Hi Awesome Unreal Community!
I've been working on my very own Voxel-based game for a while now. Moved from an internal engine (hand-written from the ground up aroung OpenGL 4.0, by myself) but moved to UE4, since 4.8 added the new ProceduralMeshComponent nad it's awesome! Super easy to get something on screen! Managed to get some noise in and got this (Google Drive).
A little explanation is in order :
A Cell contained 64x64x64 Voxels and there were 4 Cells!! That's 1,048,576 calls to GenerateNoise! This was taking ~30-45 seconds to complete!
Now the real problem, I re-coded this whole thing, and started to use the Async<T> function from 4.8 (with ThreadPool) and I'm building a 3D Grid of 4x4x4 Cells, sized at 32x32x32. Moved the genereation code to OnBeginPlay, but the editor still hang for ~2-3 seconds to build the Cells. And I'm not even generating noise! Why is this happening?
If you have suggestions or ideas regarding my problem or you need explanation, don't hesitate to post!
P.S. : if you want to view the code, I uploaded it to GitHub : link's here.
Edit : new repo is on BitBucket : here, the GitHub repo won't be updated anymore (might be deleted in the future).
I've been working on my very own Voxel-based game for a while now. Moved from an internal engine (hand-written from the ground up aroung OpenGL 4.0, by myself) but moved to UE4, since 4.8 added the new ProceduralMeshComponent nad it's awesome! Super easy to get something on screen! Managed to get some noise in and got this (Google Drive).
A little explanation is in order :
- Every Voxels are stored in a TMap (indexed by FInt3 from BrickGame, value is uint16)
- The TMap is stored in an Actor class named Cell
- I used OnConstruction event from Actor class to generate the noise and build the mesh
A Cell contained 64x64x64 Voxels and there were 4 Cells!! That's 1,048,576 calls to GenerateNoise! This was taking ~30-45 seconds to complete!
Now the real problem, I re-coded this whole thing, and started to use the Async<T> function from 4.8 (with ThreadPool) and I'm building a 3D Grid of 4x4x4 Cells, sized at 32x32x32. Moved the genereation code to OnBeginPlay, but the editor still hang for ~2-3 seconds to build the Cells. And I'm not even generating noise! Why is this happening?
If you have suggestions or ideas regarding my problem or you need explanation, don't hesitate to post!
P.S. : if you want to view the code, I uploaded it to GitHub : link's here.
Edit : new repo is on BitBucket : here, the GitHub repo won't be updated anymore (might be deleted in the future).
Comment