What do we need to implement for a custom filter (as in A_FILTER_NODE_EXPORT_METHODS type filter) to appear in the render settings dialog in Maya?
Does it need a translator? What type and how should this be registered?
Cheers,
Alan.
Solved! Go to Solution.
Solved by alan-LFL. Go to Solution.
You can just put the filter plugin in ARNOLD_PLUGIN_PATH, and it should show up in the filter list.
The filter metadata in plug-ins\mtoa.mtd looks like this:
[node gaussian_filter] maya.attr_prefix STRING "" maya.translator STRING "gaussian" [attr width] default FLOAT 2.0
but as far as I can see, there's no actual translator needed. There's just one general translator for the aiAOVFilter nodes.
Hi Stephen,
Thanks very much. That's the approach I used, but it doesn't populate. Any chance you could provide a reference example that works for me to debug mine against?
Mine is using multiple shaders in one library (others come through okay), running kick -nodes against the library shows it listed. I'm not using mtd files, but instead the callbacks without the library to provide the metadata (though that's working for the other non-filter shaders).
Any advice on debugging as on the face of it, things seem correctly setup, but must be missing something.
Cheers,
Alan.
Oh, one more thing, I don't require a width parameter, so don't have one. Though neither does the box filter, so I assumed that'd okay.
If kick loads the filter node, then I expect you would see it being loaded in the MtoA Arnold log too.
I would try with a metadata file. Because that's the only other thing you usually have to do. And it looks like MtoA uses mtoa.translator to populate the filter list.
There's an example filter here: https://docs.arnoldrenderer.com/x/cQAnAg
But again, since kick loads your custom filter, Arnold in Maya should load it.
I'd used that for reference, though it uses old APIs in node_finish (there is no AiFilterDestroy(AtNode * node) in the API from what I can see). That one also doesn't have an mtd file. So looking at other types there's a bunch of info I'm not sure whether I need ( I see maya.translator rather than mtoa usually - are both used on different types?).
Various metadata entries it's unclear what or if I need to set values for are mata.attr_prefix, maya.classification, and maya.type. I've assumed that maya/mtoa.translator should just be set to the name of the node.
BTW, I'm trying building the source as is - in a stand alone project, even without any mtd, it is recognized. So trying to port it into my source and debug further.
I meant to type maya.translator
You shouldn't need anything but what the other built-in filters use, and maya.translator should be the name of the node
Okay, so I have something appearing in the list now. I had to actually remove setting the metadata in my shader (so no mtd file and no setting the equivalent data in c++ now).
However, it seems mtoa ignores the index in a library for multi-shader. So the name the entry my filter gets in the menu now is the name of the first shader in the file (which isn't even a filter in this case).
Thanks for the details on what to expect. I'll try put together a sample that repros this to pass your way.
Thanks @Stephen Blair,
Finally got to the bottom of it. To create it, you make a shader, the custom gaussian sample code (minus the filter destroy call will do). Then, add the maya.translator (and maybe also requires attr_prefix set to empty - haven't tested that, but have been doing it).
At that point you're good. If you try copy the pattern from other types of adding maya.name metadata, then the node never gets populated in the list. I've assumed from that, it also doesn't require a maya node name, so not putting a maya.id.
With that done, the value from maya.translator is added to the filter list in settings and when selected provides your parameters 🙂
That would be great. If you could add some more explicit instructions on the formatting for the AOVs in AiFilterInitialize as well, that would be awesome. I found how to handle float and color AOVs in the cryptomatte source, but having trouble guessing the appropriate format for vector types, such as P, N etc.
Cheers,
Alan.
P is VECTOR
node_initialize { static const char* req_aovs[] = { "VECTOR P", NULL }; AiFilterInitialize(node, false, req_aovs); }
Here's a list of AOVs with their types:
C:\solidangle\mtoadeploy>2020\bin\kick -laovs -i Nul Available aovs: Type: Name: LPE: -------------------------------------------------------------- VECTOR2 motionvector (~) RGBA RGBA C.* VECTOR N (~) FLOAT Z (~) RGB direct C[DSV]L RGB emission C[LO] RGB indirect C[DSV][DSVOB].* VECTOR Pref (~) RGB albedo C[DSV]A RGB background CB RGB diffuse_direct C<RD>L RGB denoise_albedo ((C<TD>A)|(CVA)|(C<RD>A)) RGB sss_albedo C<TD>A RGB specular_albedo C<RS[^'coat''sheen']>A RGB diffuse C<RD>.* FLOAT cputime (~) RGB diffuse_indirect C<RD>[DSVOB].* RGB sss_indirect C<TD>[DSVOB].* RGB diffuse_albedo C<RD>A RGBA shadow_matte FLOAT volume_Z (~) RGB specular C<RS[^'coat''sheen']>.* RGB coat_direct C<RS'coat'>L RGB specular_direct C<RS[^'coat''sheen']>L RGB specular_indirect C<RS[^'coat''sheen']>[DSVOB].* RGB volume_direct CVL RGB coat C<RS'coat'>.* RGB coat_indirect C<RS'coat'>[DSVOB].* RGB coat_albedo C<RS'coat'>A RGB sheen C<RS'sheen'>.* RGB transmission C<TS>.* RGB transmission_direct C<TS>L RGB transmission_indirect C<TS>[DSVOB].* VECTOR2 AA_offset (~) RGB transmission_albedo C<TS>A VECTOR P (~) RGB sheen_direct C<RS'sheen'>L RGB volume CV.* RGB sheen_indirect C<RS'sheen'>[DSVOB].* NODE shader (~) RGB sheen_albedo C<RS'sheen'>A RGB sss C<TD>.* RGB sss_direct C<TD>L RGB volume_indirect CV[DSVOB].* RGB volume_albedo CVA FLOAT A (~) FLOAT ZBack (~) RGB opacity (~) RGB volume_opacity (~) FLOAT raycount (~) UINT ID (~) NODE object (~) FLOAT AA_inv_density (~) RGBA RGBA_denoise (~) -------------------------------------------------------------- (~) No opacity blending
Awesome, thanks - it was the exact formatting of the type as upper case rather than matching the Arnold types that took the guess 🙂
Appreciate all the details, when you're updating the docs for that function, it would be great if it mentioned needing the type and name.
Cheers,
Alan