Directional light for "all" directions?

No, not a point light. I’m making a space exploration game and to start I threw a directional light on the star lighting the current system and pointed at the player’s spawn point. Except, uh oh, the planets on the opposite side of the star are dark on the wrong side.

I’ve considered having the directional light always point at the player but I suspect it will still create weird lighting anomalies. As the player flew perpendicular to the star and away from the planet, that planet would start to get dark on the wrong side while the player could still see it. Any suggestions?

A point light matches the behavior you’re looking for. Why are you opposed to using one?

Maybe I’m getting ahead of myself, but I was under the impression that directional lights and point lights were handled differently and that point lights were far more expensive. Having one point light that covers 10k meters seems like it might be terrible. I also want to have the sunshafts/godrays and I don’t know if it works with point lights. I’m at work though so I can’t test. I was putting my feelers out there so I could get home and test suggestions. I’ll test a point light though.

Tested and it’s terrible. Using a point light with a massive range gives me the IsNormalized error, and costs me a ton with shadows. Without shadows my scenes will look too flat, so I’m out of luck on this looks like. I’ll have to fake it.

I’m thinking I’ll have the directional light always face the player and if the angle from the directional light to the player and the star to the planet is past a certain angle threshold, I’ll assign a non-shadowed pointlight to that side of the planet to give it light. I have a feeling this will look terrible though…

will a non shadowing point light, and shadow projector on each planets that always facing away that point light, do?

(btw an “all directions directional light” is just… Unlit)

What shader are you using? Probably don’t need all of the functionality of the standard shader so try switching to one of the less complete versions or even one of the legacy ones - don’t recall the names off the top of my head. And it doesn’t seem like a huge stretch to create a new shader from the directional shader that also calculated the direction to the light and doesn’t worry about falloff and such. Unless I’m missing something (and it has been awhile since I’ve looked at to be sure) the only difference between a directional light and point light with no falloff is an extra vector subtraction to get the direction - doesn’t seem like it should be that much more expensive. For sunlight like this you’d probably be fine doing that at the vertex level as well, rather than pixel.

My first try wound be

and only switching to a point light in case the player gets close to the sun because only then it would probably show if a directional light used.
(That if there is only one sun per System)

The directional light following the player doesn’t work either. How are space scenes lit? It’s already scaled way down. The planets exist on a separate layer rendered by a secondary camera.

I know. That’s why ‘all’ was in quotes.

I hadn’t thought of faking shadows. Either way, if I create a point light large enough to cover the entire scene I get spammed with the IsNormalized error (which kicks in at about 3500 meters). To make things worse, the planet shaders I’m using were picked up from the asset store and they really don’t like point lights. the atmosphere lighting “flips” when using a point light, meaning half the planet is lit correctly, but then the lit atmosphere is on the dark side.

Ya, too limiting. I’d like to include binary star systems at some point.

It’s a custom shader forge shader that I picked up from the Exo-Planets asset. I haven’t spent any time learning shaders as up to this point the standard stuff, or those supplied in the asset store, have been sufficient. I’m not opposed to learning how to do it if I need to though. I went from 150 fps to 25fps by using a point light, and that was with about 25 asteroids (standard shader) and 2 planets… so I imagine even with a more simple shader, which limits me, I’ll have terrible performance once the scene is full of objects.

Hi jtsmith1287,
I am curious to know how did you solve this issues of lighting the planets. I am developing a space exploration game where are all planets are revolving around the Sun. Planets which are away from camera especially Uranus and Neptune appears and disappears suddenly. I feel it is a problem with lights. I have used 1 directional light and using FPS Controller as the main camera. I want to glow up all the planets so that user can see them from far away distance also. Added as you had the problem, planets get dark from the wrong side.

Any information will be much appreciated.

You could also consider forging light probes for current position.

If this is still open, just try to make a custom light on the shader of your planets, just get the direction from the star to the planet, and lighten the planet accordingly, so it doesn’t anymore if it is a point light or a directional. This is exactly what I’m doing and it seems to work great