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

相关推荐
excel几秒前
微信小程序插件从发布到使用的完整实战指南
前端
C# 学习者4 分钟前
C# 为异步函数实现WaitAsync方法
java·前端·c#
逆风优雅14 分钟前
vue 实现自定义message 全局提示
前端·javascript·vue.js
艾小码17 分钟前
前端开发者必看!JavaScript这些坑我替你踩过了
前端·javascript
浮游本尊17 分钟前
React 18.x 学习计划 - 第六天:React路由和导航
前端·学习·react.js
fruge3 小时前
Vue项目中的Electron桌面应用开发实践指南
前端·vue.js·electron
漂流瓶jz9 小时前
Webpack中各种devtool配置的含义与SourceMap生成逻辑
前端·javascript·webpack
前端架构师-老李9 小时前
React 中 useCallback 的基本使用和原理解析
前端·react.js·前端框架
木易 士心10 小时前
CSS 中 `data-status` 的使用详解
前端·css
明月与玄武10 小时前
前端缓存战争:回车与刷新按钮的终极对决!
前端·缓存·回车 vs 点击刷新