浏览代码

HDRP: Fix issue with Vulkan and wrong normal (same as metal)

/main
sebastienlagarde 6 年前
当前提交
d866ace8
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 4
      com.unity.render-pipelines.high-definition/HDRP/Material/NormalBuffer.hlsl

4
com.unity.render-pipelines.high-definition/HDRP/Material/NormalBuffer.hlsl


// RT1 - 8:8:8:8
// Our tangent encoding is based on our normal.
#if defined(SHADER_API_METAL)
#if defined(SHADER_API_METAL) || defined(SHADER_API_VULKAN)
// With octahedral quad packing we get an artifact for reconstructed tangent at the center of this quad. We use rect packing instead to avoid it.
float2 octNormalWS = PackNormalOctRectEncode(normalData.normalWS);
#else

{
float3 packNormalWS = normalBuffer.rgb;
float2 octNormalWS = Unpack888ToFloat2(packNormalWS);
#if defined(SHADER_API_METAL)
#if defined(SHADER_API_METAL) || defined(SHADER_API_VULKAN)
normalData.normalWS = UnpackNormalOctRectEncode(octNormalWS * 2.0 - 1.0);
#else
normalData.normalWS = UnpackNormalOctQuadEncode(octNormalWS * 2.0 - 1.0);

正在加载...
取消
保存