Artistic Experiments
  • Home
  • Reel
  • Shaders
    • Stylized Shaders
    • Lighting Techniques
    • Shader Effects
    • Cubemaps
    • Pixel Lit Shaders (Basic)
    • Vertex Lit Shaders (Basic)
    • Unlit Shaders (Basic)
  • Tools
  • WIP
  • Contact

Translucent Specularity - UE4

12/10/2014

12 Comments

 
One of the more disappointing things about UE4 is a lack of specularity on translucent objects, which makes stuff like my water more difficult. Some people have taken to passing in a light vector and building blinn/phong lighting in the pixel shader. I'll be showing how to do that with the specular model that is closer to what UE4 uses, as well as another model for comparison.

To start out here is the default lighting with no direct specular:

Lit Translucency - The highlights are all due to screenspace reflection.
Picture
and here is UE4's opaque shader:
Picture
In order to get a specular highlight i needed a light vector, so I made a level blueprint that passes the directional light vector to a material collection. This way multiple shaders can access the same global attribute if needed. 

Picture
We can then use this new attribute to add a specular highlight. Here it is with a custom Blinn specular added through the emissive channel
Lit Translucency + Blinn
Picture
If you compare this to UE4's specularity though, its 

Here are each shader again, specular only (well...specular + screenspace reflections):
Blinn 
Picture
UE4 Specular 
Picture
UE4's specular is much more advanced than Blinn and to get this kind of specularity, we will need to rebuild it from scratch like we did for the Blinn. This paper is a good read for those looking to figure out how exactly the shader works (WARNING: MATH). To get a handle on doing this in UE4, i used the Cook Toorance shader I wrote a while back as the basis for my rebuilt lighting. It uses Beckmann's model of specularity, which is slightly different than the GGX approach UE4 uses.
Beckmann Specular - 
Picture
While the specular is a lot more focused and apparent with this, it does not have as much spread as UE4's which I was a little disappointed with. This definitely helps in the background, in terms of enhancing the wave's readability in the distance. So instead i attempted to implement UE4's specular model - GGX/Trowbridge-Reitz.

GGX/Trowbridge-Reitz Custom - 
Picture
Here is my the shader with UE4's Lit translucency and GGX specular added. 
Picture
Here are the different material functions for each. Let me know if you need anything clarified.

EDIT: GGX originally had some issues but is now MORE BETTER and updated graphs have been uploaded. Thanks for the help Eric!

Blinn

Picture

Beckmann

Picture
Picture
Picture
Picture
Picture
Picture

GGX

Picture
Picture
Picture
Picture
Picture
Picture
Picture
12 Comments
    In progress / half finished stuff. Random stuff I find interesting or useful. Whatever else I want.

    WIP

    Categories

    All

    RSS Feed

    Archives

    December 2014
    November 2014
    September 2014
    April 2014
    September 2012
    July 2012
    January 2012

Powered by Create your own unique website with customizable templates.