Skip to content

Commit 905916e

Browse files
holtsetioRuthySheffi
authored andcommitted
Remove ambient occlusion for performance reasons (mrdoob#31159)
1 parent 2913095 commit 905916e

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

examples/webgpu_compute_particles_fluid.html

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828

2929
import * as THREE from 'three';
3030

31-
import { Fn, If, Return, instancedArray, instanceIndex, uniform, attribute, uint, float, clamp, struct, atomicStore, int, ivec3, array, vec3, atomicAdd, Loop, atomicLoad, max, pow, mat3, vec4, cross, step, pass, mrt, output, normalView } from 'three/tsl';
31+
import { Fn, If, Return, instancedArray, instanceIndex, uniform, attribute, uint, float, clamp, struct, atomicStore, int, ivec3, array, vec3, atomicAdd, Loop, atomicLoad, max, pow, mat3, vec4, cross, step } from 'three/tsl';
3232

33-
import { ao } from 'three/addons/tsl/display/GTAONode.js';
3433
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
3534
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3635
import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
@@ -53,7 +52,6 @@
5352
const mouseCoord = new THREE.Vector3();
5453
const prevMouseCoord = new THREE.Vector3();
5554
let mouseRayOriginUniform, mouseRayDirectionUniform, mouseForceUniform;
56-
let postProcessing, aoPass, blendPassAO, scenePassColor;
5755

5856
if ( WebGPU.isAvailable() === false ) {
5957

@@ -66,7 +64,6 @@
6664

6765
const params = {
6866
particleCount: 8192 * 4,
69-
ambientOcclusion: true,
7067
};
7168

7269
init();
@@ -115,23 +112,6 @@
115112

116113
} );
117114

118-
gui.add( params, 'ambientOcclusion' );
119-
120-
// setting up post processing for ambient occlusion
121-
postProcessing = new THREE.PostProcessing( renderer );
122-
const scenePass = pass( scene, camera );
123-
scenePass.setMRT( mrt( {
124-
output: output,
125-
normal: normalView
126-
} ) );
127-
scenePassColor = scenePass.getTextureNode( 'output' );
128-
const scenePassNormal = scenePass.getTextureNode( 'normal' );
129-
const scenePassDepth = scenePass.getTextureNode( 'depth' );
130-
aoPass = ao( scenePassDepth, scenePassNormal, camera );
131-
aoPass.resolutionScale = 0.5;
132-
blendPassAO = aoPass.getTextureNode().mul( scenePassColor );
133-
postProcessing.outputNode = blendPassAO;
134-
135115
window.addEventListener( 'resize', onWindowResize );
136116
controls.update();
137117
renderer.setAnimationLoop( render );
@@ -579,15 +559,7 @@
579559

580560
await renderer.computeAsync( [ clearGridKernel, p2g1Kernel, p2g2Kernel, updateGridKernel, g2pKernel ] );
581561

582-
if ( params.ambientOcclusion ) {
583-
584-
await postProcessing.renderAsync();
585-
586-
} else {
587-
588-
await renderer.renderAsync( scene, camera );
589-
590-
}
562+
await renderer.renderAsync( scene, camera );
591563

592564
}
593565

0 commit comments

Comments
 (0)