mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-22 05:45:38 +00:00
Small correction to lighting model in shaders. Light intensity is no longer clipped.
This commit is contained in:
parent
b57ba51e44
commit
3315fb463b
|
@ -178,7 +178,7 @@ void main(void)
|
|||
ellipse = (gl_FragCoord.xy-spotEllipse.xy)/spotEllipse.zw;
|
||||
insideSpot = dot(ellipse,ellipse);
|
||||
if ((insideSpot <= 1.0) && (fsViewZ>=spotRange.x) && (fsViewZ<spotRange.y))
|
||||
lightIntensity = min(fsLightIntensity+(1.0-insideSpot)*spotColor,1.0);
|
||||
lightIntensity = fsLightIntensity+(1.0-insideSpot)*spotColor;
|
||||
else
|
||||
lightIntensity = fsLightIntensity;
|
||||
fragColor.rgb *= lightIntensity;
|
||||
|
|
|
@ -117,7 +117,7 @@ void main(void)
|
|||
// Textured polygons: set fragment color to texel value
|
||||
{
|
||||
fragColor = texture2D(textureMap,(fsSubTexture.xy+fsSubTexture.zw/2.0)/2048.0);
|
||||
//fragColor += texture2D(textureMap,(fsSubTexture.xy+fsSubTexture.zw))/2048.0);
|
||||
//fragColor += texture2D(textureMap,(fsSubTexture.xy+fsSubTexture.zw)/2048.0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -125,12 +125,11 @@ void main(void)
|
|||
ellipse = (gl_FragCoord.xy-spotEllipse.xy)/spotEllipse.zw;
|
||||
insideSpot = dot(ellipse,ellipse);
|
||||
if ((insideSpot <= 1.0) && (fsViewZ>=spotRange.x) && (fsViewZ<spotRange.y))
|
||||
lightIntensity = min(fsLightIntensity+(1.0-insideSpot)*spotColor,1.0);
|
||||
lightIntensity = fsLightIntensity+(1.0-insideSpot)*spotColor;
|
||||
else
|
||||
lightIntensity = fsLightIntensity;
|
||||
fragColor.rgb *= lightIntensity;
|
||||
fragColor.rgb *= fsLightIntensity;
|
||||
|
||||
|
||||
// Translucency (modulates existing alpha channel for RGBA4 texels)
|
||||
fragColor.a *= fsTransLevel;
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ void main(void)
|
|||
ellipse = (gl_FragCoord.xy-spotEllipse.xy)/spotEllipse.zw;
|
||||
insideSpot = dot(ellipse,ellipse);
|
||||
if ((insideSpot <= 1.0) && (fsViewZ>=spotRange.x) && (fsViewZ<spotRange.y))
|
||||
lightIntensity = min(fsLightIntensity+(1.0-insideSpot)*spotColor,1.0);
|
||||
lightIntensity = fsLightIntensity+(1.0-insideSpot)*spotColor;
|
||||
else
|
||||
lightIntensity = fsLightIntensity;
|
||||
fragColor.rgb *= lightIntensity;
|
||||
|
|
|
@ -125,8 +125,7 @@ void main(void)
|
|||
sunFactor = max(dot(sunVector,viewNormal),0.0);
|
||||
|
||||
// Total light intensity: sum of all components
|
||||
fsLightIntensity *= (sunFactor*lighting[1].x+lighting[1].y);
|
||||
fsLightIntensity = clamp(fsLightIntensity,0.0,1.0);
|
||||
fsLightIntensity *= (sunFactor*lighting[1].x+lighting[1].y);
|
||||
}
|
||||
|
||||
// Fog
|
||||
|
|
|
@ -158,7 +158,6 @@ static const char vertexShaderSource[] =
|
|||
" \n"
|
||||
" // Total light intensity: sum of all components \n"
|
||||
" fsLightIntensity *= (sunFactor*lighting[1].x+lighting[1].y); \n"
|
||||
" fsLightIntensity = clamp(fsLightIntensity,0.0,1.0); \n"
|
||||
" } \n"
|
||||
" \n"
|
||||
" // Fog \n"
|
||||
|
@ -355,7 +354,7 @@ static const char fragmentShaderSource[] =
|
|||
" ellipse = (gl_FragCoord.xy-spotEllipse.xy)/spotEllipse.zw; \n"
|
||||
" insideSpot = dot(ellipse,ellipse); \n"
|
||||
" if ((insideSpot <= 1.0) && (fsViewZ>=spotRange.x) && (fsViewZ<spotRange.y)) \n"
|
||||
" lightIntensity = min(fsLightIntensity+(1.0-insideSpot)*spotColor,1.0); \n"
|
||||
" lightIntensity = fsLightIntensity+(1.0-insideSpot)*spotColor; \n"
|
||||
" else \n"
|
||||
" lightIntensity = fsLightIntensity; \n"
|
||||
" fragColor.rgb *= lightIntensity; \n"
|
||||
|
|
Loading…
Reference in a new issue