Context Free Design Grammars for POV-Ray

ContextFree is a kickass free program for rendering fractal-like images from context free design grammars. I've been playing wiht it a lot recently and wanted to do something simmilar in 3d using POV-Ray. This is the first beta version of a script to do that. The language is not fully supported yet and there is some new stuff I'd like to add. Bug reports, comments, and images to my gmail address, I'd love to see what you make with this thing :-)

[Download source code]

rules go here:

instructions

This program is meant as a 3d approximation of the excellent Context Free renderer, so you'll need to learn to use that first. The syntax for myCFDG3d is mostly the same, except that r (rotate) becomes rx and ry to rotate on the x and y axes, and objects can now also be transformed on the z axis. CIRCLE becomes SPHERE, SQUARE becomes CUBE and I've added a new shape, CYLINDER. No TRIANGLE as yet, flip and looping not yet supported.

TODO

  • Check the math for object-space rotation, I think there may be a bug there.
  • Support more shapes, and user-defined shapes.
  • Support HSL color, alpha blending, as with Context Free.
  • Think about implementing transparency, refection, textures and other POV-Ray stuff.
  • If there is interest, add a user gallery, as at chriscoyne.com

Ideas

Add rand(min - max) as an option for variables, as in:

somerule {y 1, z rand(3, 10), rx rand(20, 50) }

Terminating cases - allow rule definitions reference another rule to switch to once object space reaches a certain size, eg:

rule STALK 100 terminate 0.3 FLOWER { CIRCLE {} STALK {y 1, rx 1, size 0.97 } }

In this case STALK behaves normally until object space becomes 0.3 the size of world space, then FLOWER is called in its place. Not quite context free.

Limitations

This copy of the program only runs to four thousand iterations. I know that's not lot. Generating million line text documents, several at a time, would affect the other sites running off this server. Ideally the server would also render the POV-Ray script to an image, for this heavily loaded box it's too expensive in memory and CPU time. If you can host a mirror with higher spec, please let me know an I'll link you from the front page. Thanks :-)




Example

context free design grammars with povray startshape tree

rule tree {
      branch { ry 30, rx 30 }
      branch { ry -30, rx -30 }
      branch { ry -30, rx 30 }
      branch { ry 30, rx -30 }
}

rule branch 10 {
      CIRCLE {}
      branch { y 1, ry -5, size 0.95 }
}

rule branch 10 {
      CIRCLE {}
      branch { y 1, ry 5, size 0.95 }
}

rule branch {
      CIRCLE {}
      branch { rx 20, size 0.95 }
      branch { rx -20, size 0.95 }
}

rule branch {
      CIRCLE {}
      branch { ry 20, size 0.95 }
      branch { ry -20, size 0.95 }
}


Webcams

219.101.90.158 - Panasonic KX Series 211.2.179.199 - Panasonic KX Series 71.138.180.178:85 - Axis 141.213.35.196 - Axis 195.73.15.148:82 - Axis www.grower2buyer.net - Panasonic KX Series 80.160.169.182 - Axis 194.94.37.79 - Axis 24.39.100.161:81 - Panasonic KX Series 220.254.124.252 - Panasonic KX Series 208.0.229.84 - Panasonic KX Series 62.128.241.214:88 - Axis 217.41.42.231 - Axis vs.comm.soft.iwate-pu.ac.jp - Panasonic KX Series

Toys

Ransom Notes
Stencil Maker
Mix Poetry
Sarcasmotron
Shocked Robin
Context Free
myCFDG3d
Hotlink Lottery

Popular Posts

The BBC iPlayer
BBC Documentaries as Torrents
Upside Down Horse Statue
Marmaduke is Watching You Masturbate
Ransom Note Generator
A Better Periodic Table
Yakima NSA Echelon Faclilty, Washington
Sea Monster on Google Maps
New York Became My Canvas
Obama Cuts Funding For Abstinence Only Sex Ed

Recent Posts



Calling all Junior Scientists
Obama Cuts Funding For Abstinence Only Sex Ed
The Moar You Know
New York Became My Canvas
How I Wonder Is A Cat
Interactive Map Of Stupid
Ransom Notes Back Online
The Hotlink Lottery

Categories


hacking
internet
introspection
music
photography
stuff
stupid
things
webcomic

- (Made By Machines) -