Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display issue when pixel value is above float16 max using OCIO #6147

Open
lucienfostier opened this issue Nov 15, 2024 · 1 comment
Open

Comments

@lucienfostier
Copy link
Collaborator

Version: Gaffer 1.5.0.1

Description

When displaying an image in the viewer with pixel value above float16 max value, the pixel will display black instead of clipping as a white pixel.

Steps to reproduce

See below for a basic scene to reproduce the issue.
Daniel Dresser is saying this is related to this comment:

# With the new OCIO2 GPU path, it is now possible to get a perfect match to the CPU path, if you make 2

He was suggesting perhaps we should clamp to float16 max value before sending the values to OCIO.

Debug log

Click to Expand

import Gaffer
import GafferImage
import imath

Gaffer.Metadata.registerValue( parent, "serialiser:milestoneVersion", 1, persistent=False )
Gaffer.Metadata.registerValue( parent, "serialiser:majorVersion", 5, persistent=False )
Gaffer.Metadata.registerValue( parent, "serialiser:minorVersion", 0, persistent=False )
Gaffer.Metadata.registerValue( parent, "serialiser:patchVersion", 1, persistent=False )

__children = {}

__children["Constant9"] = GafferImage.Constant( "Constant9" )
parent.addChild( __children["Constant9"] )
__children["Constant9"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Constant9"]["color"]["r"].setValue( 640000.0 )
__children["Constant9"]["color"]["g"].setInput( __children["Constant9"]["color"]["r"] )
__children["Constant9"]["color"]["b"].setInput( __children["Constant9"]["color"]["r"] )
__children["Constant9"]["__uiPosition"].setValue( imath.V2f( 773.626648, -146.021469 ) )


del __children

@danieldresser-ie
Copy link
Contributor

This is easy to reproduce by dropping an image Ramp node and setting one side of it to a colour of 100 000. Part of the ramp will go black when it goes over 65504.

I haven't yet investigated where this is going wrong - what we'd probably want is to convert a value of 100 000 to the maximum representable float16, but we're probably getting a reserved value of "inf", and then the OCIO gpu code isn't handling that very well. It wouldn't be that hard to clamp before passing to the GPU, but it would be a waste of time to allocate a new buffer for the common case where there aren't values this extreme.

I guess an alternative would be that in our shader, we could detect infs, and skip calling OCIO and pass them through unchanged.

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

No branches or pull requests

2 participants