Godot-proposals: Add support for 3D Level of Detail

Created on 10 Apr 2020  路  3Comments  路  Source: godotengine/godot-proposals

I'm going to ignore the issue template because this has been confirmed to be implemented in the future.

I'm opening this issue because the conversation arround LOD is scattered by multiple issues and I think it is important to have a common place to discuss the technical details of a feature (and move the discussion of the design to the proposals repository).

I'm going to ignore all the "automatic LOD generation" issues and focus on the LOD logic itself.

First of all, here is a list of related issues:
Setting up the minimal LOD to use
Add LoD hysteresis
LOD is not working (also for particles)
Ability to do per-viewport, customizable LoD in 3D
Bugsquad edit: Add support for automatic LOD generation

Technical details to consider:

  • The LOD system should be usable for imported models and procedural meshes created with the RenderingServer.
  • LOD configuration.
  • Hystereis/bias in transitions.
  • Hierarchical level of detail.
  • Based on a main camera or support multiple cameras.
  • Content streaming.
  • Hability to set Per-Platform LOD configuration.

LOD configuration

The actual exposed (and not implemented) API for GeometryInstance is based on distance range and an hystereis max and min value.
Some modern engines configure their LOD system based on how much screen space the mesh take. That way smaller meshes will transition sooner than bigger ones sharing the same configuration.
See Documentation from other engines for reference.

Hystereis/bias in transitions

Most engines can configure not only the condition of the transition but how the transition is made.
Changing from one mesh to the one in the next LOD produces an awful visual "popping", a proper LOD system should be able to handle mesh transitions too.

For example, Assasins Creed 3 used a dithering technique for LOD blending
Here is an implementation for Unity3D: https://github.com/keijiro/CrossFadingLod

Hierarchical level of detail

Another LOD approach (and not mutually exclusive with the previously mentioned) is the hierarchical level of detail. With this a single mesh can replace multiple smaller ones. It greatly helps reducing the mesh count for the areas far from the camera.
https://docs.unrealengine.com/en-US/Engine/HLOD/index.html

Based on a main camera or support multiple cameras

I don't know how LOD can be handled for multiple cameras, maybe we can try to implement it for a single camera to keep the scope realistic and try to explore alternatives in the future but preserving the exposed API.

Content streaming

Related issue: https://github.com/godotengine/godot/issues/17556

Games like GTA 5 use this mechanism to be able to manage big open worlds without needing a huge amount of RAM: https://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study-part-2/#asset-streaming

Per-Platform LOD configuration

This is useful for platforms with lower processing power like HTML5 and mobile.
Other engines implement this feature: https://docs.unrealengine.com/en-US/Engine/Content/Types/StaticMeshes/PerPlatformLOD/index.html

Documentation from other engines

It can serve as reference for how to expose the configuration.

Unity:

Unreal:

Cryengine:

rendering

Most helpful comment

I have a pitch for how this can work.

  • A new node known as an LODGroup can be used to manage multiple LOD levels.

    • It can have 1-8 GeometryInstances as children. Their order determines what LOD level they represent.

    • Each of those children can have sub-children allowing for Hierarchical LOD.

  • The LOD system will be screen coverage dependent like Unity. That way the LODs will work consistently with different Cameras and Viewports.
  • A Viewport can have an LOD bias and a minimum base LOD, including the main game Viewport, allowing variations across platforms.
  • In the VisualServer (RenderingServer in 4.0) the LODGroup will be used to determine what gets culled from rendering per Viewport.
  • Shadow maps, Reflection Probes, Baked Light, etc.. will all only use the minimum LOD level when doing their computations.
  • LOD cross fading should also be available. This tutorial gives a good idea on how that could work.

All 3 comments

Related to #657.

Dithering for LOD blending should be feasible by reusing the Distance Fade "Object Dither" SpatialMaterial effect that's already present in Godot 3.x. (I don't think it has been reimplemented in Vulkan yet, or has it?)

I have a pitch for how this can work.

  • A new node known as an LODGroup can be used to manage multiple LOD levels.

    • It can have 1-8 GeometryInstances as children. Their order determines what LOD level they represent.

    • Each of those children can have sub-children allowing for Hierarchical LOD.

  • The LOD system will be screen coverage dependent like Unity. That way the LODs will work consistently with different Cameras and Viewports.
  • A Viewport can have an LOD bias and a minimum base LOD, including the main game Viewport, allowing variations across platforms.
  • In the VisualServer (RenderingServer in 4.0) the LODGroup will be used to determine what gets culled from rendering per Viewport.
  • Shadow maps, Reflection Probes, Baked Light, etc.. will all only use the minimum LOD level when doing their computations.
  • LOD cross fading should also be available. This tutorial gives a good idea on how that could work.

I have done the lod generation portion of this, but it's lacking the engine implementation.

https://github.com/godotengine/godot-proposals/issues/657#issuecomment-640254293

  1. It needs to use a screen space metric for the mesh.
  2. A single mesh needs to share the same vertex array but have different indices arrays.
  3. The above comment's lod grouping work
Was this page helpful?
0 / 5 - 0 ratings