Comments (4)
Hi @RealTecWare
Thank you for the error report and thanks for the link to Call Stack Size calculator - that is helpful! I was searching for something like that on the internet, but only got StackOverflow help/answers as results. I somehow missed your link!
Now about the errors, I recently found that the recursive BVH builder is finicky when it comes to object dimensions. If the scaling of the object is not within a certain range with respect to the overall scene dimensions, the recursive builder will go on and on, never correctly splitting the current triangles in the current workList into 2 groups, left and right, and thus never successfully spawning 2 smaller child bounding boxes from the parent bounding box.
I did try to mitigate this with trial and error, which is why I have the exact 'model settings' that you can comment and uncomment for the appropriate model you are trying to load. I'm curious, did the Buddha model crash on your machine, using my tested dimensions settings for that Buddha model?
I am actively looking for a way to make the builder more robust to these different scaling situations. As I mentioned before on another thread in this repo, this builder is the most complex 300-or so lines of code I have ever attempted using and maintaining in a project. For months I had to go line by line, trying to understand it fully. I understand most of it, but the line 'step = (stop-start)/24' grid sizing that keeps going down as the builder steps through the levels of hierarchy I still don't fully grasp. ;-) This is where things go wrong and the recursive builder just keeps spinning its wheels until it exceeds the call stack size. Different numbers substituted for the '24' in that above equation crash certain models and scales, and perform fine on others - it's hit or miss.
Thanks again, I'll update if I make any progress.
-Erich
from three.js-pathtracing-renderer.
I try to mitigate this with trial and error, which is why I have the exact 'model settings' that you can comment and uncomment for the appropriate model you are trying to load. I'm curious, did the Buddha model crash on your machine, using my tested dimensions settings for that Buddha model?
Hy Erich,
I tested it with your information and set the model settings and with the necessary scaling of the model it works very nice, so I think the my issue is fixed by this.
Hope the callstack snippet helps you :)
Thanks for your fast answer 👍
-Fabian
from three.js-pathtracing-renderer.
@RealTecWare ,
Glad to hear you got it working! Yes if the model dimensions are not within a certain window, the recursive builder spins its wheels until it crashes. I'm still trying to determine the boundary condition where it succeeds up to that boundary, and beyond which it fails. Hopefully in the future I can make the builder less fragile and less prone to this kind of catastrophic error.
I'm also about to dive into writing a LBVH which uses Morton codes and bit manipulations inside the fragment shader (now available with WebGL 2.0 support from three.js). Instead of recursively building on the CPU beforehand, it basically builds and re-builds the entire acceleration structure from scratch every animation frame on a GPU texture, so you can have arbitrary morphing and animating triangle geometry, as in real-time games. That builder will be even more complex than the current one (ha), but I'll at least give it a try.
Thanks again!
-Erich
from three.js-pathtracing-renderer.
@RealTecWare
Hi Fabian,
Just wanted to give you a progress update on the BVH builder. I removed the recursive builder that was crashing, and in its place a created an iterative version. When I was new to BVH builders, the recursive one was more intuitive code-wise but was prone to crashing as you saw. With the iterative version, I had to create and maintain a stack and stack pointer, then the builder goes down left branches (stackptr ++) and then back up the right branches (stackptr --). It took a lot of trial and error to make it behave correctly, but now it is much more robust! You should have no problem rotating, translating, or scaling a model upon loading it with the objLoader provided by the three.js library - the builder should just do its thing and work now. :)
When I see that you have read this, I might close out this issue if that's ok with you - the recursive builder has been removed.
Take care,
-Erich
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.