Added UtsEvaluateAngelRing;
Added UTSTonemapping;
This commit is contained in:
48
Runtime/UTS Renderer/UTSToonmapping/UTSTonemapping.cs
Normal file
48
Runtime/UTS Renderer/UTSToonmapping/UTSTonemapping.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.HighDefinition;
|
||||
|
||||
[Serializable, VolumeComponentMenu("Post-processing/UTS Tonemapping")]
|
||||
public sealed class UTSTonemapping : CustomPostProcessVolumeComponent, IPostProcessComponent
|
||||
{
|
||||
[Tooltip("Controls the intensity of the effect.")]
|
||||
public BoolParameter state = new BoolParameter(true, BoolParameter.DisplayType.EnumPopup);
|
||||
|
||||
private Material _material;
|
||||
|
||||
public bool IsActive() => _material != null && state.value;
|
||||
|
||||
// Do not forget to add this post process in the Custom Post Process Orders list (Project Settings > Graphics > HDRP Global Settings).
|
||||
public override CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess;
|
||||
|
||||
const string Shader_Name = "Hidden/Shader/UTSTonemapping";
|
||||
|
||||
public override void Setup()
|
||||
{
|
||||
if (Shader.Find(Shader_Name) != null)
|
||||
{
|
||||
_material = CoreUtils.CreateEngineMaterial(Shader_Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Unable to find shader '{Shader_Name}'. Post Process Volume UTSToonmapping is unable to load. To fix this, please edit the 'kShaderName' constant in UTSToonmapping.cs or change the name of your custom post process shader.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination)
|
||||
{
|
||||
if (_material == null || !state.value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_material.SetTexture("_MainTex", source);
|
||||
HDUtils.DrawFullScreen(cmd, _material, destination, shaderPassId: 0);
|
||||
}
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
CoreUtils.Destroy(_material);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user