Getting Data from Surface Material to Post Process Material

Hi,

I have a post processing material that produces a cel shading effect. My post processing material can read depth, diffuse color and a few other things, but there doesn’t seem to be a way to transmit a custom color channel from a surface material to a post processing material.

I’ve experimented with custom depth + stencil values, but I can only set the stencil value per object.

What I want is to transmit complex, per-pixel information. For example, my cel shading effect has a light/shadow transition point. If my surface material could fill a custom invisible color channel, I could render information to it and my post processing material could use that information to alter the light/shadow transition point, enabling shiny/rough surfaces or texture effects such as fur that are usually difficult to achieve in cel shading.

Ive tried this for a long time and always came up short.

Even tried using things metallic on the material and grabbing it in the post process metallic channel, but then obviously my material was metallic.

The only thing I can think of is if you use very specific colors. Like a very specific shade of brown, then have your postprocess detect that specific color in basecolor and disable cell shadong on it for example.

Looks like that is the path I’ll have to take.

Probably with a fuzz factor, even, because instead of using emissive materials I’m undoing all shading in the post processing material (so much for render pipeline efficiency :D)


One other option I found mentioned in my searches was to create a custom shading model (along the ‘Unlit’, ‘Default Lit’, ‘Subsurface’ etc. built-in ones), but that seems to require modifying the UE sources.