Box2d lights seems ok, but still not giving the sort of lighting I want like this:
How would this be achieved?
Thanks
Box2d lights seems ok, but still not giving the sort of lighting I want like this:
How would this be achieved?
Thanks
That video kinda looks like how minecraft lighting works, there are several explanations around which I can’t find right now. It would just need modifying so that walls dont entirely block all light.
Yeah, I think you need set blocks to certain light levels dependent on how far they are from a light source - guess tinting the blocks?
Some psuedo like:
distance = (block.position - light.position). Length();
lightPower = distance / light.MaxDistance;
finalTint = light.Color * lightPower;
Render Block, with finalTint
But what to do if you got lots of lights next to each other?! I’m so confused with this.
http://minecraft.gamepedia.com/Light
I think this contains sufficient information to work out how to do it. I havnt seen anything illustrating how to implement or optimize it with regard to how to update things when a light or block is moved/added/removed… but each block has a light value associated with it, which is only updated when something changes, so you dont have to calculate the lighting every frame.
the light in minecraft doesnt go through solid blocks, so you would have to allow for that by making solid blocks decrease light level more quickly than empty blocks, but not block it completely.
Thanks for that,
I was thinking of adding a light value to my block class, this would need updating when a torch was placed some place I guess.