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

  • 17
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

allenjiao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值