POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Tasklist

FS#331 - Intersection causes quadric to disappear

Attached to Project: POV-Ray
Opened by Richard Callwood III (Cousin_Ricky) - Monday, 27 July 2015, 22:50 GMT
Last edited by Christoph Lipka (clipka) - Tuesday, 13 December 2016, 06:09 GMT
Task Type Definite Bug
Category Backend → Geometric Primitives
Status Closed
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version 3.70 release
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

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 (self-compiled with g++ 4.8, but completely unaltered)
POV-Ray 3.7.1-alpha.8150025.unofficial
openSUSE 13.2 GNU/Linux

This scene file illustrates the problem:

// +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 }
}

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>
}

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>
}

On the right side, there should have been a cylinder capped with a paraboloid. A thread has been started in povray.bugreports. Jerome has started to look at it.

This task depends upon

Closed by  Christoph Lipka (clipka)
Tuesday, 13 December 2016, 06:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  I think this should be fixed with commit 4be08d8. Any further tracking please refer to GitHub issue #128
Comment by Grimbert Jérôme (Le_Forgeron) - Wednesday, 29 July 2015, 20:43 GMT

I can confirm the problem on Ubuntu 15.04, for stable & master version.

Actually, the problem is due to the change of paraboloid-bounding box computation (in quadric.cpp)

    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 difference with 3.6.1 is easy:

  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;
  }

The paraboloid has been translated to the origin, but trying to optimize the X axis fails.
(the scene demonstrates the issue for Y, the code problem is similar, and so it is for Z axis)

Comment by Grimbert Jérôme (Le_Forgeron) - Wednesday, 29 July 2015, 21:22 GMT

Do not rush, it might be more elusive... a bug might have been unnoticed in 3.6.1, now visible with 3.7

I need to study all the detected quadrics, but my suspicion so far is that translation T1 should have been applied in the opposite direction.

Comment by Grimbert Jérôme (Le_Forgeron) - Saturday, 01 August 2015, 18:17 GMT

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 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.

Comment by William F Pokorny (wfpokorny) - Friday, 21 October 2016, 15:06 GMT
  • Field changed: Status (Released for community testing → Tracked on GitHub)

Now tracked on github as issue #128.

Loading...