Rendering texture with partial transparency on canvas. #4405
-
Facing issue when rendering overlapping quads with partial transparent sampled textures. Detailed steps:
Have enabled alpha mode flags at 3 levels:
Can you please suggest if these are correct? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
If you are rendering across multiple frames (multiple requestAnimationFrame events) then the texture you get from Otherwise, if you have 2 or more render passes, every pass except the first needs it's Finally, whatever values are in the canvas, if their alpha is less than 255 (less then 1.0) and the canvas is configured to Some more details and examples here: https://webgpufundamentals.org/webgpu/lessons/webgpu-transparency.html |
Beta Was this translation helpful? Give feedback.
-
@greggman Thanks for the transparency link it was very detailed and helped to solve my problem. |
Beta Was this translation helpful? Give feedback.
If you are rendering across multiple frames (multiple requestAnimationFrame events) then the texture you get from
getCurrentTexture
is always cleared each frameOtherwise, if you have 2 or more render passes, every pass except the first needs it's
loadOp
set to 'load'Finally, whatever values are in the canvas, if their alpha is less than 255 (less then 1.0) and the canvas is configured to
alphaMode: premultiplied
then there will be transparency through the canvas.Some more details and examples here:
https://webgpufundamentals.org/webgpu/lessons/webgpu-transparency.html