浏览代码

Fix issue with anisotropic highlight

/Yibing-Project-2
sebastienlagarde 7 年前
当前提交
0551bd40
共有 2 个文件被更改,包括 7 次插入3 次删除
  1. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl
  2. 6
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

4
ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl


#define HFLT_MIN 0.00006103515625 // 2^14 it is the same for 10, 11 and 16bit float. ref: https://www.khronos.org/opengl/wiki/Small_Float_Formats
#define SMALL_FLT_VALUE 0.0001
// General constant
float DegToRad(float deg)
{
return deg * PI / 180.0;

6
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


CBUFFER_END
// General constant
#define MIN_N_DOT_V 0.0001 // The minimum value of 'NdotV'
#define MIN_N_DOT_V SMALL_FLT_VALUE // The minimum value of 'NdotV'
//-----------------------------------------------------------------------------
// Helper for cheap screen space raycasting

float NdotL = saturate(dot(bsdfData.normalWS, L)); // Must have the same value without the clamp
float NdotV = preLightData.NdotV; // Get the unaltered (geometric) version
float LdotV = dot(L, V);
float invLenLV = rsqrt(abs(2 * LdotV + 2)); // invLenLV = rcp(length(L + V))
float invLenLV = rsqrt(max(2 * LdotV + 2, SMALL_FLT_VALUE); // invLenLV = rcp(length(L + V)) - caution about the case where V and L are opposite, it can happen, use max to avoid this
float NdotH = saturate((NdotL + NdotV) * invLenLV);
float LdotH = saturate(invLenLV * LdotV + invLenLV);

// TODO: Do comparison between this correct version and the one from isotropic and see if there is any visual difference
DV = DV_SmithJointGGXAniso(TdotH, BdotH, NdotH,
preLightData.TdotV, preLightData.BdotV, preLightData.NdotV,
preLightData.TdotV, preLightData.BdotV, NdotV,
TdotL, BdotL, NdotL,
bsdfData.roughnessT, bsdfData.roughnessB
#ifdef LIT_USE_BSDF_PRE_LAMBDAV

正在加载...
取消
保存