Download

How to create custom shading model that allows controlling strength of reflection captures??

I was successfully able to modify the engine to use Blinn-Phong as the specular model instead of GGX (unreal’s default) by modifying the BRDF.ush file (located in the Engine\Shaders\Private folder of the Engine)

(Screenshot of the modified Engine with Blinn-Phong)

I also modified the engine so that it only uses specular highlights and no reflection captures AT ALL from skylight ( planar reflections still worked, which is good!), which lets me know that the engine does (on some level) treat the specular strength and strength of the reflection captures separately. I did this by deleting the #if ENABLE_SKY_LIGHT section of the ReflectionEnvironmentComposite.ush file (also located in the Engine\Shaders\Private folder of the Engine)

(Code I deleted to get rid of skylight reflection captures in ReflectionEnvironmentComposite.ush)


#if ENABLE_SKY_LIGHT

    BRANCH  
    if (ReflectionStruct.SkyLightParameters.y > 0)
    {
        float SkyAverageBrightness = 1.0f;

        #if REFLECTION_COMPOSITE_SUPPORT_SKYLIGHT_BLEND
            float3 SkyLighting = GetSkyLightReflectionSupportingBlend(RayDirection, Roughness, SkyAverageBrightness);
        #else
            float3 SkyLighting = GetSkyLightReflection(RayDirection, Roughness, SkyAverageBrightness);
        #endif

        // Normalize for static skylight types which mix with lightmaps
        bool bNormalize = ReflectionStruct.SkyLightParameters.z < 1 && ALLOW_STATIC_LIGHTING;

        FLATTEN
        if (bNormalize)
        {
            ImageBasedReflections.rgb += ImageBasedReflections.a * SkyLighting * IndirectSpecularOcclusion;
            CompositedAverageBrightness.x += SkyAverageBrightness * CompositedAverageBrightness.y;
        }
        else
        {
            ExtraIndirectSpecular += SkyLighting * IndirectSpecularOcclusion;
        }
    }
#endif

But I still find in a lot of cases things are too glossy/reflective/wet looking would like for a way to be to be able to control the strength of the reflection captures independent of the specular amount, but I’m not sure how create a custom shading model that would allow me to do this? Please let me know where to get started or if you’re familiar with this?

Wow, first of all: good luck, because you are gonna need it.

I was able to make a custom shading model, but god its such a pain to do. There is NO official documentation in how the inner ue4 works, let alone how to modify it.
A guy make a “tutorial” long ago wich is the one I use to get it done. And other one follow his steps in the newer versions, but its incomplete : Matt Hoffman – Medium

I suggest you to give it a look, but first try to make what you want with usual shaders, or youll find yourself in a nightmare of errors because things you dont even know exists. Remember you can disable SSR reflections, and just dont use reflection captures. Use wisely the specular and roughness parameters.

The funny thing is that they have all those brdfs in the engine files,Its only that they are not in use.

UNREAL, MAKE THE ENGINE USABLE AND EASY TO MODIFY LIKE UNITY. MAKE THINGS IN PLUGINS OR MODULES SO ITS POSSIBLE TO PASS IT TO NEWER VERSIONS AND DONT HAVE TO REWRITE MARIANAS DEEP FILES.

No reflection captures?? The skylight reflections really make metal materials look much better (almost broken without them). Do you think it’s worth contacting Epic directly? how would I do this?

What are some key words I should search for when searching the source files (for the part pertaining to controlling the reflection capture strength)?

…bump…