1
0
Fork 0

WS30: Fix WS30 fragment shaders

This commit is contained in:
Stuart Buchanan 2021-08-21 17:15:15 +01:00
parent 3b5a079470
commit a442615c68
5 changed files with 11 additions and 7 deletions

View file

@ -282,6 +282,7 @@
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>

View file

@ -19,7 +19,7 @@ uniform sampler2D perlin;
varying float yprime_alt;
varying float mie_angle;
varying vec4 ecPosition;
uniform float visibility;
uniform float avisibility;
@ -47,6 +47,7 @@ vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float luminance(vec3 color)
{
@ -74,7 +75,7 @@ void main()
vec4 mat_diffuse = texture(diffuseArray, mat_index);
vec4 mat_specular = texture(specularArray, mat_index);
vec4 color = mat_diffuse;
vec4 color = mat_diffuse * NdotL * gl_LightSource[0].diffuse;
float effective_scattering = min(scattering, cloud_self_shading);
@ -126,6 +127,7 @@ void main()
texel = texture(atlas, vec3(st, lc));
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
// here comes the terrain haze model
float delta_z = hazeLayerAltitude - eye_alt;

View file

@ -26,6 +26,7 @@ varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
varying float yprime_alt;
varying float mie_angle;
@ -78,7 +79,7 @@ void main()
// this code is copied from default.vert
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;

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;
vec4 color = texture(diffuseArray, float(lc)/512.0) * 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 );
@ -58,7 +58,7 @@ void main()
texel = texture(atlas, vec3(st, lc));
fragColor = texel + pow(NdotHV, gl_FrontMaterial.shininess) * gl_LightSource[0].specular * specular;
fragColor = color * texel + pow(NdotHV, gl_FrontMaterial.shininess) * gl_LightSource[0].specular * specular;
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;

View file

@ -40,14 +40,14 @@ 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;
vec4 color = texture(diffuseArray, float(lc)/512.0) * 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 );
texel = texture(atlas, vec3(atlas_scale * gl_TexCoord[0].st, lc));
fragColor = texel + pow(NdotHV, gl_FrontMaterial.shininess) * gl_LightSource[0].specular * specular;
fragColor = color * texel + pow(NdotHV, gl_FrontMaterial.shininess) * gl_LightSource[0].specular * specular;
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;