Code for Spark's Physically Based Shader?

Hey all, has anyone reverse engineered Spark’s implementation of the physically based shader?

I’m looking into how lighting is done in Spark and I’d like to see how the PBR shader works in particular. The only thing I can find in the docs is the Phong lighting implementation.

The main issue with a custom PBR in spark is that we can’t use actual HDR images. For some reason they have black-boxed that functionality. Other than that, you could probably port some GLSL PBR shader into Spark.

Here’s one that looks pretty good.

I think spark doesn’t supply the binormal so it needs to be calculated.

For reference, here’s Matt Greenhalgh’s PBR patch.

I thought PBR was some kind of spec for rendering, but it turns out that it’s just a loose concept. More info on wikipedia:

1 Like

Thanks a lot, Josh! The shader code example looks like a great example to study. I like that it’s well commented and explains where it might be doing things in an “unconventional” way. Also thanks for linking Matt’s patch asset, I’ll give it a look as well :ok_hand: