Three.js - HemisphereLight 光源

HemisphereLight是半球光源,使用半球光光源可以创建出更加贴近自然的效果,并不是所有的光源都来自上方,更多的是来自外部的反射,例如天空的反射,地面的反射,以及其他物体的反射。
示例浏览地址:https://ithanmang.gitee.io/threejs/home/201808/20180801/01-hemisphereLight.html
这里写图片描述

构造函数

HemisphereLight( skyColor : Integer, groundColor : Integer, intensity : Float )
skyColor - (可选) 从天空发出的光线的颜色 默认0xffffff.
groundColor - (可选) 从地面发出的光线颜色. 默认0xffffff.
intensity - (可选) 光线照射的强度. 默认1.

属性
属性 简介
castShdaw 默认为undefined,因为半球光光源不能投射阴影
color 这是构造函数中传递来的天空的天空的颜色skyColor
groundColor 地面反射的光的颜色
isHemisphereLight 判断是否为HemisphereLight光源,默认为true
position 光源的照射位置,默认是从上到(0, 1, 0)
示例代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HemisphereLight 半球光源</title>
    <style>
        body {
   
            margin: 0;
            overflow: hidden;/*溢出隐藏*/
        }
    </style>
    <script src="../../libs/build/three.min.js"></script>
    <script src="../../libs/examples/js/controls/OrbitControls.js"></script>
    <script src="../../libs/examples/js/libs/dat.gui.min.js"></script>
    <script src="../../libs/examples/js/libs/stats.min.js"></script>
    <script src="../../libs/examples/js/Detector.js"></script>
</head>
<body>
<script>

    let stats = initStats();
    let scene, camera, renderer, hemiLight, controls, guiControls;
    let hemiLightHelper, directionalLightHelper;

    // 场景
    function initScene() {
   

        scene = new THREE.Scene();
        scene.background = new THREE.Color(0xB0E2FF);
        scene.fog = new THREE.Fog(scene.background, 1, 5000);
    }

    // 相机
    function initCamera() {
   

        camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 5000);
        camera.position.set(0, 0, 250)
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值