syoyo / tinygltf

Header only C++11 tiny glTF 2.0 library
MIT License
1.94k stars 393 forks source link

TODO: Add PBR shader example #4

Open syoyo opened 7 years ago

syoyo commented 7 years ago

Add GLSL PBR shader into glview example.

Ybalrid commented 6 years ago

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.

brycehutchings commented 6 years ago

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.

Ybalrid commented 6 years ago

I will look into this, thanks!

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

Le 11 janv. 2018 à 20:15, Bryce Hutchings notifications@github.com 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 commented 6 years ago

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:

viperscape commented 5 years ago

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