POV-Ray : Newsgroups : povray.newusers : Texture declarations and object grouping Server Time
5 Sep 2024 14:18:41 EDT (-0400)
  Texture declarations and object grouping (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Gail Shaw
Subject: Re: Texture declarations and object grouping
Date: 7 Feb 2001 00:53:47
Message: <3a80e2eb@news.povray.org>
The Cegorach <ceg### [at] yahoocom> wrote in message
news:a2e18tsfr93762o69mu3498gju9r2gicnj@4ax.com...
>
> When you speak of random transformations, is this achieved by a
> function with POV-Ray, such as a Do/While loop, or do you do it by
> hand?

I tend to use something like :

#declare rndTex=seed(4834);

texture {My_Marble_Texture translate
<100*rand(rnd),100*rand(rnd),100*rand(rnd)>}

Check the docs on seed and rand if not familiar with them

> I ask because I'm currently working on--you guessed--marble pillars.
> :-)

Granite pillars here, and just about finished.

Gail
********************************************************************
* gsh### [at] monotixcoza              * System.dat not found.         *
* http://www.rucus.ru.ac.za/~gail/ * Reformat hard drive Y)es O)k  *
********************************************************************
* If at first you don't succeed, call it version 1.0               *
********************************************************************


Post a reply to this message

From: Margus Ramst
Subject: Re: Texture declarations and object grouping
Date: 7 Feb 2001 10:28:37
Message: <3A816A41.E8CA931E@peak.edu.ee>
The Cegorach wrote:
> 
> When you speak of random transformations, is this achieved by a
> function with POV-Ray, such as a Do/While loop, or do you do it by
> hand?
> 

Certainly not by hand, I hate manual labour :P
POV has a rand() function, you can use this to create random transformation
vectors (as in Gail's example).
If the pillars are placed regularly, you can create them with a while loop; each
time the parser goes through the loop and encounters the rand() function, a
different random number is created (ranging from 0 to 1).
Of course you can also position the pillars by hand and give a random texture
transformation to each copy separately.
Here are two macros you might find useful (the second needs access to the first
one to run):

//Give a random number of given mean and maximum deviation
//M - mean value
//D - maximum deviation
//Seed - (declared) random number seed identifier
#macro rand_ext(M,D,Seed)
        (M+(rand(Seed)-.5)*2*D)
#end

//Give a random vector of given mean and max deviation
//M - mean (vector/float)
//D - max deviation (vector/float)
//Seed - (declared) random number seed identifier
#macro v_rand_ext(M,D,Seed)
        #local MV=M+<0,0,0>;
        #local DV=D+<0,0,0>;
       
(<rand_ext(MV.x,DV.x,Seed),rand_ext(MV.y,DV.y,Seed),rand_ext(MV.z,DV.z,Seed)>)
#end


-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg
Home page http://www.hot.ee/margusrt


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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