- Home /
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 :)
Answer by zach-r-d · Jun 22, 2015 at 10:45 AM
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:
There are more complicated ways of doing it if the stencil buffer is being used for something else, but hopefully this is sufficient.
That's awesome idea and its working the way I want thank you :)
Your answer
Follow this Question
Related Questions
Starship Shield not working 0 Answers
How to Create Shields 2 Answers
Surface of a object appear under certain lights... 1 Answer
Depth of Field Not Working 0 Answers
Most efficient way to darken the screen? 3 Answers