Convert Figma logo to code with AI

Unity-Technologies logoPostProcessing

Post Processing Stack

3,702
747
3,702
311

Top Related Projects

2,081

A collection of custom post processing effects for Unity

Unity Post Processing Stack Library | Unity引擎的高品质后处理库

Quick Overview

The Unity-Technologies/PostProcessing repository is a collection of post-processing effects for Unity, designed to enhance the visual quality of games and applications. It provides a suite of image effects that can be applied to the final rendered image, including color grading, bloom, depth of field, and more.

Pros

  • Offers a wide range of high-quality post-processing effects
  • Optimized for performance, suitable for both mobile and high-end platforms
  • Easily customizable through a user-friendly interface in Unity
  • Regularly updated and maintained by Unity Technologies

Cons

  • Can be resource-intensive if overused, potentially impacting performance
  • Learning curve for beginners to understand and effectively use all features
  • Some effects may not be compatible with certain rendering pipelines
  • Occasional bugs or compatibility issues with specific Unity versions

Code Examples

  1. Adding the Post-Processing Volume component:
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class AddPostProcessingVolume : MonoBehaviour
{
    void Start()
    {
        PostProcessVolume volume = gameObject.AddComponent<PostProcessVolume>();
        volume.isGlobal = true;
        volume.profile = ScriptableObject.CreateInstance<PostProcessProfile>();
    }
}
  1. Configuring a Bloom effect:
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class ConfigureBloom : MonoBehaviour
{
    void Start()
    {
        PostProcessVolume volume = GetComponent<PostProcessVolume>();
        if (volume != null && volume.profile != null)
        {
            Bloom bloom;
            if (volume.profile.TryGetSettings(out bloom))
            {
                bloom.intensity.value = 1.5f;
                bloom.threshold.value = 1.0f;
            }
        }
    }
}
  1. Dynamically adjusting Depth of Field:
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

public class AdjustDepthOfField : MonoBehaviour
{
    public PostProcessVolume volume;
    public Transform target;

    void Update()
    {
        if (volume != null && volume.profile != null && target != null)
        {
            DepthOfField dof;
            if (volume.profile.TryGetSettings(out dof))
            {
                float distance = Vector3.Distance(transform.position, target.position);
                dof.focusDistance.value = distance;
            }
        }
    }
}

Getting Started

  1. Install the Post Processing package via Unity's Package Manager.
  2. Create a new Post-processing Layer on your camera:
    • Select your camera in the Hierarchy
    • Add the Post-process Layer component
    • Set the Layer to "PostProcessing" (create this layer if it doesn't exist)
  3. Create a Post-processing Volume:
    • Create an empty GameObject
    • Add the Post-process Volume component
    • Check "Is Global" if you want it to affect the entire scene
    • Create and assign a new Post-process Profile
  4. Add and configure effects in the Post-process Profile.
  5. Ensure your camera is set to use the PostProcessing layer in its Culling Mask.

Competitor Comparisons

2,081

A collection of custom post processing effects for Unity

Pros of Kino

  • Lightweight and modular approach to post-processing effects
  • Easier to customize and extend for specific project needs
  • More frequent updates and experimental features

Cons of Kino

  • Less comprehensive documentation compared to PostProcessing
  • May require more manual setup and integration
  • Smaller community and fewer readily available resources

Code Comparison

PostProcessing:

[PostProcess(typeof(BloomRenderer), PostProcessEvent.AfterStack, "Unity/Bloom")]
public sealed class Bloom : PostProcessEffectSettings
{
    public FloatParameter intensity = new FloatParameter { value = 0.5f };
    public ColorParameter color = new ColorParameter { value = Color.white };
}

Kino:

public class Bloom : MonoBehaviour
{
    public float intensity = 0.5f;
    public Color color = Color.white;

    void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        // Custom bloom implementation
    }
}

The PostProcessing package uses a more structured approach with dedicated classes and attributes, while Kino often employs simpler MonoBehaviour-based scripts for effects. This reflects the difference in complexity and flexibility between the two projects.

Unity Post Processing Stack Library | Unity引擎的高品质后处理库

Pros of X-PostProcessing-Library

  • Offers a wider range of post-processing effects, including advanced and experimental ones
  • Provides more customization options for each effect
  • Designed for high performance with compute shader implementations

Cons of X-PostProcessing-Library

  • Less integrated with Unity's built-in rendering pipeline
  • May require more manual setup and configuration
  • Documentation and community support might be less extensive

Code Comparison

X-PostProcessing-Library:

[VolumeComponentMenu(VolumeDefine.Environment + "Screen Space Cloud Shadow (X-PostProcessing)")]
public class ScreenSpaceCloudShadow : VolumeSetting
{
    public override bool IsActive() => intensity.value > 0;
    public FloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
}

PostProcessing:

[Serializable]
[VolumeComponentMenu("Post-processing/Bloom")]
public sealed class Bloom : VolumeComponent, IPostProcessComponent
{
    [Tooltip("Filters out pixels under this level of brightness.")]
    public MinFloatParameter threshold = new MinFloatParameter(0.9f, 0f);
}

Both libraries use similar attribute-based approaches for defining post-processing effects, but X-PostProcessing-Library tends to offer more specialized effects with additional customization options.

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

Post-processing Stack v2

Note: development has moved to the main Graphics repository.

This branch is under maintenance and holds the current version of the post-processing stack for the built-in render pipelines.

Instructions

Documentation is available in the manual.

The current version requires Unity 2018.3+.

For versions of Unity starting from 2017.2+, use version 2.3.0. For older versions of Unity (5.6 and 2017.1), use version 2.1.8.

To report bugs or other issues, use the Unity Bug Tracker. To see how, read this.

License

Unity Companion License (see LICENSE)