- Edited
Hi there,
I made a detail shader, it's working but lighting seems to change according to camera rotation. What could be wrong ?
`shader_type spatial;
uniform float texture1Res = 10; uniform float detailRes = 10;
uniform sampler2D texture1; uniform sampler2D texture1N; uniform sampler2D detail; uniform sampler2D detailN;
void fragment(){ //float grassval = texture(splatmap, UV).g; //float rockval = texture(splatmap, UV).b; //float dirtval = texture(splatmap, UV).r; //float grassHeight = max (grassval,rockval); //vec3 grasstex = texture(grass, UVgrassres).rgb grassHeight;
vec3 texture1Albedo = texture(texture1, UVtexture1Res).rgb 0.5; vec3 texture1Normal = texture(texture1N, UVtexture1Res).rgb 0.5;
vec3 detailAlbedo = texture(detail, UVdetailRes).rgb 0.5; vec3 detailNormal = texture(detailN, UVdetailRes).rgb 0.5;
//vec3 resultAlbedo = vertexColor.r > minvertexColor ? grasstex: rocktex;
vec3 resultAlbedo = texture1Albedo + detailAlbedo; ALBEDO = resultAlbedo;
vec3 resultNormal = texture1Normal + detailNormal; NORMAL = resultNormal;
ROUGHNESS =0.5;
}`