Community
Arnold for 3ds Max
Rendering with Arnold in 3ds Max using the MaxtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

custom maya shapes and particle instancer

6 REPLIES 6
Reply
Message 1 of 7
froszu
534 Views, 6 Replies

custom maya shapes and particle instancer

I have a custom maya shape (MPxSurfaceShape) with it's mtoa translator (CShapeTranslator).

The thing is basically a viewport geometry locator which exports as procedural:

procedural
{
filename "//mnt/.../foo.ass"
...
}

This all works nice as long as this is a regular maya node.

Now I'd like it to be connected to maya particle instancer.

Maya displays it fine but mtoa refuses to export my node when it's connected to instancer. It just does not show up in ASS file as ginstances.


any thoughts?

this looks like a feature request ?

Tags (1)
Labels (1)
6 REPLIES 6
Message 2 of 7
froszu
in reply to: froszu

A similar issue. My node is put into override set with aiUserOptions attribute with this value:

"declare SomeNumber constant STRING SomeNumber 5"


This "SomeNumber" does not show up in exported ASS file (works ok for aiStandInShape).

I suppose I'm responsible for exporting this stuff myself. Are there any helper procedures or do I need to do this manually ? This would not be easy I suppose.
Message 3 of 7

With procedurals you should use the CProceduralTranslator instead of CShapeTrqanslator.


That being said the particle instancer should just translate to ginstances for you.


It sounds like there may be issues with your code, are you able to share it here? Or would you rather send it through to support@arnoldrenderer.com?



Ashley Handscomb Retallack
Arnold Support Specialist
Arnold Documentation | Arnold Downloads
Message 4 of 7
froszu
in reply to: froszu

Hi Ashley, thanks for reply!

Here's my translator code:

https://pastebin.com/9cnwZ6QY

Message 5 of 7

You need to move some things about, and make sure in the header you are inheriting from the CProceduralTranslator class.

Currently, you are doing all your assignments in CreateArnoldNodes, this is where you only need to be creating the node type. Otherwise any adjustments won't be applied during an IPR session.

AtNode* mfRibArch_mtoa_translator::CreateArnoldNodes()
{
   if (IsMasterInstance())
      return AddArnoldNode("procedural");
   else
      return AddArnoldNode("ginstance");
}

As you are only generating a builtin Arnold procedural node you can just inherit and run the native function from CProceduralTranslator, as this will do the hard work for you.

Instead, move all your parameter editing and current Export function to an ExportProcedural function like so:

void mfRibArch_mtoa_translator::ExportProcedural(AtNode* i_node)
{
    std::string maya_shape_name = GetMayaNodeName().asChar();

    // ass file name - get it from python proc
    std::string fname = expandAssFilePath(maya_shape_name);

    AtNode* procedural_node = AddArnoldNode("procedural");

    AiNodeSetStr(procedural_node, AtString("name"), maya_shape_name.c_str());
    AiNodeSetStr(procedural_node, AtString("filename"), fname.c_str());
    //AiNodeSetBool(procedural_node, AtString("override_nodes"), 0);
    auto visib = AiNodeGetByte(procedural_node, AtString("visibility"));
    AiNodeSetByte(procedural_node, AtString("visibility"), visib);

    ProcessRenderFlags(i_node); # this sets visibility based on standard Arnold properties
    ExportMatrix(i_node);
    ExportLightLinking(i_node);

}

You will also probably want to make sure the maya node had the expected Arnold visibility flags, and as it creates a procedural you may want to be able to attached operators to it.

void mfRibArch_mtoa_translator::NodeInitializer(CAbTranslator context)
{   
    // Adds attribtues for visiblity, and overrides, avialble on standin node
    CProceduralTranslator::NodeInitializer(context); 

    //// operators - to allow operators to be attached to your procedural

    data.name = "operators";
    data.shortName = "operators";
    data.type = AI_TYPE_NODE;
    data.isArray = true;
    helper.MakeInput(data);
}

You can remove your implementation of RequestUpdate and shouldn't need to override NodeChanged and the CProceduralTranslator will do what you are doing on your code plus some other tweaks



Ashley Handscomb Retallack
Arnold Support Specialist
Arnold Documentation | Arnold Downloads
Message 6 of 7
froszu
in reply to: froszu

Hi Ashley

First, thanks for fast reply, much appreciated !


Following your advice I derived my translator from CProceduralTranslator and moved most of code to ExportProcedural() - however this method is not being called on export.

What I try now is to go back to Export() and explicitly call CProceduralTranslator::ExportProcedural() from there.

I am testing on simple scene with two nodes: regular shape and one instance.

The main shape renders fine, but the instance is missing from ASS file, even though I can see the code for "ginstance" branch is being executed.

Any further tips will be greatly appreciated, because now I move blindly in circles...

thanks !


edit: link to code: https://pastebin.com/FNs2EPd2


Message 7 of 7
froszu
in reply to: froszu

* blink *

any more help on this, please ? 🙂

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

Post to forums  

Autodesk Design & Make Report