hoknamahn Posted October 27, 2006 Share Posted October 27, 2006 Hi guys, How to calculate an intersection of some vector in the point (SOP context) with the NDC plane (or with the plane which can represent the NDC)? Say I have some piece of geometry and some vectors on the points, for example normals. I want to continue that normals to intersection with NDC. I know there is no NDC in the SOP context but it is possible to create the plane which can represent it in some way. Any suggestions? Quote Link to comment Share on other sites More sharing options...
sho Posted October 27, 2006 Share Posted October 27, 2006 Hi, hoknamahn You can use toNDC() in OP context. Something like, Pndc = toNDC(camera, P); Nndc = toNDC(camera, P+N) - toNDC(camera, P); Though I'm not sure if there is VOP node, you can use InlineVOP. Cheers, Sho Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted October 27, 2006 Author Share Posted October 27, 2006 Hi, hoknamahnYou can use toNDC() in OP context. Something like, Pndc = toNDC(camera, P); Nndc = toNDC(camera, P+N) - toNDC(camera, P); Though I'm not sure if there is VOP node, you can use InlineVOP. Cheers, Sho Is it well defined? Because I see in the help: Transforms a position into normal device coordinates. This space is only well-defined for the Displacement, Surface, and Light contexts. Quote Link to comment Share on other sites More sharing options...
sho Posted October 27, 2006 Share Posted October 27, 2006 Well, I don't know what does "well defined" mean... But, when I used it long time ago to generate some attributes for sprite, it worked fine for me. Just one thing I remember is the "P" needs to be object space even if the object is transformed. I might be completely wrong though... Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted October 27, 2006 Author Share Posted October 27, 2006 Well, I don't know what does "well defined" mean...But, when I used it long time ago to generate some attributes for sprite, it worked fine for me. Just one thing I remember is the "P" needs to be object space even if the object is transformed. I might be completely wrong though... Okay I will check it. Thanks Sho. Quote Link to comment Share on other sites More sharing options...
Jason Posted October 28, 2006 Share Posted October 28, 2006 Okay I will check it. Thanks Sho. Hi there, This might help you a bit: http://odforce.net/tips/velocity.htm Quote Link to comment Share on other sites More sharing options...
MADjestic Posted October 28, 2006 Share Posted October 28, 2006 Hi there,This might help you a bit: http://odforce.net/tips/velocity.htm Oh, Jason, great data, thanks for the link. I know it has been there for long, but first like >50% of it was too sophisticated and tech for a newbe, now I can re-explore some of the key-concepts. Thanks for this kicker. Quote Link to comment Share on other sites More sharing options...
old school Posted October 28, 2006 Share Posted October 28, 2006 Sho is correct in that you have to be sure that global P is in world space when using the default toNDC() in the SOP context. Reworked vel_blur slightly so that it will compile in H8.1: void toNDC(vector p; float zoom) { float z; z = zoom / p.z; p *= set(z, z, 1); p += {0.5, 0.5, 0}; } sop vel_blur(matrix camera=1; float focal=50, aperture=42) { float zoom; vector p0, p1; vector screenV; zoom = focal/aperture; p0 = P; p1 = P + v; p0 *= camera; p1 *= camera; toNDC(p0, zoom); toNDC(p1, zoom); } Quote Link to comment Share on other sites More sharing options...
MADjestic Posted October 28, 2006 Share Posted October 28, 2006 Oh, good, old school, thanks. Sexy stuff. 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.