diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-01 00:10:11 +0100 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-01 00:10:11 +0100 |
commit | 3116416fcb8dfd54ef2807e9e75959429c946d79 (patch) | |
tree | 5fe7a724ac283796faff1e8bfdc2602238047deb /indra/newview/app_settings/shaders | |
parent | 21ddbd64af44672e4b20dc4cdf99fd1fbc5c07c2 (diff) |
Le Merge
Diffstat (limited to 'indra/newview/app_settings/shaders')
3 files changed, 43 insertions, 16 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 0223f94e55..5185a9f8f4 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -29,11 +29,12 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif +in vec3 view_pos; in vec3 view_dir; uniform vec3 cameraPosLocal; -uniform vec3 sun_direction; -uniform vec2 sun_size; +uniform vec3 sun_dir; +uniform float sun_size; uniform sampler2D cloud_noise_texture; uniform sampler2D transmittance_texture; @@ -50,20 +51,35 @@ void main() { vec3 view_direction = normalize(view_dir); + vec3 sun_direction = sun_dir; + vec3 camPos = cameraPosLocal + vec3(0, 0, 6360.0f); vec3 transmittance; + vec3 sky_illum; vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); + vec3 radiance2 = GetSunAndSkyIlluminance(camPos, view_direction, sun_direction, sky_illum); + + radiance *= transmittance; + + vec3 solar_luminance = transmittance * GetSolarLuminance(); // If the view ray intersects the Sun, add the Sun radiance. - if (dot(view_direction, sun_direction) >= sun_size.y) + if (dot(view_direction, sun_direction) >= sun_size) { - radiance = radiance + (transmittance * GetSolarLuminance()); + radiance = radiance + solar_luminance; } - vec3 color = vec3(1.0) - exp(-radiance); - color = pow(color, vec3(1.0 / 2.2)); + vec3 color = radiance; + + color = vec3(1.0) - exp(-color * 0.0001); + + //float d = dot(view_direction, sun_direction); + //frag_color.rgb = vec3(d, d >= sun_size ? 1.0f : 0.0f, 0.0f); frag_color.rgb = color; + //frag_color.rgb = vec3(dot(view_direction, sun_direction) > 0.95f ? 1.0 : 0.0, 0,0); + frag_color.rgb = normalize(view_pos); + frag_color.a = 1.0; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl index 52a7595379..cf3eb658fc 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl @@ -23,21 +23,29 @@ * $/LicenseInfo$ */ +uniform vec3 cameraPosLocal; uniform mat4 modelview_projection_matrix; +uniform mat4 modelview_matrix; +uniform mat4 inv_proj; +uniform mat4 inv_modelview; ATTRIBUTE vec3 position; // Inputs uniform vec3 camPosLocal; +out vec3 view_pos; out vec3 view_dir; void main() { - // World / view / projection - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + // pass through untransformed fullscreen pos (clipspace) + gl_Position = vec4(position.xyz, 1.0); + + view_pos = (inv_proj * vec4(position, 1.0f)).xyz; // this will be normalized in the frag shader... - view_dir = position.xyz - camPosLocal.xyz; + //view_dir = (inv_modelview * view_pos).xyz; + view_dir = view_pos - camPosLocal; } diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl index 014ab9d11b..fed3edf7de 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl @@ -32,12 +32,13 @@ out vec4 frag_color; in vec3 view_dir; uniform vec3 cameraPosLocal; -uniform vec3 sun_direction; +uniform vec3 sun_dir; uniform float sun_size; uniform sampler2D transmittance_texture; uniform sampler3D scattering_texture; uniform sampler3D mie_scattering_texture; +uniform sampler2D irradiance_texture; vec3 GetSolarLuminance(); vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 sun_dir, out vec3 transmittance); @@ -50,20 +51,22 @@ void main() vec3 camPos = cameraPosLocal; vec3 transmittance; - vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); + vec3 sky_illum; + vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_dir, transmittance); + vec3 radiance2 = GetSunAndSkyIlluminance(camPos, view_direction, sun_dir, sky_illum); - radiance *= transmittance; + //radiance *= transmittance; // If the view ray intersects the Sun, add the Sun radiance. - if (dot(view_direction, sun_direction) >= sun_size) + if (dot(view_direction, sun_dir) >= sun_size) { radiance = radiance + transmittance * GetSolarLuminance(); } - vec3 color = vec3(1.0) - exp(-radiance); - color = pow(color, vec3(1.0 / 2.2)); + //vec3 color = vec3(1.0) - exp(-radiance); + //color = pow(color, vec3(1.0 / 2.2)); - frag_color.rgb = color; + frag_color.rgb = radiance; frag_color.a = 1.0; } |