Open scrapp08 opened 1 year ago
I tried running your MRP, but it doesn't do anything no matter what. It seems the shader relies on a "terrain color" texture which is not present and MeshGen.mesh()
always returns 0 and 12. Could you please upload an MRP that highlights your issue?
In particular, you should have a shader that actually changes its output depending on the uniforms. Right now changing the uniform changes nothing in the shader, so it is impossible to determine if the uniform is being set correctly or not
For example, if I change your fragment function to:
void fragment() {
float height = vertex_y;
float position = inverse_lerp(min_height, max_height, height);
vec3 colour = texture(terrain_colour, vec2(position, 0)).rgb;
ALBEDO = colour;
if (max_height > 1.0) {
ALBEDO = vec3(0.0);
}
}
And reload the project, the mesh appears black because max_height is larger than 0 (it is 12).
The issue is that the shader_parameter is still not set to 12, visible when stepping through in debug mode.
Updated MRP with variable min & max heights: Test.zip
The issue is that the shader_parameter is still not set to 12, visible when stepping through in debug mode.
Visible where? In the debugger itself?
Yes, in the debugger click on material then have a look at the parameters, you'll see that min_height and max_height don't change.
Okay, so to clarify and summarize what I think I am hearing from you.
Is that correct?
Not just in the debugger, but when looking at the shader parameters in the inspector they also do not update, so I've got no way of knowing if the values have actually changed or not, hence I titled this set_shader_parameter() not working.
Godot version
4.1.1
System information
MacOS 13.5 - M1 Pro
Issue description
I can see that the parameter has an integer value inside of the debugger, however when setting the shader parameter that value does not set.
Steps to reproduce
Open project, set a breakpoint towards the start of the
shader()
function. Step through and observe the values of min_height and max_height, and the parameters inside of material.Minimal reproduction project
Test.zip