Skip to content

Commit 9df48f2

Browse files
authored
Examples: add reflection mask in retargeting_readyplayer (#29485)
1 parent 8f765f9 commit 9df48f2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
-317 Bytes
Loading

examples/webgpu_animation_retargeting_readyplayer.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<script type="module">
2626

2727
import * as THREE from 'three';
28-
import { screenUV, color, vec2, reflector } from 'three/tsl';
28+
import { screenUV, color, vec2, vec4, reflector, positionWorld } from 'three/tsl';
2929

3030
import Stats from 'three/addons/libs/stats.module.js';
3131

@@ -119,8 +119,10 @@
119119
reflection.target.rotateX( - Math.PI / 2 );
120120
scene.add( reflection.target );
121121

122+
const reflectionMask = positionWorld.xz.distance( 0 ).mul( .1 ).clamp().oneMinus();
123+
122124
const floorMaterial = new THREE.NodeMaterial();
123-
floorMaterial.colorNode = reflection;
125+
floorMaterial.colorNode = vec4( reflection.rgb, reflectionMask );
124126
floorMaterial.opacity = .2;
125127
floorMaterial.transparent = true;
126128

0 commit comments

Comments
 (0)