Unity Graphics (SRP)

repository·master·Indexed 25 days ago

https://github.com/unity-technologies/graphics

Source code for Unity's Scriptable Render Pipeline (SRP) technologies, including the Universal Render Pipeline (URP), High Definition Render Pipeline (HDRP), Shader Graph, and Visual Effect Graph. Includes documentation on the Shader Analysis tool for performance reporting, installation guides for Shader Graph, and XR graphics testing via the com.unity.testing.xr package.

Tokens
277.6K
Snippets
157
Records
1.6K
Agent score
83%

What's inside Unity Graphics

  1. Overview of HDRP Materials and Surfaces

    master

    In the High Definition Render Pipeline (HDRP), you can create and modify shader materials and Shader Graph materials. HDRP provides specialized workflows for various surface types including:

    • Lit Materials: Realistic materials with support for subsurface scattering, iridescence, vertex/pixel displacement, and decal compatibility.
    • Unlit Materials: Materials that are not affected by lighting.
    • Transparent and Translucent Materials: Refractive materials.
    • Organic Surfaces: Specialized workflows for Skin (subsurface scattering), Hair, Fur, and Eyes.
    • Fabrics: Materials like cotton, wool, and silk.
    • Decals: Surface decorations like paint splatters or stickers.
    • Specialized Shaders: Fog Volume shaders for volumetric fog, Fullscreen materials for post-process/custom pass effects, and Canvas materials for UGUI elements.
  2. Overview of RadeonRays C# Port

    master

    The com.unity.render-pipelines.core package contains a C# port of the RadeonRays library (originally C++). This port is based on the RadeonRays 4.1 release.

    Key implementation details:

    • The file structure and naming conventions mirror the original RadeonRays SDK source located in the src/core/src/dx directory.
    • HLSL shaders have been modified to ensure compatibility and work around bugs present in the older FXC compiler.
    • The BVH (Bounding Volume Hierarchy) build logic contains specific modifications; developers should refer to comments in HlbvhBuilder.cs for details on these changes.
  3. Overview of Unity Scriptable Render Pipeline (SRP)

    master

    The Scriptable Render Pipeline (SRP) allows developers to create modern, high-fidelity graphics in Unity. This repository contains the source code for several key SRP components:

    • Universal Render Pipeline (URP): Designed for use on all platforms.
    • High Definition Render Pipeline (HDRP): Designed for use on compute shader compatible platforms.
    • Scriptable Render Pipeline Core: The foundation for SRP packages.
    • Shader Graph: A visual tool for creating shaders.
    • Visual Effect Graph: A tool for creating complex visual effects.
  4. Overview of UGUI Subgraph Node categories

    master

    The UGUI Subgraph library is organized into several functional categories:

    • Inputs: Provides input data (e.g., Canvas Color).
    • Utilities: Simple utilities to assist with input data.
    • Gradients: Generates linear, spherical, square, and custom gradients.
    • Helpers: Commonly-used operations for building UI elements.
    • Patterns: Procedural patterns for backgrounds or masks (e.g., clouds, bars, checkers, hexagon tiles, rings, etc.).
    • SDFs (Signed Distance Fields): Provides resolution-independent shapes (circle, hexagon, pill, rectangle, star, triangle) and operators for combining them.
    • Time: Outputs time in various forms like looping, mirrored, or sine waves.
    • UV: Manipulates UV coordinates (move, scale, tilt, mirror, invert, etc.).
  5. Overview of HDRP Dynamic Resolution

    master

    Dynamic resolution reduces GPU workload to maintain a stable target frame rate by lowering the resolution of render targets used in main rendering passes.

    HDRP utilizes two modes:

    • Hardware Dynamic Resolution: Supported on all HDRP-compatible Console platforms and PCs using DX12, Vulkan, or Metal. It treats render targets (up to the back buffer) as the scaled size, allowing for faster clears.
    • Software Dynamic Resolution: Used as a fallback if hardware dynamic resolution is unavailable on the platform.

    When enabled, HDRP allocates render targets for the maximum possible resolution and rescales the viewport. The final result is upscaled to match the back buffer resolution using a software Upscale Filter.

  6. Use UGUI Shaders sample for procedural UI elements

    master

    The Shader Graph UGUI Shaders sample provides a collection of Shader Graph subgraphs designed to build dynamic, procedural user interface elements (widgets, buttons, and backgrounds).

    Using these subgraphs allows you to create UI that is:

    • Resolution Independent: Procedurally generated visuals that remain sharp at any resolution or zoom level.
    • Zero Texture Memory: Visuals are created using mathematical operations rather than texture assets.
    • Authored in Shader Graph: Allows for direct adjustments to shader parameters or node re-wiring within Unity, avoiding external export/import loops.
    • Aspect Ratio Adaptive: By passing the width and height of the assigned UI element into the shader, visuals automatically adapt to the aspect ratio without needing 9-slicing or multiple assets.
    • State-Integrated: A single shader can encapsulate all visual states, such as hover, active/inactive, and pressed states, eliminating the need for multiple image assets.
  7. Use the Shader Graph Production Ready Shaders sample

    master
    The Shader Graph Production Ready Shaders sample provides a collection of shader assets that can be used out of the box or modified for specific needs. It includes Shader Graph versions of HDRP and URP Lit shaders, as well as specialized shaders for environments. You can use these assets directly in your project or deconstruct them to learn how they are built.