This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Garrett Johnson / http://gkjohnson.github.io/ | |
* | |
* Approach from http://john-chapman-graphics.blogspot.com/2013/01/per-object-motion-blur.html | |
*/ | |
import { | |
Frustum, | |
Color, | |
WebGLRenderTarget, | |
LinearFilter, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original implementation is from https://github.com/pmndrs/drei | |
const { | |
DepthFormat, DepthTexture, LinearFilter, Matrix4, MeshStandardMaterial, | |
PerspectiveCamera, Plane, UnsignedShortType, Vector3, Vector4, WebGLRenderTarget | |
} = THREE | |
class MeshReflectorMaterial extends MeshStandardMaterial { | |
constructor(renderer, camera, scene, object, { | |
mixBlur = 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as THREE from "three" | |
// credits for the box-projecting shader code go to codercat (https://codercat.tk) | |
const worldposReplace = /* glsl */` | |
#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) | |
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 ); | |
#ifdef BOX_PROJECTED_ENV_MAP | |
vWorldPosition = worldPosition.xyz; |