Replies: 1 comment
-
@pleprince some relevant links: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
OSL metadata standardisation proposal
Draft 1
Table of contents
Motivation
User interfaces are important for usability and enforcing conventions across DCCs goes a long way towards makintg artists' work easier.
Currently, OSL defines only a few metadata keywords, representing a subset of Katana's UI capabilities. Then, there are all the other DCCs like Houdini, Maya, Cinema4D, Blender, etc, which support either none, a subset or an entirely different set of UI metadata keywords.
This area is ripe for standardization and having implemented many of these keywords in RenderMan for Maya, I am confident this would greatly improve user experience at a reasonnable cost.
The emphasis of this proposal is to define a somewhat minimal set of UI hints that may be supported by most DCC applications.
Support levels
Given the number of controls to implement, it may be useful to introduce support levels.
One would hope that developers implements at least the basic level, as it would already provide a reasonnable user-experience.
As of today:
Common keywords
These keywords are supported by all widgets.
label
help
readOnly
connectable
page
Assign the parameter to a page defined as a dot-separated path, i.e. "Specular.Advanced".
open
Sample code
widget
Defines which widget type will control the parameter. All parameter types default to a sensible widget if un-defined in the metadata block.
Widget:
null
Parameters using a
null
widget are invisible in the UI.Sample code
Widget:
number
A widget for editable numeric values. This is the default widget used for number parameters.
min
max
digits
slider
slidermin
slidermax
Sample code
Widget:
string
Default widget type used for string parameters.
Sample code
Widget:
checkBox
An int parameter displayed as a boolean check box.
Sample code
Widget:
color
A widget used to edit color parameters.
color_enableFilmlookVis
1color_restrictComponents
Sample code
Widget:
popup
Display a pop-up menu or combox box with literal choices for a string parameter.
options
"One|Two|Three"
editable
Sample code
Widget:
mapper
An menu presenting associative choices (like enums) for int, float and string parameters.
options
Sample code
Widget:
fileInput
A string attributes containing a file path. There should always be an associated button to open a file browser and select the file.
fileTypes
"tex,tx,exr"
, to filter the dialog's file list.assetDialog
Sample code
Widget:
colorRamp
Note
OSL's spline interpolation shadeops only work on static arrays when most users actually want dynamic arrays. This forces the shader writer to copy multiple dynamic arrays to static arrays. I don't know the exact cost of that operation but it would be great to get rid of this limitation.
Note
Start and end knots need to be repeated n-times depending on the interpolation scheme. It would be nice to add an option flag to let the spline shadeop automatically select the correct number of repetitions.
Note
It would be good to make sure DCC app widgets support all standard OSL interpolation modes. Last time I checked Maya did not, blender used other bases, etc.
Note
Do we really want to support per-knot interpolation bases ?
Color ramps depend on multiple parameters to provide knots position, knots value and knots interpolation.
The main parameter is an int parameter with a
colorRamp
widget. Its value is the number of currently used knots. This representation allows support of fixed-size ramps.The metadata MUST define 3 additional keywords (
rampKnots
,rampColors
andrampInterp
) to be functional. If any of theme is missing, an error should be raised.Note
Should we extend oslc to validate metadata ?
rampKnots
rampColor
rampInterp
rampHeight
Sample code
Widget:
floatRamp
The main parameter is an int parameter with a
colorRamp
widget.The metadata MUST define 3 additional keywords (
rampKnots
,rampColors
andrampInterp
) to be functional.rampKnots
rampColor
rampInterp
rampHeight
Sample code
Arrays
OSL support array parameters of any types and the metadata allows writers to decide which widget should be used.
size
Dynamic arrays: the number of existing members on node creation. Defaults to -1 for empty.
isDynamicArray
uiStruct
tupleSize
tupleGroupSize
Sample code
Conditional visibility or locking
These keywords allow to control a parameter's visibility or editability based on the value of one or more shader parameters. The comparison rules are defined as a set of pair-wise comparisons:
prefixPath prefixOp prefixValue
orprefixLeft prefixOp prefixRight
Note
Katana uses
conditionalVis
/conditionalLock
but I prefer a shorter keyword as it is still descriptive enough. TBD.Note
Pages should also support conditional visibility and locking.
How about
pageVis*
andpageLock*
?The keyword structure is as follows:
vis
orlock
.Op
,Path
,Value
,Left
,Right
.vis*Path
vis*Op
vis*Value
lock*Path
lock*Op
lock*Value
equalTo
notEqualTo
greaterThan
lessThan
greaterThanOrEqualTo
lessThanOrEqualTo
and
or
Sample code
DCC app integration
Occasionaly, OSL shaders need to carry more metadata to make integrate with host applications.
*_nodeID
tags
*_attribute
hidden
niceName
Sample code
Footnotes
This is a Katana-ism and I would prefer something more generic like
color_managed
that doesn't mention "film". ↩Beta Was this translation helpful? Give feedback.
All reactions