Skip to content

Commit

Permalink
Examples: add reflection mask in retargeting_readyplayer (#29485)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag authored Sep 24, 2024
1 parent 8f765f9 commit 9df48f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Binary file modified examples/screenshots/webgpu_animation_retargeting_readyplayer.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions examples/webgpu_animation_retargeting_readyplayer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 9df48f2

Please sign in to comment.