January 25, 2016

I've modified the lighting equations to allow for transmitted (as well as reflected) specular for dynamic lightings. Transmitted specular means the light is on the opposite side of the object, but light is coming through the object towards the viewer.

This is important for thin materials (such as leaves)

No transmitted specular:


With transmitted specular:


Here the amount of transmission is maybe slightly too high -- but it shows the effect well. This works particularly well with shadowed directional lights and geometry using order independent transparency. The above screenshot is exactly that situation. The tree leaves are rendered with stochastic transparency (which works particularly well for this model). So we get a nice halo effect around the edges of the tree.

And, if you look closely, you can see that the tree shadowing is blocking the transmitted specular, giving a volumetric look.

This model is built in a way to create a lot of noise in the normals. As you can see here:

Normals point in every direction, and there is a lot of local variation.

The transmitted specular really helps highlight this noise. It helps to make the tree canopy feel more 3D, and it helps to hide the "true" triangular geometry. The preview reflected-only specular just wasn't able to do this as well.

It's expensive!

The transmitted specular calculation is actually a second, additional, specular calculation -- and it's a little more expensive than the reflected specular. It's using the node diagram from the previous post, Transmission Node Diagram. So it's not really cheap. It's particularly expensive in this case, because stochastic transparency can result in many lighting calculations per pixel (for the different depth layers).

IBL implementation

This is not currently working with image based lighting. Part of the IBL principle is that every effect applied to "dynamic" lighting should also be applied to IBL -- (so material appear the same under both types of lights, and so we can fade distant dynamic lights into precalculated IBL).

It might be interesting to try to get it working under IBL, so I'll give it a shot.

Better doubled sided GGX specular equation

When the shader flag "MATDOUBLESIDED_LIGHTING" is set, the specular equation is now double sided. The results will be symmetrical for a flipped normal (ie, Specular(normal)==Specular(-normal), for all normals). It can be handy in cases like this, where the normals are pointing in all directions.



blog comments powered by Disqus