Skip to content

Commit 35b90a1

Browse files
authored
Examples: Enable MSAA in AO demo. (#31192)
1 parent 8797943 commit 35b90a1

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

examples/webgpu_postprocessing_ao.html

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<title>three.js webgpu - ambient occlusion (GTAO)</title>
4+
<title>three.js webgpu - ambient occlusion</title>
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
77
<link type="text/css" rel="stylesheet" href="main.css">
@@ -37,10 +37,9 @@
3737
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
3838
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
3939

40-
import Stats from 'three/addons/libs/stats.module.js';
4140
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
4241

43-
let camera, scene, renderer, postProcessing, controls, stats;
42+
let camera, scene, renderer, postProcessing, controls;
4443

4544
let aoPass, denoisePass, blendPassAO, blendPassDenoise, scenePassColor;
4645

@@ -67,7 +66,7 @@
6766

6867
scene = new THREE.Scene();
6968

70-
renderer = new THREE.WebGPURenderer();
69+
renderer = new THREE.WebGPURenderer( { antialias: true } );
7170
renderer.setPixelRatio( window.devicePixelRatio );
7271
renderer.setSize( window.innerWidth, window.innerHeight );
7372
renderer.setAnimationLoop( animate );
@@ -93,9 +92,6 @@
9392
controls.minDistance = 2;
9493
controls.maxDistance = 8;
9594

96-
stats = new Stats();
97-
document.body.appendChild( stats.dom );
98-
9995
//
10096

10197
postProcessing = new THREE.PostProcessing( renderer );
@@ -113,10 +109,10 @@
113109
// ao
114110

115111
aoPass = ao( scenePassDepth, scenePassNormal, camera );
116-
aoPass.resolutionScale = 0.5;
112+
aoPass.resolutionScale = 0.5; // running AO in half resolution is often sufficient
117113
blendPassAO = aoPass.getTextureNode().mul( scenePassColor );
118114

119-
// denoise (optional)
115+
// denoise (optional, use it if you need best quality but is has a noticeable hit on performance)
120116

121117
denoisePass = denoise( aoPass.getTextureNode(), scenePassDepth, scenePassNormal, camera );
122118
blendPassDenoise = denoisePass.mul( scenePassColor );
@@ -229,7 +225,6 @@
229225
controls.update();
230226

231227
postProcessing.render();
232-
stats.update();
233228

234229
}
235230

0 commit comments

Comments
 (0)