POV-Ray : Newsgroups : povray.advanced-users : hexagon pattern + pigment pattern Server Time: 10 Dec 2018 06:20:40 GMT
  hexagon pattern + pigment pattern (Message 1 to 9 of 9)  
From: Bald Eagle
Subject: hexagon pattern + pigment pattern
Date: 28 Oct 2017 01:05:00
Message: <web.59f3d757c07af5475cafe28e0@news.povray.org>
I was trying to create a cylindrical pigment pattern with a color map, and use
that inside of a hexagon pigment pattern.

Does the center of the cylindrical pattern not start at the center of each
hexagon?
This seems like odd and unexpected behaviour to me.

But it's late and it was a long day, so maybe I'm botching something that's
otherwise simple.



#version 3.71;

global_settings {
 assumed_gamma 1.0
}

#declare Aspect = image_width/image_height;
camera {
 location <0, 5, -5>
 right x*Aspect
 look_at <0, 0, 0>
}

#include "colors.inc"

light_source {<0, 50, 0> 1}

#declare Hole =
pigment {
  cylindrical
  color_map {
               [0.0 White]
               [0.5 White]
               [0.5 Black]
               [1.0 Black]
  }
}

plane {y, 0
 pigment {
  hexagon
  pigment {Hole},
  pigment {Hole},
  pigment {Hole}
 }
}


Post a reply to this message

From: Alain
Subject: Re: hexagon pattern + pigment pattern
Date: 28 Oct 2017 01:24:28
Message: <59f3dc4c$1@news.povray.org>
Le 17-10-27 à 21:03, Bald Eagle a écrit :
> I was trying to create a cylindrical pigment pattern with a color map, and use
> that inside of a hexagon pigment pattern.
> 
> Does the center of the cylindrical pattern not start at the center of each
> hexagon?
> This seems like odd and unexpected behaviour to me.
> 
> But it's late and it was a long day, so maybe I'm botching something that's
> otherwise simple.
> 
> 
> 
> #version 3.71;
> 
> global_settings {
>   assumed_gamma 1.0
> }
> 
> #declare Aspect = image_width/image_height;
> camera {
>   location <0, 5, -5>
>   right x*Aspect
>   look_at <0, 0, 0>
> }
> 
> #include "colors.inc"
> 
> light_source {<0, 50, 0> 1}
> 
> #declare Hole =
> pigment {
>    cylindrical
>    color_map {
>                 [0.0 White]
>                 [0.5 White]
>                 [0.5 Black]
>                 [1.0 Black]
>    }
> }
> 
> plane {y, 0
>   pigment {
>    hexagon
>    pigment {Hole},
>    pigment {Hole},
>    pigment {Hole}
>   }
> }
> 
> 
> 
> 

That pattern is centered arount the Y axis. So, if you want it somewhere 
else, you need to translate it accordingly.
In your case, some judicious and creative use of warp repeat, with some 
offset, may be more indicated.


Post a reply to this message

From: Bald Eagle
Subject: Re: hexagon pattern + pigment pattern
Date: 28 Oct 2017 02:20:01
Message: <web.59f3e84de7a40c9f5cafe28e0@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> That pattern is centered arount the Y axis. So, if you want it somewhere
> else, you need to translate it accordingly.
> In your case, some judicious and creative use of warp repeat, with some
> offset, may be more indicated.

Right, however, I naively thought that each hexagon would have it's own center,
and the original pigment's origin would be at that center.

I did try to use a warp to see if the what you said was true, and I did see
other holes, just not where I needed them.

Sam Benge apparently created some macros in 2008 (p.b.s-f) to deal with this,
but I'll have to decipher how to use them.

Chris Huff has some info that I might use to puzzle it out somehow:
">3C40b55d56@news.povray.org%3E/?ttop=373461&toff=2850" target="_new">http://news.povray.org/povray.general/thread/%3C40b55d56@news.povray.org%3E/?ttop=373461&toff=2850

I think I might have to write a function pigment with mod() to pattern the
plane.
I feel that all of that shouldn't be necessary...

feature request:  Hex2 pattern which places the pigment's origin at the center
of the hexagons, or automagically creates a new tiled pigment....  :)


Post a reply to this message

From: Bald Eagle
Subject: Re: hexagon pattern + pigment pattern
Date: 28 Oct 2017 04:30:01
Message: <web.59f406cde7a40c9f5cafe28e0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> I think I might have to write a function pigment with mod() to pattern the
> plane.

All ye here, witness thee the math[s] suckification:

(at least the pattern sorta matches up with the spheres...)

#version 3.71;

global_settings {
 assumed_gamma 1.0
}

#declare Aspect = image_width/image_height;
camera {
 location <0, 15, -0.001>
 right x*Aspect
 look_at <0, 0, 0>
}

#include "colors.inc"
#include "stbHexPatterns.inc"

light_source {<0, 50, 0> 1}

#declare Hole =
pigment {
  cylindrical   // cylinder shaped gradient along the Y-axis
  color_map {
               [0.0 White]
               [0.5 White]
               [0.5 Black]
               [1.0 Black]
  }
}

#declare Hex = 2*sin (pi/3);
// 0.03655205525709550570167739213998

//#declare HexGrid = function { abs(x + mod(x, 2)*1.5) + abs(z + mod(z,
sin(pi/3))) + sqrt(pow(x,2)+pow(z,2)) + 0*y}
//#declare HexGrid = function { x + mod(x, 2)*1.5 + z + mod(z, sin(pi/3)) +
sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z + mod(z, sin(pi/3)),2)) + 0*y}
//#declare HexGrid = function { (x + mod(x/2, 2)*1.5) + (z + mod(z, sin(pi/3)))
+ sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z + mod(z, sin(pi/3)),2)) + 0*y}
//#declare HexGrid = function { (x + mod(sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z +
mod(z, sin(pi/3)),2)), 2)*1.5) + (z + mod(sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z +
mod(z, sin(pi/3)),2)), sin(pi/3))) + 0*y}

//#declare HexGrid = function {select ( sin(z*Hex/3),
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)+pow(mod(abs(z),2),2)-1),
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)-0.5+pow(mod(abs(z),2),2))-0.5,
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)+pow(mod(abs(z),2),2)-Hex) )}

//#declare HexGrid = function {select ( sin(z*Hex),
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)+pow(mod(abs(z),2),2)-1), 0, 1 )}

#declare XStep = 3;
#declare ZZ1 = function {x+sin(z*Hex/2)}
#declare ZZ = function {x+sin(z*2*Hex)}
//#declare Cyl = function {sqrt (pow(x,2)+pow(z,2))*2}
#declare Cyl = function {sqrt (pow(ZZ1(x, y, z),2)+pow(z,2))/3}
//#declare HexGrid = function {Cyl (mod(abs(x),XStep)-XStep/2, y,
mod(abs(z),Hex/2)-Hex/4)}

#declare HexGrid = function {Cyl (mod(abs(ZZ(x, y, z)),XStep)-XStep/2, y,
mod(abs(z),Hex/2)-Hex/4)}
//#declare HexGrid = function {Cyl (mod(abs(x),XStep)-XStep/2, y,
mod(abs(z),Hex/2)-Hex/4)}
sphere {0, 1/5 pigment {Green}}
plane {y, 0
 pigment {
   //function {HexGrid (x, y, z)} translate x*1.5 translate z*Hex/4
   function {HexGrid (x, y, z)} translate x*0.75 translate z*Hex/4
   //pigment {Hole},
   //pigment {Hole translate<0, 0,   Hex>},
   //pigment {Hole translate<0, 0, 2*Hex>}
  }
 }

union {
    #local R = 1;
    #local XN = 10;
    #local YN = 20;
    #local J = -YN;
    #while(J < YN)
        #local K = -XN;
        #while(K < XN)
            sphere {< K*3*R + mod(J, 2)*1.5*R, 0, sin(pi/3)*R*J>, R/10}
//          sphere {< K*3*R + 1.5*J*R, sin(pi/3)*R*J, 0>, R}
            #local K = K + 1;
        #end
        #local J = J + 1;
    #end
    texture {
        pigment {Red}
    }
}


Maybe this needs to be done similar to the way isosurfaces are blobbed
together....


Post a reply to this message

From: Thomas de Groot
Subject: Re: hexagon pattern + pigment pattern
Date: 28 Oct 2017 07:04:14
Message: <59f42bee$1@news.povray.org>
On 28-10-2017 6:25, Bald Eagle wrote:
> #include "stbHexPatterns.inc"

... and what is that?

-- 
Thomas


Post a reply to this message

From: clipka
Subject: Re: hexagon pattern + pigment pattern
Date: 28 Oct 2017 10:53:30
Message: <59f461aa$1@news.povray.org>
Am 28.10.2017 um 03:03 schrieb Bald Eagle:
> I was trying to create a cylindrical pigment pattern with a color map, and use
> that inside of a hexagon pigment pattern.
> 
> Does the center of the cylindrical pattern not start at the center of each
> hexagon?
> This seems like odd and unexpected behaviour to me.

It's not odd at all, if you think of the outside pattern providing
"windows" to the nested pattern.

If for example the nested pattern was supposed to represent marble, you
would probably /not/ want that pattern to repeat.

To repeat portions of a particular pattern, you'll need to use a "warp".
However, there's currently no warp that takes hexagonal chunks and
repeats them.

What you could do, however, is take a hexagonal pattern with three
different cylindrical patterns, then take a rectangular chunk of that
pattern and repeat it using two repeat warps.


Or you could use just a single function pattern. Employ `mod` to make
the pattern repeat. `select` may also help. (IKEA solution - some
assembly required.)


Post a reply to this message

From: clipka
Subject: Re: hexagon pattern + pigment pattern
Date: 28 Oct 2017 11:00:29
Message: <59f4634d@news.povray.org>
Am 28.10.2017 um 04:15 schrieb Bald Eagle:

> feature request:  Hex2 pattern which places the pigment's origin at the center
> of the hexagons, or automagically creates a new tiled pigment....  :)

Denied. None of the current patterns work that way, so it would be a
source of surprise and confusion.

Alternative suggestion: A hexagonal-repeat warp.

Or a generic pattern modifier that turns on auto-warp in hex and similar
patterns (e.g. checker, brick, and what-have-you-not).


Post a reply to this message

From: Bald Eagle
Subject: Re: hexagon pattern + pigment pattern
Date: 28 Oct 2017 13:40:00
Message: <web.59f487f1e7a40c9f5cafe28e0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> On 28-10-2017 6:25, Bald Eagle wrote:
> > #include "stbHexPatterns.inc"
>
> ... and what is that?
>
> --
> Thomas

http://news.povray.org/povray.binaries.scene-files/thread/%3C482478cb%40news.povray.org%3E/?ttop=418422&toff=250


Post a reply to this message

From: Thomas de Groot
Subject: Re: hexagon pattern + pigment pattern
Date: 29 Oct 2017 07:36:24
Message: <59f584f8$1@news.povray.org>
On 28-10-2017 15:36, Bald Eagle wrote:
> Thomas de Groot <tho### [at] degrootorg> wrote:
>> On 28-10-2017 6:25, Bald Eagle wrote:
>>> #include "stbHexPatterns.inc"
>>
>> ... and what is that?
>>
>> --
>> Thomas
> 
>
http://news.povray.org/povray.binaries.scene-files/thread/%3C482478cb%40news.povray.org%3E/?ttop=418422&toff=250
> 
> 

Shame on me! I should have known! ;-)

-- 
Thomas


Post a reply to this message

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