|
|
Jing Li wrote:
> I am studying the implementation of the Ambient lighting in POV-Ray.
The implementation is a lot better "studied" by reading a textbook than then
the optimised POV-Ray implementation.
> As I know that the illumination equation of Ambient is the multiplication of
> the intensity of the ambient light (Ia) and the ambient-reflection
> coefficient of the object (Ka).
Please be advised that the variable names in formulas, including those for
the ambient term, vary from author to author. No need to go into this
detail here, you can safely assume we know what the ambient term is :-)
> from a surface to the incident luminosity. I do not understand it. There is
> a good explanation at http://geography.bu.edu/brdf/brdfexpl.html.
This explanation is not good at all. I am not even sure it aims to explain
what you think it does at all. I would strongly recommend you go with one
of the books cited in the documentation, see
<http://www.povray.org/documentation/view/3.6.1/211/>, in particular with
(1) and (8).
> Att = (1.0 - (LayCol[pFILTER]*max3(LayCol[0],LayCol[1],LayCol[2]) +
> LayCol[pTRANSM])); [Formula 2]
>
> where pFILTER, pTRANSM are the elements of a enum variable which defining
> the indices of the Color array elements: pRED = 0; pGREEN = 1; pBLUE = 2;
> pFILTER = 4; pTRANSM = 4; The LayCol is the color from the certain layer
> for a given 3d point and a pigment. It is computed by calling the method
> "Compute_Pigment(...)" in file pigment.cpp.
No need to rephrase the source code, it just makes your posts harder to read
to find your real problem :-)
> POV-Ray's help document explains
Please note that the documentation is not the appropriate source for
information about the algorithms used inside POV-Ray, it is written for
users, not implementors. As such, deriving formulas from information in the
documentation will not get you where you want!
> the pigment as the color or pattern of colors for an object. It is
> the basic color of the object, not the color the object looks like in a
> scene which is brightened or darkened by POV-Ray depending on the lighting
> in the scene.
I think you are misunderstanding the documentation here. You interpretation
"basic color of the object, not the color the object looks like" does not
make sense. The pigment provides _the_ object's surface color, without it
the object is black.
I get the impression you are not understanding the difference between
shading and color. The common shading functions compute the lighting at a
specific surface location, they do not compute the color! As such, you will
not find the color in the common descriptions of shading functions (though
extending them is easy).
To get a color, a lot more has to be taken into consideration. There is the
surface color, the color of the reflection and the color of the refraction.
And then you have your shading function, which, in more elaborate models,
the light sources which may have a color as well. Essentially the final
color is the addition of the weighted colors, as appropriate multiplied by
the result of the shading function result.
And, to repeat myself, the POV-Ray source code is the wrong place to try to
learn about this. Books provide a much better structured, step-by-step
description.
> The test scene has ambient lighting rgb<0.3, 0.3, 0.3> except any other
> lighting sources. The sphere's surface has ambient rgb<0.6, 0.6, 0.6>, and
> black pigment. POV-Ray generates a total black image when only define the
> global ambient lighting and the object's ambient reflection. From the
> [Formula 1], it is obvious that the LayCol is black as it is the pigment of
> the object. As a result, the result color computed by [Formula 1] is black.
From your somewhat confusing explanation so far it looks like you did not
specify a pigment. Without it, your object will be black.
> I am confused why POV-Ray implements the ambient light like this.
Your confusion is not about POV-Ray, it is due to you looking at the wrong
place for explanations. Please read, and make sure you understand, a
textbook on the subject first! Then the POV-Ray source code will be clear(er).
Thorsten Froehlich, POV-Team
Post a reply to this message
|
|