POV-Ray : Newsgroups : povray.newusers : many identical object with different textures : Re: many identical object with different textures Server Time
5 Sep 2024 20:17:39 EDT (-0400)
  Re: many identical object with different textures  
From: Ken
Date: 7 Sep 1999 17:50:12
Message: <37D58838.49975187@pacbell.net>
Peter Popov wrote:
> 
> There are two main cases of identically looking objects:
> 
> 1. You declare the object *with* the texture amd make some copies of
> it. Obviously they will be absolutely identical
> 
> 2. You union all your objects and apply a texture to them. In this
> case you get the "chopped out of same block of marble" syndrome. For
> example, if you make a temple as a union and apply a marble texture to
> it, it will look as if made of the same piece of stone, and this is
> very unrealistic.
> 
> In both cases you'd have to apply an individual texture to every
> object. Well, for case 1 you could turn each object a random amount
> but this only works for spheres, columns, vases etc. But you'll
> generally need individual textures. The easiest way to apply them is
> via the seed() and rand() functions. First, declare a seed:
> 
> #declare Seed=seed(42);
> 
> Then, in your while loop responsible for placing the objects, use
> something like this:
> 
> ...
> object { MyObject texture { MyTexture translate 100*rand(Seed1) } }
> ...
> 
> Of course, the value is dependant on the scale of the scene.
> 
> The problem with this approach is that each texture eats memory. You
> can cheat a bit in the case that your objects are aligned in rows
> and/or columns. Consider this (unchecked!) example:
> 
> #declare Row=0;
> #declare Column=0;
> 
> union
> {
>   #while (Row<100)
>     #while (Column<100)
>       sphere { <Row-50,0.8,Column-50>, 0.8 }
>       #declare Column=Column+1;
>     #end
>     #declare Row=Row+1;
>   #end
> 
>   pigment
>   {
>     marble scale 0.25
>     warp { repeat x offset 2*y}
>     warp { repeat z offset 2*y}
>   }
> }
> 
> You'll save memory this way as only one texture is used, but this
> approach is only applicable for ordered patterns of objects.
> 
> I hope this helps some.
> 
> Peter Popov
> ICQ: 15002700

This is all great advice and the only thing Peter's explaination does not
account for is if you have placed you objects with some other method than
a while loop. A modeller for instance creates unique locations for each
object and the rand function will not give you any advantage in this case.

-- 
Ken Tyler

See my 850+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

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