kvverti / colormatic

An independent implementation of the custom colors mod for Minecraft 1.15-1.18
GNU Lesser General Public License v3.0
108 stars 49 forks source link

Incorrect emulation of lightmaps. #82

Closed coornio closed 2 years ago

coornio commented 2 years ago

Specifically I am using the John Smith Legacy resource pack. To my understanding it uses custom color values for certain light sources and such, so Colormatic was right up my alley to use.

Back to the issue at hand. Here is what it looks like through Optifine itself:

2022-02-13_18 00 31

This is what it looks like in Fabric/Sodium/Starlight when Colormatic isn't loaded as a mod:

2022-02-13_18 07 16

And this is what happens when it is loaded:

2022-02-13_17 59 41

I'm fairly certain this isn't supposed to be this way. This bug might be affecting more than just this particular resource pack but I can't know for sure as I don't actually use any others.

Based on some blind searching, I figured out which assets in particular caused this disparity. They are located under assets/minecraft/optifine/lightmap, three different maps that dictate, to my understanding, the kind of light sources produce. For convenience, I will attach these files here directly for review. world0 world1 world-1

Removing them manually from the resource pack, the light goes right back to normal. I have brought up this situation on the John Smith Legacy discord as well to get their thoughts on the matter.

Ideally I'd like to continue using the custom lightmaps. A potential side-effect of this wrong emulation is that game text turns yellowish/orangish during night hours, which at first I thought was a feature of the mod itself. On the one hand I love that aspect of it, but on the other hand I can't use it when all light sources produce incorrect lightmaps because of this mod.

Please review and let me know if there's something more I can provide or what could be done about this.

kvverti commented 2 years ago

What is your brightness setting?

kvverti commented 2 years ago

It seems that Optifine uses a different color blending algorithm than Colormatic. I don't know Optifine has changed recently or not.

I will note that Colormatic does correctly render the brightest color channels. John Smith Legacy has just chosen to make the night sky lighting brighter than half of the block light levels.

coornio commented 2 years ago

What is your brightness setting?

This was on Moody, so 0% brightness. Colormatic does indeed render the brightness properly, it's the brightness fall-off that's too abrupt. That lightmap has something to do with it for sure, and I could potentially modify it as a fix if I knew what to change and how in the first place.

If you wish for me to test something in particular or provide more info just let me know. Also not sure whether the game text hue change at night-time is a related bug or not, it was kind of buried at the end of my original post.

kvverti commented 2 years ago

I think I've found the issue. Colormatic uses max(block, sky) to calculate the combined color instead of block + sky. I've fixed it for the next release but I'll need to do a bit more testing to make sure it looks all right.

coornio commented 2 years ago

I think I've found the issue. Colormatic uses max(block, sky) to calculate the combined color instead of block + sky. I've fixed it for the next release but I'll need to do a bit more testing to make sure it looks all right.

That's great to hear! Here's hoping this will also include the Iris fix from #78 when it drops :)

coornio commented 2 years ago

In case it helps, I can also build the source on my own to do testing. I attempted to make some changes based on what you said in the last comment (presumably L#158 in LightmapTextureManagerMixin.java I think?) but nothing I did made a change so I clearly have no idea what I'm doing there :D

If you make any commits, just let me know if there's any particular scenarios to test and I can get back to you here with the results!

coornio commented 2 years ago

I would like to point out that by the time this commit took place, the lightmaps were proper once again. All is well in 3.1.0 too so we can consider the issue itself resolved! <3

I have to say though, I'll miss the bug of the font turning yellow at night time. It was much easier on the eyes in dark environments. Hope you might consider adding that sort of thing as an option in a future version!