Canvas texture opacity map disappears in WebGPU

Hi all, I found a problem where a canvas texture used as an opacity map disappears when running in WebGPU, but it works fine in WebGL.

Steps to reproduce:

  1. Create a texture using a canvas as the source. (setSource)
  2. Assign this texture to the material’s opacity map.
  3. Apply the material to an image element.

Here is the sample code and project to check the result.

const canvas = document.createElement('canvas');
// draw something...
 
const texture = new pc.Texture(this.app.graphicsDevice);
texture.setSource(canvas);
const material = new pc.StandardMaterial();
material.opacityMap = texture;
material.opacityMapChannel = 'r';
material.blendType = pc.BLEND_PREMULTIPLIED;

entityA.element.material = material;
entityB.render.material = material; // also disappears on render component

https://playcanvas.com/project/1411213/overview/webgpu-setsource-test
Thank you in advance for your help!

Thanks for the repro, I’ve created an issue here:

1 Like