MENOZ Posted May 3, 2008 Share Posted May 3, 2008 (edited) P, in the global variables VOP, is the position of the point being shaded on the surface. right? it's in world space? camera space? what's happen if i multiply or add a constant to P ? Edited May 3, 2008 by MENOZ Quote Link to comment Share on other sites More sharing options...
Jason Posted May 3, 2008 Share Posted May 3, 2008 P, in the global variables VOP, is the position of the point being shaded on the surface. right? it's in world space? camera space? what's happen if i multiply or add a constant to P ? It's a position in "cuurent" space - which is camera space. You can transform it with a Transform VOP (or ToNDC VOP). In a surface shader you cannot modify P, but in a displacement shader you can. Quote Link to comment Share on other sites More sharing options...
MENOZ Posted May 4, 2008 Author Share Posted May 4, 2008 (edited) i get these results. why this happens? is there another way to do this effect? refl.hipnc Edited May 4, 2008 by MENOZ Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 5, 2008 Share Posted May 5, 2008 i get these results.why this happens? Why what happens? What results did you expect? is there another way to do this effect? What effect? What are you trying to do and how exactly is it not working? As Jason said, P is in camera space by default, if you transform it (or anything based on it, like a reflection vector), then things will "move". This is expected behaviour. What's the problem, exactly? Quote Link to comment Share on other sites More sharing options...
MENOZ Posted May 5, 2008 Author Share Posted May 5, 2008 i multiplied the global P by a constant, but i don't understand how the reflection vector is calculated based on such multiplied P. multiplying P for a constant it's like add a shell to my objcet? i can't visualize the idea.. the effect i want is to magnify a reflection, but i'm not shure this is a correct method. thank you all for your time! Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 5, 2008 Share Posted May 5, 2008 the effect i want is to magnify a reflection, but i'm not shure this is a correct method. Modifying P will generally affect reflection. Exactly *how* it gets affected depends on the function being used. For example, calling the two-parameter version of reflectlight() will use P implicitly (and so reflection will be affected), whereas the environment() function will not be affected, since it is only dependent on the direction vector. However, any environment maps included in a reflectlight() call (via the "environment" optional parameter) will be affected by a change in P. And of course, all tracing into the scene (as supposed to an environment map) will definitely be affected by a change in P. Amplifying a reflection (of the scene) could be done by reducing the apparent size of the object. You could try moving P into the object (along -N) and tracing from there. Here's an untested quick sketch of what I mean: surface test ( float amplify = 0; // Amount to "amplify" reflections by float bias = 0.01; // Tracing bias ) { vector Nf = normalize(frontface(N,I)); // Front-facing normal vector Pr = P - (Nf * amplify); // Modified origin of reflection vector Ir = Pr-Eye; // Modified reflection incidence vector R = reflect(Ir,Nf); // Reflection direction // Calculate scene reflections vector Rscene = reflectlight(Pr,R,bias,1); Cf = Rscene; } HTH. 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.