Skip to content

A little fix for the directional shadows with msaa enabled in Unity3d.

License

Notifications You must be signed in to change notification settings

sebastianhein/msaa-shadow-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity MSAA shadow fix

Description

MSAA multisampling is essential to create stable, non-flickering images for VR applications. Shadowmapping however is not working correctly with MSAA, resulting in hard edges where lit objects overlap shadowed areas.

The basic idea of this fix is to apply FXAA to the shadowmask in order to smooth edges. This solution uses a GrabPass in the shader and might not be the most efficient, but it works fine and allows alternative shadows like NGSS.

Example Pics

No MSAA:

no MSAA

MSAA - no fix:

MSAA - no fix

MSAA - no fix:

MSAA - fix applied

Usage

Add MsaaShadowFix to any directional light. A commandbuffer is added on enable.

Notes

Great thanks to mattdesl for providing the fxaa shader code here: https://github.com/mattdesl/glsl-fxaa

About

A little fix for the directional shadows with msaa enabled in Unity3d.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published