POV-Ray : Newsgroups : povray.advanced-users : Mesh transparancy Server Time
25 Nov 2024 14:22:19 EST (-0500)
  Mesh transparancy (Message 1 to 4 of 4)  
From: shahrokh
Subject: Mesh transparancy
Date: 18 Sep 2002 00:45:04
Message: <web.3d8803c3dd85c78cfe5a7c470@news.povray.org>
Hi,

Look at this example bellow. It is a solid made of several cubes, each built
of triangles using mesh. As you see the object is colored in transparent so
one can see inside. However, the faces of every single element is there,
and visible.
Can somebody tell how to get rid of those faces inside, the same way you
could do using merge when you combine two objects like a box and a cylinder
?
Somebody told me to use mesh2 .... but I don't see how. Are there a simple
example to do so ?

Thaks.
Shahrokh



background {rgb <1,1,1>}

light_source { <10,20,5> color rgb <1,1,1>}

camera{angle 60 location <0.5,0.5,0.5>look_at <0,0,0> sky   <0,0,1>}

global_settings { ambient_light rgb <1,1,1> }

#declare Texture01 = texture {pigment { color rgbt<1, 0.38, 0.12, 0.7> } }

#declare S1     = <-0.1000E+01 , -0.1000E+01 , -0.1000E+01>;
#declare S2     = <-0.1000E+01 , -0.7500E+00 , -0.1000E+01>;
#declare S3     = <-0.1000E+01 , -0.5000E+00 , -0.1000E+01>;
#declare S4     = <-0.1000E+01 , -0.2500E+00 , -0.1000E+01>;
#declare S5     = <-0.1000E+01 , -0.5551E-16 , -0.1000E+01>;
#declare S6     = <-0.1000E+01 ,  0.2500E+00 , -0.1000E+01>;
#declare S25    = <-0.8333E+00 , -0.1000E+01 , -0.1000E+01>;
#declare S26    = <-0.8333E+00 , -0.7500E+00 , -0.1000E+01>;
#declare S27    = <-0.8333E+00 , -0.5000E+00 , -0.1000E+01>;
#declare S28    = <-0.8333E+00 , -0.2500E+00 , -0.1000E+01>;
#declare S29    = <-0.8333E+00 ,  0.1247E-16 , -0.1000E+01>;
#declare S30    = <-0.8333E+00 ,  0.2500E+00 , -0.1000E+01>;
#declare S1825  = < 0.1100E+02 , -0.1000E+01 , -0.1000E+01>;
#declare S1826  = <-0.1000E+01 , -0.1000E+01 ,  0.0000E+00>;
#declare S1827  = <-0.1000E+01 , -0.7500E+00 ,  0.0000E+00>;
#declare S1828  = <-0.1000E+01 , -0.5000E+00 ,  0.0000E+00>;
#declare S1829  = <-0.1000E+01 , -0.2500E+00 ,  0.0000E+00>;
#declare S1830  = <-0.1000E+01 , -0.5551E-16 ,  0.0000E+00>;
#declare S1831  = <-0.1000E+01 ,  0.2500E+00 ,  0.0000E+00>;
#declare S1850  = <-0.8333E+00 , -0.1000E+01 ,  0.0000E+00>;
#declare S1851  = <-0.8333E+00 , -0.7500E+00 ,  0.0000E+00>;
#declare S1852  = <-0.8333E+00 , -0.5000E+00 ,  0.0000E+00>;
#declare S1853  = <-0.8333E+00 , -0.2500E+00 ,  0.0000E+00>;
#declare S1854  = <-0.8333E+00 ,  0.1247E-16 ,  0.0000E+00>;
#declare S1855  = <-0.8333E+00 ,  0.2500E+00 ,  0.0000E+00>;

#macro Irreg_Cube(P1, P2, P3, P4, P5, P6, P7, P8)
triangle { P2, P4, P3 }  triangle { P1, P4, P2 }
triangle { P1, P5, P4 }  triangle { P5, P8, P4 }
triangle { P5, P7, P8 }  triangle { P5, P6, P7 }
triangle { P7, P6, P2 }  triangle { P2, P3, P7 }
triangle { P3, P8, P7 }  triangle { P3, P4, P8 }
triangle { P1, P6, P5 }  triangle { P1, P2, P6 }
#end


mesh {
  Irreg_Cube(S1    ,S2    ,S26   ,S25   ,S1826 ,S1827 ,S1851 ,S1850 )
  Irreg_Cube(S2    ,S3    ,S27   ,S26   ,S1827 ,S1828 ,S1852 ,S1851 )
  Irreg_Cube(S3    ,S4    ,S28   ,S27   ,S1828 ,S1829 ,S1853 ,S1852 )
  Irreg_Cube(S4    ,S5    ,S29   ,S28   ,S1829 ,S1830 ,S1854 ,S1853 )
  Irreg_Cube(S5    ,S6    ,S30   ,S29   ,S1830 ,S1831 ,S1855 ,S1854 )
   texture { Texture01 }  }


Post a reply to this message

From: Warp
Subject: Re: Mesh transparancy
Date: 18 Sep 2002 05:09:56
Message: <3d8842e4@news.povray.org>
Well, you are telling POV-Ray "there's a triangle here" and thus POV-Ray
renders the triangle. If you don't want a triangle there, then don't put
a triangle there.

  In order to use the merge CSG, each box has to be a separate (solid) object
(meshes can be made solid with the inside_vector feature). If you are going
to use only boxes, then real boxes instead of meshes will probably be
more efficient for this.
  If you define one single mesh, then it's one single object. There's no
way POV-Ray can perform a "merge" to one single object.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Le Forgeron
Subject: Re: Mesh transparancy
Date: 18 Sep 2002 05:21:22
Message: <3D88459C.4050909@free.fr>
shahrokh wrote:

> Hi,
> 
> Look at this example bellow. It is a solid made of several cubes, each built
> of triangles using mesh. As you see the object is colored in transparent so
> one can see inside. However, the faces of every single element is there,
> and visible.
> Can somebody tell how to get rid of those faces inside, the same way you
> could do using merge when you combine two objects like a box and a cylinder
> ?
> Somebody told me to use mesh2 .... but I don't see how. Are there a simple
> example to do so ?
>


Mesh2 won't solve your problem. It is a different input format for the 
same object.

Working with mesh has a price: you have to pay it for what you want to do.
Solution would be either to not generate the offending triangles (if you 
can identify them easily...) or to give them a texture transmit of 1.

Also, beware of max_trace_level setting, default of 5 might be too low 
for some view point.

But why not use CSG with some boxes instead ?
Just updating the Irreg_Cube macro to one box instead of twelve 
triangles (it can take a little math to get the dimension of the box, 
and then the correct rotation and translation, but that shouldn't be too 
difficult). And then merge instead of mesh!

 
> Thaks.
> Shahrokh


Post a reply to this message

From: Shay
Subject: Re: Mesh transparancy
Date: 18 Sep 2002 11:57:22
Message: <3d88a262@news.povray.org>
shahrokh <shg### [at] hotmailcom> wrote in message
news:web.3d8803c3dd85c78cfe5a7c470@news.povray.org...

I'm assuming that you cannot use box primitives because your Irreg_Cubes are
not necessarily square. This will make accomplishing what you want a little
more difficult than just using a merge of cubes, but provided that the sides
of your Irreg_Cubes are flat (as they appear to be) and that the faces meet
along all edges when touching another face (as they appear to do), this
won't be too difficult. Actually, as long as the second condition is true
then this is possible, but the results will most likely look like crap if
your sides are not flat.

The easiest way to code a solution would be to represent the object twice.
The first representation would be an array of groups of four vertices
representing the four corners of each side of each Irreg_Cube. The second
and final representation will be formed by #undef_ing all groups of 4
vertices for which a matching group (although not in the same order) of
vertices exists, triangulating all of the remaining sides, and placing these
triangles into a mesh object.

Don't bother with mesh2 for this macro. Converting to mesh2 would involve
combining duplicate vertices, and doing so would be wasted effort since no
vertex normals will need to be found for this "edgy" object.

 -Shay


Post a reply to this message

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