3D‎ > ‎

Structure Synth


Simple Fractal in Structure Synth

Structure Synth script for some simple fractal . Images are rendered in SunFlow .





Smiley face

Pythagoras Tree

 // Pythagoras Tree                                                        
#define displace 0.5
set maxdepth 12
set background white

R1

rule R1 maxdepth 11 { { y 1 x displace rz -45 s 0.707 h 40 } R1
{ y 1 x -displace rz 45 s 0.707 h 40 } R1
box }


Smiley face

H Fractal

//H Fractal
#define displace 0.25
1 * {z -0.1 s 50 50 0.1 color #bbb}box
set maxdepth 12
set background white

2 * {y -0.75 rz 180}R1

rule R1 maxdepth 7 { { y 0.5 x displace rz -90 s 0.707 h 40 }R1
{ y 0.5 x -displace rz 90 s 0.707 h 40 }R1
d
} rule d{
{s 0.1 1 0.1 h 40}box
}


Smiley face

Dragon Fractal

// Dragon Factal
#define displace 0.5
set colorpool list:white,skyblue,#0044dd,#0088ee
set maxdepth 200
set background black

1 * {z -1 s 20 20 1 color #999}box

R1

rule R1 md 10 > R2 { {s 0.707 y 1 x displace rz 45 }R1
{s 0.707 y 1 x -displace rz 45 }R1
} rule R2{
{s 0.707 0.707 1 color random}box
}


Smiley face

Levy C Curve

//Levy C Curve
#define displace 0.5
set maxdepth 200
set colorpool list:white,skyblue,#0044dd,#0088ee
set background white

1 * {z -0.0575 s 50 50 0.1 color #666}box

R1

rule R1 maxdepth 11 > R2{
{ y 0.5 x displace rz -45 s 0.707 h 40 }R1
{ y 0.5 x -displace rz 45 s 0.707 h 40 }R1

} rule R2{
{s 2.1 0.2 5 color random}box
}


Smiley face

2d Box Fractal

//2d Box Fractal
#define dis 1
#define siz 1/3
set colorpool list:white,gray,#ddd,#999
set background #000

a2

rule a2 w 3 maxdepth 2 > d { { s siz x 0 y 0 z 0 h 15 } a2

{ s siz x dis y dis z 0 h 15 } a2
{ s siz x dis y -dis z 0 h 15 } a2
{ s siz x -dis y dis z 0 h 15 } a2
{ s siz x -dis y -dis z 0 h 15 } a2

} rule a2 w 3 maxdepth 3 > d { { s siz x 0 y 0 z 0 h 15 } a2

{ s siz x dis y dis z 0 h 15 } a2
{ s siz x dis y -dis z 0 h 15 } a2
{ s siz x -dis y dis z 0 h 15 } a2
{ s siz x -dis y -dis z 0 h 15 } a2

} rule d { { color random } box }


Smiley face

3d Box Fractal

//3D Box Fractal
#define dis 1
#define siz 1/3
set colorpool list:white,skyblue,#0044dd,#0088ee
set background #000

a2

rule a2 w 5 maxdepth 3 > d { { s siz x 0 y 0 z 0 h 15 } d

{ s siz x dis y dis z dis h 15 } a2
{ s siz x dis y -dis z dis h 15 } d
{ s siz x -dis y dis z dis h 15 } d
{ s siz x -dis y -dis z dis h 15 } d

{ s siz x dis y dis z -dis h 15 } d
{ s siz x dis y -dis z -dis h 15 } d
{ s siz x -dis y dis z -dis h 15 } d
{ s siz x -dis y -dis z -dis h 15 } d

} rule d { { color random } box }


Smiley face

Sierpinski Pyramid

//Sierpinski Pyramid
set background #fff
#define dis 0.5
#define off 0.866
#define gap 1

r1

rule r1 md 4 > p1 { { x 0 z 0.433 s 0.5 h 40 } r1

{ x 0.25 y 0.25 s 0.5 h 40 } r1
{ x -0.25 y -0.25 s 0.5 h 40 } r1
{ x -0.25 y 0.25 s 0.5 h 40 } r1
{ x 0.25 y -0.25 s 0.5 h 40 } r1

} rule p1 { { z 0.5 h 50 } pyramid1
} rule pyramid1 { triangle[0,0,0;1,0,0;0.5,0.5,off] triangle[1,0,0;1,1,0;0.5,0.5,off] triangle[1,1,0;0,1,0;0.5,0.5,off] triangle[0,1,0;0,0,0;0.5,0.5,off] }


Smiley face

Inverted Sierpinski Pyramid

//Inverted Sierpinski Pyramid
set background #fff
#define dis 0.5
#define off 0.866
#define gap 1

r1

rule r1 md 5 { { x 0 z 0.433 s 0.5 h 40 } r1

{ x 0.25 y 0.25 s 0.5 h 40 } r1
{ x -0.25 y -0.25 s 0.5 h 40 } r1
{ x -0.25 y 0.25 s 0.5 h 40 } r1
{ x 0.25 y -0.25 s 0.5 h 40 } r1
{ z 0.25 } p2

} rule p2 { { s 0.5 } pyramid2

} rule pyramid2 { triangle[0.5,0.5,0 ;0,0,off;1,0,off] triangle[0.5,0.5,0 ;1,0,off;1,1,off] triangle[0.5,0.5,0 ;1,1,off;0,1,off] triangle[0.5,0.5,0 ;0,1,off;0,0,off] triangle[0,0,off;1,0,off;1,1,off] triangle[1,1,off;0,1,off;0,0,off] }

Smiley face

Pythagoras Tree 2

//Pythagoras Tree 2
#define displace 0.51
set maxdepth 200
set background white

1 * {y -0.6 s 150 0.1 150 color #999}box
R1

rule R1 maxdepth 9 { { y 1.1 x displace rz -45 s 0.707 h 40 } R1
{ y 1.1 x -displace rz 45 s 0.707 h 40 } R1

{ color #fff } frame
{ } d
} rule d{
{ s 0.1 0.9 0.9 x 5 } box { s 0.1 0.9 0.9 x -5 } box { s 0.9 0.1 0.9 y 5 } box { s 0.9 0.1 0.9 y -5 } box { s 0.9 0.9 0.1 z 5 } box { s 0.9 0.9 0.1 z -5 } box } rule frame { { s 0.1 1.1 0.1 x 5 z 5 } box { s 0.1 1.1 0.1 x 5 z -5 } box { s 0.1 1.1 0.1 x -5 z 5 } box { s 0.1 1.1 0.1 x -5 z -5 } box { s 1 0.1 0.1 y 5 z 5 } box { s 1 0.1 0.1 y 5 z -5 } box { s 1 0.1 0.1 y -5 z 5 } box { s 1 0.1 0.1 y -5 z -5 } box { s 0.1 0.1 1 y 5 x 5 } box { s 0.1 0.1 1 y 5 x -5 } box { s 0.1 0.1 1 y -5 x 5 } box { s 0.1 0.1 1 y -5 x -5 } box }

Smiley face

3D Frames

//3D Frames
#define dis 0.55
set colorpool list:white,#ee0,#e0e,#0ee
set background #000

a2

rule a2 w 3 maxdepth 6 > d { { s 0.5 0.5 0.5 x dis y dis z dis } a2
{ s 0.5 0.5 0.5 x -dis y dis z dis } d
{ s 0.5 0.5 0.5 x dis y -dis z dis } d
{ s 0.5 0.5 0.5 x -dis y -dis z dis } d

{ s 0.5 0.5 0.5 x dis y dis z -dis } d
{ s 0.5 0.5 0.5 x -dis y dis z -dis } d
{ s 0.5 0.5 0.5 x dis y -dis z -dis } d
{ s 0.5 0.5 0.5 x -dis y -dis z -dis } a2

} rule d w 2 { { s 1 1 1 color random } frame
} rule frame { { s 0.1 1.1 0.1 x 5 z 5 } box { s 0.1 1.1 0.1 x 5 z -5 } box { s 0.1 1.1 0.1 x -5 z 5 } box { s 0.1 1.1 0.1 x -5 z -5 } box { s 1 0.1 0.1 y 5 z 5 } box { s 1 0.1 0.1 y 5 z -5 } box { s 1 0.1 0.1 y -5 z 5 } box { s 1 0.1 0.1 y -5 z -5 } box { s 0.1 0.1 1 y 5 x 5 } box { s 0.1 0.1 1 y 5 x -5 } box { s 0.1 0.1 1 y -5 x 5 } box { s 0.1 0.1 1 y -5 x -5 } box }

Smiley face

Fractal Box 2

//Fractal Box 2
#define size 0.5
#define offset 0.5
set colorpool list:white,white,blue,#ee0000,#00ee00
set background #fff

R1

rule R1 md 5{
{ z offset s size } R1
{ y offset s size } R1
{ x offset s size} R1

{ z -offset s size } R1
{ y -offset s size } R1
{ x -offset s size } R1

{ color random } box }


Smiley face

Fractal Box 3

//Fractal Box 3
set colorpool list:white,#ee0,#e0e,#0ee
set background #fff
#define size 0.4
#define offset 0.5
set maxdepth 7

R1

rule R1 md 6 { { x offset y offset z offset s size } R1
{ x offset y -offset z offset s size } R1
{ x -offset y -offset z offset s size } R1
{ x -offset y offset z offset s size } R1

{ x offset y offset z -offset s size } R1
{ x offset y -offset z -offset s size } R1
{ x -offset y -offset z -offset s size } R1
{ x -offset y offset z -offset s size } R1
{ color random } box }


Smiley face

Frame Frame 1

// Frame Frame 1
set colorpool list:blue,#0088ff,magenta,white
set background #fff
#define size 0.25
#define offset 0.3125
set maxdepth 7

R1

rule R1 md 4 { { x offset y offset z offset s size } R1
{ x offset y -offset z offset s size } R1
{ x -offset y -offset z offset s size } R1
{ x -offset y offset z offset s size } R1

{ x offset y offset z -offset s size } R1
{ x offset y -offset z -offset s size } R1
{ x -offset y -offset z -offset s size } R1
{ x -offset y offset z -offset s size } R1
{ color random } frame
} rule frame { { s 0.1 1.1 0.1 x 5 z 5 } box { s 0.1 1.1 0.1 x 5 z -5 } box { s 0.1 1.1 0.1 x -5 z 5 } box { s 0.1 1.1 0.1 x -5 z -5 } box { s 1 0.1 0.1 y 5 z 5 } box { s 1 0.1 0.1 y 5 z -5 } box { s 1 0.1 0.1 y -5 z 5 } box { s 1 0.1 0.1 y -5 z -5 } box { s 0.1 0.1 1 y 5 x 5 } box { s 0.1 0.1 1 y 5 x -5 } box { s 0.1 0.1 1 y -5 x 5 } box { s 0.1 0.1 1 y -5 x -5 } box }

Smiley face

Frame Frame 2

// Frame Frame 2

#define size 0.4
#define offset 0.5
set colorpool list:yellow,orange,white,red
set background #fff

R1

rule R1 md 4 { { x offset y offset z offset s size } R1
{ x offset y -offset z offset s size } R1
{ x -offset y -offset z offset s size } R1
{ x -offset y offset z offset s size } R1

{ x offset y offset z -offset s size } R1
{ x offset y -offset z -offset s size } R1
{ x -offset y -offset z -offset s size } R1
{ x -offset y offset z -offset s size } R1
{ color random } frame
} rule frame { { s 0.1 1.1 0.1 x 5 z 5 } box { s 0.1 1.1 0.1 x 5 z -5 } box { s 0.1 1.1 0.1 x -5 z 5 } box { s 0.1 1.1 0.1 x -5 z -5 } box { s 1 0.1 0.1 y 5 z 5 } box { s 1 0.1 0.1 y 5 z -5 } box { s 1 0.1 0.1 y -5 z 5 } box { s 1 0.1 0.1 y -5 z -5 } box { s 0.1 0.1 1 y 5 x 5 } box { s 0.1 0.1 1 y 5 x -5 } box { s 0.1 0.1 1 y -5 x 5 } box { s 0.1 0.1 1 y -5 x -5 } box }

Smiley face

Sierpinski Pyramid Cube

//Sierpinski Pyramid Cube
#define dis 1
#define off 0.866
set background #fff

1 * {z -0.1 s 50 50 0.1 color #ad6 } box 2 * {x 2 z 2 ry 180 } 4 * {y 2 rx 90 } r1

rule r1 md 3 > p2 { {s 0.5 x 0 y 0 } r1
{ s 0.5 x 1 } r1
{ s 0.5 x 0 y 1 z 0 } r1
{ s 0.5 x 0 y 0 z 1 } r1
} rule r1 md 1 > p2 { {s 0.5 x 0 y 0 } r1
{ s 0.5 x 1 } r1
{ s 0.5 x 0 y 1 z 0 } r1
{ s 0.5 x 0 y 0 z 1 } r1
} rule r1 md 1 > p2 { {s 0.5 x 0 y 0 }r1
{ s 0.5 x 1 }r1
{ s 0.5 x 0 y 1 z 0 }r1
{ s 0.5 x 0 y 0 z 1 }r1
} rule p2{
//{x 0.5 y 0.5 z 0.5 color #b9c}box
{ x 0.5 y 0.5 z 0.5 color #b9c } pyramid
} rule pyramid { triangle[0,0,0;0,1,0;1,0,0] triangle[0,0,0;0,1,0;0,0,1] triangle[0,0,0;1,0,0;0,0,1] triangle[1,0,0;0,1,0;0,0,1] }

Smiley face

Tic Tac Toe

// Tic Tac Toe

1 * {z -0.1 s 20 20 0.1 color #eee } box tictactoe rule tictactoe md 2 > mark { { z -0.03 s 0.3 } tictactoe

{ x 2 y 2 z -0.03 s 0.3 } tictactoe
{ x -2 y -2 z -0.03 s 0.3 } mark

{ x 2 y -2 z -0.03 s 0.3 } tictactoe
{ x -2 y 2 z -0.03 s 0.3 } mark

{ x -2 y 0 z -0.03 s 0.3 } tictactoe
{ x 2 y 0 z -0.03 s 0.3 } tictactoe

{ x 0 y 2 z -0.03 s 0.3 } mark
{ x 0 y -2 z -0.03 s 0.3 } tictactoe

lines
} rule tictactoe md 1 > mark { { z -0.03 s 0.3 }tictactoe

{ x 2 y 2 z -0.03 s 0.3 } tictactoe
{ x -2 y -2 z -0.03 s 0.3 } mark

{ x 2 y -2 z -0.03 s 0.3 } tictactoe
{ x -2 y 2 z -0.03 s 0.3 } mark

{ x -2 y 0 z -0.03 s 0.3 } tictactoe
{ x 2 y 0 z -0.03 s 0.3 } tictactoe

{ x 0 y 2 z -0.03 s 0.3 } mark
{ x 0 y -2 z -0.03 s 0.3 } tictactoe

lines
} rule lines{
1 * { y -3 s 6 0.1 0.1} 2 * { y 20 color #aa4 } box 1 * { x -3 s 0.1 6 0.1} 2 * { x 20 color #aa4 } box } rule mark{}
rule mark{}

rule mark{
{ rz 45 s 3 } xx
} rule mark{
{ x 2 s 0.3 } oo
} rule xx{
{ y -0 s 1.5 0.1 0.1 color #48e } box { x -0 s 0.1 1.5 0.1 color #48e } box } rule oo md 50 { { x 0.06 y 0.85 rz 7.5 } oo
{ s 0.75 1 0.75 } box }