Extended Clouds incompatibility.
Hey im the developer behind Extended Clouds and my mod extends the clouds further than the render distance. Looking at it, it looks like the depth buffer gets reset when used by Distand Horizons which makes my clouds render above all of the lod terrain because the renderer believes there is nothing there.

32 Replies
Hey, nice to meet you,
You are correct, after DH renders we clear the depth buffer. This is because we have to use a different projection matrix than MC (changing the near and far clip planes to prevent Z-fighting at long distances) so keeping the same depth buffer would cause wacky rendering bugs.
A more in-depth explanation can be found here:
https://discord.com/channels/881614130614767666/881614131877269586/950537059213406259
Once DH 2.0 is released we'll be adding an API that includes event handlers that could be used in this situation. Specifically we will have an event that fires before DH starts rendering and passes in the projection matrix we use. If you wanted to work with DH, you could hook into our event, and render the clouds before DH. That way the depth would work correctly for the clouds and DH LODs.
Granted this would prevent clouds from intersecting with vanilla terrain unless the clouds are rendered in two passes (one for DH and one for vanilla).
If you have any other ideas on how we could fix this, or need more information from me, just ask.
Hm, i wonder if this is a dumb idea, but would it not be possible to map the depth buffer to the minecraft projection so instead of clearing it, you would just convert it to the minecraft values and possibly just lose some information
Im confused however why that causes Z-fighting
Hmmm, Maybe?
The hard part would be determining what the depth values would need to be mapped to.
If my math and theory is not fully dumb, it should just be this
no wait
i think i am dumb
yes
give me a moment
If we kept MC's projection matrix we could only render a little bit farther than the vanilla render distance due to their far clip plane.
So we need to extend the far clip plane.
If we just extended MC's far clip plane we would have to deal with the depth buffer losing precision as we rendered farther from the camera; which manifests as flickering or Z-fighting.
So we also have to extend the near clip plane.
Mapping our depth values instead of clearing them is an interesting solution that is worth looking into. I'll have to see how best to do something like that (time to break out the GLSL :cou:).
^ now this is some very "i wrote some code off my head" type of code
Awesome, thanks 👍
If nothing else it is a good place to start
@leetom what do you think of this idea?
I think it has some merit, and is worth looking into at the very least.
v3
god this is some very mind intensive math
Gotta love 3D rendering 🙃
ikr
just watch this not work on intel gpus for no apperent reason 🔥
😆
Hopefully it would be fine. I'd expect the depth buffer in OpenGL to be pretty similar between venders.
Hopefully it would be fine. I'd expect the depth buffer in OpenGL to be pretty similar between venders.
Also while im here, would it not be possible to implement SSAO so that the DH chunks get some form of AO
Possible: yes.
Require more time than I have available: also yes.
hm, i would be up for trying to implement it
If you could that would be awesome! I'd be happy to merge in any changes you have.
If you need any help or direction just let me know.
Is the rendering part of the mod in
core -> com.seibel.lod.core.render
?
Or are there other places too that i should know?
(also we should prob move into some dev channel)Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Why though? From my understanding the z value gets mapped by the projection matrix, the distance gets mapped like
((dist - near) * (far - near))
so its a value between 0 and 1, then we can just expand it back into the distance and apply the minecraft dist and nearUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
something like this, if I remember correctly
https://developer.nvidia.com/content/depth-precision-visualized
NVIDIA Developer
Depth Precision Visualized
Depth precision is a pain in the ass that every graphics programmer has to struggle with sooner or later.

op
oh "no"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I think they would be related if nothing else
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Although it has been a while since I dug into OpenGL's depth buffer so my memory may be foggy :cou:
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hmm, something to look into after 2.0 has been released.
I'll have to create a git issue so this isn't forgotten.
OMG OMG CAN I GET YOUR SIGNATURE
big fan!!11!11
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unlikely to be changed any time soon, unless someone else decides to work on it.