Skip to content

Commit

Permalink
Fixed fog
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Mar 1, 2022
1 parent 8657e1c commit 765bf3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
9 changes: 5 additions & 4 deletions Media/Hlms/Common/Any/Fog_piece_ps.any
Expand Up @@ -10,10 +10,11 @@
// float2 params = float2(400, 3000);
// float fogFactor = 1.0 - clamp((params.y - fogDistance) / (params.y - params.x), 0.0, 1.0);
// exp
float fogFactor = 1.0 - exp( -fogDistance * 0.00003 ); // + 0.0001 .. 0.001
//float fogFactor = exp(-inPs.pos.z * 0.0001); // * (1.0-exp( -distance*rayDir.y*b ))/rayDir.y; // height and dist..
float fogFactor = 1.0 - exp( -fogDistance * 0.00001 ); //** fog density: 0.00003 0.0001 0.001
//float fogFactor = 1.0 - exp( -(270 - inPs.pos.y) * 0.001); // * (1.0-exp( -distance*rayDir.y*b ))/rayDir.y; // height and dist..

float3 fogColor = float3(0.2,0.4,0.6);
finalColour = mix(finalColour, fogColor, fogFactor);
float3 fogColor = float3(0.2,0.4,0.6) * outPs_colour0.w;
//outPs_colour0.xyz = mix(outPs_colour0.xyz, lerp(float3(1.0,0.4,0.0), fogColor, outPs_colour0.w), fogFactor );
outPs_colour0.xyz = mix(outPs_colour0.xyz, fogColor, fogFactor );

@end
7 changes: 3 additions & 4 deletions Media/Hlms/Pbs/Any/Main/800.PixelShader_piece_ps.any
Expand Up @@ -816,10 +816,6 @@
@property( !hlms_prepass )
@property( hlms_normal || hlms_qtangent )

//** fog
@insertpiece( FogPS )


@property( !hw_gamma_write )
//Linear to Gamma space
outPs_colour0.xyz = sqrt( finalColour );
Expand All @@ -837,6 +833,9 @@
outPs_colour0.w = 1.0;
@end

//** fog
@insertpiece( FogPS )

@property( debug_pssm_splits )
outPs_colour0.xyz = mix( outPs_colour0.xyz, debugPssmSplit.xyz, 0.2f );
@end
Expand Down
7 changes: 3 additions & 4 deletions Media/Hlms/Terra/Any/800.PixelShader_piece_ps.any
Expand Up @@ -364,10 +364,6 @@
@property( !hlms_render_depth_only )
@property( !hlms_prepass )

//** fog
@insertpiece( FogPS )


@property( !hw_gamma_write )
//Linear to Gamma space
outPs_colour0.xyz = sqrt( finalColour );
Expand All @@ -385,6 +381,9 @@
outPs_colour0.w = 1.0;
@end

//** fog
@insertpiece( FogPS )

@property( debug_pssm_splits )
outPs_colour0.xyz = mix( outPs_colour0.xyz, debugPssmSplit.xyz, 0.2f );
@end
Expand Down

0 comments on commit 765bf3b

Please sign in to comment.