This is a shader library used for unity shader coding, pointing to different shader effects found from various sources. Several library topics may become public in the future. This project is mainly for personal study and lack the knowledge of code management(i.e., comprehensive comment / user guide) and formal name formatting.
The following showcase pictures and knowledge network are organized in my understanding of different categories of shaders, some references and cites will be listed. But most of the content will be covered in my personal markdown notes.
See https://www.youtube.com/watch?v=aasnYKazO2Q for my TA/Rendering showreel and other bits of progress of this repository.
- Reference - Genshin Impact 渊下宫 / Zone Zero / Kejiro's PPS Light Streak
- Distance / Position / UV based Dissolve Factor calculation
- Dissolve Edge and Color
- Noise Dissolve Edge fluctuation
- Runtime implementation
- TBC - Magic: The Gathering / Legends of Runeterra look
- Noise based vertex displacement (high frequency and low frequency)
- World / Object / Screen Position based scan line (thin and thick)
- Fresnel Inner Outline
- Depth based edge detection and noise based variation
- Animation Process Mask map usage
- Screen Space UV Quad Formation and 2D Noise Texture distortion
- 3D Noise based shinning glitter
- Fresnel + Noise achieving flowing inner outline
- TBC - Journey / Witness desert look
- TBC
- TBC
- Noise-based displacement variation
- Distance based / Position based / Anime Goosebump Mockup
- Post Processing Light Shaft
- Occlusion Texture generation (only skybox kept)
- Radial image blur achieving light shaft leaking effect
- Noise offset turning pattern into noise
- Animated Speed Lines
- Good reference - Apex: Legends;
- SSAO
- World Position Rebuild
- Not implemented yet.
- Portal
- Mooncage
- Genshin Impact Style Cel Shading, Lightmap guided, Color ramp controlled (lacks face ramp control and hair specular map usage, didn't use screen space rim light).
- Outline pass - Screen Space thickness, View space normal extrusion
- PBR Based Cel Shading
- Diffuse, Specular falloff and ramp control
- Matcap shading
- NRP Shading
- Multiple ramp area control
- Diffuse, Specular, Shadow area control (for various artistic styles)
- Specular intensity control (the smoothstep function breaks the energy conservation, thus need to tweak the value to achieve proper appearance)
- Halftone step (UV Space / Screen Space)
- Todo: Anisotropic Specular Calculation
- Todo: UE approach of spherical-shape light / line-shape light (representative point)
- Todo: RBF area light approach
- Todo: HDRP shader understanding
- Todo: Fake SSS with thickness map
- Todo: Human Skin SSS rendering
- Reference
- Sun and Moon SDF based Rendering
- Texture / 3D Noise based Star rendering
- Texture Cloud Rendering
- Todo: multiple sampling achieving cloud thickness feeling
- Sky dome color ramp control
- Todo: add atmospheric scattering colorization
- Fake volumetric layer cloud - See: https://github.com/Zoroiscrying/UnityInteractableWater-Grass-Wind_URP
- Todo: Ray-marched volumetric cloud
References
- Wind Simulation in God of War - YouTube
- graphics.cs.cmu.edu/nsp/course/15-464/Fall09/papers/StamFluidforGames.pdf
- Interactive Wind and Vegetation in 'God of War' - YouTube
- Between Tech and Art: The Vegetation of Horizon Zero Dawn - YouTube
Showcase Pictures
(Work in progress on artistic showcases and dynamic vegetations...)
Global Wind 3D Scene Debug
- Based on
DrawMeshInstancedIndirect
Global Wind 2D Texture Slice Debug
- Based on Unity Post Processing and Custom PPS Render Pass
Wind Contributor Objects
- Shapes - Box, Cylinder, Sphere
- Velocity Calculation Type - Fixed, Point-based, Axis-Distance-Based
Wind Receivers (On Progress)
- Planning
- Vegetation - Grass, Vines, Shrubs (On-Going)
- Plant - Tree
- Cloth - Non-physically-correct
- Fur / Hair
- Future Improvements
- Box Contributor seems to have incorrect influence on the wind texture.
References
- https://www.slideshare.net/BenjaminGlatzel/volumetric-lighting-for-many-lights-in-lords-of-the-fallen
- Physically Based and Unified Volumetric Rendering in Frostbite
- GitHub - ArthurBrussee/Vapor at master
- Volumetric lights - Alexandre Pestana
- https://bartwronski.files.wordpress.com/2014/08/bwronski_volumetric_fog_siggraph2014.pdf
Showcase Pictures
World-Space Ray-Marching Volumetric Lighting
- World Space Camera Ray-march, Single Scattering Calculation
- Down-sample and up-sample reducing GPU cost
- Noise offset turning pattern into noise
- Bilateral Blur keeping sharp edge
- Gaussian Blur reducing light shaft edge artifact
Post-Processing Radial-Blur Volumetric Lighting
- TODO: Last of Us 2 volumetric lighting
- Frustum Voxel 3D scattering & decay texture / integration texture
- Various light shape's precalculated integration result
- Shadow map implementation for various light shapes
- Down-sampling and TAA support for volumetric lighting result
- Useful code reference
- Unity Adam showcase volumetric lighting
- Unity HDRP Volumetric lighting implementation
- Algorithm by: Tomb Raider: Rise (Deferred Snow Deformation in Rise of the Tomb Raider by Michels and Sikachev)
- Todo
- Add support for Vertical-Sliding-Window
- Create a more immersive showcase combining the GPU snow particles implementation.
- Adoption of various snow deformers (currently only one rounded type)
- Personal Concern and Possible Improvements
- Comparison with Traditional Height-Map-Based Snow Deformation
- Pros
- Suport for overlapping snow deformation (stepping snow on a bridge will only cause deformation on the bridge but not on the snow below the bridge)
- Better snow deformation and edge curve calculation due to deferred snow deformation.
- Cons
- Extra calculation when pack and extract bit data.
- Limited Precision for snow fill process.
- Pros
- Comparison with Traditional Height-Map-Based Snow Deformation
- Todo: Do some research ^^.
- Last of Us 2 screen particles approach.
References
References
- https://www.youtube.com/watch?v=MKX45_riWQA GDC talk by Sean Feeley
- Three layers of movement
- Wind-Direction Displacement based on Global Wind Texture.
- Local Spherical Noise based on Wind intensity.
- Stateful sway (displacement data stored in Buffer and processed in Compute Shader to achieve persistent movement)
- Basic Process (Every wind receiver can be treated as a single spring with a fixed location in the world, we then can use a spring model to calculate the force, hence acceleration, velocity, and displaced position in the world)
- Future Improvements
- Stateful Tree Implementation.
- Integrate Global Wind into refractored Grass Shader.
- Improve the movement shader code to match real-world wind speed and object movement.
- Improvement of editor scripts (maybe improvement on the GlobalWind3D Manager editor as well, utilizing Unity's uxml system (also serving as a learning process))
- Todo: Horizon: Zero Dawn volumetric cloud solution
- Stylized Water / Ocean Shader
- Todo: Jacobian water foam calculation
- Todo: RT + Particle system water foam and interaction (stylized)
- Todo: Underwater Post Process / Midwater look through effect (Maybe use stencil + post processing / world space near-camera water surface calculation + post processing)
- Another possible solution: render a depth map of the water top down above the camera, while in post-process, compare the screen pixel's vertical position in the world with the current water's height based on the depth map rendered (sounds like it, but I'm not sure). This solution supports Gerstner waves because it samples the water height after displacement.
- And Another one: render a near-plane dynamic mesh by sampling the water height at sepecific locations, render this mesh onto a low-res texture with a simple blur (render as white, background black, thus generating a mask texture at screen space). This solution does not support Gerstner waves, as Gerstner waves would change XZ position of water, causing the tracing of a height change on a fixed XZ point impossible (or extremely difficult).
- Actually, due to the consideration above, I would suggest using FFT waves for water movement (pure height map solution, only vertical movement).
- Depth and ramp based water colorization
- Gerstner / Sine wave and normal re-calculation
- Edge foam
- Water reflection and refraction
- Todo: FFT-based Realistic Ocean Shaders (Praise Horizon: Forbidden West and Assassin's Creed: Odyssey)
- Todo: Various Ocean simulations (Heightfield water simulation especially)
- Used in:
- Stylized Water / Ocean Shader
References
References
- Catlike coding: https://catlikecoding.com/unity/tutorials/rendering/part-20/
References
References