Convert Figma logo to code with AI

keijiro logoTestbedHDRP

Testbed project for Unity HDRP (High Definition Render Pipeline)

1,216
155
1,216
0

Top Related Projects

Unity Graphics - Including Scriptable Render Pipeline

This project contains a collection of Custom Renderer examples. This will be updated as we refine the feature and add more options.

A bunch of custom passes made for HDRP

Demo Project using the Universal RP from Unity3D

Quick Overview

TestbedHDRP is a Unity project that serves as a testbed for the High Definition Render Pipeline (HDRP). It showcases various rendering techniques and features available in HDRP, providing developers with a practical playground to experiment with advanced graphics capabilities in Unity.

Pros

  • Demonstrates cutting-edge rendering techniques using HDRP
  • Provides ready-to-use examples for learning and experimentation
  • Regularly updated to incorporate new HDRP features
  • Offers a diverse range of visual effects and shaders

Cons

  • Requires a relatively powerful GPU to run smoothly
  • May be overwhelming for beginners new to HDRP
  • Limited documentation for some of the more complex examples
  • Focused solely on HDRP, not applicable to other render pipelines

Code Examples

// Example of using HDRP's custom pass to create an outline effect
[System.Serializable]
class OutlinePass : CustomPass
{
    public Color outlineColor = Color.black;
    public float outlineThickness = 1;

    protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
    {
        // Setup code for the outline pass
    }

    protected override void Execute(CustomPassContext ctx)
    {
        // Execution code for the outline effect
    }
}
// Example of setting up a volumetric fog in HDRP
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

public class VolumetricFogSetup : MonoBehaviour
{
    void Start()
    {
        var volume = gameObject.AddComponent<Volume>();
        var fog = volume.profile.Add<VolumetricFog>();
        fog.albedo.Override(Color.white);
        fog.meanFreePath.Override(100f);
    }
}
// Example of using HDRP's ray-tracing features
[RequireComponent(typeof(HDAdditionalLightData))]
public class RayTracedAreaLight : MonoBehaviour
{
    void Start()
    {
        var lightData = GetComponent<HDAdditionalLightData>();
        lightData.SetAreaLightEmissiveMesh(GetComponent<MeshRenderer>());
        lightData.areaLightShape = AreaLightShape.Rectangle;
        lightData.useRayTracedShadows = true;
    }
}

Getting Started

  1. Clone the repository: git clone https://github.com/keijiro/TestbedHDRP.git
  2. Open the project in Unity 2020.3 or later with HDRP package installed
  3. Open one of the example scenes in the Assets/Scenes folder
  4. Press Play to see the HDRP features in action
  5. Explore the scripts and shaders in the project to learn how different effects are implemented

Competitor Comparisons

Unity Graphics - Including Scriptable Render Pipeline

Pros of Graphics

  • Larger, more comprehensive repository with broader scope
  • Official Unity repository, likely more up-to-date with latest Unity features
  • More extensive documentation and community support

Cons of Graphics

  • Potentially more complex and harder to navigate for beginners
  • May include features not relevant to all users
  • Larger codebase might lead to longer build times

Code Comparison

TestbedHDRP:

public class CustomPass : CustomPass
{
    protected override void Execute(CustomPassContext ctx)
    {
        // Custom rendering logic
    }
}

Graphics:

public class HDRenderPipeline : RenderPipeline
{
    protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
    {
        // Rendering pipeline implementation
    }
}

Summary

TestbedHDRP is a focused repository for experimenting with HDRP features, while Graphics is a comprehensive repository covering Unity's entire graphics system. TestbedHDRP may be more suitable for quick prototyping and learning HDRP specifics, while Graphics offers a complete view of Unity's rendering capabilities but with a steeper learning curve. The code examples show that TestbedHDRP focuses on custom passes, while Graphics deals with the entire rendering pipeline implementation.

This project contains a collection of Custom Renderer examples. This will be updated as we refine the feature and add more options.

Pros of UniversalRenderingExamples

  • Focuses on Universal Render Pipeline (URP), which is more versatile and suitable for a wider range of platforms
  • Provides a comprehensive set of examples covering various rendering techniques
  • Officially maintained by Unity Technologies, ensuring up-to-date compatibility with Unity releases

Cons of UniversalRenderingExamples

  • May not showcase cutting-edge graphics features available in HDRP
  • Could be less suitable for high-end PC and console projects requiring advanced visual fidelity
  • Might have a steeper learning curve due to the breadth of examples

Code Comparison

TestbedHDRP:

[SerializeField] HDAdditionalLightData _light = null;
[SerializeField] AnimationCurve _curve = AnimationCurve.Linear(0, 0, 1, 1);
[SerializeField] float _frequency = 1;

UniversalRenderingExamples:

public class ExampleFeature : ScriptableRendererFeature
{
    public override void Create()
    {
        // Feature setup
    }
}

The code snippets show that TestbedHDRP focuses on HDRP-specific components, while UniversalRenderingExamples demonstrates URP renderer features. TestbedHDRP appears more tailored to specific visual effects, while UniversalRenderingExamples provides a broader framework for custom rendering pipelines.

A bunch of custom passes made for HDRP

Pros of HDRP-Custom-Passes

  • More comprehensive documentation and examples for custom passes
  • Actively maintained with regular updates and community contributions
  • Includes a wider range of custom pass types and effects

Cons of HDRP-Custom-Passes

  • May be more complex for beginners due to its extensive features
  • Requires more setup and configuration compared to TestbedHDRP
  • Potentially higher performance overhead for some effects

Code Comparison

TestbedHDRP:

[CustomPassDrawer("My Custom Pass")]
class MyCustomPass : CustomPass
{
    protected override void Execute(CustomPassContext ctx)
    {
        // Custom rendering logic here
    }
}

HDRP-Custom-Passes:

[System.Serializable, VolumeComponentMenu("Custom Passes/My Custom Pass")]
public class MyCustomPass : CustomPass
{
    protected override void Execute(CustomPassContext ctx)
    {
        // Custom rendering logic here
    }
}

Both repositories provide frameworks for implementing custom rendering passes in Unity's High Definition Render Pipeline (HDRP). TestbedHDRP offers a simpler, more straightforward approach, while HDRP-Custom-Passes provides a more feature-rich and flexible solution. The code structure is similar, but HDRP-Custom-Passes includes additional attributes and integration with the Volume system for easier management of multiple passes.

Demo Project using the Universal RP from Unity3D

Pros of BoatAttack

  • Provides a complete game demo showcasing HDRP capabilities in a real-world scenario
  • Includes advanced water simulation and interaction systems
  • Offers a more comprehensive set of assets and gameplay elements

Cons of BoatAttack

  • Larger project size, potentially more complex to navigate and understand
  • May include features not directly related to HDRP, which could be distracting for those focused solely on rendering techniques

Code Comparison

TestbedHDRP:

[SerializeField] Renderer _renderer = null;
[SerializeField] float _frequency = 1;
[SerializeField] float _amplitude = 0.1f;

void Update()
{
    var t = Time.time * _frequency;
    _renderer.material.SetFloat("_Displacement", Mathf.Sin(t) * _amplitude);
}

BoatAttack:

public class BoatAlignNormal : MonoBehaviour
{
    public float waterLevel = 0.0f;
    public Transform[] floaters;
    public float bounceDamp = 0.05f;
    public Vector3 buoyancyCentreOffset;
    protected Rigidbody rigidBody;
}

The TestbedHDRP code focuses on simple material property manipulation, while BoatAttack demonstrates more complex physics-based interactions for water simulation.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

TestbedHDRP

gif gif

gif gif

TestbedHDRP is a Unity project where I try custom effect ideas with Unity HDRP. Currently, it only contains the following two types of effects:

  • Geometry shader effects
  • Many-light effects

Although the geometry shader effects are fun and exciting to use, I don't recommend using them in production. The geometry shader is near-obsolete technology. You will meet several problems if you use it in your product.

The many-light effects are mainly for benchmark purposes. I just wanted to know how I could utilize the power of FPTL.

System requirements

  • Unity 2019.4
  • HDRP 7.4