-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement support for LOD generation in PrimitiveMesh #6279
Comments
Mesh resources don't have any awareness of how far away the camera is from the mesh, so there is no way to implement this with the way you're mentioning. Also, you wouldn't want mesh data to be regenerated every time the camera crosses a threshold (as this is slow for complex meshes). Instead, what we can do is implement support for LOD generation in PrimitiveMesh, while allowing PrimitiveMesh subclasses to provide manually created LODs (boxes/planes/spheres/cylinders with a lower subdivision level). Note that even if this is implemented, you will have to split your ocean into several PlaneMeshes so that each PlaneMesh can have its own LOD. This also allows creating holes within the ocean. You need to find a balance between the number of draw calls and number of polygons drawn here. In the meantime, you can do this using visibility ranges in 4.0 already. Create a grid of overlaid PlaneMeshes with different subdivision levels that are hidden and shown depending on the distance from the camera. (This would require a lot of work to do manually, but the intention here is that you script this 🙂) |
The reason i suggested tessellation/dynamic mesh over using multiple separate planes is that when the vertices of the edges of the plane don't match up, you may be able to see the borders of each plane. I cannot think of any clear solutions of it other than manually modelling each plane for each LOD transition. EDIT: Found this video that goes on a closely related topic, although I'm not sure how you would go about implementing holes in this approach. |
Seems like it, it does mention my use case of water. I mainly made this proposal with the fear of that one being rejected (despite there being some interest from users). |
Describe the project you are working on
Small test projects for fun.
Describe the problem or limitation you are having in your project
Currently there is no good built-in way to make large planes with dynamic detail, to use wavy oceans for example.
I assume #6109 will not work as you'd already have to supply it with a pre-made massively subdivided mesh.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
A new resource i'm dubbing
TessellatedPlaneMesh
, which should just work for the case i stated, and maybe some more.It would be like
PlaneMesh
, except with dynamically generated mesh detail based on camera proximity.Ideally there should also be a way to make holes in the plane, for example for caves or buildings below water level. If feasible the holes could also be made dynamic, for example for something like a ship.
Unreal's water system's meshing seems like a nice point of reference on how the mesh can be tessellated
https://docs.unrealengine.com/5.1/en-US/water-meshing-system-and-surface-rendering-in-unreal-engine/
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The mesh would have the following parameters
I don't know how the holes could be handled.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I assume not.
Is there a reason why this should be core and not an add-on in the asset library?
I assume GDScript might be too slow for this case, so it could potentially work as a GDExtension addon, but it might be generic enough to warrant it being in core.
The text was updated successfully, but these errors were encountered: