POV-Ray : Newsgroups : povray.newusers : Random texture? : Re: Random texture? Server Time
28 Jun 2024 23:24:52 EDT (-0400)
  Re: Random texture?  
From: Jim Holsenback
Date: 6 Jan 2012 22:37:05
Message: <4f07bde1@news.povray.org>
On 01/06/2012 10:26 PM, Jim Holsenback wrote:
> On 01/06/2012 09:39 PM, Micke wrote:
>> Alain<aze### [at] qwertyorg> wrote:

>>>>
>>>> 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
>>
>> Thankyou for your reply, but still no success. Here is my code.
>> #declare Rand = seed(1);
>> #declare Count = 0;
>> #while (Count<10)
>> object{My_Column translate-x*12
>> // texture {My_Marble rotate<rand(Rand),rand(Rand),rand(Rand)>}
>> *Count rotate - 100*y
>> }
>> #declare Count=Count+1;
>>
>> #end
>> All works untill I add the texture line, then this error:No matching } in
>> object',: found instead. What am I doing wrong,please.
>>
>>
> hmmm ... first off the line *Count rotate - 100*y just looked strange
> before I even started. After satisfying My_Column and My_Marble (my own
> simple definition) I get this error:
>
> Parse Error: No matching } in 'object', * found instead
>
> that confirms my suspicion about the *Count line, so perhaps there is
> something in one of those other definitions thats causing the problem
> ... since I'm not sure of your intent, that's my best guess.

follow up ... forgot to mention that commenting out the *Count line and 
it parses just fine, so maybe if you could clarify the intent of that 
line it might give us another clue ... does the *Count line belong 
inside the texture definition?

This parses fine:
#declare My_Column = cylinder {<0,0,0>, <0,1,0>, 0.5 pigment { Green}}
#declare My_Marble = texture {pigment {Blue}}

#declare Rand = seed(1);
  #declare Count = 0;
  #while (Count <10)
  object{My_Column translate-x*12
    texture {My_Marble rotate <rand(Rand),rand(Rand),rand(Rand)>//}
   *Count  rotate - 100*y}
      }
   #declare Count=Count+1;

  #end


Post a reply to this message

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