diff --git a/shaders/bloom-highpass.f.glsl b/shaders/bloom-highpass.f.glsl index ec45636..24bf5d2 100644 --- a/shaders/bloom-highpass.f.glsl +++ b/shaders/bloom-highpass.f.glsl @@ -12,6 +12,9 @@ layout( location = 0 ) out vec3 color; void main( void ) { - vec3 c = textureLod( u_Input , gl_FragCoord.xy / u_InputSize.xy , u_LOD ).xyz; - color = max( vec3(0) , ( pow( c , vec3( u_FilterParams.x ) ) * u_FilterParams.y - c ) / u_FilterParams.z ); + const vec3 c = textureLod( u_Input , + gl_FragCoord.xy / u_InputSize.xy , u_LOD ).xyz; + color = max( vec3( 0 ) , + ( pow( c , vec3( u_FilterParams.x ) ) * u_FilterParams.y - c ) + / u_FilterParams.z ); } diff --git a/shaders/blur-pass.f.glsl b/shaders/blur-pass.f.glsl index 8545829..f0b610c 100644 --- a/shaders/blur-pass.f.glsl +++ b/shaders/blur-pass.f.glsl @@ -14,7 +14,6 @@ void main( void ) { vec2 tmp = gl_FragCoord.xy / u_OutputSize; vec2 disp = u_Direction / u_OutputSize; - float wt = u_Weights.x + u_Weights.y * 2 + u_Weights.z * 2 + u_Weights.w * 2; color = u_Weights.x * textureLod( u_InputTexture , tmp , u_SourceLOD ).xyz + u_Weights.y * ( textureLod( u_InputTexture , tmp + disp , u_SourceLOD ).xyz @@ -26,5 +25,5 @@ void main( void ) textureLod( u_InputTexture , tmp + disp * 3 , u_SourceLOD ).xyz + textureLod( u_InputTexture , tmp - disp * 3 , u_SourceLOD ).xyz ) ; - color /= wt; + color /= u_Weights.x + 2 * ( u_Weights.y + u_Weights.z + u_Weights.w ); } diff --git a/shaders/lib/shading-pbr.glsl b/shaders/lib/shading-pbr.glsl index bc94553..325e9d1 100644 --- a/shaders/lib/shading-pbr.glsl +++ b/shaders/lib/shading-pbr.glsl @@ -63,7 +63,7 @@ T_PBRPrecomputed PBR_Precompute( float tDir = step( .99 , abs( normal.z ) ) , aspect = sqrt( 1 - material.anisotropy * .9 ) , - rsqr = material.roughness * material.roughness; + rsqr = M_Sqr( material.roughness ); vec3 tUp = mix( vec3( 0 , 0 , 1 ) , vec3( 1 , 0 , 0 ) , tDir ) , tint = M_NormalizeColor( material.cAlbedo ); diff --git a/shaders/scene.f.glsl b/shaders/scene.f.glsl index 410272a..06e6eba 100644 --- a/shaders/scene.f.glsl +++ b/shaders/scene.f.glsl @@ -18,7 +18,7 @@ T_PBRMaterial PBRMaterials[1] = { // Albedo color vec3( .9 , 1 , .9 ) , // Roughness , metallic , subsurface , anisotropy - .25 , .5 , .9 , .9 , + .15 , .5 , .9 , .9 , // Specular strength / tint% .5 , .5 } @@ -124,7 +124,7 @@ void main( ) const int midx = int( r.y ); const vec3 sunlightDir = normalize( vec3( 0 , 1 , 1 ) ); - const vec3 sunlightColor = vec3( 1 , 1 , .99 ) * .1; + const vec3 sunlightColor = vec3( 1 , 1 , .99 ) * .05; const vec3 pl1Pos = vec3( 3 , 3 , 5 ); const vec3 pl1Color = vec3( 1 , .7 , .8 ); const float pl1Power = 20;