Title: Generating all the rules via javascript Post by: barcud on February 07, 2016, 05:16:56 PM A new era in Structure Synth (at least for me) - generating all the rules via javascript!!!!
I knew you could use javascript but I never went further than to use it for some animations - bad mistake!! Turns out you can write complete rule sets using javascript and you have access to math functions and variables this way. I have written a short tutorial http://kronpano.deviantart.com/art/Sinwave-Sculpture-with-JS-StructureSynth-tutorial-589304395 (http://kronpano.deviantart.com/art/Sinwave-Sculpture-with-JS-StructureSynth-tutorial-589304395) over at DA which should be accessible by the public Title: Re: Generating all the rules via javascript Post by: ciric50 on April 06, 2016, 04:44:55 AM Interesting! I like structure-synth as it is, but being able to use javascript opens up a whole new set of possibilities.
I wonder if there might be a way to run batches of generated Eisenscript programs, with some type of intelligence attached that would help weed out uninteresting results? It would be cool to have a program that would generate hundreds or even thousands of scripts and run them. You wouldn't want to run and evaluate them by hand, though. Some type of automated process would be required to figure out which ones were "interesting". I've done this with chaotic orbits in my own studies, but I think it would be a lot more difficult with structure-synth constructions. I'm not sure how you would determine what is an "interesting" result programmatically. Title: Re: Generating all the rules via javascript Post by: barcud on April 11, 2016, 12:19:30 PM Some programs like JWildfire or now even Mandelbulb3D have something called a MutaGen - a mutation generator which applies more or less random mutations to parameters of formulas but in both programs the results are presented as is and it is up to the user to decide which mutation might be useful.
EDIT I was just told that it is not just random mutations - there are internal processes which try to make a decision on what works in both JWF and MB3D. Using some sort of "quality" measure like edge detection, contrast, colour distribution ..... those MutaGens try to weed out the uninteresting ones and present only those passing certain criteria. END EDIT I would have no idea how you could programmatically make that decision. EDIT OK, now I have an idea but first of all I would still not be able to implement any of them and secondly I think Structure Synth is different from "normal" fractals and flames. I actually like to be the "random" generator - to come up with some idea and then find out that it doesn't work :sad1: END EDIT I am using the javascript side of things mainly to create curves (using sin/cos) or structures which I want to in/decrease in a loop fashion (like a triangular tiled roof - start at the top with one, next row two.....). Still struggling though with using it properly in a mixed way - generating several rules in javascript and calling them in an eisen script - but hey, perhaps at some point :D Title: Re: Generating all the rules via javascript Post by: barcud on April 11, 2016, 12:36:10 PM Here is another sin wave based structure build using
Code: #javascript and the follwing saved as "sinwaveSculpture4c4_es.es" Code: mysin As you can see the real Structure Synth part is just the rotation. I am trying to get to the point where I create several ambigous rules in java script and then use them properly in Structure synth - by that I mean more in a l-system style. Title: Re: Generating all the rules via javascript Post by: SCORPION on April 12, 2016, 04:24:59 PM Very interesting!
But the objects created in this way can not be exported. This is very bad. Title: Re: Generating all the rules via javascript Post by: barcud on April 12, 2016, 08:23:10 PM Well they can using for example a site like jsfiddle or a local javascript environment.
If you look for example at this https://jsfiddle.net/of40gmf6/4/ and run it you will get all the "proper" Structure Synth commands in the output window which can then be taken and pasted into structure synth. The fiddle has the following javascript which just creates a wavy tower: Code: max = 80; All the builder.append have been replaced by the out function which needs to be defined once. I know - not the most straight forward way but it works. The image is the object created in Structure Synth, exported and opened in 3DBuilder. Title: Re: Generating all the rules via javascript Post by: SCORPION on April 13, 2016, 12:00:14 AM I can not understand now how it is run in the Structure Synth.
Title: Re: Generating all the rules via javascript Post by: barcud on April 13, 2016, 03:41:53 PM It is a sort of 3 stage process if you want to create an object from a javascript.
If you open the jsfiddle link I posted before or this one https://jsfiddle.net/of40gmf6/4/ (https://jsfiddle.net/of40gmf6/4/) you can see (should be able to - I think sharing works OK) on the right hand side the output which is pure Sturcture synth rules. These can be copied and pasted into a Structure Synth tab and when you run it you can also export the object. This method will only work if you create the complete rule in javascript - not if you want to modify existing rules. Any clearer? I am not saying this is how it has to be done but I found it works. It is probably a bug in Structure Synth that the object export does not invoke the javascript interpreter (?? or something like that) because it wan't really intended for generating complete rules but to make animations possible. |