question

Luis Fernandes avatar image
Luis Fernandes asked ·

Cannot get OSL diffuse closure output working with Arnold GPU in MtoA

Hi

TLDR; has anyone had any success registering and using a OSL shader with MtoA/Arnold GPU ?

I have a very simple shader, basically the sample *hda* shader given in the Arnold documentation here.

The shader was edited to have the output color parameter replaced by an output closure color parameter.

The release notes of 5.4.0.0 and MtoA 3.3.0.0 mention OSL supporting closures, except texture(), and microfacet based closures (i'm not sure if OSL's native microfacet(), or all microfacet based closures, i.e, microfacet(), Arnold's metal() as defined in Arnold's stdosl.h and so on).

https://docs.arnoldrenderer.com/display/A5ARP/Supported+Features+and+Known+Limitations

Diffuse is of course supported. I can get the node registered by MtoA, shown correctly in the hypershade, and i get correct expected results with the OSL shader when rendering with the CPU.

With the GPU however the object that has the OSL shader produces a consistently black result. Drivers are the latest, 435.13, Linux, the card is a RTX 2060, and GPU rendering works fine. Except OSL.

So, has anyone had any success registering and using a OSL shader with the latest MtoA/Arnold when using the GPU? Care to share a minimal snippet?

I kind of expect this to be a simple error. Like i said, i can render with the CPU, ARNOLD_PLUGIN_PATH is to the directory containing the OSL *.oso files and so on.

2nd attempt at pasting code with the codebox below:

shader hda_01(
    color Cin = color(1, 0.1, 0),
    float exponent = 1.0,
    output closure color Cout = 0)
{
    Cout = Cin * exponent * diffuse(N);
}<br>
mtoashadersgpushaderosl
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Luis Fernandes avatar image
Luis Fernandes answered ·

Hi Declan, Mads. First, thanks for taking your time to take a look at this.

I tried your suggestions, both yours and Mads's (OSL node and Passthrough nodes).

Using a aiOSL node to write the code directly and pass the output to a passThrough shader works fine with a simple OSL UV pattern in both CPU and GPU (a constant color pattern).

Using a aiOSL node to write a minimal diffuse closure shader to pass the output to a aiPassThrough shader also works fine in both GPU and CPU.

Thanks for this.

Where it fails is the single standalone node. The node is loaded, registered, and rendered in the CPU just fine as expected, but nothing happens in the GPU render. Disabling pretty much all optimization options via OSL_OPTIONS (lazy_unconnected, lazy_layers, etc) and enabling all debugging and warning messages, shows everything fine in the CPU rendering.

In the GPU rendering however nothing shows at all in the logs. I'm not sure the issue is in the translator/MtoA side of things, or if there is a specific OSL search path missing - i was just appending the location of the osl|mtd|oso file to ARNOLD_PLUGIN_PATH.

As you requested i attached the minimal scene with all the combinations used. Can you let me know if you manage to render the standalone node there in GPU rendering?

For the sake of completion attached the logs, profiling/debug statistics and detailed logs with OSL_OPTIONS set to pedantic. Drivers are 435.21, card is RTX 2060, vanilla CentOS 7.5. The same issue occurs on a different machine, with different card and earlier drivers).

Thanks once again for taking your time to take a look at this. arnoldgpu-osl-scene.zip


Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Declan Russell avatar image
Declan Russell answered ·

Hi Luis, I manged to get the shader working on my machine on CPU and GPU, though it did take me a little time to figure out how to directly apply an OSL shader to a shape in MtoA. I did this via a passthrough shader. Perhaps there is something in the way you applied the shader that isn't working properly. Could you share your scene/shading network so that I can check it out?

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Mads Drøschler avatar image
Mads Drøschler answered ·

It's this more in line with what you want?
Atleast it returns a valid shader first off, and it multiples the exponent with the color.

It also renders identicallly on CPU/GPU.

Oh never mind, you are talking about .oso.
.oso is not supported in max, so, but anyways, the shader below compiles and works as expected here.

shader hda_01(
    color Cin = color(1, 0.1, 0),
    float exponent = 1.0,
    output color Cout = 0)
{
    Cout = Cin * exponent;
}

wer.gif (357.4 KiB)
Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.