![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
clipka wrote:
> I mainly did it because the C(/++) program I had written earlier only
> produced ASCII art output, and it did quite well for starters, but I got
> tired of its limitations, and was too lazy to integrate support for
> proper image reading and writing ;-)
>
> And, of course, misusing POV-Ray in this manner was an interesting
> challenge to do ;-)
I'm all for misusing programs and languages in this way. Heck, I'd go as
far as to say that the more unique ways you can find to accomplish a
singular goal, the better! "Unique ways" being the key of course ;)
> Next on the agenda: Game of life. Should be a piece of cake if done
> properly: Read in last frame, apply a color map according to birth/death
> rules overlay with 8 tuned-down displaced copies to add birth/death
> hints for the next step - render.
Ah, with the #if statement right near the apex of that calculation?
And with an average pattern instead of a function? Any way, I'd like to
see it :)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
stbenge schrieb:
> I'm all for misusing programs and languages in this way. Heck, I'd go as
> far as to say that the more unique ways you can find to accomplish a
> singular goal, the better! "Unique ways" being the key of course ;)
Yeah, I'm in for such stuff, too.
>> Next on the agenda: Game of life. Should be a piece of cake if done
>> properly: Read in last frame, apply a color map according to
>> birth/death rules overlay with 8 tuned-down displaced copies to add
>> birth/death
>> hints for the next step - render.
>
> Ah, with the #if statement right near the apex of that calculation? And
> with an average pattern instead of a function? Any way, I'd like to see
> it :)
What #if statement? The code won't need any #if :-) (the color map will
serve as a kind of #switch statement).
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
clipka wrote:
> stbenge schrieb:
>> Ah, with the #if statement right near the apex of that calculation?
>> And with an average pattern instead of a function? Any way, I'd like
>> to see it :)
>
> What #if statement? The code won't need any #if :-) (the color map will
> serve as a kind of #switch statement).
Oh, I guess I was surmising based on your previous statements...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> Good job! I think I'll stick to C programming for this effect though.
>> It's easy enough to produce a barrier and generator mask using POV, and
>> then take it into C to run the sim :/
>
> I mainly did it because the C(/++) program I had written earlier only
> produced ASCII art output, and it did quite well for starters, but I got
> tired of its limitations, and was too lazy to integrate support for proper
> image reading and writing ;-)
>
> And, of course, misusing POV-Ray in this manner was an interesting
> challenge to do ;-)
>
> Next on the agenda: Game of life. Should be a piece of cake if done
> properly: Read in last frame, apply a color map according to birth/death
> rules, overlay with 8 tuned-down displaced copies to add birth/death hints
> for the next step - render.
What you are doing here is actually very similar to how you write such
things for the GPU. I wrote a wave simulator for the GPU a while back and
it works almost identically, never thought of the GoL on a GPU, should be
easy to implement.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
clipka wrote:
> ...., and was too lazy to integrate support for
> proper image reading and writing ;-)
I'm sure you already know this but ascii PPM images are the way forward
here - a nice easy human readable/writable HDRI image format.
Obviously I admire your abuse of PovRay.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
scott schrieb:
> never thought of the GoL on a GPU, should be easy to implement.
I bet. If it can be done in POV-Ray with textures only...
Here's the full POV-Ray SDL code for a GoL sim starting with a random
pattern - the only non-linearity in control flow is the #if to care for
first-frame initialization.
The world is toroidal, though this can be chaned by enabling the "once"
keyword in the definition of PgNext.
As an interesting side note, the sim does /not/ store the end result of
each generation, but interim results: The status of the cell itself,
combined with a count of the surrounding live cells. This allows easy
use of a color_map for the conditionals.
(The code could be made shorter by using macros, but I reckon this would
be counter-productive for parsing speed.)
--------------------------------------
// +W100 +H100 +KFI1 +KFF9999 +FE
#version 3.6;
global_settings {
assumed_gamma 1.0
ambient_light 1.0
max_trace_level 15
}
camera {
orthographic
location <0,0,100>
look_at <0,0,0>
right -1*x
up 1*y
}
default {
finish { ambient 1.0 diffuse 0.0 }
}
// ----------------------------------------
#local FrameDigits = int(log(final_frame)) + 1;
#local NumLayers = 9;
#local Delta = 1/max(image_width,image_height);
#local NeighborFactor = 0.05;
#local CellFactor = 0.50;
#local EPSILON = 1e-6;
#if (frame_number = 1)
#local PgNext = pigment { bozo color_map { [ 0.499 rgb 0 ] [ 0.501
rgb 1 ] } scale Delta }
#else
#local PgNext = pigment {
image_pattern { concat("Life", str(frame_number-1,-FrameDigits,0))
/*once*/ }
color_map {
// dead cell
[ 0*CellFactor + 2.5*NeighborFactor -EPSILON rgb 0 ]
[ 0*CellFactor + 2.5*NeighborFactor +EPSILON rgb 1 ]
[ 0*CellFactor + 3.5*NeighborFactor -EPSILON rgb 1 ]
[ 0*CellFactor + 3.5*NeighborFactor +EPSILON rgb 0 ]
// live cell
[ 1*CellFactor + 1.5*NeighborFactor -EPSILON rgb 0 ]
[ 1*CellFactor + 1.5*NeighborFactor +EPSILON rgb 1 ]
[ 1*CellFactor + 3.5*NeighborFactor -EPSILON rgb 1 ]
[ 1*CellFactor + 3.5*NeighborFactor +EPSILON rgb 0 ]
}
translate -<0.5,0.5,0>
}
#end
#local Tx1 = texture { pigment { PgNext translate <-1,-1, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local Tx2 = texture { pigment { PgNext translate <-1, 0, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local Tx3 = texture { pigment { PgNext translate <-1, 1, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local Tx4 = texture { pigment { PgNext translate < 0,-1, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local Tx5 = texture { pigment { PgNext translate < 0, 0, 0>*Delta }
finish { ambient NumLayers * CellFactor } }
#local Tx6 = texture { pigment { PgNext translate < 0, 1, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local Tx7 = texture { pigment { PgNext translate < 1,-1, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local Tx8 = texture { pigment { PgNext translate < 1, 0, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local Tx9 = texture { pigment { PgNext translate < 1, 1, 0>*Delta }
finish { ambient NumLayers * NeighborFactor } }
#local TxOutput = texture {
average
texture_map {
[1 Tx1 ]
[1 Tx2 ]
[1 Tx3 ]
[1 Tx4 ]
[1 Tx5 ]
[1 Tx6 ]
[1 Tx7 ]
[1 Tx8 ]
[1 Tx9 ]
}
}
box { <-1.5, -0.5, 0.0>, <1.5, 0.5, 0.0> texture { TxOutput } }
--------------------------------------
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |