Brian Crick

Here Comes the Sun

It’s crunch time. I’m going to be spending much of today doing work-work, but before I dive into that, I wanted to babble a bit about lighting. Yes, I’m still keeping Tinselfly moving; that’s kind of essential during crunch time.

[fergcorp_cdt]

In the past few days, I’ve added some mostly cosmetic things. They all revolve around lighting and going beyond the obvious solutions for setting this up.

The Sun

The sun won’t ever move. I want it to stay in a fixed position to help you navigate. I could, then, just have set up a directional light for the sun and walked away, but I would never have been happy with that. While the purpose of said directional light is to simulate the sun, the purpose of lighting in general is to sculpt your scene. The sunlight isn’t going to do that if it’s in line with the camera or directly behind it.

So there’s some logic in here to try to keep the sunlight close to where it would naturally be, but at a reasonable angle to your point of view so you get nice highlights and shadows here and there. I’m not quite done, but generally speaking I’m liking the results so far.

The Stars

You’re on the night side of the planet, and can see a brilliant starfield. You start walking towards the day side. What happens?

My instinct was to have the stars fade out while the sky faded in, and while this was easy to implement, it just didn’t feel right. Stars don’t fade. They appear to twinkle, one by one, out of existence. So I wrote a special shader that would allow that to happen.

The Sky

Daylight is a funny thing. When you’re standing outside, you’re not just lit by the sun; you’re also lit, in large part, by the sky itself.

I thought I’d simulate this by adding some logic to have my sunlight appear higher than it naturally would be, but that’s not really working, and it’s screwing up the no-head-on-lights thing mentioned earlier.

So I think what I’ll do is have a blueish ambient light whose intensity varies based on your position instead.

Copyright © 2017 Brian Crick.