Space ship shield GFX system

Recently I was looking for this on the internet but couldn’t find anything. Problem is following:

My spaceship has invisible shield texture and when it gets hit on particular side, only part of the shield became visible and then some fade out effects which I can do myself but I dont have any clue how to make such a shield effect so Im hoping you can help me out :slight_smile:

The easiest way to do this would probably be testing the stencil buffer in the shield’s shader.

Then, any time the shield is hit, it’s just a matter of rendering a mesh that draws to the stencil buffer in the shape that you want to become visible (for finer precision, it’s probably possible to use a textured quad, then have the shader use clip() to discard transparent fragments the way Transparent Cutout shaders do). In either case, here’s a quick tutorial for rendering to the stencil buffer. This image from the tutorial effectively shows what the stencil buffer can do:

Stencil buffer example

There are more complicated ways of doing it if the stencil buffer is being used for something else, but hopefully this is sufficient.