Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 72f42c2

Browse files
committed
Fixed potential fp16 overflow in DOF
1 parent 4e01e2e commit 72f42c2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [2.1.8] - 2019-xx-xx
88

9+
### Fixed
10+
- Potential fp16 overflow in Depth of Field that could cause NaN on some platforms.
11+
912
## [2.1.7] - 2019-06-12
1013

1114
### Added

PostProcessing/Shaders/Builtins/DepthOfField.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ half3 _TaaParams; // Jitter.x, Jitter.y, Blending
2828
half4 FragCoC(VaryingsDefault i) : SV_Target
2929
{
3030
float depth = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoordStereo));
31-
half coc = (depth - _Distance) * _LensCoeff / max(depth, 1e-5);
31+
half coc = (depth - _Distance) * _LensCoeff / max(depth, 1e-4);
3232
return saturate(coc * 0.5 * _RcpMaxCoC + 0.5);
3333
}
3434

@@ -130,7 +130,7 @@ half4 FragPrefilter(VaryingsDefault i) : SV_Target
130130

131131
// Weighted average of the color samples
132132
half3 avg = c0 * w0 + c1 * w1 + c2 * w2 + c3 * w3;
133-
avg /= max(w0 + w1 + w2 + w3, 1e-5);
133+
avg /= max(w0 + w1 + w2 + w3, 1e-4);
134134

135135
// Select the largest CoC value
136136
half coc_min = min(coc0, Min3(coc1, coc2, coc3));

0 commit comments

Comments
 (0)