Copy link to clipboard
Copied
Hello everyone, I have spent hours trying to understand why my shader paints the model green no matter what texture information I give it as input, and thats why I am here maybe someone can help me.
All the shader does is takes material in the shader settings and puts information from that material's user0 channel into sampler2D variable named AM_channel_user0
//: materials [
//: {
//: "id": "AM",
//: "default": "Concrete 044",
//: "size": 1024,
//: "group": "Tiles"
//: }
//: ]
//: param auto AM.channel_user0
uniform sampler2D AM_channel_user0;
In the shade function I sample the color using texture function and output the result using
void shade(V2F inputs) {
SparseCoord uv1 = getSparseCoord(inputs.multi_tex_coord[0]);
vec2 myUV = uv1.tex_coord;
vec4 baseColor3 = texture(AM_channel_user0, myUV);
vec3 baseColor2 = baseColor3.xyz;
diffuseShadingOutput(baseColor2);
}
the result however is not as expected, and the only correct information about color is in baseColor2.x and baseColor2.y is much brighter than it should be and baseColor2.z is just black.
If I change channel_user0 to channel_basecolor in shader and in material, I get somewhat good result: The colors are fine but the whole model appears a bit brighter than when looking channel basecolor separately.
To be clear the green appears only in "Material" view mode because this is the only output i have in the shader.
The texture itself is also not the problem, since I tried diffrent textures and even basic color.
Have something to add?