diff --git a/pi3d/shaders/std_bump.inc b/pi3d/shaders/std_bump.inc index 6515874b..e36ef186 100644 --- a/pi3d/shaders/std_bump.inc +++ b/pi3d/shaders/std_bump.inc @@ -7,6 +7,9 @@ bump.y *= -1.0; // unib[3][2] ([11] in python) is used to adjust the strength of normal map textures - float bfact = unib[3][2] * (1.0 - smoothstep(100.0, 600.0, dist)); // ------ attenuate smoothly between 100 and 600 units + float bfact = unib[3][2]; + if (is_3d > 0.0) { + bfact *= (1.0 - smoothstep(100.0, 600.0, dist)); // ------ attenuate smoothly between 100 and 600 units + } float intensity = clamp(dot(lightVector, normalize(vec3(0.0, 0.0, 1.0) + bump * bfact)) * lightFactor, 0.0, 1.0); // ------ adjustment of colour according to combined normal texc.rgb = (texc.rgb * unif[9]) * intensity + (texc.rgb * unif[10]); // ------ directional lightcol * intensity + ambient lightcol diff --git a/pi3d/shaders/std_head_fs.inc b/pi3d/shaders/std_head_fs.inc index 8c6f5ffe..02178d45 100644 --- a/pi3d/shaders/std_head_fs.inc +++ b/pi3d/shaders/std_head_fs.inc @@ -12,5 +12,6 @@ uniform vec3 unif[20]; varying float dist; varying float fog_start; +varying float is_3d; //fragcolor \ No newline at end of file diff --git a/pi3d/shaders/std_head_vs.inc b/pi3d/shaders/std_head_vs.inc index 32854b30..4b7723dc 100644 --- a/pi3d/shaders/std_head_vs.inc +++ b/pi3d/shaders/std_head_vs.inc @@ -17,3 +17,4 @@ uniform vec3 unif[20]; varying float dist; varying float fog_start; +varying float is_3d; diff --git a/pi3d/shaders/std_main_vs.inc b/pi3d/shaders/std_main_vs.inc index ea447740..47951cf4 100644 --- a/pi3d/shaders/std_main_vs.inc +++ b/pi3d/shaders/std_main_vs.inc @@ -28,3 +28,5 @@ uvec.y, vvec.y, -normout.y, 0.0, uvec.z, vvec.z, -normout.z, 0.0, 0.0, 0.0, 0.0, 1.0) * vec4(lightVector, 0.0)); + + is_3d = abs(modelviewmatrix[0][3][3] - modelviewmatrix[1][3][3]);