kronpano on DeviantArthttp://creativecommons.org/licenses/by-nc-sa/3.0/https://www.deviantart.com/kronpano/art/Sinwave-Sculpture-with-JS-StructureSynth-tutorial-589304395kronpano

Deviation Actions

kronpano's avatar

Sinwave Sculpture with JS StructureSynth tutorial

By
Published:
1.9K Views

Description

Another Structure Synth creation - without actually writing any Eisen script.
Everything - except the render settings - is generated by the javascript wrapper.
This means full access to math functions and variables - a whole new world for structure synth!!!!

Just to show how it was done - the following is the Eisen Script:

set translation [0.501637 0.401172 -20]
set rotation [-0.533038 -0.796854 -0.284368 -0.57614 0.588013 -0.567755 0.619684 -0.138811 -0.772596]
set pivot [0 0 0]
set scale 0.234111

set raytracer::light [0,-10,-29]
set raytracer::reflection 0.01
set raytracer::size [2000x0]
set raytracer::samples 6


That is it !! Not a single rule in sight.
Now the wrapper java script:


#javascript

Builder.load("sinwave_sculpture1_eisen.es");
max =80;
pi=3.1415

Builder.append("6 * {x 0 x -0 rz -60 }sinwave")
Builder.append("rule sinwave{")
for (i = 0; i <=  max; i+=1) {
   trig_val=i*pi*2/max
    sin_x=16*i/max
    sin_y=5*Math.sin(trig_val)-Math.sin(trig_val)
    width_z=0.2+i/max*3
    rot_z=60*Math.cos(trig_val)
    asd="{z 0 y "+ sin_y + " x " +sin_x +" rz "+ rot_z +" rx "+ 3*i+" ry "+ 5*i +" s 1 0.25 10 }box"
    Builder.append(asd)
}
Builder.append("}")
Builder.build();

Again - not a lot here.
The javascript code can be run directly in Structure Synth.
It will first of all load the Eisen script (which should be saved as sinwave_sculpture1_eisen.es)
Then rules will be generated and appended to the existing script using the Builder.apppend function - everything that is appended is actually written as a line which is interpreted by Structure Synth.
So just assemble a string made up from variables and a bit of text and pass it to the Builder - that is it.

Nothing fancy so far since I am just starting to explore the possibilities that this rule generation via javascript offers.

This should offer an easy way to generate lots of rules which can be used from the Eisen script or from rules generated via javascript.

A whole new world for Structure Synth - now I just need to find the right balance between scripted structures and the actual underlying L-system of Structure synth.

So much to play with!!!
Image size
2099x1738px 960.29 KB
Comments7
Join the community to add your comment. Already a deviant? Log In