Jump to content
  • Advertisement
Sign in to follow this  
Magogan

Lighting and what else for a good-looking voxel game?

This topic is 1202 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

Hi,

 

3 questions:

 

First: Is there a best approach on how to implement lighting in a voxel engine? I already have a directional light and shadows, but the brightness of the shadow is the same everythere... I thought about storing a "light level" for each voxel in a texture and compute how dark a shadow is in a post-processing shader (per pixel), so I could not just determine the darkness of the shadows on the voxels, but also of the shadows on characters and objects. Should I do this for lit areas (which are determined by the shadow mapping) or should I just take the diffuse directional lighting intensity plus the intensity of point lights for lit areas?

 

Second: Are there any other things I could do to improve the look of a voxel game? It is not easy to navigate in caves because everything looks similar, even with textures... I don't know how to describe this... you sometimes can hardly see the edges of a voxel...

 

Third: How can I achieve that if you look from outside into a cave, everything is really dark, but when you walk into that cave, your eyes get used to the darkness and everything seems a little bit brighter (and vice versa when you leave the cave)? Should I just use the light intensity at the camera position for this?

 

Screenshot (4.07 MiB)

Edited by Magogan

Share this post


Link to post
Share on other sites
Advertisement

For outside: atmospheric fog - the greater the distance, the lighter the colors and the lower the contrast from light to dark. Even linear fog will enhance the feeling of distance.

 

For both inside and outside: mipmapping - more texture detail (maybe even normal mapping) for close objects. That will help to define edges a little better.

 

For reflective surfaces: specular lighting, particularly for water.

 

Lighting in caves: that can be problematic unless you can set a flag for surfaces that are inside a cave or hole. If you can do that, then for those surfaces, use a higher power for the diffuse intensity dropoff with distance - i.e., different lighting equations than outside. That will help darken voxels further from the eye and provide more contrast along edges. You could even code the power to be based on distance. I.e., the farther you are from a cave entrance, the more drastic the dropoff - to the point if you're more than several units away from the entrance, the light doesn't "penetrate."

 

I've not implemented it myself, so I'm unsure of the approach, but there is more color and contrast in shadow than in light. Not brightness, but color detail. Perhaps if you can use a paler-flatter texture for lighted pixels, and more colorful-higher contrast texture for shadowed pixels..

Edited by Buckeye

Share this post


Link to post
Share on other sites

Part of the issue is directional lighting. With purely directional lighting, every vertex, face and pixel receives the same intensity of light, depending on its orientation to the light source, resulting in a flat shaded look.

Share this post


Link to post
Share on other sites
The light level I mentioned is similar to the flag "inside/outside a cave", but with 8 bit for better transitions between areas with different brightness.

I already have mipmapping, but I want the world to look more "pixelistic" (something like minecraft, but with 32x32 textures on 0.5 meter voxels instead of 16x16 on 1 meter voxels).

Share this post


Link to post
Share on other sites

I use some fake directional-based ambient lighting. This is what it looks like in my voxel engine. The idea came from this article on image-based ambient lighting but I kept it more simple and instead am just using the six sides of a cube to gather lighting.

 

It's a simplified version of what Swiftcoder posted. The sides facing the skydome have different tints of color which change during the day/night cycle, as well as the intensity of the light bounce (how much they contribute to the final color). The sides facing the bottom are less saturated versions of the top colors. I only did this because the voxel lighting will block most of the light from the bottom sides anyways.

Edited by CC Ricers

Share this post


Link to post
Share on other sites

With voxels it should be quite easy to make some sort of semi dynamic GI system.

For some easier enhancements I would add scrolling cloud shadows.(simple projective textures). This add large scale dynamic and spatial variance. I also use lower mipmaps from cloud textures for diffuse and specular skylight shadowing.

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!