MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Add ability to perform output color transformation as part of shader generation

Open bernardkwok opened this issue 4 years ago • 1 comments

This is a proposal to add in the ability for shader generation to "append" an output transform as part of code generation. In general this would be for a display transform to be applied such as rendering color space to display space.

Currently, the only support is for input color space to rendering color space.

As a simple example a lin_rec709 to srgb_texture injection would be useful for hardware rendering. Especially so in the case where currently a hardware sRGB buffer is being used but may not be available. ( Note: Currently this approach allows for a lower resolution output buffer as the transform is done before writing the pixel to the output buffer. )

The proposed option would live on GenOptions.

If reusable shaders were exposed as definitions then it would also be useful for an alternative approach of performing the transform after rendering, though the buffer rendered to would need to be high enough precision to quantization issues.

bernardkwok avatar Jul 27 '21 11:07 bernardkwok

@bernardkwok This is a good suggestion, and I believe it's well-aligned with the current proposal to move color transforms to standard nodes (most likely with graph-based definitions). This transition should make it much more straightforward to apply color transforms to graph outputs in a renderer, either through custom rendering code or a dedicated setting in GenOptions.

jstone-lucasfilm avatar May 28 '22 23:05 jstone-lucasfilm