[Godot 3] Terrain with splatmap example not working on Windows?

ConductoConducto Posts: 7Member
edited January 26 in Shaders

Hello everyone,

I've been playing around with the splatmap shader for terrains by Nuno Donato on Youtube originally for Godot 2.1:

In the comments someone posted version of the shader code for Godot 3 which works perfectly on MacOS:

`
shader_type spatial;
uniform float grassres = 1;
uniform float rockres = 1;
uniform float dirtres = 1;
uniform sampler2D grass;
uniform sampler2D rock;
uniform sampler2D dirt;
uniform sampler2D splatmap;

void fragment(){
float grassval = texture(splatmap, UV).g;
float rockval = texture(splatmap, UV).b;
float dirtval = texture(splatmap, UV).r;
vec3 grasstex = texture(grass, UVgrassres).rgb * grassval;
vec3 rocktex = texture(rock, UV
rockres).rgb * rockval;
vec3 dirttex = texture(dirt, UV*dirtres).rgb * dirtval;
vec3 result = grasstex+rocktex+dirttex;
ALBEDO = result;
}
`
But when I try it out on Windows 10 the terrain mesh just turns green and the shader does not seem to be working correctly.

I have attached the project maybe someone else can test it with Godot 3 on Windows 10 or Linux as well and tell me wether it is working or not: https://www.dropbox.com/s/bwlprpm4zaw56n1/terrain.zip?dl=0

Thanks and regards
Conducto

Answers

  • ConductoConducto Posts: 7Member

    Ok, I tested again on MacOS and it doesnt work correct anymore. It only works with the first terrain mesh that i created... now i need to find out the differences between my first terrain mesh and this one to track down the issue...

  • ConductoConducto Posts: 7Member
    Answer ✓

    Yaayy! Figured it out! After comparing the OBJ-Files in a text editor I noticed that the first had vt coordinates. Solution add a UV mapping to the mesh by unwrapping it and blender will add the vt coordinates when exporting the OBJ file. Now the shader works correctly again!

Sign In or Register to comment.