I thought I’d make a new thread as the previous discussion I was having was over in the events section and it seems more relevant to have it here.
I’ve managed to take advantage of the fact that there is a customData channel in the GBuffer which the Default Lit and Unlit shaders dont use. All of the others (clear coat, hair, subsurface) use it.
I’ve added an output node int the material editor that lets you write whatever you want to it from a material.
I throught from discussions on the forum that I would have to access this custom data through a custom node. Doing this was giving me a failed assertion that told me that the GBuffer resource wasn’t valid. BUT then I had a look at the GBuffer visualisation and I saw my pass in the subsurface output! I then worked out that the customData get’s written there and I wouldn’t have to go through a custom node.
It actually didn’t take too much to do (well after having to figure out how the shader compiler works with all its defines when you add an output. I’m thankful for visual studios ‘go to defintion’ because documentation surely didn’t help me.
I can create a pull request for this. is this something that is likely to be accepted @DanielW, ? Or should I just keep my own custom build?
The first thing that I can see people being worried about is mixing the subsurface output with these arbitrary ones. Well because the Gbuffer is limited in how many passes it can do (or more to the point how many epic want to put in for performance reasons), I don’t see any extra custom passes being added. One workaround I have thought about it to use the stencil buffer to send material/mask IDs through so that you can do your own masking in post process. So all SS materials would be given a stencil id of 1 or something and anything else would be a custom thing. This would be up to the user though.
I’m interested to hear everyone’s thoughts on if this is a useful feature.
Hi , I found that trick with materials awesome because there isn’t any way to pass custom data to post process from fragment shaders (materials) implemented by Epic Games, so, can I ask you if you could post the steps to create that node in materials, please?.
it required adding a few lines to the source code and recompiling. It was rejected on github and I haven’t looked at it in a while. I heard that there was some change to the engine recently which allowed rendering code as plugins but I haven’t looked into it. I’ll have a look and see if its possible. In the meantime you are welcome to look at the pull request and get the code yourself if you want to compile it.
Hi all. I’ve jsut dug this out and managed to get it working in UE5. Needed a tiny bit more work than before but its all behaving nicely. As far as I can tell, when I write into the customData channel of the GBuffer, then that automatically gets written to the subsurface color. What I can do though is write to the PostProcess 5 as well though, so technically its duplicated. Maybe there’s a way to create another output for the GBuffer and reroute it to the PP5/PP6 but thats not something I’ll probably do right away.
Hey, I’m here in 2022 wanting to know how to get this working in UE5. Any hints/git pull requests for this ? I saw the UE4 one and it seems fairly straight forward, but porting to UE5 I am a touch lost.
This seems to be the only thing that can save me atm. I managed to get it working with opaque/masked materials but when the material is translucent nothing is written to the custom buffer output → SubsurfaceColor/PPInput05 is all black. I cannot figure out why this would be the case because all of the code seems to be built around shading model e.g. lit/unlit etc. not translucent or opaque property. Any ideas?