Inconsistency between <meshBasicMaterial> and MeshBasicMaterial textures #1135
-
Textures are washed out when using They look as expected with Curiously, everything is fine when both techniques are used in the same scene: Right now the workaround is to use |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
see: #1129 color management means that all textures, all colors systemwide have correct gamma. but it won't mutate externals. if you use external materials you loose that advantage. you'd have to color correct yourself, just like in plain threejs, calling color.linearToGamma or something like that. or switch colormanagement off altogether but you will not have good looking scenes with that. imo this makes no sense and is very wasteful, youre creating a new material on every render. the render function shouldn't have side-effects, no exception. function Plane(props) {
const texture = useTexture(texUrl)
const mat = new MeshBasicMaterial({ map: texture })
return <mesh {...props} geometry={geom} material={mat} />
} instead: function Plane(props) {
const texture = useTexture(texUrl)
return (
<mesh {...props} geometry={geom} dispose={null}>
<meshBasicMaterial map={texture} />
</mesh>
)
} im not sure why you think this isn't managed. or what you mean by saying you want to memoize. btw, if you're dealing with cached assets (useLoader/useTexture/etc) better put |
Beta Was this translation helpful? Give feedback.
-
Here's how to counteract the color management: texture.encoding = sRGBEncoding
material.toneMapped = false https://codesandbox.io/s/r3f-issue-textures-single-material-s5ore?file=/src/App.js:486-518 |
Beta Was this translation helpful? Give feedback.
Here's how to counteract the color management:
https://codesandbox.io/s/r3f-issue-textures-single-material-s5ore?file=/src/App.js:486-518