# \[SimplePBR\] Physically based rendering library

**URL:** <https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077>\
**Category:** Libraries\
**Created:** [August 6, 2020, 11:53am UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077 "2020-08-06T11:53:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kosowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kosowski/32/550_2.png) [@kosowski](https://discourse.processing.org/u/kosowski)\
**Post date:** [August 6, 2020, 11:53am UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077/1 "2020-08-06T11:53:02Z")

</div>

I have created a library for physically based rendering (PBR) in Processing. PBR is a rendering method for more accurate (and nicer) lighting of surfaces, [here’s a demo video](https://vimeo.com/315540699).

 ![vlcsnap-2019-02-06-11h13m51s589 (2).png](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/dbee0052b0429c5a5c99a2a91b691f2015c14757.png)  
At the core, is just a replacement of the default shader, plus the required initialization, so it should play nicely with any existing sketch or library.

There is [more information on my website](http://www.nachocossio.com/simplepbr-processing-library/), the source is hosted at [this Github repo](https://github.com/kosowski/SimplePBR/), and there’s a [compilation of sketches](https://twitter.com/i/events/1074627437131153408?s=03) done with it.

I posted the library last year, but to the wrong forum section 😬. The good news is that it is now updated and runs on every desktop platform.

Hope you enjoy it!

---

<div class="post-metadata">

**Author:** ![kosowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kosowski/32/550_2.png) [@kosowski](https://discourse.processing.org/u/kosowski)\
**Post date:** [August 6, 2020, 6:20pm UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077/2 "2020-08-06T18:20:45Z")

</div>

So, I was told to post this on the “Libraries” category instead of “Gallery”, but then it has been moved to “Gallery”, where it was already posted ¯\_(ツ)\_/¯.

@GoToLoop could you please move it back to “Libraries”? It seems [that’s the way](https://twitter.com/REAS/status/1291108239828893696) to be added to the contribution manager.

---

<div class="post-metadata">

**Author:** ![prisonerjohn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/prisonerjohn/32/10222_2.png) [@prisonerjohn](https://discourse.processing.org/u/prisonerjohn)\
**Post date:** [August 10, 2020, 12:57am UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077/3 "2020-08-10T00:57:43Z")

</div>

Hey @kosowski,

Just had a look at your link and there are a few missing pieces:

- Need to include documentation in the `reference` folder. This can simply be your library’s javadocs.
- Need to include a `library.properties` file in the zip package.
- Need a link to `SimplePBR.txt` (which is the same as the properties file) alongside the zip (so that the URLs match up to the extension).

See [Library Basics](https://github.com/processing/processing/wiki/Library-Basics) on the wiki for more information.

Thanks!

---

<div class="post-metadata">

**Author:** ![kosowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kosowski/32/550_2.png) [@kosowski](https://discourse.processing.org/u/kosowski)\
**Post date:** [August 11, 2020, 10:10am UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077/4 "2020-08-11T10:10:44Z")

</div>

Thanks @prisonerjohn, have to look into this, will get back to you when everything is ready.

---

<div class="post-metadata">

**Author:** ![grshch](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@grshch](https://discourse.processing.org/u/grshch)\
**Post date:** [January 25, 2022, 10:41am UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077/5 "2022-01-25T10:41:18Z")

</div>

@kosowski hi!

The sample videos look amazing! Great work!  
I’m trying to explore this library, but there is an error that does not allow me even run the examples:

Cannot compile fragment shader:  
ERROR: 0:167: Invalid call of undeclared identifier ‘texture2D’  
ERROR: 0:174: Invalid call of undeclared identifier ‘texture2D’  
ERROR: 0:180: Invalid call of undeclared identifier ‘texture2D’  
ERROR: 0:187: Use of undeclared identifier ‘base’  
ERROR: 0:187: Use of undeclared identifier ‘metallic’  
ERROR: 0:204: Use of undeclared identifier ‘roughness’  
ERROR: 0:205: Use of undeclared identifier ‘mipLevel’  
ERROR: 0:266: Use of undeclared identifier ‘specular’  
ERROR: 0:267: Use of undeclared identifier ‘specfresnel’  
ERROR: 0:267: Use of undeclared identifier ‘roughness’  
ERROR: 0:270: Use of undeclared identifier ‘specref’  
ERROR: 0:273: Use of undeclared identifier ‘specfresnel’  
ERROR: 0:280: Use of undeclared identifier ‘specref’  
ERROR: 0:281: Use of undeclared identifier ‘diffref’  
ERROR: 0:285: Use of undeclared identifier ‘roughness’  
ERROR: 0:286: Use of undeclared identifier ‘specular’  
ERROR: 0:286: Use of undeclared identifier ‘brdf’  
ERROR: 0:286: Use of undeclared identifier ‘brdf’  
ERROR: 0:288: Use of undeclared identifier ‘iblspec’  
ERROR: 0:288: Use of undeclared identifier ‘envspec’  
ERROR: 0:292: Use of undeclared identifier ‘base’  
ERROR: 0:292: Use of undeclared identifier ‘metallic’  
ERROR: 0:295: Use of undeclared identifier ‘result’  
ERROR: 0:295: Use of undeclared identifier ‘result’  
ERROR: 0:296: Use of undeclared identifier ‘result’

How to fix this?  
If I comment out mat.bind() — sketch runs, but obviously without textures.  
Thanks

---

<div class="post-metadata">

**Author:** ![grshch](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@grshch](https://discourse.processing.org/u/grshch)\
**Post date:** [January 31, 2022, 2:32pm UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077/6 "2022-01-31T14:32:12Z")

</div>

Now I see that I use version 0.1 meanwhile on Github the latest is 0.3.  
After switching to 0.3 everything works, no errors. Sorry to bother you.

---

<div class="post-metadata">

**Author:** ![kosowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kosowski/32/550_2.png) [@kosowski](https://discourse.processing.org/u/kosowski)\
**Post date:** [January 31, 2022, 4:21pm UTC](https://discourse.processing.org/t/simplepbr-physically-based-rendering-library/23077/7 "2022-01-31T16:21:58Z")

</div>

No problem, glad its working 🙂
