question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RGB565 textures broken since r136

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Jan 25, 2022

Is there any documentation on why RGBFormat is being dropped?

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.

1reaction
Mugen87commented, Jan 25, 2022

But yes, the usage of texStorage2D() broke the packed types. I’ll fix that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found