POV-Ray : Newsgroups : povray.programming : Improved intersection routine for CSG-Intersection objects Server Time
26 Nov 2026 05:00:00 EST (-0500)
  Improved intersection routine for CSG-Intersection objects (Message 91 to 108 of 108)  
<<< Previous 50 Messages Goto Initial 50 Messages
From: Warp
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 18 Dec 2003 19:44:35
Message: <3fe249f3@news.povray.org>
In fact, the 'inline' keyword is obsolete with regard to inlining.
In most current compilers this keyword has no effect whatshoever on
the behaviour of the compiler: If the compiler can inline a function
and its inlining algorithm tells it that it will be beneficial, it will
inline it, else it won't. And this is completely regardless of whether the
'inline' keyword appears or not.

  The 'inline' keyword has a quite different task, however, which means
that it isn't completely obsolete in C++. It's actually a command for
the linker (and has nothing to do with inlining).

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: ABX
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 19 Dec 2003 02:21:53
Message: <k585uv8aeba6p2bsibmbrhn20pmcs03uu5@4ax.com>
On Thu, 18 Dec 2003 21:32:49 +0100, Wolfgang Wieser <wwi### [at] gmxde> wrote:
> > It does not abstract most of the GUI elements at all, it just
> > draws them on its own. 
>
> Correct. So what?

So it is not user-friendly for native GUI users (which of course is not
related to C++ internal design discuted here nor to improved intersection
routine). See screenshots of native minimal sample under wxWindows:

OS2:    http://www.wxwindows.org/images/screens/wxos2.jpg
Win9x:  http://www.wxwindows.org/images/screens/minimal_win95sm.gif
Motif:  http://www.wxwindows.org/images/screens/minimal_motifbig.gif
MacOSX: http://www.wxwindows.org/images/screens/minimal_macosx.gif
GTK+:   http://www.wxwindows.org/images/screens/minimal_gtk.gif
WinCE:  http://www.wxwindows.org/images/screens/wxwince_minimal.jpg
http://cvs.wxwindows.org/viewcvs.cgi/wxWindows/samples/minimal/minimal.cpp

and screenshots of more advanced application of wxWindows under MacOSx,
Windows, Linux: http://mahogany.sourceforge.net/screenshots.html

ABX


Post a reply to this message

From: Wolfgang Wieser
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 20 Dec 2003 05:31:52
Message: <3fe42517@news.povray.org>
Thorsten Froehlich wrote:
>> What you did not mention is some sort of tree structure. I'm not
>> sure about the details, but isn't there the need for a tree traversal
>> to decide if the dynamic_cast is valid? (Think of multiple
>> inheritance...)
> 
> No, you just search through a list.  That list is (in general, but
> necessarily for every case - it may be shorter) as long as the total
> number
> number of classes a class inherited from.  This has to do with the common
> vtable structure.  How exactly it is implemented of course all depends on
> your compiler runtime library implementation.  You may want to check if
> source code is provided for it (many vendors do provide source code).
> 
Okay, and do you think that explains how the following code 
works: 

-----------------------------
#include <iostream>

struct A
{
        int a;
        A():a(1){}
        virtual ~A(){}
};

struct B
{
        int b;
        B():b(2){}
        virtual ~B(){}
};

struct C : A,B
{ };

int main()
{
        C c;
        A *a=&c;
        std::cerr << (dynamic_cast<B*>(a))->b << std::endl;
}
-----------------------------

Obviously, you can cast A to B without either one being derived 
from the other one just because they share a common parent. 

I must admit that I did not spend a lot of time on thinking but 
as for now, I cannot imagine any algoritm which can perform the 
above dymanic_cast without doing tree traversal. 

Wolfgang


Post a reply to this message

From: Wolfgang Wieser
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 20 Dec 2003 06:11:49
Message: <3fe42e74@news.povray.org>
Thorsten Froehlich wrote:
>>> It does not abstract most of the GUI elements at all, it just
>>> draws them on its own.
>>>
>> Correct. So what?
> 
> If the GUI look changes, Qt does not.  So you end up with a really ugly
> application full of (for the user) odd redraw errors.  And it many cases
> the Qt widgets don't behave exactly as their native counterparts,
> resulting in a plain usability nightmare <sigh>
> 
Okay. As I am only using Qt under Linux, I do not see that problem. 
But regarding MS Windows, you may well be right. 

And well... probably ABX is right: We're off-topic here. 

But as we're talking about GUI, I'd favour complete separation 
of the raytracing core and the GUI for future POVRay versions. 
It should be possible to build a non-GUI POVRay for render farms. 

Wolfgang


Post a reply to this message

From: Christopher James Huff
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 20 Dec 2003 11:55:43
Message: <cjameshuff-484E9E.11555020122003@netplex.aussie.org>
In article <3fe21f39@news.povray.org>,
 "Thorsten Froehlich" <tho### [at] trfde> wrote:

> > And if you ever did GUI with Java, you will find Qt like heaven...
> 
> I wrote a tiny program in Java once, and it didn't even have a GUI.  Since
> that day, programming in Java is something I will do voluntarily experience
> again!

The language isn't that bad, actually...though it is missing a few 
things that I'd really like to have. The standard frameworks, however...

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 20 Dec 2003 16:38:45
Message: <3fe4c165$1@news.povray.org>
In article <3fe42e74@news.povray.org> , Wolfgang Wieser <wwi### [at] gmxde>  
wrote:

> But as we're talking about GUI, I'd favour complete separation
> of the raytracing core and the GUI for future POVRay versions.

You will be surprised ... this is already possible with POVMS. Not that it
is easy to use in the 3.5.0 source code...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 20 Dec 2003 16:45:38
Message: <3fe4c302@news.povray.org>
In article <3fe42517@news.povray.org> , Wolfgang Wieser <wwi### [at] gmxde>  
wrote:

> Obviously, you can cast A to B without either one being derived
> from the other one just because they share a common parent.
>
> I must admit that I did not spend a lot of time on thinking but
> as for now, I cannot imagine any algoritm which can perform the
> above dymanic_cast without doing tree traversal.

You may recall one can keep binary trees in an array.  Essentially, if you
take away the need to add and remove elements (as C++ class inheritance is
fixed this requirement is fulfilled), you actually have to fold the whole
"tree" to a list.  The exact rules, while well defined, are a bit
complicated, but what exactly has to happen is specified in the ISO C++
specification...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Andreas Kaiser
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 13 Jan 2004 04:59:22
Message: <4003c167.85148617@news.povray.org>
"Mael" <mae### [at] hotmailcom> wrote:

>> I'll try again later on a more recent system
>
>This time I tried on windows (VC++ 6) and same (wrong) results for
>chess2.pov (you can render it without focal blur for faster test)
>I hope this is something easy to track down .. good luck :-/

I've got it (sorry for the long delay but i was on holiday together
with my children).

I'll post the fixed version of csg.cpp to povray.binaries.programming.

Andreas


Post a reply to this message

From: Andreas Kaiser
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 13 Jan 2004 07:19:35
Message: <4003c18e.85187202@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:

>Mael wrote:
>>>Hmm, but this isn't benchmark.pov...
>> 
>> 
>> Does benchmark.pov have lot of intersections csg ? It seems fair to me to
>> test this patch on a scene that uses it (and perhaps even a lot of it to
>> clearly show the effect of the new algorithm)
>
>The benchmark scene uses a reasonable amount of CSG, a comparison with 

I don't think so.
Both of my private builds take about 38min for benchmark.pov (PIV
2.8GHz, 1GB RAM, options are -w384 -h384 +a0.3 +v -d -f -x).

Setting use_photons = use_area_light = show_clouds = show_objects to
false				==> about 114sec both.
Additionally remove the Sockets ==> about  79sec both.
So as a rough estimate the intersection objects only take about 2% of
the total time.

>this scene would show how much gain you can expect in a typical scene.
>You can of course construct a scene where POV-Ray spends 90% of the time 
>with CSG calculations but this would not be very realistic.

Yes and no.
Give me a ratio old version <-> new version and i'll give you a scene
that shows a better ratio :-).
This is a problem with benchmarks or measurements generally, you have
to have a close look at the boundary conditions.
IMHO benchmark.pov can be used to benchmark the hardware it is running
on but i wouldn't use it to profile/compare different versions of
POV-Ray on the same hardware.

Andreas


Post a reply to this message

From: George Pantazopoulos
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 14 Jan 2004 23:44:50
Message: <opr1svpgu4hr234r@news.povray.org>
> Yes and no.
> Give me a ratio old version <-> new version and i'll give you a scene
> that shows a better ratio :-).
> This is a problem with benchmarks or measurements generally, you have
> to have a close look at the boundary conditions.
> IMHO benchmark.pov can be used to benchmark the hardware it is running
> on but i wouldn't use it to profile/compare different versions of
> POV-Ray on the same hardware.
>
> Andreas

I agree. Just because a patch does not appreciably speed up benchmark.pov 
does not mean that the patch isn't worthwhile. Why is benchmark.pov 
arbitrarily declared to be the ideal or typical POV-Ray scene, anyway? 
With so many possibilities of doing things in POV-Ray, is there even such 
a thing as "the typical scene" ?


George


-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


Post a reply to this message

From: Ken
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 15 Jan 2004 00:14:54
Message: <4006229C.572F22AE@pacbell.net>
George Pantazopoulos wrote:

> I agree. Just because a patch does not appreciably speed up benchmark.pov
> does not mean that the patch isn't worthwhile. Why is benchmark.pov
> arbitrarily declared to be the ideal or typical POV-Ray scene, anyway?
> With so many possibilities of doing things in POV-Ray, is there even such
> a thing as "the typical scene" ?

Benchmark.pov was not "arbitrarily declared" a typical scene. It was carefully
designed to test a wide variety of feature sets present in the program and to
pose as a reasonable challenge to modern computing architectures. There is no
way a single scene is going to create a high level performance test for every
feature the program offers and even if you could it would take forever to
render. Instead we decided to craft a scene with a balanced set of features
that could reasonably be expected to test both the performance of the program
and the computers it is operated on while at the same time maintaining an
acceptable rending time. To date the developers have used it extensively for
fine tuning the performance of the program both internally and at compile
time and if it does nothing else it has performed beyond expectations for
accomplishing that.

-- 
Ken Tyler


Post a reply to this message

From: Warp
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 15 Jan 2004 10:42:09
Message: <4006b4d1@news.povray.org>
I fully agree with Ken.
  benchmark.pov has been designed to mearure the rendering speed of typical
scenes in average.

  However, I agree with George as well: If a feature does not slow down
benchmark.pov but considerably speeds up some feature which is rather
often used, in my opinion it's worth adding.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 15 Jan 2004 12:06:56
Message: <4006c8b0$1@news.povray.org>
In article <4006229C.572F22AE@pacbell.net> , Ken <tyl### [at] pacbellnet>  
wrote:

> Benchmark.pov was not "arbitrarily declared" a typical scene. It was carefully
> designed to test a wide variety of feature sets present in the program and to
> pose as a reasonable challenge to modern computing architectures. There is no
> way a single scene is going to create a high level performance test for every
> feature the program offers and even if you could it would take forever to
> render. Instead we decided to craft a scene with a balanced set of features
> that could reasonably be expected to test both the performance of the program
> and the computers it is operated on while at the same time maintaining an
> acceptable rending time. To date the developers have used it extensively for
> fine tuning the performance of the program both internally and at compile
> time and if it does nothing else it has performed beyond expectations for
> accomplishing that.

While all you say is correct and remains valid, it has to be admitted that
benchmark.pov has one little bias as it does give a rather heavy weight to
the noise function due to the clouds.  Another thing is that while it is a
realistic benchmark for comparing POV-Ray performance of roughly similar
systems (same architecture) when using them to do "real" work with POV-Ray,
it is not suitable to compare the performance of any particular
processor/system with a specific other one to determine which one is
"faster".

The reason is that such a comparison is not optimal with the default
benchmark.pov is that automatic bounding is turned on, which makes the major
task while rendering searching the bounding volumes.  This to a major part
depends on memory access.  It is really a lot of searching, but not so much
computing at all...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Christoph Hormann
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 15 Jan 2004 12:32:06
Message: <kdvid1-8m.ln1@triton.imagico.de>
Andreas Kaiser wrote:
>>
>>The benchmark scene uses a reasonable amount of CSG, a comparison with 
> 
> 
> I don't think so.
> Both of my private builds take about 38min for benchmark.pov (PIV
> 2.8GHz, 1GB RAM, options are -w384 -h384 +a0.3 +v -d -f -x).
> 
> Setting use_photons = use_area_light = show_clouds = show_objects to
> false				==> about 114sec both.
> Additionally remove the Sockets ==> about  79sec both.
> So as a rough estimate the intersection objects only take about 2% of
> the total time.

Which is exactly the case for an average 'real' scene (real meaning not 
a technical test scene but a true final scene for a real image).  I 
guess if you do a statistical analysis of some of the better POV-Ray 
generated IRTC submissions you will find this confirmed.  This is not 
the case for scenes that make heavy use of isosurfaces and other objects 
with expensive intersection tests.

I agree with Warp though that a weak performance in rendering 
benchmark.pov is not at all a reason not to integrate this improvement. 
  The patch you posted in p.b.p. will make it quite difficult though 
since you did not clearly mark your changes.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 11 Jan. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Christoph Hormann
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 15 Jan 2004 12:52:05
Message: <l00jd1-oc3.ln1@triton.imagico.de>
Thorsten Froehlich wrote:
> 
> While all you say is correct and remains valid, it has to be admitted that
> benchmark.pov has one little bias as it does give a rather heavy weight to
> the noise function due to the clouds.

Heavy use of the noise function is quite common for a typical POV-Ray 
scene, even without media, due to procedural textures and geometry.  In 
a typical isosurface landscape scene it is even more excessive than in 
benchmark.pov.

> The reason is that such a comparison is not optimal with the default
> benchmark.pov is that automatic bounding is turned on, which makes the major
> task while rendering searching the bounding volumes.  This to a major part
> depends on memory access.  It is really a lot of searching, but not so much
> computing at all...

Surely the use for comparing processors is limited by this but for 
comparing the performance of whole computers concerning POV-Ray use this 
is exactly what's needed - a typical POV-Ray render will spend much time 
with memory access (in addition to bounding slabs just think of large 
meshes, photon maps, radiosity, image maps).

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 11 Jan. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Christopher James Huff
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 15 Jan 2004 17:19:22
Message: <cjameshuff-2E19BC.17194115012004@netplex.aussie.org>
In article <4006b4d1@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   However, I agree with George as well: If a feature does not slow down
> benchmark.pov but considerably speeds up some feature which is rather
> often used, in my opinion it's worth adding.

I agree as well. The benefit will be moderate for most scenes, but many 
scenes will render considerably faster. I'd say this is definitely a 
worthwhile optimization.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Andreas Kaiser
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 16 Jan 2004 08:58:39
Message: <4007e95b.357503542@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:

>[...]
>
>I agree with Warp though that a weak performance in rendering 
>benchmark.pov is not at all a reason not to integrate this improvement. 
>  The patch you posted in p.b.p. will make it quite difficult though 
>since you did not clearly mark your changes.

What's the preferred way to submit/mark changes?

For the posted csg.cpp:

function All_CSG_Union_Intersections, 
	lines 148 - 167, 183 - 185

function All_CSG_Intersection_Intersections completely,

function All_CSG_Merge_Intersections,
	lines 436 - 438

BTW evaluation of 'tstPoint' at lines 277 and 278 is loop invariant
and should be moved just before the for-loop.

Andreas


Post a reply to this message

From: ABX
Subject: Re: Improved intersection routine for CSG-Intersection objects
Date: 16 Jan 2004 09:08:32
Message: <curf005fn7qjf0lcd7qdfuln7dil4q7es9@4ax.com>
On Fri, 16 Jan 2004 13:58:38 GMT, kai### [at] siemenscom (Andreas Kaiser)
wrote:
> What's the preferred way to submit/mark changes?

http://megapov.inetart.net/manual/internals.html#markup

ABX


Post a reply to this message

<<< Previous 50 Messages Goto Initial 50 Messages

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