How to use the MeshPhysicalMaterial function from three

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

133
134
135
136
137
138
139
140
141
142
//let material = new THREE.MeshStandardMaterial({ color: 0x2B2B2B });
//material.roughness = 0.2;
//material.metalness = 0.2;
    

//let material2 = new THREE.MeshPhysicalMaterial({  
//    roughness: 0.7,   
//    transmission: 0.5,  
//    thickness: 0.7
//});
fork icon3
star icon7
watch icon0

+ 8 other calls in file

599
600
601
602
603
604
605
606
607
608
getMaterialType( materialIndex ) {

    const parser = this.parser;
    const materialDef = parser.json.materials[ materialIndex ];
    if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;
    return THREE.MeshPhysicalMaterial;

}

extendMaterialParams( materialIndex, materialParams ) {
fork icon2
star icon10
watch icon0

+ 13 other calls in file

599
600
601
602
603
604
605
606
607
608
getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name])
        return null;
    return three.MeshPhysicalMaterial;
}
extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
fork icon2
star icon7
watch icon0

+ 5 other calls in file

60
61
62
63
64
65
66
67
68
69
 console.log(geometry)

 //let material = materials[obj.attributes.materialIndex]
// console.log(material)

 let mat = new THREE.MeshPhysicalMaterial()

 //mat.color = material.diffuseColor

 let m = meshToThreejs(geometry, mat)
fork icon2
star icon6
watch icon1

68
69
70
71
72
73
74
75
76
77

/** SCENE ROOM SETUP * */
const fbxLoader = new FBXLoader();
fbxLoader.load(require('./assets/rigTest-03.fbx'), (ratMesh) => {
  scene.add(ratMesh);
  ratMesh.children[0].material = new THREE.MeshPhysicalMaterial({
    skinning: true,
    // wireframe: true
  });
  console.log(ratMesh);
fork icon0
star icon3
watch icon3

118
119
120
121
122
123
124
125
126
127
scene.add(tailPoint);


const rat = ratMesh.children[0];

rat.material = new THREE.MeshPhysicalMaterial({
  skinning: true,
  color: new THREE.Color('#0ff0ff'),
  opacity: 0.8,
  transparent: true,
fork icon0
star icon3
watch icon3

460
461
462
463
464
465
466
467
468
469
  key: "getMaterialType",
  value: function getMaterialType(materialIndex) {
    var parser = this.parser;
    var materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return _three.MeshPhysicalMaterial;
  }
}, {
  key: "extendMaterialParams",
  value: function extendMaterialParams(materialIndex, materialParams) {
fork icon0
star icon1
watch icon0

+ 3 other calls in file

112
113
114
115
116
117
118
119
120
121
const normalMapTexture = textureLoader.load("src/normal.jpg");
normalMapTexture.wrapS = THREE.RepeatWrapping;
normalMapTexture.wrapT = THREE.RepeatWrapping;
normalMapTexture.repeat.set(options.normalRepeat, options.normalRepeat);

const material = new THREE.MeshPhysicalMaterial({
  transmission: options.transmission,
  thickness: options.thickness,
  roughness: options.roughness,
  envMap: hdrEquirect,
fork icon0
star icon0
watch icon0

+ 2 other calls in file

208
209
210
211
212
213
214
215
216
217
  thick = r_stock[i]*1.7;
  //alert(r);
} else {
  thick = 4 * 2;
}
material3.push(new THREE.MeshPhysicalMaterial({
  roughness: 0.05,
  transmission: 0.9,
  thickness: thick,
  reflectivity: 1,
fork icon0
star icon0
watch icon0

+ 11 other calls in file

71
72
73
74
75
76
77
78
79
80
this.three_mouse = new THREE.Vector2();
this.mouse = { x: 0, y: 0 }

this.ground = new THREE.Mesh(
    new THREE.PlaneGeometry(this.size, this.size, Math.sqrt(this.size), Math.sqrt(this.size)),
    new THREE.MeshPhysicalMaterial({
        color: 0x002611,
        roughness: 1,
        specularIntensity: .2,
    })
fork icon0
star icon0
watch icon0

Other functions in three

Sorted by popularity

function icon

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