PoeticRainbow / golden-days

Golden Days is a Minecraft resource pack meant to bring back old textures, lighting, names, and sounds from older versions of Minecraft.
184 stars 11 forks source link

Using 1.17 shaders to add grey lighting in vanilla. #11

Closed coyo-t closed 1 year ago

coyo-t commented 3 years ago

Admittedly, the way I did this is a bit hacky, since the light texture is still by the game generated internally every frame, so I manually created my own lookup table and multiply the result of that by the highest block and skylight values in the light texture (so day/night still work correctly).

Also, the blocklight is not 1:1 like skylight is (they should be the same), as I felt it was too dark when inside. This might be due to default gamma settings changing between 1.7.3 and below vs 1.8 and above. If you want to use the accurate skylight, change any references to BLOCKLIGHT_LUT in shaders/include/light.glsl with LIGHT_LUT.

Let me know if I missed any shaders that have a light texture lookup (usually using texelfetch). I think I found all instances of this but I could be wrong.

Additionally, my shader code here probably isn't the fastest (due to that dynamic array access). I can't do a whole lot about that, like I said, the light table is still generated internally rather than in a shader (despite the fact that, aside from how the flicker is done, it is PRIME real estate for being created in a shader. RIP).

Could also be worth splitting this off into its own resource pack module, for people who actually do like the tinted+flickering lighting.

Edit: Upon further thinking shaders could 100% be used to implement classic-looking lighting for skylight. I don't think there would be much of a point to doing so but for the sake of completeness it can be done.

inboundbark commented 3 years ago

When using this the hand becomes completely black, any fix for this? image

inboundbark commented 3 years ago

Ok, so I figured out how to fix the issue, I replaced all the code in shaders/core/rendertype_entity_solid.vsh with the code in shaders/core/rendertype_entity_translucent.vsh and it seems to work correctly now.

PoeticRainbow commented 1 year ago

I will not be implementing this at this time.