mScatter Tool for Octane Standalone

Forums: mScatter Tool for Octane Standalone
Forum for OctaneRender Lua scripting examples, discussion and support.

mScatter Tool for Octane Standalone

Postby Vue2Octane » Wed Jul 30, 2014 12:43 pm

Vue2Octane Wed Jul 30, 2014 12:43 pm
A repeat of the posting from the gallery section.

This is the Matlab Code of mScatter. I am looking for someone to turn it into C-Code or Lua for wide distribution and faster processing.

-------------------------------------from gallery section
Here is the Matlab Code.

There are three variations of mScatter as of now:

1. Heightmap based
2. Random non-overlapping instances
3. Random overlapping instances

If you just load it into Matlab and run it, it writes scatter matrices in you current folder. Those can be loaded into a scatter node straightaway. I always test it then with simple cubes in Octane.

For all three variations, it exports all variations of the differents matrix multiplications, so TransAll has eg only the translation in it, while Transshearrotsale has everything.

For heightmap there is also one randomised export. This means I take all the matrices for the instances and randomly re-organise them in the txt file for the scatter node. This has the big advantage, that I can thin out populations by just selection any say 100 elements in the scatter node and delete them (e.g. the first 100). Without randomizing the instance order, the first 100 element were the first rows of the scanned terrain (I scan row-wise right now). This way I can also just copy a few lines in the scatter node and paste them in another which e.g. puts flowers in grass. Then the flowers will be randomly distributed on a meadow for example.
It all coded for organic landscape scene.

I tend to only use the InstanceTSRshearallrandom.txt output. There the matrices for each element contain translation, rotation, scaling, shearing and are randomised in the txt.

The terrain heightmap is exported from VUE, same as the terrain .obj (not in the upload).
When matching heightmap and obj, then obj needs to be the correct height. Or you have to move down the scatterring using a placement node. (the (256/64) in the code -> heightmap max is 256, means 256m in octane, while terrain .obj export is 64m, because I restricted my height to this value. Otherwise the terrains are too steep)

Terrain has to be 256 color bitmap.
Painting has to be white (means value 255) on the terrain and saved as 24bit bmp. This way the painted stuff always has one gray value more than the largest terrain gray value. The code then substracts Terrain Painting and Terrain to extract the distribution.

It is pretty slow in Matlab for large distributions. One more reason to create a C-Code and exe.

Matlab Code mScatter.7z
(167.96 KiB) Downloaded 322 times
Licensed Customer
Licensed Customer
Posts: 88
Joined: Thu Jun 26, 2014 8:16 am

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

Wed Jan 27, 2021 1:44 am [ UTC ]