1
\$\begingroup\$

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

\$\endgroup\$
4
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jan 11, 2016 at 17:01
  • \$\begingroup\$ My eagle view means that I see the game from the top similiar to GTA1-2 \$\endgroup\$
    – D4rWiNS
    Commented Jan 11, 2016 at 17:12
  • \$\begingroup\$ Good thing I asked, then. \$\endgroup\$ Commented Jan 11, 2016 at 17:14
  • \$\begingroup\$ 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. \$\endgroup\$
    – DMGregory
    Commented Jan 11, 2016 at 23:40

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the explanation! tint was what I am looking for! so if I want to achieve the red tinted as example above, tint color should have value (1.0, 0 , 0 ,1.0)? \$\endgroup\$
    – D4rWiNS
    Commented Jan 12, 2016 at 9:23
  • 1
    \$\begingroup\$ Exactly that, yes. \$\endgroup\$
    – Cobertos
    Commented Jan 12, 2016 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .