POV-Ray : Newsgroups : povray.general : lights and tiles : Re: lights and tiles Server Time
6 Aug 2024 06:20:10 EDT (-0400)
  Re: lights and tiles  
From: Slime
Date: 2 May 2002 16:36:26
Message: <3cd1a34a$1@news.povray.org>
> 2 - There's something strange in the way that light
>   intensity is calculated. Real lights have intensity
>   decreasing proportionally to the inverse of the
>   squared distance:
>
>    I  = K / d^2

I'm not sure this is 100% true. Because if it were, that would mean that as
you approached the light source, the light intensity would approach
infinity. So if you put your eye an inch or so away from a candle, it would
probably be like looking directly at the sun and you'd go blind. So this
can't really be 100% true.

The equation 1/(1+d^2), after about two or three units from the origin, is
extremely similar to 1/d^2. (graph the two functions in a program and you'll
see why.) The only difference is that near the origin, 1/(1+d^2) has the
value of one (not infinity). I think this is a lot closer to the real life
model, and it still has the property that light intensity is *almost*
proportional to the inverse of the distance squared.

As for the checker pattern you were talking about, you may be interested in
this function that I came up with recently for my "traditional raytracing
desktop" image:

#declare smoothcheckerbasis = function (x,y,z,allfloors,xv,yv,zv) {
 select(allfloors-floor(allfloors/2)*2,
  0,
  max(xv-.5,yv-.5,zv-.5, .5-xv,.5-yv,.5-zv),
  min(xv+.5,yv+.5,zv+.5, 1.5-xv,1.5-yv,1.5-zv)
 )
}
#declare smoothchecker = function (x,y,z) {

smoothcheckerbasis(x,y,z,floor(x)+floor(y)+floor(z),x-floor(x),y-floor(y),z-
floor(z))
}



functions only work with POV-Ray 3.5 (which is still in beta), but if you're
using that, this should help you. It's best used as:

pigment {
    function{smoothchecker(x,y+.5,z)}
    // a color map similar to this will be most effective:
    color_map {
        [.4 rgb 0]
        [.6 rgb 1]
    }
}

I use "y+.5" instead of just "y" since the function is only interesting
halfway through a unit. It has a solid value of .5 at all integer values.

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]


Post a reply to this message

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