POV-Ray : Newsgroups : povray.general : Solid meshes in CSG Server Time
5 Nov 2024 01:24:19 EST (-0500)
  Solid meshes in CSG (Message 1 to 10 of 40)  
Goto Latest 10 Messages Next 10 Messages >>>
From: SharkD
Subject: Solid meshes in CSG
Date: 10 Dec 2008 21:30:00
Message: <web.49407a1e34307b75ef318dca0@news.povray.org>
I'm a little confused by the docs when they explain when meshes can be used in
CSG. Can I, for instance, create a flat plane from a mesh and use it in CSG as
long as I specify an inside vactor? Or, must a mesh be fully enclosed, like a
cube? Please explain what happens in either case.

-Mike


Post a reply to this message

From: clipka
Subject: Re: Solid meshes in CSG
Date: 10 Dec 2008 23:00:00
Message: <web.49408f297b08f33bebb7cc8a0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> I'm a little confused by the docs when they explain when meshes can be used in
> CSG. Can I, for instance, create a flat plane from a mesh and use it in CSG as
> long as I specify an inside vactor? Or, must a mesh be fully enclosed, like a
> cube? Please explain what happens in either case.

If the mesh is fully closed, then everything is fine: Your mesh will behave like
any other solid object in a CSG operation.

If the mesh is open I'd expect whacky results from CSG operations. For example,
if you intersect an open mesh and a solid object, the resulting object will
*not* behave like a "cut-out" piece of the mesh; instead, I'd expect certain
parts of the other object's surface to be visible as well, namely all those
areas where a ray, when shot along the inside vector, would enter through a
"hole" into the inside of the mesh. (This is just a guess, but be prepared to
get something like this or similar.)


Post a reply to this message

From: SharkD
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 00:20:01
Message: <web.4940a2387b08f33bf255f5c00@news.povray.org>
"clipka" <nomail@nomail> wrote:
> If the mesh is open I'd expect whacky results from CSG operations. For example,
> if you intersect an open mesh and a solid object, the resulting object will
> *not* behave like a "cut-out" piece of the mesh; instead, I'd expect certain
> parts of the other object's surface to be visible as well, namely all those
> areas where a ray, when shot along the inside vector, would enter through a
> "hole" into the inside of the mesh. (This is just a guess, but be prepared to
> get something like this or similar.)

My mesh is completely flat. If anything lying above the mesh upward until
infinity is considered "inside", that's OK.

Also, where do I put the "inside_vector" statement? Inside the triangle, or
inside the mesh?

-Mike


Post a reply to this message

From: Thomas de Groot
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 03:04:43
Message: <4940c99b$1@news.povray.org>
"SharkD" <nomail@nomail> schreef in bericht 
news:web.4940a2387b08f33bf255f5c00@news.povray.org...
>
> Also, where do I put the "inside_vector" statement? Inside the triangle, 
> or
> inside the mesh?
>

Inside the mesh. Have you used Poseray? Open a mesh2 file generated by 
Poseray and you can see.

Thomas


Post a reply to this message

From: Warp
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 07:55:11
Message: <49410daf@news.povray.org>
clipka <nomail@nomail> wrote:
> If the mesh is open I'd expect whacky results from CSG operations. For example,
> if you intersect an open mesh and a solid object, the resulting object will
> *not* behave like a "cut-out" piece of the mesh; instead, I'd expect certain
> parts of the other object's surface to be visible as well, namely all those
> areas where a ray, when shot along the inside vector, would enter through a
> "hole" into the inside of the mesh. (This is just a guess, but be prepared to
> get something like this or similar.)

  There's nothing really strange about solid meshes which do not form a
closed surface, as long as the inside_vector is defined properly.

  Sure, you'll get odd behavior sometimes, but so you do with other solid
primitives which are not closed surfaces, such as planes and heightfields.
(I assume that many povray users don't realize the heightfields *are* solid
and can be used in CSG. Everything under the heightfield is considered to
be inside. The same goes for planes.)

  If you have a planar mesh, then simply define an inside_vector for it which
is perpendicular to its surface, like you would do with a plane. This way one
side of the mesh will be inside and the other outside, exactly like with a
plane.

-- 
                                                          - Warp


Post a reply to this message

From: Dan Connelly
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 08:46:37
Message: <494119bd$1@news.povray.org>
Warp wrote:

>   There's nothing really strange about solid meshes which do not form a
> closed surface, as long as the inside_vector is defined properly.
> 
In fact, my understanding is whether it is closed or not is irrelevant.  Even if you
define a simple closed polyhedron,  if you don't have an inside_vector defined
properly, the system has no way of determining if that's a finite solid or a hole in
an infinite solid.

It's all about the inside_vector...


Post a reply to this message

From: clipka
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 10:05:00
Message: <web.49412be27b08f33bf708085d0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "clipka" <nomail@nomail> wrote:
> My mesh is completely flat. If anything lying above the mesh upward until
> infinity is considered "inside", that's OK.

Hm... what do you need a completely flat mesh for?

Anyway, if it's OK for you to get unexpected effects *above* the mesh for
differences and intersections (I guess unions shouldn't be too problematic in
this respect) then you'd want an inside_vector of -y, i.e. pointing *downward*.


Post a reply to this message

From: SharkD
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 10:20:01
Message: <web.49412f827b08f33bbceefebd0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   There's nothing really strange about solid meshes which do not form a
> closed surface, as long as the inside_vector is defined properly.
>
>   Sure, you'll get odd behavior sometimes, but so you do with other solid
> primitives which are not closed surfaces, such as planes and heightfields.
> (I assume that many povray users don't realize the heightfields *are* solid
> and can be used in CSG. Everything under the heightfield is considered to
> be inside. The same goes for planes.)
>
>   If you have a planar mesh, then simply define an inside_vector for it which
> is perpendicular to its surface, like you would do with a plane. This way one
> side of the mesh will be inside and the other outside, exactly like with a
> plane.
>
> --
>                                                           - Warp

Thanks for the explanation!

Since we're discussing it further, I'm curious what the rationale is behind
having an inside *vector* for a closed surface. To me, it seems that a vector
by itself wouldn't be sufficient to contain all the information necessary to
define what lies inside and outside of the surface. Could you explain how it
works?

-Mike


Post a reply to this message

From: Warp
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 10:48:35
Message: <49413653@news.povray.org>
SharkD <nomail@nomail> wrote:
> Since we're discussing it further, I'm curious what the rationale is behind
> having an inside *vector* for a closed surface. To me, it seems that a vector
> by itself wouldn't be sufficient to contain all the information necessary to
> define what lies inside and outside of the surface. Could you explain how it
> works?

  When POV-Ray needs to determine whether a point in space is inside the
mesh, it sends a ray from that point in the direction specified by
inside_vector. If the ray hits the mesh an odd amount of times, the point
is inside.

  With closed meshes it doesn't really make too much of a difference
what the inside_vector is. With open meshes it makes a big difference.

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Solid meshes in CSG
Date: 11 Dec 2008 11:25:00
Message: <web.49413dc57b08f33bf708085d0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> Since we're discussing it further, I'm curious what the rationale is behind
> having an inside *vector* for a closed surface. To me, it seems that a vector
> by itself wouldn't be sufficient to contain all the information necessary to
> define what lies inside and outside of the surface. Could you explain how it
> works?

As mentioned in the documentation, for a perfectly closed mesh the vector should
actually not be needed at all - theoretically.

To test whether some point is inside a certain closed object, all you have to do
is shoot a test ray from that point in an *arbitrary* direction and count the
number of times it intersects with the object's surface before hitting infinity
(ignoring any other shapes that may be in the scene as well).

If the test ray does not hit the suface at all, it obviously means that the
point is outside the object (unless it is inverted).

If the test ray hits the surface once before hitting infinity, it means that the
ray has to penetrate the surface to get outside, i.e. the point is obviously
inside.

If the test ray hits the surface multiple times, going in and out (or vice
versa) repeatedly, an even number of hits means that the point is outside the
object, and the ray went in-out-in-...-out, while an odd number of hits means
the point is inside, and the ray went out-in-...-out.

As mentioned, for a perfectly closed mesh it doesn't matter in which direction
you shoot the ray - *theoretically*. In practice, intersection tests *may*
occasionally give wrong results because of numerical precision issues. In that
case, manually choosing an "easier" direction for the test ray will help solve
such issues.

If the mesh is *not* perfectly closed however, the direction of the test ray
*does* have a significant impact on the results, as any point from which the
test ray hits (or rather, doesn't hit) a "gap" in the surface will have its
inside/outside status inverted; so changing the test ray's direction will
change the areas affected by this.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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