POV-Ray : Newsgroups : povray.newusers : random rotated pattern : Re: random rotated pattern Server Time
29 Jul 2024 08:17:59 EDT (-0400)
  Re: random rotated pattern  
From: Mike Williams
Date: 1 Apr 2006 07:54:25
Message: <fQKk7HA7fnLEFwg4@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.

I don't think you can rotate a pattern randomly for different parts of a
texture. The problem is that rotations are handled at parse time rather
than at render time, so you can't use things like functions on them.

Here's a simple brick wall with random colours on the bricks. [To see
how it works, change the "offset" to "0.5*x". The "1000.5*x" causes the
bricks of the same colour to be shifted sideways by 1000 extra steps, so
you don't see the pattern repeat.]

#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}

plane {z,0
  // random colours
  texture {
    pigment {cells
      warp {repeat y offset 1000.5*x}
      colour_map {[0 rgb <1,0.7,0.4>][1 rgb <0.8,0.3,0>]}
      scale <1,0.5,1>
    }
  }
  // mortar applied as a texture layer
  texture {
    pigment {brick rgb 1 rgbt 1
      brick_size <1,0.5,0.5>
      mortar 0.02
    }
  }
}  


It's possible to pull out the pattern as a function

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

and then use that to control a pigment or a texture_map

pigment {function{F(x,y,z)}

but you can't use it to control a rotation_map because there's no such
thing.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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