From fa280a8ed69243b8691e44a068d38c249dbbd3cf Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 8 Jan 2020 13:56:03 +0100 Subject: Fix Rayleigh and Mie phase functions --- raymarch.cl | 5 ++--- sunrise.py | 2 +- 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]), -- cgit v1.2.3