Jump to content
  • Advertisement

Project: Voxyc

Lighting Voxel Buildings With Per-Vertex Lighting

VoxycDev

703 views

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.

Screenshot_20190313-134813.thumb.jpg.45f29d06d1bb106bb5dbfb10657aebe0.jpgScreenshot_20190313-134741.thumb.jpg.ac57eef502daf14d46bf3c1e2c3bc207.jpgScreenshot_20190313-134629.thumb.jpg.a65500411d2d7dd2c605cb904d840d22.jpgScreenshot_20190313-134528.thumb.jpg.43fc51f9e691fb3b541c7fe949de6a94.jpgScreenshot_20190313-134444.thumb.jpg.5fd1d96654684091a5c71f7ca3abf9d3.jpgScreenshot_20190313-134346.thumb.jpg.43ff71a9057b6ca0ed94496487661bf9.jpgScreenshot_20190313-134203.thumb.jpg.39d70ec33d88d3e683ce8b7b85f97da3.jpgScreenshot_20190313-132923.thumb.jpg.2e6e8aea6fdef01d8cc649c1fefd1897.jpg



0 Comments


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!