aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2020-01-08 13:56:03 +0100
committerAdrian Kummerlaender2020-01-08 13:56:03 +0100
commitfa280a8ed69243b8691e44a068d38c249dbbd3cf (patch)
treefc7aac3222d3d5379d2e30a8f7c1efd7baa4cca7
parent51d4f8162df01225e096d24971e8c8335b8c8371 (diff)
downloadfirmament-fa280a8ed69243b8691e44a068d38c249dbbd3cf.tar
firmament-fa280a8ed69243b8691e44a068d38c249dbbd3cf.tar.gz
firmament-fa280a8ed69243b8691e44a068d38c249dbbd3cf.tar.bz2
firmament-fa280a8ed69243b8691e44a068d38c249dbbd3cf.tar.lz
firmament-fa280a8ed69243b8691e44a068d38c249dbbd3cf.tar.xz
firmament-fa280a8ed69243b8691e44a068d38c249dbbd3cf.tar.zst
firmament-fa280a8ed69243b8691e44a068d38c249dbbd3cf.zip
Fix Rayleigh and Mie phase functions
-rw-r--r--raymarch.cl5
-rw-r--r--sunrise.py2
2 files changed, 3 insertions, 4 deletions
diff --git a/raymarch.cl b/raymarch.cl
index 391d844..1e88f40 100644
--- a/raymarch.cl
+++ b/raymarch.cl
@@ -128,9 +128,8 @@ double3 scatter(double3 origin, double3 dir, double dist, double3 sun) {
const double mu = dot(dir,sun);
- const double rayleigh_phase = 3./(16.*M_PI) * (1.0 + mu*mu);
- const double mie_phase = (3.*(1. - mie_g*mie_g)) / (2.*(2. + mie_g*mie_g)) * (1. + mu*mu) / pow(1. + mie_g*mie_g - 2.*mie_g*mu, 1.5);
- //const double mie_phase = (1-mie_g*mie_g) / (4*M_PI*pow(1+mie_g*mie_g-2*mie_g*mu,1.5));
+ const double rayleigh_phase = 0.75 * (1.0 + mu*mu);
+ const double mie_phase = 0.5*(1-mie_g*mie_g)/pow(1+mie_g*mie_g-2*mie_g*mu,1.5);
return rayleigh_sum*rayleigh_beta*rayleigh_phase + mie_sum*mie_beta*mie_phase;
}
diff --git a/sunrise.py b/sunrise.py
index 9a99605..408f408 100644
--- a/sunrise.py
+++ b/sunrise.py
@@ -16,7 +16,7 @@ config = {
'ray_samples' : 32,
'light_samples': 8,
- 'exposure': 20.0,
+ 'exposure': 2.0,
'zoom': 1.0,
'eye_pos': numpy.array([0, 0, 1.0001]),