POV-Ray : Newsgroups : povray.general : constructing solid mesh from surface mesh Server Time
29 Jul 2024 16:31:39 EDT (-0400)
  constructing solid mesh from surface mesh (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Thomas de Groot
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 06:59:09
Message: <4e28067d$1@news.povray.org>
On 21-7-2011 10:16, kiwon wrote:
>    #declare myvolume = union {
>      box {0, 1 clipped_by {mysurface}}
>      mysurface
>    }
>


Try:

#declare myvolume = union {
   box {0, 1 clipped_by {mysurface}}
   object {mysurface}
}

Thomas


Post a reply to this message

From: kiwon
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 08:30:04
Message: <web.4e281b84fccc6bd34c0a951f0@news.povray.org>
Thomas de Groot <tenDOTlnDOTretniATtoorgedDOTt> wrote:
> On 21-7-2011 10:16, kiwon wrote:
> >    #declare myvolume = union {
> >      box {0, 1 clipped_by {mysurface}}
> >      mysurface
> >    }
> >
>
>
> Try:
>
> #declare myvolume = union {
>    box {0, 1 clipped_by {mysurface}}
>    object {mysurface}
> }

Tried, but the same error msg on the "clipped_by" line:
Parse Error: Illegal texture or patch in clip, bound or object pattern.
The clipped_by doesn't seem to work with mesh2.


Post a reply to this message

From: kiwon
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 08:45:01
Message: <web.4e281f1afccc6bd34c0a951f0@news.povray.org>
"kiwon" <nomail@nomail> wrote:
> Thomas de Groot <tenDOTlnDOTretniATtoorgedDOTt> wrote:
> > On 21-7-2011 10:16, kiwon wrote:
> > >    #declare myvolume = union {
> > >      box {0, 1 clipped_by {mysurface}}
> > >      mysurface
> > >    }
> > >
> >
> >
> > Try:
> >
> > #declare myvolume = union {
> >    box {0, 1 clipped_by {mysurface}}
> >    object {mysurface}
> > }
>
> Tried, but the same error msg on the "clipped_by" line:
> Parse Error: Illegal texture or patch in clip, bound or object pattern.
> The clipped_by doesn't seem to work with mesh2.

If I put *inside_vector y* (because the surface's average normal direction is y
direction) in mysurface, it seems to construct what I intend. But the rendering
result has noise on that solid mesh.


Post a reply to this message

From: Thomas de Groot
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 10:11:03
Message: <4e283377$1@news.povray.org>
On 21-7-2011 14:29, kiwon wrote:
> Thomas de Groot<tenDOTlnDOTretniATtoorgedDOTt>  wrote:
>> On 21-7-2011 10:16, kiwon wrote:
>>>     #declare myvolume = union {
>>>       box {0, 1 clipped_by {mysurface}}
>>>       mysurface
>>>     }
>>>
>>
>>
>> Try:
>>
>> #declare myvolume = union {
>>     box {0, 1 clipped_by {mysurface}}
>>     object {mysurface}
>> }
>
> Tried, but the same error msg on the "clipped_by" line:
> Parse Error: Illegal texture or patch in clip, bound or object pattern.
> The clipped_by doesn't seem to work with mesh2.
>
>
>
>
What about:

#declare myvolume =
intersection {
   box {0, 1}
   object {mysurface}
}


Thomas


Post a reply to this message

From: Roman Reiner
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 11:30:01
Message: <web.4e28449efccc6bd39054ac430@news.povray.org>
"kiwon" <nomail@nomail> wrote:
> If I put *inside_vector y* (because the surface's average normal direction is y

That's not how inside_vector works.

It simply defines the specified point to be *inside* the object, thus
determining its inside and outside.


Post a reply to this message

From: kiwon
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 11:40:01
Message: <web.4e284716fccc6bd34c0a951f0@news.povray.org>
Thomas de Groot <tenDOTlnDOTretniATtoorgedDOTt> wrote:
> On 21-7-2011 14:29, kiwon wrote:
> > Thomas de Groot<tenDOTlnDOTretniATtoorgedDOTt>  wrote:
> >> On 21-7-2011 10:16, kiwon wrote:
> >>>     #declare myvolume = union {
> >>>       box {0, 1 clipped_by {mysurface}}
> >>>       mysurface
> >>>     }
> >>>
> >>
> >>
> >> Try:
> >>
> >> #declare myvolume = union {
> >>     box {0, 1 clipped_by {mysurface}}
> >>     object {mysurface}
> >> }
> >
> > Tried, but the same error msg on the "clipped_by" line:
> > Parse Error: Illegal texture or patch in clip, bound or object pattern.
> > The clipped_by doesn't seem to work with mesh2.
> >
> >
> >
> >
> What about:
>
> #declare myvolume =
> intersection {
>    box {0, 1}
>    object {mysurface}
> }

Doesn't work. It keep only mysurface. The following are a simple test codes
for my purpose:

#version 2.7

global_settings {
  assumed_gamma 1.33
  max_trace_level 30
}

camera {
  right -x*image_width/image_height
  location <0.0, 2.2, 2.7>
  look_at <0.0, 0.5, 0.5>
}

light_source {
  <500, 500, -200>
  color rgb 1.3
}


#declare myF = finish {
  ambient 0
  diffuse 0
  phong 1
  phong_size 200
  reflection {
    0.01, 1
    fresnel on
  }
  conserve_energy
}

#declare myT = texture {
  pigment { rgbf <0.9,0.3,0.3 0.95> }
  finish { myF }
}

#declare myI = interior {
  ior 1.33
  fade_distance 10
  fade_power 2
}

#declare myM = material {
  interior{myI}
  texture {myT}
}

#declare TestSurf = mesh2 {
  vertex_vectors {
    4,
    <0, 0.5, 0>,
    <1, 0.5, 0>,
    <0, 0.5, 1>,
    <1, 0.4, 1>,
  }
  face_indices {
    2,
    <0, 1, 3>,
    <0, 3, 2>,
  }
  inside_vector y
}

#declare TestVol = union {
  box{0, 1 clipped_by{TestSurf}}
  TestSurf
}

#declare TestObj = object {
  TestVol
  translate <-0.5, -0.5, -0.5>
  material {myM}
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6, 0.7, 1.0>]
      [0.7 rgb <0.0, 0.1, 0.8>]
    }
  }
}

plane {
  y, -0.2
  texture {
    pigment { color rgb <1.0, 0.8, 0.6> }
    finish { ambient 0 diffuse 1 }
  }
}

object {
  TestObj
  translate <0, 0.5, 0.5>
}


Post a reply to this message

From: kiwon
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 11:50:01
Message: <web.4e28499cfccc6bd34c0a951f0@news.povray.org>
"Roman Reiner" <lim### [at] gmxde> wrote:
> "kiwon" <nomail@nomail> wrote:
> > If I put *inside_vector y* (because the surface's average normal direction is y
>
> That's not how inside_vector works.
>
> It simply defines the specified point to be *inside* the object, thus
> determining its inside and outside.

Really? I don't think so. Please check the manual *3.4.2.3.1 Solid Mesh* it
says:
.....
To determine if a point is inside a triangle mesh, POV-Ray shoots a ray from the
point in some arbitrary direction. If this vector intersects an odd number of
triangles, the point is inside the mesh. If it intersects an even number of
triangles, the point is outside of the mesh. You can specify the direction of
this vector. For example, to use +z as the direction, you would add the
following line to the triangle mesh description (following all other mesh data,
but before the object modifiers).
  inside_vector <0, 0, 1>
This change does not have any effect on unions of triangles, these will still be
always hollow.
.....


Post a reply to this message

From: Warp
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 11:56:35
Message: <4e284c33@news.povray.org>
Roman Reiner <lim### [at] gmxde> wrote:
> "kiwon" <nomail@nomail> wrote:
> > If I put *inside_vector y* (because the surface's average normal direction is y

> That's not how inside_vector works.

> It simply defines the specified point to be *inside* the object, thus
> determining its inside and outside.

  Nope. inside_vector defines a *direction*, not a point.

  When determining if a point is inside the mesh or not, a ray will be
shot in that specified direction from that point, and the number of
intersections with the mesh counted. (If the count is odd, then the point
is determined to be inside.)

  For closed meshes in theory there's little significance on which direction
you choose. Basically any direction would work equally well. There are certain
pathological circumstances where the chosen direction becomes crucial, though.
For example, if you have a triange that's exactly on the xy plane, choosing
an inside_vector x (or any other vector that's on the xy plane) can cause
the insideness calculations to fail for points on that plane. While this is
quite unlikely to happen and show visible effects, in theory it can happen.
That's why you should try to choose a direction that is not tangential to
any of the triangles, if possible.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 12:01:39
Message: <4e284d63@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   For closed meshes in theory there's little significance on which direction
> you choose.

  I forgot to mention the other situation, ie. open meshes: In this case
the chosen direction is *very* crucial, as it determines which direction
the endless "interior" of the open mesh will face. For example, if you have
a "heightfield" built up as a mesh, placed on the xz plane, you want its
interior to be below it, ie. pointing to the negative y direction. In that
case you would use "inside_vector y" (which means that interior testing
rays are shot right up).

  (Solid open meshes can often be useful in conjunction with csg, and
perhaps sometimes even on their own, even though in this case you have
to take into account that the "interior" of the mesh will extend to
infinity at the opposite direction of the inside_vector.)

-- 
                                                          - Warp


Post a reply to this message

From: Alain
Subject: Re: constructing solid mesh from surface mesh
Date: 21 Jul 2011 21:32:16
Message: <4e28d320$1@news.povray.org>

> Dear POV-Ray users,
>
> when there is only a surface mesh, is there any way to construct a solid
> (volumetric) mesh covered by other solid object boundary such as box?
>
> This codes are what I'm just trying, but doesn't seem to work:
>
>    #declare mysurface = mesh2 {
>      ... surface data
>    }
>
>    #declare myvolume = union {
>      box {0, 1 clipped_by {mysurface}}
>      mysurface
>    }
>
> Thanks
>
> Tested in Persistence of Vision(tm) Ray Tracer Version 3.7.0.RC3
> Issued: Parse Error: Illegal texture or patch in clip, bound or object pattern.
>
>
>

I see absolutely no logical to use that kind of construction.

clipped_by cuts a hole in your box and leave it open. You then plug it 
with your mysurface object.
If mysurface don't cover exactly the wanted opening, there will be bits 
of the parent object sticking or bits of the mesh protuding around.

If you use this:
intersection{
  box{0, 1}
  object{mysurface}
  texture{...}
}

With a mysurface that have a proper inside_vector, you will have the 
same result.

Also, mysurface can now be defined with a texture if you want to, or 
need it (like when using an UV maped texture)


Alain


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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