r/GraphicsProgramming • • 30m ago

Path tracing CAD models in a browser tab: WebGL and WebGPU engines, OIDN denoise, tracing while the camera moves

Post image

ive been building an open source cad app that runs in the browser (https://rodeo.build, code at https://github.com/rodeobuild/rodeo) and the rendering side might be interesting to people here.

the live view is three.js with a gbuffer, ssr and ao pass. path tracing is three-gpu-pathtracer with two engines behind one interface, webgl and webgpu. the bvh gets built in a worker with three-mesh-bvh and the denoise is intels oidn running on webgpu. it keeps tracing while you orbit, does tiled 4k stills, and the same renderer runs on a cloud gpu for bigger ones. the scenes come straight out of cad files (walls, solids, imported revit, sketchup, rhino, ifc) so nobody has cleaned up the meshes first.

stuff i learned the hard way:

webgpu wasnt faster. 256 spp at 1600x1000 takes about 14s on both engines on an m3 max.

4k tiles could reset the gpu and lose the context with no error, which gave me black pngs for a while.

the webgpu tracer builds a bvh per mesh and my render meshes are non indexed, so big meshes just vanished until i kept the index the worker made.

its kernels size a texture array at compile time, so if the texture count grows you have to set the whole scene again.

happy to answer questions. has anyone actually got webgpu path tracing meaningfully ahead of webgl2 in a real scene? disclosure: AI used to build this project

1 Upvotes

1 comment sorted by

•

u/AutoModerator 30m ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.
  • Disclose AI usage in post or project.
  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.