POV-Ray : Newsgroups : povray.general : Possible bounding bug found. : Possible bounding bug found. Server Time
10 Aug 2024 09:19:04 EDT (-0400)
  Possible bounding bug found.  
From: Ken
Date: 25 Jan 2000 05:05:44
Message: <388D74BB.EBC3DAEE@pacbell.net>
I have waited a few days but have not seen this appear in .general or
in .bugreports so I am moving it from c.g.r.r. so that it is not
overlooked by the POV-Team. If someone could confirm that this is
indeed a bug let me know and I will post a report to .bugreports.

Thanks,

Ken


Yannick Patois wrote:
> 
> Hi,
> 
> I'm quite new to povray, and I'm having problems rendering a scene(I put
> the script below). Note that I greatly simplified my original script in
> order to focus on the problem (the scene by itself has no real meaning).
> 
> Harware & Software specifications :
> 
> - Linux Mandrake 6.1 on an AMD K6II 450MHz
> $ uname -a : Linux 2.2.13-7mdk #1 Wed Sep 15 18:02:18 CEST 1999 i586
> 
> - "Persistence of Vision(tm) Ray Tracer Version 3.1g.Linux.gcc
>   This is an official version prepared by the POV-Ray Team(tm)"
> (I didnt recompile it).
> 
> - povray called with the command :
> $ x-povray +D +P -W640 -H480 -Q2 -i pov_problem.pov
> (It doesnt seems to depend on the specific rendering switchs I use).
> 
> Description of the problem :
> The objet 'TheTest' is not drawn properly when a negative scale is
> applied (I use negative scale to generate symetrical objects, like the
> left hand from the description of a right hand). When a negative scale
> is applyed, the included sphere is not drawn any more. Removing any of
> the cylinder from the description of TheTest will increase the rendering
> time by a factor 6 (!) but the sphere will be drawn. Note that in the
> original scene when I noticed the problem, the cylinder and sphere where
> not one over the other, it's only to simplify the script. There is not
> any difference in the behavior if I move the cylinders around.
> 
> I would be very happy if someone could help me to solve the problem
> either by telling me what I am doing wrong or by giving me some
> workaround. If there is a more appropriated place to ask this question,
> please inform me too. Thanx.
> 
>         Yannick
> 
> Script is below :
> 
> #include "colors.inc"
> 
> light_source { <0, -10, -20> color White}
> 
> camera
> {
>    location <0, -10, -100>
>    look_at  <-5,  -2,  2>
> }
> 
> #declare TheTest=
>     union
>     {
> // Removing any of this cylinders will solve the problem
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       cylinder{<0, 0, 0>,<1, 0, 0>,1}
>       sphere { <3,2.5,0> 5}
>       texture {pigment { color Yellow }}
>     }
> 
> // this objet is not drawn properly
> object
> {
>         TheTest
>         scale -1
>         translate <0,20,0>
> }
> 
> // this one is
> object
> {
>         TheTest
>         scale 1
>         translate <0,-20,0>
> }


      Subject: BUG + FIX: Strange povray behavior : 'forget' to draw sphere
               object when negative scaling is applied
         Date: Sun, 23 Jan 2000 11:10:30 +1000
         From: Darius Davis <see### [at] studentuqeduau>
 Organization: King's College
           To: Yannick Patois <pat### [at] ganilfr>
   Newsgroups: comp.graphics.rendering.raytracing
  References:  1

Hi Yannick,

> The objet 'TheTest' is not drawn properly when a negative scale is
> applied.

You've found a bug!

If:
- the object is a sphere
- there are no other complex transformations (matrix, etc) in effect
- automatic bounding box creation is ON (eg. >= 25 objects in scene)
- the object is scaled equally in all three axes, and
- the scaling factor is negative

the object will 'disappear' due to a bug in the bounding box
calculations.

> Removing any of
> the cylinder from the description of TheTest will increase the rendering
> time by a factor 6 (!) but the sphere will be drawn.

The slowdown you noticed is also due to Automatic Bounding.  Put +MB1 on
the end of the command line and it'll trace a lot faster.  (With 11
cylinders in the union, there are 24 objects in the scene, with 12
cylinders there are 26 objects, and the threshold for auto-bounding is
25 objects.)  Incidentally, adding +MB1 makes the sphere disappear even
when there are *no* cylinders in the scene (since auto-bounding will be
turned on, and all the other conditions for the bug to occur are also
true).

By the way, to make a left hand from a right hand, you probably want to
only mirror it in one axis anyway, eg:
        scale <-1, 1, 1>
to mirror in the x-axis.  Doing this, the problem won't happen anyway!

If you really do need to apply a negative uniform scale to such an
object, I know of two workarounds:

If precision is not essential, scale the object slightly unevenly, ie.

        scale <-2, -2, -2.0001>

If precision is required, just put an identity 'matrix' transformation
before the negative scaling, as in:

object
{
        TheTest
        matrix <1, 0, 0,   0, 1, 0,  0, 0, 1,  0, 0, 0>
        scale -2
        translate <0,20,0>
}

(Look up 'matrix' in the documentation if you're not familiar with it)

Or put
        scale <-2, -2, 2> scale <1, 1, -1>

There's probably another simpler transformation you could use, but
that's what springs to mind.

Alternatively, you could disable Automatic Bounding (put -MB on the end
of the command line), but that will slow down the tracing considerably.

For those of you who may wish to fix it yourself, here's the offending
line of source:

SPHERES.C, function Scale_Sphere, approx line 652:
Change
    Sphere->Radius *= Vector[X];
to
    Sphere->Radius *= fabs(Vector[X]);

I'll send this to the POV-Team ASAP.

Darius

 ------------ Recent Evolutionary Trends in Mainstream Computer Software
|Darius Davis|      WYSIWYG - What you see is what you get.
| s328919 at |      WYSIWYD - What you see is what you desire.
| student.uq.|      WYSINYD - What you see is not your document.
|   edu.au   |      NYSINYD - Now you see it, now you don't.
 ------------    ----------------------------------------------------


Post a reply to this message

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