POV-Ray : Newsgroups : povray.newusers : Random texture? : Re: Random texture? Server Time
28 Jun 2024 23:17:11 EDT (-0400)
  Re: Random texture?  
From: Alain
Date: 26 Dec 2011 21:57:26
Message: <4ef93416$1@news.povray.org>

>
> I am trying to randomise a texure in a while-loop.Is this possible,and how can I
> achive this please.
>
>
First, you initiate a random stream: #declare Rand = seed(0);
seed() takes any integer value as it's argument.

Then, in your loop, you use that stream to randomly create some pigment 
or switch between patterns and create random colour_map, also using your 
random stream.

You can create a stream to sellect your pattern and another for the colours.
You can create a random pigment like this: 
pigment{rgb<rand(Rand),rand(Rand),rand(Rand)>}
pigment{rgbft<rand(Rand),rand(Rand),rand(Rand),rand(Rand)/2,rand(Rand)/2>} 
will generate pigments that are transparent to various degrees.

You can use the #switch() #case()/#range() #break #end statement to 
sellect between various patterns. Read the documentation about the 
#switch() statement. The #break is mandatory.


Alain


Post a reply to this message

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