Skip to content

Commit

Permalink
Increased fog end distance
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan-Greve committed Feb 24, 2024
1 parent 8f88cd7 commit 722d168
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions SourceFiles/WaterPixelShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ float4 main(PixelInputType input) : SV_TARGET
if (should_render_fog)
{
float distance = length(cam_position - input.world_position.xyz);
float fogFactor = (fog_end - distance) / (fog_end - fog_start);
float fogFactor = (fog_end + 10000 - distance) / (fog_end + 10000 - fog_start);
fogFactor = clamp(fogFactor, 0.0, 1.0);
final_color = lerp(float4(fog_color_rgb, 1.0), final_color, fogFactor);
float3 fog_color = lerp(fog_color_rgb, final_color.rgb, fogFactor);
final_color = lerp(float4(fog_color, 1.0), final_color, fogFactor);
}

float min_alpha = max(0.5 * (color0.a + color1.a), 0.7);
Expand Down
5 changes: 3 additions & 2 deletions SourceFiles/WaterPixelShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,10 @@ float4 main(PixelInputType input) : SV_TARGET
if (should_render_fog)
{
float distance = length(cam_position - input.world_position.xyz);
float fogFactor = (fog_end - distance) / (fog_end - fog_start);
float fogFactor = (fog_end + 10000 - distance) / (fog_end + 10000 - fog_start);
fogFactor = clamp(fogFactor, 0.0, 1.0);
final_color = lerp(float4(fog_color_rgb, 1.0), final_color, fogFactor);
float3 fog_color = lerp(fog_color_rgb, final_color.rgb, fogFactor);
final_color = lerp(float4(fog_color, 1.0), final_color, fogFactor);
}

float min_alpha = max(0.5 * (color0.a + color1.a), 0.7);
Expand Down
4 changes: 2 additions & 2 deletions SourceFiles/draw_dat_browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,8 @@ bool parse_file(DATManager* dat_manager, int index, MapRenderer* map_renderer,


map_renderer->SetFogStart(std::max((int)sub2_0.fog_distance_start, 3000));
map_renderer->SetFogEnd(std::max((float)sub2_0.fog_distance_end, map_renderer->GetFogStart()+10000));
map_renderer->SetFogStartY(-5000);
map_renderer->SetFogEnd(std::max((float)sub2_0.fog_distance_end, map_renderer->GetFogStart()+15000));
map_renderer->SetFogStartY(-10000);
map_renderer->SetFogEndY(1500);

map_renderer->SetClearColor(clear_and_fog_color);
Expand Down

0 comments on commit 722d168

Please sign in to comment.