Closed peeweek closed 2 years ago
I'm changing a bit how the external output file type works. Now there's an option to select either PNG or EXR (independently of the node precision). This allows to save the data from a FP16 directly to PNG and prevent that issue happening in LDR because of the SRGB Conversion. Color Conversion was happening in 8 bit as the node was output in that precision. Instead, the conversion can happen with default precision (FP16) without loss in the darkest tones.
The node has now an option for Texture2d dimension that allows selecting PNG or EXR as file type. Also, changing this type invalidates the update button.
Some weirdness is that EncodeToEXR data can be fed into a PNG, caused me a headache, but finally fixed.
@alelievr : currently the PR is in an acceptable state regarding exported data and previews, however here's a summary of what could be improved:
1) need to find a way to manual color (reverse-)conversion happening at export (because we do a Linear>SRGB conversion in finalOutputMaterial and texture importer also does its own), right now the state of the PR is functional but the code is messy. 2) preview weirdness (low precision), could not find what is causing that.
stuff to do / questions:
Finally I have cleaned up the behavior in external output : no more conversion in finalOutputMaterial, and no more inverse-conversion in C#. Now, the conversion is only handled by the texture importer.
I have added a sRGB Preview System:
Preview can be implemented on any MixtureNode
:
public override bool canEditPreviewSRGB => true|false;
to enable the sRGB toggle in the preview of the nodepublic override bool defaultPreviewSRGB =>true|false;
to define the default preview mode;public bool previewSRGB;
to control it manuallyI've implemented specific behavior in 3 nodes:
TextureNode
has sRGB preview toggle only if input is not a texture with a TextureImporter
, in that case value is read from the sRGB flag in the importerOutputNode
never previews as sRGB, as the finalOutputMaterial handles the sRGB Conversion, it will be previewed correctlyExternalOutputNode
previews depending if the output will be configured with the sRGB flag on. All other conversions were removed.
previewSRGB
, whether it can be edited per nodecanEditPreviewSRGB
, and default valuedefaultPreviewSRGB
(Also added the sRGB toggle to the UIElements schema but it seems it is not used yet)