POV-Ray : Newsgroups : povray.general : Tilable textures : Re: Tilable textures Server Time
30 Jul 2024 06:21:06 EDT (-0400)
  Re: Tilable textures  
From: Warp
Date: 15 Aug 2009 04:36:54
Message: <4a8673a6@news.povray.org>
SharkD <mik### [at] gmailcom> wrote:
> I may have asked this before, but what are some good ways to create 2D 
> textures that tile?

//==================================================================
#declare PatternFunc =
  function { pattern { wood turbulence .5 scale .5 } };

#declare PatternFuncTiledX =
  function
  { pattern
    { function
      { (1-x)*PatternFunc(x, y, z) +
        x*PatternFunc(x-1, y, z)
      }
      warp { repeat x }
    }
  };

#declare PatternFuncTiledY =
  function
  { pattern
    { function
      { (1-y)*PatternFunc(x, y, z) +
        y*PatternFunc(x, y-1, z)
      }
      warp { repeat y }
    }
  };

#declare PatternFuncTiledXY =
  function
  { pattern
    { function
      { (1-y)*PatternFuncTiledX(x, y, z) +
        y*PatternFuncTiledX(x, y-1, z)
      }
      warp { repeat y }
    }
  };

camera { location -z*3 look_at 0 }
plane
{ -z, 0
  pigment
  { function { PatternFuncTiledXY(x, y, z) }
    color_map { [0 rgb 0] [1 rgb 1] }
  }
  finish { ambient 1 }
}
//==================================================================

-- 
                                                          - Warp


Post a reply to this message

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