|
@@ -9,8 +9,8 @@
|
|
<body>
|
|
<body>
|
|
|
|
|
|
<div id="info">
|
|
<div id="info">
|
|
- <a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - <span id="description">Normal, Velocity, Depth, DepthRGBA, DepthRGBAUnpacked, Materials</span><br/>
|
|
|
|
- by <a href="https://Clara.io">Ben Houston</a>. ninja head from <a href="https://gpuopen.com/archive/gamescgi/amd-gpu-meshmapper/" target="_blank" rel="noopener">AMD GPU MeshMapper</a>
|
|
|
|
|
|
+ <a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - <span id="description">Normal, Velocity, and Depth Materials</span><br/>
|
|
|
|
+ ninja head from <a href="https://gpuopen.com/archive/gamescgi/amd-gpu-meshmapper/" target="_blank" rel="noopener">AMD GPU MeshMapper</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="importmap">
|
|
<script type="importmap">
|
|
@@ -53,7 +53,7 @@
|
|
let cameraOrtho, cameraPerspective;
|
|
let cameraOrtho, cameraPerspective;
|
|
let controlsOrtho, controlsPerspective;
|
|
let controlsOrtho, controlsPerspective;
|
|
|
|
|
|
- let mesh, materialStandard, materialDepthBasic, materialDepthRGBA, materialNormal, materialVelocity;
|
|
|
|
|
|
+ let mesh, materialStandard, materialDepthBasic, materialDepthRGBA, materialDepthRGB, materialDepthRG, materialNormal, materialVelocity;
|
|
|
|
|
|
const SCALE = 2.436143; // from original model
|
|
const SCALE = 2.436143; // from original model
|
|
const BIAS = - 0.428408; // from original model
|
|
const BIAS = - 0.428408; // from original model
|
|
@@ -90,13 +90,11 @@
|
|
controlsPerspective = new OrbitControls( cameraPerspective, renderer.domElement );
|
|
controlsPerspective = new OrbitControls( cameraPerspective, renderer.domElement );
|
|
controlsPerspective.minDistance = 1000;
|
|
controlsPerspective.minDistance = 1000;
|
|
controlsPerspective.maxDistance = 2400;
|
|
controlsPerspective.maxDistance = 2400;
|
|
- controlsPerspective.enablePan = false;
|
|
|
|
controlsPerspective.enableDamping = true;
|
|
controlsPerspective.enableDamping = true;
|
|
|
|
|
|
controlsOrtho = new OrbitControls( cameraOrtho, renderer.domElement );
|
|
controlsOrtho = new OrbitControls( cameraOrtho, renderer.domElement );
|
|
controlsOrtho.minZoom = 0.5;
|
|
controlsOrtho.minZoom = 0.5;
|
|
controlsOrtho.maxZoom = 1.5;
|
|
controlsOrtho.maxZoom = 1.5;
|
|
- controlsOrtho.enablePan = false;
|
|
|
|
controlsOrtho.enableDamping = true;
|
|
controlsOrtho.enableDamping = true;
|
|
|
|
|
|
// lights
|
|
// lights
|
|
@@ -165,6 +163,26 @@
|
|
side: THREE.DoubleSide
|
|
side: THREE.DoubleSide
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
+ materialDepthRGB = new THREE.MeshDepthMaterial( {
|
|
|
|
+ depthPacking: THREE.RGBDepthPacking,
|
|
|
|
+
|
|
|
|
+ displacementMap: displacementMap,
|
|
|
|
+ displacementScale: SCALE,
|
|
|
|
+ displacementBias: BIAS,
|
|
|
|
+
|
|
|
|
+ side: THREE.DoubleSide
|
|
|
|
+ } );
|
|
|
|
+
|
|
|
|
+ materialDepthRG = new THREE.MeshDepthMaterial( {
|
|
|
|
+ depthPacking: THREE.RGDepthPacking,
|
|
|
|
+
|
|
|
|
+ displacementMap: displacementMap,
|
|
|
|
+ displacementScale: SCALE,
|
|
|
|
+ displacementBias: BIAS,
|
|
|
|
+
|
|
|
|
+ side: THREE.DoubleSide
|
|
|
|
+ } );
|
|
|
|
+
|
|
materialNormal = new THREE.MeshNormalMaterial( {
|
|
materialNormal = new THREE.MeshNormalMaterial( {
|
|
displacementMap: displacementMap,
|
|
displacementMap: displacementMap,
|
|
displacementScale: SCALE,
|
|
displacementScale: SCALE,
|
|
@@ -213,7 +231,7 @@
|
|
//
|
|
//
|
|
|
|
|
|
const gui = new GUI();
|
|
const gui = new GUI();
|
|
- gui.add( params, 'material', [ 'standard', 'normal', 'velocity', 'depthBasic', 'depthRGBA' ] );
|
|
|
|
|
|
+ gui.add( params, 'material', [ 'standard', 'normal', 'velocity', 'depthBasic', 'depthRGBA', 'depthRGB', 'depthRG' ] );
|
|
gui.add( params, 'camera', [ 'perspective', 'ortho' ] );
|
|
gui.add( params, 'camera', [ 'perspective', 'ortho' ] );
|
|
gui.add( params, 'side', [ 'front', 'back', 'double' ] );
|
|
gui.add( params, 'side', [ 'front', 'back', 'double' ] );
|
|
|
|
|
|
@@ -263,6 +281,8 @@
|
|
case 'standard': material = materialStandard; break;
|
|
case 'standard': material = materialStandard; break;
|
|
case 'depthBasic': material = materialDepthBasic; break;
|
|
case 'depthBasic': material = materialDepthBasic; break;
|
|
case 'depthRGBA': material = materialDepthRGBA; break;
|
|
case 'depthRGBA': material = materialDepthRGBA; break;
|
|
|
|
+ case 'depthRGB': material = materialDepthRGB; break;
|
|
|
|
+ case 'depthRG': material = materialDepthRG; break;
|
|
case 'normal': material = materialNormal; break;
|
|
case 'normal': material = materialNormal; break;
|
|
case 'velocity': material = materialVelocity; break;
|
|
case 'velocity': material = materialVelocity; break;
|
|
|
|
|