I've been using expression like this:
origin(“”,“../../cam1”, “TX”)-$TX
..in a point SOP to face normals in the direction of a camera, feels a little antiquated. Any tips on how I would go about this in VEX?
Set normals to point at camera, VEX
6949 11 0- AndyW
- Member
- 339 posts
- Joined: Dec. 2014
- Offline
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
- AndyW
- Member
- 339 posts
- Joined: Dec. 2014
- Offline
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
I am curious about this because I want to see by being selective of only a limited number of points having normals facing the camera,
perhaps there is some kind of effects that can be utilized indirect as a result from shading.
Once I get to playing around with cracktransform I will see if that is the function needed, or perhaps another ‘extraction’ method.
In this example the target points normals are only affected by the cameras translation values, not the resulting rotation of the camera around the object; Which hopefully can be done with some ‘extracted/cracked’ transform matrix.
perhaps there is some kind of effects that can be utilized indirect as a result from shading.
Once I get to playing around with cracktransform I will see if that is the function needed, or perhaps another ‘extraction’ method.
In this example the target points normals are only affected by the cameras translation values, not the resulting rotation of the camera around the object; Which hopefully can be done with some ‘extracted/cracked’ transform matrix.
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
- AndyW
- Member
- 339 posts
- Joined: Dec. 2014
- Offline
- AndyW
- Member
- 339 posts
- Joined: Dec. 2014
- Offline
Ok here's what seems to work best, set @orient instead of N, (cgwiki to the rescue again here http://www.tokeru.com/cgwiki/index.php?title=HoudiniVex#Convert_N_to_Orient_with_dihedral)
vector dir = normalize(chv('../../cam1/t') - @P);
vector up = {0,1,0};
matrix3 m = maketransform(dir,up);
@orient = quaternion(m);
vector dir = normalize(chv('../../cam1/t') - @P);
vector up = {0,1,0};
matrix3 m = maketransform(dir,up);
@orient = quaternion(m);
Edited by AndyW - June 6, 2019 10:43:14
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
Not sure what you were attempting to begin with.
At first you were wanting normals to point towards camera. Which worked with what I gave you last.
But you said you had issue with local z axis, but from what I see, no matter what the local z axis is the normals still point at the camera.
So I thought you meant if the camera orientation changes(the normals point at the camera, but the camera doesn't point at the object). Was this the issue?
But now your showing adding an @orient, but no normals.
Care to show a hip with your intended solution? - I think I missed what you wanted.
I was thinking if it's the camera to point at the object(not just normals at camera), just do the reverse. Use a cracktransform and lookat function for the camera.
At first you were wanting normals to point towards camera. Which worked with what I gave you last.
But you said you had issue with local z axis, but from what I see, no matter what the local z axis is the normals still point at the camera.
So I thought you meant if the camera orientation changes(the normals point at the camera, but the camera doesn't point at the object). Was this the issue?
But now your showing adding an @orient, but no normals.
Care to show a hip with your intended solution? - I think I missed what you wanted.
I was thinking if it's the camera to point at the object(not just normals at camera), just do the reverse. Use a cracktransform and lookat function for the camera.
- AndyW
- Member
- 339 posts
- Joined: Dec. 2014
- Offline
I guess I should've been more specific in that I didn't really need to deal with normals other than that being an easy way to rotate instanced or copied geometry. without an up vector the geometry tends to rotate weirdly around it's local z axis, setting an up vector and using @orient fixes that. I've never used cracktransform, I'll have to dig into that
- fgillis
- Member
- 157 posts
- Joined: July 2005
- Offline
BabaJ
So..as far as doing it by vex..this seems to be the simplest.
The following if put in a point wrangle will have normals point at camera.matrix Op_Matrix;
Op_Matrix = optransform('op:../../cam1/');
@N = (Op_Matrix * (@P - @P)) - @P;
So, here we are, five years later, and I was looking for a way to project points onto a plane so their locations matched when viewed from the same perspective camera.
Added normals using your code above, then used a ray sop to project the points onto the grid.
Worked like a charm. Thank you!
Floyd Gillis
-
- Quick Links