ZeroCool940711 / Sandbox-Game-Engine

GNU General Public License v3.0
4 stars 1 forks source link

Use CGAL to create automatic or semi-automatic LOD #19

Open ZeroCool940711 opened 5 years ago

ZeroCool940711 commented 5 years ago

My proposal is to use CGAL or more specifically the Triangulated Surface Mesh Simplification algorithm from CGAL to create automatic LOD (Level of Detail) to optimize every model. This could be done in multiple ways but I propose two approaches, the first one is semi-automatic and will be used mainly on the ModelEditor, from the ModelEditor a Level Design or an Artist will import a model and selecting the LOD tab will use CGAL to generate multiple resolution models from the original imported model and depending on the resolution and the model size and type the engine will use the appropriate model LOD. The second option is to use CGAL to create dynamic LOD for models in real time according to the position of the camera on the world, for example, if we have a House and a Wall in front of it the house will be partially visible, for the part of the model that is hidden from the camera we'll use CGAL to simplify the mesh while the part that is visible to the camera will continue to use the version of the mesh with higher detail, by simplifying only part of the mesh we can optimize the mesh easily and improve FPS without showing any artifact that is normally shown when you switch from one model to another with the normal LOD system. For those models that are completely hidden from the camera then the Occlusion Culling system will remove the object, by using CGAL to dynamically adjust the LOD we can load a model in parts if it was previously hidden, in the previous example if the house is completely hidden behind the wall and we are getting close from the corner part of the house will start to become visible and we can load the model starting from that side and automatically reduce the detail on the other sides that are not visible to speed up the loading process and also free resources that could be used for other nearby objects.