Skip to content

Make fog into a stage, fix some issues with it#1408

Merged
VReaperV merged 8 commits intoDaemonEngine:masterfrom
VReaperV:fog-drawsurf
Nov 2, 2024
Merged

Make fog into a stage, fix some issues with it#1408
VReaperV merged 8 commits intoDaemonEngine:masterfrom
VReaperV:fog-drawsurf

Conversation

@VReaperV
Copy link
Copy Markdown
Contributor

@VReaperV VReaperV commented Oct 31, 2024

Changes fog from being done based on an if statement in Tess_StageIteratorColor() to being added as a surface with one of two new defaut fog shaders - similar to how we add depth pre-pass surfaces. The 2 new default shaders are for fogs with FP_EQUAL and FP_LE fog passes.

  • Adds fog to material system. Fog surfaces are added as stages to the main surface, like it's already done with depth pre-pass surfaces.
  • Slightly reworked how depth and fog surfaces are linked to the main surface, now R_AddDrawSurf() returns the index of the surface, to get the correct one.
  • Moved some early-return fog checks to shader parsing/R_AddDrawSurf().
  • Added u_FogMap since all fogs use the same image, so it can be made global, and cleaned up Render_fog() and fog processing a bit.
  • Fixes SSAO displayed above fog from behind wall #537 by rendering all fog surfaces with SS_FOG, which is done after SSAO.
  • Fixed incorrect max stage count for material system.

@slipher
Copy link
Copy Markdown
Member

slipher commented Nov 1, 2024

What are some maps with fog to try it out? The only one I know off the top of my head is atcshd.

@VReaperV
Copy link
Copy Markdown
Contributor Author

VReaperV commented Nov 1, 2024

Copy link
Copy Markdown
Member

@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! And it works well on my end!

@VReaperV VReaperV force-pushed the fog-drawsurf branch 3 times, most recently from ed4d4a2 to 693b0a5 Compare November 2, 2024 20:44
Added the fog stage to renderer selection and material system. Added u_FogMap uniform because all fog uses the same fog image. Changed `R_AddDrawSurf()` to return the added surface's index, because translucent surfaces get added at the end instead, so this is a more robust approach.

Removed some redundant checks to return from `Render_fog()` early.

Fixed incorrect material system max stage count.
fog->originalBrushNumber can only be < 0 for world fog, which is already accounted for by only adding surfaces with fogNum >= 1 (non-world).
Wolf:ET was checking for `RDF_SNOOPERVIEW` here, we don't have that.
@VReaperV VReaperV merged commit 16a5b7b into DaemonEngine:master Nov 2, 2024
@VReaperV VReaperV deleted the fog-drawsurf branch November 2, 2024 22:49
@VReaperV VReaperV mentioned this pull request Nov 2, 2024
VReaperV added a commit to VReaperV/Daemon that referenced this pull request Mar 18, 2025
DaemonEngine#1408 had removed the hacky way of drawing fog surfaces and made them into actual stages. This change removes the sorting by fog index since it now has no positive effect (and potentially has a negative one, preventing surfaces from being merged). The fognum bits are redistributed towards drawsurf indexes and entity count.
VReaperV added a commit to VReaperV/Daemon that referenced this pull request Mar 22, 2025
DaemonEngine#1408 had removed the hacky way of drawing fog surfaces and made them into actual stages. This change removes the sorting by fog index since it now has no positive effect (and potentially has a negative one, preventing surfaces from being merged). The fognum bits are redistributed towards drawsurf indexes and entity count.
VReaperV added a commit that referenced this pull request Mar 23, 2025
#1408 had removed the hacky way of drawing fog surfaces and made them into actual stages. This change removes the sorting by fog index since it now has no positive effect (and potentially has a negative one, preventing surfaces from being merged). The fognum bits are redistributed towards drawsurf indexes and entity count.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

SSAO displayed above fog from behind wall

3 participants