Corpse Flies (Ideas?)

Hey Folks, how would you go about creating “corpse flies” as an FX? Would you use a flat texture, a flipbook, or a 3d model for a realistic FPS game? I’m using UE4 for this FX.

At (0:55 - 1:16 seconds) you can see Rust’s take on it. They have a black fly flipbook texture swarming around. It seems like that would be enough since their so small and move so quick. I’d guess that a mesh would be expensive and require code to spawn them.

This seems a bit complicated to me as well: Vertex Animation Tool. Looks like I’d get wobbly flies https://www.youtube.com/watch?v=muAQbXdqHHY.

Maybe I could create something similar but have some of the flies rotated in the opposite direction.

https://www.youtube.com/watch?v=XIjfbmeVkC4

It’s usually enough to just drop in some black dots and orbit/turbulence them around a bit. Flies are so small that it’s not worth a highres texture. If you don’t have access to orbit or turbulence, make a few crossplanes, randomly offset from the origin. Say, you make 25 of these. Slap a fly on each one and combine to one mesh. Now combine it to one mesh and emit 5 of them and rotate them randomly. Boom, 125 flies buzzing around, at the cost of 5 particles.

However, it can depend on the setting. If this is a main feature of the game or something you’ll get really close to, I’d recommend some animated meshparticles. Either vertex or scrolling baked frames. That way, they can be lit proeperly and look really cool.

Alternative, and almost opposite of Partikel’s suggestion, you could actually use a very nice high res 3d fly model and use imposter sprites :stuck_out_tongue:

https://docs.unrealengine.com/latest/INT/Engine/Content/Tools/RenderToTextureTools/3/

I do agree with Part though, occasionally small dots or very small fly textures already does the trick.

@Partikel Gotcha, that’s probably the easiest solution. What do you mean by scrolling baked frames?
@Luos_83 Impostor Sprites are pretty cool. How can I create an animated one? I see someone made it for Unity, but I’ve yet to find it for UE4. How would you even set that up if the shots are taken static? Would the flies wings be the same in all the frames?

Scrolling baked frames is an old trick, but sometimes, old tricks are the best tricks.

Animate a couple of frames of a super lowpoly fly. Take all frames, combine them all on one static frame. Position the uvs for each frame next to eachother. Scroll an alpha mask through these uvs to make the frames become visible in sequence. It’s cheap and simple :slight_smile:

Impostors can be created in any 3d package. Not doing it with built in tools gives you the option of better renders with motionblur, subsurface scattering and so on. However, I don’t see how you’d justify the memory footprint of an impostor texture for a corpsefly as you need a certain amount of pixels to see the animation and that would just balloon the whole thing.

Ok so performance-wise a static or “scrolling baked frame” texture would be preferred.

Sorry, I still don’t understand the process for the “scrolling baked frames”. I’m trying to imagine how that works but I’m visual. Do you mean align the cards within UV space next to eachother and have a flat black and white alpha pan over the texture? Wouldn’t that be a SubUV? I’m a little lost here haha

I don’t have time to set up an in engine example right now, but here are the basics:

Create an amazing looking fly:

UV map it:

Animate it:

Truly lifelike…

Then, take a copy of the mesh at each frame and combine them all to one mesh:

Position the UVs of the frames after eachother:

Create a mask that’s mostly black. One line of white in it. This line is ((textureWidth/numberOfFrames)-paddingBetweenFrames) wide. As you can see above, I just made it sloppily, and it gives some issues.

Then just apply the texture as alpha, and scroll it:

You can see the tail of my fly disappearing because of my slightly too small mask.

And that’s it.
General tips for this:
Put these uvs in a second uv set if you want to texture the fly as well.
Floor the uv scroll so it steps between frames instead of scrolling, or you might get a sliding line going across the frames.
Keep the polycount low, use crossplanes where possible. 100 vert fly*10 frames is 1000 verts.
Only animate what’s needed. Leave the body static, give it a differentmaterial or whatever. So if you have a quad per wing, and animate them for 10 frames, you only get 40 tris and that ain’t bad.
The mask texture only needs to be 1D (or whatever your engine can handle). 1 pixel high, and then the relationship I described above between black and white. I tend to make masks around 64x8 just so I don’t get screwed by compression and so on.

Have fun!

5 Likes

Hahah, classic! I’ve seen that done for butterflies.

I’m going to chime in and agree with what’s been mentioned before, and say that by and large, using motion blurred specks for your flies should be good. If you can get them to pick up light as they travel through it - bonus! But the key to flies lies in the erratic behaviour & fast motion. TBH the more detail in the sprite, the less believable it gets

I would actually use vertex animation for the wings, as you’d only need a few frames, that would only be a few kb .exr file, or some rather simple sine-esque math. (and use vertex color to tell ue4 what should be animated and what not)

its fun to see how many different approaches one can do for something as simple as a fly :slight_smile:

Yep, I’ve done butterflies, birds,crabs and rats and so on with it :slight_smile: No school like the oldschool. The smallest thing I’ve done this for are probably moths. Anything smaller than that isn’t really worth it.

And yeah, less detail will look better. When you see a fly more than a meter from your face you don’t actually see anything more than a black smudge. Or, I might need new glasses.

3 Likes