Convert Figma logo to code with AI

Unity-Technologies logoGraphics

Unity Graphics - Including Scriptable Render Pipeline

2,497
790
2,497
85

Top Related Projects

88,735

Godot Engine – Multi-platform 2D and 3D game engine

18,111

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.

7,644

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.

6,448

Stride Game Engine (formerly Xenko)

11,280

One framework for creating powerful cross-platform games.

Quick Overview

The Unity-Technologies/Graphics repository is a collection of graphics-related packages and tools for the Unity game engine. It includes various rendering pipelines, shader libraries, and graphics utilities to enhance the visual quality and performance of Unity projects.

Pros

  • Provides advanced rendering pipelines (Universal RP, High Definition RP) for different project needs
  • Offers a wide range of graphics features and optimizations
  • Regularly updated and maintained by Unity Technologies
  • Includes extensive documentation and examples

Cons

  • Can be complex for beginners to understand and implement
  • Some features may require more powerful hardware to run efficiently
  • Occasional breaking changes between versions
  • May require additional setup and configuration compared to Unity's built-in rendering pipeline

Code Examples

  1. Setting up Universal Render Pipeline (URP):
using UnityEngine;
using UnityEngine.Rendering.Universal;

public class URPSetup : MonoBehaviour
{
    void Start()
    {
        UniversalRenderPipelineAsset urpAsset = ScriptableObject.CreateInstance<UniversalRenderPipelineAsset>();
        GraphicsSettings.renderPipelineAsset = urpAsset;
    }
}
  1. Creating a custom post-processing effect:
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class CustomPostProcessPass : ScriptableRenderPass
{
    public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    {
        // Implement custom post-processing effect here
    }
}
  1. Using the High Definition Render Pipeline (HDRP) Volume system:
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

public class HDRPVolumeExample : MonoBehaviour
{
    void Start()
    {
        Volume volume = gameObject.AddComponent<Volume>();
        VolumeProfile profile = ScriptableObject.CreateInstance<VolumeProfile>();
        volume.profile = profile;

        Bloom bloom = profile.Add<Bloom>(true);
        bloom.intensity.Override(1.5f);
    }
}

Getting Started

To get started with the Unity-Technologies/Graphics packages:

  1. Open your Unity project
  2. Go to Window > Package Manager
  3. Search for and install the desired graphics package (e.g., "Universal RP" or "High Definition RP")
  4. Create a new Render Pipeline Asset (Assets > Create > Rendering > Universal Render Pipeline > Pipeline Asset)
  5. Set the new asset as the default in Project Settings > Graphics > Scriptable Render Pipeline Settings
  6. Upgrade your project materials and shaders when prompted

For more detailed instructions and advanced usage, refer to the official Unity documentation for the specific rendering pipeline you're using.

Competitor Comparisons

88,735

Godot Engine – Multi-platform 2D and 3D game engine

Pros of Godot

  • Open-source and free to use, with no licensing fees or royalties
  • Lightweight and efficient, with a smaller installation size
  • Supports multiple programming languages (GDScript, C#, C++)

Cons of Godot

  • Smaller community and ecosystem compared to Unity
  • Less extensive documentation and learning resources
  • Fewer built-in tools and features for advanced graphics

Code Comparison

Godot (GDScript):

extends Spatial

func _ready():
    var cube = CSGBox.new()
    add_child(cube)
    cube.translate(Vector3(0, 1, 0))

Graphics (C#):

using UnityEngine;

public class CubeSpawner : MonoBehaviour
{
    void Start()
    {
        GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
        cube.transform.position = new Vector3(0, 1, 0);
    }
}

Both examples create a cube and position it slightly above the origin. Godot's code is more concise due to GDScript's simplicity, while Unity's C# code is more verbose but potentially more familiar to developers with C# experience.

18,111

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.

Pros of cocos2d-x

  • Lightweight and efficient, suitable for mobile game development
  • Open-source with a large community and extensive documentation
  • Cross-platform support for multiple programming languages (C++, Lua, JavaScript)

Cons of cocos2d-x

  • Less comprehensive toolset compared to Unity's extensive features
  • Steeper learning curve for developers new to game engine architecture
  • Limited built-in visual editing capabilities

Code Comparison

cocos2d-x (C++):

auto sprite = Sprite::create("sprite.png");
sprite->setPosition(Vec2(100, 100));
this->addChild(sprite);

Graphics (Unity C#):

GameObject sprite = new GameObject("Sprite");
SpriteRenderer renderer = sprite.AddComponent<SpriteRenderer>();
renderer.sprite = Resources.Load<Sprite>("sprite");
sprite.transform.position = new Vector3(1, 1, 0);

Both examples demonstrate creating and positioning a sprite, showcasing the syntax differences between the two frameworks. cocos2d-x uses a more direct approach with its own classes, while Unity relies on the GameObject and Component system.

7,644

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.

Pros of o3de

  • Open-source and fully customizable game engine
  • Modular architecture allowing for easier extension and modification
  • Integrated asset pipeline with support for various file formats

Cons of o3de

  • Steeper learning curve due to its complexity and extensive feature set
  • Smaller community and ecosystem compared to Unity
  • Less documentation and tutorials available for beginners

Code Comparison

o3de:

#include <AzCore/Component/Entity.h>
#include <AzCore/Component/ComponentApplication.h>

void Initialize()
{
    AZ::ComponentApplication::Descriptor appDescriptor;
    AZ::ComponentApplication::StartupParameters startupParams;
    AZ::ComponentApplication app;
    app.Create(appDescriptor, startupParams);
}

Graphics:

using UnityEngine;

public class ExampleScript : MonoBehaviour
{
    void Start()
    {
        Debug.Log("Unity script initialized");
    }
}

The o3de code demonstrates the initialization of the component-based application, while the Graphics code shows a basic Unity script structure. O3DE uses a more low-level approach, offering greater control but requiring more setup, whereas Unity provides a simpler, more accessible scripting environment.

6,448

Stride Game Engine (formerly Xenko)

Pros of Stride

  • Open-source and free to use, allowing for more community contributions and customization
  • Built with modern C# and .NET, potentially offering better performance and easier integration with other .NET technologies
  • Supports both high-level and low-level graphics programming, providing flexibility for developers

Cons of Stride

  • Smaller community and ecosystem compared to Unity, resulting in fewer resources and third-party assets
  • Less mature and battle-tested in large-scale production environments
  • Steeper learning curve for developers transitioning from other popular game engines

Code Comparison

Stride (C#):

public class MyScript : SyncScript
{
    public override void Start()
    {
        // Initialization code
    }
}

Unity (C#):

public class MyScript : MonoBehaviour
{
    void Start()
    {
        // Initialization code
    }
}

Both examples show a basic script structure, with Stride using SyncScript and Unity using MonoBehaviour as base classes. The Start method in Stride is marked with override, while Unity's is not.

11,280

One framework for creating powerful cross-platform games.

Pros of MonoGame

  • Open-source and completely free to use, with no licensing fees
  • Cross-platform development for multiple platforms including desktop, mobile, and consoles
  • Lightweight and efficient, suitable for smaller teams and indie developers

Cons of MonoGame

  • Less extensive documentation and community support compared to Unity
  • Fewer built-in tools and features, requiring more manual implementation
  • Steeper learning curve for developers new to game development

Code Comparison

MonoGame:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);
    spriteBatch.Begin();
    spriteBatch.Draw(texture, position, Color.White);
    spriteBatch.End();
    base.Draw(gameTime);
}

Graphics (Unity):

void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    Graphics.Blit(source, destination, material);
}

MonoGame focuses on 2D sprite rendering, while Graphics (Unity) provides more advanced rendering capabilities, including post-processing effects. The MonoGame example shows basic sprite drawing, whereas the Unity example demonstrates applying a material to the entire rendered image.

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

NOTE: We have migrated reported issues to FogBugz. You can only log further issues via the Unity bug tracker. To see how, read this.

NOTE 2: Development by Unity developers happens in an private repo. Changes are mirrored from that private repo to this public repo every few weeks. This forum thread can be used to discuss the mirroring.

Unity Scriptable Render Pipeline

The Scriptable Render Pipeline (SRP) is a Unity feature designed to give artists and developers the tools they need to create modern, high-fidelity graphics in Unity. Unity provides two pre-built Scriptable Render Pipelines:

  • The Universal Render Pipeline (URP) for use on all platforms.
  • The High Definition Render Pipeline (HDRP) for use on compute shader compatible platforms.

Unity is committed to an open and transparent development process for SRP and the pre-built Render Pipelines. This means that you can browse this repository to see what features are currently in development.

For more information about the packages in this repository, see the following:

Branches and package releases

The packages in this repository are distributed as Core packages in the Unity editor. The package vendoring process happens multiple times in each Unity release. The vendoring happens from the latest changeset of the release branch for each Unity release. A tag is generated on the changeset used to vendor a specific Unity release.

Release branches are defined as follows:

  • master branch is used for main developement and it always maps to the latest Unity Alpha release.
  • {unity-version}/staging maps to beta and released Unity versions. f.ex, 2021.1/staging maps to Unity 2021.1.
  • {package-major-version}.x.x/release is used for Unity 2020.x and below. f.ex, 10.x.x/release maps to Unity 2020.3 LTS.

If you need to find if a specific changeset is included in a specific Unity version, you can search tags for the Unity version. On GitHub, you can do that by clicking on the Branch drop-down then clicking the Tags tab. Typing 2021.2 will list all changesets tagged to each Unity version.

Modifying package source

You can download and install the packages of this repositories on your Unity project and modify the package source code. You can do that by one of the following methods:

  1. Clone this repository in any folder on your computer. Install them as local packages into your project.
  2. Clone this repository inside a Packages folder in your Unity project.

Cloning the repository using the GitHub Desktop App:

  1. Open the GitHub Desktop App and click File > Clone repository.
  2. Click the URL tab and enter the following URL: https://github.com/Unity-Technologies/Graphics.
  3. Click the Choose… button and navigate to your Unity Project’s base folder.
  4. Click the Clone button.

Make sure you have Git LFS extension installed as that's required.

After you clone the repository, open your console application of choice in the Graphics folder and run the following console command:

\> git checkout 2021.1.16f1.2801 (or the latest tag)

Cloning the repository using console commands:

Open your console application of choice and run the following console commands:

\> cd <Path to your Unity project>

\> git clone https://github.com/Unity-Technologies/Graphics

\> cd Graphics

\>  git checkout 2021.1.16f1.2801 (or the latest tag)

Sample Scenes in Graphics

Unity provides sample Scenes to use with SRP. You can find these Scenes in the Graphics GitHub repository. To add the Scenes to your Project, clone the repository into your Project's Assets folder.

Package versions on Unity 2020.3 LTS and below

On Unity 2020.3 LTS and below, the packages in this repository were not Core packages. Instead they were regular packages and different versions could be installed to different versions of Unity. The compatibility of Unity versions and package versions were as follows:

  • Unity 2023.3 is compatible with SRP versions 17.x.x
  • Unity 2023.2 is compatible with SRP versions 16.x.x
  • Unity 2023.1 is compatible with SRP versions 15.x.x
  • Unity 2022.2/3 is compatible with SRP versions 14.x.x
  • Unity 2022.1 is compatible with SRP versions 13.x.x
  • Unity 2021.2/3 is compatible with SRP versions 12.x.x
  • Unity 2021.1 is compatible with SRP versions 11.x.x
  • Unity 2020.2 is compatible with SRP versions 10.x.x
  • Unity 2020.1 is compatible with SRP versions 8.x.x
  • Unity 2019.3 is compatible with SRP versions 7.x.x
  • Unity 2019.2 is compatible with SRP versions 6.x.x
  • Unity 2019.1 is compatible with SRP versions 5.x.x

The above list is a guideline for major versions of SRP, but there are often multiple minor versions that you can use for a certain version of Unity. To determine which minor versions of SRP you can use:

  1. In your Unity Project, open the Package Manager window (menu: Window > Package Manager).
  2. In the list of packages, find Core RP Library. To find this package in older versions of Unity, you may need to expose preview packages. To do this, click the Advanced button at the top of the window then, in the context menu, click Show preview packages.
  3. Click the drop-down arrow to the left of the package entry then click See all versions. This shows a list that contains every package version compatible with your version of Unity.

After you decide which version of SRP to use:

  1. Go to the Unity Graphics repository.
  2. Click the Branch drop-down then click the Tags tab.
  3. Find the tag that corresponds to the version of SRP you want to use. When you clone the repository, you use this tag to check out the correct branch.