After a lot of profiling I found the major problem comes from the fracture block the main game thread. In order to fix that I made a complete refactoring ( precedent post ) which allow me to made a multi-threaded architecture using the UE4 threading system(FRunnable) 🙂 !
Now the game thread send fracture task to the fracture thread and watch for result.
Next time: fast real time convex approximation and partial fracture 🙂
Last week I past most of my time cleanup code and think about a stack system which will execute the fracture task on other thread in order to remove the render freeze 🙂 I will add this after the partial fracture ( Under construction) and the run-time mesh component test (Also to improve perfs ) .
Two options added for partial fracture: the radius of impact and a Boolean to active it
First tests of partial fracture !
I am also looking for a new method to compute the volumetric decomposition of the object to improve perf, I will talk about in a future post 😉
Today I add the recursive fracture which simply consist to be able to break a fragment from an already broken object 🙂
I also avoid the pattern generation at each fire and done it once at the begin of the game. Finally I shoot the first video of the run-time fracture(see below) ! 🙂
For the next time I will clean code and try to add a basic partial fracture system 🙂
After a lot of fighting and code refactoring, I finally apply a correct physic on each fragment ! The lag come from the Fracture pattern generation step(which is really expensive ), not from the fragment formation. 🙂
First fracture !
From another point of view 🙂
So next step will consist to cache the fracture pattern before the beginning of the game !
Last days I add a cleaning step into the fragment procedure which consist to clean all co-planar facet of each voronoi facet before use them compute fracture fragments. Now I have clean fragments following each cells (in green below) without wrong face face normal’s. 🙂
Fragment formation following the user generated voronoi cells
Actually I’m fighting with the Unreal physic system to make all fragment move…
Me trying to setup UE4 physic for the fragments tonight…
Last day I made some big jump in my initial prototype road map ! 🙂
Firstly, I developed the user defined pattern which allow the artist to draw his own fracture pattern based on a voronoi diagram in Unreal. As you can see below, you can move, add or remove control point in real time. The blue lines draw the intermediate Delaunay triangulation which allow to compute without more calculation the dual Voronoi Diagram(in green).
Real time pattern edition interface in Unreal
New option for the fracture pattern
After developing the improved pattern generation, I started to wrote the most important procedure: the fracture. Below are the first results…No as expected but fun 🙂
First test of real time fracture ! 🙂
The new generated fragments are not totaly following the fracture pattern, and there are also some problems with the new normal computed on the fly…I will investigate on it 🙂
Last days I figured out some problematic bugs like the plane representation conflict between UE4 and CGAL. Now I successfully extract the plane normal from each voronoi cell facet which allow me to begin the development of the main fracture routine witch is the fragment construction !
I spend the last weekend fixing a dynamic linking bug in the CGAL plugin which prevented me from computing the convex hull of the voronoi cells… My mistake was loading the GMP and MPRF Dll’s as DelayedDLL and not in the startup module function while the module loading.
Me Sunday night…
After fixing that issue, I continued the fracture plugin development by refactor the voronoi region detection, computing the convex hull of each cell then the plane equation of each cells plane.
The voronoi region convex hulls in wire-frame…
One voronoi region convex hulls in wire-frame…
Tomorrow : display and make plane inside UE4 in order to play with slice function. The problem it that CGAL and UE4 don’t have the same plane construction equation… To be continued 🙂