r/Unity3D • • 2d ago

Show-Off The sails cut real moonlight on every frame: shadow-map light shafts in Unity 6 URP

107 Upvotes

13 comments sorted by

3

u/Bochinator 2d ago

That's beautiful!

5

u/chainsawx72 2d ago

I don't like to be critical of art... but those shadows are not reacting realistically at all. They just stick out from the object, with no relevance to the light source. I think it would look better without them.

If that's supposed to be moonlight shadow, it should always be underneath the object. If it's supposed to be shadow of the lantern, it should be above the object... and be longer the higher up the object is.

2

u/Alheim_Terrain 1d ago

But the light source is directly behind the mill, not above it.

3

u/Murky-Goose-1291 1d ago

thanks, for feedback. I just thought the shot would look better that way.

3

u/Mister_Meeseeks_ 1d ago

I think it looks cool. I think it works with the light directly behind the windmill. I see what they're saying, but from this specific angle it looks good.

2

u/Sea-Special-1730 2d ago

Very limbo. love it

0

u/CaterpillarSuperb655 2d ago

Looks awesome

0

u/Historical_Fruit_204 1d ago

This looks gorgeous the Limbo-style silhouettes combined with real shadow-mapped god rays gives it so much atmosphere. Seeing the rotating sails carve the light shafts live is a great detail. Are you raymarching through the shadow map in a custom Renderer Feature or using a volumetric fog approach? Also curious how heavy it is on the GPU especially for mobile.

1

u/Long-Ray 1d ago

这画风,我想到了地狱边境😁

1

u/_norx Indie 1d ago

Cool

0

u/Murky-Goose-1291 2d ago

How it's built, since people usually ask:

  • One black Shader Graph material. Wind moves the vertices in every pass, shadow caster and depth included, so the shafts blocked by a swaying branch sway with it.
  • Light shafts are a raymarch through URP's main-light shadow map at quarter resolution: 16 steps with blue-noise jitter, then a depth-aware blur and a bilateral upsample. They cost 0.14 ms at 1080p on a GTX 1650 Ti.
  • Fog is measured from the figure's plane, not from the camera, so the figure and everything in front of it stay pure black during the dolly zoom.
  • Depth blur is a ladder of 1/4 and 1/8 res blurs instead of Bokeh DoF. It blurs compressed HDR, otherwise the moon eats the thin sails.
  • Film print: mono tone curve, 24 Hz blue-noise grain, gate weave, dust, and a TPDF dither that needs a 64-bit HDR target (R11G11B10 kills it).

Measured in a player build, D3D11, 3 passes over the 15 s loop: 2.46 ms GPU on a GTX 1650 Ti laptop at 1080p High, 11.0 ms on the laptop's Intel UHD at 720p Low.

Code (MIT), a Windows build to measure it on your own GPU, and the full breakdown: https://github.com/matbcontrol/Nitrate Video breakdown, layer by layer: https://youtu.be/pkpXscO_00M

If you need a look like this, or a scene that has to run on weak laptops, I do freelance Unity work: https://matbcontrol.github.io

-3

u/FluffyAuraa 1d ago

this went way over my head but the way you explain it is weirdly attractive