Components and instancing in 1.025

Forums: Components and instancing in 1.025
SketchUp Integrated Plugin (Integrated Plugin maintained by OTOY)

Components and instancing in 1.025

Postby smicha » Sat Jul 21, 2012 6:18 pm

smicha Sat Jul 21, 2012 6:18 pm
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
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby Tugpsx » Sat Jul 21, 2012 9:04 pm

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

viewtopic.php?f=7&t=22511
Dell Win Vista 32 | NVIDIA Quadro NVS135M | Core2 Duo T7500 2.20GHz | 4GB
CyberPowerPC Win 7 64| NVIDIA GTX660Ti (3G) GTX480(1.5G) | 16GB
Tugpsx
Licensed Customer
Licensed Customer
 
Posts: 1145
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL

Re: Components and instancing in 1.025

Postby TIG » Sun Jul 22, 2012 1:30 pm

TIG Sun Jul 22, 2012 1:30 pm
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
User avatar
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Re: Components and instancing in 1.025

Postby rappet » Tue Jul 31, 2012 9:54 pm

rappet Tue Jul 31, 2012 9:54 pm
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,
User avatar
rappet
Licensed Customer
Licensed Customer
 
Posts: 1962
Joined: Fri Apr 06, 2012 3:57 pm
Location: The Netherlands

Re: Components and instancing in 1.025

Postby smicha » Wed Aug 01, 2012 9:24 am

smicha Wed Aug 01, 2012 9:24 am
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
Attachments
instance2.jpg
instance1.jpg
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby TIG » Wed Aug 01, 2012 9:40 am

TIG Wed Aug 01, 2012 9:40 am
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:
TIG
User avatar
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Re: Components and instancing in 1.025

Postby smicha » Wed Aug 01, 2012 10:41 am

smicha Wed Aug 01, 2012 10:41 am
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
Attachments
cubes1.jpg
trying to retrieve original location of 4 cubes using placements
cubes0.jpg
a component copied 4 times
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby smicha » Wed Aug 01, 2012 1:37 pm

smicha Wed Aug 01, 2012 1:37 pm
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?
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby TIG » Wed Aug 01, 2012 2:56 pm

TIG Wed Aug 01, 2012 2:56 pm
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 !
TIG
User avatar
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Re: Components and instancing in 1.025

Postby smicha » Wed Aug 01, 2012 3:59 pm

smicha Wed Aug 01, 2012 3:59 pm
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.
Attachments
scatter.jpg
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland
Next

Return to SketchUp


Who is online

Users browsing this forum: No registered users and 6 guests

Thu Mar 28, 2024 1:06 pm [ UTC ]