CptSpaceToaster / CptsModdingLight

Do What The F*ck You Want To Public License
39 stars 15 forks source link

Texture Error with Custom Liquids during Darkness. #33

Open Wristwatch1 opened 9 years ago

Wristwatch1 commented 9 years ago

I've noticed with the most recent build 35, When a Custom textured Liquid has a coloured light value applied to it using the API (E.G: CLApi.setBlockColorRGB(this, 15, 15, 15);), When it turns night, the Liquid will default back to the standard water texture. This even applies if the liquid has a ordinary light value applied to it (E.G: setLightLevel(1.0f);).

CptSpaceToaster commented 9 years ago

I'm not sure this is a bug, or if this a mistake in implementing the API.

1.) Define "When it turns night" (certain tick value? just anytime it's "dark?") 2.) Is the behavior repeatable if you use CLApi.setBlockColorRGB(this, 0, 15, 15); 3.) Is the behavior repeatable if you use CLApi.setBlockColorRGB(this, 14, 14, 14); 4.) Are you still calling setLightLevel(1.0f) to an block before you call CLApi.setBlockColor? I have no idea how you're using the API, and there's a really good chance you're simply using something in an unexpected way. I would need to see how you're using the API, and repeat the problem myself before I can even hope to fix anything.

Screenshots of all of the cases would be nice.

Also, is there any source code I can look at? Right now, all I know is that you might have a problem, but I don't have any confirmation that the problem exists, or what to look for... so you're not helping me fix any problems here :)

Wristwatch1 commented 9 years ago

First off, it doesn't Happen when the mod is NOT installed into the game. The API can be installed and have no errors. To answer the 4 Queries:

1.)https://www.youtube.com/watch?v=tQTMkKhE1Qo shows how the liquid reacts to a change in day, while https://www.youtube.com/watch?v=LwmyiM2ehFY Shows how the liquid reacts to a cave. so it seems like its based on the light level of the immediate area to the liquid.

2.)Setting the liquid to CLApi.setBlockColorRGB(this, 0, 15, 15); produced this result: http://i.imgur.com/SQmTkL5.png As you can see, the light around some areas of the liquid has changed to Cyan, but most of it is still white light, with broken textures.

3.)Setting the liquid to CLApi.setBlockColorRGB(this, 14, 14, 14);, produced no change in the textues.

4.)I originally was calling setLightLevel(1.0f) on the liquid, but I found that disabling it had no effect on the texture of the liquid. As for the API, I am using it in the same way you showed me how to, using https://github.com/CptSpaceToaster/TestingColoredLightAPI/blob/master/src/main/java/com/example/examplemod/ExampleColoredLightBlock.java as the basis of the code.

5.) If you have a bitbucket account, I can invite you to my source code.

EXTRA FINDINGS: After testing with liquids that were using the CLC code, and ones that weren't, I have come to the conclusion that it has something to do with how CLC Renders liquids classed as water in general, as a liquid with no light shined on it in darkness renders normally, while one with light on it, be it from itself or from a torch, becomes the regular water texture, shaded with its custom texture colour. The Sun does not cause this affect, as it is altering the natural light level.

In conclusion, I don't believe this to be an API Glitch, as liquids that were not using the API were still affected. This is a Rendering Issue.

CptSpaceToaster commented 9 years ago

Thank you for the video. That was quite helpful. At certain times of the day, it looks like the liquid renderer starts stepping on it's own lightvalue entries when rendered in full sunlight. At other moments, your liquids only appear to be listening to blue color components.

1.) I'm assuming you were testing a white colored liquid in both videos that was intended to produce white light? 2.) I'm assuming you haven't written your own renderer (and you're relying on vanilla)

If those two points are correct, then it's something I can look into fixing. If you did write your own renderer, then we'll need to see the source, and find out where you're stepping on a lighting value, as that'd be your issue again.

Still need a bit more info.

Wristwatch1 commented 9 years ago

1). Yes, that was the intention. I did test with different colors off-camera, and each one had varying results, E.G. The Red coloured liquid would become a very blue shade of purple during darkness, while still emitting red light.

2). They are using the Vanilla Liquid Renderer.

I do also want to point out, that as seen in this promo image I did last year: http://i.imgur.com/9vCD8s6.png This bug was not present in CLC for 1.7.2.

CptSpaceToaster commented 9 years ago

The old renderer for 1.7.2 wasn't capable of coloring anything but solid blocks. The new system we have is fundamentally different, but attempts to color everything. Fences, half slabs, chests, etc.

If you're using the vanilla renderer, then I need to go fix it.

I'll look at this as soon as I can

CptSpaceToaster commented 9 years ago

Some documentation that explains on a technical level, why things turn blue: https://gist.github.com/CptSpaceToaster/8b6dbd107e5fe44ab7b7