Jump to content
  • Advertisement
Sign in to follow this  
coderWalker

Shading

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

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?

Share this post


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

Share this post


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

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!