Sodium

Sodium

35M Downloads

Clouds with a custom Resource Pack texture does not scale as expected.

mistrk7 opened this issue ยท 7 comments

commented

Version information

mc1.19.3-0.4.8+build.22

Expected Behavior

If a Resource Pack uses a custom cloud.png texture higher than the default (256x256), it is expected that the clouds will scale to size.

This is actually done in Vanilla, but with hilariously buggy results if you use Fancy clouds. (img: using my 'xBR Clouds' resource pack, 1024x1024 sized cloud file)

image

Actual Behavior

Instead, the texture keeps its pixel density and becomes larger across the sky. (img: sodium 0.4.8, resource pack on)

image

The Vanilla solution would be to just use Fast clouds, but the new cloud rendering optimisation fix in 0.4.7 removed that. It would be great that this would be fixed. I can no longer use this Vanilla workaround when Sodium is installed... :)

Reproduction Steps

  1. Download my Resource Pack or create a cloud.png texture higher than 256x256 in assets\minecraft\textures\environment. (Note: Lower resolutions not tested. might want to check.)
  2. Launch Sodium 0.4.7 or later
  3. Load up a world, and look at the sky.

When this bug is fixed it should look like how Vanilla attempts to do it, but fixed.

Java version

Java 17

CPU

Intel Core i7-10700F

GPU

NVIDIA GeForce RTX 2070 SUPER

Additional information

No response

commented

I've got a build that fixes the issue shown above and also fixes a few other things that honestly you'd only ever find if you were trying to find/cause issues.

however, as jelly has said increasing the cloud size with the current method doesn't scale well as you end up generating not only more geometry but refreshing it more frequently. and it's possible to crash the game if your clouds.png is large enough to exceed the max size of the buffer

i think next ill see where just making it update less frequently gets it by letting it translate the clouds further than a single cell at higher cloud resolutions, as long as it updates before the fog starts it should be identical.

Nice one.
Please keep us updated on this. Thanks

commented

If someone else wants to work on the code to implement Fast mode rendering, or to make the fancy-cloud rendering more performant at high texture resolutions, we're open to that...

We removed the Fast mode because it was additional work, and our Fancy clouds were so much faster than even vanilla's Fast clouds. It just didn't make sense to maintain both code paths. Probably it still doesn't, but we can fix Fancy clouds so people don't need to resort to this.

commented

It's possible for us to patch the "fancy cloud" rendering code to take into account the texture resolution. But that would require a lot more time on the CPU to generate the cloud geometry. The algorithm we're using isn't very fast, but it's fast enough that at the default cloud texture size (256x256) it ends up being a non-issue. With additional optimizations we could probably "cache" the geometry so that the performance is better, though that would need quite a bit of additional work.

commented

I've got a build that fixes the issue shown above and also fixes a few other things that honestly you'd only ever find if you were trying to find/cause issues.

however, as jelly has said increasing the cloud size with the current method doesn't scale well as you end up generating not only more geometry but refreshing it more frequently. and it's possible to crash the game if your clouds.png is large enough to exceed the max size of the buffer

i think next ill see where just making it update less frequently gets it by letting it translate the clouds further than a single cell at higher cloud resolutions, as long as it updates before the fog starts it should be identical.

image
image

1024px clouds
image

256px clouds
image