|
@@ -1,11 +1,10 @@
|
|
|
import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
|
|
|
import { materialReference } from '../accessors/MaterialReferenceNode.js';
|
|
|
import { diffuseColor } from '../core/PropertyNode.js';
|
|
|
-import { vec2, vec3 } from '../shadernode/ShaderNode.js';
|
|
|
-import { positionViewDirection } from '../accessors/PositionNode.js';
|
|
|
+import { vec3 } from '../shadernode/ShaderNode.js';
|
|
|
import { MeshMatcapMaterial } from 'three';
|
|
|
-import { transformedNormalView } from '../accessors/NormalNode.js';
|
|
|
import { mix } from '../math/MathNode.js';
|
|
|
+import { matcapUV } from '../utils/MatcapUVNode.js';
|
|
|
|
|
|
const defaultValues = new MeshMatcapMaterial();
|
|
|
|
|
@@ -27,10 +26,7 @@ class MeshMatcapNodeMaterial extends NodeMaterial {
|
|
|
|
|
|
setupVariants( builder ) {
|
|
|
|
|
|
- const x = vec3( positionViewDirection.z, 0.0, positionViewDirection.x.negate() ).normalize();
|
|
|
- const y = positionViewDirection.cross( x );
|
|
|
-
|
|
|
- const uv = vec2( x.dot( transformedNormalView ), y.dot( transformedNormalView ) ).mul( 0.495 ).add( 0.5 ) ; // 0.495 to remove artifacts caused by undersized matcap disks
|
|
|
+ const uv = matcapUV;
|
|
|
|
|
|
let matcapColor;
|
|
|
|