Shader adjustments

Clamp directional per-vertex diffuse lighting
Simplify vectors
pull/541/head
Capostrophic 6 years ago
parent c3cebbfaf6
commit e49232074b

@ -63,7 +63,7 @@ vec4 doLighting(vec3 viewPos, vec3 viewNormal, vec4 vertexColor, out vec3 shadow
lightResult.xyz += gl_FrontMaterial.emission.xyz;
#if @clamp
lightResult = clamp(lightResult, vec4(0.0, 0.0, 0.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0));
lightResult = clamp(lightResult, vec4(0.0), vec4(1.0));
#else
lightResult = max(lightResult, 0.0);
#endif

@ -98,7 +98,7 @@ void main()
#if @diffuseMap
gl_FragData[0] = texture2D(diffuseMap, adjustedDiffuseUV);
#else
gl_FragData[0] = vec4(1.0, 1.0, 1.0, 1.0);
gl_FragData[0] = vec4(1.0);
#endif
#if @detailMap
@ -117,7 +117,13 @@ void main()
float shadowing = unshadowedLightRatio();
#if !PER_PIXEL_LIGHTING
#if @clamp
gl_FragData[0] *= clamp(lighting + vec4(shadowDiffuseLighting * shadowing, 0), vec4(0.0), vec4(1.0));
#else
gl_FragData[0] *= lighting + vec4(shadowDiffuseLighting * shadowing, 0);
#endif
#else
gl_FragData[0] *= doLighting(passViewPos, normalize(viewNormal), passColor, shadowing);
#endif

@ -69,7 +69,13 @@ void main()
float shadowing = unshadowedLightRatio();
#if !PER_PIXEL_LIGHTING
#if @clamp
gl_FragData[0] *= clamp(lighting + vec4(shadowDiffuseLighting * shadowing, 0), vec4(0.0), vec4(1.0));
#else
gl_FragData[0] *= lighting + vec4(shadowDiffuseLighting * shadowing, 0);
#endif
#else
gl_FragData[0] *= doLighting(passViewPos, normalize(viewNormal), passColor, shadowing);
#endif

@ -170,7 +170,7 @@ void main(void)
vec2 screenCoords = screenCoordsPassthrough.xy / screenCoordsPassthrough.z;
screenCoords.y = (1.0-screenCoords.y);
vec2 nCoord = vec2(0.0,0.0);
vec2 nCoord = vec2(0.0);
#define waterTimer osg_SimulationTime
@ -186,7 +186,7 @@ void main(void)
if (rainIntensity > 0.01)
rainRipple = rainCombined(position.xy / 1000.0,waterTimer) * clamp(rainIntensity,0.0,1.0);
else
rainRipple = vec4(0.0,0.0,0.0,0.0);
rainRipple = vec4(0.0);
vec3 rippleAdd = rainRipple.xyz * rainRipple.w * 10.0;

Loading…
Cancel
Save