美文网首页
resize 窗口时,如何实现渲染物体大小不变

resize 窗口时,如何实现渲染物体大小不变

作者: 不决书 | 来源:发表于2019-10-15 16:56 被阅读0次

    We want all objects, regardless of their distance from the camera, to appear the same size, even as the window is resized.

    The key equation to solving this is this formula for the visible height at a given distance:

    visible_height = 2 * Math.tan( ( Math.PI / 180 ) * camera.fov / 2 ) * distance_from_camera;
    

    If we increase the window height by a certain percentage, then what we want is the visible height at all distances
    to increase by the same percentage.

    This can not be done by changing the camera position. Instead you have to change the camera field-of-view.
    http://jsfiddle.net/Q4Jpu/

    https://threejs.org/docs/#manual/en/introduction/FAQ

    相关文章

      网友评论

          本文标题:resize 窗口时,如何实现渲染物体大小不变

          本文链接:https://www.haomeiwen.com/subject/iyrsuctx.html