15
\$\begingroup\$

I have a 2d infinite runner type game which background is changing its colors constantly. Meanwhile the color of the platforms stays the same. This way the platforms at some point(when their color is the same as the background's) become "invisible" for the player.

How can I creatively, shortly and conviniently avoid this problem with unity?

P.S. I've tried adding glossy material to it but it didn't work.

\$\endgroup\$
20
\$\begingroup\$

Old trick - new look:

Example 1

Add a layer of color to your platforms that helps keep that defined line.

Example 2

Your solution of either line or other graphics can vary but the principle is the same - the color you choose can be as subtle or as stark as you need it to be.

\$\endgroup\$
1
\$\begingroup\$

Since this is an infinite runner, I assume your background colors are procedurally generated. I'm not sure on your algorithm, but take that color output and limit its range.

  1. You could simply exclude your platform color(s) as a possible background color option (but the background could be a tiny bit different and hard to differentiate). For example: IF backColor = platformColor THEN GetNextBackgroundColor(). You could create a 'IsColorSimilar(color1, color2)' function for this also, but more difficult.

  2. Use a list of known valid background colors, and cycle through them.

  3. Have different color 'styles' for both. Your platform could be bright and cheerful, and limit your background colors to desaturated colors. You need to move away from the traditional RBG way of representing colors, and move to a model such as HSL.

A great Unity add-on for working with colors is ColorTools. It costs $10, but is worth it. https://www.assetstore.unity3d.com/en/#!/content/21966

It has methods for generating colors for what you are looking for, such as Desaturate() for desaturating your generated background color, and IsSimilar() to check if the two colors are too close of a match to each other.

You can find other similar functionality for free in other libraries on the net with a bit of searching.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.