POV-Ray : Newsgroups : povray.newusers : random rotated pattern : Re: random rotated pattern Server Time
29 Jul 2024 08:13:54 EDT (-0400)
  Re: random rotated pattern  
From: Mike Williams
Date: 1 Apr 2006 08:01:03
Message: <nAJqPLA2knLEFwG4@econym.demon.co.uk>
Wasn't it eilart who wrote:
>Hi, i'm wondering if ther's a way to render a brick pattern in which
>every brick have a random rotated pattern.

It turns out I was wrong. It is possible to write a texture rotation
function pattern. Here's one that rotates a one-dimensional gradient
function.

G: is the gradient function
F: is the function that chooses a random value for each cell
H: applies F as a rotation to G.x

If you want to rotate a two dimensional texture, then you have to change
H to apply rotations to G.x and G.y


#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <5,0,-10> look_at <0,0,0> angle 50}
light_source {<-30, 100, -30> color rgb 1}

#declare F = function {pattern {cells
  warp {repeat y offset 1000.5*x}
  scale <1,0.5,1>
}}
  
#declare G = function {x*6}

#declare H = function {G(x*sin(F(x,y,z)*2*pi)+y*cos(F(x,y,z)*2*pi),0,0)}

plane {z,0
  texture {
    pigment { function {  H(x,y,0)  }
      colour_map {[0.5 rgb 0.5][0.5 rgb 0.6]}
    }
  }
  texture {
    pigment {brick rgb 1 rgbt 1
      brick_size <1,0.5,0.5>
      mortar 0.02
    }
  }
}  


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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