Process SohoGeometry faster, tips

   2121   4   1
User Avatar
Member
460 posts
Joined: July 2005
Offline
Hi
I'm writing a renderer and exporting the geo to the format I need takes
the most time specially with geometry with millions of points of course

I think there was a post a while back about this, to process the geometry faster
can't find it

any tips?
use numpy maybe?
an external C++ parser maybe?

any tips are welcome

thanks
varomix - Founder | Educator @ Mix Training
Technical Artist @ Meta Reality Labs
User Avatar
Member
2529 posts
Joined: June 2008
Offline
Here are some basic python tips…http://stackoverflow.com/questions/27384093/fastest-way-to-write-huge-data-in-file [stackoverflow.com] I would say the take away is to write chunks directly to the disk and try to avoid joins.

I put together a minor RIB exporter a while back. Mainly a Shelf Tool button, not SOHO. Interrogating the scene and preparing ASCII output can be the slowest part for an external renderer.


Is this for your Cycles ROP WIP?
Edited by Enivob - Feb. 16, 2017 16:56:09
Using Houdini Indie 20.0
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
460 posts
Joined: July 2005
Offline
Yeah is for my Cycles ROP

looping the geometry is the slowest part not really writing to disk
that's what I want to make faster

right now having issues with matrix stuff damn camera doesn't match

thanks
varomix - Founder | Educator @ Mix Training
Technical Artist @ Meta Reality Labs
User Avatar
Member
2529 posts
Joined: June 2008
Offline
Here is some code exploration I did on the camera matrix when writing a .RIB exporter.
        
    n = hou.node(camera_name)
    if n != None:
        fl = n.parm("focal").eval()
        fu = n.parm("focalunits").eval() 
        ap = n.parm("aperture").eval()
        nc = n.parm("near").eval()
        fc = n.parm("far").eval() 
        ic = n.parm("iconscale").eval()
        rx = n.parm("resx").eval()
        ry = n.parm("resy").eval() 
        pr = n.parm("aspect").eval()
        sh = n.parm("shutter").eval()
        fd = n.parm("focus").eval() 
        st = n.parm("fstop").eval()
        mtx = n.parmTransform()
        delight_matrix = hou.Matrix4( (0,0,1,0, 0,-1,0,0, 1,0,0,0, 0,0,0,1) ) # Swap X<->Z, Y negative.
        mtx = mtx * delight_matrix
        pos=mtx.extractTranslates()
        rot=mtx.extractRotates()
        scl=mtx.extractScales()
         safe_node_name = n.name().replace("/","_")
        file.write('#-> Camera %s\n' % safe_node_name)     
        #file.write('DepthOfField %f 1.0 %f\n' % (st, fc))
        #file.write('Shutter %f %f\n' % (rm.shutter_open, rm.shutter_close))
        #file.write('Option "shutter" "efficiency" [ %f %f ] \n' % (rm.shutter_efficiency_open, rm.shutter_efficiency_close))
        file.write('Clipping %f %f\n' % (nc,fc))
        #fov = 2 * math.degrees(math.atan(16.0 /(aspect * self.camera.lens))) #Blender
        file.write('Projection "perspective" "fov" [%f]\n' % fl)

I broke my exporter into separate sections. For instance I would fetch all top level Geometry nodes then get their children and look for the display flag. Then I would execute the saveToFile() method on that to generate a .obj version of that geometry network on disk.
# Export geo based objects as OBJ files.
lst_geo_objs = []
lst_mat_counts = []
nodes = childrenOfNode(hou.node(node_root_path),["Object geo"])                         #Other valid filters are Sop, Object, cam.
for node in nodes:
    ary = node.split("~")
    if len(ary) > 0:
        node_candidate = "%s/%s" % (node_root_path, ary[0])
        n = hou.node(node_candidate)
        if n !=None:
            if n.isDisplayFlagSet():
                mat_count = exportAsOBJ(node_candidate, geo_dir, current_frame)
                lst_geo_objs.append(node_candidate)
                lst_mat_counts.append(mat_count)

Does Cycles read any native model format? Like .obj, .ply, .stl etc…? If so, the saveToFile() might speed up some export operations.
Using Houdini Indie 20.0
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
460 posts
Joined: July 2005
Offline
I'm not sure it reads any external formats but it should, just need to code it
varomix - Founder | Educator @ Mix Training
Technical Artist @ Meta Reality Labs
  • Quick Links