POV-Ray : Newsgroups : povray.programming : Adaptive trees (AMR) in POV ray Server Time
22 Dec 2024 07:45:27 EST (-0500)
  Adaptive trees (AMR) in POV ray (Message 1 to 4 of 4)  
From: Tom Fogal
Subject: Adaptive trees (AMR) in POV ray
Date: 15 Jul 2005 21:09:42
Message: <42d85e56$1@news.povray.org>
Hi all, maybe this belongs as a followup to Daniel Neilson's KD-tree
thread, but its not /really/ related. I didn't get the feeling that his
approach was adaptive, but maybe I'm wrong.

I was curious if POV ray itself or anyone out there was working on an
AMR based representation of the objects in a scene. For those not
familiar with the buzzword, its basically the same old subdivision
methods except now the tree can adapt in time. For example, a ball in
the upper left quadrant might be flying towards the upper right in an
animation. At the beginning of the animation, the top left quadrant
would have lots of resolution -- that quadrant would be defined by 4
subquadrants, and one of them (the one that contains the ball) might
have 4 of its own divisions. As the ball moved to the right, the
subquandrants would be swallowed up into their parents, and new
subdivisions would be created closer to the ball. This is of course
with a quadtree, for the 2D case; a three dimensional implementation
would use an octree (but those are harder to talk about :).

I've been searching for an example of some AMR (oops, never defined the
acronym: 'adaptive mesh refinement') code, something closer to an
implementation than the information I'm finding in research papers.

Thanks for any help / pointers!

-tom


Post a reply to this message

From: Christoph Hormann
Subject: Re: Adaptive trees (AMR) in POV ray
Date: 16 Jul 2005 02:05:01
Message: <dba7rr$2kd$1@chho.imagico.de>
Tom Fogal wrote:
> 
> I was curious if POV ray itself or anyone out there was working on an
> AMR based representation of the objects in a scene. For those not
> familiar with the buzzword, its basically the same old subdivision
> methods except now the tree can adapt in time. For example, a ball in
> the upper left quadrant might be flying towards the upper right in an
> animation. At the beginning of the animation, the top left quadrant
> would have lots of resolution -- that quadrant would be defined by 4
> subquadrants, and one of them (the one that contains the ball) might
> have 4 of its own divisions.

You should know this only makes very limited sense since POV-Ray shapes 
are not approximated with triangle meshes for the render.  Your 'ball' 
would be just a sphere which is a single entity and does not profit from 
being subdivided in a spartial data structure.

Also note the required detail level does not only depend on the distance 
of the camera in a raytracer - adaptive subdivision (for thse shapes 
where it could make sense) would only work on per-ray basis.

Finally in contrast to a scanline renderer you don't gain a lot of speed 
by replacing a detailed triangle mesh in a raytracer with a low detail 
representation.

So to sum it up the only significant gain of such a technique would be 
cases of mesh subdivision where it is either very expensive to generate 
the whole mesh or it takes too much memory to store it.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.tu-bs.de/~y0013390/ (Last updated 01 Jul. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: Tom Fogal
Subject: Re: Adaptive trees (AMR) in POV ray
Date: 18 Jul 2005 16:19:08
Message: <42dc0ebc$1@news.povray.org>
On 2005-07-16, Christoph Hormann wrote:
> Tom Fogal wrote:
>> 
>> I was curious if POV ray itself or anyone out there was working on an
>> AMR based representation of the objects in a scene. For those not
>> familiar with the buzzword, its basically the same old subdivision
>> methods except now the tree can adapt in time. For example, a ball in
>> the upper left quadrant might be flying towards the upper right in an
>> animation. At the beginning of the animation, the top left quadrant
>> would have lots of resolution -- that quadrant would be defined by 4
>> subquadrants, and one of them (the one that contains the ball) might
>> have 4 of its own divisions.
>
> You should know this only makes very limited sense since POV-Ray shapes 
> are not approximated with triangle meshes for the render.  Your 'ball' 
> would be just a sphere which is a single entity and does not profit from 
> being subdivided in a spartial data structure.

Hrm, yes, I remember that a common technique is to enclose complex
geometries with simple ones (such as spheres) and test for sphere
intersection before intersection with the geometry.

In a comp. graphics class I recently took, we also talked about spatial
subdivision too, so I was hoping POV ray used that under the hood (in
which case adaptive subdivision makes more [well, at least some]
sense).

> Also note the required detail level does not only depend on the distance 
> of the camera in a raytracer - adaptive subdivision (for thse shapes 
> where it could make sense) would only work on per-ray basis.

From this I get the impression that I did not explain things properly,
or perhaps what I label 'spatial subdivision' isnt the commonly
accepted nomenclature. Picture for example:

 \
  \
   \
   \|/
/-------------------------------------------\
|                     |                     |
|                     |                     |
|       A             |          B          |
|                     |                     |
|-------------------------------------------|
|                     |                     |
|                     |                     |
|       C             |          D          |
|                     |                     |
\-------------------------------------------/


with a ray entering from A at the indicated place and (approximate)
angle. In tracing the ray, it becomes obvious that it only passes
through both A and C, and thus any objects (read: complicated meshes)
which are contained wholly outside of A and C do not need to be checked
for intersection.

The idea is that this process could be applied recursively (of course)
to split up A and C, and also adaptively -- maybe a human (read:
complex triangle mesh) is standing in the upper right quadrant of A and
moving to C; one could recursively divide A and the children from A
until the human is contained almost entirely within an exact fit box.
That box could 'move' over to C later in the animation.

Spheres are (of course) cheaper than boxes for a ray-intersection test,
so I guess my original question was fairly naive -- I'd probably be
hard pressed to find a raytracer which splits objects into boxes instead
of enclosing them in spheres.

Mea culpa, thanks for the clue bat,

-tom


Post a reply to this message

From: Daniel Hulme
Subject: Re: Adaptive trees (AMR) in POV ray
Date: 18 Jul 2005 17:11:30
Message: <20050718221130.5371368b@dh286.pem.cam.ac.uk>
> The idea is that this process could be applied recursively (of course)
> to split up A and C, and also adaptively -- maybe a human (read:
> complex triangle mesh) is standing in the upper right quadrant of A
> and moving to C; one could recursively divide A and the children from
> A until the human is contained almost entirely within an exact fit
> box. That box could 'move' over to C later in the animation.

The problem is not nor explanation, nor the spatial tree structure.
POV-Ray already uses a hierarchy of bounding slabs. The thing is, for an
animation, POV-Ray parses the scene afresh for each frame, recreating
the bounding slab tree from scratch. Thus each tree is static and has no
need to adapt to changing geometry.

Thank you anyway for your suggestion.

-- 
"The  rules  of  programming  are  transitory;  only  Tao  is  eternal.
 Therefore you  must contemplate Tao before you receive  enlightenment."
"How will I know when I have received enlightenment?"  asked the novice.
"Your program will then run correctly," replied the master.


Post a reply to this message

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