Godot Version
4.2.1 Stable
Question
Hello everyone!
I’m currently creating a shader that stores the vertex positions in the red and green channels of the color attribute of each vertex (so I can save the changes to disc), and the material that is used depends on the value of the blue channel (from 0-255). This is all functional and works correctly. However, when rendering the material the vertex color smoothly transitions, which makes the shader display textures in between two values.
For example, I have two vertices, where one has a blue value of 0, and the other has a blue value of 2. I intend for the two vertices to show materials 0 and 2 exclusively, but due to vertex color blending, it also has a blue value of 1 in between them because of interpolation between the two colors. This causes another material that shouldn’t be displayed, be displayed.
Is there a way to disable this in Godot or a workaround that you could do within a shader program?
Thanks for all your help!
(P.S. I have heard about flat shading in openGL, but it doesn’t seem to do anything when I turn it on in compatibility rendering mode or forward+)
Here’s a visual representation on what I have and what I want (made in blender):
Note that this is exaggerated between a blue value of 0 and 255, but I want this to work for any two values of blue.