Lighting voxel planets

Started by
2 comments, last by SpikeViper 8 years, 8 months ago

Hey guys! I've finished my basic planet generator (making spherical worlds out of cubes), and now I need some help. I need to figure out what the best type of lighting would be for my game - so here's what it needs to do:

1. Support blocks that light other blocks (Lava, Lamps, etc.)

2. Support semi-dynamic(ness?) (Planets will move closer and farther to the star)

3. Not be terribly laggy

4. Be possible to write in Unity C#

The big problem is the dynamic part. I have no clue how to wrap my head around it! wacko.png

Thanks for the help!

I'm making an open source voxel space game called V0xel_Sp4ce! Help me out with the repository here: https://github.com/SpikeViper/V0xel_Sp4ce

Advertisement

I'd either assign each face a light value or each vertex and blend them for smoother lighting depending on the number of vertices. Per vertex close up, per face a little farther out maybe?

To calculate light levels a modified flood fill should work just fine if you dont have to many light levels.


1. Support blocks that light other blocks (Lava, Lamps, etc.)

Static, precomputed. Use some kind of local radiosity approach to give some nice lighting effect.


2. Support semi-dynamic(ness?) (Planets will move closer and farther to the star)

If there's only one large,dynamic lightsource then use a simple directional/pointlight for the star with shadowmapping.


3. Not be terribly laggy

The standard case would be pre-computed lightmap + 1 directional/point light + one shadowmap, which is pretty standard for the last 15 years, so you should not encounter lot of issues here. If you need to recalculate the pre-computed lightmap, try to distribute the calculation of local changes over several frames to avoid performance spikes.

I'm in a bit of a catch - 22 now. I want blocks to spread light over other blocks, but each face needs a different value, so, for example, an closed area wont be lit by lights outside. How would I move the light through only air, but not have everything touching air be light?

So confused!

EDIT: I'm using a sort of "fake" light. It multiplies the vertex color by the light amount, so 0 would be black, 1 would be normal, and 2 would be white-ish.

I'm making an open source voxel space game called V0xel_Sp4ce! Help me out with the repository here: https://github.com/SpikeViper/V0xel_Sp4ce

This topic is closed to new replies.

Advertisement