4
\$\begingroup\$

Do I need to draw, for example, a tree how it looks in the day (normal colors) and how it looks at night (colors aligned according to the moonlight)? Or does Unity have a function for that?

\$\endgroup\$
3
  • \$\begingroup\$ You can tint the images \$\endgroup\$ – Bálint Mar 24 '17 at 10:17
  • 1
    \$\begingroup\$ I haven't worked with it, but Sprite Lamp might be worth a look for you. \$\endgroup\$ – Christian Mar 24 '17 at 10:43
  • \$\begingroup\$ Isn't there a shader supporting this lighting profiles? \$\endgroup\$ – Luis Masuelli Mar 24 '17 at 15:11
10
\$\begingroup\$

The quick-and-dirty solution would be to use a camera filter effect. The color correction curves filter might do what you want. Move the end-points of the R, G and B curve down, but the blue-curve a bit less. If you don't want it to affect some objects (like your GUI, for example), render them with a different camera.

But the problem with this is that you can not have any light sources that way. Even emissive light (like a lit window) becomes cumbersome. Also, shading at night is different than shading at day, especially for outdoor scenarios. At day, you have one primary light source (the sun). At night, the light conditions are far more diffuse. But calculating realistic light in a 2d environment is very hard to pull off. There are some interesting technologies available in this regard, but most require to manually add some 3d information to your art assets and many aren't universally applicable to every situation. That's why we invented 3d engines :)

The "clean" solution is to redo all your sprites and tiles in two versions: a "night" version and a "day" version. You can use automatic color correction in your image editor for the prototype and then touch up any art assets manually which need it.

\$\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.