Jump to content
  • Advertisement

Project: Voxyc

Vertex lights: storing RGB in chars



I got lucky. This wasn't supposed to work so quickly. The vertex lights are functioning. Completely random and crazy and wrong, but functioning. I hear that Unreal gave up on vertex light mapping years ago. Probably for a good reason. Texture memory is cheap now. No time to integrate lightmapper and vertex lights already worked in my engine years ago. Re-adding them for version 3.

How to store RGB in a char? When light hits a color, their values multiply. When light hits light, their values add. Unsigned char holds values from 0 to 255. The final value will be a float in the shader, but with what range? (-1.0, 1.0)? No, because you often want to multiply by more than 1.0. The highest I ever multiplied a light by is 3.0. So from 0 to 255, maybe range can be to 0.00 to 4.00? As in 64 = 1.0, 128 = 2.0, 196 = 3.0, 256 = 4.0? I wonder what is the most efficient way to store light values in chars so they can be multiplied as floats in the shader. What is the highest value, in practice, that a color value could be multiplied by?



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!