#3D Pixel Art Godrays

1 messages · Page 1 of 1 (latest)

visual rampart
#

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...

▶ Play video
unkempt pollen
ripe glen
#

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
Maybe instead of using 1M quads, you can use fewer count of inverted cylinders, sampled from lower res shadowmap (or mip), and instead of spawning other light shafts from sampled pixels, clustered bright pixels are merged making the lightshaft bigger

iron moss
#

I guess it's a pancake of quads, either big enough or numerous enough to cover the camera frustum which are aligned with the light direction while also oriented towards the camera, so you never see them from the side
The downside is that with camera rotation, parts of the quads away from the pivot can move very quickly if they're big
But it might not be too noticeable

#

If it is, using more but thinner quads will help that issue, at the cost of making the effect potentially more spotty

#

There's a lot of methods to iron out the flaws
They can fade out by distance to camera to prevent clipping, or fade out by viewing angle / fresnel to prevent seeing them edge-on, and fading out by distance to depth buffer to prevent clipping with geometry

visual rampart
#

Though these are manually placed in the scene. I suppose now would be to figure out the optimal way to place them procedurally

visual rampart
#

oh yeah, another huge issue of the stacked plane method (where you stack a bunch of instanced planes on top of eachother and rotate them to the light direction) is that it causes color to be blown out a lot since there's a bunch of transparent planes overlapping

#

It also can be pretty slow at high plane amounts since each one is sampling the depth texture and there's a tonne of transparent pixel overdraw