POV-Ray : Newsgroups : povray.general : Yet another idea on specular reflection : Yet another idea on specular reflection Server Time
13 Aug 2024 09:27:36 EDT (-0400)
  Yet another idea on specular reflection  
From: Peter Popov
Date: 1 Oct 1998 22:04:50
Message: <361426b2.0@news.povray.org>
Hi all.

This thinking task has been running at low priority in my brain for a long
time and I think it finally rendered something worth considering. True
specular reflection is probably one of the most discussed possible
improvements to POV so I won't be surprised if someone else has already come
up with the same idea. Still, please try to spare some brain clock cycles on
this.

This method is, of course, a heuristic one, and as such is based on the
presumption that one would not use it by default in all scenes and for every
pixel, but rather for specific objects and/or light sources. Here's how it
works.

Let's suppose we have a disco ball lit by a projector. We are interested by
the specular reflections of this spotlight, let's call its origin L, in this
object, let's call it O. L can also be a point light but we must constrain
the calculations to a minimum, so an angle must be assigned to it so that
for our purpose it behaves as a spotlight, and otherwise as a regular point
light. In both cases we will designate the angle with A. A spotlight may be
assigned a different A than its radius or falloff. This will prevent useless
calculations if, for example, we want the disco ball to cast a shadow on the
ceiling _and_ cause reflective caustics. In any case L and A form a single
virtual light cone C (see below).

The main idea of this method is that to determine if a point is indirectly
lit by L after being reflected in O, we use virtual light sources. They are
only taken into account when calculating specular reflections. These n
virtual light sources V[1..n] are generated in the following way. At a
pre-render stage, n sample rays S[1..n] are shot from L that lie within its
virtual light cone. They are shot in such a way that the volume of C is
completely enclosed in the union of the volumes of the cones with L as their
common peak, S[1..n] as their axes and corresponding angles
A[1..n] which must be kept minimal. To put it in a simpler way, imagine that
we have to completely enclose the area of a disc within a specified number
of circles of minimal radii so that there is minimal redundancy in area
coverage. There should be some statistical way to do this (particle
repulsion?), but it is unfortunately beyond my math knowledge.

For the sake of simplicity we will consider O as the only object directly
lit by L. So when sample m ( 1 <= m <= n) hits O at point Pm, we find the
reflection of L in the plane tangent to O at Pm and call it Rm. A virtual
spotlight Vm is generated with its origin at Rm, angle of Am and its
corresponding cone Cm thus formed. It's (Vm's) color is based on the
color of O at Pm as lit by L and O's finish properties with Pm being
considered a point of specular reflection.

So let's see if a test point, say T, is specularly lit by L. If T does not
lie within any C[1..n] then we  write it off. Let's suppose it lies within
the cone Cp (1 <= p <= n). A ray is shot from T towards Rp. If this ray does
not intersect O we skip Cp (since this is a sampling error) and go on with
the next C that T lies in (if there is such). If it does, we do a regular
ray-shape intersection test with the rest of the objects in the scene. We
must take into account two things here. First, objects "behind" the surface
of O (as viewed from T) cannot block light from Vm for trivial reasons.
Second, we only need one such object "in front: of O and can stop
shadow testing the moment we find it. We apply the following steps for
all cones C that T lies in and sum up the results.

I think this algorithm should work, and not tremendously slowly at that. For
the specularly unlit parts of the scenes it will only do a ray-shape
intersection test for, say, 100 cones (pyramids), and POV doesn't seem
troubled by such trivial things when it has to calculate a 2000 facets disco
ball or a polished silver 4-D atanh julia fractal :).

That's it, put as clearly as I could. I would really to see your comments on
this (especially the ones like "You know, Pete, this might just work! I'll
try and code it tomorrow..." <G>) Let me know if I am missing something, if
this algorithm is absolutely wrong, if you have came up with this last week
and want to chop my head down to the waist for stealing your idea, etc...

Peter


Post a reply to this message

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