Jump to content

P space of VOP globalvarialbes


MENOZ

Recommended Posts

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? :unsure:

what's happen if i multiply or add a constant to P ?

Edited by MENOZ
Link to comment
Share on other sites

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? :unsure:

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.. :unsure:

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...