POV-Ray : Newsgroups : povray.advanced-users : output an octree file Server Time
31 Oct 2024 23:28:20 EDT (-0400)
  output an octree file (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: jazzman
Subject: output an octree file
Date: 9 Aug 2010 19:35:00
Message: <web.4c608fec6babf39befdd5d0@news.povray.org>
Hi all,

I was wondering if someone knows if there's an option to output an octree of the
rendered scene from POV-ray. All I need is to know for each cell in a 3d grid of
the scene whether it's occupied or not.

Any help would be greatly appreciated,
Jazzman


Post a reply to this message

From: Christian Froeschlin
Subject: Re: output an octree file
Date: 10 Aug 2010 15:55:06
Message: <4c61ae9a$1@news.povray.org>
jazzman wrote:

> I was wondering if someone knows if there's an option to output an octree of the
> rendered scene from POV-ray. All I need is to know for each cell in a 3d grid of
> the scene whether it's occupied or not.

I'm not sure if the internal data built during the render
is suitable for your needs, but even if so you'd need to
modify the source code of POV-Ray to get at it.

Alternatively, you can divide the scene into cubes in SDL
and use the trace function to check if they're empty or not
(within some error margin). In 3.7 you could even write
the data out in a binary format (such as df3).


Post a reply to this message

From: Jim Holsenback
Subject: Re: output an octree file
Date: 10 Aug 2010 18:17:00
Message: <4c61cfdc@news.povray.org>
On 08/10/2010 04:58 PM, Christian Froeschlin wrote:
> jazzman wrote:
> 
>> I was wondering if someone knows if there's an option to output an
>> octree of the
>> rendered scene from POV-ray. All I need is to know for each cell in a
>> 3d grid of
>> the scene whether it's occupied or not.
> 
> I'm not sure if the internal data built during the render
> is suitable for your needs, but even if so you'd need to
> modify the source code of POV-Ray to get at it.
> 
> Alternatively, you can divide the scene into cubes in SDL
> and use the trace function to check if they're empty or not
> (within some error margin). In 3.7 you could even write
> the data out in a binary format (such as df3).

see also this:
http://wiki.povray.org/content/Documentation:Reference_Section_2.5#The_.23write_Directive


Post a reply to this message

From: Jim Holsenback
Subject: Re: output an octree file
Date: 10 Aug 2010 18:55:58
Message: <4c61d8fe$1@news.povray.org>
On 08/10/2010 07:16 PM, Jim Holsenback wrote:
> On 08/10/2010 04:58 PM, Christian Froeschlin wrote:
>> jazzman wrote:
>>
>>> I was wondering if someone knows if there's an option to output an
>>> octree of the
>>> rendered scene from POV-ray. All I need is to know for each cell in a
>>> 3d grid of
>>> the scene whether it's occupied or not.
>>
>> I'm not sure if the internal data built during the render
>> is suitable for your needs, but even if so you'd need to
>> modify the source code of POV-Ray to get at it.
>>
>> Alternatively, you can divide the scene into cubes in SDL
>> and use the trace function to check if they're empty or not
>> (within some error margin). In 3.7 you could even write
>> the data out in a binary format (such as df3).
> 
> see also this:
>
http://wiki.povray.org/content/Documentation:Reference_Section_2.5#The_.23write_Directive

probably should also mention ... requires at LEAST v3.7.beta.32


Post a reply to this message

From: jazzman
Subject: Re: output an octree file
Date: 12 Aug 2010 18:00:00
Message: <web.4c646dd0e632d53a9ea3f41b0@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> jazzman wrote:
>
> > I was wondering if someone knows if there's an option to output an octree of the
> > rendered scene from POV-ray. All I need is to know for each cell in a 3d grid of
> > the scene whether it's occupied or not.
>
> I'm not sure if the internal data built during the render
> is suitable for your needs, but even if so you'd need to
> modify the source code of POV-Ray to get at it.
>
> Alternatively, you can divide the scene into cubes in SDL
> and use the trace function to check if they're empty or not
> (within some error margin). In 3.7 you could even write
> the data out in a binary format (such as df3).

Could you please specify how exactly I'm supposed to divide the scene up into
cubes? I'm not an expert in the SDL, so pointers to specific functions would be
helpful.
Also, how does the macro "trace" help me find out which cubes contain objects?
From my understanding, the macro traces a specific ray and returns its color.


Post a reply to this message

From: clipka
Subject: Re: output an octree file
Date: 13 Aug 2010 05:33:34
Message: <4c65116e$1@news.povray.org>
Am 12.08.2010 23:55, schrieb jazzman:

> Also, how does the macro "trace" help me find out which cubes contain objects?
>  From my understanding, the macro traces a specific ray and returns its color.

Not exactly; actually the inbuilt function "trace(...)" does trace a 
ray, but returns an intersection point (with some specified object) 
instead. By systematically shooting multiple rays at an object (or set 
of objects), you can determine (to some degree of accuracy) which space 
is indeed occupied by it (as opposed to min_extent() and max_extent(), 
which only give you the extent of a box that is guaranteed to encompass 
all of the respective object, but may be larger than strictly needed).

An alternative would be the inside() function, which tests whether a 
given point is inside the object. It may be more straightforward to use 
and also give better results for concave objects, but may also require 
more time, as you'll have to use N^3 tests as opposed to N^2 tests for 
the trace() approach.


Post a reply to this message

From: jazzman
Subject: Re: output an octree file
Date: 13 Aug 2010 07:05:00
Message: <web.4c652680e632d53ac1f7a70f0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 12.08.2010 23:55, schrieb jazzman:
>
> > Also, how does the macro "trace" help me find out which cubes contain objects?
> >  From my understanding, the macro traces a specific ray and returns its color.
>
> Not exactly; actually the inbuilt function "trace(...)" does trace a
> ray, but returns an intersection point (with some specified object)
> instead. By systematically shooting multiple rays at an object (or set
> of objects), you can determine (to some degree of accuracy) which space
> is indeed occupied by it (as opposed to min_extent() and max_extent(),
> which only give you the extent of a box that is guaranteed to encompass
> all of the respective object, but may be larger than strictly needed).
>
> An alternative would be the inside() function, which tests whether a
> given point is inside the object. It may be more straightforward to use
> and also give better results for concave objects, but may also require
> more time, as you'll have to use N^3 tests as opposed to N^2 tests for
> the trace() approach.

Actually, I need to know for every cube in the scene if it contains an object
(not for every square on the screen). So I need to perform N^3 tests anyways.
I can't seem to find any documentation on the "inside()" function. Could you
please refer me to some?


Post a reply to this message

From: Jim Holsenback
Subject: Re: output an octree file
Date: 13 Aug 2010 07:42:59
Message: <4c652fc3@news.povray.org>
On 08/13/2010 08:03 AM, jazzman wrote:
> I can't seem to find any documentation on the "inside()" function. Could you
> please refer me to some?

It's alphabetically listed in this section:
http://wiki.povray.org/content/Documentation:Reference_Section_2#Functions


Post a reply to this message

From: Thomas de Groot
Subject: Re: output an octree file
Date: 13 Aug 2010 10:34:36
Message: <4c6557fc@news.povray.org>
"Jim Holsenback" <jho### [at] povrayorg> schreef in bericht 
news:4c652fc3@news.povray.org...
> On 08/13/2010 08:03 AM, jazzman wrote:
>> I can't seem to find any documentation on the "inside()" function. Could 
>> you
>> please refer me to some?
>
> It's alphabetically listed in this section:
> http://wiki.povray.org/content/Documentation:Reference_Section_2#Functions
>

... or the "quick and dirty" search for "inside" in the Index of Help. ;-)

Thomas


Post a reply to this message

From: clipka
Subject: Re: output an octree file
Date: 13 Aug 2010 12:17:17
Message: <4c65700d$1@news.povray.org>
Am 13.08.2010 13:03, schrieb jazzman:

> Actually, I need to know for every cube in the scene if it contains an object
> (not for every square on the screen). So I need to perform N^3 tests anyways.

I'd suggest to...

- Test the scene objects one by one, unless they're very close to each 
other.
- For each object, restrict your testing to the bounding box as given by 
min_extent() and max_extent().
- Use 2x N^2 calls to trace() from two opposite sides of the bounding 
box, to further narrow down the subset of the bounding box where you 
have to use a series of inside() tests. (Obviously, you don't need to 
test on a line that doesn't intersect with the object anywhere.)


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

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