浏览代码

Decouple thickness and SSS radius

/Branch_Batching2
Evgenii Golubev 8 年前
当前提交
b6cd7220
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 12
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.hlsl

12
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.hlsl


float3 halfRcpVariance2, float lerpWeight2,
float thickness, float radiusScale)
{
// To be consistent with SSS, we modify the thickness instead of scaling the radius of the profile.
thickness /= radiusScale;
// Thickness and SSS radius are decoupled for artists.
// In theory, we should modify the thickness by the inverse of the radius scale of the profile.
// thickness /= radiusScale;
thickness *= 100;
float t2 = thickness * thickness;

bsdfData.diffuseColor = surfaceData.baseColor;
bsdfData.fresnel0 = 0.028; // TODO take from subsurfaceProfile
bsdfData.subsurfaceRadius = surfaceData.subsurfaceRadius * 0.01;
bsdfData.thickness = surfaceData.thickness * 0.01;
bsdfData.thickness = surfaceData.thickness * (0.01 * 3);
bsdfData.subsurfaceProfile = surfaceData.subsurfaceProfile;
bsdfData.enableTransmittance = (1 << bsdfData.subsurfaceProfile) & _TransmittanceFlags;
if (bsdfData.enableTransmittance)

bsdfData.diffuseColor = baseColor;
bsdfData.fresnel0 = 0.028; // TODO take from subsurfaceProfile
bsdfData.subsurfaceRadius = inGBuffer2.r * 0.01;
bsdfData.thickness = inGBuffer2.g * 0.01;
bsdfData.thickness = inGBuffer2.g * (0.01 * 3);
bsdfData.subsurfaceProfile = inGBuffer2.a * 8.0;
bsdfData.enableTransmittance = (1 << bsdfData.subsurfaceProfile) & _TransmittanceFlags;
if (bsdfData.enableTransmittance)

[branch] if (illuminance > 0.0)
{
BSDF(V, L, positionWS, preLightData, bsdfData, diffuseLighting, specularLighting);
diffuseLighting *= (cookie.rgb * lightData.color) * (illuminance * lightData.diffuseScale);
specularLighting *= (cookie.rgb * lightData.color) * (illuminance * lightData.specularScale);
}

正在加载...
取消
保存