Improve terrain fog quality and refactor cloud rendering #52

Merged
embeddedt merged 8 commits from rdh/celeritas:sky-fog into stonecutter 2026-11-19 21:51:49 -05:00
Owner

This PR implements enhanced terrain fog and cloud rendering similar to newer vanilla versions. For terrain, we now blend against the rendered sky at the edge of render distance, rather than just using a provided fog color. This fixes ugly terrain-shaped silhouettes during sunsets etc. This change also applied to clouds, which use the same fog rendering logic, causing a new issue: clouds disappeared into the sky rather than their silhouette still being visible. To fix this properly, I decided to just take the opportunity to do a long-overdue overhaul of the cloud renderer. It now lives in common (so any renderer can use it) and uses vertex pulling, which enabled extending the cloud render distance. The fog calculations were also reworked to make sense with our new formulas.

The remaining limitation is that clouds aren't part of the sky texture, so distant fogged terrain in front of clouds shows as a sky-coloured silhouette.

This is based on an existing attempt by @rdh.

This PR implements enhanced terrain fog and cloud rendering similar to newer vanilla versions. For terrain, we now blend against the rendered sky at the edge of render distance, rather than just using a provided fog color. This fixes ugly terrain-shaped silhouettes during sunsets etc. This change also applied to clouds, which use the same fog rendering logic, causing a new issue: clouds disappeared into the sky rather than their silhouette still being visible. To fix this properly, I decided to just take the opportunity to do a long-overdue overhaul of the cloud renderer. It now lives in common (so any renderer can use it) and uses vertex pulling, which enabled extending the cloud render distance. The fog calculations were also reworked to make sense with our new formulas. The remaining limitation is that clouds aren't part of the sky texture, so distant fogged terrain in front of clouds shows as a sky-coloured silhouette. This is based on an existing attempt by @rdh.
embeddedt added 5 commits 2026-11-19 10:48:13 -05:00
Bind the sky texture once per capture instead of on every program setup, free it when sky fog is off, and stop the LEGACY texelFetch remap from leaking into other includes.
Clouds are vertex-pulled like vanilla's since 1.21.6, keeping per-cell colors
from the clouds texture, and fade out over their own range instead of using
terrain fog. Shader packs generate the same vertices through CloudVertices.
embeddedt added 1 commit 2026-11-19 12:09:38 -05:00
embeddedt added 2 commits 2026-11-19 21:51:10 -05:00
embeddedt merged commit 5647d662fc into stonecutter 2026-11-19 21:51:49 -05:00
embeddedt deleted branch sky-fog 2026-11-19 21:51:49 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: embeddedt/celeritas#52