DH and True Darkness custom LightMap

Hello! So I've been trying to make a kitchensink with True Darkness and DH, but I realised that the DH lod chunks weren't actually dark during the night. So I investigated a bit how True Darkness makes blocks actually dark, and it's modifying the Lightmap. Now I have no background in minecraft's render loop, I do know a bit of openGL though, but since I am not clear enough with the render loop, it doesn't help me too much. here is where I think True Darkness is hooking up to change the lightmap : https://github.com/grondag/darkness/blob/1.19/common/src/main/java/grondag/darkness/mixin/MixinGameRenderer.java and here: https://github.com/grondag/darkness/blob/1.19/common/src/main/java/grondag/darkness/mixin/MixinLightTexture.java From what I understand of reading DH's injections, it's rendering before blocks are rendered, and from what I read, True Darkness injects themselves a bit later... if I understood correctly. (Can someone sanity check me?) So are there some things that could be done on either sides to make this work? I don't think I dug up nearly enough info to determine that, but I am limited by my knowledge at the moment. I'll do more reading ofc, but I would appreciate some help towards maybe making a patch (it might be time for me to finally get into proper modding)
GitHub
darkness/MixinGameRenderer.java at 1.19 · grondag/darkness
Hardcore darkness for Fabric mod loader. Contribute to grondag/darkness development by creating an account on GitHub.
GitHub
darkness/MixinLightTexture.java at 1.19 · grondag/darkness
Hardcore darkness for Fabric mod loader. Contribute to grondag/darkness development by creating an account on GitHub.
10 Replies
Celivalg
CelivalgOP3y ago
also yes, I posted the 1.19 version of the files instead of 1.18, oops, but they seem to be the same to me
BackSun
BackSun3y ago
Last I looked into the issue I think the problem is because DH only grabs the light map once (at the same time we generate the texture colors) and since True Darkness changes the light map over time it doesn’t render correctly. In order to fix the issue DH would need to be notified that the light map had changed and update it.
Celivalg
CelivalgOP3y ago
oh I see, I think I saw in the commits that this might actually have been fixed on the main branch, but not the 1.18 version. 1.18 is the 1.18.x archive branch right?
BackSun
BackSun3y ago
The main branch contains all MC versions and is the current in-development version.
Celivalg
CelivalgOP3y ago
Ah, I see, mmh, well then I need much more understanding on what those lightmap actually look like in the code, because I think it's actually hooked up to be updated, (https://gitlab.com/jeseibel/minecraft-lod-mod/-/blob/main/forge/src/main/java/com/seibel/lod/mixins/client/MixinLightmap.java) but True Darkness seems to be doing something weird...
GitLab
forge/src/main/java/com/seibel/lod/mixins/client/MixinLightmap.java...
This is a mod that adds a Level Of Detail (LOD) system to Minecraft. This implementation renders simplified chunks outside of the normal render distance allowing for an...
Celivalg
CelivalgOP3y ago
ok, from what I understand, True Darkness is setting the lightmap at HEAD of DynamicTexture.upload, whereas DH is getting it's lightmap at INVOKE of DynamicTexture.upload in LightTexture.updateLightTexture.... The way True Darkness ensures that they aren't changing other Dynamic textures is with a flag that only set when a lighttexture updates.... so True Darkness is doing something a bit ugly
Celivalg
CelivalgOP3y ago
created an issue on their github, https://github.com/grondag/darkness/issues/30 I think DH has everything to make it work tbh, and their injection is a bit inefficient in my taste
Celivalg
CelivalgOP3y ago
It's a bit sad that the read and write operations on the lightmap are so close together
BackSun
BackSun3y ago
Thanks for creating the issue, I've added links to both DH and True Darkness' issues.
Celivalg
CelivalgOP3y ago
just saw that, thanks!

Did you find this page helpful?