POV-Ray : Newsgroups : povray.general : Random solid colors for the hexagon block pigment pattern Server Time
29 Nov 2024 11:38:33 EST (-0500)
  Random solid colors for the hexagon block pigment pattern (Message 1 to 6 of 6)  
From: Smws
Subject: Random solid colors for the hexagon block pigment pattern
Date: 7 Nov 2005 17:25:00
Message: <web.436fd3c2e2eb0cf59e8613510@news.povray.org>
Hey, I've been wrangling with this for a few hours:

I'm trying to use the hexagon pigment pattern (as one of several function
for creating a height field) and instead of a repeating pattern of 3 colors
I'd like to have each hexagon given a random solid color. Is this possible?

Thanks so much,
Stefan Sittler


Post a reply to this message

From: John VanSickle
Subject: Re: Random solid colors for the hexagon block pigment pattern
Date: 7 Nov 2005 18:59:04
Message: <436fea48$1@news.povray.org>
Smws wrote:

> Hey, I've been wrangling with this for a few hours:
> 
> I'm trying to use the hexagon pigment pattern (as one of several function
> for creating a height field) and instead of a repeating pattern of 3 colors
> I'd like to have each hexagon given a random solid color. Is this possible?

Yes.  Here's an entire POV file to demonstrate:

// start of POV-Ray file

#declare pigA=pigment { cells
   warp { repeat z offset <-.5,10,0>}
   translate z/2
   scale <3,1,sqrt(6.75)>
}

#declare pigB=pigment { cells
   warp { repeat z offset <-.5,10,0>}
   translate <1.5,7,0>
   scale <3,1,sqrt(6.75)>
}
#declare pigC=pigment { cells
   warp { repeat z offset <-.5,10,0>}
   translate <0,-7,0>
   scale <3,1,sqrt(6.75)>
}

plane { y,0
   pigment { hexagon pigment {pigA} ,pigment { pigB} , pigment {pigC} }
}

light_source { 1e4 1 }

camera { location 10 look_at 0 }

// end of POV-Ray file

Regards,
John


Post a reply to this message

From: Smws
Subject: Re: Random solid colors for the hexagon block pigment pattern
Date: 8 Nov 2005 16:30:00
Message: <web.4371186bab22bf96facdf0790@news.povray.org>
Thank you very much!


Post a reply to this message

From: Dave Matthews
Subject: Re: Random solid colors for the hexagon block pigment pattern
Date: 17 Nov 2005 15:05:01
Message: <web.437ce1dfab22bf968c7259570@news.povray.org>
John VanSickle <evi### [at] hotmailcom> wrote:
> Yes.  Here's an entire POV file to demonstrate:
>
> Regards,
> John

OK, I see THAT it works (and by adding color_maps you can get all kinds of
cool stuff); I'm still trying to puzzle out WHY it works.

Anyway, yet another useful trick from the files of Mr. VanSickle.

Dave Matthews


Post a reply to this message

From: Jim Charter
Subject: Re: Random solid colors for the hexagon block pigment pattern
Date: 17 Nov 2005 16:15:40
Message: <437cf2fc$1@news.povray.org>
Dave Matthews wrote:
> John VanSickle <evi### [at] hotmailcom> wrote:
> 
>>Yes.  Here's an entire POV file to demonstrate:
>>
>>Regards,
>>John
> 
> 
> OK, I see THAT it works (and by adding color_maps you can get all kinds of
> cool stuff); I'm still trying to puzzle out WHY it works.
> 
>
Well you get that the cells pattern gives you random stepped colors 
based on the map you feed it, right?  So it is an easy way to have a) 
random values, b) stepped values, meaning a cell is all one color c) a 
regular grid pattern.  (As someone else pointed out, you can get b), the 
stepped effect, from other patterns too by manipulating the color_map)

John is nesting the cells pattern, as it were, within the hexagon 
pattern.  It's like the hexagon pattern is a sort of mask with the cells 
pattern forming the color behind. I posted a similar thing here to get 
random brick textures. His method for scaling and warping the cells 
pattern to the hexagon pattern is typically ingenious however, and 
opaque to me, naturally.


Post a reply to this message

From: Dave Matthews
Subject: Re: Random solid colors for the hexagon block pigment pattern
Date: 17 Nov 2005 17:10:01
Message: <web.437cfe6bab22bf968c7259570@news.povray.org>
Jim Charter <jrc### [at] msncom> wrote:
> Well you get that the cells pattern gives you random stepped colors
> based on the map you feed it, right?

Actually, (embarassingly) no, that's what I didn't get.  I should have
looked over the "cells" documentation again.  And the rest of your
explanation, although I had figured it out, is much clearer than the way I
was previously thinking about it.

Thanks!

Dave Matthews


Post a reply to this message

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