tinygltf icon indicating copy to clipboard operation
tinygltf copied to clipboard

TODO: Add PBR shader example

Open syoyo opened this issue 7 years ago • 5 comments

Add GLSL PBR shader into glview example.

syoyo avatar Jun 05 '17 15:06 syoyo

If I understand correctly, what is missing from the glview example to support this is a shader program that can use the standard PBR values/textures.

I have currently a high level understanding of how PBR rendering. I never implemented such a complex shader myself yet (I'm learning OpenGL as I go, and for my 3D/VR development, I use a C++ rendering engine called Ogre that itself implement physically based rendering, but they call that PBS for physically based shading)

I'm quite liking this tutorial https://learnopengl.com/#!PBR/Theory and there seems to be good explanations on both the math and how to implement them in GLSL.

I'm on other things right now (trying to understand how to load skeleton-based animation into Ogre, as I continue writing a glTF importer for Ogre). But I'll give a try at implementing a PBR Metal-Roughness pipeline into this example. tinygltf exposes all the material configuration and textures needed, so that's mostly just a matter of implementing everything in OpenGL.

Ybalrid avatar Jan 11 '18 19:01 Ybalrid

The official glTF PBR tutorial at https://github.com/KhronosGroup/glTF-WebGL-PBR has a reference implementation with the shaders under https://github.com/KhronosGroup/glTF-WebGL-PBR/tree/master/shaders (MIT license). I have had good success using it myself (although I ported it to use with DirectX) with the tinygltf loader. I would recommend using this reference implementation.

brycehutchings avatar Jan 11 '18 19:01 brycehutchings

I will look into this, thanks!

-- Arthur Brainville (Ybalrid) ESIEA 4A http://esiea.fr/

Le 11 janv. 2018 à 20:15, Bryce Hutchings [email protected] a écrit :

The official glTF PBR tutorial at https://github.com/KhronosGroup/glTF-WebGL-PBR has a reference implementation with the shaders under https://github.com/KhronosGroup/glTF-WebGL-PBR/tree/master/shaders (MIT license). I have had good success using it myself (although I ported it to use with DirectX) with the tinygltf loader. I would recommend using this reference implementation.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Ybalrid avatar Jan 11 '18 20:01 Ybalrid

Okay, thanks for the link @brycehutchings, there's indeed the complete shader program in there, and under a free and permissive license. Should be able to drop that in, and do a nice render with the correct material and some nice lighting.

I'll study the code this week end to see how that goes :smile:

Ybalrid avatar Jan 12 '18 00:01 Ybalrid

I started working on a more elaborate rendering example, located here for now. It does not include AO or cube environment effects, but is likely a good start. I based it on Khronos' PBR example

viperscape avatar Dec 18 '18 14:12 viperscape