在Threejs中,光源用Light表示,它是所有光源的基类。它的构造函数是:

THREE.Light ( hex )

它有一个参数hex,接受一个16进制的颜色值。例如要定义一种红色的光源,我们可以这样来定义:

Var redLight = new THREE.Light(0xFF0000);

Three.js内置了多种光源可以直接调用:

  • AmbientLight(环境光)
  • AreaLight(区域光)
  • DirectionalLight(平行光)
  • HemisphereLight(半球光)
  • PointLight(点光源)
  • SpotLight(聚光灯)
<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>我的第一个WebGL程序</title>

    <style>body { margin: 0; overflow: hidden; }; canvas { width: 100%;  height: 100%; }</style>

</head>

<body>

    <script src="libs/three.js"></script>

    <script>

        //创建场景

        var scene = new THREE.Scene();

        //创建摄影机

        var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000);

        camera.position.set(100, 100, 100);

        camera.lookAt(scene.position);

        //创建绿色立方体

        var box = new THREE.Mesh(

            new THREE.CubeGeometry(5, 5, 40),

            new THREE.MeshLambertMaterial({

                color: 0x00ff00

            }));

        box.position.set(10, 20, 10);

        scene.add(box);

        //创建红色地面

        var ground = new THREE.Mesh(

            new THREE.CubeGeometry(100, 1, 100),

            new THREE.MeshLambertMaterial({

                color: 0xff0000,

            }));

        ground.position.set(0, 5, 0);

        ground.receiveShadow = true;

        scene.add(ground);

        //创建渲染器并把设置背景为蓝色

        var renderer = new THREE.WebGLRenderer();

        renderer.setSize(window.innerWidth, window.innerHeight);

        renderer.setClearColor(0x0000ff, 1);

        document.body.appendChild(renderer.domElement);

        //渲染画面

        renderer.render(scene, camera);

    </script>

</body>

</html>

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABREAAAL7CAIAAADlGFUiAAAaxElEQVR4nO3XW27cSAAEQd//0t6PBYSF15aleTCLZCTiAGVOs2n9+PHjJwAAAPA7/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAACATf0CAAAA2NQvAAAAgE39AgAAANjULwAAAIBN/QIAAADY1C8AAF7oo3wJAFxAvwAAeN4n5dsA4Lz6BQDAM75YvhMAzqhfAAA84OHy5QBwIv0CAOBbXlL+rwCAU+gXAABf9PLyfxEAjOsXAACfO6D83wgAm/oFAMCfHFz+7wWANf0CAOAXefkTAIAR/QIA4MNU+dMAgFy/AAD4Wf95/En5kwGAUL8AAO7sROXPCgCO1y8AgHs6aflzA4A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AAAAAm/oFAAAAsKlfAAAAAJv6BQAAALCpXwAAAACb+gUAAACwqV8AAAAAm/oFAAAAsKlfAAAAAJv6BQAAALCpXwAAAACb+gUAAACwqV8AAAAAm/oFAAAAsKlfAAAAAJv6BQAAALCpXwAAAACb+gUAAACwqV8AAAAAm/oFAAAAsKlfAAAAAJv6BQAAALCpXwAAAACb+gUAAACwqV8AAAAAm/oFAAAAsKlfAAAAAJv6BQAAALCpXwAAAACb+gUAAACwqV8AAAAAm/oFAAAAsKlfAAAAAIv+ARFWuadpS38LAAAAAElFTkSuQmCC" alt="" />

现在运行页面,我们只能看到蓝色的背景和一块黑色的几何体,因为我们还没有加入灯光,所以一切的物体都是黑色的。立方体和地面的材质均为MeshLambertMaterial(类似纸张,可以均匀反射接收到的光线)。

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>我的第一个WebGL程序</title>

    <style>body { margin: 0; overflow: hidden; }; canvas { width: 100%;  height: 100%; }</style>

</head>

<body>

    <script src="libs/three.js"></script>

    <script>

        //创建场景

        var scene = new THREE.Scene();

        //创建摄影机

        var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000);

        camera.position.set(300, 300, 300);

        //创建绿色立方体

        var box = new THREE.Mesh(

            new THREE.CubeGeometry(5, 5, 40),

            new THREE.MeshLambertMaterial({

                color: 0x00ff00

            }));

        box.position.set(0, 15, 0);

        box.castShadow = true;

        scene.add(box);

        //创建红色地面

        var ground = new THREE.Mesh(

            new THREE.CubeGeometry(200, 1, 200),

            new THREE.MeshLambertMaterial({

                color: 0xff0000,

            }));

        ground.receiveShadow = true;

        scene.add(ground);

        //创建渲染器并把设置背景为蓝色

        var renderer = new THREE.WebGLRenderer();

        renderer.setSize(window.innerWidth, window.innerHeight);

        renderer.setClearColor(0x0000ff);

        renderer.shadowMapEnabled = true;

        document.body.appendChild(renderer.domElement);

        //添加聚光灯

        var light = new THREE.SpotLight( 0xffffff, 3 );

        light.position.set( 100, 200, 50 );

        light.castShadow = true;        

        light.shadowCameraNear = 50;

        light.shadowCameraFar = 300;

        light.shadowCameraFov = 30;

        scene.add( light );

        //渲染画面

        var render = function() {

            requestAnimationFrame(render);

            box.rotation.y += 0.01;

            ground.rotation.y += 0.01;

            camera.lookAt(scene.position);

            renderer.render(scene, camera);

        };

        render();

    </script>

</body>

</html>

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABdEAAALDCAIAAAB1jt5DAAAfrklEQVR4nO3dW3Jj2XluUXRMTjdMR+VuWfKx3QBf5MbY4UtY6YdKVjKZvGMDc+1/jYzxIimJNUECm4ovNqoul8tXAAAAAI7WFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAAAAAMzTFwAAAADM0xcAAAAAzNMXAA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AAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAADm6QsAAAAA5ukLAAAAAObpCwAAAACm+T9PRlfFZAyrKwAAAABJRU5ErkJggg==" alt="" />

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Three框架</title>
<script src="libs/three.js"></script>
<style type="text/css">
div#canvas-frame {
border: none;
cursor: pointer;
width: 100%;
height: 600px;
background-color: #EEEEEE;
} </style>
<script>
var renderer;
function initThree() {
width = document.getElementById('canvas-frame').clientWidth;
height = document.getElementById('canvas-frame').clientHeight;
renderer = new THREE.WebGLRenderer({
antialias : true
});
renderer.setSize(width, height);
document.getElementById('canvas-frame').appendChild(renderer.domElement);
renderer.setClearColor(0xFFFFFF, 1.0);
} var camera;
function initCamera() {
camera = new THREE.PerspectiveCamera(45, width / height, 1, 10000);
camera.position.x = 600;
camera.position.y = 0;
camera.position.z = 600;
camera.up.x = 0;
camera.up.y = 1;
camera.up.z = 0;
camera.lookAt({
x : 0,
y : 0,
z : 0
});
} var scene;
function initScene() {
scene = new THREE.Scene();
} var light;
function initLight() {
} var cube;
function initObject() {
var geometry = new THREE.CubeGeometry( 200, 100, 50,4,4);
var material = new THREE.MeshLambertMaterial( { color:0xFFFFFF} );
var mesh = new THREE.Mesh( geometry,material);
mesh.position = new THREE.Vector3(0,0,0);
scene.add(mesh);
} function threeStart() {
initThree();
initCamera();
initScene();
initLight();
initObject();
renderer.clear();
renderer.render(scene, camera);
} </script>
</head> <body onload="threeStart();">
<div id="canvas-frame"></div>
</body>
</html>

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhgAAAD+CAIAAAD3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D4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYVxvIAuEhD4hYTy/8PjHtx9d7yS/ICT0CQlv9Pwj4XknhIQ+IaHnX8PzU3uud/jDExL6hIT36/889Fzv9rsjJPQJCZ+Ht21PQsIFIeHr+jTh+X6pj8fj+fn5+r7y5QgJ/IbaZ56XB3x5ou9nv74TMIQE/qDXHnp+Ig98aEICQERIAIgICQARIQEgIiQARIQEgIiQABAREgAiQgJAREgAiAgJABEhASAiJABEhASAiJAAEBESACJCAkBESACICAkAESEBICIkAESEBICIkAAQERIAIkICQERIAIgICQARIQEgIiQARIQEgIiQABAREgAiQgJAREgAiAgJABEhASAiJABEhASAiJAAEBESACJCAkBESACICAkAESEBICIkAESEBICIkAAQERIAIkICQERIAIgICQARIQEgIiQARIQEgIiQABAREgAiQgJAREgAiAgJABEhASAiJABEhASAiJAAEBESACJCAkBESACICAkAESEBICIkAET+BrJiYDbiS0i5AAAAAElFTkSuQmCC" alt="" />

  <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Three框架</title>
<script src="libs/three.js"></script>
<style type="text/css">
div#canvas-frame {
border: none;
cursor: pointer;
width: 100%;
height: 600px;
background-color: #EEEEEE;
} </style>
<script>
var renderer;
function initThree() {
width = document.getElementById('canvas-frame').clientWidth;
height = document.getElementById('canvas-frame').clientHeight;
renderer = new THREE.WebGLRenderer({
antialias : true
});
renderer.setSize(width, height);
document.getElementById('canvas-frame').appendChild(renderer.domElement);
renderer.setClearColor(0xFFFFFF, 1.0);
} var camera;
function initCamera() {
camera = new THREE.PerspectiveCamera(45, width / height, 1, 10000);
camera.position.x = 600;
camera.position.y = 0;
camera.position.z = 600;
camera.up.x = 0;
camera.up.y = 1;
camera.up.z = 0;
camera.lookAt({
x : 0,
y : 0,
z : 0
});
} var scene;
function initScene() {
scene = new THREE.Scene();
} var light;
function initLight() {
// A start
light = new THREE.AmbientLight(0xFF0000);
light.position.set(100, 100, 200);
scene.add(light);
// A end } var cube;
function initObject() {
var geometry = new THREE.CubeGeometry( 200, 100, 50,4,4);
// B start
var material = new THREE.MeshLambertMaterial( { color:0x880000} );
// B end
var mesh = new THREE.Mesh( geometry,material);
mesh.position = new THREE.Vector3(0,0,0);
scene.add(mesh);
} function threeStart() {
initThree();
initCamera();
initScene();
initLight();
initObject();
renderer.clear();
renderer.render(scene, camera);
} </script>
</head> <body onload="threeStart();">
<div id="canvas-frame"></div>
</body>
</html>
  <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Three框架</title>
<script src="libs/three.js"></script>
<style type="text/css">
div#canvas-frame {
border: none;
cursor: pointer;
width: 100%;
height: 600px;
background-color: #EEEEEE;
} </style>
<script>
var renderer;
function initThree() {
width = document.getElementById('canvas-frame').clientWidth;
height = document.getElementById('canvas-frame').clientHeight;
renderer = new THREE.WebGLRenderer({
antialias : true
});
renderer.setSize(width, height);
document.getElementById('canvas-frame').appendChild(renderer.domElement);
renderer.setClearColor(0xFFFFFF, 1.0);
} var camera;
function initCamera() {
camera = new THREE.PerspectiveCamera(45, width / height, 1, 10000);
camera.position.x = 600;
camera.position.y = 0;
camera.position.z = 600;
camera.up.x = 0;
camera.up.y = 1;
camera.up.z = 0;
camera.lookAt({
x : 0,
y : 0,
z : 0
});
} var scene;
function initScene() {
scene = new THREE.Scene();
} var light;
function initLight() {
// A start
light = new THREE.AmbientLight(0xFF0000);
light.position.set(100, 100, 200);
scene.add(light);
// A end } var cube;
function initObject() {
var geometry = new THREE.CubeGeometry( 200, 100, 50,4,4);
// B start
var material = new THREE.MeshLambertMaterial( { color:0x880000} );
// B end
var mesh = new THREE.Mesh( geometry,material);
mesh.position = new THREE.Vector3(0,0,0);
scene.add(mesh);
} function threeStart() {
initThree();
initCamera();
initScene();
initLight();
initObject();
renderer.clear();
renderer.render(scene, camera);
} </script>
</head> <body onload="threeStart();">
<div id="canvas-frame"></div>
</body>
</html>

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfkAAAERCAIAAAD3w0lcAAAGeUlEQVR4nO3ZQU6cVxSEUZbGzphmJdkGA6/EK0kGkbjIKqzY13Bx+RzVEHX/aqTv0Y+HfwBo93D9AAC8O60H6Kf1AP20HqCf1gP003qAfloP0E/rAfppPUA/rQfop/UA/bQeoJ/WA/TTeoB+Wg/QT+sB+mk9QD+tB+in9QD9tB6gn9YD9NN6gH5aD9BP6wH6aT1AP60H6Kf1AP20HqCf1gP003qAfloP0E/rAfppPUA/rQfop/UA/bQeoJ/WA/TTeoB+Wg/QT+sB+mk9QD+tB+in9QD9tB6gn9YD9NN6gH5aD9BP6wH6aT1AP60H6Kf1AP20HqCf1gP003qAfloP0E/rAfppPUA/rQfop/UA/bQeoJ/WA/TTeoB+Wg/QT+sB+mk9QD+tB+in9QD9tB6gn9YD9NN6gH5aD9BP6wH6aT1AP60H6Kf1AP20HqCf1gP003qAfloP0E/rAfppPUA/rQfop/UA/bQeoJ/Wwzv6+vz8si9PT3Gvf+b6eaml9fAD3mr334+PL/vr4WG/1y/oVGBP6/mjvfVH9y9v9/vtm1PBMUCk9fT4zoXJ7xLu/b48PV3/HviMtJ7PS7u1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5bZt+f1hNpPT/p9cHgbPg803oirefjxLPhm+PhvJW/+7SeSOv5vP7PV4fztn62aT2R1tPDtZLW8xat589Vcza8POqXp6evz8/XnyufkdbDD/iwfzm8fsHXb/Ty7tefBL8ZrYd39NZXh2+m4Lw3rQfop/UA/bQeoJ/WA/TTeoB+Wg/QT+sB+mk9QD+tB+in9QD9tB6gn9YD9NN6gH5aD9BP6wH6aT1AP60H6Kf1AP20HqCf1gP003qAfloP0E/rAfppPUA/rQfop/UA/bQeoJ/WA/TTeoB+Wg/QT+sB+mk9QD+tB+in9QD9tB6gn9YD9NN6gH5aD9BP6wH6aT1AP60H6Kf1AP20HqCf1gP003qAfloP0E/rAfppPUA/rQfop/UA/bQeoJ/WA/TTeoB+Wg/QT+sB+mk9QD+tB+in9QD9tB6gn9YD9NN6gH5aD9BP6wH6aT1AP60H6Kf1AP20HqCf1gP003qAfloP0E/rAfppPUA/rQfop/UA/bQeoJ/WA/TTeoB+Wg/QT+sB+mk9QD+tB+in9QD9tB6gn9YD9NN6gH5aD9BP6wH6aT1AP60H6Kf1AP20HqCf1gP0+xet3moTGnx1SAAAAABJRU5ErkJggg==" alt="" />

three.js光源的更多相关文章

  1. 初探three.js光源

    上一节我们简单的说了一下THREE中必要的元素.今天我们深入探讨一下各种THREE的光源. 一 基础光源 基础光源有4种1.THREE.AmbientLight(环境光源)2.THREE.PointL ...

  2. Three.js的光源投影

    Three.js的光源默认不会导致物体间的投影,打开投影需要执行以下几步: 打开渲染器的地图阴影: renderer.shadowMapEnabled = true; 启用光线的投影:light.ca ...

  3. 深入理解three.js中光源

    前言: Three.js 是一个封装了 WebGL 接口的非常好的库,简化了 WebGL 很多细节,降低了学习成本,是当前前端开发者完成3D绘图的得力工具,那么今天我就给大家详细讲解下 Three.j ...

  4. 深入理解three.js中平面光光源RectAreaLight

    前言 之前有深入讲解过Three.js中光源,在那篇文章的最后也说了由于平面光光源的特殊性,所以会单独拿出来讲解,这篇文章会详细的讲解平面光光源的特性和实际应用该如何使用. 首先,平面光光源从一个矩形 ...

  5. three.js学习4_光源

    Three.Light 首先展示的是使用半球光引用的效果, 光源直接放置于场景之上,光照颜色从天空光线颜色颜色渐变到地面光线颜色.光照主要有 AmbientLight 环境光 DirectionalL ...

  6. three.js入门系列之光源

    首先创建场景来试验各种光源带来的不同效果: 一.锥形光源(聚光灯) SpotLight 接下来缩小范围(π/7): 二.基础光源(环境光) AmbientLight 上例中没有添加环境光,使得周围黑漆 ...

  7. three.js加载obj模型

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xht ...

  8. Three.js基础部分学习

    一.关于使用Three.js几点理论说明 1.请参考官网地址 https://threejs.org/ 2.使用three.js必备条件 <场景 A scene.相机a camera.渲染器 a ...

  9. Three.js外部模型加载

    1.  首先我们要在官网: https://threejs.org/ 下载我们three.js压缩包,并将其中的build文件夹下的three.js通过script标签对的src属性导入到我们的页面中 ...

随机推荐

  1. C#实现把指定文件夹下的所有文件复制到指定路径下以及修改指定文件的后缀名

    1.实现把指定文件夹下的所有文件复制到指定路径下 public static void copyFiles(string path) { DirectoryInfo dir = new Directo ...

  2. Qt中如何添加.qrc文件

    You need a resource file (.qrc) within which you embed the input text file. The input file can be an ...

  3. 浅析 - 提高xib(Interface Builder)高效工作的几个小技巧

    本文译自:8 Tips for working effectively with Interface Builder(需FQ)先来看看目录:介绍使view的Size与view中的Content相适应按 ...

  4. UVA 111 History Grading

    读题读了好久,其实就是在输入数据时要对数据的位置进行相应的改变 #include<iostream> #include<cstring> #include<cstdio& ...

  5. .net学习笔记---xml操作及读写

    一.XML文件操作中与.Net中对应的类 微软的.NET框架在System.xml命名空间提供了一系列的类用于Dom的实现. 以下给出XML文档的组成部分对应.NET中的类: XML文档组成部分 对应 ...

  6. 与你相遇好幸运,MongoDB小技巧

    保存为bat方便: "C://Program Files//MongoDB//Server//3.2//bin//mongod.exe" --dbpath=D://corp//db ...

  7. VS对路径的访问被拒绝

    问题:权限问题. 1.检查自己电脑账户.是否是Administrator.如果没有启用.在[我的电脑]——[管理]——[本地用户和组]——[用户]——[Administrator]——[属性启用] 2 ...

  8. SQL链表查询 数据库为空

    查询出数据为空,解决方案:链表 对应字段长度不一致.

  9. Linux命令中特殊符号

    转自:http://blog.chinaunix.net/uid-16946891-id-5088144.html   在shell中常用的特殊符号罗列如下:# ; ;; . , / \ 'strin ...

  10. Centos6.5里安装Hbase(伪分布式)

    首先我们到官方网站下载Hbase,而我使用的版本是hbase-0.94.27.tar.gz 解压下来: tar zxvf hbase-.tar.gz 寻找java安装路径 [root@localhos ...