POV-Ray : Newsgroups : povray.binaries.images : Mesh CSG help Server Time
31 Jul 2024 06:23:25 EDT (-0400)
  Mesh CSG help (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: Christian Froeschlin
Subject: Re: Mesh CSG help
Date: 19 Jun 2010 13:07:41
Message: <4c1cf95d@news.povray.org>
SharkD wrote:

> I'm a bit confused by input_vector. Is it a vector or a point? I have 
> simply been placing it at the exact center of each mesh

It's a direction so you should never set it to 0. Otherwise,
the value is completely arbitrary in theory, although numerical
issues may cause artefacts for some values.

[To test if a point is inside a mesh you can shoot a line
from that point to infinity in some direction and calculate
the number of intersections, if that is odd the point is
inside the mesh. Of course, for convex objects the count
would then always be 1].


Post a reply to this message

From: clipka
Subject: Re: Mesh CSG help
Date: 19 Jun 2010 13:20:15
Message: <4c1cfc4f@news.povray.org>
Am 19.06.2010 18:08, schrieb SharkD:
> On 6/18/2010 7:40 AM, clipka wrote:
>> What's your inside_vector? Does it happen to be pointing along the blue
>> line (whatever axis that may be)? If so, try changing that to something
>> pretty random.
>
> I'm a bit confused by input_vector. Is it a vector or a point? I have
> simply been placing it at the exact center of each mesh, which sometimes
> happens to be the origin.

As the name suggests, inside_vector (not input_vector, btw) is indeed a 
vector.

POV-Ray's implementation of intersection and difference CSG uses two 
operations: Computing intersections between a ray and the member 
objects, and testing whether such an intersection point is inside the 
other member objects.

For most object types, the inside-test is defined via a mathematical 
formula (for instance, for a sphere you just test whether the distance 
between the point in question and the center is smaller than the 
sphere's radius). For meshes, this is not so easy; so instead, POV-Ray 
shoots a "random" test ray from the point in question and tests how many 
times it intersects the mesh: If the number of intersections is odd, the 
point must be inside, otherwise outside.

inside_vector specifies the "random" direction in which to shoot that 
test ray. Theoretically the direction should not matter, but in rare 
cases this algorithm might lead to artifacts - which then can be made to 
disappear by choosing a different test ray direction.

An inside_vector of <0,0,0> is equivalent to specifying no inside_vector 
at all, i.e. leaving the mesh non-solid.


Post a reply to this message

From: SharkD
Subject: Re: Mesh CSG help
Date: 19 Jun 2010 14:23:26
Message: <4c1d0b1e$1@news.povray.org>
On 6/19/2010 1:20 PM, clipka wrote:
> As the name suggests, inside_vector (not input_vector, btw) is indeed a
> vector.

Oops, sorry!

On 6/19/2010 1:20 PM, clipka wrote:
> POV-Ray's implementation of intersection and difference CSG uses two
> operations: Computing intersections between a ray and the member
> objects, and testing whether such an intersection point is inside the
> other member objects.
>
> For most object types, the inside-test is defined via a mathematical
> formula (for instance, for a sphere you just test whether the distance
> between the point in question and the center is smaller than the
> sphere's radius). For meshes, this is not so easy; so instead, POV-Ray
> shoots a "random" test ray from the point in question and tests how many
> times it intersects the mesh: If the number of intersections is odd, the
> point must be inside, otherwise outside.
>
> inside_vector specifies the "random" direction in which to shoot that
> test ray. Theoretically the direction should not matter, but in rare
> cases this algorithm might lead to artifacts - which then can be made to
> disappear by choosing a different test ray direction.
>
> An inside_vector of <0,0,0> is equivalent to specifying no inside_vector
> at all, i.e. leaving the mesh non-solid.

I still don't understand what value I /should/ be using for 
inside_vector. Someplace inside the mesh that is not <0,0,0>?

-- 
http://isometricland.com


Post a reply to this message

From: stbenge
Subject: Re: Mesh CSG help
Date: 19 Jun 2010 16:50:38
Message: <4c1d2d9e$1@news.povray.org>
SharkD wrote:
> I still don't understand what value I /should/ be using for 
> inside_vector. Someplace inside the mesh that is not <0,0,0>?

Like clipka suggested, any direction will do in most cases, though if 
your mesh isn't completely closed you might get various results for 
different vectors. I recently tried changing inside_vector when I 
encountered strange behavior after converting the mesh to an object 
pigment, and was presented with odd effects unique to the values I was 
passing to inside_vector. I'm pretty sure it wasn't a properly closed mesh.


Post a reply to this message

From: clipka
Subject: Re: Mesh CSG help
Date: 19 Jun 2010 17:13:23
Message: <4c1d32f3$1@news.povray.org>
Am 19.06.2010 20:23, schrieb SharkD:

> I still don't understand what value I /should/ be using for
> inside_vector. Someplace inside the mesh that is not <0,0,0>?

There is no "right" value, and no "wrong" one either except for <0,0,0> 
- any non-zero vector will usually do. I often use "y", but you can just 
as well use "x", "z", "<1,1,1>", "<42,23,4711>", 
"<sqrt(13),log(77),sin(0.2)>" or... well, maybe you get the idea.

The only situation when the actual value of this vector may make a 
difference is when you get artifacts - in that case choosing some other 
value may help.


Post a reply to this message

From: SharkD
Subject: Re: Mesh CSG help
Date: 19 Jun 2010 17:49:43
Message: <4c1d3b77$1@news.povray.org>
On 6/19/2010 5:13 PM, clipka wrote:
> Am 19.06.2010 20:23, schrieb SharkD:
>
>> I still don't understand what value I /should/ be using for
>> inside_vector. Someplace inside the mesh that is not <0,0,0>?
>
> There is no "right" value, and no "wrong" one either except for <0,0,0>
> - any non-zero vector will usually do. I often use "y", but you can just
> as well use "x", "z", "<1,1,1>", "<42,23,4711>",
> "<sqrt(13),log(77),sin(0.2)>" or... well, maybe you get the idea.
>
> The only situation when the actual value of this vector may make a
> difference is when you get artifacts - in that case choosing some other
> value may help.

OK, thanks.

-- 
http://isometricland.com


Post a reply to this message

From: Thomas de Groot
Subject: Re: Mesh CSG help
Date: 20 Jun 2010 03:49:48
Message: <4c1dc81c@news.povray.org>
"SharkD" <pos### [at] gmailcom> schreef in bericht 
news:4c1ceb68$1@news.povray.org...
> I'm a bit confused by input_vector. Is it a vector or a point? I have 
> simply been placing it at the exact center of each mesh, which sometimes 
> happens to be the origin.

For instance, Poseray puts the inside_vector at the end of the mesh2:

mesh2{
.....all mesh data.....
inside_vector <0,0,1>
}

Thomas


Post a reply to this message

From: SharkD
Subject: Re: Mesh CSG help
Date: 20 Jun 2010 05:15:54
Message: <4c1ddc4a$1@news.povray.org>
On 6/20/2010 3:49 AM, Thomas de Groot wrote:
> For instance, Poseray puts the inside_vector at the end of the mesh2:
>
> mesh2{
> .....all mesh data.....
> inside_vector<0,0,1>
> }
>
> Thomas
>
>

I didn't mean placement within the blocks of SDL code, LOL!

-- 
http://isometricland.com


Post a reply to this message

From: Thomas de Groot
Subject: Re: Mesh CSG help
Date: 20 Jun 2010 11:20:41
Message: <4c1e31c9@news.povray.org>
"SharkD" <pos### [at] gmailcom> schreef in bericht 
news:4c1ddc4a$1@news.povray.org...
> I didn't mean placement within the blocks of SDL code, LOL!
>

Great! One of my infamous misunderstandings :-)

Thomas


Post a reply to this message

From: Alain
Subject: Re: Mesh CSG help
Date: 27 Jun 2010 14:15:21
Message: <4c279539$1@news.povray.org>
Le 2010-06-17 11:48, SharkD a écrit :
> When I intersect two solid meshes I get weird artifacts, as can be seen
> in the following images. The red object is the main object, the green
> object is the one I'm trying to subtract. The artifacts aren't _always"
> there. Sometimes they disappear when the radius of the green object
> changes. Any clue why this is happening?
>
>

Looks like a problem with the orientation of the inside vector.
Try changing it a little.
If it's value is <0,1,0>, change it to something like <0.0001,1,0>.


Alain


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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