-
Notifications
You must be signed in to change notification settings - Fork 296
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
Mesh Distance Fields and maybe Nanite? #1508
Comments
I have just noticed that issue #1172 is linked to this as well and I would love to take a crack at it |
Yes, that's where the
In this case, I suspect it would be much easier to simply download the model from Cesium ion - using the Clips feature if necessary - and then add it to Unreal with the normal workflow. Trying to go via 3D Tiles -> Nanite statically seems like unnecessary complexity to me, but maybe it's justified for a reason that isn't obvious to me. If we could do it at runtime, that would be another story.
It's pretty typical that you need to spend a lot of time spelunking through the Unreal source code in order to figure out how to do things at runtime that the Engine usually does at Editor time. |
Unfortunately we can't load the meshes into the Unreal Editor as we want to be able to load different 3d tiles from Cesium Ion and use a config file to tell Unreal which asset ids from Cesium Ion to load. This allows for us to add new 3d tiles to Cesium Ion and update a config file with the new ids without having to rebuild the Unreal application.
I stepped through that section with the debugger and it shows that the source mesh is not populated when loading the static mesh. The part that I am struggling to find is where the mesh is actually generated. By my understanding it must download the vertex, uv, normal data from Cesium Ion and use that to generate the mesh, possibly using a |
Upon further investigation, I have discovered that the |
That makes sense, but it sounds like it's at odds with baking Nanite meshes at Editor time, no? I guess you're saying that because you don't have LODs, you only need to create the Nanite mesh once when it's first loaded, not incrementally as new tiles are loaded. If I have that correct, I don't think it solves the fundamental problem: Nanite meshes can only be created in the Editor (as far as I know). Doing the baking per tile isn't particularly hard (we do lots of things per tile). The question is just whether UE allows us to do the baking in a game (versus Editor) at all.
We do as much of that work as we can off the game thread in order to improve performance. It's in that same file, though. The entry point is loadModelAnyThreadPart. The part that actually populates the position data is in loadPrimitive (other attributes are nearby).
Yeah that is unfortunately common and not too surprising. It's possible there's a "lower level" way to do it that is available at runtime (perhaps by including an extra module that is usually only used by the Editor?), but there are no guarantees. |
Hi there!
I'm looking into Lumen in Unreal Engine and have discovered that Cesium's tiles do not have any mesh distance fields generated. This causes Lumen to behave primarily in screen space and global illumination doesn't behave as well as it should.
I want to look into building these distance fields at runtime when a tile is loaded. I have been looking at the
UCesiumGltfComponent
and I can see some references to a static mesh here, but I am unable to tell if this is where the mesh is actually generated? Any insight on where mesh generation actually occurs would be fantastic.As an addition with this, I would also like to experiment with building Nanite meshes from the Cesium tiles when they are loaded. I understand that tiles are streamed in and the building is meant to happen in editor as it is quite expensive to do at runtime, however my use case is that I have some 3d models that do not have LODs and are loaded as 3d tiles from Cesium Ion. This means that Nanite (and distance fields) only need to be created once it has loaded and it will remain loaded.
What I have already tried is inside the
UCesiumGltfComponent::loadPrimitiveGameThreadPart
I have taken the reference to theUStaticMesh
and set generate distance fields to true as well as enable Nanite. However calling theBuild
function throws a warning saying that the StaticMesh has no source models, so I feel I'm looking in the wrong place here.Any help and or insight would be appreciated!
Many thanks,
Kieran
The text was updated successfully, but these errors were encountered: