Skip to main content
gamedev.net
🔒 Locked

Shading

Started by coderWalker Apr 11, 2011 at 2:47 AM 2 replies 1.5k views
Original Post
coderWalker
coderWalker
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:
Rqhx3.jpg

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?

Ideas?

How should I implement this?
If this post was helpful please +1 or like it !

Webstrand
Seabolt
Seabolt
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.
Perception is when one imagination clashes with another
coderWalker
coderWalker
I am using Vertex and Texture arrays.

Should I have the seperate arrays for the directions? or is there a way to have a light array?
If this post was helpful please +1 or like it !

Webstrand
Danny02
Danny02
for such voxel worlds a sort of AmbientOcclusion is possible. This can be calculated on the cpu for each cube face while generating the world

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.