Archived

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

browny

Real Time Lighting.....

Recommended Posts

Cosine shading.

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 normal
vector3d 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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster

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

- JL

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites