OSL getmessage/setmessage



Hi everyone!

I'm a R&D engineer at Illumination MacGuff, and i'm currently trying to use the setmessage() / getmessage() feature from OSL.

To provide a bit of context: we are creating an OSL shader to read our volume files using an override of the RendererServices::texture3d() function for the lookup in the file.

From this OSL shader, we would like to provide some additional arguments to the texture3d() call, and get back some informations from this call which are not in the available values returned by texture3d().

Maybe it is a bad idea - feel free to give me your advice - but we are trying to use setmessage() and getmessage() to do it, and the second part actually works very well: thanks to an override of the RendererServices::getmessage(), we can use the "trace" source to communicate between functions in RendererServices and the OSL shader.
So we succeed to retrieve additional outputs from texture3d() with something like that:

result = texture3d(...);

getmessage("trace", "texture3d_out0", out0);

getmessage("trace", "texture3d_out1", out1);


But the first part is problematic, because the setmessage() feature seems to be private. There is no available definition of setmessage() in RendererServices, so we can't override it to use the "trace" source.
Ideally we would like to use it like that:


setmessage("trace", "texture3d_arg0", arg0);
setmessage("trace", "texture3d_arg1", arg1);
result = texture3d(...);

Maybe there is an other way to communicate from an OSL shader to a RendererServices functions?

Thank you for your help.
Kind regards,


Join osl-dev@lists.aswf.io to automatically receive all group messages.