Comments (3)
Hi @zhaishengfu
Sorry for the late reply - I was on vacation. :)
The main reason I use WebGL 2.0 (which is based on OpenGL ES 3.0) rather than pure OpenGL under Windows is the ease of cross-platform portability. Basically any device that has a capable modern browser (which is pretty much everything these days) can run my code. I develop the demos on my Windows laptop but as soon as I release it, people with Windows desktop, Mac, Linux, tablets, smartphones, etc. can experience the demos as long as they can use a browser, and that browser can be Chrome, Firefox, or Edge at that.
Pure OpenGL might be a little faster like you said, but since my code mainly uses shaders that get compiled down to GPU machine code, I think the trade-off for portability and "write once, run everywhere" is worth it in the end.
Thanks! :-)
from three.js-pathtracing-renderer.
Oh, enjoy your vacation. I got your reason. I have seen some one says using compute shader to inplement ray tracing, do you think it is better?
from three.js-pathtracing-renderer.
Hi again, :)
Yes it is probably a little more efficient to do the tight raytracing loop with a compute shader. If I'm not mistaken I think that is how you must access NVidia's raytracing hardware on their RTX cards - through compute shaders. My project does the more traditional full-screen quad trick and uses a vertex and fragment shader. The vertex shader is only a couple of lines of code because it only needs to draw 2 big triangles that form a quad that stretches across the entire viewport. Then all the work is done with the pixel (or fragment) shader that operates on all the pixels that are covered by those 2 triangles, which ends up being every single pixel of your full screen.
To see how to make a raytracer with compute shaders where you are essentially talking to the individual GPU cores and setting up each individual thread with its own ID, take a look at Sam Lapere's GitHub projects . He shows how to do it with CUDA as well as OpenCL/OpenGL on Windows.
I don't know if the tight raytracing loop runs any faster on the compute setup vs. the vertex/fragment shader full screen quad approach, but I will say this - WebGL, since it runs on browsers that may or may not be running on mobile devices, is capped at 60 fps. That is the best you can hope for in collecting many samples per second to get rid of initial noise. But with compute, like NVidia RTX, OpenCL, and CUDA, you don't have that cap, and it is possible to run at 140 fps or 200 fps, thereby collecting many more samples per second. However this assumes a simple geometry scene setup. If you're trying to run a detailed level from a AAA game with millions of triangles, it will probably do no better than 60 fps at this moment in GPU raytracing (summer 2019). As GPUs get more powerful in the future, I can envision doing any geometry no matter how complex at 120 fps - enough to do real-time VR path tracing with minimal noise and enough fps to make it a comfortable experience.
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.