Unity URP

_MainLightShadowParams

  • x: shadowStrength
  • y: 1.0 = soft shadow, 0.0 = otherwise
  • z: 1/ fade distance
  • w: 1- start fade

Anti-Aliasing

What is AA: https://www.youtube.com/watch?v=hqi0114mwtY

How to do AA? There’re two types of AA. One is to increase the sample rate, that means to render the scene in a higher resolution and sample down it to the target resolution to smooth the line. Two is to blur the edge or contrast, known as Post AA or Post Processing .

  • Super Sampling, or Full Scene, Anti-Aliasing (SSAA/FSAA) is in the first category, and works better in photorealism. For line art and diagram, it will lower the quality by blurring out the content. It has huge computational cost.
  • MSAA is similar to SSAA, but only super samples the edge of the polygons, and calculates textures once per pixel. CSAA (Coverage Sample) was released with GeForce 8 graphic cards. It detects where the polygon is present and judge where to use super sampling. It produces similar quality like 16x MSAA by using 4x.
  • FXAA (Fast Approximate) falls into the second category. It directly smooth the edge directly after each pixel is rendered. It compares the depth between two pixels and smoothes their edge according to relative depth. The downside is that it makes every texture soft.
  • TXAA (Temporal) is a film style anti-aliasing technique combined down sampling and blurring. The implementation varies from game to game, and only available to certain GPU.
  • SMAA (Sub-pixel Morphological) combines morphological anti-aliasing, a post processing technique identifies aliasing based on patterns and blends color around thee, and super sampling to sharpen the entire scene.

Reading Material:

  1. How to resolve an MSAA DepthBuffer: https://wickedengine.net/2016/11/13/how-to-resolve-an-msaa-depthbuffer/
  2. URP’s use of the depth prepass: https://forum.unity.com/threads/need-clarification-on-urps-use-of-the-depth-prepass.1004577/
  3. RenderTexture.ResolveAA:
    1. https://cxymm.net/article/ccanan/48213083
    2. https://github.com/sienaiwun/Unity_AAResolveOnCommand
    3. https://forum.unity.com/threads/every-graphics-blit-causes-rendertexture-resolveaa-if-msaa-enabled-which-is-killing-framerate.457653/