浏览代码

Reformatting

/stochastic_alpha_test
Frédéric Vauchelles 7 年前
当前提交
de4f8bc3
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 12
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/CopyChannel.compute

12
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


float distFromP = depth - posInput.depthVS;
float VoR = dot(-V, R);
refractedBackPointWS = posInput.positionWS + R*distFromP / VoR;
refractedBackPointWS = posInput.positionWS + R * distFromP / VoR;
opticalDepth = bsdfData.thickness;
#elif defined(_REFRACTION_THICKSPHERE)

// Refracted ray
float3 R1 = refract(-V, bsdfData.normalWS, 1.0 / bsdfData.ior);
// Center of the tangent sphere
float3 C = posInput.positionWS - bsdfData.normalWS*bsdfData.thickness*0.5;
float3 C = posInput.positionWS - bsdfData.normalWS * bsdfData.thickness * 0.5;
opticalDepth = -NoR1*bsdfData.thickness;
opticalDepth = -NoR1 * bsdfData.thickness;
float3 P1 = posInput.positionWS + R1*opticalDepth;
float3 P1 = posInput.positionWS + R1 * opticalDepth;
// Out normal
float3 N1 = normalize(C - P1);
// Out refracted ray

// Refracted source point
refractedBackPointWS = P1 - R2*(depthFromPosition - NoR1*VoR1*bsdfData.thickness) / N1oR2;
refractedBackPointWS = P1 - R2 * (depthFromPosition - NoR1 * VoR1 * bsdfData.thickness) / N1oR2;
#elif defined(_REFRACTION_THINPLANE)
/*

// The refracted ray exiting the thin plane is the same as the incident ray (parallel interfaces and same ior)
float VoR = dot(-V, R);
float VoN = dot(V, bsdfData.normalWS);
refractedBackPointWS = posInput.positionWS + R*opticalDepth - V*(distFromP - VoR*opticalDepth);
refractedBackPointWS = posInput.positionWS + R * opticalDepth - V * (distFromP - VoR * opticalDepth);
#endif
// Calculate screen space coordinates of refracted point in back plane

2
ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/CopyChannel.compute


#define KERNEL_SAMPLECOPY(sourceN, resultN, subscript) [numthreads(8, 8, 1)]\
void KSampleCopy##sourceN##_##resultN##_##subscript(uint2 dispatchThreadId : SV_DispatchThreadID)\
{\
RESULT(resultN)[dispatchThreadId] = SOURCE(sourceN).SampleLevel(sampler_LinearClamp, float2(dispatchThreadId)*_Size.zw, 0.0).subscript;\
RESULT(resultN)[dispatchThreadId] = SOURCE(sourceN).SampleLevel(sampler_LinearClamp, float2(dispatchThreadId) * _Size.zw, 0.0).subscript;\
}
// Source R

正在加载...
取消
保存