浏览代码

Revert "Attempt to add shadowing for regular transmission"

This reverts commit 4b39d5e2917acc42307530bf9b82abe6408f0402.
/Branch_Batching2
Evgenii Golubev 8 年前
当前提交
2455e20c
共有 1 个文件被更改,包括 7 次插入30 次删除
  1. 37
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

37
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


#define LTC_LUT_SCALE ((LTC_LUT_SIZE - 1) * rcp(LTC_LUT_SIZE))
#define LTC_LUT_OFFSET (0.5 * rcp(LTC_LUT_SIZE))
#define MIN_N_DOT_V 0.0001 // The minimum value of 'NdotV'
#define MILLIMETERS_TO_METERS 0.001
#define MIN_N_DOT_V 0.0001 // The minimum value of 'NdotV'
uint _EnableSSS; // Globally toggles subsurface scattering on/off
uint _TexturingModeFlags; // 1 bit/profile; 0 = PreAndPostScatter, 1 = PostScatter

// float RdotL = NdotL - 2 * preLightData.NdotV * LdotV;
float illuminance = saturate(-LdotV);
// For thin objects, we can reuse the shadowing status for the back of the object.
[branch] if (!bsdfData.useThinObjectMode)
{
// TODO: precompute?
float d = bsdfData.thickness * (2 * MILLIMETERS_TO_METERS);
float3 P = positionWS - d * V;
shadow = GetDirectionalShadowAttenuation(lightLoopContext.shadowContext, P, bsdfData.normalWS, lightData.shadowIndex, L, posInput.unPositionSS);
}
// For low thickness, we can reuse the shadowing status for the back of the object.
shadow = bsdfData.useThinObjectMode ? shadow : 1;
illuminance *= shadow * cookie.a;
// The difference between the Disney Diffuse and the Lambertian BRDF for transmission is negligible.

// float RdotL = NdotL - 2 * preLightData.NdotV * LdotV;
float illuminance = saturate(-LdotV * attenuation);
// For thin objects, we can reuse the shadowing status for the back of the object.
[branch] if (!bsdfData.useThinObjectMode)
{
// TODO: precompute?
float d = bsdfData.thickness * (2 * MILLIMETERS_TO_METERS);
float3 P = positionWS - d * V;
float3 offset = float3(0.0, 0.0, 0.0); // GetShadowPosOffset(nDotL, normal);
shadow = GetPunctualShadowAttenuation(lightLoopContext.shadowContext, P + offset, bsdfData.normalWS, lightData.shadowIndex, L, posInput.unPositionSS);
}
// For low thickness, we can reuse the shadowing status for the back of the object.
shadow = bsdfData.useThinObjectMode ? shadow : 1;
illuminance *= shadow * cookie.a;
// The difference between the Disney Diffuse and the Lambertian BRDF for transmission is negligible.

// float RdotL = NdotL - 2 * preLightData.NdotV * LdotV;
float illuminance = saturate(-LdotV * clipFactor);
// For thin objects, we can reuse the shadowing status for the back of the object.
[branch] if (!bsdfData.useThinObjectMode)
{
// TODO: precompute?
float d = bsdfData.thickness * (2 * MILLIMETERS_TO_METERS);
float3 P = positionWS - d * V;
shadow = GetDirectionalShadowAttenuation(lightLoopContext.shadowContext, P, bsdfData.normalWS, lightData.shadowIndex, L, posInput.unPositionSS);
}
// For low thickness, we can reuse the shadowing status for the back of the object.
shadow = bsdfData.useThinObjectMode ? shadow : 1;
illuminance *= shadow * cookie.a;
// The difference between the Disney Diffuse and the Lambertian BRDF for transmission is negligible.

正在加载...
取消
保存