Firstborn/Library/PackageCache/com.unity.render-pipelines..../ShaderLibrary/DeclareNormalsTexture.hlsl
Schaken-Mods 9092858a58 updated to the latest editor
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
2023-05-07 17:43:11 -05:00

34 lines
1.1 KiB
HLSL

#ifndef UNITY_DECLARE_NORMALS_TEXTURE_INCLUDED
#define UNITY_DECLARE_NORMALS_TEXTURE_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
TEXTURE2D_X_FLOAT(_CameraNormalsTexture);
SAMPLER(sampler_CameraNormalsTexture);
float3 SampleSceneNormals(float2 uv)
{
float3 normal = SAMPLE_TEXTURE2D_X(_CameraNormalsTexture, sampler_CameraNormalsTexture, UnityStereoTransformScreenSpaceTex(uv)).xyz;
#if defined(_GBUFFER_NORMALS_OCT)
float2 remappedOctNormalWS = Unpack888ToFloat2(normal); // values between [ 0, 1]
float2 octNormalWS = remappedOctNormalWS.xy * 2.0 - 1.0; // values between [-1, +1]
normal = UnpackNormalOctQuadEncode(octNormalWS);
#endif
return normal;
}
float3 LoadSceneNormals(uint2 uv)
{
float3 normal = LOAD_TEXTURE2D_X(_CameraNormalsTexture, uv).xyz;
#if defined(_GBUFFER_NORMALS_OCT)
float2 remappedOctNormalWS = Unpack888ToFloat2(normal); // values between [ 0, 1]
float2 octNormalWS = remappedOctNormalWS.xy * 2.0 - 1.0; // values between [-1, +1]
normal = UnpackNormalOctQuadEncode(octNormalWS);
#endif
return normal;
}
#endif