Răsfoiți Sursa

Examples: add reflection mask in `retargeting_readyplayer` (#29485)

sunag 1 an în urmă
părinte
comite
9df48f2a92

BIN
examples/screenshots/webgpu_animation_retargeting_readyplayer.jpg


+ 4 - 2
examples/webgpu_animation_retargeting_readyplayer.html

@@ -25,7 +25,7 @@
 		<script type="module">
 
 			import * as THREE from 'three';
-			import { screenUV, color, vec2, reflector } from 'three/tsl';
+			import { screenUV, color, vec2, vec4, reflector, positionWorld } from 'three/tsl';
 
 			import Stats from 'three/addons/libs/stats.module.js';
 
@@ -119,8 +119,10 @@
 			reflection.target.rotateX( - Math.PI / 2 );
 			scene.add( reflection.target );
 
+			const reflectionMask = positionWorld.xz.distance( 0 ).mul( .1 ).clamp().oneMinus();
+
 			const floorMaterial = new THREE.NodeMaterial();
-			floorMaterial.colorNode = reflection;
+			floorMaterial.colorNode = vec4( reflection.rgb, reflectionMask );
 			floorMaterial.opacity = .2;
 			floorMaterial.transparent = true;
 

粤ICP备19079148号