POV-Ray : Newsgroups : povray.general : CSG mesh bug Server Time
26 Dec 2024 15:13:27 EST (-0500)
  CSG mesh bug (Message 1 to 7 of 7)  
From: Jozef Gatial
Subject: CSG mesh bug
Date: 27 Mar 2003 02:10:09
Message: <web.3e82a371ff88dac376ced8e90@news.povray.org>
The same results with difference or intersection of two meshes.
Please, see next simple sample
Jozef Gatial


// Persistence of Vision Ray Tracer Scene Description File

#version 3.5;
#include "colors.inc"
global_settings { assumed_gamma 1.0 }

// ----------------------------------------

camera {location <0.0, 0.5, -4.0> direction 1.5*z right
x*image_width/image_height look_at<0,0,0> }
sky_sphere { pigment { gradient y color_map { [0 rgb <0.6,0.7,1.0>] [0.7 rgb
<0.0,0.1,0.8>] } } }
light_source { <0, 0, 0> color rgb <1, 1, 1> translate <-30, 30, -30> }
plane { y, -1 pigment { color rgb <0.7,0.5,0.3> } }

// ----------------------------------------

#declare Object1Material1 = material {
texture {
  pigment { color rgbf <1, 1, 1, 0> }
  finish  { ambient .5 diffuse .5 }
  }
}
#declare Object1Material2 = material {
texture {
  pigment { color rgbf <1, 1, 0, 0> }
  finish  { ambient .5 diffuse .5 }
  }
}

#declare Object1 = mesh {
   inside_vector <0, 0, 1>
   smooth_triangle { <-1, -1, -1>, <0, 1, 0>, <1, -1, -1>, <0, 1, 0>, <1,
-1, 1>, <0, 1, 0> }
   smooth_triangle { <1, -1, 1>, <0, 1, 0>, <-1, -1, 1>, <0, 1, 0>, <-1, -1,
-1>, <0, 1, 0> }
   smooth_triangle { <-1, 1, -1>, <0, -1, 0>, <1, 1, 1>, <0, -1, 0>, <1, 1,
-1>, <0, -1, 0> }
   smooth_triangle { <1, 1, 1>, <0, -1, 0>, <-1, 1, -1>, <0, -1, 0>, <-1, 1,
1>, <0, -1, 0> }
   smooth_triangle { <-1, -1, -1>, <0, 0, 1>, <1, 1, -1>, <0, 0, 1>, <1, -1,
-1>, <0, 0, 1> }
   smooth_triangle { <1, 1, -1>, <0, 0, 1>, <-1, -1, -1>, <0, 0, 1>, <-1, 1,
-1>, <0, 0, 1> }
   smooth_triangle { <1, -1, -1>, <-1, 0, 0>, <1, 1, 1>, <-1, 0, 0>, <1, -1,
1>, <-1, 0, 0> }
   smooth_triangle { <1, 1, 1>, <-1, 0, 0>, <1, -1, -1>, <-1, 0, 0>, <1, 1,
-1>, <-1, 0, 0> }
   smooth_triangle { <1, -1, 1>, <0, 0, -1>, <-1, 1, 1>, <0, 0, -1>, <-1,
-1, 1>, <0, 0, -1> }
   smooth_triangle { <-1, 1, 1>, <0, 0, -1>, <1, -1, 1>, <0, 0, -1>, <1, 1,
1>, <0, 0, -1> }
   smooth_triangle { <-1, -1, 1>, <1, 0, 0>, <-1, 1, -1>, <1, 0, 0>, <-1,
-1, -1>, <1, 0, 0> }
   smooth_triangle { <-1, 1, -1>, <1, 0, 0>, <-1, -1, 1>, <1, 0, 0>, <-1, 1,
1>, <1, 0, 0> }
}

difference
//intersection
{
object { Object1 material { Object1Material1 } scale .5 rotate <45,45,45>
translate <-.5,0,0>}
object { Object1 material { Object1Material2 } scale .5 rotate <45,45,45>
translate <.5,0,0>}
}


Post a reply to this message

From: Mark Weyer
Subject: Re: CSG mesh bug
Date: 27 Mar 2003 04:32:28
Message: <3E82C865.3040302@informatik.uni-freiburg.de>
> The same results with difference or intersection of two meshes.

Just as I would expect. difference {A B} does the same as
intersection {A object {B inverse}}. inverse can have no effect on
patch objects such as a mesh, because they have no inside or outside.


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: Johannes Dahlstrom
Subject: Re: CSG mesh bug
Date: 27 Mar 2003 05:30:04
Message: <web.3e82d27b9c39944cf7cbce3c0@news.povray.org>
Mark Weyer wrote:
>Just as I would expect. difference {A B} does the same as
>intersection {A object {B inverse}}. inverse can have no effect on
>patch objects such as a mesh, because they have no inside or outside.

Well, closed ("well-behaving") meshes DO have a well defined interior, and
the "insideness" algorithm is rather trivial (just trace a ray from the
point in question to some direction (inside_vector), if there are an even
number of intersections, the point is outside, else inside). It can fail,
though, if the ray happens to on the exactly same plane as some of the
triangles being tested. This is what seems to be happening here. The
inside_vector should be chosen carefully to not be parallel to any of the
triangles in a mesh.


Post a reply to this message

From: Mark Weyer
Subject: Re: CSG mesh bug
Date: 27 Mar 2003 06:15:56
Message: <3E82E0A5.6030702@informatik.uni-freiburg.de>
> Well, closed ("well-behaving") meshes DO have a well defined interior, and
> the "insideness" algorithm is rather trivial (just trace a ray from the
> point in question to some direction (inside_vector), if there are an even
> number of intersections, the point is outside, else inside). It can fail,
> though, if the ray happens to on the exactly same plane as some of the
> triangles being tested. This is what seems to be happening here. The
> inside_vector should be chosen carefully to not be parallel to any of the
> triangles in a mesh.

Oh, so that is what I don't know from never using meshes. I wonder why
inside_vector is not allowed for arbitrary objects (mostly unions of
patch primitives).


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: Jozef Gatial
Subject: Re: CSG mesh bug
Date: 27 Mar 2003 07:00:09
Message: <web.3e82e6c39c39944c76ced8e90@news.povray.org>
Inside_vector is point defined where is interior of mesh but it is probably
not fully function (in this example only value <0, 0, 0> show differences).
Mesh and mesh2 are fully function in CSG operations when they are combined
with some other objects. Problem is only with two meshes
Jozef



#declare Object2 = sphere { <0, 0 0> 1 }

// A - ok
difference
{
object { Object2 material { Object1Material2 } scale .5 rotate <45,45,45>
translate <.5,0,0>}
object { Object1 material { Object1Material1 } scale .5 rotate <45,45,45>
translate <-.5,0,0>}
}

// B - ok
/*
difference
{
object { Object1 material { Object1Material2 } scale .5 rotate <45,45,45>
translate <.5,0,0>}
object { Object2 material { Object1Material1 } scale .5 rotate <45,45,45>
translate <-.5,0,0>}
}
*/

// A + B - error


Post a reply to this message

From: Warp
Subject: Re: CSG mesh bug
Date: 27 Mar 2003 10:58:07
Message: <3e831f8e@news.povray.org>
This phenomenon might be related to the bug that a (solid) mesh cannot
be the second object in a CSG.
  IIRC this will be fixed in the next release.

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Ken
Subject: Re: CSG mesh bug
Date: 27 Mar 2003 21:09:24
Message: <3E83AFCE.78C70FF7@pacbell.net>
Warp wrote:
> 
>   This phenomenon might be related to the bug that a (solid) mesh cannot
> be the second object in a CSG.
>   IIRC this will be fixed in the next release.

I confirm that what you say is true.

-- 
Ken Tyler


Post a reply to this message

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