|
28 | 28 |
|
29 | 29 | import * as THREE from 'three';
|
30 | 30 |
|
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'; |
32 | 32 |
|
33 |
| - import { ao } from 'three/addons/tsl/display/GTAONode.js'; |
34 | 33 | import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
35 | 34 | import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
36 | 35 | import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
|
|
53 | 52 | const mouseCoord = new THREE.Vector3();
|
54 | 53 | const prevMouseCoord = new THREE.Vector3();
|
55 | 54 | let mouseRayOriginUniform, mouseRayDirectionUniform, mouseForceUniform;
|
56 |
| - let postProcessing, aoPass, blendPassAO, scenePassColor; |
57 | 55 |
|
58 | 56 | if ( WebGPU.isAvailable() === false ) {
|
59 | 57 |
|
|
66 | 64 |
|
67 | 65 | const params = {
|
68 | 66 | particleCount: 8192 * 4,
|
69 |
| - ambientOcclusion: true, |
70 | 67 | };
|
71 | 68 |
|
72 | 69 | init();
|
|
115 | 112 |
|
116 | 113 | } );
|
117 | 114 |
|
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 |
| - |
135 | 115 | window.addEventListener( 'resize', onWindowResize );
|
136 | 116 | controls.update();
|
137 | 117 | renderer.setAnimationLoop( render );
|
|
579 | 559 |
|
580 | 560 | await renderer.computeAsync( [ clearGridKernel, p2g1Kernel, p2g2Kernel, updateGridKernel, g2pKernel ] );
|
581 | 561 |
|
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 ); |
591 | 563 |
|
592 | 564 | }
|
593 | 565 |
|
|
0 commit comments