top of page

Beard Trimmings Part 1

Through the development of Filament so far many ideas and prototypes have come and gone, the Beard Trimmings is here to showcase some of the best abandoned ideas, explain how some of them work, and why we've stopped working on them (at least for now). To start this off I thought it would be worth taking a look at things made for the game jam and demo build especially seeing as now that we're turning it into a full game a lot of stuff is getting reworked and prettied up.

With a visual fidelity overhaul most of the things made during the game jam are getting replaced, one of the sadder casualties are the collision objects found in nearly every level, several people have asked how they work as the visual effect is certainly an interesting one, so hopefully this can help someone replicate the effect to some degree.

Most of the heavy lifting is done with a material, but is combined with a blueprint that builds an array of instanced meshes, those meshes are then scaled and offset randomly so that they all intersect with each other to some degree, without the material in effect this is what that looks like:

The intersection is only really visible on the sides of the object now, but if I turn on wireframe mode the overlapping cubes will become extremely apparent:

This is nothing to worry about performance wise seeing as all the meshes are instances so it only takes up one draw call, the overlapping faces can be a bit of an issue as Z-fighting will result in quite a bit of overdraw in some cases (which in testing only became an issue on lower end hardware thanks to an unrelated attempt at shader optimisation), but for the game jam this was good enough. Another benefit of using instanced meshes is that materials can use a perInstanceRandom variable that lets each cube look slightly different to the others, in this case that is used to drive height information, as that's the only thing I really needed to change.

The colour on the object is driven entirely by world space information, mostly because that's quick and easy, but also because the main UV channel was being used with a mask to select which vertices would be effected by the height changes, this has the added benefit of being able to sync up with the panning texture on the walls of the levels. Emissive colour was based on absoluteWorldPositionZ distance from objectPositionZ which achieves a nice gradient from bottom to top and makes the glow pulse the higher it goes. In order to have the levels read very easily i the dark environments it was important for the collision areas to be very noticeable, with a flat emmisive value they just looked ugly so this was a nice compromise.

The most interesting effect is easily the height pulsing, initially this was just done with a sine wave which actually looked quite nice, adding the random offsets based on instances made the effect a lot more interesting but also slighty more chaotic than I initially intended. As I've mentioned already, if in doubt about a way of doing something the answer is obviously more world space projection... for a game jam where optimisation doesn't matter at least. So, instead of using pixel world location I decided to use object location again, the X and Y values are plugged into a panner and let a crazy noise map I made pan across the meshes. Because I use object position instead of pixel position each one of the cubes will always be one block colour so I'll always have one specific value to control the height of it. Hopefully this makes some kind of sense... Anyway, here's a full image of what the material graph looks like that should explain better anything I've missed:

Despite this not being of the visual fidelity that I'd like to see in the final game it was still a good proof of concept for an effect that isn't limited to either a material or a blueprint and instead gets the best of both worlds. I don't claim that this is the best way of achieving this, it certainly isn't the most efficient, but in the end this only comes to 114 instructions (but will be more expensive thanks to the previously mentioned overdraw).

Hopefully more blog posts will soon follow showing off some of the cool stuff we're all doing, let me know if I've missed out on anything or not explained something well enough.

Cheers,

Jo

Featured Posts
Check back soon
Once posts are published, you’ll see them here.
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page