SciProgCentre / visionforge

Visualization module for dataforge
Apache License 2.0
36 stars 8 forks source link

Consider aliasing with FXAA #70

Open CommanderTvis opened 2 years ago

CommanderTvis commented 2 years ago

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();
altavir commented 2 years ago

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

CommanderTvis commented 2 years ago

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?

altavir commented 2 years ago

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