Skip to content

Commit 1ec971e

Browse files
checked that normalizedV and normalizedN make sense...
the failure comes from `nbl_glsl_MC_runGenerateAndRemainderStream` @Crisspl advise?
1 parent 0704cd5 commit 1ec971e

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

examples_tests/22.RaytracedAO/dirty_source/ExtraCrap.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,9 +1018,31 @@ void Renderer::render(nbl::ITimer* timer)
10181018
camera->render();
10191019

10201020
const auto currentViewProj = camera->getConcatenatedMatrix();
1021+
auto properEquals = [](const auto& rhs, const auto& lhs) -> bool
1022+
{
1023+
const float rotationTolerance = 1.001f;
1024+
const float positionTolerance = 1.005f;
1025+
const float projectionTolerance = 1.0005f;
1026+
const core::matrix4SIMD tolerance(
1027+
rotationTolerance,rotationTolerance,rotationTolerance,positionTolerance,
1028+
rotationTolerance,rotationTolerance,rotationTolerance,positionTolerance,
1029+
rotationTolerance,rotationTolerance,rotationTolerance,positionTolerance,
1030+
projectionTolerance,projectionTolerance,projectionTolerance,projectionTolerance
1031+
);
1032+
for (auto r=0; r<4u; r++)
1033+
for (auto c=0; c<4u; c++)
1034+
{
1035+
const float ratio = core::abs(rhs.rows[r][c]/lhs.rows[r][c]);
1036+
// TODO: do by ULP
1037+
if (core::isnan(ratio) || core::isinf(ratio))
1038+
continue;
1039+
if (ratio>tolerance.rows[r][c] || ratio*tolerance.rows[r][c]<1.f)
1040+
return false;
1041+
}
1042+
return true;
1043+
};
10211044
// TODO: instead of rasterizing vis-buffer only once, subpixel jitter it to obtain AA
1022-
const auto thresh = core::ROUNDING_ERROR<core::matrix4SIMD>()*128.f;
1023-
if (!core::equals(prevViewProj,currentViewProj,thresh))
1045+
if (!properEquals(prevViewProj,currentViewProj))
10241046
{
10251047
m_raytraceCommonData.framesDispatched = 0u;
10261048

examples_tests/22.RaytracedAO/raygen.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void main()
218218
const uint realOutputID = outputID+i;
219219
if (validRay)
220220
{
221-
const float err = 1.0/64.0;
221+
const float err = 1.0/256.0; // TODO: improve ray offsets
222222
rays[realOutputID].origin = worldPosition+direction*err;
223223
rays[realOutputID].maxT = max(maxT-err,0.0);
224224
rays[realOutputID].direction = direction;

0 commit comments

Comments
 (0)