Fix rim lighting math.

This commit is contained in:
Mari the Deer 2022-05-08 13:12:51 +02:00
commit a480e1649f
3 changed files with 4 additions and 4 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.17 \cu(Sun 8 May 01:10:55 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.2.17 \cu(2022-05-08 01:10:55)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.18 \cu(Sun 8 May 13:14:40 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.2.18 \cu(2022-05-08 13:14:40)\c-";

View file

@ -20,7 +20,7 @@ void SetupMaterial( inout Material mat )
vec2 uv2 = vec2(atan(rvec.z,abs(rvec.x))*RECIPROCAL_PI2+.5,asin(rvec.y)*RECIPROCAL_PI2+.5);
vec3 envcol = textureGrad(tex,uv,dFdx(uv2),dFdy(uv2)).rgb*ENVFACT;
#ifdef RIM_LIGHTING
float rim = smoothstep(RIMSTEP,1.,1.-clamp(dot(eye,norm),0.,1.));
float rim = smoothstep(RIMSTEP,1.,1.-abs(dot(eye,norm)));
vec3 rimcol = texture(rimtex,vec2(.25+.5*rim,.5)).rgb;
envcol = mix(envcol,rimcol,rim*RIMFACT);
#endif

View file

@ -22,7 +22,7 @@ void SetupMaterial( inout Material mat )
vec2 uv2 = vec2(atan(rvec.z,abs(rvec.x))*RECIPROCAL_PI2+.5,asin(rvec.y)*RECIPROCAL_PI2+.5);
vec3 envcol = textureGrad(envtex,uv,dFdx(uv2),dFdy(uv2)).rgb*ENVFACT;
#ifdef RIM_LIGHTING
float rim = smoothstep(RIMSTEP,1.,1.-clamp(dot(eye,norm),0.,1.));
float rim = smoothstep(RIMSTEP,1.,1.-abs(dot(eye,norm)));
vec3 rimcol = texture(rimtex,vec2(.25+.5*rim,.5)).rgb;
envcol = mix(envcol,rimcol,rim*RIMFACT);
#endif