diff --git a/shaders/lib/raymarching.glsl b/shaders/lib/raymarching.glsl index 03b5e42..8a651d4 100644 --- a/shaders/lib/raymarching.glsl +++ b/shaders/lib/raymarching.glsl @@ -138,9 +138,8 @@ vec3 RM_ReduceDiscontinuity( { vec3 hitPos = origin + hitDist * rayDir; for ( int i = 0 ; i < iterations ; i ++ ) { - const float err = length( origin - hitPos ) * tanPhi; hitPos = hitPos + rayDir * ( - RM_Map( hitPos ).x - tanPhi + RM_Map( hitPos ).x - tanPhi * length( origin - hitPos ) ); } return hitPos; diff --git a/shaders/lib/shading-pbr.glsl b/shaders/lib/shading-pbr.glsl index 53cf840..c941a8e 100644 --- a/shaders/lib/shading-pbr.glsl +++ b/shaders/lib/shading-pbr.glsl @@ -128,7 +128,7 @@ vec3 PBR_Shade( * mix( Fd , ss , material.subsurface ) * material.cAlbedo /* + Fsheen */) * pow( 1 - material.metallic , 3 ) - + clamp( Gs , 0 , 1 ) * Fs * Ds ); + + Gs * Fs * Ds ); } vec3 PBR_Shade( diff --git a/shaders/scene.f.glsl b/shaders/scene.f.glsl index 5dd9e16..3c4ea5b 100644 --- a/shaders/scene.f.glsl +++ b/shaders/scene.f.glsl @@ -18,7 +18,7 @@ T_PBRMaterial PBRMaterials[1] = { // Albedo color vec3( .8 , 1 , .8 ) , // Roughness , metallic , subsurface , anisotropy - .2 , .8 , .5 , .0 , + .3 , .8 , .8 , .9 , // Specular strength / tint% .5 , .5 } @@ -49,10 +49,10 @@ vec2 RM_Map( vec3 pos ) vec3 q = pos; HG_pMod2( q.xy , vec2( 8. ) ); HG_pR( q.xz , 1 ); - return vec2( HG_fOpUnionColumns( - HG_fBox( q , vec3( 1.5 ) ) , - HG_fSphere( q , 1.5 ) , - 1. , 8 ) , + return vec2( HG_fOpUnionStairs( + HG_fBox( q , vec3( 2.3 ) ) , + HG_fSphere( q , 2.6 ) , + 1. , 4 ) , step( 0. , -HG_fSphere( pos , 3 ) ) ); } @@ -92,7 +92,7 @@ void main( ) vec3 r = RM_Advanced( u_CamPos , rayDir , int( u_Render.x ) , u_Render.y , - /*u_Render.z */ tanPhi , .001 , u_Render.w ); + tanPhi , .01 , u_Render.w ); const vec3 background = vec3( .005 ); vec3 bc = background; @@ -135,7 +135,8 @@ void main( ) if ( glowidx >= 0 ) { bc += Glow[ glowidx ]; } - bc = FOG_Apply( bc , r.x , u_FogAttenuation , background ); + bc = FOG_Apply( bc , length( u_CamPos - hitPos ) , + u_FogAttenuation , background ); } o_Color = bc;