POV-Ray : Newsgroups : povray.binaries.images : tiling pattern challenge : Re: tiling pattern challenge Server Time
30 Jul 2024 18:16:54 EDT (-0400)
  Re: tiling pattern challenge  
From: Robert McGregor
Date: 4 Mar 2011 11:55:01
Message: <web.4d7119307ce2fcf286ff1d480@news.povray.org>
Jim Holsenback <jho### [at] povrayorg> wrote:
> OK ... I've finally got some sunshine so I'm going to go soak up some
> rays, but as Stephen pointed out the tiling doc section could use some help.
>
> Here's the deal I'll work on the narrative but I'd like some one to come
> up with a scene file that would make experimentation a bit more user
> friendly.
>
> From the current doc passage I came up with this crude example (applied
> to a ground plane) using obvious colors to better illustrate what's
> going on.
>
> #declare TilingPattern = 22;
> #declare TileTypes = 3;
>
> texture {
>   pigment {
>   tiling TilingPattern
>   color_map {
>     [0/TileTypes Red]
>     [0.75/TileTypes Red]
>     [0.75/TileTypes White]
>     [1/TileTypes White]
>     [1/TileTypes Green]
>     [1.75/TileTypes Green]
>     [1.75/TileTypes Yellow]
>     [2/TileTypes Yellow]
>     [2/TileTypes Blue]
>     [2.75/TileTypes Blue]
>     [2.75/TileTypes Black]
>     [3/TileTypes Black]
>     }
>   }
> }
>
> I'd like something that would allow just changing the Pattern/Type
> values and have the color_map automatically generated.
>
> Any ideas? If someone would like to take this on speak up so we don't
> end up stepping on each other toes.
>
> Oh yeah, whoever steps up to do this I'd need your permission (as per
> new license) to include your work in the distribution.
>
> Jim

Jim, I haven't tried it on all the pattern types, but how about something like
this:

#declare TilingPattern = 22;
#declare TileTypes = 3;
#declare Grout = 0.85;

plane { y, -3
   texture {
      pigment {
         tiling TilingPattern

         #local clr  =
            array[TileTypes*2] {Red, White, Green, Yellow, Blue, Black}
         #local nClr = -1;
         #local n    = 0;

         color_map {
            #while (n < TileTypes)
               #local nClr = nClr + 1;
               [n/TileTypes clr[nClr]]
               [(n+Grout)/TileTypes clr[nClr]]

               #local nClr = nClr + 1;
               [(n+Grout)/TileTypes clr[nClr]]

               #local n = n + 1;
               [n/TileTypes clr[nClr]]
            #end
         }
      }
   }
}

Cheers,
Rob

-------------------------------------------------
www.McGregorFineArt.com


Post a reply to this message

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