Skip to content

Wrong color space in the Image abstraction? #613

@GuillaumeAmat

Description

@GuillaumeAmat

Describe the bug

I'm trying to use the Image abstraction, in order to load images on planes, but the loaded images are rendered more bright than they really are.

Even the official documentation has the same display issue:

Original asset Documentation display
Image

Why am I considering the color space as root cause?

I've seen that the Image component has a color prop, which has white as default value. This color seems to be used as multiplied color, over the loaded asset.

When tweaking it to another color, it applies it to the assets in the canvas.

I looked for issues and discussions, and found a similar behavior here: https://github.com/orgs/Tresjs/discussions/739

The contributor solved his issue by applying the SRGBColorSpace color space (though, their issue is not related to Image, but to useTexture).

Reproduction

https://cientos.tresjs.org/guide/abstractions/image.html

Steps to reproduce

Go to the official documentation, or use the given snippet:

<script setup lang="ts">
import { NoToneMapping, SRGBColorSpace } from 'three'
import { TresCanvas } from '@tresjs/core'
import { Image, OrbitControls } from '@tresjs/cientos'

const gl = {
  clearColor: '#82DBC5',
  outputColorSpace: SRGBColorSpace,
  toneMapping: NoToneMapping,
}

const URL_STUB = 'https://upload.wikimedia.org/wikipedia/commons/'

const URLS = [
  'f/f0/Cyanistes_caeruleus_Oulu_20150516.JPG',
  '3/36/Cyanistes_caeruleus_Oulu_20130323.JPG',
  '2/2e/Cyanistes_caeruleus_Oulu_20170507_02.jpg',
].map(url => URL_STUB + url)
</script>

<template>
  <TresCanvas
    v-bind="gl"
  >
    <TresPerspectiveCamera :position="[0, 0, 2]" />
    <OrbitControls />
    <Image :url="URLS[0]" :radius="0.2" :transparent="true" :position="[-1.5, 0, -1]" />
    <Image :url="URLS[1]" :radius="0.2" :transparent="true" />
    <Image :url="URLS[2]" :radius="0.2" :transparent="true" :position="[1.5, 0, -1]" />
  </TresCanvas>
</template>

System Info

Used Package Manager

yarn

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions