Archived

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

nanik

Light HOW?

Recommended Posts

Hi all, I would like ask a simple question. Let''s say I did not like the DirectX or Opengl (or another) API''s or engine''s lightning structure, and I want to do this by msyself. How could I do this at the end? Ok. Bizzare question. I will explain. I have projected each point on to the screen, then using some math model I have calculated each intensities at these pixels. So how can I interact the intensity and the color information at each pixel? At first I think that RGB can be represented as Hue, Saturation and Intensity. So the OuputIntensity = LightIntensity* PixelColorIntensity is true or not?

Share this post


Link to post
Share on other sites
So if I understand you...
you have two bitmaps (in effect)
one representing the raw colour data of the image,
and another representing the required lighting intensity.
simply multiply the first image, by the second... ie:
say for a pixel, colours were r,g,b and the intensity required was i...
r''=(r*i)>>8;
g''=(g*i)>>8;
b''=(b*i)>>8;
where r'',g'', and b'' are the output colours... this operation can be carried out quickly, using MMX, but it should be done, per byte, not per pixel, for 8/24/32 bit screens.... it has to be done per pixel for 16 bit however (well, sort of_)

Share this post


Link to post
Share on other sites