Multiple outputs

Multiple outputs

maxtarpini
Collaborator Collaborator
783 Views
4 Replies
Message 1 of 5

Multiple outputs

maxtarpini
Collaborator
Collaborator

I see that both Maya and Houdini for Arnold does not obey the Arnold spec around shader multiple outputs.
https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_user_guide_ac_release_notes_ac_rn_7000_html

Ie. let's say I have three outputs : color, distance and bump.

'color' being the default is indexed as -1 and should not be listed in node_parameters and so it should just appear in the output list in Maya or Houdini.. but it does not. I have to explicitely list it in node_parameters and also index it. Eventually I copy the same output also for -1 to support default.

 

This is not happening in C4DTOA (new editor) for example where the specification is followed correctly.

 

In code this should be something like this : 

 

 

    case SVoronoiOutput::COLOR:     // -1 .. default output
        sg->out.RGB() = AtRGB(Output.Color.x, Output.Color.y, Output.Color.z);
        break;
    case SVoronoiOutput::DISTANCE:  // 0 .. first multiple output
        sg->out.RGB() = AtRGB(Output.Distance);
        break;
    case SVoronoiOutput::BUMP:      // 1 .. second multiple output
        sg->out.FLT() = (Output.Position.x + Output.Position.y + Output.Position.z) /3.f;
        break;

 

 

 

instead to be able to see 'color' output I have to ..

 

 

    case -1:                        // -1 .. default output
        sg->out.RGB() = AtRGB(Output.Color.x, Output.Color.y, Output.Color.z);
        break;
    case SVoronoiOutput::COLOR:     // 0 .. color output
        sg->out.RGB() = AtRGB(Output.Color.x, Output.Color.y, Output.Color.z);
        break;
    case SVoronoiOutput::DISTANCE:  // 1 .. second multiple output
        sg->out.RGB() = AtRGB(Output.Distance);
        break;
    case SVoronoiOutput::BUMP:      // 2 .. third multiple output
        sg->out.FLT() = (Output.Position.x + Output.Position.y + Output.Position.z) /3.f;
        break;
    }

 

 

 

It's not a problem at all because the last code block works cool also for C4DTOA. Maybe some minor cosmetic thing where DCC apz won't have the their usual default name for their default outputs. My main worries is if you plan to keep this thing consistent or not .. meaning if you're aware of this and won't change it later.

Potentially, the bug is : with multiple outputs we have to explicitely add and index a default output too or it won't be exposed in the UI while this is not part of the original multiple output specification.


Makes sense, what do you think ?

Btw, it looks super nice and useful. 

rombonoisevoronoi_multioutputxxx.png

0 Likes
784 Views
4 Replies
Replies (4)
Message 2 of 5

maxtarpini
Collaborator
Collaborator

This is now broken in c4dtoa 4.8.6 (Arnold 7.4.5.0).

It always outputs the default output. 

Just follow the guide here : 
https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_user_guide_ac_release_notes_ac_rn_7000_html

 

node_parameters
{
   AiOutputRGB("green"); // first output is indexed as 0
   AiOutputFlt("pi"); // second output is indexed as 1
}
case 0: sg->out.RGB() = AI_RGB_GREEN; return;
case 1: sg->out.FLT() = AI_PI; return;
case -1: sg->out.RGB() = AI_RGB_BLUE; return;

 

It will always output a blue color regarding of what output we choose.

 

c4dtoa_multioutput_broken.jpg

 

 @peter_howard

 

 

0 Likes
Message 3 of 5

peter_horvath
Autodesk
Autodesk

Hey Max, It is indeed broken when connected directly to the Arnold Material end node. It is working fine when connected to other nodes. For instance in your example if you add a flat shader in between. I'll take a look and fix it in our next release. Thank you.


// Peter Horvath
// C4DtoA developer
Message 4 of 5

peter_horvath
Autodesk
Autodesk

This is actually not a regression, but a limitation. Arnold does not support custom outputs connected directly to shapes. It does not work in Maya either. You need to use an intermediate node as a workaround. The plugin could be smarter though and do this for you under the hood.


// Peter Horvath
// C4DtoA developer
Message 5 of 5

maxtarpini
Collaborator
Collaborator

All cool .. effectively on Maya I was using a color to closure node.

Thanks for the feedback ! 🖖

0 Likes