I have a SceneKit fragment shader where I need to make some decisions about the alpha value based on an interpolated value between the vertexes. At each vertex there is a value and I need to know what the interpolated value for the given position that the fragment shader is determining the color for. Is there a way to do this?
This is what my shader looks like.
#pragma arguments
float myInterpolatedVlaue;
#pragma transparent
#pragma body
//Sample logic. The actual logic has more too it.
if (myInterpolatedVlaue > 1.0 ) {
_output.color.a = 0;
}
I want to set a value at each vertex and then get the interpolated value in my fragment shader. I would like to have myInterpolatedVlaue
be set based on the interpolated values from the value at each vertex.