POV-Ray : Newsgroups : povray.general : Bug report: a different coincident-surfaces problem : Re: Bug report: a different coincident-surfaces problem Server Time
26 Apr 2024 03:53:46 EDT (-0400)
  Re: Bug report: a different coincident-surfaces problem  
From: Robert Munyer
Date: 3 Nov 2018 09:11:41
Message: <87sh0igv9x.fsf@munyer.com>
Alain wrote:

> Coincident surfaces problems can happen whenever you have two or more
> surfaces that are at the same location.
> It can come from two objects that touch each other.
> It can show up in unions and merges.
>
> It show more often in differences and intersections because, in the
> other cases, the affected surfaces are hidden unless you have at least
> one transparent object.

Thank you, that's very helpful advice.

I'm trying to see if any other CSG-related programs have this problem.
I tried the three other CSG programs that happen to be installed on my
system.  I asked people at the local hackerspace who have other CSG
programs.  None of the other programs seem to have this problem.

Neither I nor any of the others had BRL-CAD, so when I have some time
I will download and try it.  It will be interesting to use a ray tracer
that's even older than POV-Ray!

To be clear...  There are two coincident-surfaces problems that affect
nearly all CSG programs, but this thread is about a different problem.

If two coincident surfaces have opposite orientation (i.e. one of
them is trying to show a surface whose interior side faces the camera,
and the other one is trying to show a surface whose exterior side faces
the camera) most CSG programs will render unintended geometry:

  difference {
    box { -1, 1 pigment { Red } }
    cylinder { -z, z, 0.5 pigment { Green } }
  }

If two coincident surfaces have the same orientation but different
texture, it's impossible to know what the author intended:

  union {
    box { -1, 1 pigment { Red } }
    box { -1, 1 pigment { Yellow } translate y }
  }

This thread is about a different case, in which the coincident surfaces
have the same orientation and the same texture.

> Solution : Always make sure that you don't have surfaces that just
> touch. If it happen, move one of the surfaces by a tiny amount.
>
> This will solve your problem :
> #declare Bar =
>    union {
>      // No more surface coincidences _within_ this union.
>      box { <-.75, -.75, -2>, <.25, .25, 0.000001> }
>      box { <-.25, -.25, -2>, <.75, .75, 0> }
>      pigment { Green }
>    }

Or you can refactor Bar so that it doesn't use CSG internally:

#declare Bar =
  prism {
    -8, 0, 8,
    <-1, -1>, <-1, -3>, < 3, -3>, < 3,  1>,
    < 1,  1>, < 1,  3>, <-3,  3>, <-3, -1>
    scale .25
    rotate 90 * x
    pigment { Green }
  }


Post a reply to this message

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