Closed WrathfulSpatula closed 3 years ago
Looking at what I previously added for shadows to the shader, it is so limited as to basically require thinking of general shadows support as a new feature.
Within rendering engine limitations, beyond knowing that the path of light blocked to produce shadows follows null geodesics corresponding with the metric, there might not be more exotic relativistic concerns for shadows necessary, or feasible within the rendering engine. I will take notes here, if I think of additional relativistic considerations.
Reading a bit, Unity uses shadow masks, which rely on a depth texture. It seems like, as far as light rays bending in a metric that isn't flat, the effective depth from perspectives of camera and lights is changed. Factoring the metric into the calculation of the depth texture might be the best place in the pipeline to insert relativistic effects, in this case and for more general use.
I'll have time to play with that, this weekend.
I likely was thinking of this when I first attempted shadow support, but I can document it, now:
Baked rendering can be far easier to handle than real-time with relativistic effects, in general. Besides the bending of light rays to follow null geodesics, as determined by the metric, shadows are theoretically subject to a speed of light delay from caster to receiver. If shadows are baked as cast and received by static geometry on both ends, though, then "start time" is effectively before the scene starts and the "stop time" after the scene ends. Hence, rather than try to incorporate a time delay into shadow fragments, we can limit to baked shadows, at first. For video game purposes, it would be great to have (reasonably physically qualitative) baked shadows, at least.
Shadows are still theoretically subject to the curvature of null geodesics between light source, caster, and potential receivers. A good first step might be just to rely on default Unity rendering engine functionality for shadows, in the Standard Relativity shader. Once confident that works, I can potentially consider the effect of space-time curvature on depth textures, with the metric. However, in general, a number of rendering effects we bake assume that the world coordinates are flat and not accelerated. (Attenuation would be an exception, but Unity doesn't even seem to expose baked attenuation in the pipeline at all, though we have written real-time attenuation based on the metric, with a variable overall attenuation multiplier.)
After #43, we won't support real-time shadows, for now. I might reopen this issue, if we can tackle real-time shadows at some point in the future.
In my own separate project, point lights "bleed" through opaque light fixture meshes significantly, when the combination of model mesh and point light source is used like a floor, table, or ceiling lamp interior light fixture.
This might be a general problem with shadow casters, in the shaders. (Or, it might be an engine limitation for point lights very close to shadow-caster meshes, which would have to be addressed through means other than modifying shadow casting behavior in the shaders.)
I will investigate the behavior of shadow casters, to see whether they're working as expected, and I will fix any bugs found.