@fern-solutions/three-vr-postfx
v0.1.0
Published
[](https://www.npmjs.com/package/@fern-solutions/three-vr-postfx) [;
// Handle resizing
const resize = () => {
if(!renderer.xr.isPresenting) {
renderer.setSize(window.innerWidth, window.innerHeight);
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
}
const size = renderer.getSize(new THREE.Vector2());
sobelEffect.setSize(size.width, size.height);
}
window.addEventListener('resize', _ => resize())
renderer.xr.addEventListener('sessionstart', _ => resize());
renderer.xr.addEventListener('sessionend', _ => resize());
// Render
//renderer.render(scene, camera);
sobelEffect.render(scene, camera);See the example in example/ for a full example.
Each effect is intended to replace the main renderer.render call. This means that the effects can't be combined with each-other. This is a deliberate limitation of the library. Ultimately having multiple passes is a poor fit for VR on mobile tile-based GPUs. Optimizing one effect makes it possible to use it for your experience, but the headroom generally does not allow these effects to be stacked on top of each other.
Effects
SobelEffect(resolution?)BlurEffect(resolution?)BasicBloomEffect(resolution?, strength?, radius?, threshold?)UnrealBloomEffect(resolution?, strength?, radius?, threshold?)
