fix(web): decode textures as sRGB in 3D viewers
TextureLoader leaves colorSpace as NoColorSpace, so card, tile, token, model, and part art is uploaded as linear and then double-decoded in the shader, washing out contrast. Mark each texture sRGB so the GPU decodes it once, correctly.
This commit is contained in:
@@ -48,6 +48,11 @@ export function TokenMesh({
|
||||
}) {
|
||||
const texture: THREE.Texture | null = url ? useTexture(assetUrl(url)) : null;
|
||||
|
||||
// Token art is sRGB-encoded; `TextureLoader` leaves `colorSpace` as
|
||||
// `NoColorSpace`, which double-decodes it in the shader and washes out
|
||||
// contrast. Mark it sRGB so the GPU decodes it once, correctly.
|
||||
if (texture) texture.colorSpace = THREE.SRGBColorSpace;
|
||||
|
||||
// Trace the image's alpha channel into a shape. Suspends until the trace
|
||||
// resolves so the surrounding Suspense boundary (and `Bounds`) only mounts
|
||||
// once the token geometry is present. Falls back to a circle when there's no
|
||||
|
||||
Reference in New Issue
Block a user