Prevent interpolation of value from VS to PS

Started by
1 comment, last by BFG 7 years, 4 months ago

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

Advertisement

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

Note that "nointerpolation" uses the value from the first vertex of a primitive. If that doesn't work for you, then the "normal" approach is to duplicate vertices.

This topic is closed to new replies.

Advertisement