Skip to content

Draw the FS1 nebula over a skybox model when a mission asks for it - #7855

Closed
dustinspace217 wants to merge 3 commits into
scp-fs2open:masterfrom
dustinspace217:graphics/fs1-nebula-skybox
Closed

dustinspace217 wants to merge 3 commits into
scp-fs2open:masterfrom
dustinspace217:graphics/fs1-nebula-skybox

Conversation

@dustinspace217

Copy link
Copy Markdown
Contributor

What?

Adds an optional mission line, $FS1 Nebula Over Skybox: YES, at the end of the background section, for the FS1 nebula introduced in #7853. When it is set and the mission has a skybox model, the FS1 nebula is drawn over the skybox with additive blending. qtFRED and FRED get a "Draw over skybox" checkbox for it. Without the line, a skybox still hides the nebula, as in #7853.

Why?

#7853 skips the FS1 nebula whenever a mission has a skybox model, because the mesh is opaque and would hide the skybox. That turns out to cover the missions most likely to want the FS1 look: every FSPort mission and every retail mission as rewritten by MediaVPs 5.x carries $Skybox Model: starfield.pof (the model ships with the MediaVPs, so with them the skybox loads and the nebula is hidden). Mod makers should not have to give up their skybox to get the nebula. Additive blending keeps the skybox and its stars where the nebula is dark and adds the nebula's colour where it is bright.

How?

The parser reads the line at the end of the background section (after $Environment Map:) into a per-mission flag, reset with the other nebula state, in the engine and in the Lab. stars_draw lets the nebula through when the flag is set even with a skybox model, and nebula_render switches the material to additive blending in that case; the no-skybox path is untouched. The environment map follows the same rule, so reflections show what the player sees. The saver writes the line only when the flag is set and a pattern is selected, with a version comment; the position means builds that do not know the line skip it with the rest of the section. qtFRED's background editor model gets a getter and setter and the dialog a checkbox wired like the other old-nebula controls; FRED's background dialog gets the matching checkbox with DDX, enabled with the colour combo and disabled under full nebula.

Screenshots?

Screenshots of FSPort's SM1-01 (with the FSPort MediaVPs) with and without the line, and of MediaVPs 5.0.2's SM1-01 with the line, follow in a comment.

Testing?

Linux, headless harness, OpenGL and Vulkan: FSPort's SM1-01 with the FSPort MediaVPs (so its skybox loads) draws the nebula over the skybox with the line and nothing without it, same as with the switch off; MediaVPs 5.0.2's SM1-01 with the line draws it over the purple sky; retail SM1-01 (no skybox) with the line is pixel-identical to #7853; a build without this change reads the mission with the line and renders it exactly as without the line, backgrounds intact. qtFRED built from the branch saves the line at the end of the background section; the checkbox itself could not be driven by the harness, so the editor-set save path is verified by reading. FRED has eight changed lines, syntax-checked against the engine headers, not built here; the MSVC CI jobs are its compile check. In standard-format saves the line is written plain; older builds skip it and show no nebula over the skybox.

Anything Else?

Depends on #7853; opened as a draft until that lands. I used Claude Code to write and test the change; the design and the testing calls are mine.

Restores the FS1 background nebula that the engine has parsed and loaded
since retail but has not drawn since the palette manager was removed in
2017. The mesh is drawn on the far sphere before the stars, after the
skybox, and only when a mission has no skybox model and is not a full
nebula mission. The colour ramp is the first 20 entries of the FS1 game
palette for the mission's nebula and colour (gamepalette<N>-<CC>.pcx),
uploaded as a one-row texture so the GPU interpolates between ramp
entries. Missing palette or mesh files log a line and draw nothing.

The mesh loader now rejects triangle indices outside the point list and
closes the file on every failure path, since the renderer consumes the
indices. qtFRED's background editor and FRED's nebula colour control
reload the nebula when the fields change, so the editors preview it.
Adds an optional `$FS1 Nebula Over Skybox: YES` line at the end of a
mission's background section. When it is set and the mission has a
skybox model, the FS1 nebula is drawn after the skybox with additive
blending, so its dark areas leave the skybox and its stars untouched.
Without the line a skybox still hides the nebula, as before. The line
sits after `$Environment Map:` so builds that do not know it skip it
with the rest of the section; it is written with a version comment.
qtFRED's background editor and FRED's background dialog get a "Draw
over skybox" checkbox for it, and the Lab reads and resets the flag.
dustinspace217 added a commit to dustinspace217/fs2open.github.com that referenced this pull request Oct 13, 2026
@dustinspace217

Copy link
Copy Markdown
Contributor Author

Screenshots from the headless harness (OpenGL, 1920x1080). All three missions have $Skybox Model: starfield.pof and the FS1 nebula fields; the only difference between the first two is the new line.

FSPort SM1-01 with the FSPort MediaVPs, line absent (same frame as #7853 and as the switch off):

FSPort SM1-01, no line

Same mission with $FS1 Nebula Over Skybox: YES (Nebula03, Gold, pitch 90):

FSPort SM1-01, line present

MediaVPs 5.0.2's SM1-01 with the line (Nebula01, Red, pitch 90), drawn over its own sky art:

MediaVPs 5 SM1-01, line present

@dustinspace217

Copy link
Copy Markdown
Contributor Author

Superseded by #7853, which now draws the nebula over a skybox model as part of the merged design.

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.

1 participant