summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Froehlich <Mathias.Froehlich@web.de>2011-02-03 13:46:56 +0100
committerMathias Froehlich <Mathias.Froehlich@web.de>2012-02-11 12:41:42 +0100
commit72ffd0ea808b879bb723beecc881681beaef6f36 (patch)
tree608472ed75096ca9afc3d68507d301125c0e0417
parente38a2fa4db5c373002c8d7989d9098a451ccc0f8 (diff)
x
-rw-r--r--common.glsl14
-rw-r--r--transmittance.glsl12
2 files changed, 12 insertions, 14 deletions
diff --git a/common.glsl b/common.glsl
index 138fb4a..3d28814 100644
--- a/common.glsl
+++ b/common.glsl
@@ -95,20 +95,6 @@ vec2 getTransmittanceUV(float r, float mu) {
return vec2(uMu, uR);
}
-void getTransmittanceRMu(out float r, out float muS) {
-#ifdef _FRAGMENT_
- r = gl_FragCoord.y / float(TRANSMITTANCE_H);
- muS = gl_FragCoord.x / float(TRANSMITTANCE_W);
-#endif
-#ifdef TRANSMITTANCE_NON_LINEAR
- r = Rg + (r * r) * (Rt - Rg);
- muS = -0.15 + tan(1.5 * muS) / tan(1.5) * (1.0 + 0.15);
-#else
- r = Rg + r * (Rt - Rg);
- muS = -0.15 + muS * (1.0 + 0.15);
-#endif
-}
-
vec2 getIrradianceUV(float r, float muS) {
float uR = (r - Rg) / (Rt - Rg);
float uMuS = (muS + 0.2) / (1.0 + 0.2);
diff --git a/transmittance.glsl b/transmittance.glsl
index 36ca327..9115add 100644
--- a/transmittance.glsl
+++ b/transmittance.glsl
@@ -42,6 +42,18 @@ void main() {
#else
+void getTransmittanceRMu(out float r, out float muS) {
+ r = gl_FragCoord.y / float(TRANSMITTANCE_H);
+ muS = gl_FragCoord.x / float(TRANSMITTANCE_W);
+#ifdef TRANSMITTANCE_NON_LINEAR
+ r = Rg + (r * r) * (Rt - Rg);
+ muS = -0.15 + tan(1.5 * muS) / tan(1.5) * (1.0 + 0.15);
+#else
+ r = Rg + r * (Rt - Rg);
+ muS = -0.15 + muS * (1.0 + 0.15);
+#endif
+}
+
float opticalDepth(float H, float r, float mu) {
float result = 0.0;
float dx = limit(r, mu) / float(TRANSMITTANCE_INTEGRAL_SAMPLES);