bonsai-rx / bonsai

The compiler, IDE, and standard library for the Bonsai visual programming language for reactive systems
https://bonsai-rx.org
MIT License
131 stars 29 forks source link

Name a first-class scene format (glTF or USD) and adopt physically based rendering #1779

Open PathogenDavid opened 2 months ago

PathogenDavid commented 2 months ago

Discussed at the end of dev club today. We started with talking about updating Assimp.NET (or replacing it with our own) for our scene loading infrastructure. I suggested it might be better to name one preferred format that Bonsai declared first-class support for (as opposed to partial support for several older formats as we do today.)

Within the games industry there is wide support for glTF and growing support for USD. I personally have a lot of experience with glTF and have been very happy with it, I've been looking for an excuse to learn more about USD.

I'm creating this issue both to ramble out my thoughts and to track this potential effort.

Physically based rendering (PBR)

Defining physically based rendering (PBR) up front (this might seem unrelated but it falls out naturally from supporting either of these):

A downside of PBR is that it's more computationally heavy to render. It's not a problem for desktop-class GPUs but can be for mobile-class GPUs. I think if this becomes a problem we can just offer a simplified rendering toggle somewhere.

glTF

USD

What Bonsai supports today

Right now Bonsai only supports Wavefront Objects (.obj) for meshes.

To contrast with the above, it supports the following for scenes:

Conclusions?

My gut says that glTF is probably the best fit for Bonsai's needs. USD is more powerful, but a lot of what makes it attractive in the AAA games space doesn't feel relevant to Bonsai users. (That being said, I'd greatly welcome the opportunity to mess with USD 😁)

A big benefit of glTF is that the spec is fairly simple, you can implement a parser for it in a weekend. (As I mentioned in DCM I've created 2 parsers and 3 different renderers with varying levels of conformance for it in the past.)

In my opinion COLLADA/FBX/OBJ/STL should all just be deprecated and we should put our energy into a single format instead. (I don't think we need to remove them, but if we ever add more complex scene manipulation stuff like moving objects around we shouldn't make any effort to support those features with them.)

Blender support should be migrated towards transparent export to either glTF or USD.

PBR isn't truly necessary for Bonsai, but I think the way you can get nice results from PBR with relatively little effort is pretty compelling. It's a natural fit for glTF in particular and as mentioned earlier Poly Haven provides a lot of great public domain PBR assets people could use for their scenes. (I focused on the materials above but they offer models too.) I think it'd be nice for people to get similar results out of Blender and Bonsai as well.

PathogenDavid commented 2 months ago

Also just in case it wasn't clear: You don't need to support PBR to use glTF, it's only required for a conformant renderer. (2 of the 3 renderers I mentioned weren't conformant in that regard since they were for a project that didn't use PBR.)

We can start with glTF w/o PBR if that's deemed necessary or desirable.