Three.js maintainers: Can we make antialiasing toggleable at runtime?

@mrdoob @Mugen87 @sunag @donmccurdy @gkjohnson

Antialiasing in three.js is enabled or disabled in the constructor options to WebGLRenderer or WebGPURenderer:

const webGLRenderer = new THREE.WebGLRenderer({
  antialias: true
});

const webGPURenderer = new THREE.WebGPURenderer({
  antialias: true
});

I’d like to toggle the antialias setting after a renderer has been created. Would this be a difficult change to make?

Yep. Antialiasing is not a Three.js property and can not be switched. It is used only once – when a WebGL context is created. The options to have ‘toggable’ antialias are:

  • recreate a new context with different antialias (and dispose the old one)
  • use post-processing effect for antialiasing and toggle the effect
  • (Edit) for WebGPU try renderer.samples to change the antialiasing region