Vertex lights: storing RGB in chars

posted in VoxycDev
Published March 07, 2019
Advertisement

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?

1892647883_voxycvertexlightexperiment1.thumb.jpg.9ddfaf89028ad7882a5985f2f3a07232.jpg263361318_voxycvertexlightexperiment2.thumb.jpg.84e1d0f8663ec135550cab7084987694.jpg1912812998_voxycvertexlightexperiment3.thumb.jpg.1fbb17d54955fac2ac86e1b3f928599f.jpg974512191_voxycvertexlightexperiment4.thumb.jpg.f4578c8994494b700791183086870889.jpg

1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement