You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
554 B
20 lines
554 B
#ifndef VOLUMETRIC_MATERIAL_UTILS
|
|
#define VOLUMETRIC_MATERIAL_UTILS
|
|
|
|
float VBufferDistanceToSliceIndex(uint sliceIndex)
|
|
{
|
|
float de = _VBufferRcpSliceCount; // Log-encoded distance between slices
|
|
|
|
float e1 = ((float)sliceIndex + 0.5) * de + de;
|
|
return DecodeLogarithmicDepthGeneralized(e1, _VBufferDistanceDecodingParams);
|
|
}
|
|
|
|
float EyeDepthToLinear(float linearDepth, float4 zBufferParam)
|
|
{
|
|
linearDepth = rcp(linearDepth);
|
|
linearDepth -= zBufferParam.w;
|
|
|
|
return linearDepth / zBufferParam.z;
|
|
}
|
|
|
|
#endif // VOLUMETRIC_MATERIAL_UTILS
|