RGB565 textures broken since r136
See original GitHub issueDescribe the bug
Since r136, RGB565 textures will be rendered black instead of their proper colors.
To Reproduce
Steps to reproduce the behavior:
Use the code below to show a simple RGB565 texture. See only blackness. Change threes version to any version before r136, see the plane with a red, green, blue, and white rectangle.
Code
import * as THREE from 'https://cdn.skypack.dev/three@0.135.0'
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
const data = new Uint16Array([
0x001F, 0xF800,
0x07E0, 0xFFFF,
])
const map = new THREE.DataTexture(data, 2, 2, THREE.RGBFormat, THREE.UnsignedShort565Type)
const geometry = new THREE.PlaneGeometry();
const material = new THREE.MeshBasicMaterial( { map } );
const obj = new THREE.Mesh( geometry, material );
scene.add( obj );
camera.position.z = 1;
function animate() {
requestAnimationFrame( animate );
renderer.render( scene, camera );
};
animate();
Expected behavior
Not display any RGB565 texture as black.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You find the information at the respective PR: https://github.com/mrdoob/three.js/pull/23228#issue-1102180015
We usually only put the migration tasks in the migration guide and not the reasoning behind each change. That would be just too much management.
But yes, the usage of
texStorage2D()
broke the packed types. I’ll fix that.