Jump to content
  • Advertisement
Sign in to follow this  
SpikeViper

Unity Lighting voxel planets

This topic is 1064 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Edited by SpikeViper

Share this post


Link to post
Share on other sites
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.

Edited by KuroSei

Share this post


Link to post
Share on other sites

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.

Edited by Ashaman73

Share this post


Link to post
Share on other sites

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.

Edited by SpikeViper

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!