ITADN

Feature Request: Support high-precision (RGBA16Float) output targets to prevent 8-bit quantization artifacts on transparent backgrounds (MacOS)

#1564Closedbejminliou 创建于 2026-04-10
B
bejminlioucommented
### **Is your feature request related to a problem? Please describe.** I am rendering a scene to a transparent window/canvas using `render_to_texture`. On the soft, anti-aliased edges of strokes and shapes, I am getting a highly visible "dark shadow" and black outline, which looks terrible over lighter backgrounds. <img width="1108" height="576" alt="Image" src="https://github.com/user-attachments/assets/0d6fe8fe-1c51-42d3-bfed-a59247ec3394" /> <img width="1308" height="782" alt="Image" src="https://github.com/user-attachments/assets/b630050d-62d8-497b-bbcf-1988f0e9a345" /> This happens because Vello outputs **premultiplied linear** color into an 8-bit texture. For very soft edges (e.g. 2% alpha) the linear RGB values get heavily crushed and rounded down to `0` in 8-bit integer math. When my blit shader un-premultiplies the output to composite it onto the screen (`RGB (0) / Alpha (0.02)`), the result is pure black. This creates a black outline/shadow around all anti-aliased geometry. ### **Describe the solution you'd like** To model the solution more clearly, I would like to first introduce what I tried. I tried changing my wgpu target texture to `wgpu::TextureFormat::Rgba16Float` to preserve the float precision of the dark colors before un-premultiplying. Now calling `render_to_texture` immediately panics with: `Storage texture binding 5 expects format = Rgba8Unorm, but given a view with format = Rgba16Float` Because Vello's fine rasterization pass and internal image formats are currently hardcoded to 8-bit (`Rgba8Unorm`/`Bgra8Unorm`), I cannot bypass this quantization artifact. ```rs pub enum ImageFormat { Rgba8, Bgra8, } ``` In `vello/src/render.rs`: ```rs let out_image = ImageProxy::new(params.width, params.height, ImageFormat::Rgba8); ``` I would like Vello to support rendering to `Rgba16Float` storage textures. ### **Additional context** This is specfically an issue when compositing Vello's output onto transparent backgrounds (like transparent desktop windows or transparent web canvases). ### Side Note I'm new to Vello's internals so I don't quite have the expertise to submit a PR for this myself, but I am very willing to coordinate with the maintainers! I would be happy to provide a minimal reproducible example of my transparent window setup, and I am fully available to test any potential fixes or branches locally to confirm if the artifacts are resolved.
关闭于 2026-04-11 4 条评论