Volumetric Nebula

From FreeSpace Wiki
Revision as of 13:58, 21 September 2023 by Lafiel (talk | contribs) (Add Volumetric Nebula Page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Volumetic Nebulae are a method of adding localized regions of fog and nebula to a mission.

Preparing the Nebula hull model

As the first step to adding a volumetric nebula into a mission is to create a model of the nebula. This model must consist of one or more enclosed volumes. Only on the inside of these volumes will there be fog when added into the mission. It is allowed to have multiple unconnected volumes in the nebula hull model. It is also allowed to have multiple volumes within one another to create a pocket of no fog within a region of fog. However, the model must only consist of closed, watertight volumes, and may not contain disconnected faces.

Volumetric Nebula Settings

The following is a closer discussion of the settings of the volumetric nebula and their effects on the visuals and performance.

Position

This simply sets the position of the nebula within the mission. While it is possible to move the nebula this way, it is not possible to scale or rotate it.

Color

The primary color of the volumetric nebula

Maximum Opacity

This setting determines how opaque / transparent the nebula is at its maximum. A value very close to 0 means that the nebula will be close to fully opaque, while a value of 1 means fully transparent.

Maximum Opacity Distance

How thick the nebula has to be for it to reach the maximum opacity as defined above. This closely correlates with how "thick" the nebula feels. The lower the value, the thicker the nebula. Should be around half to a tenth of the size of the nebula. For performance reasons, it is strongly discouraged to set this value to be much lower. Halving this value will double the performance cost in the worst case!

Render Quality Steps

How many steps the renderer will take to reach the maximum opacity distance. A lower value causes a "banded" look in terms of transparency, while a higher value increases performance cost. Doubling this value will double the performance cost! Something between 5 and 30 is reasonable.

Resolution

The resolution of the volume texture used to render the nebula, defined as 2^n. Lower values create a potentially blocky look, while higher values drastically increase the VRAM requirements. Reasonable values are 5 to 8.

Resolution Oversampling

Determines how accurate the volume texture is calculated. Higher values will make larger nebulae look smoother, and fill the edges with more accurate, less aliased voxels, but also take longer to load (approximate quadrupling of loading time for every value above 1).

Henyey Greenstein Coefficient

Determines how light scatters in the nebula. The higher the value, the more Anistropic the light scattering will be (light scatters in the direction it was already travelling). In practice, this means that high values will make the dark side of the fog look brighter, especially on the edges, giving the look of the bright edges of clouds directly in front of the sun, while the bright side will get darkened. Similarly, negative values will make the nebula look reflective and less translucent. A value of 0.2 to 0.4 is roughly corresponding to how natural clouds look in front of the sun.

Sun Falloff Factor

Scales how well sunlight passes through the nebula. A value above 1 will make sunlight shine further into the nebula, making it appear brighter when deeper inside, while a value below 1 will make sunlight shine less into the nebula, making it appear darker when deeper inside.

Sun Quality Steps

How many steps are taken to calculate illumination of the nebula from the sun. A lower value causes a "banded" look in terms of brightness and color, while a higher value increases performance cost. Doubling this value will double the performance cost! Something between 3 and 6 is reasonable.

Emissive Light Spread

The higher the spread is, the faster will any sort of emissive lighting from ships in the nebula spread sideways in a cone. Reasonable values seem to be between 0 and 4.

Emissive Light Intensity

This determines how intense and visible the scattered emissive light is. Higher values will make light much more noticable. Reasonable values seem to be between 0 and 10.

Emissive Light Falloff

This parameter tunes how bright the scattered emissive light from ships is in relation to the distance from the respective light source. Values below 1 will make the light brighter close to the source and darker further away, while values above 1 will make the light darker close to the source and brighter further away. Values slightly above 1 seem realistic-ish.

Noise Color

The color of any noise added to the nebula

Noise Scale

The length in meters of the noise until it repeats its pattern. Make sure that the two numbers have a large least common multiple in order to avoid visible harmonics. Sensibly smaller than the nebula itself.

Noise Intensity

How visible the noise color is compared to the primary nebula color===

Noise Resolution

The resolution of the volume texture used to add the noise, defined as 2^n. Lower values create a potentially blocky look, while higher values drastically increase the VRAM requirements. Reasonable values are 5 to 8, but it should probably be at least one less than the main Resolution setting.

Noise Functions

These cannot yet be set in FRED, but must be added by text editor. In the noise block of the nebula, after +Intensity, add +Function Base: and +Function Sub: for the two functions used to generate the noise volume texture. These are specified in ANL's (unfortunately poorly documented) DSL. For reference, the default functions for the noise used are respresentable as translate(bias(scale(valueBasis(3,0),3),scale(valueBasis(3,1),8)),scale(simplexBasis(2),4)*0.6).