Skip to content

Forward alpha channel in color4 RgbToHsv and HsvToRgb#2838

Closed
mvanhorn wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
mvanhorn:fix/color4-hsv-alpha-passthrough
Closed

Forward alpha channel in color4 RgbToHsv and HsvToRgb#2838
mvanhorn wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
mvanhorn:fix/color4-hsv-alpha-passthrough

Conversation

@mvanhorn
Copy link

The color4 variants of mx_rgbtohsv and mx_hsvtorgb hardcode the
output alpha to 1.0 instead of forwarding _in.a. Per the MaterialX
spec, the alpha channel should pass through unchanged during color space
conversion.

Fixed in both GLSL (genglsl/) and OSL (genosl/) implementations.
The color3 variants are unaffected (no alpha channel).

Files changed:

  • libraries/stdlib/genglsl/mx_rgbtohsv_color4.glsl: 1.0 -> _in.a
  • libraries/stdlib/genglsl/mx_hsvtorgb_color4.glsl: 1.0 -> _in.a
  • libraries/stdlib/genosl/mx_rgbtohsv_color4.osl: 1.0 -> _in.a
  • libraries/stdlib/genosl/mx_hsvtorgb_color4.osl: 1.0 -> _in.a

As noted in the issue, this also fixes the inherited bug in HsvAdjust
(which is a node graph using RgbToHsv and HsvToRgb).

Fixes #2765

This contribution was developed with AI assistance (Claude Code).

The color4 variants of RgbToHsv and HsvToRgb hardcoded the alpha
component to 1.0 instead of forwarding the input alpha. Per the
MaterialX spec, the alpha channel should pass through unchanged.

Fixed in both GLSL and OSL implementations.

Fixes AcademySoftwareFoundation#2765
@linux-foundation-easycla
Copy link

CLA Not Signed

@mvanhorn
Copy link
Author

Closing - the EasyCLA check requires CLA authorization that I haven't completed. The fix itself is correct (all build checks pass). Happy to resubmit after signing the CLA, or feel free to pick up the 4-line change.

@mvanhorn mvanhorn closed this Mar 22, 2026
@jstone-lucasfilm
Copy link
Member

This looks really promising, thanks @mvanhorn. If you'd like to proceed with this proposal, you can just reopen the PR and follow the instructions in #2838 (comment) to resolve the EasyCLA warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect GLSL implementation of color4 typed RgbToHsv, HsvToRgb and HsvAdjust

2 participants