-
Notifications
You must be signed in to change notification settings - Fork 16
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
Linear material colors #36
Comments
Discussion in AFrame repo aframevr/aframe#3757 |
ThreeJS has this still unsolved as of March 2019 Editor: all colors/textures washed out in r102
Suggestion: add a bufferAttribute.convertGammaToLinear method
|
Babylon js has useScalarInLinearSpace but can't find any docs on it. |
Current thinking. Assume float rgba array colors Add gamma correction to What about vertex colors? |
Filament is most clear in the docs 👍
About linear RGB
About pre-multiplied RGB
|
They should be linear KhronosGroup/glTF#1638 |
color.fromHEX("#FF000") -> [1, 0, 0, 1]
color.toLinear(color.fromBytes([255, 0, 0])) -> [1, 0, 0, 1]
var red = color.fromBytes([255, 0, 0])
var red = [r / 255, g / 255, b / 255, 1] // floating point sRGB/gamma color
var linearRed = color.toLinear(red)
var linearishRed = [
Math.pow(r / 255, 2.2),
Math.pow(r / 255, 2.2),
Math.pow(r / 255, 2.2),
1
] // floating point sRGB/gamma color
var linearColorValue = [0, 0, 0, 0]
var colorValueLinear = [0, 0, 0, 0]
ctx.submit(myCommand, {
uniforms: {
uColor: color.convertToLinear(color.set(linearColorValue, colorIn.value)),
uColor: color.fromGamma(linearColorValue),
uColor: color.fromGammaToLinear(linearColorValue, colorIn.value),
uColor: color.fromLinear(linearColorValue, colorIn.value)
uColor: color.toLinear(colorIn.value),
uColor: color.toLinear(colorIn.value, linearColorValue)
}
})
color.getHex(color.toLinear(colorIn.value)) Can we assume all colors coming out of this library are linear? That would require 2.0 rewrite. |
Alternatively we simply add |
EXT_sRGB is included in core in WebGL2 which allows you to autoconver all srgb textures before sampling and no more toLinear calling is needed. So changing all uniform colors to linear would make all our code linear. Downsides: user need to do it's own bookkeeping to know which color is and which one isn't linear. |
EXT_sRGB would be WebGL2 only, as there are issues with mipmap generation in WebGL 1: PS: WebGPU has |
Another reason to deprecate WebGL1 in v4 |
Compare with gltf as I think we have gamma colors and gltf has linear https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material
The text was updated successfully, but these errors were encountered: