办公园区建筑科技风效果(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)

相关推荐
剪刀石头布啊1 分钟前
http状态码大全
前端·后端·程序员
剪刀石头布啊3 分钟前
iframe通信、跨标签通信的常见方案
前端·javascript·html
宇之广曜12 分钟前
搭建 Mock 服务,实现前端自调
前端·mock
yuko093114 分钟前
【手机验证码】+86垂直居中的有趣问题
前端
用户15129054522018 分钟前
Springboot中前端向后端传递数据的几种方式
前端
阿星做前端18 分钟前
如何构建一个自己的 Node.js 模块解析器:node:module 钩子详解
前端·javascript·node.js
用户15129054522021 分钟前
Web Worker:让前端飞起来的隐形引擎
前端
司宸22 分钟前
学习笔记十 —— 自定义hooks设计原则 笔试实现
前端
用户15129054522026 分钟前
踩坑与成长:WordPress、MyBatis-Plus 及前端依赖问题解决记录
前端·后端
半个烧饼不加肉32 分钟前
React + ts + react-webcam + CamSplitter 实现虚拟摄像头解决win摄像头独占的问题
前端·react.js·前端框架