POV-Ray : Newsgroups : povray.advanced-users : Simulating vignetting in a camera : Re: Simulating vignetting in a camera Server Time
29 Jul 2024 04:31:21 EDT (-0400)
  Re: Simulating vignetting in a camera  
From: hughes, b 
Date: 7 Feb 2003 22:33:41
Message: <3e447a95@news.povray.org>
"Slime" <slm### [at] slimelandcom> wrote in message
news:3e442587@news.povray.org...
> > Does anyone know how to simulate the vignetting that was present in old
> > camera lenses - a loss of brightness towards the edge of the field, say
> > according to a cosine law?
>
> Simple solution: put a sphere around the camera, textured with a
cylindrical
> texture (so the values you give in your color_map correspond to the cosine
> of the angle), using colors of rgbf<?,?,?,1> where the ? goes from 0 at
the
> edges to 1 in the center.

I'll try to expand on this and use transmit, and not filter, as the variable
and rgb 0 for the color. However, when I try the cos-4th law as I just found
it (not knowing of it before) I can't seem to get POV-Ray to produce the
same result for cos(A)^4 by using pow(cos(A),4). Am I doing that wrong? For
example, I find cos(20/2)^4 in a calculator to be
0.94060186578282644642735371998179 and yet in POV it is 0.495673773. Maybe
the order in which the operands work causing the discrepency? Although I
don't see how that could be the reason at all.

Here's the test scene I was messing with:

// my lame attempt at lens cos 4th law, not meant to be used as a totally
working concept

#declare A=67; // angle
#declare R=<10,0,0>; // orientation
#declare L=<0,0,-5>; // location
#declare V=20; // variable, degrees? divided in half later

camera {
  location  0
  look_at   z
  angle A
  rotate R
  translate L
}

sphere {
  0, 1
  texture {
    pigment {
      cylindrical
      color_map {
        [0 color rgb 0 transmit 1 ]
        [pow(cos(V/2),4) color rgb 0 transmit pow(cos(V/2),4) ]
        [1 color rgb 0 transmit 0 ]
      } frequency -1 rotate 90*x
    }
    finish{
      ambient 0 diffuse 0
    }
  }
  scale 0.0001 // make small/invisible
  rotate R
  translate L
}

#debug concat(str(pow(cos(V/2),4),-1,9))

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0 rgb <0.7,0.8,0.9>]
      [1 rgb <0.2,0.5,0.8>]
    }
  }
}

light_source {
 <-30, 30, -30>,1
}

// ----------------------------------------

plane {
  y, -1
 pigment {color rgb 1}
}

sphere {
  0.0, 1
 pigment {color rgb 1}
}


Post a reply to this message

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