Arnold for Maya Forum
Rendering with Arnold in Maya using the MtoA plug-in.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Post Translation Callback

Message 1 of 4
464 Views, 3 Replies

Post Translation Callback


We are noticing an issue when running Arnold IPR in Maya in combination with a `Post Translation` callback.

We setup our environments we gpuCache nodes pointing to the proxy representation of the assets. All representations of the asset and their respective paths on disk are stored on `mtoa_constant` attributes on the gpuCache shape node. At render-time we swap the proxy path on the alembic procedural with the path of the render representation of the asset. This is done through a script in the `Post Translation` callback.

This is all working fine, until we jump to another frame, triggering an update of the IPR. When this happens, Arnolds seems to fallsback to the proxy paths. Is feels like Arnold is translating the scene and storing the result in memory, prior to running the post translation callback. Then, when we jump frame, it seems to fallback to the result stored in memory, discarding all changes made in the callback.

My question: Is there a way to ensure that the effects of the callback are not discarded when jumping frames?

I'm aware that the aiStringReplace to achieve a similar proxy-switching behavior. However, this is name pattern based, which is a bit implicit. We went with our callback approach to be more flexible and explicit.

Here is a snipped of the code ran in the callback:

node_it = AiUniverseGetNodeIterator(AI_NODE_SHAPE)
while not AiNodeIteratorFinished(node_it):
    node = AiNodeIteratorGetNext(node_it)
    if ai.AiNodeIs(node, 'alembic'):
        purpose = 'render'
        render_parm = AiNodeLookUpUserParameter(node, purpose)
        if render_parm:
            render_asset = AiNodeGetStr(node, purpose)
            if not render_asset:
                AiMsgWarning('Value for "%s.%s" is null.',
                             AiNodeGetName(node), purpose)
            AiNodeSetStr(node, 'filename', render_asset

Tags (2)
Labels (2)
Message 2 of 4
in reply to: Anonymous

Hi Arlon, yes currently the post-translation callback gets only invoked once for a render.

If you change anything in the scene during an IPR session it doesn't get invoked anymore. And jumping from one frame to another has exactly the same effect as interactively modifying the animated nodes.

We decided not to invoke the callback during IPR changes, because it could cause lots of problems too. The callback wouldn't know what exactly got modified, so depending on the changes you want to do, applying the post-translation changes over and over on the same nodes that were not modified at all could be both overkill or even produce incorrect results.

As you pointed out, going through operators would be much much more efficient and appropriate in this case. If the aiStringReplace isn't doing the job, maybe we need to extend it or create a new one for this use case ?

I guess you noticed that doing "update full scene" in the arnold renderview (ctrl-u) would re-export the full scene and therefore probably solve your issue, but I understand you don't want to re-export the scene for every frame.

Message 3 of 4
in reply to: Anonymous

On a more generic note, it's possible to have a proxy VS render representation with alembic going through aiStandins, there's something meant just for that.

If you have one aiStandin loading the render-version of the alembic file, and enable the attribute "Ignore Group Nodes", it means that everything below the hierarchy of this standin will be ignored by arnold. So you can have another standin (or gpuCache or any geometry) that loads the proxy representation, and that has the first standin as a parent.

This way you'll have the proxy geometry displayed in the viewport, but the render geometry rendered by arnold

Message 4 of 4

Hi Sebastien,

Thanks for the fast responds! I'll definitely give the aiStandin approach a try to see if this could work for us. If not, I'll get back to you and we could discuss other options.

Many thanks.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums