- Home /
2D solarsystem lighting
Hi everyone,
I have a 2D solar-system, with sun in the centre, and orbiting planets. I want to add a light-source to the sun, to light the orbiting planets (make them look spherical, simulate day/night appearance, etc)
What's the best way of achieving this?
1/ I was thinking of adding a gradient mask to each planet, and rotating it to 'face' the sun.
2/ I have explored this option https://www.youtube.com/watch?v=fwyAoE_uMFo however it doesn't work properly as a single light point (in the sun), with planets in different orbits. It does work if I add a light point around each planet, and adjust it based on planet size... however this is fiddley, and demanding on resources (I think). To automate the lightsource settings, I may need to calculate the current light on the planet (this looks difficult) https://answers.unity.com/questions/24662/detect-lightshadow-falling-on-object.html
What is the best approach? Thanks!