Three-gpu-pathtracer: A modular shader-based path tracing extension for three.js!

Can you make an issue with any console errors? Does the simpler MaterialBall demo all crash the page?

I don’t have access to a Windows machine at the moment but I hopefully will again soon. This might be a device issue and something to make a Chrome bugzilla report about, as well.

I tried Basic Path Tracing Example in chromium on my low-end windows laptop and it does not crash but kind of freezes the whole thing, e g network tab stops updating and I cannot switch to the console, and the browser does not respond to resize, but I can close it.

Just like @makc3d, it just freezes at first. After a couple of seconds, the screen (not just the browser) goes blank for a split second, then the page is white with an X in the top-left. Console simply starts with WebGL context lost. There is nothing else in particular related to any of the code.

I’ll see if I can reproduce and find any errors.

edit: @gkjohnson I’ve created an issue here with console warnings and a screenshot. I’ve tried 3 examples, all give the exact same result. The mars rover does render a single frame, after which it crashes. The rest just stays black / loading and crashes with the same errors.

@makc3d @Harold

Thanks guys.There is an up front cost to loading the model, building the BVH, and then compiling the (fairly complex) shader. I’ve noticed that the shader compilation can take a particularly long time on windows machines and at some point I’d like to see if that can come down by either adding some more conditional #define logic or simplifying the code a bit more.

Adding support for the KHR_parallel_shader_compile to three.js would hopefully improve the blocking time on shader compilation so that browser doesn’t lock up. But that hasn’t had any progress in years it looks like…

The mars rover does render a single frame, after which it crashes.

Sounds like the first rasterized view of the rover gets rendered and then the browser / driver fails to compile the shader.

1 Like

Happy new year everyone! And happy new v0.0.9 release! This version adds support for material flat-shading, improved ray direction sampling using own-scrambled sobol-sampling to help improve resolve time for images with fewer samples, and support for direction and points lights! Of course some bug fixes are in there, as well.

There are still some issues with iphones and some windows GPUs which I may need some help with at some point.

Release notes for v0.0.9 here!

Owen scrambled sobol sampling comparison before/after
top row: 32 spp
bot row: 100 spp

Flat shading

6 Likes

Still working on some new improvements but I was really happy with how these lego model renders turned out with the translucent pieces being rendered with MeshPhysicalMaterial volume transmission - which looks great.

And here’s the 2002 UCS Star Destroyer model rendered - which has over 3,000 lego pieces and over 4 million triangles. Probably the most complicated piece of geometry rendered, yet!

9 Likes

Version 0.0.13 is finally released! This revision brings a number of fidelity fixes for sheen, iridescence, and transmission in addition to some new features like early ray termination which can help with performance when using a lot of bounces and support for quilt rendering which can be used to render images for holographic displays like the Looking Glass Portrait.

Release notes for v0.0.13 here !

Quilt rendering for the Looking Glass

Live Demo Here

Improved sheen support

Improved iridescence support

6 Likes

That is a really great project.

Unfortunately, I have had issues with the project when running it on my Macbook.

When I open any of the examples in Chrome, it will only show the first picture and then freeze.
Additionally, it crashes in Safari.

This is quite concerning and I am hoping there is a way to fix it.

Unfortunately, I have had issues with the project when running it on my Macbook.

When I open any of the examples in Chrome, it will only show the first picture and then freeze.
Additionally, it crashes in Safari.

Without more information there’s not much to say. Feel free to make an issue in the project with hardware details and any logged console errors but make sure Safari and Chrome are running on the latest release. There have been a couple browser issues fixed that affect the project. There are also some driver and hardware as well as shader transpilation quirks on browsers like Chrome that can’t be addressed by the project that I’m hoping can be fixed at some point.

Just released v0.0.14 with the big improvement being the addition of volumetric fog materials! As should be expected the use of fog can have a big impact on performance since it causes a lot more ray scattering.

Release notes here.

Fog Demo

Environment with Fog

13 Likes

any way to hide the area light box in the rendering result?

any way to hide the area light box in the rendering result?

The next release will hide the area light surfaces which is what happens in three.js.

when that will be any approximate timeline?

great work

I’ve just released v0.0.17 of three-gpu-pathtracer! This version primarily includes shader fixes that were causing compilation crashes on Android and MacOS.

The other two main changes are that meshes with negative scales will now render correctly and area light surfaces will no longer render to match three.js behavior.

v0.0.17 changelog is here.

Invisible Area Light Surface

5 Likes


possible regression?

2 Likes

Thanks! Turns it out it was an incorrect adjustment to the models geometry in the example page. It’s been fixed now!

6 Likes

Version 0.0.20 is out! This version centers around some general path tracer improvements but one big visual difference is the addition of blue noise-scrambled stratified sampling! This makes the image resolve a lot more quickly and results in a smoother image.

Additionally the pathtracer has been added to the three.js editor under the “realistic” render option! The latest pathtracer will be available in the next release of the three.js editor r162. There are still improvements to be made but it’s a cool start.

Stratified Sampling @ 10 Samples Per Pixel

Before / After

Before / After

Three.js Editor Integration

7 Likes

Completely amazing, as usual.
I rushed over to the Editor, but I see it’s not included as standard, yet :slight_smile:

CORRECTION, it’s there. “REALISTIC” rendering. Great stuff

Keep it up!