diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-14 00:11:19 +0100 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-14 00:11:19 +0100 |
commit | 79e4a8c28ad29b028ddb907a6ea01f4ef71e822a (patch) | |
tree | 5addab6a1cad0d8545d5fbe6cfb3907c264591a3 /indra/newview/app_settings | |
parent | 057dda6afe59791f4a6fcf4c5ca8387b8aeda6a8 (diff) |
Fix up atmospheric helpers and transport shader for adv atmo path.
Basic hook-up of sky settings to llatmosphere model.
Moved mie aniso to be a top-level setting instead of a per-mie-layer setting.
Diffstat (limited to 'indra/newview/app_settings')
4 files changed, 53 insertions, 44 deletions
diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl index db8ec71b35..fee1a7f311 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl @@ -22,9 +22,12 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + +vec3 getAdditiveColor(); +vec3 getAtmosAttenuation(); uniform sampler2D cloudMap; +uniform vec4 gamma; uniform vec4 cloud_pos_density1; uniform vec4 lightnorm; uniform vec4 sunlight_color; @@ -41,26 +44,29 @@ uniform vec4 glow; uniform float scene_light_strength; uniform mat3 ssao_effect_mat; -vec3 getAdditiveColor(); -vec3 getAtmosAttenuation(); -vec3 getAdditiveColor(); -vec3 getAtmosAttenuation(); -void setPositionEye(vec3); -vec3 getPositionEye(); -vec3 getSunlitColor(); -vec3 getAmblitColor(); -vec3 getAdditiveColor(); -vec3 getAtmosAttenuation(); -void setPositionEye(vec3 v); -void setSunlitColor(vec3 v); -void setAmblitColor(vec3 v); -void setAdditiveColor(vec3 v); -void setAtmosAttenuation(vec3 v); +vec3 scaleFragSoftClip(vec3 light) +{ + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + return light; +} -void calcFragAtmospherics(vec3 inPositionEye, float ambFactor) { +vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) +{ + light *= atten.r; + light += additive; + return (2.0 * light); +} + +vec3 atmosLighting(vec3 light) +{ + return atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation()); +} + +void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) { vec3 P = inPositionEye; - setPositionEye(P); vec3 tmpLightnorm = lightnorm.xyz; @@ -98,7 +104,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor) { temp1 = exp(-temp1 * temp2.z * distance_multiplier); //final atmosphere attenuation factor - setAtmosAttenuation(temp1.rgb); + atten = temp1.rgb; //compute haze glow //(can use temp2.x as temp because we haven't used it yet) @@ -129,20 +135,14 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor) { tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); //haze color - setAdditiveColor( + additive = vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient) - + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x - + tmpAmbient))); + + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x + + tmpAmbient)); //brightness of surface both sunlight and ambient - setSunlitColor(vec3(sunlight * .5)); - setAmblitColor(vec3(tmpAmbient * .25)); - setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); + sunlit = vec3(sunlight * .5); + amblit = vec3(tmpAmbient * .25); + additive *= vec3(1.0 - temp1); } -vec3 atmosLighting(vec3 light) -{ - light *= getAtmosAttenuation().r; - light += getAdditiveColor(); - return (2.0 * light); -} diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl index c064023858..3270c243a4 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl @@ -49,7 +49,7 @@ uniform float distance_multiplier; uniform float max_y; uniform vec4 glow; -void calcAtmospherics(vec3 inPositionEye, float ambFactor) { +void calcAtmospherics(vec3 inPositionEye) { vec3 P = inPositionEye; setPositionEye(P); @@ -118,7 +118,7 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) { * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); */ - tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); + //tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); //haze color setAdditiveColor( diff --git a/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl index c71eaf4b13..08b6ec3f97 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl @@ -49,16 +49,16 @@ void main() { vec3 view_direction = normalize(view_dir); - vec3 camPos = cameraPosLocal; + vec3 camPos = cameraPosLocal + vec3(0, 0, 6360.0f); vec3 transmittance; vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); - radiance *= transmittance; + //radiance *= transmittance; // If the view ray intersects the Sun, add the Sun radiance. if (dot(view_direction, sun_direction) >= sun_size.y) { - radiance = radiance + transmittance * GetSolarLuminance(); + radiance = radiance + (transmittance * GetSolarLuminance()); } vec3 color = vec3(1.0) - exp(-radiance); diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl index 8a8e4cb0f6..82e1d7fe35 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -33,21 +33,30 @@ vec3 getAtmosAttenuation(); uniform sampler2D cloudMap; uniform vec4 cloud_pos_density1; -vec3 atmosTransport(vec3 light) { - light *= getAtmosAttenuation().r; - light += getAdditiveColor() * 2.0; +vec3 atmosFragTransport(vec3 light, vec3 atten, vec3 additive) { + light *= atten.r; + light += additive * 2.0; return light; } -vec3 fullbrightAtmosTransport(vec3 light) { +vec3 fullbrightFragAtmosTransport(vec3 light, vec3 atten, vec3 additive) { float brightness = dot(light.rgb, vec3(0.33333)); - - return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); + return mix(atmosFragTransport(light.rgb, atten, additive), light.rgb + additive.rgb, brightness * brightness); } -vec3 fullbrightShinyAtmosTransport(vec3 light) { +vec3 fullbrightFragShinyAtmosTransport(vec3 light, vec3 atten, vec3 additive) { float brightness = dot(light.rgb, vec3(0.33333)); + return mix(atmosFragTransport(light.rgb, atten, additive), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); +} - return mix(atmosTransport(light.rgb), (light.rgb + getAdditiveColor().rgb) * (2.0 - brightness), brightness * brightness); +vec3 atmosTransport(vec3 light) { + return atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor()); } +vec3 fullbrightAtmosTransport(vec3 light) { + return fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); +} + +vec3 fullbrightShinyAtmosTransport(vec3 light) { + return fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); +} |