Zach Coley avatar image
Zach Coley asked ·

Custom shader plugin is unknown to OptixProgramCache

Hi I am building the Shave and a Haircut Arnold shader plug-in for Arnold Core and MtoA 4.0.1 because if you are unaware Epic games acquired shave from Joe alter recently and they are now offering the source code for the entire shave plugin to the community on GitHub.

I have now successfully compiled the Arnold shave plugin for Arnold 6 however at the moment it only works correctly on the CPU. I am exporting a shave hair test scene as an .ass file from Maya 2018 which has Arnold Core and MtoA installed as I can only get the Shave Maya plugin to work on Maya 2018 as that’s the last version that the shave Maya plugin was officially built for and that version of shave only supported Arnold and MtoA

I have all the code to build the shave Maya plugin for Maya 2020 but at the moment I cannot get it to compile and right now I don’t have the time to muck around with all the source code to get it to build, but I do intend to build it for Maya 2020 and maybe also 2019 eventually. But right now I can just build the shave Arnold shader plugin for Arnold 6 and create the required dynamic link library (.dll) as I’m using windows 10 and Visual Studio 2019.

I am compiling a Arnold .exe program which uses the Arnold standalone API, I am not rendering with kick, my program loads the ass file with AiASSload(); where I pass in the file name and AI_NODE_ALL and I return the result of the ass load into a int variable called loadSuccess which equals 0 if the file is successfully found and parsed into Arnold correctly, pretty normal stuff. The ass file is what contains the path to the MtoA shader plugins using options.plugin_searchpath “$ARNOLD_PLUGIN_PATH” which is also where my Arnold 6 shave_shaders-6_0_1_0.dll and simple_shader-6_0_1_0.dll plug-ins are located.

But when Arnold loads in the shave_shaders-6_0_1_0.dll for example with Arnold GPU enabled the console outputs a warning message saying that the shave nodes are unknown to the OptixProgramCache. The .ass file still renders with the shave hair strands actually showing on the mesh object (Arnold curves nodes) but there is no colour where colour is supposed to be, everything is just white? In my shave test scene there is a simple sphere with a shave grass preset on it which is green and the background is white and it is all lit with a Arnold Sky dome light.

I also followed Arnold’s documentation on building a simple shader plugin and ran that on the GPU and got a similar error where the node called “simple” was unknown to the Optix Program Cache.

Link to that simple shader documentation here:

In this doc the output image is supposed to be a red circle in the center with a black background surrounding it but again with Arnold GPU it is just rendered white.

As I said earlier these shaders work absolutely perfectly on the CPU with both Arnold 5 and 6.

So what I can understand is that Arnold GPU caches multiple potential scene object combinations in order to accelerate scene compilation for the GPU prior to rendering, and that it does this with a pre population of the GPU optix cache.

I have figured out that I have to somehow get the pre population cache to read my custom shaders so that they can be included in the cache file so that the optix cache can recognise my shaders and use them in renders in the Arnold standalone renderer.

I looked at the Core C++ API Under the Device API and see that there is a function I can call which will pre populate the GPU cache and I tried running this after my ass file had been loaded along with my plugins but I had no luck it didn’t even work I don’t think. I deleted all the cache and Arnold rebuilt it without me needing to call the pre populate cache function anyway but it didn’t include my shaders.

How am I supposed to resolve these Optix program cache warnings messages and make my images render with colour on both the CPU and GPU? As there is no documentation on building shaders or plugins for Arnold GPU yet. I assume that since Arnold GPU is now production ready that it would now support 3rd party shaders and plugins?

Any help or advise would be greatly appreciated.

Thank you.

kind regards, Zach Coley.

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.

1 Answer

· Write an Answer
Stephen Blair avatar image
Stephen Blair answered ·

Arnold GPU does not support custom shaders yet.

For Arnold GPU, you'd have to use built-in Arnold hair shader. That would work.

2 comments 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.

Would I be able to build a custom hair shader using OSL? Is that now supported on the GPU? Also how can I connect a shader to a shave hair node, I know there is a shader override for the shave Arnold maya extension and it says here:

that you are supposed to connect a different shader to the shave hair using the Maya connection editor, but how do I actually connect a AiStandardHair or OSL shader to the maya shave hair/node using the connection editor? Thanks.

0 Likes 0 · ·

OSL is supported.

In an old .ma file, I see this connection:

connectAttr "aiHair1.out" "shaveHairShape2.ai_hair_shader";

0 Likes 0 · ·

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.