Closed mattrdowney closed 5 years ago
It wasn't immediately obvious to me, but applying a cuculoris to both a PlanetariaWorldLight and a PlanetariaPointLight is harder than a DirectionalLight and PointLight (because--unlike DirectionalLights--PlanetariaWorldLights are 360 degrees).
PlanetariaArcLight should also exist (using Cubemap technique like https://youtu.be/Nt9BVz-i2O4?t=791 or CubePlanetarium).
Conceptually, all the light needs to do is find the Vector3.Angle(sample_point, ArcUtility.snap_to_edge(light_arc, sample_point)), and then you can use 1 - "distance squared" drop-off metrics to compute the lighting.
Notably, there should be an optimized version of ArcLight (stretch goal) that sets a normal spotlight-cucoloris pair on a single hemisphere where possible (to avoid using a cubemap -- or six textures).
Comment https://github.com/mattrdowney/Planetaria/issues/112#issuecomment-421553861 is wrong - the same issues exist for both types of lights. With respect to ArcLight: For games with a lot of zoom, the lighting techniques with cucoloris don't work (at least when the ratio of length to light_radius is high), because texture size can get to resolutions too big for memory/practicality. In these circumstances, you can use a far away spot light (essentially just a cylinder light) as it intersects a secant of the sphere, plus cucoloris for the desired result (should be possible with 2 or 3 spotlights). There should be a lot of floating point issues, plus a lot of computations would need to be made (for spotlight positioning and cucoloris computation) - and you might still get some light overdraw where two spotlights overlap. Notably, as the light radius gets larger, this approximation gets more computationally intensive (because cos(theta) stops approximating theta).
WorldLight conceptually should not exist. Any attempt at recreating something like directional lights from Unity would result in something like Unity's point light (which is already planned).
PointLight and SectorLight should definitely exist. ArcLight should exist if implementation is reasonable.
Light dropoff is a complicated subject that should be studied, especially because light at the antipodal point should conceptually be exactly as bright. For this reason, perhaps lights should only render on one hemisphere.
Done as of 84461216cc72c9a47413149c6b9a06183accee40 (I suppose I could have implemented a better lighting function, but I digress).
PlanetariaWorldLight and PlanetariaPointLight
Use PlanetariaCuculoris for filter.
PlanetariaPointLight should have a radius (that changes the cone angle).