Sign in to follow this  
PhillipHamlyn

Prevent interpolation of value from VS to PS

Recommended Posts

Hi,

 

I pass in an array of textures into my shader, with a vertex value ("textureIndex") indicating which texture from the array should be used to paint that particular vertex. If my triangle has vertexes which have different selection values the textureIndex is interpolated across the face of the triangle and my PS gets a whole "rainbow" of indexes across the triangle, instead of just the two possible values I want to paint.

 

Is there any way of instructing the PS how to interpolate values ?

 

If my verexes have textureIndex of 1,5,5 on my triangle I'd wish my PS to get either 1 or 5 but not 1,2,3,4,5 (and all floats inbetween).

 

If I'm simply doing things a weird way, that would also be a great answer :-)

 

Phillip

Share this post


Link to post
Share on other sites

you might want to check out these links:

 

https://msdn.microsoft.com/en-us/library/windows/desktop/bb509668(v=vs.85).aspx

 

and

 

https://msdn.microsoft.com/en-us/library/windows/desktop/bb509647(v=vs.85).aspx

 

I think what your looking for is the "nointerpolation" interpolation modifier

Edited by iedoc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this