Jump to content

Tightening up the graphics and tripling down on glTF


Josh

2,545 views

 Share

As I have stated before, my goa for this game enginel is not to build a marketplace of 3D models, but instead to just make sure our model loading code reliably loads all 3D models that are compliant with the glTF specification. I started testing more 3D models from Sketchfab, and found that many of them are using specular/gloss materials. At first I thought I could just fudge the result, but I wasn't getting very good results, and the Windows 10 3D Object Viewer was showing them perfectly. This made me very upset because I feel that the software I make for you should be the absolute best thing possible. So I went ahead and implemented the actual KHR_materials_pbrSpecularGlossiness extension. Here are the results:

Untitled.jpg.8452d9b35f86cc9a041c3e3c4ff95b42.jpg

It looks quite good without breaking the specular/gloss approach. I think this would be an ideal way to upgrade the Leadwerks renderer without making changes that are too big.

To implement this, I used the glTF sample viewer source code, which is a bit of a reference renderer for glTF materials. It has changed quite a lot since I first used it as a guide to implementing PBR materials. I decided I might as well integrated the latest code into our renderer. The shader code is very well organized, so it was pretty simple to integrate into my latest code. The glTF materials system is great because it provides a standardized materials system with a lot of advanced effects, along with a reference renderer that shows exactly how the materials are supposed to appear. This means that any engine or tool that is conforms to the glTF standard will always display the same materials the same way, while still allowing additional more specialized features like shadows and post-processing effects to be added.

In addition to revising our metal-roughness code, I went ahead and added support for some more features. The KHR_materials_clearcoat extension basically makes cars look like cars:

It adds an extra layer of reflections that gives a dark surface a big boost, and can even use a separate normal map for the clearcoat layer:

image_1656582469.thumb.gif.d4d318d2888c1efb72a8efa9e0d68029.gif

The KHR_materials_sheen extension makes cloth look like cloth. You can see for yourself in the image below. The appearance kind of makes my skin crawl because I can't stand the feeling of velvet / velour. Apparently this is some kind of common tactile hypersensitivity and I actually get a feeling like electricity shooting through my spine just looking at this image, so I think the effect is working well:

Image3.thumb.jpg.0af406093a005891434f518c2bb0193e.jpg

Another creepy example. Just the thought of running my hand over that fuzzy orange fabric is making me shiver:

Untitled.thumb.jpg.b2ad5fc15a99a8d80a839ad71e1b4442.jpg

The KHR_materials_transmission extensions provides a physically accurate model for transparent surfaces, with support for refraction. Here's a shot of refraction bending the background image:

Untitled.thumb.jpg.ffbbe5b450c75e9cfb7a5c0899f31ccd.jpg

This also supports roughness, for making the refracted background appear blurry like frosted glass:

Untitled.thumb.jpg.5affc5316e1042e42106a7289d205717.jpg

I feel the background is too pixellated and should be improved. This problem occurs in the reference renderer, and I have several ideas on how to solve it.

The transparency system is very advanced, and introduces a lot of interesting new commands to the engine:

Material::SetIndexOfRfraction(const float ior)
Material::SetThickness(const float thickness)
Material::SetTransmission(const float transmission)

These features will give you reliable support for loading glTF models from any source, as well as the best image quality possible for your games. I think realistic materials in VR will also make a big difference in bridging the uncanny valley. And all of this is done with the fastest possible performance for VR.

And yes, of course I used a gamepad to do all of this.

 

 

  • Like 3
 Share

3 Comments


Recommended Comments

It looks like 3ds Max has added support for all of these features in its materials system, so that is very good:

maxgltf.thumb.png.687c223490421742c0cd6a1c138506b3.png

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...