Package limn.render3d
Enum Class ColorSpace
- All Implemented Interfaces:
Serializable,Comparable<ColorSpace>,Constable
How the channel values of a color or texture are encoded. Authoring happens in
SRGB (what image editors and hex colors give you); lighting must run in
LINEAR. The 3D pipeline decodes sRGB inputs to linear in the shader
and lights in linear; the render target stays linear, scene-referred, and
the re-encode to sRGB happens once in the 2D composite, as the tail of the
display transform (exposure, ACES, encode), when the target is drawn. It never
relies on GL sRGB texture formats, kept portable to GLSL ES.
The static helpers are the CPU reference for the same piecewise transfer function the shaders implement (IEC 61966-2-1): the decode in the 3D pass, the encode in the composite; they exist so the conversion can be unit-tested headless and reused where a color must be linearized on the CPU.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic floatdisplayTransform(float linear, float exposure) The whole display transform for one channel: exposure, thentonemapAces(float), thenlinearToSrgb(float).static floatlinearToSrgb(float c) Encodes one linear-light channel in [0,1] back to sRGB (the display OETF).static floatsrgbToLinear(float c) Decodes one sRGB-encoded channel in [0,1] to linear light.static floattonemapAces(float x) The ACES filmic curve (Narkowicz's fit), clamped to [0,1], the shoulder that maps unbounded scene-referred light onto a display's range.static ColorSpaceReturns the enum constant of this class with the specified name.static ColorSpace[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SRGB
Gamma-encoded (perceptual). Base-color textures and authored colors live here. -
LINEAR
Physically linear. Lighting math and render targets accumulate here.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
srgbToLinear
public static float srgbToLinear(float c) Decodes one sRGB-encoded channel in [0,1] to linear light. -
linearToSrgb
public static float linearToSrgb(float c) Encodes one linear-light channel in [0,1] back to sRGB (the display OETF). -
tonemapAces
public static float tonemapAces(float x) The ACES filmic curve (Narkowicz's fit), clamped to [0,1], the shoulder that maps unbounded scene-referred light onto a display's range. Input is linear light with exposure already applied. -
displayTransform
public static float displayTransform(float linear, float exposure) The whole display transform for one channel: exposure, thentonemapAces(float), thenlinearToSrgb(float). Scene-referred linear light in, display-referred sRGB out.This is the CPU mirror of the transform the 2D composite applies when a render target is drawn, and it exists so that reading a target back produces the picture that was on screen rather than an approximation of it. The two implementations must agree: changing the curve on one side and not the other makes an exported image differ from the window it came from, with nothing to point at.
- Parameters:
linear- one linear-light channel, straight (not premultiplied); may exceed 1exposure- the exposure the pass was given
-