POV-Ray : Newsgroups : povray.general : CSG with mesh2 Server Time
29 Jul 2024 18:30:59 EDT (-0400)
  CSG with mesh2 (Message 1 to 7 of 7)  
From: quickfur
Subject: CSG with mesh2
Date: 18 Jan 2011 13:40:00
Message: <web.4d35dddbb7e0c2d1ee8d82c40@news.povray.org>
Hi All,

I want to do CSG with a mesh2 object, but I'm not sure if POVRay supports what I
need to do: the mesh2 object that I have is closed, but also contains internal
triangles (almost every triangle is transparent, so the internal triangles are
visible). I want to be able to do CSG with the *boundary* of the mesh2, and
ignore the internal triangles as far as CSG is concerned. Is this possible?

From the documentation, it seems like it wouldn't do what I want, because it
seems that based on whether the number of triangles intersected is odd or even
POV will consider the point as inside/outside. But what I want is for POV to
only intersect the triangles on the mesh2's *boundary* when doing this test, and
ignore the internal triangles. So any point inside the boundary triangles should
be regarded as "inside" regardless of how many triangles intersect a particular
ray.

What I want to achieve is this: I have several mesh2 objects, all of which have
a well-defined boundary but also contain internal triangles. I want to be able
to, for example, subtract mesh B from mesh A, so that all the triangles in mesh
A (including the internal triangles) are clipped by the *boundary* of mesh B
(ignoring B's internal triangles). How can I achieve this?

Thanks in advance!


Post a reply to this message

From: clipka
Subject: Re: CSG with mesh2
Date: 18 Jan 2011 13:58:59
Message: <4d35e2f3$1@news.povray.org>
Am 18.01.2011 19:37, schrieb quickfur:
> Hi All,
>
> I want to do CSG with a mesh2 object, but I'm not sure if POVRay supports what I
> need to do: the mesh2 object that I have is closed, but also contains internal
> triangles (almost every triangle is transparent, so the internal triangles are
> visible). I want to be able to do CSG with the *boundary* of the mesh2, and
> ignore the internal triangles as far as CSG is concerned. Is this possible?

No.

You'll have to separate the internal and external triangles into 
different mesh2 objects.


Post a reply to this message

From: quickfur
Subject: Re: CSG with mesh2
Date: 18 Jan 2011 15:25:00
Message: <web.4d35f6509a9f4973ee8d82c40@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 18.01.2011 19:37, schrieb quickfur:
> > Hi All,
> >
> > I want to do CSG with a mesh2 object, but I'm not sure if POVRay supports what I
> > need to do: the mesh2 object that I have is closed, but also contains internal
> > triangles (almost every triangle is transparent, so the internal triangles are
> > visible). I want to be able to do CSG with the *boundary* of the mesh2, and
> > ignore the internal triangles as far as CSG is concerned. Is this possible?
>
> No.
>
> You'll have to separate the internal and external triangles into
> different mesh2 objects.

OK, but how would I do CSG with the mesh containing internal triangles? I want
the internal triangles to be clipped as well.

One workaround I thought of is to have a mesh containing only boundary triangles
and use that in a clipped_by modifier for the mesh being subtracted from. But
this doesn't support full CSG. But I suppose I can figure out ways to work
around this.


Post a reply to this message

From: quickfur
Subject: Re: CSG with mesh2
Date: 18 Jan 2011 17:25:00
Message: <web.4d3612cf9a9f4973ee8d82c40@news.povray.org>
"quickfur" <qui### [at] quickfurathcx> wrote:
[...]
> One workaround I thought of is to have a mesh containing only boundary triangles
> and use that in a clipped_by modifier for the mesh being subtracted from. But
> this doesn't support full CSG. But I suppose I can figure out ways to work
> around this.

Actually, this doesn't work. :-( I keep getting "Illegal texture or patch in
clip, bound or object pattern" when I specify clipped_by { mesh2 { ... }}.

Any suggestions as to how I might achieve clipping by a mesh2 object? Or is this
simply impossible?


Post a reply to this message

From: Jim Holsenback
Subject: Re: CSG with mesh2
Date: 18 Jan 2011 17:32:03
Message: <4d3614e3$1@news.povray.org>
On 01/18/2011 06:23 PM, quickfur wrote:
> "quickfur" <qui### [at] quickfurathcx> wrote:

> 
> Actually, this doesn't work. :-( I keep getting "Illegal texture or patch in
> clip, bound or object pattern" when I specify clipped_by { mesh2 { ... }}.

http://wiki.povray.org/content/Documentation:Reference_Section_4.5#Clipped_By
the 2nd paragraph is your clue!


Post a reply to this message

From: Alain
Subject: Re: CSG with mesh2
Date: 18 Jan 2011 23:22:57
Message: <4d366721@news.povray.org>

> Hi All,
>
> I want to do CSG with a mesh2 object, but I'm not sure if POVRay supports what I
> need to do: the mesh2 object that I have is closed, but also contains internal
> triangles (almost every triangle is transparent, so the internal triangles are
> visible). I want to be able to do CSG with the *boundary* of the mesh2, and
> ignore the internal triangles as far as CSG is concerned. Is this possible?
>
>  From the documentation, it seems like it wouldn't do what I want, because it
> seems that based on whether the number of triangles intersected is odd or even
> POV will consider the point as inside/outside. But what I want is for POV to
> only intersect the triangles on the mesh2's *boundary* when doing this test, and
> ignore the internal triangles. So any point inside the boundary triangles should
> be regarded as "inside" regardless of how many triangles intersect a particular
> ray.
>
> What I want to achieve is this: I have several mesh2 objects, all of which have
> a well-defined boundary but also contain internal triangles. I want to be able
> to, for example, subtract mesh B from mesh A, so that all the triangles in mesh
> A (including the internal triangles) are clipped by the *boundary* of mesh B
> (ignoring B's internal triangles). How can I achieve this?
>
> Thanks in advance!
>
>

Make a mesh with the outside triangles and one with the inside 
triangles. Don't forget to give an inside vector to the outside mesh.

Unless the inside mesh is supposed to also be solid, don't give it an 
inside vector.

Bind them in a single union.

Have the second mesh made as the first outside one. DON'T union it with 
it's inside triangles.

Perform your difference or intersection.

If you want to use clipped_by, the clipping object MUST be texture-less.
So, you need to define your meshes that are subject to be used as 
clipping objects without any material/texture/pigment, and only apply 
the texture if needed.

A clipping mesh may be unioned with a non-solid iner mesh, as long as 
they are both texture-less.

Texture-less also mean that you can't have any per triangle/vertice 
texture. NO texture ANYWHERE in the mesh definition.




Alain


Post a reply to this message

From: quickfur
Subject: Re: CSG with mesh2
Date: 19 Jan 2011 16:30:01
Message: <web.4d3756869a9f4973ee8d82c40@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:
[...]
> If you want to use clipped_by, the clipping object MUST be texture-less.
> So, you need to define your meshes that are subject to be used as
> clipping objects without any material/texture/pigment, and only apply
> the texture if needed.
>
> A clipping mesh may be unioned with a non-solid iner mesh, as long as
> they are both texture-less.
>
> Texture-less also mean that you can't have any per triangle/vertice
> texture. NO texture ANYWHERE in the mesh definition.
[...]

It's not working. I tried clipped_by with a textureless mesh2 object, but POVRay
is still rejecting it. Here's an example that causes a rejection:

sphere {
        <0,0,0>, .5

        clipped_by {
                mesh2 {
                        vertex_vectors {
                                6,
                                <1,0,0>, <0,1,0>, <0,0,1>,
                                <-1,0,0>, <0,-1,0>, <0,0,-1>
                        }
                        face_indices {
                                8,
                                <0,1,2>
                                <0,2,3>
                                <0,3,4>
                                <0,4,1>
                                <5,1,2>
                                <5,2,3>
                                <5,3,4>
                                <5,4,1>
                        }
                        inside_vector x
                }
        }

        pigment { rgb<1,1,0> }
        finish { ambient 0.3 diffuse 0.5, specular 0.8 }
}


As you can see, there is no texture anywhere in the mesh2, yet POVRay still
complains:

Parse Error: Illegal texture or patch in clip, bound or object pattern.

Is this a version-dependent thing? Or did I misunderstand the mesh2 syntax? I'm
really confused now.


Post a reply to this message

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