Hellow Three.js 之 光影之谜
基础知识
Light 光源基类
各种派生类
1、AmbientLight 环境光

2、DirectionalLight 平行光

3、PointLight 点光源

4、SpotLight 聚光源

材质与光源
Last updated




Last updated
var amblight = new THREE.AmbientLight( 0x404040 );
scene.add( amblight );var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
directionalLight.position.set( 0, 1, 0 );
scene.add( directionalLight );var light = new THREE.PointLight( 0xff0000, 1, 100 );
light.position.set( 50, 50, 50 );
scene.add( light );// 白色聚光灯从侧面发光,投射阴影
var spotLight = new THREE.SpotLight( 0xffffff );
spotLight.position.set( 100, 1000, 100 );
spotLight.castShadow = true;
spotLight.shadow.mapSize.width = 1024;
spotLight.shadow.mapSize.height = 1024;
spotLight.shadow.camera.near = 500;
spotLight.shadow.camera.far = 4000;
spotLight.shadow.camera.fov = 30;
scene.add( spotLight );