sitoa icon indicating copy to clipboard operation
sitoa copied to clipboard

Add OSL-node support

Open JenusL opened this issue 7 years ago • 6 comments

How could / should this be done?

JenusL avatar Apr 19 '18 16:04 JenusL

First, .osl files that are on disk that are present during startup work right? SItoA asks Arnold what shaders are available and generates shader nodes/UIs, correct?

Second, is this about a generic osl code shader? If so, then I would use the Text Editor widget (can it be used in shader nodes, I don't know).

http://download.autodesk.com/global/docs/softimage2014/en_us/sdkguide/index.html?url=files/cus_ppg_TextEditorWidget.htm,topicNumber=d30e19362

caron avatar Apr 19 '18 19:04 caron

First, .osl files that are on disk that are present during startup work right? SItoA asks Arnold what shaders are available and generates shader nodes/UIs, correct?

I wasn't aware of this but reading the docs now and yes that should already work.

So what we need is a text editor and the PPG to update after a change. I actually think I would prefer just an Edit button that opens the .osl in the script editor instead of a widget. And after a save, we need a Reload button, or that it senses that the .osl has changed and updates the PPG automatically. So this might be much simpler than first thought.

So... Text Widget or Edit in script editor?

JenusL avatar Apr 19 '18 20:04 JenusL

So since this is the first time I read about how osl works in Arnold I didn't really know what we needed until now. Since Arnold already finds .osl files in it's search paths, maybe this issue should focus on the implementation of the osl-node instead. Here's the kick output:

kick -info osl
node:         osl
type:         shader
output:       (null)
parameters:   3
filename:     <built-in>
version:      5.1.0.0

Type          Name                              Default
------------  --------------------------------  --------------------------------
STRING        shadername
STRING        code
STRING        name

This node can take osl code directly as a string and in that case it need to use the Text Widget in the PPG. But it could also just point to a osl-file with the shadername field. This node has not been automatically created by SItoA. My guess is it's because of the (null) output.

JenusL avatar Apr 19 '18 20:04 JenusL

'shadername' is a path to an osl file? that is a very odd parameter name...

@sjannuz , is there any details about what shadername is/does?

caron avatar Apr 19 '18 20:04 caron

See Manually Loading Shaders here: https://support.solidangle.com/display/A5ARP/OSL+Shaders

JenusL avatar Apr 19 '18 21:04 JenusL

I see... not sure how best to use that.

caron avatar Apr 20 '18 00:04 caron