Replies: 4 comments 4 replies
-
I feel this adds a lot of complexity that may not be effectively taken advantage of by most users. I value having a simpler but less powerful system, rather than a big and flexible solution that is difficult to wrangle. What I'd just do is:
All those items can be implemented independently from each other. However, we should probably fix godotengine/godot#58513 before implementing this in the Light3D and Decal distance fade systems.
Fading requires you to set the begin/end margin to values greater than 0. Also, materials will go through the transparent pipeline during fading, which means that transparency sorting issues can occur. To avoid this, there are plans to allow forcing dithering on entire materials with a single toggle, but it hasn't been implemented yet. |
Beta Was this translation helpful? Give feedback.
-
@reduz Has told me that AutoLOD will be extended to allow geometry streaming in the future, so it makes no sense merging it with VisRange. I guess then what does make sense is:
Why? To allow for multiple configurations to be reusable and globally controllable. Say you want to decrase the LOD distances for world models, but not character models - with LOD managing resources as long as you have them separate you can esily alter the resource in one place and everything updates. With every node having it;'s own settings this would require a lot of extra scripting, signals and manual updating for each node.
Why? Right now setting up VisRange distances and making them match between meshes is a completely manual process, that is wasteful and error-prone. Also very tedious to tweak and test.
This could be done with hierarchy and naming patterns. For example:
If a MeshInstance node has a child that has the same name only with
In the above example every part of the model has it's own LOD models. Child LOD groups (Scope, Mag, Hand) are governed by the parent LOD group (Gun) and will follow it's configured LOD distances, unless another LOD configuration is provided as an override. The LOD managing resource could specify if the submodels in the LOD group should be considered as a single mesh (all visiblity changes follow LOD0 - useful fro small scenes like character models) or work independently - each part keeps track of it's distance from camera and active LOD level separately (useful for very large scenes like entire environments or massive spaceships etc.). Note that dynamically adding models into this hierarchy would also make them follow the Gun's LOD policy - that'd be useful for cosmetics on player models, modular gun models etc. Why? Having to manually mark what objects belong to a common LOD group and which object defines what LOD level will be extremely tedious and error prone. It'd also allow much more UI work in the scene import dialog. Handling this via scene hierarchy and object naming is both easier for Godot devs and easier for users (as long as it's documented).
Why? Right now LOD distances do not care for camera FOV and screen resolution, this can lead to either rendering too much detail (on low resolutions or wider FOVs) or too little details (on higher resolutions or lower FOVs). |
Beta Was this translation helpful? Give feedback.
-
I started working on visibility range automatic FOV adjustment in a branch: https://github.com/Calinou/godot/tree/visibility-range-add-fov-adjust |
Beta Was this translation helpful? Give feedback.
-
Can you send some bug reports on this? |
Beta Was this translation helpful? Give feedback.
-
The problem
Godot 4 has two LOD features right now:
Both have limitations and strengths, and I think they should be merged together with some new features added to create a complete and integrated LOD system.
AutoLOD
Upsides
Downsides
The quality and efficiency of the generated LOD models is limited, as of course the system will not be able to discard and optimize geometry as well as an artist could, plus it's limited to re-using the same textures. It could maybe be possible to have it re-bake textures from the original model to preserve more detail in normal maps and reduce the triangle count even more etc but that'd be a very complex feature.
There's no way to preview or tweak the generated LOD models or to even know how many are generated.
Bugs
Currently in my project AutoLOD does not work at all. LOD models are either not generated or not utilized. This gave me a false sense of security and made me use mid-poly placeholder assets where I should've been using low-poly ones.
VisRange
Upsides
Allows superior quality and efficiency due to allowing the use of custom, highly optimized LOD models with unique textures for preserving maximum detail with less rendering cost in exchange for more artist work and possibly more asset storage required (due to optional use of unique LOD textures, not sure how much extra storage AutoLOD costs).
Allows for smooth fading between LOD models to reduce the LOD popping.
Downsides
Bugs
Fading doesn't seem to work correctly, or I don't know how to set it up.
What I think we need
AutoLOD and VisRange could be merged to utilize the strenghts of both and eliminate their weaknesses. It would require a few new features though.
The engine would allow objects in the imported scene to use the same name with _LOD0, _LOD1 etc suffixes to group the objects together into a single MipMesh resource. If there are no LOD models present, a regular Mesh resource is used instead.
Material resources could also be analyzed to deduplicate ones that differ only by used textures.
MipMap generation and imported texture resolution could be optimized for LOD models to not waste resources on detail that will not be visible.
Say my LOD0 model uses a 2K texure, but by accident my LOD1 model also uses 2K texture, that will never be rendered itsel, - only it's mipmaps. Then the texel density of LOD0 can be estimated and an optimal textrue resolution for LOD1 can be derived, then the LOD1 textures can be imported in lower resolution, saving storage and video memory without any visual impact.
Similarly for LOD0 there is no point generating mipmaps that will never be rendered if LOD1 kicks in earlier.
If LOD models use the same material, the textures could probably be atlassed like MipMaps to optimize the rendering, especially when two LOD models are rendered at one during fading. This makes even more sense to use a custom resource and handle this during the import process - manual LOD setup could never do things like this, but a deep engine integration can provide such benefits.
If we go further with this idea - the MipMeshes and MipMaps can work together, optimizing rendering and memory to use lower-fidelity meshes with their custom textures on a lower level.
As long-term improvement, the AutoLOD models could be automatically UV unwrapped and have custom textures baked based on the LOD0 model - this could provide even better visual fidelity with lower rasterization impact, ultimately providing fully automatic advanced LOD generation that can be optimizeed with manual assets if need be, but in many instances would provide great looks out of the box. Althought obviously baking PBR maps on import would probably take some time and could be very error prone.
The AutoLOD could also take a few passes to optimize meshes further by testing visual difference vs polycount vs rendering time in passes to tweak the settings per-LOD mesh to optimize the results in exchange for extended import post-processing time.
What are your thoughs?
Beta Was this translation helpful? Give feedback.
All reactions