|
|
I wanted some random meaningless alien letters for a space scene I've been
working on, so I decided to make a pigment filled with random alien
gibberish!
The letters are built out of segments, like the numbers on a calculator, but
the segments can overlap. I use object pigments with a repeat warp and a
cells pattern to randomly light up every possible combination of segments,
in an infinitely large pigment.
Here's the code:
//--start
// Alienese - by Tek
#include "transforms.inc"
#declare AlienLetters = array[6];
// build it in boxes of 11x11, from 0,0 to 11,11 with 0-1 and 10-11 as space
between letters
#declare AlienLetters[0] =
union { box { <1,1>, <2,6,1> } box { 0, <1,4,1> Shear_Trans(x-y,y+x,z)
translate <1,6> } box { <5,9>, <6,10,1> } scale <1,1,11>/11 };
#declare AlienLetters[1] =
union { box { <9,1>, <10,6,1> } box { -x, <0,4,1> Shear_Trans(x+y,y-x,z)
translate <10,6> } box { <5,9>, <6,10,1> } scale <1,1,11>/11 };
#declare AlienLetters[2] = box { 0,1 Shear_Trans(x-y,y+x,z) translate
<4.5,5.5> scale <1,1,11>/11 };
#declare AlienLetters[3] =
union { box { <1,1>, <6,2,1> } box { 0, <1,4,1> Shear_Trans(x-y,y+x,z)
translate <5,2> } box { <9,5>, <10,6,1> } scale <1,1,11>/11 };
#declare AlienLetters[4] =
union { box { <9,5>, <10,6,1> } box { -x, <0,4,1> Shear_Trans(x+y,y-x,z)
translate <10,6> } box { <5,9>, <6,10,1> } scale <1,1,11>/11 };
#declare AlienLetters[5] =
box { 0, <1,8,1> Shear_Trans(x-y,y+x,z) translate <1,2> scale
<1,1,11>/11 };
#declare Alienese =
pigment {
// combine an on/off pattern for each of the cells making the characters
// optimal version would test empty space first, then combinations of
cells, then individual ones, but lazy approach is just test all using
average and saturate that
pigment_pattern {
pigment_pattern {
average
pigment_map {
// toggle each one randomly, by using 2x frequency with each letter
part, so every combination appears in the colour map.
// could instead get a nice effect by having a list of every valid
combo and doing one big colour map on cells for that.
#local i=0; #while ( i < dimension_size(AlienLetters,1) )
[1 cells frequency pow(2,i) pigment_map { [.5 rgb 0][.5 object {
AlienLetters[i] rgb 0, rgb 1 } warp { repeat x } warp { repeat y } warp {
repeat z } ] } ]
#local i=i+1; #end
}
}
colour_map {
[.5/dimension_size(AlienLetters,1) rgb 0]
[.5/dimension_size(AlienLetters,1) rgb 1]
}
}
}
//--end
Enjoy!
--
Tek
http://evilsuperbrain.com
Post a reply to this message
Attachments:
Download 'alienese.jpg' (134 KB)
Preview of image 'alienese.jpg'
|
|