Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.73k stars 159 forks source link

Textures are not working, even low poly paint #311

Open Suchys22 opened 2 years ago

Suchys22 commented 2 years ago

Hiii, i have problem. I followed many tutorials but still my textures doesn't show up, i can't paint them or interact with them. I tried changing shader type but no-one works. After that i used lo poly and i can't paint even color on it

Zylann commented 2 years ago

What steps are you taking? What do you mean "interact"? What is your version of Godot? Which graphics card do you have? Are you using GLES2 or GLES3? Which shader did you try? Did you get errors in the console? Please note some shaders expect you to use texture arrays instead of classic textures, while others do not support textures at all.

veksha commented 2 years ago

@Suchys22 try the following trick, tell me if it works for you.

edit these files at location addons/zylann.hterrain/tools/brush/shaders. old lines are commented out.

color.shader:

//vec4 col = vec4(mix(src.rgb, u_color.rgb, brush_value * u_factor), src.a);
vec4 col = vec4(mix(src.rgb, u_color.rgb, brush_value), src.a);

splat4.shader:

//float brush_value = u_opacity * texture(TEXTURE, UV).r * u_factor;
float brush_value = u_opacity * texture(TEXTURE, UV).r;

basically you take u_factor out of the equation.

veksha commented 2 years ago

@Zylann my texture and color painting brushes break after i use the following tools: image to fix broken texture/color brushes I may select the first brush (Raise height) and use it on terrain. or I can modify shaders (above trick) and all seem to work without breaking.

info: image GLES3 Windows 11 x64

Zylann commented 2 years ago

I dont remember why I commented this https://github.com/Zylann/godot_heightmap_plugin/blob/3202df62303b8ea14aca5cc443b9e746339aa089/addons/zylann.hterrain/tools/brush/terrain_painter.gd#L531 , I need to check the Git history later. If the line is not needed maybe it needs to be brought back with setting the value to 1.0, rather than changing the shader, because it might be used in other cases.

veksha commented 2 years ago

I may be mistaken but I think shader parameters must be set to default on tool switch. it can be that setting of one tool pollutes the other.

Zylann commented 2 years ago

It shouldn't reset the settings (would be another matter), but it should reset the shader's parameters, which is basically done by assigning them all when configuring the shaders in paint functions, and if the parameter isnt used in a particular mode, it should be set to a default value.

Zylann commented 2 years ago

Turns out u_factor was commented due to the commit adding support for pen pressure, it got superseded with a more general u_opacity parameter. So it sounds like some shaders should not need the parameter anymore.

Zylann commented 2 years ago

Should be fixed in 60874838ed444746176758938707d08ab15e37c6