Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm looking into prototyping a game in Unity which will consist of solid square sprites / tiles. I figure I can represent different types of objects with different colors for each of the tiles in the game.

I figure that I can import a single square sprite and shade it appropriately in Unity as opposed to imported squares of many different colors.

My experience with adjusting the hue and saturation within Photoshop shows that white is not an easy color to change as things that are white often stay white. My testing in Unity shows that I can change the "color" of a sprite to anything other than white and the sprite is seemingly shaded appropriately, despite what I would have thought given my Photoshop experience.

Since white objects do seem to take on the appropriate color shading when changed within Unity my gut tells me that this is the best base color to begin with, meaning that I can import a single white square sprite and simply adjust the color to represent different objects and object states.

Is a white sprite actually the best color sprite to begin with and why does something like this work in Unity as opposed to adjusting the hue and saturation within Photoshop?

enter image description here

share|improve this question

2 Answers 2

up vote 10 down vote accepted

White is the best base color for true representation. Also keeping your sprite grayscale can make for some easy color adjustments for teams, etc.

Unity applies a Multiply blend mode to the sprite texture and color.

Unity's Color type is ranged from 0 to 1 inclusive.

Color.White is equal to (1, 1, 1, 1).

Knowing that 1 times anything is itself.

If the grayscale texture is blended with the Sprite Renderer Color field, each pixel is itself. Changing this field will simply multiply each uniform grayscale value by each component of the color.

Tinting some a sprite


You can play with the Multiply blend mode in your favorite image editor like Photoshop or GIMP.

Photoshop Setup

share|improve this answer

Unity colors have 4 float values typical of many color formats RGBA, corresponding to the individual percentage color values Red, Green, Blue and the Alpha transparency channel.

Also as mentioned above the default "Tint" applied by Unity is a multiplicative shader Photoshop calls this effect "Multiply" and the process is literally multiplying the color values in the pixels of your sprite with the color value selected.

The problem with this is, a Multiplicative color math shader will ALWAYS produce the same hue (if you "multiply" by white) or darker color if you multiply by anything else. I came across the situation where I wanted the exact opposite effect in a blacksmithing type situation. Heated metal should not be Multiplied by Yellow to produce a darker hue:

multiplicative shader by Yellow

Instead, I rewrote Unity's default multiplicative shader to be an additive one. The results were more along the lines of what I was looking for:

additive shader

I'll provide a gist to the rewritten shader if anyone is interested.

Here is a good reference on color terminology and modes: http://www.northlite.net/ps/blend.htm

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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