POV-Ray : Newsgroups : povray.newusers : Assigning different textures to triangles in a mesh Server Time
4 Sep 2024 22:18:36 EDT (-0400)
  Assigning different textures to triangles in a mesh (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: Mark M  Wilson
Subject: Re: Assigning different textures to triangles in a mesh
Date: 8 Sep 2002 23:18:04
Message: <pan.2002.09.08.23.20.36.111164.1883@att.net>
On Sun, 08 Sep 2002 22:53:20 -0400, Ken wrote:

 To use the pre-declare
> colors listed in glass.inc you would have to use them like this -
> 
> #include "glass.inc"
> 
> mesh {
>         triangle {<a>, <b>, <c> texture { pigment { Col_Glass_Winebottle
>         }}} triangle {<c>, <d>, <e> texture { pigment { Col_Glass_Orange
>         }}} etc...
> }

Ok, I tried this, and it didn't work either.   AAARRGGH!  I _really_
don't relish the idea of making extremely thin triangle-shaped prisms,
and rotating/translating them into place...
--Mark W.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GLS$ d+ s+: a C+ UL--- P L++ E--- W+ N+ o+ K- w-- 
O-- M- V-- PS+ PE Y+ PGP- t 5-- X- R- tv+ b+ DI++ D++ 
G e+++ h--- r+++ y+++ 
------END GEEK CODE BLOCK------


Post a reply to this message

From: Mark M  Wilson
Subject: Re: Assigning different textures to triangles in a mesh
Date: 8 Sep 2002 23:22:13
Message: <pan.2002.09.08.23.24.45.457286.1883@att.net>
On Sun, 08 Sep 2002 23:18:07 -0400, Ken wrote:

> 
> Unless you have a great need to use a mesh object you can get greater
> flexibility by just using a union of triangles instead of a mesh.
> 

I didn't know that triangles could be used outside the context of a
mesh....  That's why I'm posting to the newusers group!  ;-)
Thanks again!
--Mark  W.
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GLS$ d+ s+: a C+ UL--- P L++ E--- W+ N+ o+ K- w-- 
O-- M- V-- PS+ PE Y+ PGP- t 5-- X- R- tv+ b+ DI++ D++ 
G e+++ h--- r+++ y+++ 
------END GEEK CODE BLOCK------


Post a reply to this message

From: Ken
Subject: Re: Assigning different textures to triangles in a mesh
Date: 8 Sep 2002 23:23:35
Message: <3D7C151D.F109E717@pacbell.net>
"Mark M. Wilson" wrote:

> Ok, I tried this, and it didn't work either.   AAARRGGH!  I _really_
> don't relish the idea of making extremely thin triangle-shaped prisms,
> and rotating/translating them into place...

What it really want's is -

#include "glass.inc"

#declare T1 = texture { pigment { Col_Glass_Winebottle }}
#declare T2 = texture { pigment { Col_Glass_Orange }}


mesh {
        triangle {<a>, <b>, <c> texture { T1 }}
        triangle {<c>, <d>, <e> texture { T2 }}
        etc...
}


-- 
Ken Tyler


Post a reply to this message

From: Mark M  Wilson
Subject: Re: Assigning different textures to triangles in a mesh
Date: 8 Sep 2002 23:25:28
Message: <pan.2002.09.08.23.27.55.718565.1883@att.net>
On Sun, 08 Sep 2002 23:27:25 -0400, Ken 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?
--Mark



> What it really want's is -
> 
> #include "glass.inc"
> 
> #declare T1 = texture { pigment { Col_Glass_Winebottle }} #declare T2 =
> texture { pigment { Col_Glass_Orange }}
> 
> 
> mesh {
>         triangle {<a>, <b>, <c> texture { T1 }} triangle {<c>, <d>, <e>
>         texture { T2 }} etc...
> }
> 
> 

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GLS$ d+ s+: a C+ UL--- P L++ E--- W+ N+ o+ K- w-- 
O-- M- V-- PS+ PE Y+ PGP- t 5-- X- R- tv+ b+ DI++ D++ 
G e+++ h--- r+++ y+++ 
------END GEEK CODE BLOCK------


Post a reply to this message

From: Ken
Subject: Re: Assigning different textures to triangles in a mesh
Date: 8 Sep 2002 23:27:10
Message: <3D7C15F4.2B7F42B4@pacbell.net>
"Mark M. Wilson" wrote:

> I didn't know that triangles could be used outside the context of a
> mesh....  That's why I'm posting to the newusers group!  ;-)

In POV-Ray v1.0 and v2.2 all triangle based objects where contained in a union.
Meshes didn't appear until POV-Ray v3.0 and the restrictions that came with them.
The real beauty of meshes are the reduced memory requirements when copies of
declared mesh objects are used. There is no real difference otherwise.

-- 
Ken Tyler


Post a reply to this message

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 5 Messages Goto Initial 10 Messages

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