Phong reflection model with unlit material

I’d like to share with the community the result of some “material playing” I’ve recently done. :slight_smile:

First, a short introduction to the problem… :slight_smile:
While developing medical VR experiences we had to deal with huge, hi-poly, organic meshes with no needs of proper PBR realistic shading, just like this one (intestine interior)

Since we were in VR, the number of meshes was at the minimun (in order to have less draw calls as possible) and we switched our project to Forward rendering.
And there started problems: the pixel shader quickly became huge (we have a lot of WPO to make all tissue moving and waving) and together with overshading made the GPU time fail to reach the VR target (11 ms).

So I started to implement a very basic Phong reflectance model inside an unlit material, using the good ol’ book The CG Tutorial as reference in order to drastically reduce the shader complexity without losing visual quality.

First iteration was fine but there was no direct relationship between UE4 point lights and my fake stuff, so I’m now trying to adapt a little the Phong model in order to give me a result closer to the UE lights.
I use a bunch of custom BPs in scene: each one represent a light and affects a parameter collection used in the unlit material: at the moment light color, intensity, radius, falloff type and object material’s base color and roughness can be expressed with (about) the same values with real and fake lights instead of guessing values for the Phong model :slight_smile:

Of course they are 2 completely different systems, but with some magic numbers to convert units the difference is low enough to switch our organic materials to the unlit version.
In these images a standard material is used with 3 pointlights: ambient occlusion, indirect lighting and shadows are switched off to see only direct light and specular.

With this dirty trick the pixel shader complexity on our organic meshes was very low (less than half of the original material) and we had a significant framerate boost :slight_smile:
Normal maps can also used.
The Phong point light is a material function and next step is to adapt it to have spotlight and directional lights too: so with these building blocks will be possible to assemble materials as needed.

Hi, @berna! Do you mind sharing your blueprint material of the Phong shading? I’d like to see how you implement it

What is the point of this if you aren’t even gonna show how it’s done? Useless post.