Lighting whoes

Hi,

I’ve done lighting in my game, thus if you place a lamp, area around it is lit up (basically adjust the colour on each block near the light, further block away, less light it gets). Now, I’ve
got day/night cycle in my game and what I’m doing is setting the blocks in the game to multiply its r,g,b value by the day/night cycle float value which ranges from 0.0 to 1.0f. Problem
with this is, if there are any lamps been placed, the blocks near the lamp will adjust colour due to the day/night value. I guess what I need is to see if block is near lamp, and if so, don’t use the day/night float value - does this sound reasonable?

Hope the above makes some sense?! ;D

Thanks

I believe that your color are not adding the way you want. I don’t know the specifics but there are several different ways to add colors and the default way is not the way you want. You either have 2 options. To find out how to add colors the way you want or use some sort workaround with the default way.

For the first option, I recommend reading this page:
http://www.java-gaming.org/index.php?topic=22467.0

For the second, I can only say that its up to you to determine if your workaround works for you.

Yeah multiplying by 0 for night will kill your light. You’d be better off going down the road most light shaders go down, splitting light into separate components

timeOfDayLight + lightFromSource

in which light from the time of day will gradually decrease to 0 (probably better at 0.1 or something so you can see a little unless you want pure blackness) and the light from your placed lights will be unaffected.

You’ll want to play with it though, I’m not sure if lumens are cumulative, so you could maybe take only the max of timeOfDayLight and lightFromSource instead of adding them.

@JESTERRRRRR, yes, light is cumulative.