NVIDIA ShadowWorks (Adv. Soft Shadows) 2.1.
Overview
NVIDIA Advanced Soft Shadows provides a simple interface for adding high quality efficient shadows to games. It improves on PCSS to reach new levels of quality and performance, with the ability to render cascaded shadow maps, and multiple spot lights.
- Renders shadow maps (Application provides function pointer containing draw calls)
- Excepts externally generated maps too!
- Supported light types: Spot and Directional (with cascades)
- Renders shadow buffer (Application provides depth buffer)
- Filtering technique types: Hard, PCF and PCSS+
- PCSS+
- Adapted to support directional light sources with adaptive quality level for cascades
- Aliasing reduction algorithm (Penumbra control as blocker depth reaches zero
- Dramatic performance increases with convergence testing algorithm
Screenshot from Assassin’s Creed: Black Flag
Package
doc/—this documentation page.
lib/—header file, import libraries and DLLs, for Win32 and Win64.
samples/—source for sample applications demonstrating NVIDIA ShadowWorks - Adv. Soft Shadows.
Integration Overview
- DirectX 11 capable engine
- Shadow maps
- Provide a function pointer containing draw calls - let the library do the rest
- Provide your own rendering shadow maps - along with information used to render them
- Depth buffer (either single sample or MSAA)
- Library produces fullscreen shadow buffer
- Needs combining with color buffer
Integration Time
- Providing your own shadow maps:
- This is the path of least resistance
- Only requires 1 full screen pass to render the shadow buffer
- ~1 day with engine programmer & technical artist
- Library renders shadow maps:
- Need to group draw calls in a function (passed to the lib)
- ~2-3 days with engine programmer & technical artist (really depends on engine architecture...)
- Tuning
- Very quick when params can be changed at runtime
- ~1/2 a day
Integration Tips
- Provide resolved depth buffer if it exists
- Requires the max depth sub-sample
- Resolve will occur if MSAA buffer is provided
- Use the debug shaders:
- linear depth, cascade view & light frustum view
- Ensure matrices are identical to those used to render shadow maps and main scene
- Start with sensible default values as described in the main header file
- Tune parameters at runtime via the game console
API - On Create Device
- NV_ShadowLib_GetVersion()
- Check that header file matches DLL version
- NV_ShadowLib_OpenDX()
- Pass in ID3D11Device & ID3D11DeviceContext
- Returns a NV_ShadowLib_Ctx
- NV_ShadowLib_AddBuffer()
- NV_ShadowLib_AddMap()
- Optional – if not providing your own shadow maps
API - On Resize Window
- NV_ShadowLib_RemoveBuffer()
- Release the existing shadow buffer
- NV_ShadowLib_AddBuffer()
- Create a new one of the correct size
API - On Render
- NV_ShadowLib_RenderMap()
- Optional – if not providing your own shadow maps
- NV_ShadowLib_ClearBuffer()
- NV_ShadowLib_RenderBuffer()
- Can be called multiple times to composite from different shadow maps
- NV_ShadowLib_FinalizeBuffer()
- Gives back the finalized shadow buffer
API - On Destroy Device
- NV_ShadowLib_RemoveMap()
- Optional – if not providing your own shadow maps
- NV_ShadowLib_RemoveBuffer()
- Release the shadow buffer
- NV_ShadowLib_CloseDX()
- Fully release all resources and the NV_ShadowLib_Ctx
API - On Debug!
- NV_ShadowLib_DevModeDisplayMap()
- NV_ShadowLib_DevModeDisplayMapFrustum()
- NV_ShadowLib_DevModeDisplayBuffer()
- NV_ShadowLib_DevModeToggleDebugCascadeShader()
- ...
Artistic Requirements
- Really just parameter tuning
- Light size and position
- Penumbra size and gradient
- Shadow map resolution
- Overall shadow intensity
Examples
Regular PCF - Fixed Filter Size
PCSS+ - Physically Based Filter Size
CHS - Fixed Filter Size
PCSS+
CHS - Upper Limit to Penumbra Size
PCSS+
CHS - Aliasing
PCSS+ - Reduced Aliasing