Fullneb Revamp#7352
Merged
Merged
Conversation
Contributor
|
There are multiple mods, BtA included, that have not been able to upgrade to modern builds because this fix is still not in. Is this going to make 26.0.0? |
Member
Author
|
It will. |
Replace the legacy `+Fog Near Mult` / `+Fog Far Mult` model — which depended on fixed engine constants — with four parameters that map directly to renderer behavior: +Fog 1000m Visibility fraction of light surviving 1000m of fog +Fog Near Distance meters from camera where fog begins +Fog Skybox Clip Distance max render distance for the skybox in fog +Fog Clip Distance max render distance for the scene in fog The deferred-lighting fog shader, material system, model renderer, object sort, and the Lua mission API all consume the new parameters directly. The legacy `Neb2_fog_near_mult` / `Neb2_fog_far_mult` globals are removed. Mission parsing accepts either the legacy keys or the modern keys. Legacy values are converted to the modern set at parse time, and a per-mission flag (`Neb2_fog_use_legacy_values`) records which keys to write back on save. The flag is cleared only when something actually changes, so opening and OK'ing an unmodified legacy mission preserves its on-disk format. Saving uses `optional_string_fred` to preserve user comments through edit cycles. FRED2 and QtFRED background editors both expose the four parameters in place of the old multipliers, with friendly labels and tooltips. Both editors validate input (visibility clamped to [0, 1]; near distance must be > 0; skybox and scene clip distances may be 0 to disable fog at that range) and use a snapshot-and-compare at close time so that a no-op open-then-OK never spuriously rewrites a legacy mission in the modern format. FRED2's background dialog is also reorganized so that "Display bg bitmaps in nebula", "Override nebula fog palette", the RGB row, and the four fog parameters all sit inside the Nebula group box; the "Old Nebula" group box is restored below it with its Pattern, Color, Pitch, Bank, and Heading controls back inside the frame. The dialog now overrides PreTranslateMessage so that the new fog tooltips — and the previously broken "Save sun/bitmap angles in correct format" tooltip — actually fire. QtFRED's BackgroundEditor.ui adds four QDoubleSpinBox controls in the existing nebula form layout, with per-field decimals chosen to avoid scientific notation, and per-field min/max declaring the validation rules. The QtFRED help page is updated to describe the new fields.
Rewrite nebula fog with four explicit parameters
wookieejedi
reviewed
May 26, 2026
| // fog near and far values for rendering the background nebula | ||
| extern float Neb_backg_fog_near; | ||
| extern float Neb_backg_fog_far; | ||
|
|
Member
There was a problem hiding this comment.
Should these two values Neb_backg_fog_near and Neb_backg_fog_far just be removed to avoid any future confusion since they are removed everywhere else?
wookieejedi
reviewed
May 26, 2026
Member
Author
|
Small issues still popped up, so in draft for a day or so pending these |
- Rename Neb2_fog_use_legacy_values to Neb2_fog_save_legacy_values to reflect that the flag governs save format, not runtime behavior. - Decide both the save flag and the legacy-to-modern conversion purely from whether the file contains modern fog keys, dropping the prior heuristic based on required_fso_version. A mission without modern keys (legacy- or retail-format) converts on load and saves back in legacy format; missions with modern keys are saved as modern. - Snapshot the four fog values as floats at editor open and use fl_equal for the no-change comparison in both FRED2 and QtFRED, replacing the FRED2 CString comparison and the QtFRED strict inequality. - Document the on-disk invariant in missionsave: when not saving legacy keys, the four modern keys must always be written (never gated on "only if non-default"), since the parser uses their presence to decide whether to run the conversion on next load.
Refine nebula fog rewrite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This revamps the fullneb configuration from near and far multipliers with fixed nebula transparencies to a much more intuitive near-distance + configurable transparency at 1000m depth. It furthermore adds clip distances after which the nebula does not gain opacity with more depth, split between skyboxes and everything else. This is needed, and accordingly default-configured for old missions, because prior to #7245, skybox depth was incorrectly clipped to 0 in the shader due to float overflow, resulting in non-fogged skyboxes. #7245 fixed that, and in turn made skyboxes get fogged with full opacity, essentially completely hiding them when fog is enabled.
This PR makes the respective values fully configurable, allowing for full fogging, no fogging, and anything inbetween for skyboxes and/or ships respectively.