How to set Shader material as default material and auto apply textures to that material? #206
Replies: 2 comments 6 replies
|
Yes, in your map settings, set your default material there. You will then want to set the Default Material Albedo Uniform to map to your albedo for your shader. You can also add additional textures with the Shader Material Uniform Map Patterns in there too. This is covered in the textures page of the documentation. |
|
You shouldn't need to rename it. For the albedo uniform, it automatically detects the texture, you just need to set the albedo uniform so it matches 1:1 with the uniform for the shader material. Behind the scenes it is calling set_shader_parameter(). You would only need to rename your textures if you wanted to apply multiple uniforms. When doing that it pattern matches. As an example say we have the pattern %s_n to mark normal maps. If we had a texture named texture.png, it will also try to match texture_n.png and then apply it as a shader parameter to whatever key it has. For your usecase with only an albedo uniform this isn't important. |




You shouldn't need to rename it. For the albedo uniform, it automatically detects the texture, you just need to set the albedo uniform so it matches 1:1 with the uniform for the shader material. Behind the scenes it is calling set_shader_parameter().
You might need to rename the albedo uniform to be texture_albedo in your shader(iirc that's what it matches against. @RhapsodyInGeek can probably confirm)I'm misremembering, you just set the uniform value to match what it is in your shader.https://docs.godotengine.org/en/stable/classes/class_shadermaterial.html#class-shadermaterial-method-set-shader-parameter
You would only need to rename your textures if you wanted to apply multiple unifor…