 # MirrorSword

Members

38

• #### Last visited

• Birthday 03/20/1989

## Contact Methods

• Website URL
www.jameslittlejohn.com

## Personal Information

• Name
James Littlejohn
• Location
San Mateo, CA

## MirrorSword's Achievements 13

### Reputation

2. Hey, I think you can just turn the velocity into a float4, make sure the last component is zero, and then multiply it by the matrix. (As it says here in the docs). However I'm not a master at matrix math so I might be missing something. edit: re-read the help doc I linked and it said that when transforming a normal you want to multiply it by the inverted transpose of the matrix. but it seems like a velocity would just be transformed as a regular vector. However It would be interesting to know why you do one thing with a vector and another with a normal. edit2: Looks like you use the inverted transpose so that the normals will stay perpendicular to the surface. (as explained here). edit3: I did a test and I'm pretty sure that for a velocity vector you want to use the vector rules and not the normal rules.
3. Pixar has a tiny bit of information about how they did the bread in ratatouille. Might be a good place to start. https://renderman.pixar.com/view/pixar-ratatouille-shading-food
4. To remove the delta volume you need to create a blast node with the group parameter set to @name="delta" . I've attached a fixed version of your hip file. sop_solver_multi-out_v2.hipnc
5. You're close, you just need to use a slightly different expression. Firstly, vex expressions don't use capitalized variable names. Secondly, the life attribute is the life span of the particle, so use @age or @nage. See these pages for more info. Writing Particle Vex Expressions Particle Attributes
6. I remember reading that Houdini saves the JOB env with the hip file. But it sounds like you want it to automatically update to whatever env you have set in your shell. Maybe you could add something to you 456.py to reset the JOB env. Something like this maybe. import hou import os hou.putenv("JOB",os.environ["JOB"])
7. So you don't need to do anything specific with the rotations, the matrix math takes care of that. I think I updated your example to do what you want, but I had to add an extra null so I would have an original position to reference. (Hip file Attached) import math node = hou.pwd() n1 = hou.node("/obj/null1") n2 = hou.node("/obj/null2") if n1 and n2: mtx = n1.worldTransform() distance = node.parm("dist").eval() v = hou.Vector3(0,0,1) direction = v.normalized() vector = direction * distance translate_matrix = hou.hmath.buildTranslate(vector) mtx = translate_matrix * mtx n2.setWorldTransform(mtx) Also I'm not sure what you were trying to do here: v = hou.Vector3(rx, ry, rz) direction = v.normalized() vector = direction * distance translate_matrix = hou.hmath.buildTranslate(vector) but it seems like you are making a mistake with how you treat rotations. You can't convert a rotation into a vector by just plugging the x,y,z rotations into the x,y,z components of a vector as they represent completely different things. If you want to create a vector that is relative to a rotation, you should do it by first creating the vector in local space then rotating it by a matrix. Like so: v1 = hou.Vector4(2,0,0,0) rx = 30 ry = 30 rz = 30 mtx = hou.hmath.buildRotate((rx,ry,rz),"xyz") v2 = v1 * mtx v2 = hou.Vector3(v2) print v2 ap_project_along_rotation_v2.hiplc
8. I believe my code actually does what you want. Note the order of the matrix multiplication. "translation_matrix * mtx" constructs a matrix that will first transform the object with the translate_matrix and then transform the object with the original object matrix (mtx). So in my example it should move the object along the local x-axis, not the world x-axis. If the matrix multiplication was reversed ("mtx * translate_matrix") then the code would behave incorrectly and translate in world space instead of object space.
9. I'm not 100% sure I understand what you are looking for. But here are some ideas. This will move it relative to object space with a distance and normalized direction. n = hou.node("/obj/geo1") if n: mtx = n.worldTransform() distance = 2 direction = hou.Vector3(1,0,0).normalized() vector = direction * distance translate_matrix = hou.hmath.buildTranslate(vector) mtx = translate_matrix * mtx n.setWorldTransform(mtx) To summarize this, you get a distance and a normalized direction, and then multiply them together to make your offset vector. Then you use that vector to build a matrix that translates along that vector. Then you multiply that matrix with your objects matrix. This has the effect of moving the object relative to object space. Alternatively if you just want a velocity vector that is transformed by your objects matrix you can do it with the following: n = hou.node("/obj/geo1") if n: v1 = hou.Vector4(2,0,0,0) mtx = n.worldTransform() v2 = v1 * mtx v2 = hou.Vector3(v2) print v2 (v1 needs to be a vector4 with a zero as the 4th component so that it is transformed as a velocity and not as a position, as explained here)
10. You can construct a matrix that represents this x-axis transform and then multiply that matrix by the original transform. n = hou.node("/obj/geo1") if n: mtx = n.worldTransform() translate_x = hou.hmath.buildTranslate((2,0,0)) mtx = translate_x * mtx n.setWorldTransform(mtx)
11. Well lookat doesn't actually rotate vector A on to vector B. it rotates the Z-Axis onto the vector formed from the "From" position to the "To" position. Lookat also allows an up vector.
12. I'm not sure why that's not working for you, but my own technique for running batch renders is a bit different. All of the code for hrender is actually in the file hrender.py and you can run this script with hython and it will work just like the linux command. so I just make my own hrender.cmd like so. @echo off "C:\Program Files\Side Effects Software\Houdini 15.0.347\bin\hython" "C:\Program Files\Side Effects Software\Houdini 15.0.347\bin\hrender.py" %* If I put that hrender.cmd somewhere in my system PATH env, then I can just call hrender from command prompt with out needing to use csh. So maybe try that and see if it works. Good Luck!
13. Hi Atom, If you want to do it with python you could look into the parmTemplateGroup class. I've used that to add spare parameters to nodes. However, if you want to do it by hand you could just copy and paste the parameters from the "edit parameter interface" window.
14. So I made an example of how I would accomplish that task. If you check out this page. You'll see that the "rot" attribute is a final rotation applied after all the other rotations. So if your points have "v" and "rot" attributes, the objects will first be rotated in the direction of the velocity and then rotated by the "rot" quaternion. I also calculate the "rot" attribute before the particle system so that it won't change during the simulation (although it shouldn't matter for this example). to calculate the rot attribute I use the point number to create a random vector within the range 0 to 1 and then remap it to the range -1 to 1. I then normalize that and use "look at" to convert it to a matrix that points in that direction, and then finally convert that matrix to a quaternion. There's probably a better way to calculate that but this works. Anyway let me know if you have any questions. rotate_in_copy_v2.hip
15. The problem is that not all nodes support those per point local variable. From the help docs on the color node: So you just need to use a Point sop instead of the color sop.
×