Skip to content

Add height fog system (高度雾方案)#73

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/create-misting-solution
Draft

Add height fog system (高度雾方案)#73
Copilot wants to merge 4 commits intomainfrom
copilot/create-misting-solution

Conversation

Copy link

Copilot AI commented Mar 7, 2026

Implements an exponential height fog effect as a full-screen post-process pass inserted between the forward pass and tone-mapping.

Fog Algorithm

Analytically integrates exponential density along the view ray:

density(h) = FogDensity * exp(-HeightFalloff * max(h - BaseHeight, 0))

Closed-form solution handles both horizontal and angled rays correctly. World position is reconstructed from depth buffer using InvViewProj.

New Components

  • HeightFogFeatureProcessor — manages fog params UBO, exports HeightFogParamsBuffer to render graph each frame; density defaults to 0 (no-op until component attached)
  • HeightFogPassFullScreenPass reading FWD_CL + FWD_DSHeightFogOutput
  • HeightFogComponent — serializable world component exposing: fog color, inscatter color, density, height falloff, base/max height, start distance; resets density to 0 on detach

Pipeline Changes

  • DefaultForwardPipeline::Collect conditionally inserts HeightFogPass when HeightFogFeatureProcessor is present, redirecting PostProcessingPass input via new SetColorInput()
  • HeightFogFeature::Init() registered alongside other features in RenderModule

Cross-API Depth Reconstruction

  • Added invViewProject (= viewProject.Inverse()) to SceneViewInfo / ViewInfo HLSL struct
  • HeightFogParams::clipYSign corrects NDC Y-axis convention: +1 for Vulkan (Y=-1 at top), -1 for DX12/Metal (Y=+1 at top), set automatically from RHI::GetDevice()->GetConstants().flipY

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 3 commits March 7, 2026 12:55
…ogComponent)

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
…t fog

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot AI changed the title [WIP] Add high misting solution implementation Add height fog system (高度雾方案) Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants