POV-Ray : Newsgroups : povray.newusers : Assigning different textures to triangles in a mesh Server Time
4 Sep 2024 22:12:57 EDT (-0400)
  Assigning different textures to triangles in a mesh (Message 11 to 15 of 15)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Ken
Subject: Re: Assigning different textures to triangles in a mesh
Date: 8 Sep 2002 23:28:35
Message: <3D7C164A.8AF0AA6B@pacbell.net>
"Mark M. Wilson" wrote:

> But you're saying, if I understand correctly, that with a union of
> triangles, I can use a pigment OR a texture quite freely, yes?

Yes. In a union a triangle is just like any other POV-Ray object type.

-- 
Ken Tyler


Post a reply to this message

From: Warp
Subject: Re: Assigning different textures to triangles in a mesh
Date: 9 Sep 2002 06:24:36
Message: <3d7c76e4@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
> The real beauty of meshes are the reduced memory requirements when copies of
> declared mesh objects are used. There is no real difference otherwise.

  Unless POV-Ray handles a union of triangles in a very special way (which
I don't know if it does; I suppose not), then even one single instance of
a mesh takes less memory than a union of triangles (because in a mesh
vertex points shared by several triangles are stored only once, not once for
each triangle, as I suppose happens with a union of triangles).

-- 
#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: Warp
Subject: Re: Assigning different textures to triangles in a mesh
Date: 9 Sep 2002 06:39:23
Message: <3d7c7a5a@news.povray.org>
Mark M. Wilson <mrm### [at] attnet> wrote:
> But you're saying, if I understand correctly, that with a union of
> triangles, I can use a pigment OR a texture quite freely, yes?

  When you are using a mesh, you can only use pre-declared textures in
the triangles.
  'texture { pigment { whatever } }' is not a pre-declared texture, but a
new texture declaration, which is illegal in a mesh triangle. You can
only use 'texture { predeclared_texture_identifier }'. This is because
mesh triangles only accept references to a previously declared texture
(for efficiency), and they can't hold a new texture definition.

  If you are going to use the same texture in more than one triangle, then
doing it with a mesh is certainly memory-saving. (If you do it with a union
of triangles you will be copying the texture for each triangle in which you
use it.)

  If you have many textures you want to use, but you don't want to invent
a new identifier name for each, you can make an array with your textures.
That is:

#declare Textures = array[amount_of_textures]
{
  texture { whatever },
  texture { something else },
  texture { something },
  ...
}

  Then you can use them in the triangles like:
texture { Textures[0] } // uses the first texture in the array

-- 
#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: Christopher James Huff
Subject: Re: Assigning different textures to triangles in a mesh
Date: 9 Sep 2002 09:24:25
Message: <chrishuff-1AC4CA.09235309092002@netplex.aussie.org>
In article <pan### [at] attnet>,
 "Mark M. Wilson" <mrm### [at] attnet> wrote:

> and it worked like that!  Why does it let me use a color identifier as a
> texture for the whole mesh, but not for the ind. triangles?  That doesn't
> really make sense to me.  The docs could have been a little clearer on
> that point, if you ask me....

Because the individual triangles need texture identifiers, while a 
texture definition is acceptable for the mesh object. The docs do 
mention this.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Assigning different textures to triangles in a mesh
Date: 9 Sep 2002 09:25:03
Message: <chrishuff-7C044E.09243309092002@netplex.aussie.org>
In article <3d7c76e4@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   Unless POV-Ray handles a union of triangles in a very special way (which
> I don't know if it does; I suppose not), then even one single instance of
> a mesh takes less memory than a union of triangles (because in a mesh
> vertex points shared by several triangles are stored only once, not once for
> each triangle, as I suppose happens with a union of triangles).

The mesh primitive also has a well optimized way of doing bounding 
calculations on individual triangles.

A union is a collection of shapes, the syntax of each shape is exactly 
the same as it would be outside of the union. A mesh is not a collection 
of triangle objects, it is a collection of triangle vertex, normal, and 
texture data, optimized for memory and speed. It is more of a 
"multi-triangle" than a group of triangles. Because of this, mesh 
triangles don't support the exact same syntax.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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