Hi, small premis, i’m a newbie to UE5 and game development. I’m currently working on a project that uses a compute shader to create a terrain mesh from different types of noise. During the development i noticed that the CPU readback of the mesh data from the GPU causes a huge performance drop and i was wondering if it’s possible to avoid it.
The data flow is the following:
CPU (mesh parameters) → GPU (mesh creation) → CPU (mesh readback) → GPU (mesh rendering).
So, my question is, how can i submit the mesh to the rendering pipeline without having to read its data back from the GPU?
I know that in Unity this can be done using the scriptable render pipeline but i don’t know if there is something similar in UE5.
I’ve recently been working on a voxel editor for Unreal that runs in game play. The readback from GPU to CPU is generally slow just due to hardware limitations so the trick is to minimize the number of times you move the meshes. Is this doing multiple passes on the terrain so you can see it being created?
Yes, the terrain is created in multiple passes. The first pass creates the base mesh and the second adds details, so yes i want to see the mesh being created.
Depends on what the data is. I was thinking if it’s height map data you could do something like render to target. Then in a material you could sample the texture and use World Position Offset to display the height. I don’t think this is moving it from GPU to CPU because it’s only a visual effect. It wouldn’t have proper collision but you could see it being built. At the end you could move it from the GPU into a procedural mesh or something like that. If it’s a volume texture (3D texture) you could do something similar where you read the volume texture and display it with a volumetric effect like fog. If it’s mesh data there might be some way to flag it as a mesh on the GPU. I don’t know the specifics of how to do this in Unreal. I found this though. Update vertex buffer with data from GPU