Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localized Volumetric Nebulae #5231

Merged
merged 77 commits into from
Mar 6, 2023
Merged

Conversation

BMagnu
Copy link
Member

@BMagnu BMagnu commented Mar 4, 2023

This PR adds the ability to use (as of now) up to one area containing arbitrary localized nebulae:

nebula.mp4

Closes #4193

The base rendering technique is adapted from Andrew Schneider's 2015 SIGGRAPH talk "The real-time volumetric cloudscapes of Horizon: Zero Dawn". It allows specifying a POF as the hull of a nebula, which will be rendered using ray marching. The POF itself however must be watertight, and it must not have any overlapping polygons. Having one mesh enclosed within another without any touching polygons will create a region of space within the nebula which is "empty" and not nebulized. Furthermore, many options for look and feel are possible and can be used. The performance is acceptable, but not perfect and subject to further optimization.

The following is a list of improvements I can see to be made in the future.

  • Enhance the main Nebula texture to also contain an SDF for the regions of empty space. Since the nebula does not need 256 different density values, the lower half of the alpha component of the nebula color could be used to signal empty space with an according value for the SDF, while the upper half could indicate occupied space with the desired level of density. This would allow both optimization with regards to unnecessary samples in empty space and could drastically speed up sparse nebulae, as well as allowing a path to proper noise-based edge eroding.
  • An Editor in FRED to allow changing the nebulas property in FRED, as well as a wireframe renderer for the volumetric nebula itself within the mission (FRED Dialog for Volumetrics #5351).
  • Calculation of the nebulae's texture's voxels not from a solid tabled color, but from the texture of the nebula, allowing for more varied colorscapes.
  • Allow multiple nebulae regions per render pass / mission.
  • Allow poofs to spawn within localized nebulae.
  • Allow a player that is "sufficiently inside" a localized nebula to have the localized nebula fade into a fullneb and back once they leave.

For anyone testing this: Do be aware that a lot of nebula fades are disabled by default. Consider adding the following to the graphics settings of a -mod.tbm:

$Beams affected by nebula visibility: YES
$Weapons affected by nebula visibility: YES
$Particles affected by nebula visibility: YES
$Fireballs affected by nebula visibility: YES

@BMagnu BMagnu added graphics A feature or issue related to graphics (2d and 3d) general modding A general feature or issue related to modding capabilities of FSO feature A totally new sort of functionality labels Mar 4, 2023
code/graphics/util/uniform_structs.h Outdated Show resolved Hide resolved
code/graphics/util/uniform_structs.h Outdated Show resolved Hide resolved
code/nebula/volumetrics.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A totally new sort of functionality general modding A general feature or issue related to modding capabilities of FSO graphics A feature or issue related to graphics (2d and 3d)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Localized nebulae
2 participants