Download

The great Orthographic Shadows Programming Adventure

Hello there, yall!
As some of you may know, orthographic cameras in UE4 are unable to display any kind of cast shadow, which is pretty gosh darn terrible for us devs trying to make a 2.5D game. The issue is backlogged to hell and back despite tons of votes (Unreal Engine Issues and Bug Tracker (UE-11026) (If any of the staff wouldn’t mind telling me if there are any updates on this front, that would be welcome. Not holding my breath for good news, though)), so I guess I better take the elbow grease out and try to figure out a solution. Two options come to mind:

  1. Using the orthographic view, make my own cast shadows from scratch basically, probably using shadows, another camera and dynamic materials. Performance would be likely pretty bad, and I’m unsure of how good it would look, but I don’t know where I would have to start if I wanted to get this integrated early in the rendering pipeline like it should be. Any pointers or relevant docs on this front would be welcome.

  2. Hack together something that looks like an orthographic view using a perspective camera with a narrow FoV.

I’ve done some tests with #2, and it looks okay at 20 degrees FoV, but you can ever so slightly notice the perspective shifting when objects move (first picture).
The fake orthographic view is more convincing at 10 degrees FoV (second picture), but as you can see the shadow quality, really suffers here, I assume because of the large distance between the camera and the rendered shadow, and because of the shadow’s small angular size from the camera’s PoV.

So, I’d prefer to get #2 working, since that’s way less work than getting #1, but if I can’t get something that looks legit going I guess I’ll bite the bullet.
Any ideas on how I could trick the cameras into rendering the shadows in #2 with a higher quality?