[Music] hello everyone welcome to disintegrating meshes with particles for god of war welcome to my talk my name is rupert renard i'm an australian game developer i bring programming games for over 12 years now i've worked on 12 ship titles and half a dozen cancelled titles some of the games i've worked on you may have heard about such as god of war the legend of zelda deus ex mass effect 3 to blob 2 and scooby-doo i've worked in a variety of programming positions i'm currently at sony santa monica as a graphics and engine programmer where we shipped god of war in april 2018 and it did pretty well in previous god of all games kratos would plow through lots of enemies and the new game wasn't going to differ too much in that aspect so back in around mid-2015 we held a meeting to come up with in-theme method methods of removing defeated enemies from the screen the method needed to fit into the god of war world we couldn't just simply let the pile of
corpses stack up we needed to remove these bodies to ensure that the frame rate wouldn't suffer most games don't really take this into account they usually just do something simple like let the body sink through the floor or fade the body with alpha blending so i proposed a method to disintegrate the body pixel by pixel i quickly prototyped this and the results results looked promising and it got implemented into the game i've prepared a short demonstration video from the final game to show you what to expect from the technique also note that some other standard particle emission techniques are used in combination at times the disintegration technique can occur pretty quickly at times so please refrain from blinking [Music]
oh so [Music]
this technique is applied in two major parts the first part is to make the mesh disappear to do this we simply we apply a simple alpha reference testing nothing really new there the second part is to emit particles from the mesh we do this by emitting particles the frame immediately before the pixel will be hidden from the alpha reference testing this gives the illusion that the pixels that make up the mesh are disintegrating into small particles the particles are then able to move and animate independently as well as collide with the screen depth buffer the technique also conveniently has built-in level of detail we start with a simple alpha reference comparison test for each fragment of the mesh being drawn we sample a single channel texture we compare the sample against a reference value the reference value is
shared globally for the mesh and changes over time the comparison results are used to determine whether or not the fragment is visible if it's visible we continue on in the shader if it's not visible we discard the fragment here is a sample texture from one of the enemies in the game it's obviously a noise texture that's used all over the character in a wrap sampling mode the texture is used to demonstrate the character decaying away from random parts on the body that is to say its effect is to not decay in a specific manner just let it be random and works quite well other cases may be more case specific tailored textures for certain models or scenarios here is a demo of an animated alpha reference i'm using the same texture for the alpha reference as i am for diffuse i've done this so you can visually see where the alpha recedes from and to you can see the mesh starts disappearing at the dark sections and moves to the brighter sections as the alpha reference level rises
the particle mission is broken down into generally three phases we need to leverage a depth pre-pass the depth pre-pass is required to guarantee we only run one fragment shader per pixel in the opaque pass this prevents multiple particles from being emitted from the same pixel if triangles were to overlap once we have populated the depth buffer we run the opaque pass the opaque pass will potentially add to an append buffer the screen coordinates of the pixels that are emitting particles from this frame once we have populated the append buffer later in the frame we're going to read the contents we initiate a dispatch indirect to read the pen buffer and convert pixel coordinates into proper emitted particles this is done by using screen coordinates to look up information in the g buffer such as depth normal and lighting or
other surface information while also converting screen coordinates plus depth read from the depth depth buffer to world space coordinates the next frame we're able to draw the newly emitted particles and animate move and collide all the particles as usual append buffer will obviously need to be emptied at the start of the frame while i say the depth pre-pass is required there are obvious ways around it you just need to be careful with your drawing and utilization of this technique in the opaque pass shader variations were needed to emit the particles we didn't want the particle emission shadow code to be in shaders of materials that never emitted particles for obvious performance reasons we do all this at native 1080p resolution for the base ps4 or at the 4k checkerboard for ps4 pro the append buffer can pack all information needed screen coordinates etc into a single 32-bit entry the append buffer has enough storage to emit
128 000 particles per frame but it's unlikely we'll ever use that here we're going to demonstrate the emission of particles that are coupled with alpha reference test here you can see three segments of a mesh over three frames these three segments will disappear in a cascade from top to bottom at the start of frame n we draw the three segments of the mesh we start by drawing the segments in the depth pass the top segment doesn't pass the reference test so it executes a discard in the pixel shader of the depth pass the other two segments pass the reference test so they don't discard and populate the depth buffer we have determined the middle segment will not pass the reference test in the next frame so we need to emit particles this frame to represent the invisible segment in the next frame we start by taking the pixel coordinates of each
fragment in the middle section and add them to the append buffer later in the frame we need to read the append buffer full of pixel coordinates and create particles from them we run a shader via dispatch indirect in order to process one particle per thread in each thread we read the pixel coordinates linearly from the append buffer note we don't need to use the consume buffer here now that we have pixel coordinates we can index into the g buffer and also the depth buffer we read the depth buffer and can now combine the pixel coordinates with the depth value into world space coordinates we use the world space coordinates as the particle's spawning position this is also a great opportunity to read other attributes that may be used by the particle such as normal from the normal buffer or material properties or final lighting values of the pixel but make note the particles we're spawning in this frame are definitely to be not drawn this frame the reason being the
mesh is still visible there's no point drawing particles on top of the mesh since the mesh fragments supposed to turn into the particles we have now advanced forward a frame now is the time to start drawing the particles we spawned from the previous frame the segment that was visible in the previous frame but not in this frame has visually been replaced with particles we emitted but didn't draw in the previous frame we also draw all other particles that have spawned previously we're able to draw all the particles together and treat them uniformly we can also animate the particle and move the particle and collide the particle with other primitives or the depth buffer i wanted to test that we could convincingly recreate a mesh entirely with part with particles what you're seeing here in this video demonstrates exactly that each of the kratos clones are fully created from little particles every frame we emit particles from the mesh of
kratos as criter cradles flies around the test level the particles remain where they were spawned i had a fixed ring up particle ring buffer for this so the trails of kratos end where the particle ring buffer size is full you can also see that segments of the clones are missing pieces this is because they were obscured on a mission particles are easily able to collide with the depth buffer start by taking the particles world space coordinates and project them onto screen space coordinates you can now sample a depth buffer with these screens with these green space coordinates compare the particle's projected z value with the depth buffer value if the particle is behind the depth buffer you can use the same screen space coordinates to read the normal buffer and use that as your collision normal then nudge the particle in front of the
depth buffer and update the particle velocity now here we have the first video of putting this technique into the hands of our lead character artist raf kraseti raph is playing with the decay animation in on a loop raf is also moving the model around manually while the loop plays to inspect the effect from multiple angles the animation changes the alpha reference value over time causing the particles to emit and the mesh to disappear you can also see that raph has added some material animations to help sell the effect raph has made the mesh burn to ash before emitting the particle causing a pile of ashes to fall to the ground you can also see that the mesh is burned into a pile of ash in the shape of the silhouette of the mesh very cool just as a note the character has its feet and waist missing this model was a work in progress at the time of testing
one of the key benefits of this technique is it has built-in level of detail the smaller the mesh appears on screen the fewer particles it is able to emit however this relationship is not obviously linear sorry this relationship is obviously not linear if a mesh is unfortunate enough to be close to the viewing camera it may occupy large portions of the screen this can create the opportunity to emit a large quantity of particles per frame however you can counteract this with the authoring parameters such as ensuring you do not animate your reference value too quickly with a smaller reference value speed you create segments of particle you create smaller segments of particle emission our particle system programmer paolo also introduced a method of emission randomization to help reduce particle emission count in certain scenarios by decoupling the reference value
between emission and alpha reference testing you can actually start emitting particles early before the mesh will disappear that is to say instead of emitting a single particle the frame immediately before the pixel of the mesh disappears you'll meet one particle per frame over multiple frames right before the pixel mesh disappears this gives you the ability to produce a more substantial decay effect for example denser objects but a cost but at a cost of more particles you can achieve this with a single lu add instruction in the emission shader you add a uniform value to the result of the texture sample right before you do the alpha reference comparison this detaches the emission of the particle from the disappearing mesh by a variable amount supplied here you can see a video of the particles emitting at pixels right as the mesh is disappearing when the little explosion occurs it will change over to emitting particles earlier than when the mesh pixel
disappears now it gives a nice effect of giving the emitting area a visually larger size [Applause] emission velocity is a useful feature to have available to designers particles may want to just fall from the mesh or perhaps they may want to sample the normal buffer from the emission screen coordinates and explode off the mesh instead particles have a range of options to choose from when picking their color the emitted color could be the final lick color of the pixel or it could derive a color from the material rendered in in the g buffer or the color could be a part of the particle system attributes there's no reason it can't be a combination of these such as starting off from the uh starting off as the same color as the final lit pixel then blend towards the external colors supplied
with the particle system over time this technique also has some drawbacks if the mesh is not on screen it can't emit particles so kratos's head and feet are off screen the rest of the body is onscreen pixel shaders are only ever run on pixels that get rasterized it can't be rasterized if it's outside the viewport so this means kratos's head and feet will not be able to emit particles if we were to have an alpha reference emit particles from kratos's head to feet you would expect kratos's particles to fall from his head and into the viewport but they won't the head will gradually disappear downwards even though you won't be able to tell then the top of his shoulders and chest will start disappearing and emitting particles some of our designers unfortunately fell
into this trap a couple of times one in particular was very impressed with the technique he wanted to use it for revealing a hidden passageway from a fake wall he set the fake coil material up with a decay option and was pleased with the visual result it was decaying like sand from top to bottom right in front of your eyes however he noticed that when triggering the effect from up close and looking around the wall just kind of cut off near the top of the screen as the particles were falling down this was caused by the mesh not being on screen in order to emit particles there are methods available to you to help counteract this such as rendering the mesh off screen at the same resolution or simply just resort to your simple triangle emission techniques but these are outside the scope of this technique the technique proved to be very valuable to the effects artists they wanted to use it in several other scenarios as well
as described in the limitations section it was used for revealing hidden fake walls various magic effects were also applicable to this technique and were used extensively in one particular cutscene in the game the cutscene shows a character being sucked into a portal the character is attempting to resist and little pieces of the character end up falling away into the portal one setup of this technique was repeatedly asked for the reverse where particles were scattered around and are pulled together to form the mesh this is very doable but not with this technique present here so as i said earlier this was all initially developed in 2015 so this gdc presentation has been four years in the making but we're occupied making the game itself everything i presented to you was here here was the core initial version of the technique and it's everything you need to get this technique up and running for yourself at the same time as this was being
developed our gpu particle system was being developed by simone kulsitsky over the next few years some changes were made to the technique in order to fit in nicely with our new particle system our particle system programmer paulo cerrico also added some new mechanisms on how to animate the alpha reference value originally you could just keyframe the alpha reference value through our animation sequences he expanded on this workflow and added mechanisms to animate it through script and also hooked it up to our depth death system he also added a feature to ration out the particle spawning between different multiple disintegrating meshes depending on their screen size one particular feature i was hoping some of our artists would explore was mesh layering the character would have multiple layers of mesh like a manchester doll also known as the russian nesting doll before the disintegrating disintegration begins the inside layers would never be
rendered for the sake of performance but once disintegration starts the inner layers are rendered as the outer mesh layer of the skin disintegrates it would reveal a flesh mesh layer beneath it when the flesh mesh layer would disintegrate it would reveal the bone beneath it then the bone mesh would disintegrate thanks everyone for attending i'd just like to take a few moments to thank others who helped out in various ways paolo cerico and the rest of the rendering team max ankar kevin hyun and the rest of the facts team jack mulholland and christina coffin we are hiring in very various positions please check out our website and come join us on our next project we also have various other presentations that other members of the team are giving i think we're around here so we've got all these talks to go please attend them thanks [Applause]
[Music] any questions please step up to the microphone go ahead thank you it was an interesting presentation um i have a question this kind of technique is kind of resolution dependent so you you should end up with different number of particles for ps base ps version and ps4 versions is this a thing that you somehow mitigated with your artist maybe no we did not so the question was uh since there are multiple resolutions for multiple consoles how did we handle that we just let the higher resolution have more particles it had more hardware to handle it so away went but i was curious if it provides like if artists are happy enough with different visuals on different platforms like slightly different okay no they liked it okay yeah thank you thank you good uh so you mentioned that the off
uh parts of the character couldn't get any particles did you guys attempt any solution to cover that up or was it just not visible enough to be worth addressing it was used uh sorry the question was how did we handle uh the meshes being off screen and not emitting particles so we mostly com handle this with kind of two mechanisms one is restrict the camera particularly in cut scenes to have the meshes on screen the other method is just combine it with other particle emission techniques yeah thanks no problem go ahead all right great talk thank you thank you uh i had a question about i know you said that you divided the meshes into segments and the segments would start fading away and emit particles was the segment definition artist defined or was that mesh dependent okay so the question is on segments what are segments segments is something i just invented for this presentation so as the alpha references are animating the segment
is effectively uh pixels on the mesh that may that will appear this frame and not mix next frame so there are no real segments it's just a term i've used to describe pixels that are changing from being visible to not being visible in the next frame thank you no problem any other questions yeah one last quick question this technique looks like it was purely pixel bass did you investigate anything like pervert based for a similar technique or no uh we wanted the higher resolution for pixel shapes sorry the question was uh did we investigate vertex emission techniques is that correct yeah yes no we did not investigate that that would probably be too low resolution for us uh some of our character measures were pretty high in the vertex count but probably not enough to give the effect that we wanted yep thanks thank you any final questions right thank you everyone
Auto-generated captions from YouTube — names and numbers may be misheard.
Distilling the key insights…
Game Developers Conference · 2026
Game Developers Conference · 2026
Game Developers Conference · 2022
Comments