|
|
@@ -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;
|
|
|
|