|
30 | 30 |
|
31 | 31 | import * as THREE from 'three';
|
32 | 32 |
|
33 |
| - import { pass, mrt, output, emissive, color, screenUV } from 'three/tsl'; |
| 33 | + import { pass, mrt, output, emissive, renderOutput } from 'three/tsl'; |
34 | 34 | import { bloom } from 'three/addons/tsl/display/BloomNode.js';
|
| 35 | + import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; |
35 | 36 |
|
36 | 37 | import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
37 | 38 |
|
|
59 | 60 |
|
60 | 61 | const loader = new UltraHDRLoader();
|
61 | 62 | loader.setDataType( THREE.HalfFloatType );
|
62 |
| - loader.load( `textures/equirectangular/moonless_golf_2k.hdr.jpg`, function ( texture ) { |
| 63 | + loader.load( 'textures/equirectangular/moonless_golf_2k.hdr.jpg', function ( texture ) { |
63 | 64 |
|
64 | 65 | texture.mapping = THREE.EquirectangularReflectionMapping;
|
65 | 66 | texture.needsUpdate = true;
|
|
163 | 164 |
|
164 | 165 | // renderer
|
165 | 166 |
|
166 |
| - renderer = new THREE.WebGPURenderer( { antialias: true } ); |
| 167 | + renderer = new THREE.WebGPURenderer(); |
167 | 168 | renderer.setSize( window.innerWidth, window.innerHeight );
|
168 | 169 | renderer.setPixelRatio( window.devicePixelRatio );
|
169 | 170 | renderer.setAnimationLoop( animate );
|
|
181 | 182 | emissive
|
182 | 183 | } ) );
|
183 | 184 |
|
184 |
| - const outputPass = scenePass.getTextureNode(); |
| 185 | + const beautyPass = scenePass.getTextureNode(); |
185 | 186 | const emissivePass = scenePass.getTextureNode( 'emissive' );
|
186 | 187 |
|
187 | 188 | const bloomPass = bloom( emissivePass, 2 );
|
188 | 189 |
|
189 |
| - postProcessing.outputNode = outputPass.add( bloomPass ); |
| 190 | + const outputPass = renderOutput( beautyPass.add( bloomPass ) ); |
| 191 | + |
| 192 | + const fxaaPass = fxaa( outputPass ); |
| 193 | + postProcessing.outputNode = fxaaPass; |
190 | 194 |
|
191 | 195 | // gui
|
192 | 196 |
|
|
222 | 226 |
|
223 | 227 | controls = new OrbitControls( camera, renderer.domElement );
|
224 | 228 | controls.enableDamping = true;
|
225 |
| - controls.target.set( 0, 0, -5 ); |
| 229 | + controls.target.set( 0, 0, - 5 ); |
226 | 230 | controls.update();
|
227 | 231 |
|
228 | 232 | //
|
|
0 commit comments