Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Using Arnold procedural nodes in USD files

144 views
Skip to first unread message

Szabolcs Horvátth

unread,
Feb 6, 2025, 4:40:29 AMFeb 6
to gaffer-dev
Hi,

I tried doing a USD scene setup that is usable in both Maya, USDView and Gaffer, when using the same Arnold renderer. One thing that I couldn't get to work are Arnold procedural nodes: no matter what I tried, the USD file exported from Maya only renders in Maya. 
USDView displays the nodes and attributes, but does not render the procedural, while Gaffer simply displays an empty scene. The exported USD file refers to the nodes as ArnoldProceduralCustom type, and I'm not sure if that is some custom schema that only the Maya USD plugin understands or something more generic that I failed to use properly.

The rendering does work if I use an external procedural node in my Gaffer graph, but that beats the purpose of having a generic USD setup.

Is there something I miss, or is it a limitation of Gaffer right now?

Cheers,
Szabolcs

John Haddon

unread,
Feb 6, 2025, 4:51:14 AMFeb 6
to gaffe...@googlegroups.com
If you export a Maya mesh using this same process, what do you end up with in the USD file? A "Mesh" or an "ArnoldPolyMesh"? If the latter, then what you're looking at could best be described as a "USD flavoured ASS file". It seems unlikely that anything except Arnold is going to be able to consume those - they're way outside the standard USD representation. But if your USD file is standard in all other ways, then there's a chance we can make the ArnoldProceduralCustom work. Maybe you could post a minimal example containing a mesh and a procedural?
Cheers...
John

--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gaffer-dev/4415c289-b695-41ab-bddd-e26fc4a84aa4n%40googlegroups.com.

Szabolcs Horvátth

unread,
Feb 6, 2025, 1:15:21 PMFeb 6
to gaffer-dev
Hi John,

I created USD files with procedurals using two different methods:
- Tried exporting from Maya using the Arnold API to write a .usda file directly.
- Exported a renderable .ass file, than used the kick executable to re-save the scene to a .usda file.
Both methods created similar nodes and both of them was renderable in Maya using the USD plugin. The mesh node was exported as type "Mesh" while the procedural node is "ArnoldProceduralCustom".

My test was done using the Yeti hair procedural node, but perhaps it would be easier and more straightforward using the builtin alembic procedural, because Yeti is a 3rd party plugin.

This is how the exported node looks in the usda file:

def ArnoldProceduralCustom "pgYetiMaya_hair_test"
{
    float arnold:density = 10
    string arnold:filename = "/somefakepath.2361.fur"
    int arnold:frame = 2361
    string arnold:node_entry = "pgYetiArnold"
    float[] arnold:samples = [2361]
    int arnold:verbosity = 1
    rel material:binding = </mtl/hairMaterial>
    float primvars:min_pixel_width = 0 (
        elementSize = 1
        interpolation = "constant"
    )
    int primvars:mode = 0 (
        elementSize = 1
        interpolation = "constant"
    )
}

Based on the render output there is no sign of the procedural's execution, so I assume that it's not the interpretation of the attribute that fails, but the node is missing from the scene.

Cheers,
Szabolcs

Nico Rehberg

unread,
Feb 7, 2025, 5:39:46 AMFeb 7
to gaffer-dev
I'd also be interested in this. For Yeti but also for handling some things via standIns through USD. They do look like this when exported from Maya:

#usda 1.0
(
    defaultPrim = "aiStandIn"
    framesPerSecond = 25
    metersPerUnit = 0.01
    timeCodesPerSecond = 25
    upAxis = "Y"
)

def ArnoldProcedural "aiStandIn" (
    kind = "assembly"
)
{
    asset arnold:filename = @/path/cube.ass@
    float3[] extent = [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)]
    string primvars:dcc_name = "aiStandInShape" (

        elementSize = 1
        interpolation = "constant"
    )
}

This loads and renders fine back in Maya, but Gaffer just ignores the entry I guess.

Cheers,
Nico

Szabolcs Horvátth

unread,
Feb 14, 2025, 4:27:55 AMFeb 14
to gaffer-dev
Hi John,

Is there anything we can help with regarding this issue? I can provide a complete renderable example using Arnold's alembic procedural if that helps the process at your end.
Or should we look into the source code of Gaffer and try to come up with a PR? In this case providing a few pointers where to start the investigation would be much appreciated!

Cheers,
Szabolcs

On Thursday, February 6, 2025 at 10:51:14 AM UTC+1 John Haddon wrote:

John Haddon

unread,
Feb 14, 2025, 4:48:22 AMFeb 14
to gaffer-dev
Hi,

Sorry for the delay in getting back to you. I was hoping to find some spare moments to investigate doing this myself, but I have some unusually tight deadlines at the moment and haven't been able to squeeze it in. Let me provide you with some pointers as to how you might start going about it yourself, and see if that gets us anywhere.

In theory it is possible to extend Gaffer's USD support using a plugin, without recompiling Gaffer. There is an `IECoreUSD::ObjectAlgo::registerReader()` function that you can use to register functions for reading specific USD schema types. All Gaffer's existing object conversions are registered in that manner - there is fairly simple example of one in CameraAlgo.cpp. So if you registered something similar against "ArnoldProceduralCustom" and implemented it to return an `IECoreScene::ExternalProcedural` object you should be well on your way.

There are some potential wrinkles though. You mentioned that at the moment the procedural prim isn't even showing up in Gaffer's scene graph. I think that will be because we ignore any non-imageable prims. It looks like ArnoldProceduralCustom inherits from Gprim, which would make it Imageable. But I don't think USD will know that unless you have the Arnold schemas registered in Gaffer, so you might need to build them appropriately and put them on PXR_PLUGINPATH_NAME. Alternatively, you could modify `isSceneChild()` to return true if ObjectAlgo has a converter registered. That might let you load things without having the Arnold schemas available - I don't know much about how USD copes with missing schemas at runtime though.

Hopefully that gives you some pointers. Let me know how you get on...
Cheers...
John

Szabolcs Horvátth

unread,
Mar 17, 2025, 8:39:34 AM (11 days ago) Mar 17
to gaffer-dev
Hi John,

Sorry for the very-very long delay in my answer, I got lost in other Gaffer USD and shader issues and forgot about this one!
Thanks, I looked at the source code examples from your previous mail and I think I understand the process to register the new USD node type. We don't have c++ Gaffer plugin compiling experience yet, so have to do some ground work to have a sandbox for plugin development. If in the meantime there was some development at your end then I'd love to give it a try before we get up to speed in gaffer dev land.

Cheers,
Szabolcs
Reply all
Reply to author
Forward
0 new messages