POV-Ray : Newsgroups : povray.general : Tilable textures : Re: Tilable textures Server Time
30 Jul 2024 06:20:05 EDT (-0400)
  Re: Tilable textures  
From: stbenge
Date: 15 Aug 2009 04:17:48
Message: <4a866f2c@news.povray.org>
SharkD wrote:
> I may have asked this before, but what are some good ways to create 2D 
> textures that tile? 

In 2D space you can use diamond tiling:

#declare repeatable_pattern=
pigment{
  cylindrical rotate x*90 scale 1.00
  pigment_map{
   [0 rgb 0]
   [1 crackle scale .5]
  }
}

plane{z,0
  pigment{
   average
   pigment_map{
    [1 repeatable_pattern translate -x]
    [1 repeatable_pattern translate x]
    [1 repeatable_pattern translate -y]
    [1 repeatable_pattern translate y]
   }
   translate(x+y)
   warp{repeat x*2}
   warp{repeat y*2}
  }
}

or square tiling:

#declare repeatable_pattern=
pigment{
  cylindrical rotate x*90 scale 1.50
  pigment_map{
   [0 rgb 0]
   [1 crackle scale .5]
  }
}

plane{z,0
  pigment{
   average
   pigment_map{
    [1 repeatable_pattern translate<-1,-1,0>]
    [1 repeatable_pattern translate<1,-1,0>]
    [1 repeatable_pattern translate<-1,1,0>]
    [1 repeatable_pattern translate<1,1,0>]
   }
   translate(x+y)
   warp{repeat x*2}
   warp{repeat y*2}
  }
}

where "repeatable_pattern" is a pigment you wish to use in excess.

> Secondly (and this is the more advanced part), how might I turn tiling 
> on and off for a particular direction? 

I think perhaps you'll be keeping track of where the break in repetition 
occurs, so for a tile which repeats using diamond tiling, with a break 
in repetition to the right:

  pigment{
   average
   pigment_map{
    [1 repeatable_pattern translate -x]
    [1 non_repeatable_pattern translate x]
    [1 repeatable_pattern translate -y]
    [1 repeatable_pattern translate y]
   }
   translate(x+y)
   warp{repeat x*2}
   warp{repeat y*2}
  }

might suffice.

I hope this helps somewhat.

Sam


Post a reply to this message

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