Get transformation from alembic?

Forums: Get transformation from alembic?
Forum for OctaneRender Lua scripting examples, discussion and support.

Re: Get transformation from alembic?

Postby gardeler » Thu Jan 26, 2017 9:35 am

gardeler Thu Jan 26, 2017 9:35 am
That sounds great Roeland, but I have no idea how to do that. How would I setup the time control? And can I pinpoint a specific object in the alembic file, or do I need to do like in this script, export a specific object with that motion?

Sorry for not knowing anything about lua, or programming in general!
gardeler
Licensed Customer
Licensed Customer
 
Posts: 121
Joined: Fri Feb 22, 2013 5:10 pm

Re: Get transformation from alembic?

Postby ToxicAngel » Fri Oct 19, 2018 6:57 pm

ToxicAngel Fri Oct 19, 2018 6:57 pm
Hi guys,

Forum noobie here asking probably a really stupid question, but...

Since sometimes alembic caches gets huge and heavy, and they are cumbersome at best when you are dealing with heavy geometry rigid objects that don't have any vertex animations etc. , i was wondering if a similar script like cameraTransform.orbx by calus could be written for getting the animation data (rotation,position etc) of an object inside the .abc file.

Introducing a scenario :
Let's say that we have sci-fi alembic scene which has a camera animation but also animation data for some spaceship objects that are moving around the scene.

What i'd like to do - instead of waiting several hours to get HUGE alembic scene exported, i could use dummy objects (like cube or null etc), to tell where the spaceships are and how they are flying around, and later in Octane standalone i would be able to link their animation data to various .obj files that contains the actual hi-poly mesh of the spaceships.
This would also enable the same scene to be used with different types of vessels to be rendered without having to re-export the heavy and cumbersome scene out again.

So - in a nutshell - my question, is this possible - personally i don't know enough about lua / alembic to even get started with this, but if somebody out there has already invented this "wheel", i'd be interested to test it :)!

Cheers, and thanks for the cameraTransform - it already helped me to solve one issue that i kept having :)
ToxicAngel
Licensed Customer
Licensed Customer
 
Posts: 1
Joined: Fri Nov 22, 2013 4:19 pm

Re: Get transformation from alembic?

Postby roeland » Mon Oct 22, 2018 10:49 pm

roeland Mon Oct 22, 2018 10:49 pm
Exporting and importing huge geometry objects is fast in Alembic, the slow part is actually exporting and importing all the transforms.

You can inspect nodes in an geometry archive like in any other node graph. But that is quite complex, Alembic can store arbitrary geometry node structures.

The easiest way (I think) is to copy the contents of the Alembic archive to a new node graph and then replace the data in the copied mesh nodes. But I don’t have a script which does this.

alembicArchive is assumed to be the imported Alembic archive. For an automated script an easy way to get a specific archive in a scene is to find it by name:

Code: Select all
local alembicArchive = octane.project.getSceneGraph():findItemsByName("name.abc")[1]


Then make the copy and find the mesh nodes in that copy

Code: Select all
local g = octane.nodegraph.create{ name = "New graph" }
g:copyFromGraph(alembicArchive)
local meshList = g:findNodes(octane.NT_MESH)


What to do with this list of mesh nodes heavily depends on your use case. Eg. you can iterate over that list and load new data:

Code: Select all
for _, node in ipairs(meshList) do
    local obj = ....
    node:setAttribute("filename", obj)
end
User avatar
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1741
Joined: Wed Mar 09, 2011 10:09 pm
Previous

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 2 guests

Sat Oct 19, 2019 8:04 am [ UTC ]