r/GraphicsProgramming • • 3d ago

[ Removed by moderator ]

/r/GraphicsProgramming/comments/1y54yqf/removed_by_moderator/

[removed] — view removed post

15 Upvotes

13 comments sorted by

•

u/GraphicsProgramming-ModTeam 3d ago

The post lacked an AI disclosure and was removed.

If you later correct this or believe this was in error, please contact the mod team.

6

u/VictoryMotel 3d ago

Amazing that you were able to do all this by not touching github for 6 months, then committing everything two days ago.

2

u/dariopagliaricci 3d ago

The public repo only shows part of the picture. I develop the renderer in a private repository, and the public one only receives release snapshots.

When a version is ready, I clean it up, remove private notes, scripts and work-in-progress material, and push it as a release. That's why the public history looks like a long silence followed by a big commit.

The actual work between v3.0.0 and v4.0.0 happened over those six months, with a lot of small commits, dead ends and validation runs in the private repo. The CHANGELOG gives a good sense of that work, since every fix lists the scene or test it was measured on.

I can see why the public history looks odd from the outside, though. Thanks for taking a look at the project.

1

u/VictoryMotel 2d ago

Interesting that you have embree integrated but embree isn't there.

1

u/dariopagliaricci 2d ago

Embree is a separately backend. You have to build it using CMake, and you can render scenes using different commands in the terminal.. I’d recommend take a closer look at the project. At least the README part. Many thanks.

1

u/VictoryMotel 2d ago

I took a pretty close look and I've used embree before. Embree/rtcore.h is included but not there. Thanks.

1

u/dariopagliaricci 2d ago edited 2d ago

Thanks for looking so closely. You're right that rtcore.h isn't in the repo. That's intentional:

Embree is an optional external dependency, not a vendored one, so the header comes from your Embree installation.

The include is <embree4/rtcore.h> (Embree 4) and it sits behind #if defined(PATH_TRACER_ENABLE_EMBREE). That macro is only defined when you configure with -DPATH_TRACER_ENABLE_EMBREE=ON, which is off by default. With the option on, CMake runs find_package(embree 4.4 REQUIRED CONFIG) and links it, so a missing install fails at configure time. The default Metal build doesn't need Embree at all.

To build the Embree backend:

brew install embree
cmake -S . -B build-embree -DCMAKE_BUILD_TYPE=Release -DPATH_TRACER_ENABLE_EMBREE=ON
cmake --build build-embree --target PathTracerHeadless EmbreeSmokeTest

If you hit a build error with these steps, I'd really like to see it, so please open an issue with the output.

TL;DR

  • The include is actually #include <embree4/rtcore.h> (Embree 4), not embree/rtcore.h. It appears in two files: src/headless/EmbreeHeadlessRenderer.mm and src/headless/EmbreeSmokeTest.cpp.
  • Embree is an external dependency and is not vendored in the repo, the same way people normally use it. The Embree header and library come from an Embree installation, for example brew install embree.
  • In EmbreeHeadlessRenderer.mm, the include (and the TBB includes) sit inside #if defined(PATH_TRACER_ENABLE_EMBREE). The Embree code is also wrapped by the same guard.
  • The CMake option PATH_TRACER_ENABLE_EMBREE is OFF by default. Only when it is ON does CMake define that macro, look for Embree 4.4 with find_package(embree 4.4 REQUIRED CONFIG), and link it. EmbreeSmokeTest.cpp is only built when the option is ON.
  • So a default build never reaches that include, and an Embree build stops at configure time with a clear error if Embree isn't installed. The README lists Embree 4.4 as optional and shows the Embree build steps.

1

u/JBikker 3d ago

You may want to update TinyBVH, you're using an ancient version. :) Are you using this on GPU and CPU, or just CPU?

1

u/dariopagliaricci 3d ago

Thanks, and thanks for TinyBVH! You're right, the vendored copy is 1.6.7, so it's well behind.

To answer your question: it's both, in a way. TinyBVH builds the BVH on the CPU (a plain binary BVH with Build(), one BLAS per mesh). I then copy the nodes and primitive indices into my own buffers and traverse them in my own Metal compute kernels on the GPU. That BVH powers the software ray tracing path, which I use as a fallback and for parity checks against Metal's hardware ray tracing. The hardware path uses Metal's own acceleration structures, and the Embree backend uses Embree's.

I don't use any of TinyBVH's GPU layouts yet. If you have a recommendation for which layout would suit Apple GPUs best, I'd love to hear it.
Many thanks for checking out the project

2

u/JBikker 3d ago

Yours is a great project, lovely pictures!

For Apple GPUs so far the basic layout appears to work best, so I don't think there is much to improve there. You can however feed it a better BVH: Consider building with BuildHQ, and run Optimize on the built BVH for a nice bonus. BuildHQ applies spatial splits (~+25%) and Optimize reorders nodes to improve cost (~+15%). This is independent of the final layout.

You could also consider tracing rays on the CPU e.g. for devices with low VRAM; in a path tracer shading is the bulk of the work anyway. A BVH4_CPU is very fast, especially on a many-core CPU.

1

u/dariopagliaricci 3d ago

Thank you, that means a lot coming from you!

Good to know the basic layout is the right choice on Apple GPUs, since that's what my Metal kernels already traverse. I'll update to 1.9.2 and switch the BLAS builds to BuildHQ plus Optimize. I noticed that with spatial splits the index count can exceed the triangle count, so I'll fix the places where I currently copy exactly triCount indices before trying it. My parity tests against hardware ray tracing should show if I miss anything.

CPU tracing is an interesting idea for my case too. Since memory is shared on Apple Silicon, Metal caps the GPU working set below total memory, and that cap is exactly what limits my largest scenes. I already have an Embree backend for reference renders, so comparing it against BVH4_CPU on the M-series cores would be a fun experiment.

Thanks again for the library and the advice!

1

u/AutoModerator 3d 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.