办公园区建筑科技风效果(html+threejs)

办公楼科技风(Html+threejs)

初始化三维场景

复制代码
function init() {

    container = document.getElementById('container');

    camera = new THREE.PerspectiveCamera(65, window.innerWidth / window.innerHeight, 0.1, 150000000);
    camera.position.set(550, 600, 690);

    scene = new THREE.Scene();
    // scene.background = new THREE.Color(0x426ab3);
    scene.background = new THREE.Color(0x0);

    renderer = new THREE.WebGLRenderer({
        //logarithmicDepthBuffer: true,  // 使用精度更高的z缓冲
        antialias: true,  // 设置抗锯齿,
        alpha: true       // 是否可以设置背景色透明。必须设置为true,才能出现镜头光晕效果
    });
    renderer.setPixelRatio(window.devicePixelRatio);
    renderer.setSize(window.innerWidth, window.innerHeight);
    container.appendChild(renderer.domElement);

    // const light = new THREE.HemisphereLight(0xffffff, 0x909090, 0.8);
    // scene.add(light);
    const light = new THREE.AmbientLight( 0xffffff,1 ); // soft white light
    scene.add( light );

    const directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
    directionalLight.position.set(550, 4600, 690);
    scene.add(directionalLight);

    const light2 = new THREE.PointLight( 0xffffff, 0.25 );
    light2.position.set( 1550, 3500, 0 );
    scene.add( light2 );

    controls = new THREE.OrbitControls(camera, renderer.domElement);
    // controls.minDistance = 1;
    // controls.maxDistance = 100000;
    controls.target.set(0, 1, 0);
    controls.update();

    stats = new Stats();
    container.appendChild(stats.dom);

    window.addEventListener('resize', onWindowResize, false);

}

办公楼科技风2(Html+threejs)

​​​​​​​

办公园区科技风效果(Html+threejs)

相关推荐
小墨宝13 分钟前
js 生成pdf 并上传文件
前端·javascript·pdf
睿创咨询18 分钟前
科技与商业动态简报
人工智能·科技·ipd·商业
HED29 分钟前
用扣子快速手撸人生中第一个AI智能应用!
前端·人工智能
DN金猿33 分钟前
使用npm install或cnpm install报错解决
前端·npm·node.js
丘山子33 分钟前
一些鲜为人知的 IP 地址怪异写法
前端·后端·tcp/ip
志存高远661 小时前
Kotlin 的 suspend 关键字
前端
九河云1 小时前
物联网赋能玻璃制造业:实现设备智能管理与生产协同
科技·物联网·重构·云计算·制造
www_pp_1 小时前
# 构建词汇表:自然语言处理中的关键步骤
前端·javascript·自然语言处理·easyui
天天扭码2 小时前
总所周知,JavaScript中有很多函数定义方式,如何“因地制宜”?(ˉ﹃ˉ)
前端·javascript·面试
一个专注写代码的程序媛2 小时前
为什么vue的key值,不用index?
前端·javascript·vue.js