POV-Ray : Newsgroups : povray.newusers : many identical object with different textures : Re: many identical object with different textures Server Time
5 Sep 2024 20:19:31 EDT (-0400)
  Re: many identical object with different textures  
From: Peter Popov
Date: 7 Sep 1999 17:39:08
Message: <4oDVN=l6V3Tl2wckz0dYcKbsGKAQ@4ax.com>
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


Post a reply to this message

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