Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Wednesday, 27 October 2010

Another StructureSynth Sketch

I've been keeping my copy of the development version StructureSynth up to date (svn update Oct 27th 2010) , and it seems to be improving all the while. In the sketch below I use the StructureSynth built in ray tracing facility to render image.
   1 // Camera settings. Place these before first rule call.
   2 set translation [0 0 -20]
   3 set rotation [-0.935483 0.278086 0.218019 -0.159335 -0.882663 0.442205 0.315407 0.378935 0.870019]
   4 set pivot [0 0 0]
   5 set scale 3.25
   6 
   7 set maxdepth 8
   8 
   9 links
  10 
  11 rule links {
  12 { rx 45  x 0.35 y 0.35 z 0.25} link
  13 { rx -45  y -0.35 x -0.35 z 0.5} link
  14 }
  15 
  16 rule link{
  17 { x -0.5 y 0.5}left
  18 { y -0.5 x 0.5}north
  19 { x 0.5 y -0.5}right
  20 { y 0.5 x -0.5}south
  21 }
  22 
  23 rule left{
  24 { x 0.5 y 0 z 0 s 1.225 0.25 0.25 } box 
  25 }
  26 
  27 rule right {
  28 { x -0.5 y 0 z 0 s 1.225 0.25 0.25 } box 
  29 }
  30 
  31 rule north{
  32 { x 0 y 0.5 z 0 s 0.25 1.225 0.25 } box 
  33 }
  34 
  35 rule south {
  36 { x 0 y -0.5 z 0 s 0.25 1.225 0.25 } box 
  37 }

Saturday, 2 October 2010

Ray Tracer In StructureSynth (experimental in subversion)

Well there I was trying to learn about all different sorts of ray tracing options for 3D images, then this comes along http://blog.hvidtfeldts.net/index.php/2010/09/creating-a-raytracer-for-structure-synth/.  One really neat thing is the ability to adjust the image zoom and rotation before rendering. Then by use of mouse click you can save the current camera settings as below before doing the ray-tracer render.  (custom syntax highlighting using my custom jedit mode). Note the individual primitive objects can be 'tagged' to get special treatment.

   1 // Camera settings. Place these before first rule call.
   2 set translation [-0.0633663 0.0965309 -20]
   3 set rotation [0.888729 0.0811242 0.451178 -0.094785 0.995468 0.00771677 -0.448509 -0.0496248 0.892393]
   4 set pivot [0 0 0]
   5 set scale 0.4
   6 
   7 
   8 set raytracer::ambient-occlusion [1,50,0]
   9 set raytracer::shadows true
  10 set raytracer::anti-alias 2
  11 set raytracer::reflection 0.0
  12 set raytracer::reflective::reflection 0.0
  13 set raytracer::phong [0.6,0.6,0.3]
  14 set raytracer::reflective::phong [0.6,0.6,0.0]
  15 
  16 
  17 #define _md 400
  18 #define _rz 0
  19 #define _zoom 1
  20 
  21 game
  22 
  23 set background #fff
  24 
  25 rule game{
  26   {h 20} frame
  27   {s 4 h 220} sphere::reflective
  28   {x -5 z -5 y -5 ry 45 rz 45 rx 45} jack
  29   {x 5 z 5 y 5 ry 45 rz 45 rx 45} jack
  30 }
  31 
  32 
  33 rule frame{
  34   cross
  35   {ry 90} cross
  36 }
  37 
  38 rule cross{
  39   four
  40   {rz 90} four
  41 }
  42 
  43 rule four{
  44  {y -2.5 z -2.5}bar
  45  {y -2.5 z 2.5}bar
  46  {y 2.5 z -2.5}bar
  47  {y 2.5 z 2.5}bar
  48 }
  49  
  50 rule bar{
  51   {s 14 0.5 0.5} box
  52 }
  53    
  54 rule jack{
  55   arm
  56   {ry 90}arm
  57   {rz 90}arm
  58 }
  59 
  60 rule arm{
  61   5 *{x 0.28284271} sphere::reflective
  62   5 *{x -0.28284271} sphere::reflective
  63 }
 
 

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2