Skip to content

Improve Desaturation Support in Unshaded.frag by using HSV vec3 uniform #2643

@yaRnMcDonuts

Description

@yaRnMcDonuts

color.rgb = vec3(mix(color.rgb, gray, m_DesaturationValue));

Currently we have this float uniform that allows altering the saturation of Unshaded materials (particularly useful for gui components that get grayed in/out depending on a component's state), however the current implementation using this float is non-ideal in cases where the desaturation is faded in/out smoothly, as it requires re-setting the matParam every frame which causes a drop in frame rate (an unavoidable symptom of floats and similar primitive varTypes for matParams). It would be much better to pack this parameter into a vector for proper usage.

So I'm planning on adding support for a an HSV vec3 uniform (hue/saturation/value) which will fix this shortcoming while also adding some extra useful functionality with the addition of hue and value scaling. I'm also considering adding the HSV support to a .glsllib so it can also be implemented into PBRLighting.frag since HSV color editing in-shader is a great feature to have. Modifying a a color in HSV space is much better and gives much more control than simply using the existing Color uniforms as a multiplier which only typically works if the original color is already desaturated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSomething that is supposed to work, but doesn't. Less severe than a "bug"enhancement

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions