Autodesk / sitoa

Arnold plugin for Softimage
Apache License 2.0
33 stars 16 forks source link

Add OSL-node support #12

Open JenusL opened 6 years ago

JenusL commented 6 years ago

How could / should this be done?

caron commented 6 years ago

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

JenusL commented 6 years ago

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 commented 6 years ago

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.

caron commented 6 years ago

'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?

JenusL commented 6 years ago

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

caron commented 6 years ago

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