Comments (10)
Thanks a lot @syoyo ! It worked!
$ ./bug.exe 1
This program exposes a possible accuracy bug with nanort.
A slight variation on direction[0] makes nanort misses a real intersection.
Called without argument, we run a normal case where a ray creates an intersection on a single triangle
Called with one argument, we slightty changes the direction and have a no intersection result, that is not normal
directions[0] = -5.30288e-017
We have the expected result
Intersection isect.u =0.68 v = 0.131201
from nanort.
At least I can reproduce an issue. I will investigate!
from nanort.
Thanks for your time. I have reproduced it on:
- Windows with g++ and MSVC.
- MacOSX with g++/clang
It seems also that if we replace double with float, bug also appears (but make no sense since below float precision)
I am not an expert with template class, but I have weird to have 1.0f constant in functions/methods where we use double template. Maybe a lead to follow...
Again thanks for your time
from nanort.
There was an unexpected offset value added to ray direction : 7490e9b#diff-6ae3ef545df31bcbb8d6f3814304e805L2029 and this was the source of the issue.
And also removed some float
precision constant value.
Now fixed and I got expected result(your test code is added to test/regression/possible-accuracy-problem-30
from nanort.
Wow, that was fast... I suspected it right, but had no clue that we should use static_cast to fix the problem. Thanks a lot!
from nanort.
Yeah! Recent compiler shoud generate immediate value for static_cast(CONSTANT_VALUE) at compile time optimization so no performance slowdown! > we should use static_cast
from nanort.
I have changed to use template specialization for IntersectRayAABB
206543c#diff-6ae3ef545df31bcbb8d6f3814304e805R1900 This will give more precise intersection result for double
type
from nanort.
Hello @syoyo , I have tried to run the regression test I have proposed with g++8 and clang++ on the latest version. I thought it was solved, but the bug reappeared. Could you please try yourself?
$ make -f Makefile.dev
clang++ -I../../../ -std=c++11 -fsanitize=address -g -O0 -o bug main.cc
$ ./bug
This program exposes a possible accuracy bug with nanort.
A slight variation on direction[0] makes nanort misses a real intersection.
Called without argument, we run a normal case where a ray creates an intersection on a single triangle
Called with one argument, we slightty changes the direction and have a no intersection result, that is not normal
directions[0] = 0
We have the expected result
Intersection isect.u =0.68 v = 0.131201
$ ./bug 1
This program exposes a possible accuracy bug with nanort.
A slight variation on direction[0] makes nanort misses a real intersection.
Called without argument, we run a normal case where a ray creates an intersection on a single triangle
Called with one argument, we slightty changes the direction and have a no intersection result, that is not normal
directions[0] = -5.30288e-17
No intersection detected
We get the wrong result
from nanort.
I can reproduce bug 1
.
After brief investigation, ray-AABB test fails for very small value(around or less than double precision epsilon which is 2.2e-16). I think ray-AABB test is not robust or fails for denormal number. I need more investigation.
from nanort.
Oh, its my fault. Simply I forgot to add sign when returning inf
in vsafe_inverse()
. Now fixed in this commit: 61309ec
and regression test should pass.
from nanort.
Related Issues (20)
- RayTracer with Color HOT 1
- Questions about differences between paper + NanoRT for ray-triangle intersection HOT 1
- Real time raycaster? HOT 2
- Performance descriptions or wiki elaboration HOT 5
- Documentation Return type of Traverse HOT 2
- Wrapping max() in parenthesis for windows error HOT 2
- Potential issue in examples/common/imgui/imgui_widgets.cpp: Arithmetic Overflow in Expression HOT 1
- Potential issue in examples/common/imgui/imgui.cpp: Unchecked return from initialization function
- Potential issue in examples/common/imgui/imgui_widgets.cpp: Unchecked return from initialization function
- [feature] Point query: Find nearest hit surface for a given point
- Want to use nanort in GPU HOT 1
- MultiHitTraverse HOT 4
- What is faces : The array of triangle face indices (3 * numFaces) HOT 3
- [Question] how to update the BVH tree fast with small modification to primitives? HOT 1
- cant use any function from imgui
- [TODO] Deprecate OpenMP
- [TODO] Deprecate C++03
- [TODO] SIMD, BF16/FP16, INT8 optimization HOT 1
- nanosg. how to remove white rounded border? HOT 7
- Please support MSYS2 MINGW64 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nanort.