Search code examples
three.jsaframe

Set a Maximum Range for Face Rendering in AFrame scene


i got a Scene which loads a very large .obj File (a lot of faces), this results in low fps ...

I want to set a maximum distance from camera where faces should be rendered.

So far i only tried to use the fog component, which does not what i expected...

Anyone got a idea ?


Solution

  • I believe you can achieve this by a THREE.PerspectiveCamera property called far which determines the camera frustum far plane.

    You can check it out in the docs. It can be easily set it like this:

    let scene = document.querySelector("a-scene")  
    scene.camera.far = 3 // default is 1000 afaik
    

    Check it out in this fiddle (move around a bit).
    Here i threw it into an aframe component.