1

I have a 3D game with a "eagle view", I have enemies and I have magics that will affect the status of the enemies.

I want to show the status of the enemies( frozen, on fire(dot damage), slowed...etc)

I think about two possibilities

  • Put a 2D image in the enemy that show status
  • Change the color of the enemy with vertex shaders

Is there other,or correct way? In case of use vertex shader, how I change the color of enemy without losing all details(Something like a filter)? shaders

D4rWiNS
  • 293
  • 1
  • 17
  • Your "eagle view" is basically a minimap, yes? A minimap probably doesn't need to show all of the Things, its supposed to be a quick reference. I would boil your enemies down to simple dots or other easy-to-recognize sprite, and then colorize it based on status, rather than rendering a realistic top-down view. – Draco18s no longer trusts SE Jan 11 '16 at 17:01
  • My eagle view means that I see the game from the top similiar to GTA1-2 – D4rWiNS Jan 11 '16 at 17:12
  • Good thing I asked, then. – Draco18s no longer trusts SE Jan 11 '16 at 17:14
  • It sounds like you should work out the visual target for your game first (this comes down to your art direction and UI sensibilities, so it's likely to attract mostly opinion-based answers). Once you know what you want it to look like, you can describe it (or even better, mock up a sample image to show us) and ask how to achieve that particular look. – DMGregory Jan 11 '16 at 23:40

1 Answers1

1

Is there other, or correct way?

Sure, there's tons of ways to "show the status of the enemy" and maybe not even with color. This is a very subjective question but it comes down to what you think looks best and what works with the rest of your game.

In case of use vertex shader, how I change the color of enemy without losing all details (Something like a filter)?

This is a much more concrete question. If you want to apply colors without losing any of the details, you're probably going to look at some sort of tinting of the character.

Tinting pictorial representation

What you can do is have a custom uniform value in your fragment shader (not the vertex shader!) that will render all the pixels of that object with a tinting. The easiest way to do this is just with multiplicative blending. Multiplicative blending is simple in that a 1.0 in a given channel will let original color pass through while a 0.0 will produce no color in that channel. A value in the middle gives a partial pass through (darker color).

uniform vec4 tintColor;

void frag(out vec4 fragColor)
{
    vec4 originalColor; //Comes from original object color
    return originalColor * tintColor;
}

Multiplicative blending is not the only one and you should consider other types of blending (or even more complex forms of tinting) by doing research until you find something that fits with your design.

Cobertos
  • 1,634
  • 12
  • 23