#### Archived

This topic is now archived and is closed to further replies.

# Real Time Lighting.....

This topic is 5965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How do u make Real Time Lightings in 8bit (256) color mode ??

Very carefully?

##### Share on other sites

Given a surface normal and a direction vector for your light source(s), add the product of the color value and the cosine of the angle between the normal and the light to the surface''s color value. ie,
vector3d snorm; // surface normalvector3d light; // magnitude and direction of light// It''s often helpful to keep these vectors normalized, but it may not work for you...float shading_factor = light * snorm; // dot product yields cosine of angle// now when drawing, multiply light color by shading_factor and add to surface texture/color

##### Share on other sites
I store my lightmaps in my Leveleditor in 8bit lightmaps....
R3_G3_B2 or so :o).. works great hehe..

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

##### Share on other sites

R3_G3_B2 !! yuk !! You''re joking about that, are you

- JL

##### Share on other sites
Well I think I''d do normal RGB shading and then find the closest match in the palette for the resulting color. But that might be too slow to be real-time?

##### Share on other sites
No I''m not joking about that R3_G3_B2 stuff... it''s only for the lightmaps and it works fine! even for colored ones hehe.. they''re blended anyhow... and I need to save memory in my Leveleditor :O)))

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

##### Share on other sites
R3_G3_B2 is horrible, even for lightmaps. I use 16 bit textures R5_G6_B5, OK they take twice the memory, but they look so much better. You can also use 8bit paletted textures for lightmaps, they look even better, but need to be quantized first.

- JL