Atom Posted April 27, 2015 Share Posted April 27, 2015 (edited) Hi All, I am trying to calculate the "from" "to" parameters for a Renderman light shader using the Houdini matrix information. The "from" is easy, it is simply the location extracted from the matrix. n = hou.node(light_name) if n != None: mtx = n.worldTransform() # from pos=mtx.extractTranslates() It is the "to" value that I am having trouble with. I realize I need to use the rotation information projected along a vector to produce a new location but I am not quite sure how to do that using Houdini Python. Here is an example I found in some Blender python code accomplishing the same task. How would I translate that to Houdini based Python? m = ob.matrix_world loc = m.to_translation() lvec = loc - (m.to_quaternion() * mathutils.Vector((0,0,1))) Edited April 27, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
Atom Posted May 3, 2015 Author Share Posted May 3, 2015 I tried rotating it right but it did not work. Does anyone know how to calculate the "from" "to" parameters for a Renderman light shader using the Houdini matrix information? Quote Link to comment Share on other sites More sharing options...
Atom Posted May 7, 2015 Author Share Posted May 7, 2015 Can someone help with this it has been over a week and I still need to accomplish this goal. Where is the begging emoticon...? Quote Link to comment Share on other sites More sharing options...
symek Posted May 7, 2015 Share Posted May 7, 2015 n = hou.node(light_name) if n != None: mtx = n.worldTransform() # from pos=mtx.extractTranslates() # to direction = hou.Vector3((0, 0, -1)) * mtx # and depending on your needs evantually: lookat = pos + direction I'm not sure if vector should be pointed backwards though but this is easy fix anyway. Quote Link to comment Share on other sites More sharing options...
Atom Posted May 29, 2015 Author Share Posted May 29, 2015 Thank you Symek, I am finally getting back to this task. Your code example helps a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.