浏览代码

HDRenderPipeline: Remove unused code

/Yibing-Project-2
Sebastien Lagarde 7 年前
当前提交
24756a33
共有 2 个文件被更改,包括 9 次插入12 次删除
  1. 14
      ScriptableRenderPipeline/Core/ShaderLibrary/Refraction.hlsl
  2. 7
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

14
ScriptableRenderPipeline/Core/ShaderLibrary/Refraction.hlsl


struct RefractionModelResult
{
float opticalDepth;
float distance; // length of the transmission during refraction through the shape
float3 positionWS; // out ray position
float3 rayWS; // out ray direction
};

// Second refraction (tangent sphere out)
float NoR1 = dot(normalWS, R1);
// Optical depth within the sphere
float opticalDepth = -NoR1 * thickness;
float distance = -NoR1 * thickness;
float3 P1 = positionWS + R1 * opticalDepth;
float3 P1 = positionWS + R1 * distance;
// Out normal
float3 N1 = normalize(C - P1);
// Out refracted ray

RefractionModelResult result;
result.opticalDepth = opticalDepth;
result.distance = distance;
result.positionWS = P1;
result.rayWS = R2;

float3 R = refract(-V, normalWS, 1.0 / ior);
// Optical depth within the thin plane
float opticalDepth = thickness / dot(R, -normalWS);
float distance = thickness / dot(R, -normalWS);
result.opticalDepth = opticalDepth;
result.positionWS = positionWS + R * opticalDepth;
result.distance = distance;
result.positionWS = positionWS + R * distance;
result.rayWS = -V;
return result;

7
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


// Refraction
float3 transmissionRefractV; // refracted view vector after exiting the shape
float3 transmissionPositionWS; // start of the refracted ray after exiting the shape
float transmissionOpticalDepth; // length of the transmission during refraction through the shape
float3 transmissionTransmittance; // transmittance due to absorption
float transmissionSSMipLevel; // mip level of the screen space gaussian pyramid for rough refraction

};
// This is a refract - TODO: do we call original refract or this one, original maybe slightly emore expensive, to check
// This is a refract - TODO: do we call original refract or this one, original maybe slightly more expensive, to check
float3 ClearCoatTransform(float3 X, float3 N, float ieta)
{
float XdotN = saturate(dot(N, X));

RefractionModelResult refraction = REFRACTION_MODEL(V, posInput, bsdfData);
preLightData.transmissionRefractV = refraction.rayWS;
preLightData.transmissionPositionWS = refraction.positionWS;
preLightData.transmissionOpticalDepth = refraction.opticalDepth;
preLightData.transmissionTransmittance = exp(-bsdfData.absorptionCoefficient * refraction.opticalDepth);
preLightData.transmissionTransmittance = exp(-bsdfData.absorptionCoefficient * refraction.distance);
preLightData.transmissionOpticalDepth = 0;
preLightData.transmissionTransmittance = float3(1.0, 1.0, 1.0);
preLightData.transmissionSSMipLevel = 0;
#endif

正在加载...
取消
保存