Book Image

Learning Three.js - the JavaScript 3D Library for WebGL

By : Jos Dirksen
Book Image

Learning Three.js - the JavaScript 3D Library for WebGL

By: Jos Dirksen

Overview of this book

Table of Contents (20 chapters)
Learning Three.js – the JavaScript 3D Library for WebGL Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
8
Creating and Loading Advanced Meshes and Geometries
Index

Advanced materials


In this section, we'll look at the more advanced materials Three.js has to offer. We'll first look at THREE.MeshPhongMaterial and THREE.MeshLambertMaterial. These two materials react to light sources and can be used to create shiny and dull-looking materials, respectively. In this section, we'll also look at one of the most versatile, but most difficult to use, materials: THREE.ShaderMaterial. With THREE.ShaderMaterial, you can create your own shader programs that define how the material and object should be shown.

THREE.MeshLambertMaterial

This material can be used to create dull-looking, non-shiny surfaces. This is a very easy-to-use material that responds to the lighting sources in the scene. This material can be configured with a number of properties we've seen before: color, opacity, shading, blending, depthTest, depthWrite, wireframe, wireframeLinewidth, wireframeLinecap, wireframeLineJoin, vertexColors, and fog. We won't go into the details of those properties, but...