Community
Arnold GPU Forum
General discussions about GPU rendering with Arnold.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
792 Views, 3 Replies

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>
Labels (5)
3 REPLIES 3
Message 2 of 4
madsd
in reply to: Anonymous

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.

4546-wer.gif

shader hda_01(
    color Cin = color(1, 0.1, 0),
    float exponent = 1.0,
    output color Cout = 0)
{
    Cout = Cin * exponent;
}
Message 3 of 4
DeclanRussell
in reply to: Anonymous

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?

Message 4 of 4
Anonymous
in reply to: Anonymous

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

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

Post to forums  

Autodesk Design & Make Report