소스 검색

webgpu_generator_city: Use SSAO instead of GTAO.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mr.doob 3 주 전
부모
커밋
dcf4b4b331
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      examples/webgpu_generator_city.html

+ 6 - 6
examples/webgpu_generator_city.html

@@ -45,7 +45,7 @@
 			import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js';
 			import { SkyMesh } from 'three/addons/objects/SkyMesh.js';
 			import { bloom } from 'three/addons/tsl/display/BloomNode.js';
-			import { ao } from 'three/addons/tsl/display/GTAONode.js';
+			import { ssao } from 'three/addons/tsl/display/SSAONode.js';
 			import { CityGenerator, createBuildingMaterial, createRoadMaterial } from 'three/addons/generators/CityGenerator.js';
 
 			let camera, scene, renderer, controls, timer;
@@ -134,7 +134,7 @@
 				materials = { building: createBuildingMaterial( city.layout, parameters.seed ) };
 				generateCity();
 
-				// ground-truth ambient occlusion for the facade's contact shadows. a cheap
+				// screen-space ambient occlusion for the facade's contact shadows. a cheap
 				// pre-pass lays down view normals and depth, so the AO is ready before the
 				// lit scene pass and feeds in through its lighting context: the occlusion
 				// then darkens only the sky/IBL fill in the crevices, never the direct sun
@@ -149,11 +149,11 @@
 				const prePassNormal = sample( ( uv ) => unpackRGBToNormal( prePass.getTextureNode().sample( uv ) ) );
 				const prePassDepth = prePass.getTextureNode( 'depth' );
 
-				const aoPass = ao( prePassDepth, prePassNormal, camera );
+				const aoPass = ssao( prePassDepth, prePassNormal, camera );
 				aoPass.resolutionScale = 0.5; // half-res is plenty for soft contact shading
-				aoPass.radius.value = 4;
-				aoPass.thickness.value = 4;
-				aoPass.scale.value = 2;
+				aoPass.radius.value = 1.5;
+				aoPass.intensity.value = 4;
+				aoPass.blurEnabled = false;
 
 				const scenePass = pass( scene, camera );
 				scenePass.contextNode = builtinAOContext( aoPass.getTextureNode().sample( screenUV ).r );

粤ICP备19079148号