how to disable antialiasing for webgpu

135 Views Asked by At

Object literal may only specify known properties, and 'antialiasing' does not exist in type 'GPUCanvasConfiguration'.ts(2353)

But then how do I disable anti aliasing?

2

There are 2 best solutions below

0
On BEST ANSWER

You don't. webgpu does not have any kind on auto antialiasing like webgl.

In WebGPU if you want antialiasing like webgl you have to do it manually by creating your own multisampled texture, rendering to it, and resolving it to the canvas. You can see an example in this answer

by default, webgpu does not antialias

You might find this article helpful if you're new to WebGPU and already familiar with WebGL

0
On

As explained in https://toji.dev/webgpu-best-practices/webgl-performance-comparison#antialiasing, in WebGL, if you don’t explicitly specify otherwise the default framebuffer will be antialiased. In contrast, the textures provided by a WebGPU canvas context are always single sampled.

https://developer.chrome.com/blog/from-webgl-to-webgpu#canvas_handling is also a nice resource to learn some tips for WebGL developers who are migrating to WebGPU.

Moreover you can see in WebGPU types (https://github.com/gpuweb/types/blob/b71895f2ec6bf2cafc9d7f3fb94a9edc004f5f61/dist/index.d.ts#L600) that GPUCanvasConfiguration does not indeed contain antialiasing