1
0
Fork 0

WS30: Improved ambient color

Previous we just applied gl_LightSource[0].ambient without
multiplying it by the texture itself, so it just lightened
everything.

This fixes that.  (ws30-ALS-detailed.frag still to do)
This commit is contained in:
Stuart Buchanan 2021-11-05 19:55:05 +00:00
parent baba195a36
commit bf55997a56
3 changed files with 3 additions and 3 deletions

View file

@ -119,7 +119,7 @@ void main()
vec4 mat_diffuse = texture(diffuseArray, index);
vec4 mat_specular = texture(specularArray, index);
vec4 color = gl_Color + mat_diffuse * NdotL * gl_LightSource[0].diffuse;
vec4 color = mat_diffuse * (gl_Color + NdotL * gl_LightSource[0].diffuse);
// Testing code:
// Use rlc even when looking up textures to recreate the extra performance hit

View file

@ -41,7 +41,7 @@ void main()
// Different textures have different have different dimensions.
// Dimensions array is scaled to fit in [0...1.0] in the texture1D, so has to be scaled back up here.
vec4 color = texture(diffuseArray, float(lc)/512.0) * NdotL * gl_LightSource[0].diffuse;
vec4 color = texture(diffuseArray, float(lc)/512.0) * (gl_LightSource[0].ambient + NdotL * gl_LightSource[0].diffuse);
vec4 specular = texture(specularArray, float(lc)/512.0);
vec2 atlas_dimensions = 10000.0 * texture(dimensionsArray, float(lc)/512.0).st;
vec2 atlas_scale = vec2(tile_width / atlas_dimensions.s, tile_height / atlas_dimensions.t );

View file

@ -40,7 +40,7 @@ void main()
// Different textures have different have different dimensions.
// Dimensions array is scaled to fit in [0...1.0] in the texture1D, so has to be scaled back up here.
vec4 color = texture(diffuseArray, float(lc)/512.0) * NdotL * gl_LightSource[0].diffuse;
vec4 color = texture(diffuseArray, float(lc)/512.0) * (gl_LightSource[0].ambient + NdotL * gl_LightSource[0].diffuse);
vec4 specular = texture(specularArray, float(lc)/512.0);
vec2 atlas_dimensions = 10000.0 * texture(dimensionsArray, float(lc)/512.0).st;
vec2 atlas_scale = vec2(tile_width / atlas_dimensions.s, tile_height / atlas_dimensions.t );