POV-Ray : Newsgroups : povray.general : Yet another idea on specular reflection Server Time
5 Nov 2024 11:18:42 EST (-0500)
  Yet another idea on specular reflection (Message 1 to 7 of 7)  
From: Peter Popov
Subject: Yet another idea on specular reflection
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

From: Roland Mas
Subject: Re: Yet another idea on specular reflection
Date: 1 Oct 1998 22:37:32
Message: <m3zpbfvj2x.fsf@rpc66.acr.atr.co.jp>
"Peter Popov" <pet### [at] usanet> writes:

> 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.

  Gosh.  You got me.

> Still, please try to spare some brain clock cycles on this.

  I already did, but I guess you were just a little faster than I was.  All
you say seems almost natural to me, even if I had not formulated it clearly
yet.  Except that I was only using real faceted objects (like the actual
discobll), and I had not thought of using the tangent plans.

> 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>) 

  You know, Pete, this might just work.  If I had time...  I currently have
a running image, a big include file and a Python / Tkinter GUI...  And some
"real work" too.  Too bad.
 
  By the way, do you still need the .df3 library?  Now I have my PC, and I
can code it someday...  Maybe even this week-end.  If of course it is going
to be used (I won't use it myself before a looong time).

Roland.
-- 
Les francophones m'appellent Roland Mas,
English speakers call me Rowlannd' Mass,
Nihongode hanasu hitoha [Lolando Masu] to iimasu.
Choisissez ! Take your pick ! Erande kudasai !


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Yet another idea on specular reflection
Date: 2 Oct 1998 07:00:03
Message: <qqmn27f708l.fsf@goldach.fmi.uni-konstanz.de>
"Peter Popov" <pet### [at] usanet> writes:

> 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.
[...]

In my opinion, your suggestion goes in a good direction. It can even
be simplified and improved at the same time: Instead of considering
a single object it is almost as easy to determine for each sample ray
the first object that is hit. So, my idea is as follows:

Take a (spot-) light source. Shot sample rays from it. (As far as I
know this is a standard function in POV-Ray.) For each sample ray 
look at the first object that intersects with the ray. If this object
is reflective, create a virtual light source at the intersection point.
Of course, this virtual light source is created according to the
properties of the surface like normal, color, and reflection.

The problem with this and your idea is -- as far as I understood the
latter -- the number of the sample rays. If the object that is lit by
our super light source has a smooth, the reflected caustics should
also be quite smooth. This means a high number of sample rays. 
Furthermore, we want a uniform distribution of the sample rays, that
is not regular. Otherwise, the rays would be visible.
For the rendering of objects like a disco ball, it is furthermore
necessary that there are enough sample rays that every single mirror
reflects at least one sample ray -- or equally that for every mirror
at least one virtual light source is created. All these constraints
result in a considerably high number of sample rays. My fear is, that
this number will be to high.

My conclusion is, that we should consider one single sample ray. This
sound silly, but it would be useful to model laser beam and the like.
If we include reflection and refraction, then this could lead to some
interesting pictures.

Another method, which I already used, is to incorporate human knowledge
about the scene. More precisely, in a scene where a disco ball is lit
by a spot light, it is known where to place the virtual lights (if we
assume one light per mirror). Using the capabilities of the POV-Ray
language is it possible the automatically calculate the position of 
these light sources, their respective directions, and the test whether
they are in the shadow of the disco ball. I know this, because I've done
it. The result is at 
http://www.fmi.uni-konstanz.de/~willhalm/graphics/tracegallery/
I have even created an animation of my disco ball.

I'm sorry about my bad English, but my native language is German.

Thomas

-- 
http://www.fmi.uni-konstanz.de/~willhalm


Post a reply to this message

From: Peter Popov
Subject: Re: Yet another idea on specular reflection
Date: 2 Oct 1998 22:22:25
Message: <36157c51.0@news.povray.org>
Roland Mas wrote in message ...
>"Peter Popov" <pet### [at] usanet> writes:
>
>> <snip>
>> Still, please try to spare some brain clock cycles on this.
>
>  I already did, but I guess you were just a little faster than I was.  All
>you say seems almost natural to me, even if I had not formulated it clearly
>yet.  Except that I was only using real faceted objects (like the actual
>discobll), and I had not thought of using the tangent plans.

Well, the first time I ever thought about this problem was maybe three years
ago. It took me about three hours to work out the math... for a
triangle-based rendering engine. It's a piece of cake, really. However,
when it comes to tesselating CSG-ed high-degree polynomials, blobs,
or julias, I am definitely not your man. It was just a week ago that I
realized/realised I could sample the light source and not tesselate the
object.

The described algorithm is also suitable for true refractive caustics. The
difference is subtle and is in the generation and usage of V[1..n]. Sample
ray m hits O, refracts, hits it again at Pm, and leaves as m1 (that should
be "m prime"). Vm lies on the reflection of ray m1 in Pm (but where exactly?
I'll think of it) and it's color and brightness depend on two more
parameters of O: internal media scattering & absorption and light
attenuation of O (fade_distance, fade_power).

>> 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>)
>
>  You know, Pete, this might just work.  If I had time...  I currently have
>a running image, a big include file and a Python / Tkinter GUI...  And some
>"real work" too.  Too bad.

Glad to hear that, especially after you've been thinking along the same
lines for some time. Maybe we should move this thread to the programming
group and ask some of the code gurus there for ideas.

>  By the way, do you still need the .df3 library?  Now I have my PC, and I
>can code it someday...  Maybe even this week-end.  If of course it is going
>to be used (I won't use it myself before a looong time).

No bother, I'll do it myself. I'll be taking C++ this year anyway and this
will be a nice excercise. What was it, file i/o and basic voxel operations
(getVoxel, setVoxel)? Maybe a .df3 class will be best, esp. for a multi-doc
app. I'll give it a shot once I get a little more familiar with VC5.0

>Roland.
>--
>Les francophones m'appellent Roland Mas,
>English speakers call me Rowlannd' Mass,
>Nihongode hanasu hitoha [Lolando Masu] to iimasu.
>Choisissez ! Take your pick ! Erande kudasai !

Peter


Post a reply to this message

From: Peter Popov
Subject: Re: Yet another idea on specular reflection
Date: 4 Oct 1998 01:11:09
Message: <3616f55d.0@news.povray.org>
I am sorry if someone can't read my reply. I am reposting it. I just
re-installed Windows and Outlook, but I think I finally got it in the corner
and set it to plain non-encoded western text once and for all.

Thomas Willhalm wrote in message ...
>In my opinion, your suggestion goes in a good direction. It can even
>be simplified and improved at the same time: Instead of considering
>a single object it is almost as easy to determine for each sample ray
>the first object that is hit. So, my idea is as follows:


Well, I didn't make myself very clear, it seems. I supposed that one object
only - O - was lit by the spotlight to make things easier to explain and not
fiddle with O1, O2 etc. There were many variables anyway.

[...]

>Another method, which I already used, is to incorporate human knowledge
>about the scene. More precisely, in a scene where a disco ball is lit
>by a spot light, it is known where to place the virtual lights (if we
>assume one light per mirror). Using the capabilities of the POV-Ray
>language is it possible the automatically calculate the position of
>these light sources, their respective directions, and the test whether
>they are in the shadow of the disco ball. I know this, because I've done
>it. The result is at
>http://www.fmi.uni-konstanz.de/~willhalm/graphics/tracegallery/
>I have even created an animation of my disco ball.

If your disco ball is the one posted in binaries.images, it is what made my
cpu think a little on the subject.

>I'm sorry about my bad English, but my native language is German.
>
>Thomas
>
>--
>http://www.fmi.uni-konstanz.de/~willhalm

Peter


Post a reply to this message

From: Roland Mas
Subject: Re: Yet another idea on specular reflection
Date: 4 Oct 1998 20:29:57
Message: <m3d8873nwi.fsf@rpc66.acr.atr.co.jp>
"Peter Popov" <pet### [at] usanet> writes:

> The described algorithm is also suitable for true refractive caustics. The
> difference is subtle and is in the generation and usage of V[1..n]. Sample
> ray m hits O, refracts, hits it again at Pm, and leaves as m1 (that should
> be "m prime"). Vm lies on the reflection of ray m1 in Pm (but where exactly?
> I'll think of it) and it's color and brightness depend on two more
> parameters of O: internal media scattering & absorption and light
> attenuation of O (fade_distance, fade_power).

  For the position of the light source on the ray, I think we should do
some optics (heh, we're speaking about a raytracer, are we not?).  Take
into consideration the curvatures of the surface at the entry and exit
point of the ray into and out of the object.  Like for lenses, you know.
But, this would require not only to calculate normals (for the tangent
plan) but also these curvatures.  Not sure whether POV knows how to do it
in a general case.  Maybe some approximations (by sampling again) would be
necessary...

  I wish I had some more time.

Roland.
-- 
Les francophones m'appellent Roland Mas,
English speakers call me Rowlannd' Mass,
Nihongode hanasu hitoha [Lolando Masu] to iimasu.
Choisissez ! Take your pick ! Erande kudasai !


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Yet another idea on specular reflection
Date: 5 Oct 1998 05:00:28
Message: <qqmyaqvh20p.fsf@goldach.fmi.uni-konstanz.de>
"Peter Popov" <pet### [at] usanet> writes:
>
> Thomas Willhalm wrote in message ...
> 
> >Another method, which I already used, is to incorporate human knowledge
> >about the scene. More precisely, in a scene where a disco ball is lit
> >by a spot light, it is known where to place the virtual lights (if we
> >assume one light per mirror). Using the capabilities of the POV-Ray
> >language is it possible the automatically calculate the position of
> >these light sources, their respective directions, and the test whether
> >they are in the shadow of the disco ball. I know this, because I've done
> >it. The result is at
> >http://www.fmi.uni-konstanz.de/~willhalm/graphics/tracegallery/
> >I have even created an animation of my disco ball.
> 
> If your disco ball is the one posted in binaries.images, it is what made my
> cpu think a little on the subject.

Yes, it is.

For the integration of reflected light in POV-Ray, I think we should take
a look at the work that has already been done. Last weekend -- clearing up
my room -- I found a copy a paper with an interesting topic:

Illumination from Curved Reflectors

Pat Hanrahan and Don Mitchell. 
Computer Graphics (Proc. SIGGRAPH 1992), July 1992 

http://www-graphics.stanford.edu/papers/reflectors/

I haven't read it yet, and I'm not sure whether the presented technique can
be used in POV-Ray, but the images look promising.

Another article that sounds interesting is:
Monte Carlo techniques for direct lighting calculations 
Peter Shirley, Changyaw Wang and Kurt Zimmerman
ACM Transactions on Graphics
Volume 15, No. 1 (Jan. 1996)
Pages 1-36

However, I don't have a copy of it (yet).

Thomas

-- 
http://www.fmi.uni-konstanz.de/~willhalm


Post a reply to this message

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