Page 1 of 4

new Scatter Tool for Octane Standalone -mScatter-

Posted: Tue Jul 29, 2014 2:04 pm
by Vue2Octane
Hi,

I coded scatter tool for Octane Standalone.

It takes heightmaps as inputs and painted distributions on the same heightmap and exports the scatter matrices into a .txt file.
That txt file is then loaded into a scatter node as usual.

It can also do random scattering.

It exports the scatter matrices according to the octane manual. The matrice format is fortunately standard transform matrix format like shown here. That made it easy.
http://www.cs.brandeis.edu/~cs155/Lecture_07_6.pdf

I coded it in a way, that it takes the heightmap and the painted distribution and calculates x,y,z position from that.
Then I apply some x,y,z scaling, some x,y,z rotation and some x,y,z shearing. Each of that gives a single matrix, and by matrix-multiplying all of them, you get one final matrix to be imported into the Octane Scatter node, and which combines translation, rotation, scaling and shearing. With all that, basically no instance looks like the other.

I did it mainly for self use a while ago, so that I can do landscapes in Octane. I am coming from landscape rendering. I am quite proficient on Matlab and quickly coded it there in a free minute. Unlucky, I have not done C for ages and have never done Lua.
If someone would like to translate the Code, then I am happy to share. It is all pretty basic coding.
I am sure, the Scatter tool can be done in Lua and with GUI.

Below are renders that I have done the last month.
Most vegetatation scenes have ~1GB GPU Ram in size and ~2000000 instances.
All rendered on my laptop with GTX780M/2GB

It is quite nice to see, how well Octane Standalone handles instancing.

Everything is CG, apart from skies in some pictures. The skies are composed photographs.
19.jpg
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
9.jpg
10.jpg
11.jpg
12.jpg
13.jpg
14.jpg
15.jpg
16.jpg
17.jpg
18.jpg

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Tue Jul 29, 2014 3:45 pm
by p3taoctane
Very cool
Where can we get it :>)))

Nice Work

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 7:29 am
by Vue2Octane
will upload the code as soon as I have the C-Code. Right now I have only Matlab Code.

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 7:37 am
by Zay
Looks great!

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 8:24 am
by Jaberwocky
Looks Really good Vue

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 10:23 am
by Phantom107
Oh nice, I didn't realise you could also shear using the matrices. Maybe I can find a use for that.

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 10:38 am
by Vue2Octane
Yes, I also did not remember shearing. I was only aware of scaling, rotation and translation.
Nice scatter tool, Phantom107.

mScatter will be much more basic and just one .exe file and a scatter options input from a txt file and then the heightmap and the painted distribution on the heightmap as input. So far I really only painted directly on the heightmap in Paint with a brush. Very basic.
The terrains I exported from VUE as .obj.
It is mainly for scattering on Terrains and some random scattering modes which are box-random (fields etc) or normal distribution pseudo-random (gravitiy effects etc.) or whatever I write in the translation matrix generation. Plus some jitter options etc. to get any regularity out of a painted distribution.

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 10:39 am
by smicha
I am also a Matlab and rather Gauss and r-project coder. I am very interested how you coded this.

Which software are you using for height maps?

Post your questions on LUA section.
http://render.otoy.com/forum/viewforum.php?f=73

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 12:41 pm
by Vue2Octane
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.

Re: new Scatter Tool for Octane Standalone -mScatter-

Posted: Wed Jul 30, 2014 12:58 pm
by smicha
This should be definitely converted to LUA.