Align OSL image alpha with texture conventions#2985
Open
jstone-lucasfilm wants to merge 1 commit into
Open
Conversation
This changelist fixes the alpha output of the OSL `image` and `hextiledimage` nodes when sampling a file with fewer than four channels. The OSL `texture` function returns zero for channels not present in the file, so a `color4` or `vector4` `image` reading an RGB file returned a transparent rather than opaque result. The fix queries the channel count with `gettextureinfo` and sets the output alpha to one when fewer than four channels are present, matching the GLSL and MSL backends. More broadly, this change aligns the `image` node with the established convention that a missing fourth channel resolves to one, as already followed by the MaterialX `convert` node, the OpenUSD `UsdUVTexture` node, and standard GPU texture sampling. The specification text for the `image` node, previously ambiguous on this point, has been clarified to note the fourth-channel exception.
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This changelist fixes the alpha output of the OSL
imageandhextiledimagenodes when sampling a file with fewer than four channels. The OSLtexturefunction returns zero for channels not present in the file, so acolor4orvector4imagereading an RGB file returned a transparent rather than opaque result. The fix queries the channel count withgettextureinfoand sets the output alpha to one when fewer than four channels are present, matching the GLSL and MSL backends.More broadly, this change aligns the
imagenode with the established convention that a missing fourth channel resolves to one, as already followed by the MaterialXconvertnode, the OpenUSDUsdUVTexturenode, and standard GPU texture sampling. The specification text for theimagenode, previously ambiguous on this point, has been clarified to note the fourth-channel exception.