您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

68 行
1.5 KiB

Shader "Hidden/HDRenderPipeline/LutGen"
{
HLSLINCLUDE
#pragma target 5.0
#include "Common.hlsl"
#include "Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderVariables.hlsl"
#include "ColorGrading.hlsl"
float4 _LutParams;
struct Attributes
{
float3 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
struct Varyings
{
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
Varyings Vert(Attributes input)
{
Varyings output;
output.vertex = TransformWorldToHClip(input.vertex);
output.texcoord = input.texcoord.xy;
return output;
}
float4 Frag(Varyings input) : SV_Target
{
// 2D strip lut
float2 uv = input.texcoord - _LutParams.yz;
float3 color;
color.r = frac(uv.x * _LutParams.x);
color.b = uv.x - color.r / _LutParams.x;
color.g = uv.y;
// Lut is in LogC
float3 colorLogC = color * _LutParams.w;
// Switch back to unity linear
float3 colorLinear = LogCToLinear(colorLogC);
return float4(colorLinear, 1.0);
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Frag
ENDHLSL
}
}
Fallback Off
}