POV-Ray : Newsgroups : povray.unofficial.patches : ambient light handling : ambient light handling Server Time
1 Sep 2024 16:19:16 EDT (-0400)
  ambient light handling  
From: EliasH
Date: 31 Jan 2001 08:39:09
Message: <3a78157d@news.povray.org>
Hello,
    I am trying to figure out, the way POV handles ambient light. As far as
I know, an oversimplified
formula to compute the light in a surface, can be given by

    I = Ia + Id + Is + ...

where Ia = ambient light, Id = diffuse light, Is = specular light etc.

The problem is that POV does not seem to use that formula. Specifically,
instead of just adding the
ambient term to the total, it multiplies each R,G,B coefficient with the
color pigment. The code is in
lighting.c, #2504, in function compute_lighted_texture

      /* Add ambient contribution. */
      TmpCol[0] += Att * LayCol[0] * Layer->Finish->Ambient[0] *
Frame.Ambient_Light[0] * AmbCol[0]);
      TmpCol[1] += Att * LayCol[1] * Layer->Finish->Ambient[1] *
Frame.Ambient_Light[1] * AmbCol[1]);
      TmpCol[2] += Att * LayCol[2] * Layer->Finish->Ambient[2] *
Frame.Ambient_Light[2] * AmbCol[2]);

Thus, there seems to be no way, to have for example a red colored shape,
with green ambient light:

// Sphere object
sphere { <0, 3, 0>, 3
   pigment { color rgb<1,0,0> }
   finish {
      ambient <0,1,0>
      diffuse 0.7
      phong 1
      phong_size 80
      brilliance 2
   }
}

All that this does, is that it produces a red sphere with NO AMBIENT light!

I would appreciate any suggestions. Thanks for your time!

    Regards,
        Elias Hatzigeorgiou.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.