DarkShadow44 / CptsModdingLight

Do What The F*ck You Want To Public License
5 stars 1 forks source link

Discussion of colored light mixing #52

Open DarkShadow44 opened 3 years ago

DarkShadow44 commented 3 years ago

This issue serves as a document/discussion regarding how colored light works.

Definitions:

Basic overview:

The basic approach of the mod is to run light calculation 4 times, one for vanilla, and for each RGB channel. A bit compute itensive, but very vanilla friendly. I don't see a better approach for "real" colored lighting. All color information is seperated form vanilla, so you can easily remove/add the mod without light glitches. Hurray for compatibility! Additionally, there's a color list for light emitting blocks to set the color of the light they emit. For blocks not in the list, light is assumed to be white. Colored light can also be filted though stained glass, Both sky and block light can be filtered like this.

Caveats:

Since each channel is between 0-15, there are a few unfixable issues:

Technical details:

We want to keep using the lightmap - since that is used for nightvison/lightning strike effects - and also handles sky light dependent on weather/day time. Not using the lightmap would be a huge PITA, so we need that. Plus, could help lamdbdynamiclight compat, but that's for the future.

The shaders get two light values for each channel, indicating strength of blocklight/skylight for that channel. Additionally we get the two lightvalues for the vanilla minecraft light level, that is, vanilla blocklight / skylight.

The question, how do we want them mixed together...

Problem

I'd love to have both skycolor/block color mixing (solutions 2) and no absolute black at night. And blocks to not go dark when placing glowstone... Ideas on how to improve mixing? If the document isn't easy enough to understand or unclear, please let me know!

DarkShadow44 commented 3 years ago

Maybe "normalizing" the color value before usage would help - making it's biggest value be 1. When all 0s, it would be 0 though.