1
\$\begingroup\$

I am working on a tile based game on a globe. I am trying to implement a simple day night cycle on my hex globe something similar to the image below

enter image description here

Here is the picture of my globe inside Unity

enter image description here

I am just using a few point lights but it doesn't look perfect. Would it be possible to do better with the current lighting system in Unity or do I have to just play around with different lights, intensity and their positions to make it look close to what I want. Also is there any way through a script that I can get information on if my gameobjects in the scene are being lit by a source of light. I would want this to get information on the tiles that are in the dark and the ones that are in the light

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Wouldn't the sun be better approximated with a Directional Light? \$\endgroup\$ Sep 30, 2014 at 23:33
  • \$\begingroup\$ Yea it would but I want one half of my globe to be in the dark and the other half lit. With the directional light wouldn't it always lit the entire globe? \$\endgroup\$
    – ckzilla
    Sep 30, 2014 at 23:50
  • 2
    \$\begingroup\$ @JimZilla you are thinking of ambient light, directional will always come from the same side and light half of a sphere \$\endgroup\$ Oct 1, 2014 at 11:00
  • \$\begingroup\$ cool I get it now \$\endgroup\$
    – ckzilla
    Oct 2, 2014 at 19:28

1 Answer 1

2
\$\begingroup\$

Unity has three kinds of lights that work in real-time: Directional, point, and spot.

Point lights just sit somewhere and emit light in all directions, which sounds a lot like the sun, but you would have to put the light so far away from everything and make it so strong that it may be unreasonable.

Spot lights are the same, except they emit light in a cone instead of in all directions.

Directional lights, however, don't have a position. Well technically in Unity they probably do, but the position isn't used in the light calculations. The only factors are the direction and the strength of the light. This means the light effectively has a distance of infinity, but the brightness does not fall off.

Of these three, the directional light is the most reasonable to simulate sunlight, even if it doesn't exactly sound right.

For some pictures to further clarify things, here's Unity's page on the matter: http://docs.unity3d.com/Manual/class-Light.html

\$\endgroup\$
4
  • \$\begingroup\$ I understand that directional lights work best for sun light but in my case, I want half of my globe to be lit and the other half to be in complete dark and not have any possible light thrown. This is to imitate a day night cycle as seen from outer space. With directional lights, they would light the entire globe which is not what I want which is why I tried using multiple point lights and light only half of the globe but that doesn't work quite well. \$\endgroup\$
    – ckzilla
    Sep 30, 2014 at 23:58
  • 2
    \$\begingroup\$ No they wouldn't. All light types will only light faces pointing toward them. (Unless Unity has subsurface scattering or something...but I'm not aware of that.) An ambient light would light all faces regardless of direction, but that's a render setting, not an actual type for the Light class. \$\endgroup\$ Oct 1, 2014 at 0:03
  • \$\begingroup\$ Thanks, I will try that out. Hopefully it should work. Also I still have one question. Is it possible to get information on whether my gameobjects in Unity are lit by any kind of light? I would want this information to group my gameobjects as the ones that are lit and the ones that are in the dark \$\endgroup\$
    – ckzilla
    Oct 2, 2014 at 19:31
  • \$\begingroup\$ You should make a new question for that. It might be easier to just keep track of where they are on the planet relative to its rotation, but I'm not really sure. If you make a new question you might get much better answers. \$\endgroup\$ Oct 2, 2014 at 19:41

You must log in to answer this question.

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