I've been going down a rabbit-hole trying to recreate the godrays from this video:
https://www.youtube.com/watch?v=fSNdZ82I-eQ
My main attempt to recreate this was to instance a bunch of huge quads (1000x1000) that follow the light direction and have their alpha modulated by the shadow map as-well as fake cloud shadows. This got me close to what can be seen in the video but there was some big flaws:
- You could rotate the camera in such a way that the quads would be seen from the side, completely ruining the illusion
- The camera would clip with the quads creating ugly seams
Neither of these issues seem to appear in the video. There's part of the videos where the camera is rotated and the beams seem to always face the camera, indicating that there's billboarding going on (assuming they're actual geometry)
There's a brief and pretty vague explanation of how the effect was made in the description of the video:
"Using the light-space shadow map of the sun, I can project some quads on the scene to compute sunbeams (god rays) with just some texture sampling, without the need to do any raycasting or raytracing. This effect can then be modulated by the camera angle, time of day, and rain density, to create some pretty nice atmospheric effects. Hard edges on the rays helps to preserve the crisp, pixel art aesthetic."
This seems to confirm that the godrays are infact geometry-based and don't use any expensive raymarching/raytracing/etc. I'm mostly intrigued about this line and can't really decipher it:
"Using the light-space shadow map of the sun, I can project some quads on the scene to compute sunbeams (god rays) with just some texture sampling"
It seems to suggest that the placement of the quads is procedural and based on the shadow map of the sun. How they do this (especially since they mention they use texture sampling to do so) I have no clue. Can anyone give more insight?
Date of Recording: 2021-01-23
Using the light-space shadow map of the sun, I can project some quads on the scene to compute sunbeams (god rays) with just some texture sampling, without the need to do any raycasting or raytracing. This effect can then be modulated by the camera angle, time of day, and rain density, to create some pretty nice atm...