Sign in to follow this  


Recommended Posts

My game is using a voxel engine.
I need to add shading to the game because right now all the faces kinda blend togeather.

I found this screenshot online to show something like I want to do:

It seems that the light depends only on the faces direction.

In my game only visible faces are rendered.
The game will "render" each piece of the map to Vertex and Texture lists to draw.

What is the best way to implement shading, or lighting?

I was thinking have 6 vertex and texture arrays one for each direction.
The faces will add to the corresponding arrays.
At draw time before drawing, change the amount of light for each array (technically vector)

My game map is split into chunks.
Each chunk has it's own vertex and texture lists.
With the map having 11^3 chunks on screen at once will this be a large slowdown?


How should I implement this?

Share this post

Link to post
Share on other sites
You could probably use that method for directional lighting, where you calculate the light applied by the direction of the light, though it could get tricky for more complex scenes, especially if you want to add shadows to it. There are several different ways to implement lighting, each with their own draw backs. Check into the Forward Lighting, Deferred Lighting, Pre-pass Lighting, or Inferred Lighting for some ideas. None of them are perfect, so you have to decide based on your needs.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this