POV-Ray : Newsgroups : povray.newusers : Assigning different textures to triangles in a mesh : Re: Assigning different textures to triangles in a mesh Server Time
5 Sep 2024 00:14:43 EDT (-0400)
  Re: Assigning different textures to triangles in a mesh  
From: Warp
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

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