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

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 }
 
 

No comments:

Post a Comment

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