Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | atorresm | |
Old Version | Published before Godot 3 was released. |
Hi!
I have generated a simple map using a MeshInstance containing a PlainMesh. As a shader, I apply the following:
shader_type spatial;
render_mode cull_disabled;
uniform sampler2D tex;
void vertex() {
vec2 xz = VERTEX.xz;
float h = texture(tex, UV).g * 10.0;
VERTEX = vec3(xz.x, h, xz.y);
}
Where tex
is a heightmap I generated using GIMP. With this, I get the following (I added an OmniLight to show the current state):
(Wireframe mode to clarify)
This is the effect I want to achieve:
As you can see, each triangle has an only one color.
I imagine I have to apply something in the shader regarding fragment or lighting, but I don’t really know how to get around it.
Thanks in advance!