visionforge icon indicating copy to clipboard operation
visionforge copied to clipboard

Consider aliasing with FXAA

Open CommanderTvis opened this issue 3 years ago • 3 comments

As for my PC, current WebGLRenderer usages result in quite a visible aliasing, so an explicit FXAA shader should be considered.

There are also other options like SMAA, SSAA, TAA.

Usage example for FXAA:

import { FXAAShader } from 'https://threejs.org/examples/jsm/shaders/FXAAShader.js';
...
const fxaaPass = new ShaderPass(FXAAShader);
const pixelRatio = renderer.getPixelRatio();
fxaaPass.material.uniforms['resolution'].value.x = 1 / (container.offsetWidth * pixelRatio);
fxaaPass.material.uniforms['resolution'].value.y = 1 / (container.offsetHeight * pixelRatio);
composer1 = new EffectComposer(renderer); // renderer: WebGLRenderer
...
composer1.addPass(fxaaPass);
...
composer1.render();

CommanderTvis avatar Jan 23 '22 12:01 CommanderTvis

OK, I will try, but we need to check if it will affect performance for large geometries.

altavir avatar Jan 23 '22 12:01 altavir

OK, I will try, but we need to check if it will affect performance for large geometries.

Maybe there just should be an option to disable it?

CommanderTvis avatar Jan 23 '22 12:01 CommanderTvis

Yes, it is possible. We can pass almost any option through Canvas3DOptions or its specialized descendant.

altavir avatar Jan 23 '22 12:01 altavir