How to use the MeshNormalMaterial function from three

Find comprehensive JavaScript three.MeshNormalMaterial code examples handpicked from public code repositorys.

175
176
177
178
179
180
181
182
183
// directionalLight.position.set( 0, 0, 1 ).normalize();
// scene.add( directionalLight );

// var sphereBufferGeometry = new THREE.SphereBufferGeometry( 5, 10, 10 );
// var material = new THREE.MeshBasicMaterial( {color: 0xffff00} );
// // var material = new THREE.MeshNormalMaterial( {shading: THREE.FlatShading} );
// var sphere = new THREE.Mesh( sphereBufferGeometry, material );


fork icon5
star icon23
watch icon3

+ 2 other calls in file

750
751
752
753
754
755
756
757
758
}

this.depthMaterial = new THREE.MeshDepthMaterial();
this.depthMaterial.depthPacking = THREE.RGBADepthPacking;
this.depthMaterial.blending = THREE.NoBlending;
this.normalMaterial = new THREE.MeshNormalMaterial();
this.normalMaterial.blending = THREE.NoBlending;

if ( THREE.SAOShader === undefined ) {
fork icon3
star icon7
watch icon0

+ 17 other calls in file

17
18
19
20
21
22
23
24
25
26

canvasResizer(camera, renderer);

// Add basic cube
const geometry = new three.BoxGeometry(1, 1, 1);
const material = new three.MeshNormalMaterial({ wireframe: true });
const cube = new three.Mesh(geometry, material);
scene.add(cube);

// GSAP timeline
fork icon1
star icon5
watch icon3

55
56
57
58
59
60
61
62
63
64
const THREE = require('three')

class MyFirstSketch {
  constructor () {
    // Create a cube, add it to the root of the scene
    const mat = new THREE.MeshNormalMaterial()
    const geom = new THREE.BoxGeometry(300, 300, 300)
    this.cube = new THREE.Mesh(geom, mat)
    this.root.add(this.cube)
  }
fork icon21
star icon0
watch icon1

100
101
102
103
104
105
106
107
108
109
      break;
    case 1: 
      return new THREE.MeshBasicMaterial( {color: getRandomColor(), wireframe: true} );
      break;
    case 2:
      return new THREE.MeshNormalMaterial();
      break;
  }
}

fork icon14
star icon4
watch icon0

+ 5 other calls in file

60
61
62
63
64
65
66
67
68
69
this.ssaoMaterial.uniforms['cameraFar'].value = this.camera.far;
this.ssaoMaterial.uniforms['resolution'].value.set(this.width, this.height);
this.ssaoMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix);
this.ssaoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse);
// normal material
this.normalMaterial = new three_1.MeshNormalMaterial();
this.normalMaterial.blending = three_1.NoBlending;
// blur material
this.blurMaterial = new three_1.ShaderMaterial({
    defines: Object.assign({}, SSAOShader_2.SSAOBlurShader.defines),
fork icon1
star icon3
watch icon0

+ 5 other calls in file

161
162
163
164
165
166
167
168
169
170
}

function addRobotViz(topic){
        var loader = new STLLoader()
    loader.load( './src/stls/car.stl', function ( geometry ) {
         var material = new THREE.MeshNormalMaterial()
         var mesh = new THREE.Mesh( geometry,material )
         robot = new THREE.Group();
         robot.add(mesh);
         scene.add(robot);
fork icon1
star icon0
watch icon1

19
20
21
22
23
24
25
26
27
this.intersectPoint = new THREE.Vector3();
this.intersectPoint2 = new THREE.Vector3();

var tempHand = new THREE.Mesh(
  new THREE.BoxBufferGeometry(0.1, 0.1, 0.1, 1, 1, 1),
  new THREE.MeshNormalMaterial()
);

this.h1 = tempHand;
fork icon0
star icon16
watch icon0

13
14
15
16
17
18
19
20
21
22
23
    color: 0x00ff00
});
var iterativeMat = new THREE.MeshBasicMaterial({
    color: 0x0000ff
});
var debugMat = new THREE.MeshNormalMaterial();


var interiorColor = new THREE.Color( 0xff0000 );
var frontierColor = new THREE.Color( 0x00ff00 );
var boundaryColor = new THREE.Color( 0x0000ff );
fork icon0
star icon1
watch icon0

+ 2 other calls in file

34
35
36
37
38
39
40
41
42

// Content
// -------

const geometry = new THREE.IcosahedronGeometry(1, 0);
const material = new THREE.MeshNormalMaterial();

const mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
fork icon0
star icon0
watch icon0

23
24
25
26
27
28
29
30
31
32
mainBc.childNodes[0].style.position = 'absolute';
mainBc.childNodes[0].style.zIndex = '-999999';
document.body.style.backgroundColor = ' black';
//code starts here

var surface = new THREE.MeshNormalMaterial();
var shape = new THREE.SphereGeometry(100, 10, 30);
var ball = new THREE.Mesh(shape, surface);
var surface2 = new THREE.MeshPhongMaterial();
var color = new THREE.MeshPhongMaterial();
fork icon0
star icon0
watch icon0

191
192
193
194
195
196
197
198
199
200
                inst.sizeAttenuation,
                inst.fog];
}

/**
 * Property getter THREE.MeshNormalMaterial
 */
function getter_THREE_MeshNormalMaterial(inst) {
        return [
                inst.name,
fork icon0
star icon0
watch icon2

+ 5 other calls in file

70
71
72
73
74
75
76
77
78
79
                        obj.geometry.addAttribute( 'uv2', new THREE.BufferAttribute( uvs, 2 ) );
                        obj.material = materials.wood;
                        break;

                default:
                        obj.material = new THREE.MeshNormalMaterial();
                        console.log(obj.name);
        }
});
this.add( lobby );
fork icon0
star icon0
watch icon2

+ 5 other calls in file

26
27
28
29
30
31
32
33
34
35
        return new THREE.Line( geometryPoints, new THREE.LineBasicMaterial( { color: 0xFF0000, linewidth: 3 } ) );
}

export const createSphere = () => {
        let geometry = new THREE.SphereBufferGeometry( 4, 20, 20 );
        let material = new THREE.MeshNormalMaterial();
        return new THREE.Mesh(geometry, material);
}

export const createEllipse = () => {
fork icon0
star icon0
watch icon1

+ 2 other calls in file

123
124
125
126
127
128
129
130
131
132
 */
export const createMultiTextureSphere = () =>{
        let materials = [];
        materials.push( new THREE.MeshBasicMaterial( { color: 0xffaa00, transparent: true, blending: THREE.AdditiveBlending} ) ); // 黄色加透明光亮
        materials.push( new THREE.MeshBasicMaterial( { color: 0xffaa00, wireframe: true } ) );
        materials.push( new THREE.MeshNormalMaterial( { flatShading: true } ) );
        materials.push( new THREE.MeshPhongMaterial( { color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, opacity: 0.9, transparent: true } ) );
        // 这里由于使用多材质,应采取API提供的对材质排序的方法进行性能优化,因此对几何对象中的面进行处理
        // 这里要实现的是多种材质在几何体中随机分布,因此给每个面进行配置材质索引并根据索引排序可以减少绘制调用和提升性能
        // 配置材质索引
fork icon0
star icon0
watch icon1

51
52
53
54
55
56
57
58
59
camera.position.z = 1;

scene = new THREE.Scene();

geometry = new THREE.BoxGeometry(0.2, 0.2, 0.2);
material = new THREE.MeshNormalMaterial();

mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
fork icon0
star icon0
watch icon2

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)