Three.js - Fisheye effect

前端 未结 5 1518
渐次进展
渐次进展 2021-02-03 15:12

So, I\'ve messed around with three.js, works out great. The only thing I can\'t figure out, is how to make a camera with a real fisheye effect.

How is that possible?

5条回答
  •  轮回少年
    2021-02-03 15:52

    Put a camera inside a reflective sphere. Make sure the sphere is double sided. Parent the camera and sphere together if you want to move it around your scene. Works like a charm:

    http://tileableart.com/code/NOCosmos/test.html

    borrowed from:

    http://mrdoob.github.io/three.js/examples/webgl_materials_cubemap_dynamic2.html

    cubeCamera = new THREE.CubeCamera( 1, 3000, 1024);
                cubeCamera.renderTarget.minFilter = THREE.LinearMipMapLinearFilter;
    scene.add( cubeCamera );
    camParent.add(cubeCamera);
    var material = new THREE.MeshBasicMaterial( { envMap: cubeCamera.renderTarget } );
    material.side = THREE.DoubleSide;
    sphere = new THREE.Mesh( new THREE.SphereGeometry( 2, 60, 30 ), material );
    

提交回复
热议问题