//Vertex shader
o.baseWorldPos = unity_ObjectToWorld._m03_m13_m23;
//Frag shader
fixed4 col = fixed4(1,0,0,1);
if (i.baseWorldPos.x >= 0.5 && i.baseWorldPos.y >= 0.5 && i.baseWorldPos.z >= 0.5) {
col = fixed4(i.baseWorldPos.x,i.baseWorldPos.y,i.baseWorldPos.z,1);
}
so in my vertex shader, i grab the meshes world position, and based on tests using the if statement in this code i can confirm that the value matches the position of the model in world space in the game/editor. If the objects xyz are all below 0.5, it draws in a full red color, if not then it becomes a color based on the positions as it should. So we know that the position being passed in is correct.
The problem is, the color that is generated based of this position, is something entirely different. When I set the positions so that each xyz = 0.51, you would expect to get a color of rgb = 0.51, but instead i get rgb = 0.7411.
does anyone have any idea why this is the case?