polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

commit 5a78fd91b3a6a263d5988d045456d99fce74aa27
parent c2e6c5984f4af27e1a31bed42defe2a11d9bc84e
Author: William Casarin <jb55@jb55.com>
Date:   Wed,  2 May 2018 21:45:54 -0700

fog is nice now

Diffstat:
Metc/shaders/test.f.glsl | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/etc/shaders/test.f.glsl b/etc/shaders/test.f.glsl @@ -12,7 +12,7 @@ uniform bool fog_on; uniform mat4 normal_matrix; vec3 apply_fog(in vec3 rgb, in float distance, in vec3 ray_orig, in vec3 ray_dir) { - const float b = 0.000046; + const float b = 0.00046; const float v = 1.0; const float zs = 1.0; @@ -22,7 +22,7 @@ vec3 apply_fog(in vec3 rgb, in float distance, in vec3 ray_orig, in vec3 ray_dir // float fog_amount = // exp(-ray_orig.z*b) * (1.0-exp( -distance*ray_dir.z*b))/ray_dir.z*b; - float fog_amount = 1.0 - exp(-distance*b) ; + float fog_amount = 1.0 - exp(-(pow(distance*b, 2.0))) ; vec3 fog_color = vec3(0.5,0.6,0.7); return mix( rgb, fog_color, fog_amount);