kursad Posted May 24, 2010 Share Posted May 24, 2010 (edited) Hi I have started working on a shader. I can normally get what I want by creating a vector by substracting position "P" from position "eye". I also wanted to use the "I" variable described as "direction from eye to surface". But when I use it as part of a dot product I am not getting anything close to what I think I should be expecting. As you can see from the picture the upper example is wrong, and the bottom one is right. I thought that the "I" variable was same as Renderman`s "I" variable thanks Edited May 24, 2010 by kursad Quote Link to comment Share on other sites More sharing options...
anim Posted May 24, 2010 Share Posted May 24, 2010 why do you complement the I value? complement is 1-X i suppose you wanted to use Negate VOP it'll work then Quote Link to comment Share on other sites More sharing options...
kursad Posted May 24, 2010 Author Share Posted May 24, 2010 anim, thanks for the reply. Yeah you are right I thought the complement would work I guess Ok negate does the trick. Thanks again Quote Link to comment Share on other sites More sharing options...
old school Posted May 25, 2010 Share Posted May 25, 2010 Just to complete the thread, I is indeed the vector from the camera to the current shade point. The wrong direction to compute the dot product with the surface normal. You need to negate the I vector so that it is a new vector going from the shade point to the Eye. Finally you need to normalize both the negated I and the surface normal or your dot product won't return a sensible value (unless that is what you want). The I vector holds the distance from the Camera to the current shade point as it's magnitude. Quote Link to comment Share on other sites More sharing options...
kursad Posted May 25, 2010 Author Share Posted May 25, 2010 Just to complete the thread, I is indeed the vector from the camera to the current shade point. The wrong direction to compute the dot product with the surface normal. You need to negate the I vector so that it is a new vector going from the shade point to the Eye. Finally you need to normalize both the negated I and the surface normal or your dot product won't return a sensible value (unless that is what you want). The I vector holds the distance from the Camera to the current shade point as it's magnitude. old school, thanks for the tip, I did not know about the length aspect of that vector 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.