From 52887ad7c3544ed1d8f286393228de6b2e8c8be0 Mon Sep 17 00:00:00 2001 From: Emilian Huminiuc Date: Mon, 25 May 2015 16:29:56 +0200 Subject: [PATCH] Environment/interpolator.xml: create copies of tied properties used by the ubershader reflection rotation. Effects/model-combined.eff: use copies instead of tied properties Shaders/ubershader: fix reflection rotation for dynamic reflections. --- Effects/model-combined.eff | 4 ++-- Environment/interpolator.xml | 16 ++++++++++++++++ Shaders/ubershader-gbuffer.frag | 6 +++--- Shaders/ubershader.frag | 6 +++--- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Effects/model-combined.eff b/Effects/model-combined.eff index 09ff0a567..a8d8f8c73 100644 --- a/Effects/model-combined.eff +++ b/Effects/model-combined.eff @@ -129,10 +129,10 @@ please see Docs/README.model-combined.eff for documentation orientation/model/roll-deg - position/longitude-deg + position/model/longitude-deg - position/latitude-deg + position/model/latitude-deg /environment/ground-visibility-m diff --git a/Environment/interpolator.xml b/Environment/interpolator.xml index 23b702670..881df6d6f 100644 --- a/Environment/interpolator.xml +++ b/Environment/interpolator.xml @@ -245,6 +245,22 @@ /orientation/model/roll-deg + + EnvironmentInterpolator:model:latitude + /position/latitude-deg + /position/model/latitude-deg + gain + 1 + + + + EnvironmentInterpolator:model:longitude + /position/longitude-deg + /position/model/longitude-deg + gain + 1 + + EnvironmentInterpolator:wave:amp gain diff --git a/Shaders/ubershader-gbuffer.frag b/Shaders/ubershader-gbuffer.frag index 9dde7f670..6df4e754a 100644 --- a/Shaders/ubershader-gbuffer.frag +++ b/Shaders/ubershader-gbuffer.frag @@ -142,12 +142,12 @@ void main (void) float latRad = radians(90. - latDeg); float lonRad = radians(lonDeg); - mat3 rotCorrX = rotX(-lonRad); mat3 rotCorrY = rotY(latRad); - mat3 reflCorr = rotCorrX * rotCorrY; + mat3 rotCorrZ = rotZ(lonRad); + mat3 reflCorr = rotCorrY * rotCorrZ; wRefVec = reflect(wVertVec,wNormal); wRefVec = normalize(reflCorr * wRefVec); - } else if (refl_enabled > 0) { ///static reflection + } else { ///static reflection wRefVec = normalize(reflMatrix * vec4(wRefVec,0.0)).xyz; } diff --git a/Shaders/ubershader.frag b/Shaders/ubershader.frag index 14d245b26..1a8507ee4 100644 --- a/Shaders/ubershader.frag +++ b/Shaders/ubershader.frag @@ -139,12 +139,12 @@ void main (void) vec3 wVertVec = normalize(reflMatrix * vec4(viewVec,0.0)).xyz; vec3 wNormal = normalize(reflMatrix * vec4(N,0.0)).xyz; - float latRad = radians(90. - latDeg); + float latRad = radians(90.-latDeg); float lonRad = radians(lonDeg); - mat3 rotCorrX = rotX(-lonRad); mat3 rotCorrY = rotY(latRad); - mat3 reflCorr = rotCorrX * rotCorrY; + mat3 rotCorrZ = rotZ(lonRad); + mat3 reflCorr = rotCorrY * rotCorrZ; wRefVec = reflect(wVertVec,wNormal); wRefVec = normalize(reflCorr * wRefVec); } else { ///static reflection