How to modify BRDF.ush file to switch to phong shading model? (instead of Unreal's GGX default)

I read that this is possible.…-cgi-film-look
How would I go about doing this?


make your own engine build and modify the ush file

I think I recall it used to be rather simple by going into \Engine\Shaders\Private, finding ShadingModels.usf, then you’d find commented lines for most models and you could just leave the one you wanted uncommented. Now however I can’t find anything like that in ShadingModels, so either I am misremembering, or things have changed around quite a bit.

Would also like to know.

I wrote the guy who made the toon shading model. I’m now attempting to modify shading his model, specifically the specular highlights…ng-experiments

I just discovered how to do this and it was surprisingly simple! You have to modify the D_GGX function found in BRDF.ush to use Blinn-Phong instead.

So change from this:

float D_GGX( float a2, float NoH )
    float d = ( NoH * a2 - NoH ) * NoH + 1;    // 2 mad
    return a2 / ( PI*d*d );                    // 4 mul, 1 rcp

to this:

float D_GGX( float a2, float NoH )
    float d = 2 / a2 - 2;
    return (d+1) / (2*PI) * PhongShadingPow( NoH, d );        // 1 mad, 1 exp, 1 mul, 1 log

I tested this with a custom version of the engine and it works! This looks much better than “faking” phong shading highlights via an emissive. There is proper shadow mapping so the highlights will be properly obscured by cast shadows. Like they’re supposed to be:

Screenshots of the modified engine (with blinn-phong):

Hi, @tapirtoon! I also want to create an environment using Phong shading. You said that this result is better than using post-processing. Have you already tried to compare the result of post-processing and custom shader?