Comments (3)
@dafhi
Hi again, I was able to mitigate the problem by decreasing the amount of the "nudge" that I give to each newly spawned ray origin along the path. EPS_Intersect was previously set at 0.1 units times the normalized surface normal vector, nl. For instance, r.origin += nl * EPS_Intersect. Which essentially pushed the new ray's origin out along the surface normal the distance of 0.1 units. I changed the precision to be higher on desktop (not much I can do about mobile at the moment with how most cell phones' chips are manufactured in 2019, so it remains at a whopping 1.0 units). Now EPS_Intersect is 0.01 on desktop so the ray origins get nudged just 0.01 units along the surface normal.
The old artifact of the bright white line around the red cylinder where it meets the ground is all but gone now. It is ever so slightly still there, but you would have to be looking for it. Depending on your machine, you can try more precision, say 0.001 but on my humble machines, when I asked for too much precision, black spots started to appear on diffuse and coated surfaces like the checkered ground and white capsule, due to incorrect self intersection of newly spawned rays with the surfaces they had just intersected before.
You can give it a try: Geometry showcase demo
I am in the process of applying the most precision I can to some of the other demos (like the CSG museum demos) in order to guard against similar artifacts. Thanks for bringing this issue to my attention, I had just kind of forgotten about it, but now I think I ended up finding a good balance between artifacts and machine precision.
from three.js-pathtracing-renderer.
@dafhi
Hello, yes this artifact popped up back when I combined the refracted (transmitted) ray's contribution to the reflected ray's contribution, in order to capture a realistic double image (like when you look through a window at an angle) that is smooth and real time without any grainy noise as you move the camera around. The old way of doing things was to randomly pick a transmitted or reflected ray each time the camera ray hit a refractive object. Although this eventually gives the right answer for progressive rendering (over many frames) according to Monte Carlo integration, it resulted in objectionable noise of the double image on all refractive objects such as glass, water, clear plastic, etc. if the camera was moving or, for instance, water waves were moving up and down.
The issue that you refer to stems from each new ray's origin point and the lack of machine precision. When the initial ray hits the refractive surface, I have to nudge the transmitted ray forward or through the surface a little so it doesn't self intersect, and likewise I must nudge the reflected ray backwards or out of the surface also to avoid self intersection. If you take away the nudge by commenting out the line: ' firstRay.origin += nl * EPS_Intersect ', the artifacts disappear - however if you now fly the camera above the glass coffee table, the reflected image of the large light spheres in the glass of the table now has many artifacts! Again due to lack of machine precision. Frustrating to say the least.
I am currently investigating this problem - I'll let you know if I can resolve it somehow. I think it was always there, but it used to be conveniently masked by the noise of the random ray choice for refraction or reflection. The artifact can no longer hide behind that noise, because it is a solid (and physically correct) double image now. :)
Thanks!
from three.js-pathtracing-renderer.
huge improvement!
i'll consider the issue closed but let you decide. there may be a possibility of reformulation to make float precision a non-issue. beyond me atm :)
from three.js-pathtracing-renderer.
Related Issues (20)
- muti material not supported
- WebGPU port HOT 3
- More abstractions HOT 9
- Using more information from earlier samples HOT 3
- More samples per frame option HOT 63
- More compatibility with three js APIs HOT 2
- Stop a caustic ray if it crosses a surface HOT 3
- Just wondering how you handled something HOT 14
- Blue noise HOT 8
- GLTF viewer textures HOT 3
- sampler2D array HOT 14
- How to use this pathtracer in Freeciv 3D version? HOT 2
- [question] how to debug glsl in chrome? HOT 2
- GLTF_Model_Viewer didn't get the right result? HOT 6
- How to incorporate it into project? HOT 9
- statistical tool: bootstrapping
- Shadow Catcher HOT 1
- Support for a THREE.ParametricGeometry HOT 1
- GLTF_Viewer is not able to load textures HOT 1
- image stretched for BHV point light source HOT 2
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 three.js-pathtracing-renderer.