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

Skybox rendering #188

Merged
merged 23 commits into from
Dec 14, 2023
Merged

Skybox rendering #188

merged 23 commits into from
Dec 14, 2023

Conversation

stackotter
Copy link
Owner

@stackotter stackotter commented Nov 28, 2023

Description

I've finally implemented a proper skybox renderer with distance fog, correct sky color (based on time-of-day and biome), the sun, the moon, the stars, the sunrise/sunset 'fog', underwater fog and lava fog. This drastically improves how complete the client feels, and makes a massive improvement in the nether where the fog is a staple of the visual aesthetic.

Remaining tasks

  • The fancy end sky
  • Updating the water fog code so that the player's 'eyes' slowly adjust to being underwater (just like they do in vanilla)
  • Interpolating the fog color between biomes

…gration could be attempted instead of throwing an error)
…nfig (to give them a chance to close the client and recover their config)
… stabilise a bit)

I've made the config version a Float so that we can increment it without
ripping through versions too quickly.
The light map was calculating brightness incorrectly by accidentally offsetting the
sun angle by half a day.
…rwater (replicating GL_FOG_EXP)

Took me ages to realise that OpenGL actually just has a built-in fog feature. I spent quite
a while searching around the decompiled vanilla sources and shaders to find the exponential
fog equation to no avail (before realising that it's actually just a documented built-in
GL feature).

The sky plane is rendered exactly how it is in Vanilla (or so I hope).
…r returns negative time when that's the case)
…d to read as unsigned)

This means that fixed time dimensions now have their sky/fog rendered correctly. The nether
fog is now correctly the same color no matter the time in the overworld
…om behind instead of being overlayed on top)
…orrect when in 3rd person

Before this change, directional sunrise fog was incorrect when in camera 3, and you'd
get water fog when the camera was above water but the player was below
Still has a few issues, the main one being a weird color banding effect as the translucent
geometry passes through the fog, but at a distance it's not quite as noticeable. Will need
to revisit OIT at some point to make it a bit more accurate. Or alternatively I could just
optimize regular translucency rendering with smarter sorting.
Turns out it's just a 200x200x200 textured cube, the more you know. All the cool
shimmery effects are just a result of Moire patterns.
@stackotter
Copy link
Owner Author

Gonna leave the other two remaining tasks for now as they're more minor things and not really part of the main skybox implementation. They can be implemented later as QoL improvements.

@stackotter stackotter merged commit 926215e into main Dec 14, 2023
10 checks passed
@stackotter stackotter deleted the skybox branch December 14, 2023 14:43
@ninjadev64
Copy link
Contributor

🎉

Maybe add some screenshots showing this off to the README?

@stackotter
Copy link
Owner Author

Oh yeah good idea 👍 a sunrise would look nice in the readme. Will do when I’m back at my laptop.

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.

None yet

2 participants