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
Turn off all the lights. Calculate your own colors at each vertex. And then send your desired color along with each vertex at drawing time.

Or, calculate the illumination as a texture map to be draped over your objects. This works best for static scenes.

Share this post


Link to post
Share on other sites
quote:
Original post by bishop_pass
Turn off all the lights. Calculate your own colors at each vertex. And then send your desired color along with each vertex at drawing time.

Or, calculate the illumination as a texture map to be draped over your objects. This works best for static scenes.



Thanks for the answer bishop_pass, but I want to learn how to calculate the my own color for this case. I mean there is some color information for each vertex and I have light intensity. What is the correct way to interpolate them? This is somewhat different from the above though.

Share this post


Link to post
Share on other sites
Well, you can still look at the OpenGL lighting specification.
In case of one light, i think it uses something like:

Vertex_color = Ambient_color + Attenuation * Light_color

Where Attenuation = 1 / ( a + b*D + c*D*D ),
D is the distance from the vertex to the light position,
and a,b & c are user-defined constants.

Y.

Share this post


Link to post
Share on other sites