Logo by KRAFTWERK - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. April 20, 2024, 01:59:04 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Exporting non-uniform scaled spheres and cylinders from Structure Synth  (Read 6099 times)
0 Members and 1 Guest are viewing this topic.
barcud
Navigator
*****
Posts: 69


« on: October 23, 2017, 02:20:10 PM »

OK - here is something I've been playing with.
Structure Synth can't squash spheres or use cylinders.
So I wrote an export template which will give me the transformation matrices for my objects -convert them via a web page using three.js and export and object and material file.
Problem is that Structure Synth only exports the full transformation matrix for boxes.
So here is the script I used for the images:
balls
Code:
{y 12}cyl
{x 12}cyl2
{x -12}cyl3
{y -12}boxes
rule balls md 12 {
{z 0.4 s 6 12 0.3 h -80 sat 0.8}box::ball
{ s 0.8 0.9 1.4 rz 90 h 20}balls
}
rule cyl md 12 {
1 * {z 0.3 s 12 6 0.3 h 80 sat 0.8} 1 *{rx 90}box::cyl
{ s 0.7 0.9 1.4 rz 90 h 20}cyl
}
rule cyl2 md 12 {
1 * {z 0.3 s 12 6 0.3 h 80 sat 0.8} 1 *{ry 90}box::cyl
{ s 0.7 0.9 1.4 rz 90 h 20}cyl2
}
rule cyl3 md 12 {
1 * {z 0.3 s 12 6 0.3 h 80 sat 0.8} 1 *{rz 90}box::cyl
{ s 0.7 0.9 1.4 rz 90 h 20}cyl3
}
rule boxes md 12 {
{z 0.2 s 6 12 0.1 h -80 sat 0.8}box
{ s 0.7 0.9 1.4 rz 90 h 20}boxes
}
and the export template is:
Code:
<template defaultExtension="Matrix (*.txt)" name="MatrixBSC">
<description>
Exports matrix to create squashed spheres and cylinders using conversion
</description>
<primitive name="begin"><![CDATA[]]></primitive>
<primitive name="end"><![CDATA[]]></primitive>
<primitive name="box"><![CDATA[box
{matrix}
{r} {g} {b} {oneminusalpha}
]]></primitive>
<primitive name="box::ball"><![CDATA[sphere
{matrix}
{r} {g} {b} {oneminusalpha}
]]></primitive>
<primitive name="box::cyl"><![CDATA[cylinder
{matrix}
{r} {g} {b} {oneminusalpha}
]]></primitive>
</template>
This will result in a text file which has the object (sphere, box, cylinder) and the full transformation matrix + color info.
This file can be uploaded to a web page and produces the second image (colours are not rendered nicely but it is more about the geometries here).
Pressing "export" will create an .obj and .mtl file which can then be imported into a 3D program of your choice and rendered.
Yes - it is not that straight forward and the preview in Structure Synth is not that helpful but hey - it's a start.
Is there any interest in the converter web page?
All the conversion is done locally on your computer using javascript - there is no data transfer to a server involved - just matrix operations using three.js and an object exporter.
Exporting 1500 round objects takes about 10 seconds during which the web page is unresponsive.

Let me know what you think and/or if that is of interest to anybody.


* BallCylinderBox.jpg (63.15 KB, 960x819 - viewed 321 times.)

* threeJSconverter.jpg (69.97 KB, 1319x977 - viewed 309 times.)

* render.jpg (74.61 KB, 1280x1024 - viewed 319 times.)
Logged
barcud
Navigator
*****
Posts: 69


« Reply #1 on: October 23, 2017, 05:41:03 PM »

If somebody actually wants to try it - copy the template from above and save it to the template folder.
Then take the script and run it - remember - the Structure Synth preview will only show boxes.
Export using the new template - this will result in a txt file.

Go to http://matrixconverter4structuresynth.created-by.me/converter.html  and load the text file.
There in the preview you will see the spheres and cylinders.
Export to object will save the converted geometries in the download folder.

Nothing is actually transmitted to the server. The web page load three.js and a couple of helpers and all the conversion is done locally in your browser.

I have exported 2000 spheres but the obj file will be about 200MB - so be careful - start slowly.
The web page will be unresponsive during the export time - it takes usually about 10seconds for 1000 spheres.

This is a alpha version of the converter - nothing should go wrong but if it does let me know.
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Structure Synth General Discussion seied 11 3800 Last post October 21, 2012, 11:02:36 PM
by blob
Structure Synth 3D Fractal Generation VanlindtMarc 2 4999 Last post July 11, 2013, 10:59:34 PM
by VanlindtMarc
Structure Synth related links Structure Synth VanlindtMarc 2 4703 Last post January 15, 2016, 03:16:22 PM
by barcud
Still using structure synth for houses Structure Synth Gallery barcud 5 1967 Last post April 06, 2016, 11:26:59 PM
by matsoljare
Panoramic images using Structure synth Structure Synth Gallery barcud 0 1190 Last post January 15, 2016, 03:00:38 PM
by barcud

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.161 seconds with 25 queries. (Pretty URLs adds 0.009s, 2q)