1
0
Fork 0

Add clustered shading support to most Effects and shaders

This commit is contained in:
Fernando García Liñán 2020-12-22 10:52:59 +01:00
parent a058bed4d5
commit b3237e207a
57 changed files with 139 additions and 31 deletions

View file

@ -6,6 +6,14 @@
<use-shadow-pass>csm1</use-shadow-pass>
<use-shadow-pass>csm2</use-shadow-pass>
<use-shadow-pass>csm3</use-shadow-pass>
<clustered-shading>
<tile-size>128</tile-size>
<depth-slices>1</depth-slices>
<num-threads>1</num-threads>
<condition>
<property>/sim/rendering/clustered-shading/enabled</property>
</condition>
</clustered-shading>
<binding>
<buffer>sun-shadowmap-atlas</buffer>
<unit>10</unit>

View file

@ -252,6 +252,7 @@
<fragment-shader>Shaders/secondary_lights.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>grain_strength</name>

View file

@ -147,6 +147,7 @@
<fragment-shader>Shaders/secondary_lights.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>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>

View file

@ -81,6 +81,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

@ -97,6 +97,7 @@
<fragment-shader>Shaders/secondary_lights.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>intrinsic_wetness</name>

View file

@ -93,6 +93,7 @@
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/crop.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>NoiseTex</name>

View file

@ -148,6 +148,7 @@
<fragment-shader n="4">Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader n="5">Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader n="6">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="7">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>

View file

@ -151,6 +151,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>colorMode</name>
@ -433,7 +434,8 @@
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/default.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
</program>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
</program>
<!--<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -166,6 +166,7 @@
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>

View file

@ -162,6 +162,7 @@
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>

View file

@ -140,6 +140,7 @@
<fragment-shader>Shaders/secondary_lights.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>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>

View file

@ -162,6 +162,7 @@
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>

View file

@ -450,7 +450,8 @@ please see Docs/README.model-combined.eff for documentation
<fragment-shader n="4">Shaders/noise.frag</fragment-shader>
<fragment-shader n="5">Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader n="6">Shaders/shadows-include.frag</fragment-shader>
</program>
<fragment-shader n="7">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>BaseTex</name>
@ -1519,7 +1520,8 @@ please see Docs/README.model-combined.eff for documentation
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/ubershader.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
</program>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>BaseTex</name>
@ -2114,7 +2116,8 @@ please see Docs/README.model-combined.eff for documentation
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/ubershader.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
</program>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>BaseTex</name>

View file

@ -137,6 +137,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

@ -109,6 +109,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

@ -148,6 +148,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>
@ -565,6 +566,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

@ -457,7 +457,8 @@
<fragment-shader n="5">Shaders/noise.frag</fragment-shader>
<fragment-shader n="6">Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader n="7">Shaders/shadows-include.frag</fragment-shader>
</program>
<fragment-shader n="8">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>BaseTex</name>
@ -1550,6 +1551,7 @@
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/ubershader.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>

View file

@ -315,6 +315,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>
<attribute>
<name>tangent</name>
<index>6</index>

View file

@ -97,6 +97,7 @@
<fragment-shader>Shaders/secondary_lights.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>intrinsic_wetness</name>

View file

@ -213,6 +213,7 @@
<fragment-shader n="5">Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader n="6">Shaders/lightspot-ALS.frag</fragment-shader>
<fragment-shader n="7">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="8">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>
@ -1046,7 +1047,8 @@
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/runway.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
<attribute>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>

View file

@ -330,6 +330,7 @@
<fragment-shader>Shaders/secondary_lights.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>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
@ -982,6 +983,7 @@
<fragment-shader>Shaders/hazes.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>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
@ -1300,6 +1302,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>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>
@ -1561,6 +1564,7 @@
<fragment-shader>Shaders/default.frag</fragment-shader>
<fragment-shader>Shaders/include_fog.frag</fragment-shader>
<fragment-shader>Shaders/shadows-include.frag</fragment-shader>
<fragment-shader>Shaders/clustered-include.frag</fragment-shader>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>

View file

@ -160,6 +160,7 @@
<fragment-shader>Shaders/secondary_lights.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>
<attribute>
<name>orthophotoTexCoord</name>
<index>14</index>

View file

@ -251,6 +251,7 @@ parameters :
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/transition.frag</fragment-shader>
<fragment-shader n="2">Shaders/shadows-include.frag</fragment-shader>
<fragment-shader n="3">Shaders/clustered-include.frag</fragment-shader>
</program>
<uniform>

View file

@ -10,7 +10,7 @@ varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -93,6 +93,7 @@ vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
// a fade function for procedural scales which are smaller than a pixel
@ -453,6 +454,7 @@ if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0))
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
float lightArg = (terminator-yprime_alt)/100000.0;
vec3 hazeColor = get_hazeColor(lightArg);

View file

@ -9,6 +9,7 @@ varying vec3 relPos;
varying vec3 worldPos;
varying vec2 rawPos;
varying vec3 ecViewdir;
varying vec4 ecPosition;
varying vec2 orthoTexCoord;
@ -83,6 +84,7 @@ vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float detail_fade (in float scale, in float angle, in float dist)
@ -336,6 +338,7 @@ if (quality_level > 3)
color.rgb +=secondary_light * light_distance_fading(dist);
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
float lightArg = (terminator-yprime_alt)/100000.0;

View file

@ -22,6 +22,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
varying float yprime_alt;
varying float mie_angle;
@ -120,7 +121,7 @@ void main()
// this code is copied from default.vert
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
//gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
@ -287,7 +288,7 @@ else // the faster, full-day version without lightfields
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
gl_Position = gl_ModelViewProjectionMatrix * vertex;
setupShadows(gl_ModelViewMatrix * vertex);
setupShadows(ecPosition);
}

View file

@ -10,7 +10,7 @@ varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec4 ecPosition;
varying float steepness;
@ -84,6 +84,7 @@ vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
{
@ -427,6 +428,7 @@ if ((dist < 5000.0) && (combined_wetness>0.0))
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
float lightArg = (terminator-yprime_alt)/100000.0;
vec3 hazeColor = get_hazeColor(lightArg);

View file

@ -25,6 +25,7 @@ vec3 fog_Func(vec3 color, int type);
//////////////////////
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
void main (void)
{
@ -71,6 +72,7 @@ void main (void)
c1 *= ambient_light;
vec4 finalColor = c1;
finalColor.rgb += getClusteredLightsContribution(ecPosition.xyz, VNormal, basecolor.rgb);
// if(gl_Fog.density == 1.0)
// fogFactor=1.0;

View file

@ -6,6 +6,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
uniform sampler2D texture;
uniform sampler2D orthophotoTexture;
@ -19,6 +20,7 @@ vec3 fog_Func(vec3 color, int type);
//////////////////////
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float luminance(vec3 color)
{
@ -67,6 +69,7 @@ void main()
}
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;

View file

@ -21,6 +21,7 @@ attribute vec2 orthophotoTexCoord;
varying vec4 diffuse_term;
varying vec3 normal;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
uniform int colorMode;
@ -35,6 +36,7 @@ void setupShadows(vec4 eyeSpacePos);
void main()
{
gl_Position = ftransform();
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;
normal = gl_NormalMatrix * gl_Normal;
@ -64,5 +66,5 @@ void main()
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
//fogCoord = abs(ecPosition.z / ecPosition.w);
//fog_Func(fogType);
setupShadows(gl_ModelViewMatrix * gl_Vertex);
setupShadows(ecPosition);
}

View file

@ -8,6 +8,7 @@ varying vec3 normal;
varying vec3 relPos;
varying vec2 rawPos;
varying vec3 ecViewdir;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -84,6 +85,7 @@ vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
void main()
@ -319,7 +321,7 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
color.rgb +=secondary_light * light_distance_fading(dist);
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
float lightArg = (terminator-yprime_alt)/100000.0;

View file

@ -24,6 +24,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
varying float yprime_alt;
varying float mie_angle;
@ -142,7 +143,7 @@ void main()
gl_Position = gl_ModelViewProjectionMatrix * pos;
//do the colour and fog
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

View file

@ -23,6 +23,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
//varying float fogCoord;
varying vec4 ecPosition;
uniform int colorMode;
uniform float osg_SimulationTime;
@ -107,7 +108,7 @@ void main()
gl_Position = gl_ModelViewProjectionMatrix * pos;
//do the colour and fog
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;

View file

@ -189,6 +189,7 @@ void main (void)
c1 *= ambient_light;
vec4 finalColor = c1;
finalColor.rgb += getClusteredLightsContribution(ecPosition.xyz, VNormal, basecolor.rgb);
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;

View file

@ -25,6 +25,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;
@ -77,7 +78,7 @@ void main()
// this code is copied from default.vert
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;
@ -244,7 +245,7 @@ else // the faster, full-day version without lightfields
gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0;
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
setupShadows(gl_ModelViewMatrix * gl_Vertex);
setupShadows(ecPosition);
}

View file

@ -6,7 +6,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -57,6 +57,7 @@ vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float luminance(vec3 color)
{
@ -147,6 +148,7 @@ void main()
texel = texture2D(texture, gl_TexCoord[0].st);
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
float lightArg = (terminator-yprime_alt)/100000.0;

View file

@ -120,6 +120,7 @@ vec3 moonlight_perception (in vec3 light) ;
vec3 addLights(in vec3 color1, in vec3 color2);
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
@ -505,6 +506,8 @@ void main (void)
fragColor += Specular * nmap.a;
fragColor.rgb += getClusteredLightsContribution(vertVec, N, texel.rgb);
//////////////////////////////////////////////////////////////////////
// BEGIN lightmap
//////////////////////////////////////////////////////////////////////

View file

@ -247,5 +247,5 @@ void main(void)
//gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
setupShadows(gl_ModelViewMatrix * vertex);
setupShadows(ecPosition);
}

View file

@ -6,6 +6,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -63,6 +64,7 @@ vec3 flashlight(in vec3 color, in float radius);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float luminance(vec3 color)
{
@ -173,6 +175,7 @@ void main()
texel = texture2D(texture, gl_TexCoord[0].st);
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
// implicit lightmap - the user gets to select

View file

@ -22,6 +22,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
varying float yprime_alt;
varying float mie_angle;
@ -76,7 +77,7 @@ void main()
// this code is copied from default.vert
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
@ -243,6 +244,6 @@ else // the faster, full-day version without lightfields
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
if (shadow_mapping_enabled) {
setupShadows(gl_ModelViewMatrix * gl_Vertex);
setupShadows(ecPosition);
}
}

View file

@ -7,6 +7,7 @@ varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec3 rawpos;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -79,6 +80,7 @@ vec3 flashlight(in vec3 color, in float radius);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float luminance(vec3 color)
{
@ -205,6 +207,8 @@ void main()
fragColor = color * texel;
fragColor.rgb += specular.rgb;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
// implicit lightmap - the user gets to select a color which is then made emissive
if (implicit_lightmap_enabled == 1)

View file

@ -23,6 +23,7 @@ varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec3 rawpos;
varying vec4 ecPosition;
varying float yprime_alt;
varying float mie_angle;
@ -86,7 +87,7 @@ void main()
// this code is copied from default.vert
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
normal = gl_NormalMatrix * gl_Normal;
@ -301,7 +302,7 @@ else // the faster, full-day version without lightfields
gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0;
if (shadow_mapping_enabled) {
setupShadows(gl_ModelViewMatrix * gl_Vertex);
setupShadows(ecPosition);
}
}

View file

@ -6,6 +6,7 @@
varying vec4 diffuse_term;
varying vec3 normal;
varying vec3 relPos;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -85,6 +86,7 @@ vec3 flashlight(in vec3 color, in float radius);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float luminance(vec3 color)
{
@ -308,6 +310,7 @@ void main()
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
// explicit lightmap

View file

@ -114,6 +114,7 @@ vec3 filter_combined (in vec3 color) ;
vec3 addLights(in vec3 color1, in vec3 color2);
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
@ -625,7 +626,7 @@ void main (void)
fragColor += Specular * nmap.a;
fragColor.rgb += getClusteredLightsContribution(vertVec, N, texel.rgb);
//////////////////////////////////////////////////////////////////////
// BEGIN procedural lightmap

View file

@ -9,7 +9,7 @@ varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec4 ecPosition;
varying float steepness;
@ -85,6 +85,7 @@ vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
{
@ -486,6 +487,7 @@ if ((dist < 5000.0) && (combined_wetness>0.0))
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
float lightArg = (terminator-yprime_alt)/100000.0;
vec3 hazeColor = get_hazeColor(lightArg);

View file

@ -9,6 +9,7 @@ varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -74,6 +75,7 @@ vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
void main()
@ -343,7 +345,7 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
color.rgb +=secondary_light * light_distance_fading(dist) + lightspot(relPos);
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb + (2.0 * N.r + 0.1 * (noise_01m-0.5))* (1.0 - water_factor)) ;
float lightArg = (terminator-yprime_alt)/100000.0;

View file

@ -10,6 +10,7 @@ varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 vViewVec;
varying vec3 reflVec;
varying vec3 vertVec;
varying vec4 Diffuse;
varying float alpha;
@ -39,6 +40,7 @@ vec3 fog_Func(vec3 color, int type);
//////////////////////
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
void main (void)
{
@ -130,6 +132,8 @@ void main (void)
vec4 fragColor = vec4(color.rgb * mixedcolor.rgb + ambient_Correction.rgb * (1.0 - refl_correction * (1.0 - 0.8 * lightness)) * nFactor, color.a);
fragColor += Specular * nmap.a * nFactor;
fragColor.rgb += getClusteredLightsContribution(vertVec, N, texel.rgb);
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
gl_FragColor = fragColor;
}

View file

@ -11,6 +11,7 @@ varying vec3 VBinormal;
varying vec3 Normal;
varying vec3 vViewVec;
varying vec3 reflVec;
varying vec3 vertVec;
varying vec4 Diffuse;
varying float alpha;
@ -56,7 +57,7 @@ void main(void)
alpha = gl_Color.a;
// Vertex in eye coordinates
vec3 vertVec = ecPosition.xyz;
vertVec = ecPosition.xyz;
vViewVec.x = dot(t, vertVec);
vViewVec.y = dot(b, vertVec);

View file

@ -15,6 +15,7 @@ uniform sampler2D orthophotoTexture;
varying float yprime_alt;
varying float mie_angle;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
uniform float visibility;
@ -40,6 +41,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)
{
@ -99,6 +101,7 @@ void main()
}
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);

View file

@ -9,7 +9,7 @@ varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec2 orthoTexCoord;
varying vec4 eyePos;
uniform sampler2D texture;
@ -61,6 +61,7 @@ vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
void main()
@ -338,6 +339,7 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(eyePos.xyz, n, texel.rgb);
// here comes the terrain haze model

View file

@ -27,6 +27,7 @@ varying vec3 relPos;
varying vec2 rawPos;
varying vec3 worldPos;
varying vec2 orthoTexCoord;
varying vec4 eyePos;
varying float mie_angle;
@ -88,7 +89,7 @@ void main()
float scattering;
rawPos = gl_Vertex.xy;
vec4 eyePos = gl_ModelViewMatrix * gl_Vertex;
eyePos = gl_ModelViewMatrix * gl_Vertex;
worldPos = (osg_ViewMatrixInverse * eyePos).xyz;
steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0));

View file

@ -11,6 +11,7 @@ varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec2 grad_dir;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
uniform sampler2D texture;
@ -93,6 +94,7 @@ vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
// a fade function for procedural scales which are smaller than a pixel
@ -497,6 +499,8 @@ if ((dist < 5000.0) && (combined_wetness>0.0))
fragColor = color * texel + specular;
fragColor.rgb += getClusteredLightsContribution(ecPosition.xyz, n, texel.rgb);
float lightArg = (terminator-yprime_alt)/100000.0;
vec3 hazeColor = get_hazeColor(lightArg);

View file

@ -29,6 +29,7 @@ varying vec3 worldPos;
varying vec3 ecViewdir;
varying vec2 grad_dir;
varying vec2 orthoTexCoord;
varying vec4 ecPosition;
varying float mie_angle;
varying float steepness;
@ -110,7 +111,7 @@ void main()
// this code is copied from default.vert
//vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
//gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
orthoTexCoord = orthophotoTexCoord;
@ -296,7 +297,7 @@ if (use_IR_vision)
gl_FrontColor.a = mie_angle;
gl_BackColor.a = mie_angle;
setupShadows(gl_ModelViewMatrix * gl_Vertex);
setupShadows(ecPosition);
}

View file

@ -9,6 +9,7 @@ varying float RawPosZ;
varying vec3 WorldPos;
varying vec3 normal;
varying vec3 Vnormal;
varying vec4 eyePos;
uniform float SnowLevel;
uniform float Transitions;
@ -35,6 +36,7 @@ vec3 fog_Func(vec3 color, int type);
//////////////////////
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
void main()
{
@ -159,6 +161,7 @@ void main()
}
vec4 fragColor = diffuseColor * texel + specular;
fragColor.rgb += getClusteredLightsContribution(eyePos.xyz, n, texel.rgb);
if(cover >= 2.5){
fragColor.rgb = fragColor.rgb * 1.2;

View file

@ -9,6 +9,7 @@
varying float RawPosZ;
varying vec3 WorldPos;
varying vec4 eyePos;
varying vec3 normal;
varying vec3 Vnormal;
@ -19,7 +20,7 @@ void setupShadows(vec4 eyeSpacePos);
void main()
{
RawPosZ = gl_Vertex.z;
vec4 eyePos = gl_ModelViewMatrix * gl_Vertex;
eyePos = gl_ModelViewMatrix * gl_Vertex;
WorldPos = (osg_ViewMatrixInverse * eyePos).xyz;
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

View file

@ -66,6 +66,7 @@ vec3 fog_Func(vec3 color, int type);
////////////////////////////////////
float getShadowing();
vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel);
//////rotation matrices/////////////////////////////////////////////////////////
@ -262,6 +263,8 @@ void main (void)
fragColor += Specular * nmap.a;
fragColor.rgb += getClusteredLightsContribution(eyeVec, N, texel.rgb);
//////////////////////////////////////////////////////////////////////
// BEGIN lightmap
//////////////////////////////////////////////////////////////////////

View file

@ -58,6 +58,9 @@ Started September 2000 by David Megginson, david@megginson.com
<enabled type="bool" userarchive="y">false</enabled>
<sun-atlas-size type="int" userarchive="y">2048</sun-atlas-size>
</shadows>
<clustered-shading>
<enabled type="bool" userarchive="y">false</enabled>
</clustered-shading>
<photoscenery>
<enabled type="bool" userarchive="y">false</enabled>
</photoscenery>