MoreMcmeta / emissive-plugin

Plugin for MoreMcmeta to enable emissive textures for blocks, items, entities, and block entities.
GNU Lesser General Public License v3.0
4 stars 0 forks source link

Overlays do not work on fluids #3

Closed dopadream closed 1 year ago

dopadream commented 1 year ago

Describe the bug Trying to make the lava texture fully emissive yields no results

Screenshots or videos image image (not emissive)

Which Minecraft versions does this bug affect? 1.20.1

Mod loader Which mod loaders does this bug affect?

Mods list Tested only using this, fabric api, and the core moremcmeta mod. Any blocks made emissive through your mod render perfectly fine. It's only on lava (and possibly water too, haven't tested).

soir20 commented 1 year ago

Emissive textures are really maximum brightness overlays. However, lava is already maximum brightness because the lava "blocks" are emitting light, so the emissive overlay doesn't look any brighter. If you use a different texture besides the lava flow as the overlay, you should be able to see the overlay; you just won't be able to perceive that it's emissive.

I'll double check this with water to make sure there's no issue with rendering overlays on fluids.

dopadream commented 1 year ago

Uh... but if you make a block fully emissive it has no shading on all four sides. I've tested it. The same should work for lava regardless of its light level (for example, i tested it with a beacon, and it works fine) image

Here's an example of working emissives on lava. This was done through core shaders in a resource pack. image

dopadream commented 1 year ago

I'd like to clarify that the overlay does work on lava, but the emissive setting does absolutely nothing and it still looks dark on some faces of the block.

soir20 commented 1 year ago

I've tested this with water and checked the code, and it looks like overlays currently aren't rendering on fluids at all. (Are you sure you're seeing the overlay and not just the regular lava texture?) I'll start working on a fix.

dopadream commented 1 year ago

I've tested this with water and checked the code, and it looks like overlays currently aren't rendering on fluids at all. (Are you sure you're seeing the overlay and not just the regular lava texture?) I'll start working on a fix.

Yeah I'm pretty sure. When I tried putting on a random texture for an overlay it would work albeit buggy and stretched out

soir20 commented 1 year ago

Do you still see the overlay if you remove the Fabric API? MoreMcmeta includes the Fabric API modules it uses as part of the mod jar. I wonder if one of the modules it doesn't include (and isn't being used in my dev environment) is causing the overlay to appear.

dopadream commented 1 year ago

Now that I look closer I think the stretched mess is just the texture compressing and repeating a lot due to the animation loading properly. I fixed the formatting of the file and yeah I think you were right, it appears overlays just don't work on fluids.

soir20 commented 1 year ago

Thanks for checking and clarifying--it's actually less work to implement this if the overlays aren't working at all, rather than working in some cases. 😆

dopadream commented 1 year ago

Hey! Small update, sorry if this isn't useful information as I imagine the fix you pushed to the repo is still a WIP, but I managed to build a jar and it's working! Lava renders overlays perfectly and the emissives work properly! Only caveat unfortunately is that it seems to not render fluid overlays at all with Sodium and Indium enabled, which I imagine is because sodium renders fluids entirely different from vanilla. Do you think there's any solution here?

soir20 commented 1 year ago

I'm glad it's working well. The fix is more or less finished; I just need to do final testing on all versions outside of a dev environment (hopefully meaning a release later tonight).

Sodium entirely rewrites chunk and liquid rendering, so the only fix I see is to inject a mixin into Sodium's code that is equivalent to the ChunkRebuildTaskMixin introduced in the latest commits. Adding mixins to work with specific mods isn't something I have the appetite for. I'd have to keep up with Sodium updates, and it also adds a lot of testing work.

6 MC versions x 2 loaders = 12 mods per release to test currently. A Sodium-compatible version of the plugin would add another 6 with a potential need for more frequent releases. That's difficult for me to justify for emissive liquid support.

If you wanted to, you could implement a mod that would be like Indium for Sodium and the MoreMcmeta emissive plugin. (Or build a custom version of the plugin just for yourself.) However, I don't guarantee that the emissive plugin's internals will be stable like the MoreMcmeta API is stable, though it doesn't change often in practice.

dopadream commented 1 year ago

I see. I agree it would not be tenable to support on your end, but I'll try to see what I can do after the update is out officially

soir20 commented 1 year ago

Emissive plugin v1.1.0 has been released, which contains support for liquid overlays. It will take a few minutes for the release scripts to finish and for CurseForge to approve the files.

You might be able to make something work with Sodium without referencing any internal emissive plugin code. Core's MetadataRegistry is part of the API and would allow you to access metadata from the emissive plugin. This is what 1.1.0 uses to retrieve the metadata when rendering liquids; you'd essentially have to reimplement the most recent commits for Sodium.

FYI, there was also some interest in making Rubidium (Sodium for Forge) work with the emissive plugin: #2.

soir20 commented 1 year ago

If there's anything else to discuss about Sodium emissive liquid compatibility, let's move that to help wanted or core dev questions.