Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only the first sampler showing up in ShaderMaterial Shader Param list #8353

Closed
supagu opened this issue Apr 11, 2017 · 1 comment
Closed

Comments

@supagu
Copy link
Contributor

supagu commented Apr 11, 2017

I am trying to write my own shader in godot 3, and have managed to get something partially working, but the ShaderMaterial is not showing the full set of Shader Params.

here is my shader:

shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo_2 : hint_white;
uniform sampler2D texture_albedo : hint_albedo;

//uniform sampler2D texture_colour_tint : hint_white;
//uniform sampler2D texture_terrain : hint_white;

//uniform float metalness;
//uniform float roughness : hint_range(0,1);
//uniform float point_size : hint_range(0,128);
//uniform sampler2D texture_specular : hint_white;
uniform vec2 uv1_scale;
uniform vec2 uv1_offset;
uniform vec2 uv2_scale;
uniform vec2 uv2_offset;
//uniform sampler2D texture_normal : hint_normal;
//uniform float normal_scale : hint_range(-16,16);


void vertex() {
        UV=UV*uv1_scale+uv1_offset;
}


void fragment() {
        vec4 albedo_tex = texture(texture_albedo,UV);
		vec4 albedo_tex_2 = texture(texture_albedo_2,UV);
        ALBEDO = albedo.rgb * albedo_tex.rgb * albedo_tex_2.rgb;
        //NORMALMAP = texture(texture_normal,UV).rgb;
        //NORMALMAP_DEPTH = normal_scale;
        //vec4 specular_tex = texture(texture_specular,UV);
        //SPECULAR = vec3(ALBEDO.rgb * metalness * specular_tex.r);
        //ROUGHNESS = specular_tex.a * roughness;
}

the problem is that only the first texture sampler is being displayed in the ShaderMaterial "Shader Param" list. Any other samplers are not displayed.

so texture_albedo_2 is displaying, but texture_albedo is not. The normal map and specular map were also not showing so I commented them out to try to simplify the problem.

@nunodonato
Copy link
Contributor

nunodonato commented Apr 21, 2017

I can confirm this. They seem to be working fine, as in, being used in the shader, its just that they dont show up in the inspector, so changing the textures is very hard.
Any hints on which files to start looking for this?

Edit: well it seems in the editor they work, but when running the game the 2nd texture is all white, so perhaps the problem is not just in displaying the properties in the inspector

@akien-mga akien-mga changed the title [gd3.0] Only the first sampler showing up in ShaderMaterial Shader Param list Only the first sampler showing up in ShaderMaterial Shader Param list May 18, 2017
@akien-mga akien-mga added this to the 3.0 milestone May 18, 2017
@reduz reduz closed this as completed in 2da3f48 Jun 17, 2017
groscalin pushed a commit to groscalin/godot that referenced this issue Jul 15, 2017
…), to make it more GLSL compatible

-Fixed referencing of world_transform in fragment shader not working
-Fixed unsycn bug related to getting shader param list from the server
-Fixed getting all textures from shader properly, fixes godotengine#8353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants