Jump to content


  • Content count

  • Donations

    0.00 CAD 
  • Joined

  • Last visited

  • Days Won


Everything posted by Atom

  1. Houdini 15 Wishlist

    Fix the bugs that prevent R14 from working on MacMINI. I am basically stuck at R13 unless this gets done.
  2. Hi All, I am playing around with a RIB exporter to try out the Renderman system. I have some python code that exports the Matrix for objects, lights and the camera but it does not always work. I am wondering if there is some difference between the two systems that is causing the camera to point the wrong way and thus render black images sometimes. Does anyone have any example python code that would show how to export the Houdini Matrix to a Renderman Transform?
  3. Houdini Matrix to Renderman Transform?

    After reading some more on the subject I have come to the conclusion that the camera needs some additional matrix in order to function as a camera in the scene. This is still an assumption and I wish someone who actually knew this stuff would chime in on a way to proceed. So here goes. A second matrix is created based upon the screen windows settings, projection type, fov, clipping planes and aperture of the camera. def view_plane(camera_name, winx, winy, xasp, yasp): n = hou.node(camera_name) if n != None: #/* fields rendering */ ycor = yasp / xasp use_fields = False if (use_fields): ycor *= 2 # Fetch values from the named camera. nc = n.parm("near").eval() fl = n.parm("focal").eval() wx = n.parm("winx").eval() wy = n.parm("winy").eval() ap = n.parm("aperture").eval() pt = n.parm("projection").eval() # Projection type. if (pt == 1): # Orthographic proection. #/* scale == 1.0 means exact 1 to 1 mapping */ pixsize = n.parm("orthowidth").eval() elif (pt == 0): # Perspective projection. sensor_size = 32.0 #Blender default. pixsize = (sensor_size * nc) / fl else: # Unsupported projection type at this time. pixsize = 1.0 apx = ap apy = (winy * ap) / (winx * xasp) if apx > apy: # Horizontal. viewfac = winx else: # Vertical. viewfac = ycor * winy pixsize /= viewfac #/* extra zoom factor */ pixsize *= 1 #params->zoom #/* compute view plane: # * fully centered, zbuffer fills in jittered between -.5 and +.5 */ xmin = -0.5 * winx ymin = -0.5 * ycor * winy xmax = 0.5 * winx ymax = 0.5 * ycor * winy #/* lens shift and offset */ dx = wx * viewfac # + winx * params->offsetx dy = wy * viewfac # + winy * params->offsety xmin += dx ymin += dy xmax += dx ymax += dy #/* the window matrix is used for clipping, and not changed during OSA steps */ #/* using an offset of +0.5 here would give clip errors on edges */ xmin *= pixsize xmax *= pixsize ymin *= pixsize ymax *= pixsize else: xmin = 0.0 xmax = 1.0 ymin = 0.0 ymax = 1.1 return xmin, xmax, ymin, ymax def projection_matrix(camera_name): n = hou.node(camera_name) if n != None: rx = n.parm("resx").eval() ry = n.parm("resy").eval() ap = n.parm("aperture").eval() nc = n.parm("near").eval() fc = n.parm("far").eval() pr = n.parm("aspect").eval() apx = ap apy = (ry * ap) / (rx * pr) if apx > apy: aspect_ratio = apx/apy else: aspect_ratio = apy/apx left, right, bottom, top = view_plane(camera_name, rx, ry, pr, pr) farClip, nearClip = fc, nc Xdelta = right - left Ydelta = top - bottom Zdelta = farClip - nearClip ''' # Original Blender matrix mapping. mat = [[0]*4 for i in range(4)] mat[0][0] = (nearClip * 2 / Xdelta) mat[1][1] = (nearClip * 2 / Ydelta) mat[2][0] = ((right + left) / Xdelta) #/* note: negate Z */ mat[2][1] = ((top + bottom) / Ydelta) mat[2][2] = (-(farClip + nearClip) / Zdelta) mat[2][3] = -1 mat[3][2] = ((-2 * nearClip * farClip) / Zdelta) return sum([c for c in mat], []) ''' # I wonder if I have this mapping correctly? Porting this technique from a Blender script. mat = hou.Matrix4( (( nearClip * 2 / Xdelta),0,0,0, 0,(nearClip * 2 / Ydelta),0,0, ((right + left) / Xdelta),((top + bottom) / Ydelta),(-(farClip + nearClip) / Zdelta),-1, 0,0,((-2 * nearClip * farClip) / Zdelta),1) ) return mat else: return None def export_transform(file, ob_name): n = hou.node(ob_name) if n != None: if n.type().description() == 'Camera': # Special matrix output for camera. m = projection_matrix(ob_name) mtx = n.localTransform() * m else: mtx = n.worldTransform() file.write('Transform %s' % rib(mtx))
  4. Hi All, When I fetch the Matrix4 from a Houdini object I notice the numbers for rotation don't match what is displayed in the Transform panel. Does this mean Houdini is stores rotate value as radians for the Matrix?
  5. Houdini Matrix to Renderman Transform?

    I am still working on this. Does anyone understand matrix math and can explain it in working python code? I can get coordinates out to the RIB file, but they are just wrong at render time. I keep flipping axis thinking I'll just land on the right combination that works but I think I have been through all the possible combinations and there is always a flaw. I find mixed conclusions on the net as to weather or not Houdini is Left or Right handed axis system. One of the employees on the Renderman forum claims that renderman is a left-handed system. But I really don't know what that means at the math level. I do know that in all other exporters I have written that the matrix calculations are only a few lines of code. That is why I am surprised that there is not just some example code out there already. I guess this thread will become the definitive guide that Google search engines will stumble upon when other users attempt to convert Houdini coordinates to Pixar Renderman coordinate system. This python code will calculate the matrix transformation from the Houdini camera to the Pixar Renderman camera.
  6. Houdini Matrix to Renderman Transform?

    I did have a look at those files. I found some code to calculate the FOV but nothing concrete about the matrix.
  7. Houdini Matrix to Renderman Transform?

    I made a little bit of progress in trying to export coordinates to renderman. I discovered that order of operation is very important when dealing with explicit LOC/ROT/SCALE. While my render output looks much close to the viewport than the previous post I still find that certain camera angles simple don't work, I get a black render (probably because the camera is looking at nothing). I wish someone could explain what is wrong with my code or post a correction to this def. I have incorporated the detection of translation order into this revision. I also set aside a special case for the camera matrix in case I need to process it differently than the rest of the objects in the scene. def export_transform(file, ob_name): n = hou.node(ob_name) if n != None: xOrd = n.parm("xOrd").eval() # Translation Order. rOrd = n.parm("rOrd").eval() # Rotation Order. if n.type().description() == 'Camera': world_mtx = n.worldTransform() else: world_mtx = n.worldTransform() world_mtx = n.worldTransform() mMirror_XY = hou.Matrix4( (-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1) ) mtx = mMirror_XY * world_mtx * mMirror_XY pos=mtx.extractTranslates() rot=mtx.extractRotates() scl=mtx.extractScales() if xOrd == 0: # Translation order: Scale Rot Loc. file.write('Scale %f %f %f' % (scl[0],scl[1],scl[2])) if rOrd == 0: # Rotation Order: X Y Z file.write('Rotate %f %f %f %f' % (-rot[0],1,0,0)) file.write('Rotate %f %f %f %f' % (rot[1],0,1,0)) file.write('Rotate %f %f %f %f' % (rot[2],0,0,1)) else: print "WARNING:Unsupported rotation order [%s]." % rOrd file.write('Translate %f %f %f' % (-pos[0],pos[1],pos[2])) else: print "WARNING:Unsupported translation order [%s]." % xOrd
  8. Python Ldraw coding help

    Have you tried simply adding a Facet node at the end of the current results?
  9. string from relative path expression

    Have you looked at the docs? Try placing the evalAsString inside a TRY/EXCEPT or unexpand the string as the docs suggest.
  10. Houdini Matrix to Renderman Transform?

    So far my code looks like this. Each Houdini node presents 4 matrix options. I am not sure which one to use or what to swap for what? def export_transform(rib_writer, ob_name): n = hou.node(ob_name) if n != None: #mtx = n.parmTransform().inverted() #mtx = n.localTransform().inverted() #mtx = n.preTransform() #.inverted() mtx = n.worldTransform().inverted() rib_writer.emit_text('Rotate 180 0 1 0') rib_writer.emit_text('Scale -1 1 1') rib_writer.emit_text('ConcatTransform %s' % rib(mtx)) Which is kind of close. But compare the two images, one is the Houdini viewport and the pink image is the renderman result. It also looks like the sphere should be 1-y but I'm not sure how to do that with Matrix math?
  11. Hi All, I have been trying to determine what type of material I have in any given node. For instance the difference between a Clay material and a Mantra Surface. Each node does have a .shaderType() method but they both return the same value, vopnetwork... Is there any other method for distinguishing the difference between material nodes other than grunt checking for the presence or absence of parameters using TRY/EXCEPT? Thanks
  12. Determine Material Type From Python?

    Thank you, I think that can work.
  13. Hi All, I have a short python script that is running as a button the SHELF. I have some hard coded strings in my script and it would be nice to move them up one level so an end user could type in values. Can this be done with a SHELF tool or do I have to convert my tool to an HDA?
  14. Can Shelf Tool Have Parameters Panel?

    Thanks for the tips. @mantragora: The ALT-Click might be a way to go for the popup dialog. @michael: I am detecting as much as possible but this is an exporter that calls a 3rd party tool that could be installed on any drive. So some user interaction is probably required to specify where the tool is installed.
  15. Hi All, I ran across this page where Ryan Hurd uses a custom VEX shader to accomplish cross hatch shading. http://hurdfx.blogspot.fr/2005/05/vex-toon-cross-hatch.html I am trying to replicate this effect but I can't seem to figure it out. The above website describes the technique but leaves out a step-by-step which noobies like me still need. Can someone take a look at my HIP file and tell me what I have done wrong or still need to do to create this render effect? I am not sure if it is a shading issue, lighting or both? I have re-constructed the shader as best possible, it is located in the SHOP network. ap_vex_cartoon_hatch_marks.hipnc
  16. Can Shelf Tool Have Parameters Panel?

    Thanks for the link. I guess if I have to use a popup form that would be last choice. The strings in my code are more like properties that get set once depending upon the scene and OS. Then you click the button over and over to use those settings. It would be nice if the SHELF tool had a parameter sheet like nodes.
  17. Hi All, I am trying to make non-sticky UVs. Lay down a grid followed by a UV Texture then a UV Edit. With the UV Edit active select a face and move it along the X axis in the UV viewport. The four points of the face do indeed move but they drag along the faces of the neighbors vertices as well. I don't want this effect. I want each face in the UV map to be an independent 4 point entity that is not connected to a neighbor. I want to be able to move a UV box anywhere on the image and not be related to any other faces. I am still learning Houdini UVs. I wonder if I want each face to be an island...? Not sure of the terminology here. Is there a node that can already do this or does it have to be done in a FOREACH for example?
  18. Python Based Mantra to RSL?

    Hi All, I am wondering if any one has any python code that will convert a mantra surface to a RSL shader? Even a partial implementation could help? Thanks
  19. Python Based Mantra to RSL?

    Thanks for the link. After thinking about it I don't think I need to go all the way to RSL. Maybe something as simple as routine a few of the most common parameters from a Mantra Surface to an already existing ShinyPlastic or Uber shader might just do the trick.
  20. Emulating Toon Cross Hatching?

    Thanks for the feedback. I think I was expecting to see it in the viewport. Now that I have switched to the Render view I can see that it is working.
  21. Dan, care to clarify? I notice that depending upon what projection type I use the UV coordinates appear in different columns in the Geometry Sheet (i.e. Primitives or Points). Is this what you are talking about? Should I use an Attribute Promote to always shift them to Points with the Delete Originals turned on?
  22. What is the User name you are logged in as? Are there non-standard characters in your User name? Sometimes that can cause pathing issues in scripts. If so try creating another user on your system with a simple name like 'test'. After that log in as 'test' user and try the Houdini tool under that user name.
  23. Hi All, I am looking for a way to use a python node to fetch the UV coordinates for a given Primitive. I can get the uv attribute but I m not sure how to gain access to the coordinates. Does anyone have any tips or examples? Thanks
  24. Hi All, I am trying to obtain a list of Primitives that are in the current selection. Mainly right after creating a loop selection. Not sure where to begin on this one...
  25. Thank you, I think that will do it. Your above example scales all UV coordinates in half. So I am still a bit unclear about the return values from Houdini functions. The return value, coord is a tuple, I think. Is that why you need to convert explicitly to a Vector3 on the next line? When fetching attribValues is it expected to test for type of return value before assuming the variable contents?