POV-Ray : Newsgroups : povray.beta-test : Wondering about Intersect_BBox : Wondering about Intersect_BBox Server Time
30 Jun 2024 12:27:53 EDT (-0400)
  Wondering about Intersect_BBox  
From: Le Forgeron
Date: 8 Oct 2010 10:19:02
Message: <4caf2856$1@news.povray.org>
Greetings,

Maybe a bit too early for povray.programming, so beta-test seems
appropriate.

I was diving in the beta.38 source lately(*²) (short of having the
beta.39 source at hand), and looking at the shapes objects code (in
particular sphere & plane). (source/backend/shape/spheres.cpp &
source/backend/shape/planes.cpp )

Both sphere & plane reimplement Intersect_BBox for their class as
"always true". (instead of ObjectBase::Intersect_BBox from which they
inherit). And that seems rather counter productive, as it seems to me
(but am I wrong ?) that the ObjectBase's implementation is fine
 (it checks the direction & side of the box).

It then seems to me that with the overloaded Intersect_BBox, the
Find_Intersection (from source/backend/scene/objects.cpp) will in fact
never (for plane & sphere) use the bounding box, but call the
::All_Intersections method (and that might be costly **) for each ray.

Did I miss a subtlety ( or more) ?



**: it seems that a lot of shapes like to change the method for "always
true", in effect removing the bounding box optimisation.

*²: I was looking for a strange memory expansion which seems to use
about a few bytes per pixel once the rendering has been started (and I
do not understand why, hence I'm searching), which occurs with an empty
scene (one camera), as well as a scene with 4 spheres (or finite 3D
objects) & one camera but not a scene with some planes (unless they
reduced to less into a csg-intersection, but then it's more a csg than a
plane).
It's very obvious with the gnome system monitor, and a huge resolution:
when povray starts, it allocates w*h*5 (let's say 9 GB for a square of
20500), and as the render progresses, it reach 16 GB (with a
quasi-linear progression within an empty scene). It also seems that the
release of that collection of memory takes some not so small time, as it
is done while the file is saved, and it might be sub-optimal (I do not
know yet what it is).

-- 
Real software engineers work from 9 to 5, because that is<br/>
the way the job is described in the formal spec.  Working<br/>
late would feel like using an undocumented external procedure.


Post a reply to this message

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