Page 1 of 1

Light Colorations

Posted: Fri Sep 14, 2012 3:56 pm
by DocHussey
Alright, I noticed that in the Dev Diary thread someone mentioned about light colorization. I made an uninformed post, and was told to move it here, which seems like a good idea.
Why can't light sources from different blocks be colored independently? They all reference the file "light_normal.png" for their colors, but couldn't that little snippet of code be changed to reference say "light_lava.png"? I really don't know anything about Java, and in other coding I've done/seen, it's a simple task to change that ref line. Anyone know why this isn't possible/hasn't been done yet?

Re: Light Colorations

Posted: Fri Sep 14, 2012 4:49 pm
by Anbaric
See, it seems like the easiest thing in the world. Make like five or six copies of the light_normal.png, and change that single line of code in each light-giving source to use a different file. Then you can color each of those files whatever you want. Not quite sure why it hasn't been done yet, but soon I'll be wanting to start programming, and this kind of easy change would probably become my first mod.

Re: Light Colorations

Posted: Fri Sep 14, 2012 7:31 pm
by Magnavode
Having lurked this forum for a while now and being a java dev myself I thought it would be a good time to register and post something useful.

It's because Minecraft stores it's light values in 2 arrays of 4 bit values. One array for sky light and one array for block lights. It stores a light value from 0 to 15 (16 = 4 bits) this is the block light values that everyone who plays Minecraft should be familiar with.

To get new colors in this system you would either have to;
- create a third array to store light values for each block.
or
- change the system to store rgb values. This could end up rather complex.

This is obviously quite difficult to do, not to mention the extra cpu time the system would need to calculate everything.
Also: blending.

Re: Light Colorations

Posted: Fri Sep 14, 2012 7:34 pm
by FlowerChild
Anbaric wrote:Not quite sure why it hasn't been done yet
...
this kind of easy change would probably become my first mod.
Seriously, don't you see a bit of a problem with the above?

Guys, if you haven't looked at the code, and are assuming something is "easy", and nobody has yet to do it, guess what? You're probably wrong.

I didn't want this discussion going on in the dev-diary thread as it was so full of face-palm I risked giving myself a concussion.

Re: Light Colorations

Posted: Sat Sep 15, 2012 1:17 pm
by PatriotBob
Because nearly the entire rendering pipeline would need to be overhauled.

I read the Jeb was looking into it, and died a little on the inside.
But such is the life of a dev that inherits terrible code.

I'll see if I can look up the link...

Re: Light Colorations

Posted: Sat Sep 15, 2012 2:09 pm
by DocHussey
I didn't mean for this to turn into an all out derp fest, I just remember doing some modding for games like Neverwinter Nights and Diablo 2 and those kinds of things were common and easy to do. Struck me as odd, and I was hoping that someone could explain why it was so nasty...