POV-Ray : Newsgroups : povray.bugreports : Intersection causes quadric to disappear Server Time
15 Oct 2024 23:57:01 EDT (-0400)
  Intersection causes quadric to disappear (Message 1 to 10 of 10)  
From: Cousin Ricky
Subject: Intersection causes quadric to disappear
Date: 25 Jul 2015 10:24:55
Message: <55b39c37$1@news.povray.org>
The following paraboloid renders correctly:

   intersection
   { quadric { <1, 0, 1>, <0, 0, 0>, <0, 1, 0>, -1 }
     cylinder { 0, y, 1 }
   }

However, when I extend the clipping cylinder downward:

   intersection
   { quadric { <1, 0, 1>, <0, 0, 0>, <0, 1, 0>, -1 }
     cylinder { -y, y, 1 }
   }

the object disappears completely in POV-Ray 3.7 and 3.7.1.  In POV-Ray 
3.6.1, it renders as expected.

POV-Ray 3.7.0.unofficial
POV-Ray 3.7.1-alpha.8150025.unofficial
openSUSE 13.2 GNU/Linux


Post a reply to this message

From: Cousin Ricky
Subject: Re: Intersection causes quadric to disappear
Date: 26 Jul 2015 12:29:59
Message: <55b50b07@news.povray.org>
On 07/25/2015 10:25 AM, Cousin Ricky wrote:
> The following paraboloid renders correctly:
>
> [snip]
>
> the object disappears completely in POV-Ray 3.7 and 3.7.1.  In POV-Ray
> 3.6.1, it renders as expected.
>
> POV-Ray 3.7.0.unofficial
> POV-Ray 3.7.1-alpha.8150025.unofficial
> openSUSE 13.2 GNU/Linux

Here is a complete scene demonstrating the problem:

----------[BEGIN CODE]----------
// +w480 +h240
#version 3.6; //[sic]

global_settings { assumed_gamma 1 }

camera
{ location <0, 1, -7.5958>
   look_at <0, 1, 0>
   right 2 * x
   up y
   angle 43.1038
}

#default { finish { diffuse 0.6 ambient rgb 0.15618 } }

light_source
{ <-4.3125, 9.6250, -7.4695>,
   rgb 6856.3
   fade_power 2 fade_distance 0.10417
   spotlight point_at <0, 1, 0> radius 45 falloff 90
}

box
{ -<9, 11, 9>, <9, 11, 9>
   pigment { rgb 1 }
}

plane
{ y, 0
   pigment { checker rgb 0.05 rgb 1 }
}

// OK in POV-Ray 3.6 and 3.7
intersection
{ quadric { <1, 0, 1>, <0, 0, 0>, <0, 1, 0>, -1 }
   cylinder { 0, y, 1 }
   pigment { green 0.5 }
   translate <-1.25, 1, 0>
}

// OK in POV-Ray 3.6; not rendered in 3.7
intersection
{ quadric { <1, 0, 1>, <0, 0, 0>, <0, 1, 0>, -1 }
   cylinder { -y, y, 1 }
   pigment { green 0.5 }
   translate <1.25, 1, 0>
}
-----------[END CODE]-----------


Post a reply to this message

From: Le Forgeron
Subject: Re: Intersection causes quadric to disappear
Date: 27 Jul 2015 14:10:29
Message: <55b67415$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 26/07/2015 18:30, Cousin Ricky a écrit :
> On 07/25/2015 10:25 AM, Cousin Ricky wrote:
>> The following paraboloid renders correctly:
>> 
>> [snip]
>> 
>> the object disappears completely in POV-Ray 3.7 and 3.7.1.  In
>> POV-Ray 3.6.1, it renders as expected.
>> 
>> POV-Ray 3.7.0.unofficial POV-Ray 3.7.1-alpha.8150025.unofficial 
>> openSUSE 13.2 GNU/Linux
> 

Confirmed on Ubuntu 15.04 too.

3.6.1 needed a fix on png_pov.cpp (to comment png_write_finish_row
declaration and call, as it was internal to libpng 1.0 and no more
present in current 1.2) to compile now.

The stable and master version of Povray 3.7 are impacted (as well as
my own derivatives)

For 3.7

Box                            1553561         1553561    100.00
Cone/Cylinder                  1767346          180868     10.23
CSG Intersection               1767346           79691      4.51
Plane                          1553561          520176     33.48
Quadric                        1767346          515067     29.14
Bounding Box                   3107122         1553561     50.00

For 3.6.1

Box                            1382184         1382184    100.00
Cone/Cylinder                   683555          371945     54.41
CSG Intersection                683555          195292     28.57
Plane                          1382184          442620     32.02
Quadric                         683555          499054     73.01
Bounding Box                   1878629         1856588     98.83
Light Buffer                   3357640         2222801     66.20
Vista Buffer                   2937947         2424601     82.53

Interesting 3.7 : if the cylinder is { -y/2, y, 1 }, the render is fine.

(it works also with -y*0.999 !)

Box                            1472708         1472708    100.00
Cone/Cylinder                  3157892          400035     12.67
CSG Intersection               3157892          211950      6.71
Plane                          1472708          470874     31.97
Quadric                        3157892         1059059     33.54
Bounding Box                   1472708         1472708    100.00



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlW2dBQACgkQhKAm8mTpkW3g3AP+NaF6Z/rNgVi5YV9z/YPgkp44
1Yfh/r0A6z2vzd88zqBqyU+ABoU1ETlOU14GEY/Wv5L6w1G3awXx55e/kbptT3dy
JSSUM8VU2ClagBdkBzg6BmsTswMvHaLqYsw+mDwXaYoLp7RuQLtGJJrCdJI7BlIW
TciWNFxPlJjwrSxI28k=
=QNJM
-----END PGP SIGNATURE-----


Post a reply to this message

From: Le Forgeron
Subject: Re: Intersection causes quadric to disappear
Date: 27 Jul 2015 14:33:44
Message: <55b67988$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 27/07/2015 20:10, Le_Forgeron a écrit :
> Le 26/07/2015 18:30, Cousin Ricky a écrit :
>> On 07/25/2015 10:25 AM, Cousin Ricky wrote:
>>> The following paraboloid renders correctly:
>>> 
>>> [snip]
>>> 
>>> the object disappears completely in POV-Ray 3.7 and 3.7.1.  In 
>>> POV-Ray 3.6.1, it renders as expected.
>>> 
>>> POV-Ray 3.7.0.unofficial POV-Ray 3.7.1-alpha.8150025.unofficial
>>>  openSUSE 13.2 GNU/Linux
> 
> 
> Confirmed on Ubuntu 15.04 too.
> 

Looking at the bounding box, with -0.999*y :


Min : -10000000000.0000,-10000000000.0000,-10000000000.0000
Max : 10000000000.0000,10000000000.0000,10000000000.0000

whereas with -y :

Min : 1.2500,0.0000,0.0000
Max : 1.2500,0.0000,0.0000

Compared to 3.6.1 with -y :

Min : 0.2500,0.0000,-1.0000
Max : 2.2500,2.0000,1.0000

and 3.6.1 with -y*0.999 :

Min : 0.2500,0.0010,-1.0000
Max : 2.2500,2.0000,1.0000


Raw conclusion so far: the bounding box computation in 3.7 get
something wrong. It might be in intersection/csg or cylinder. (as
quadric is kind of infinite, it is unlikely to be involved... but a
look does not cost that much either).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlW2eYcACgkQhKAm8mTpkW1zBQQAm771Vzlt7JvAFHw5Fr9Zz99o
MtAmUJGqg12Yl6ZcbaPUhekdCYHsl4uv+R9e39RvDMtt62HFl7GQW8rVlb7exYnV
fV68StMe09JpCWi/dSuKDbVji4KDPK4VKzI9sZeEcHTg0zv0mqJZVpetmEUIg07u
1wcCBLXiaWEpksI2qjE=
=+/wN
-----END PGP SIGNATURE-----


Post a reply to this message

From: Cousin Ricky
Subject: Re: Intersection causes quadric to disappear
Date: 27 Jul 2015 18:53:09
Message: <55b6b655@news.povray.org>
On 2015-07-27 02:10 PM (-4), Le_Forgeron wrote:
> Confirmed on Ubuntu 15.04 too.

I have opened task #331 on FlySpray.


Post a reply to this message

From: Le Forgeron
Subject: Re: Intersection causes quadric to disappear
Date: 29 Jul 2015 16:22:41
Message: <55b93611$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 28/07/2015 00:53, Cousin Ricky a écrit :
> On 2015-07-27 02:10 PM (-4), Le_Forgeron wrote:
>> Confirmed on Ubuntu 15.04 too.
> 
> I have opened task #331 on FlySpray.
> 

I have it... you of course had to choose the sole kind of quadric that
get "optimized" bounding box in 3.7 : paraboloid.
(the 3 axes are impacted)

Before (3.6.1):

> if ((A == 0.0) && (D != 0.0) && (E != 0.0) && (H != 0.0) && (J ==
> 0.0)) { /* Get radii for lower x value. */
> 
> x = ClipMin[X];
> 
> ry1 = sqrt(fabs(2.0 * D * x / E)); rz1 = sqrt(fabs(2.0 * D * x /
> H));
> 
> /* Get radii for upper x value. */
> 
> x = ClipMax[X];
> 
> ry2 = sqrt(fabs(2.0 * D * x / E)); rz2 = sqrt(fabs(2.0 * D * x /
> H));
> 
> ry = max(ry1, ry2); rz = max(rz1, rz2);
> 
> NewMin[Y] = -ry; NewMin[Z] = -rz; NewMax[Y] = ry; NewMax[Z] = rz; 
> }

After (3.7):

> if ((A == 0.0) && (D != 0.0) && (E * H > 0.0) && (J == 0.0)) { /*
> Get radii for lower x value. */
> 
> x = D * E < 0 ? max(0., ClipMin[X]) : ClipMin[X];
> 
> ry1 = sqrt(fabs(2.0 * D * x / E)); rz1 = sqrt(fabs(2.0 * D * x /
> H));
> 
> /* Get radii for upper x value. */
> 
> x = D * E > 0 ? min(0., ClipMax[X]) : ClipMax[X];
> 
> ry2 = sqrt(fabs(2.0 * D * x / E)); rz2 = sqrt(fabs(2.0 * D * x /
> H));
> 
> ry = max(ry1, ry2); rz = max(rz1, rz2);
> 
> if (D*E < 0) NewMin[X] = max(0., ClipMin[X]); NewMin[Y] = -ry; 
> NewMin[Z] = -rz; if (D*E > 0) NewMax[X] = min(0., ClipMax[X]); 
> NewMax[Y] = ry; NewMax[Z] = rz; }

The object has been translated to the origin, the 3.6 version only
reduced the "diameter" of the paraboloid. 3.7 is more ambitious... and
fails with a bounding box that has a null dimension.

When used alone, the paraboloid bounding box is ok in 3.7 (because the
evaluation of radius is above critical length, the bounding box is
reset to infinity, so tracing is fine.

But used in an intersection, the null bounding box is kept, due to the
other objects bounding box being smaller than infinity, and nothing is
traced.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlW5NhAACgkQhKAm8mTpkW34pgP/ZuSHPbVrmsgbDO4K0xFW+hOi
XYTs4lkYTyNGa6eFQs3TWppbldNavyLtKI6eAjs7u/VrMT9NmsdXzva7Bc7iXx5H
GcvNUyRXVcY1mRLZegksJPxEVMsqFr7uviL728lHBFObnDdYZq2KhnBpqLL3ziJv
OYKtLplqwOQdp36Ph44=
=tCeX
-----END PGP SIGNATURE-----


Post a reply to this message

From: clipka
Subject: Re: Intersection causes quadric to disappear
Date: 31 Jul 2015 13:32:12
Message: <55bbb11c@news.povray.org>
Am 29.07.2015 um 22:22 schrieb Le_Forgeron:

> I have it... you of course had to choose the sole kind of quadric that
> get "optimized" bounding box in 3.7 : paraboloid.
> (the 3 axes are impacted)

...

> The object has been translated to the origin, the 3.6 version only
> reduced the "diameter" of the paraboloid. 3.7 is more ambitious... and
> fails with a bounding box that has a null dimension.
>
> When used alone, the paraboloid bounding box is ok in 3.7 (because the
> evaluation of radius is above critical length, the bounding box is
> reset to infinity, so tracing is fine.
>
> But used in an intersection, the null bounding box is kept, due to the
> other objects bounding box being smaller than infinity, and nothing is
> traced.

Not sure I understand exactly what's happening there, but if you do, 
that's fine with me :). Are you already working on a fix?


Post a reply to this message

From: clipka
Subject: Re: Intersection causes quadric to disappear
Date: 31 Jul 2015 20:33:13
Message: <55bc13c9$1@news.povray.org>
Am 29.07.2015 um 22:22 schrieb Le_Forgeron:

> I have it... you of course had to choose the sole kind of quadric that
> get "optimized" bounding box in 3.7 : paraboloid.
> (the 3 axes are impacted)

After having had a closer look, it seems that we should be careful when 
trying to fix this: The change appears to have in turn been introduced 
to fix some other known issue with the quadric bounding boxes.

(For reference: The change dates back to Perforce times, and is listed 
in the database as Changelist 3810; it was checked in by Chris on 
2005-06-13, apparently on behalf of Massimo Valentini.)


Post a reply to this message

From: Le Forgeron
Subject: Re: Intersection causes quadric to disappear
Date: 1 Aug 2015 08:58:27
Message: <55bcc273$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 31/07/2015 19:31, clipka a écrit :
> Am 29.07.2015 um 22:22 schrieb Le_Forgeron:
> 
>> I have it... you of course had to choose the sole kind of quadric
>> that get "optimized" bounding box in 3.7 : paraboloid. (the 3
>> axes are impacted)
> 
> ...
> 
>> The object has been translated to the origin, the 3.6 version
>> only reduced the "diameter" of the paraboloid. 3.7 is more
>> ambitious... and fails with a bounding box that has a null
>> dimension.
>> 
>> When used alone, the paraboloid bounding box is ok in 3.7
>> (because the evaluation of radius is above critical length, the
>> bounding box is reset to infinity, so tracing is fine.
>> 
>> But used in an intersection, the null bounding box is kept, due
>> to the other objects bounding box being smaller than infinity,
>> and nothing is traced.
> 
> Not sure I understand exactly what's happening there, but if you
> do, that's fine with me :). Are you already working on a fix?
> 

Yes, I'm working on a fix... and understanding the various
transformations of the equation to get a translation and adjusted
coefficients.

Not as obvious as it might seems. Previously I was asserting the
translation was in the wrong direction, but "not always". Seems there
is a few sign errors deep in some branches of code for that translation.

I have some testing scenes (rather kind of animation) with many
quadrics (nobody uses "coefficients translated quadrics", and that
what I need to use to trigger the bug). Once I'm happy with the
solution, I will post it (here and in flyspray)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlW8wnIACgkQhKAm8mTpkW3acgP+K7F9J4U/ry4eheTzHh7AUSIA
ruRnt95DwTTZ26SovsmCDhl9xaPDfLX/mqUljT7e2Oa5mkwl1tqyui0StXLYhWe8
mfZJtQhfRVGnbkkhvj+0zdc9z7pGWjRAndW+e3xE6CdgQXHKAEfNUvv7F/IcipFu
vNvn1MBROEqfzHS33QE=
=M4KR
-----END PGP SIGNATURE-----


Post a reply to this message

From: Le Forgeron
Subject: Re: Intersection causes quadric to disappear
Date: 1 Aug 2015 13:54:09
Message: <55bd07c1@news.povray.org>
Le 01/08/2015 02:32, clipka a écrit :
> Am 29.07.2015 um 22:22 schrieb Le_Forgeron:
> 
>> I have it... you of course had to choose the sole kind of quadric that

>> get "optimized" bounding box in 3.7 : paraboloid.
>> (the 3 axes are impacted)
> 
> After having had a closer look, it seems that we should be careful when

> trying to fix this: The change appears to have in turn been introduced
> to fix some other known issue with the quadric bounding boxes.
> 
> (For reference: The change dates back to Perforce times, and is listed
> in the database as Changelist 3810; it was checked in by Chris on
> 2005-06-13, apparently on behalf of Massimo Valentini.)
> 
Massimo is quite a competent contributor (he provided the fix for the
bezier curve used in the blob).

The code introduced in 3.7 (compared to 3.6) is ok (for bounding box of
quadrics), and should stay (it make a smaller box for paraboloid, as
such objects are only on one side of the half-universe ).

The problem is deeper, and so simple... it's a double sign error in
unlikely situation (well, in regard to quadrics' space, it's unlikely...
it happens for paraboloid, or rather, when the square terms are already
null on the relevant axis: the computed displacement is then inversed,
and the adjustment of the constant term is also bogus (which is somehow
a good thing, as it is part of the identification of the quadric amongst
a few ones: no identification --> bounding box is kept as large as
possible, so the quadric remains visible)

Nevertheless, I have a few situations where 3.6 (and 3.1g) is also bogus
in regard to the computation of bounding box of quadric in intersection
with something else.

E.g. quadric { <1,0,1>,<0,0,0>,<0,-1,0>,-1/4 } (a paraboloid on y,
upside, translated down by 0.25 ) in a cylinder { 0,y,1 } get a bounding
box of -0.87*2 length on x & z (it should be a length of 2)... but it
get back to normal with a cylinder { -y, y , 1 }... for 3.6. For 3.7 it
just get worst.

The patch is in attached delta.txt

If you are interested in more quadric tests, you can use the attached
scene (with frame & clock from 0 to 63)

On attached images, the green & yellow is the intersection with the blue
and red cylinder at the back.... the bounding box is draw in cyan and
magenta.


Post a reply to this message


Attachments:
Download 'delta.txt' (2 KB) Download 'inter.pov.txt' (15 KB) Download 'i36ter_001.png' (143 KB) Download 'i37ter_001.png' (147 KB) Download 'ifxter_001.png' (145 KB)

Preview of image 'i36ter_001.png'
i36ter_001.png

Preview of image 'i37ter_001.png'
i37ter_001.png

Preview of image 'ifxter_001.png'
ifxter_001.png


 

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