POV-Ray : Newsgroups : povray.binaries.images : tiling pattern challenge Server Time
30 Jul 2024 16:25:50 EDT (-0400)
  tiling pattern challenge (Message 1 to 10 of 10)  
From: Jim Holsenback
Subject: tiling pattern challenge
Date: 4 Mar 2011 10:50:38
Message: <4d710a4e@news.povray.org>
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


Post a reply to this message


Attachments:
Download 'work.png' (114 KB)

Preview of image 'work.png'
work.png


 

From: Robert McGregor
Subject: Re: tiling pattern challenge
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

From: Le Forgeron
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 12:46:51
Message: <4d71258b$1@news.povray.org>
Le 04/03/2011 17:54, Robert McGregor nous fit lire :
> 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.

Does it have to be short or not ?
Attached is source from the current doc illustration.
Feel free about it.

>>
>> 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.

I'm afraid to be no better.

>>
>> #declare TilingPattern = 22;
>> #declare TileTypes = 3;

#declare Co1 = rgb <0.25,0.75,0.25> ;
#declare Co2 = rgb <0.75,0.75,0.25> ;
#declare Co3 = rgb <0.25,0.75,0.75> ;
#declare Co4 = rgb <0.25,0.25,0.75> ;
#declare Co5 = rgb <0.75,0.25,0.25> ;
#declare Co6 = rgb <0.75,0.25,0.75> ;

#declare ii=TilingPattern; // colour rotation
#declare num=TileTypes;


#declare Co=array[6]{Co1,Co2,Co3,Co4,Co5,Co6};


pigment_map {
#local i=0;
#while(i<num)
  [i/num Co[mod(i+ii,6)]]
  [(2*i+1)/(2*num)-0.1/num Co[mod(i+ii,6)]]
  [(2*i+1)/(2*num)-0.1/num rgb<1,1,1>-Co[mod(i+ii,6)]]
  [(2*i+1)/(2*num)+0.1/num rgb<1,1,1>-Co[mod(i+ii,6)]]
  [(2*i+1)/(2*num)+0.1/num Co[mod(i+ii,6)]]
	[(i+1)/num-0.1/num Co[mod(i+ii,6)]/2]
	[(i+1)/num-0.1/num Black]
	[(i+1)/num Black]
#local i=i+1;
#end
}


Post a reply to this message


Attachments:
Download 'tiling.pov.txt' (3 KB)

From: Jim Holsenback
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 13:17:21
Message: <4d712cb1$1@news.povray.org>
On 03/04/2011 12:54 PM, Robert McGregor wrote:
> 
> Jim, I haven't tried it on all the pattern types, but how about something like
> this:

Rob .. thanks for getting the ball rolling, I had a reply all crafted
then I noticed that Le_Forgeron (he added the feature) has posted a code
fragment that I think what I'm going to do is include that frag in a
pre-formatted text block rather than go the scene file route.

Again thanks everyone for pitching in to help make the docs better, I'll
try to get those changes posted soon so they make it into the release.

Jim


Post a reply to this message

From: Samuel Benge
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 15:00:00
Message: <web.4d7144417ce2fcf27f98f9e70@news.povray.org>
Jim Holsenback <jho### [at] povrayorg> wrote:
> 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.
....
> I'd like something that would allow just changing the Pattern/Type
> values and have the color_map automatically generated.

Hey Jim, here's my take on it.

It reproduces the example you posted, and is flexible enough for all tile types.
Some of the extra options might be removed to shorten the code...

// Code

#include "colors.inc"
#include "math.inc"

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

// for seeing how many colors we need
#declare ColorMap  = on;

// make final color black, probably not needed
#declare BlackAtTileType = true;

#declare ColorArray =
  array[10]{
    Red,        White,
    Green,      Yellow,
    Blue,       Cyan,
    IndianRed,  Pink,
    DarkGreen,  Turquoise
  }

plane{y,0
  texture{
    pigment{
      tiling TilingPattern
      #if(ColorMap)
        color_map{
          #declare V=0;
          #declare V2 = 0;
          #while(V<TileTypes*2)
            #if(mod(V,TileTypes*2) = TileTypes*2-1 & BlackAtTileType)
              #declare ThisColor = rgb<0,0,0>;
             #else
              #declare ThisColor =
                ColorArray[mod(V,dimension_size(ColorArray,1))];
            #end
            #declare incre = 0.75*even(V)+0.25*odd(V);
            [ V2/TileTypes ThisColor]
            [ (V2+incre)/TileTypes ThisColor]
            #declare V = V + 1;
            #declare V2 = V2 + incre;
          #end
        }
      #end
    }
  }
}

// ~Code

It's a little messy, but it works. I think I captured the spirit of what you
were looking for...

Sam


Post a reply to this message

From: stbenge
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 15:34:02
Message: <4d714cba@news.povray.org>
Hi again,

Here's some updated code.

The color_map viewing switch has been removed, since the image in the 
documentation tells everything we need to know. I also added the ability 
to specify the caulk color, how often it should be displayed, and what 
size to make it. In addition to these changes, there are two new entries 
in the color array, giving us a total of six color combos.

An extra array for referencing the pattern types /could/ be added to 
make the TileTypes variable obsolete, but it would lengthen the code.

// Code

#include "colors.inc"
#include "math.inc"

#declare TilingPattern = 5;
#declare TileTypes    = 3;

// 0 = caulk off
// 1 = caulk at every color
// TileTypes = caulk at n TileTypes
#declare CaulkAt    = 1;
#declare CaulkSize  = 0.2;
#declare CaulkColor = White;

#declare ColorArray =
   array[12]{
     Red,        White,
     Green,      Yellow,
     Blue,       Cyan,
     IndianRed,  Pink,
     DarkGreen,  Turquoise
     Violet,     BlueViolet
   }

plane{y,0
   texture{
     pigment{
       tiling TilingPattern
       color_map{
         #declare V=0;
         #declare V2 = 0;
         #while(V<TileTypes*2)
           #if(mod(V,CaulkAt*2) = CaulkAt*2-1 & CaulkAt!=0)
             #declare ThisColor = rgb<0,0,0>;
            #else
             #declare ThisColor =
               ColorArray[mod(V,dimension_size(ColorArray,1))];
           #end
           #declare incre = (1.0-CaulkSize)*even(V)+CaulkSize*odd(V);
           [ V2/TileTypes ThisColor]
           [ (V2+incre)/TileTypes ThisColor]
           #declare V = V + 1;
           #declare V2 = V2 + incre;
         #end
       }
     }
   }
}

// ~Code

Sam


Post a reply to this message

From: stbenge
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 15:38:35
Message: <4d714dcb@news.povray.org>
It looks like you've already got your winning entry, but it was a fun 
exercise anyway :)

Sam


Post a reply to this message

From: Jim Holsenback
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 15:54:15
Message: <4d715177$1@news.povray.org>
On 03/04/2011 04:38 PM, stbenge wrote:
> It looks like you've already got your winning entry, but it was a fun
> exercise anyway :)
> 
> Sam
> 
ha-ha .. you gotta be pretty darn quick around here ... eh? When I
issued the challenge I do believe I heard the faint clicking of
keyboards in the distance. I'll explore your contribution ... maybe
there's a scene file in this after all

Cheers


Post a reply to this message

From: stbenge
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 16:03:14
Message: <4d715392@news.povray.org>
On 3/4/2011 12:33 PM, stbenge wrote:
> An extra array for referencing the pattern types /could/ be added to
> make the TileTypes variable obsolete, but it would lengthen the code.

This snippit probably won't make it in, but it might make your scene 
file easier to use. Here's what it would look like:

// Code

#declare TilingPattern = 17;

#declare TileReference =
   array[24]{
    1, 1, 2,
    1, 3, 2,
    2, 3, 3,
    1, 3, 3,
    3, 5, 2,
    3, 6, 2,
    3, 3, 6,
    3, 3, 5
   }

// automatically get the value for TileTypes
#declare TileTypes = TileReference[TilingPattern-1];

// ~Code

It's not compatible with my other code, but it could be with a couple of 
small alterations...

Also, you might want to clip TilingPattern:

#declare TilingPattern = clip(TilingPattern,1,24);

Sam


Post a reply to this message

From: stbenge
Subject: Re: tiling pattern challenge
Date: 4 Mar 2011 16:14:52
Message: <4d71564c@news.povray.org>
On 3/4/2011 12:54 PM, Jim Holsenback wrote:
> On 03/04/2011 04:38 PM, stbenge wrote:
>> It looks like you've already got your winning entry, but it was a fun
>> exercise anyway :)
>>
> ha-ha .. you gotta be pretty darn quick around here ... eh? When I
> issued the challenge I do believe I heard the faint clicking of
> keyboards in the distance.

Not my keyboard... I didn't even see this thread until it was already 
too late. And even then, I didn't read the replies until I was finishing 
up my code... Oh well :/

> I'll explore your contribution ... maybe
> there's a scene file in this after all
>
> Cheers

Perhaps. At any rate, I needed the practice!

Sam


Post a reply to this message

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