xeolabs / xeogl

A WebGL-based 3D engine for technical visualization. Not actively maintained.
http://xeogl.org
Other
1.15k stars 264 forks source link

Handling large meshes #280

Closed harshitlalpura closed 5 years ago

harshitlalpura commented 5 years ago

Hello

I am trying to render large mesh (gltf file). But frame rate drops. Is there any way to render only part which i am viewing. Please help.

Thank You.

xeolabs commented 5 years ago

You probably have a very large number of objects (ie. glTF scene nodes) within your glTF file, which will result in a large number of WebGL draw calls, which will generally be slow to render, regardless of which WebGL library you use.

Although xeogl doesn't do it natively, the solution for these cases is usually to implement frustum culling, which you can do at the application level, by setting the culled properties of objects false while those objects are outside of the viewing frustum (which you can compute from the Camera view and projection matrices).

This is not implemented as a core function function of xeogl, but it's a fairly standard optimization, which you should be able to find algorithms for online.

You can also hide objects that fall beyond a certain distance from the camera viewpoint.

Another approach is to hide some of the objects (say, the smallest or least visually significant ones) while the camera is moving, then show them again after the camera has remained stationary for a certain amount of time.

Those are two general techniques - hope it helps.

tldddd commented 5 years ago

I'd like to +1 to having native frustum culling and hiding elements during camera movement.

Main reason being that any viewer is always compared to Navisworks or Forge which can both handle very large models at high frame rates even when the camera is moving due to the above techniques.