Hello guys, maybe title speaks for itself, but let me explain a little. I do not know how to do scripting, so I am asking for help.
I have a light rig, lets say, some kind of custom reflector, with zeroed transformations and saved in local DB. As I'm working in external application and rendering in Standalone, I export everything with alembic, but somehow lights are always the pain, especially if I want to tweak transformations of them a little.
So, what I need is to alembic export some guide object (I believe that camera is the best suited for that) and extract its transformations and transform my light rig with it. In short: extract transformations from alembic object, and plug that transformation in the transformation pin of Placement node.
I tried to do that with "FromABC2Thin" script that I downloaded here, and I am getting correct position, but there is not correct rotation output.
Thank in advance,
Doca
Get transformation from alembic?
Here it is,
I took some parts from the explodeCamera script node and the camera map script.
Seems to work nicely.
I took some parts from the explodeCamera script node and the camera map script.
Seems to work nicely.

Code: Select all
-- Take an ABC camera as input and extract its transformation
-- the output tranform can be plugged in a placement node for example.
local CamTransform = {}
-- edit this to change the name of the graph
local graphName = "cameraTransform"
local inputs = {}
local outputs = {}
local transform = nil
function CamTransform.onInit(self, graph)
-- camera input pin
local inputInfos =
{
{ type = octane.PT_CAMERA, label = "Camera In", defaultNodeType = octane.NT_CAM_THINLENS },
}
-- transform output pin
local outputInfos =
{
{ type = octane.PT_TRANSFORM, label = "Transform Out" },
}
-- register the pins
inputs = graph:setInputLinkers(inputInfos)
outputs = graph:setOutputLinkers(outputInfos)
-- create the transform_value node
transform = octane.node.create{ type = octane.NT_TRANSFORM_VALUE, name = "Transform Value" }
outputs[1]:connectToIx(1, transform)
self:setEvaluateTimeChanges(true)
graph.name = graphName
graph:unfold()
end
-- extract camera matrix
function convertInputs()
local cameraNode = inputs[1]:getInputNodeIx(1)
if cameraNode ~= nil then
local pos = cameraNode:getPinValue(octane.P_POSITION)
local target = cameraNode:getPinValue(octane.P_TARGET)
local up = octane.vec.normalized(cameraNode:getPinValue(octane.P_UP))
local Z = octane.vec.normalized(octane.vec.sub(target, pos))
local X = octane.vec.normalized(octane.vec.cross(up, Z))
local Y = octane.vec.normalized(octane.vec.cross(Z, X))
matrix = {
{X[1], Y[1], Z[1], pos[1]},
{X[2], Y[2], Z[2], pos[2]},
{X[3], Y[3], Z[3], pos[3]},
}
transform:setAttribute(octane.A_TRANSFORM, matrix)
end
end
function CamTransform.onEvaluate(self, graph)
convertInputs()
end
return CamTransform
Pascal ANDRE
This is actually one of the things I have missed the most in octane!! BUT it does not work with motionblur? Can that be solved? Also, the Z axis of my object got inverted, but I could work around that with a negative scale on a different place node.
If you want animated data, you can copy any node to a private root node graph in your script, and vary the time of that root node graph to evaluate that node at arbitrary time stamps. In case of nodes inside an alembic archive, these values will be loaded from the Alembic file.
--
Roeland
--
Roeland