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:
@@ -69,6 +69,11 @@ export function TileMesh({
|
||||
}) {
|
||||
const texture: THREE.Texture | null = url ? useTexture(assetUrl(url)) : null;
|
||||
|
||||
// Tile 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;
|
||||
|
||||
// Build the extruded geometry from the tile shape. When `stretch` is false
|
||||
// and a texture is available, scale the shape to the image's aspect ratio so
|
||||
// the tile matches the source proportions instead of being square. Shared
|
||||
|
||||
Reference in New Issue
Block a user