Jump to content
Site Stability Read more... ×
  • Advertisement

Project: Voxyc

Lighting Voxel Buildings With Per-Vertex Lighting



I finally found a way to light voxel buildings with per-vertex lighting that looks decent. They key is to have a RGB values for each voxel, and set them in the following way:

  • Start from an empty point somewhere in the room
  • Expand on all three axes as far as you can until you hit a voxel on each axis, save min/max values 
  • Fill a rectangle box bound by min/max values on the three axes with desired RGB values

This works relatively well if each corner of each voxel/quad takes the color of the voxel value to the left/lower/rear of it (on x, y and z correspondingly). Then when you go from a somewhat radical RGB value (1.0, 1.0, 1.4 in this case) to default 1.0, 1.0, 1.0 in the next voxel, you get a nice gradient due to interpolation in the shader. If bet it will look even nicer if I try to make a gradient in the RGB voxel values from top to bottom, as if the light comes from the lamps on the ceiling. Gotta try that next.



Recommended Comments

There are no comments to display.

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
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!