Godlander / objmc

A tool to bypass Minecraft Java Edition model limits by baking vertex data into texture.
MIT License
515 stars 44 forks source link

Models do not render with Sodium installed #47

Closed opl- closed 5 months ago

opl- commented 1 year ago

Sodium version 0.4.11 for Minecraft 1.19.3 introduced a new "feature" which replaces the color of all transparent pixels in a texture with the average color of all non-transparent pixels:

https://github.com/CaffeineMC/sodium-fabric/blob/4ab16c83114e2c1e589628aac5690e2f1750b6e9/src/main/java/me/jellysquid/mods/sodium/mixin/features/mipmaps/MixinSpriteContents.java#L117-L118

This was supposedly taken from the Iris mod, so it's likely to affect those users too.

This change causes some of the data encoded in the texture to get corrupted, making the models invisible.

A workaround would be to never encode data in pixels with alpha set to 0.

(And yes, the exception for textures with leaves in their path got removed on the same day, so it can't be used as a workaround: https://github.com/CaffeineMC/sodium-fabric/commit/4ab16c83114e2c1e589628aac5690e2f1750b6e9#diff-c81d6d8b4e2b5fd501145113099af15a86983f5b8d2a0895d675932f6abcec4bR44-R52)

Godlander commented 1 year ago

oof this is the reason i dont want to support any mods they can just randomly change stuff.

if a trivial change can allow objmc to be more compatible, i'll do it. but i dont want to do unnecessary stuff for compatibility with arbitrary mods, especially since a lot of them just replace core shaders outright with no chance of compatibility in the first place.

there are likely much better ways of display 3d models if you're modding the game anyway.

opl- commented 1 year ago

Just for reference, Sodium is a client-side mod which aims to improve rendering performance. For some people the game runs at terrible framerates without it, so it's not entirely unreasonable for a player to be using it, especially if the alternative is 5 FPS.

From what I could tell while investigating, Sodium doesn't touch the shader. The draw call was identical to the vanilla one, with the only exception being the texture getting messed up. Of course that's not to say this won't change in the future.

That said, whether supporting this kinda stuff is worth it or not is of course up for debate. I considered opening a related issue in Sodium's repository, but I have no idea if they wouldn't consider it invalid and I don't know if I care enough. I mean, one could argue that it's Sodium breaking compatibility here.

I mostly opened this issue just so the time spent looking into it doesn't go to waste, as this might be helpful to someone in the future.

opl- commented 1 year ago

Sodium is also currently the second most popular mod on Modrinth with 4.67 million downloads, right after Fabric API with 6+ million downloads, so I think it's not that unlikely to see a player with Sodium in the wild.

That still isn't to say that I expect you to support it. Mod compatibility is a slippery slope. :P

Felix14-v2 commented 1 year ago

Sodium version 0.4.11

Can you check this with Sodium 0.4.10 and 0.5.3? Sodium 0.4.11 has been removed from Modrinth due to compatibility issues and high instability. I don't think supporting this exact version makes sense.

opl- commented 1 year ago

I am actually running Sodium 0.5.3, and the issue is still very much present. I mentioned 0.4.11 simply because that's the version which introduced this feature, and it's still present to this day.

Godlander commented 1 year ago

From what I could tell while investigating, Sodium doesn't touch the shader.

sodium currently only breaks block core shaders, and doesn't change entities. however, if you read the readme, i do have a screenshot of jellysquid stating they will also break entity core shaders too, at which point there will be no compatbility at all.

one could argue that it's Sodium breaking compatibility here.

yea thats basically my argument. they have to do this to achieve the performance improvements though, so theres just no way around it.

Sodium is also currently the second most popular mod on Modrinth with 4.67 million downloads, right after Fabric API with 6+ million downloads, so I think it's not that unlikely to see a player with Sodium in the wild.

but how many out of those also have iris? theres simply nothing we can do for modded shaders.

i think the only solution is to just use another mod that can render 3d models and has support for modded shaders. maybe something like https://www.curseforge.com/minecraft/mc-mods/mcgltf. but it doesn't look like it has support for reading model files from a resourcepack. i'm not sure how feasible that would be to add.

awesomedudeer commented 9 months ago

Have they now broken entity core shaders because my maxwell is invisble it goes over bread.