Page 1 of 6

Components and instancing in 1.025

PostPosted: Sat Jul 21, 2012 6:18 pm
by smicha
TIG,

I have a short question: how to export multiple copies of the same component with instancing support (to save vram) - the new great function of Octane.

http://render.otoy.com/forum/viewtopic.php?f=33&t=22508

Kind regards,

smicha

Re: Components and instancing in 1.025

PostPosted: Sat Jul 21, 2012 9:04 pm
by Tugpsx
You may find your answer here

viewtopic.php?f=7&t=22511

Re: Components and instancing in 1.025

PostPosted: Sun Jul 22, 2012 1:30 pm
by TIG
You sort of answer your question in the question...

You need to export individual parts of your Model as OBJ/MTL file sets - it's an available option on the SUp Exporter - i.e. 'no render'... OR if you have Pro you could use the inbuilt OBJ exporter - setting the options up correctly meters/triangulated/single-sided/flippedZY etc as required by the receiving OCS...
The SUp Exporter only includes things on visible layers [or that are not otherwise 'hidden'].
So if you have componentized your model either export the individual components as external SKPs and export those as separate OBJ/MTL files, or use on/off layers [and scene-tabs to remember them etc] in the Model to keep the relative relationships of the geometry/objects... and then export them as named sets...
Make an OCS with the latest Octane version and manually add multiple OBJ nodes etc using these named sets...
Use the new Octane functions as detailed in the other links already given to make them all active etc...

Re: Components and instancing in 1.025

PostPosted: Tue Jul 31, 2012 9:54 pm
by rappet
TIG wrote:You sort of answer your question in the question...

You need to export individual parts of your Model as OBJ/MTL file sets - it's an available option on the SUp Exporter - i.e. 'no render'... OR if you have Pro you could use the inbuilt OBJ exporter - setting the options up correctly meters/triangulated/single-sided/flippedZY etc as required by the receiving OCS...
The SUp Exporter only includes things on visible layers [or that are not otherwise 'hidden'].
So if you have componentized your model either export the individual components as external SKPs and export those as separate OBJ/MTL files, or use on/off layers [and scene-tabs to remember them etc] in the Model to keep the relative relationships of the geometry/objects... and then export them as named sets...
Make an OCS with the latest Octane version and manually add multiple OBJ nodes etc using these named sets...
Use the new Octane functions as detailed in the other links already given to make them all active etc...


But how to make an animation when the different objects are geometrically gouped obj's?
Greetz,

Re: Components and instancing in 1.025

PostPosted: Wed Aug 01, 2012 9:24 am
by smicha
TIG wrote:You sort of answer your question in the question...

You need to export individual parts of your Model as OBJ/MTL file sets - it's an available option on the SUp Exporter - i.e. 'no render'... OR if you have Pro you could use the inbuilt OBJ exporter - setting the options up correctly meters/triangulated/single-sided/flippedZY etc as required by the receiving OCS...
The SUp Exporter only includes things on visible layers [or that are not otherwise 'hidden'].
So if you have componentized your model either export the individual components as external SKPs and export those as separate OBJ/MTL files, or use on/off layers [and scene-tabs to remember them etc] in the Model to keep the relative relationships of the geometry/objects... and then export them as named sets...
Make an OCS with the latest Octane version and manually add multiple OBJ nodes etc using these named sets...
Use the new Octane functions as detailed in the other links already given to make them all active etc...


TIG,
I was not precise in my question - my fault. In my simple example there is a cube (component) copied into 10x10 wall and again as a component copied along elliptical path. I can export it as an entire .obj into Octane (.obj is about 70MB, 41mb of vram). Now assume that every single cube is replaced by 1 million poly shape. Now, how to export such model into Octane? If this is not supported yet, will it be? Or is possible to retrieve coordinates for a scatter node for all of these cubes in Sketchup?

As roeland says:
For a translation:
[1, 0, 0, tx]
[0, 1, 0, ty]
[0, 0, 1, tz]
[0, 0, 0, 1]

The scatter node will contain these 12 values:
1 0 0 tx 0 1 0 ty 0 0 1 tz


The intent is that these values will get exported from modeling applications.

Or if this is a question to the great Octane Team - if and when exporting of SU components as instances will work automatically?

smicha

Re: Components and instancing in 1.025

PostPosted: Wed Aug 01, 2012 9:40 am
by TIG
At the moment Octane accepts OBJ files - which consist of triangulated facets with vertex/material data linked into MTL file materials - in the case of this Sketchup Exporter these facets are grouped by 'material' and by 'container' [model/group/instance/image] etc.
In a SKP as well as faces within a container [group/instance], the container itself can also be given a material and any faces without materials inside it are then displayed using the container's material - this means you can have several instances that look quite different, but which will use the same component-definition !
Also as well as changing the location of any instance you can also rotate/mirror and scale it - meaning an instance might look quite different from its siblings.
All of this is accounted for in the export to exported OBJ file by treating everything as independent objects.
If Octane were [in the future] able to accept 'instancing', then I think it would either require a format other than OBJ... OR the individual containers would need exporting as separate OBJ files, then importing them as separate nodes into one grand-OCS...
But then the many instances would appear as individual nodes too ?
Giving you a very cluttered node interface :?
This is far more complex that it might initially seem.....
:roll:

Re: Components and instancing in 1.025

PostPosted: Wed Aug 01, 2012 10:41 am
by smicha
TIG,
Thank you for your detailed reply. Let's assume I don't want to scale neither rotate copies of my component. I just want to copy it many times (along any shaped path) and "the only" vectors I am looking for are their locations/translations, in the form c1=[x1 y1 z1], c2=[x2 y2 z2], ..., cn=[xn,yn,zn], where "cj" are consecutive copies of my original component, j=1,2,...,n.
My problem is that I can't retrieve [xj yj zj] from Sketchup for each copy of my component. I can only try to input [xj yj zj] values for each translation vector manually which is painful - white cubes are not overlapping yellow ones. And now imagine I have thousands of them.

So my question is: is it possible to get the values of position/translation of copies of a component?

Thank you so much for your time and help,

smicha

Re: Components and instancing in 1.025

PostPosted: Wed Aug 01, 2012 1:37 pm
by smicha
TIG,
Plugin for Sketchup is desired :)

Here is my idea how it would work:
Let's call it: "Components location and rotation to Octane csv"

1. Create a component. Copy it N times along any path - curved lines, etc. Each copy is translated and/or rotated. Scaling individuals is impossible.
2. Select all/desired copies of the same component.
3. Go to plugins -> "Components location and rotation to Octane csv"

In .csv file each line has 12 numbers representing rotation and translation (as roeland explained), and the .csv file has N lines for each copy of the component.

4. Import into Octane a single component and connect it to a scatter node with exported csv file.

Is is possible to write such plugin?

Re: Components and instancing in 1.025

PostPosted: Wed Aug 01, 2012 2:56 pm
by TIG
The x/y/z location [and axes etc] of any component-instance is easily got from its 'transformation'.
xyz = instance.transformation.origin.to_a
This is in inches and Octane swaps y/z axes compared to Sketchup, so you need to post process the 'xyz'...
Something like xzy = [xyz.x.to_m, xyz.z.to_m, -(xyz.y.to_m)]
You can iterate the instances and compile an array of the xzy arrays.
Then how might you use it ?
Manually typing in for each seems tiresome in the extreme !

Re: Components and instancing in 1.025

PostPosted: Wed Aug 01, 2012 3:59 pm
by smicha
TIG wrote:Then how might you use it ?
Manually typing in for each seems tiresome in the extreme !


The idea is to upload a csv file or to paste a 12xN matrix, not to do it manually - please see a screenshot.

I don't know how to use the code you sent but if you could be so kind and write step by step instructions how to get coordinates of all or selected copies of a component I'll export it into Matlab or R-project and write my own code to transform coordinates from sketchup into 12xN matrix.