Skip to content

ebiten: add gamma/degamma option #3314

@hajimehoshi

Description

@hajimehoshi

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

What feature would you like to be added?

I propose to add these members:

type NewImageOptions struct {
    // ApplyDegamma indicates whether [NewImageFromImageWithOptions] degammas the input image color values,
    // assuming the input image color values are non-linear sRGB,
    // so that the image color values on GPU will be linear sRGB.
    //
    // ApplyDegamma is useful if you want faithful rendering calculations and results.
    // See also [RunGameOptions.ApplyGamma].
    //
    // The default (zero) value is false, which means the color values are not converted.
    ApplyDegamma bool
}

type RunOptions struct {
    // ApplyGamma indicates whether the shader for the final rendering applies gamma function to the color values,
    // assuming the color values on GPU are linear sRGB and the expected output color values are non-linear sRGB.
    //
    // ApplyGamma is useful if you want faithful rendering calculations and results.
    // See also [NewImageOptions.ApplyDegamma].
    //
    // The default (zero) value is false, which means the color values are not converted.
    ApplyGamma bool
}

See also #3313.

In v3, I might change the default value to do gamma/degamma by default.

Why is this needed?

In order to get correct rendering results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions