Getting point position with parenting

   1188   4   0
User Avatar
Member
63 posts
Joined: July 2018
Offline
I'm trying to calculate facing ratio at SOP level as an attribute to feed into a shading network for a character (for reasons that don't matter here, I need to do this in SOPs and not in the shader itself). I wrote a basic bit of VEX to calculate the facing ration, but if the object is transformed at the object level or parented, it doesn't work because it's grabbing the point position prior to parenting and object level transformations, which are likely to occur in animation.

I thought I could use ow_space() but that doesn't seem to work (possibly because parent transforms are done after SOP level calculations?). Any way to grab point positions that will take object-level transforms into account?
madebygeoff.com
User Avatar
Member
8621 posts
Joined: July 2007
Offline
v@worldP = ptransform("space:world", v@P);
similarly
v@worldN = ntransform("space:world", v@N);
Edited by tamte - Aug. 16, 2022 21:19:25
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8621 posts
Joined: July 2007
Offline
also to get facing ratio you can transform your N to camera space directly
vector cam_N = ntransform("/obj/cam1", v@N);

f@facing_ratio = abs(dot({0,0,-1}, normalize(cam_N)));
Edited by tamte - Aug. 16, 2022 21:27:55
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2 posts
Joined: Aug. 2022
Offline
First of all, i'm not really good at houdini, but i just can't get my head around one thing and get it to work the way i want. So, for some reason popnet node (with popvop turb noise) doesn't work when i try and move it from the origin. I'm attaching a video for a showcase

https://youtu.be/-NnRkzqXKu0 [youtu.be]

I'm using a wrangle node with expression (v@v = v@P), but it clearly doesn't work when i move my geo. So instead I've tried using other expression(v@v = v@N) and it gives me that radial velocity but popvop turb noise doesn't work and i can't get that nice effect i got at the very beginning.

I know I can just animate the thing afterwards but I want particles to actually move and react to the movement of a sphere and not just stay still like a solid geometry. PLEASE HELP.
In summary all i want to do is to get the same effect the i got at the very beginning, but to be able to move it around. That's all. If you can help, tell me exactly what to do because I'm new to Houdini
User Avatar
Member
63 posts
Joined: July 2018
Offline
Tomas, thanks for that. Super helpful. And the facing ratio trick: never would have thought of that.
madebygeoff.com
  • Quick Links