Some experiments for getting SSR to reflect diffuse materials for SSGI like effect. Works in viewport in Eevee. Just replacing principled shader with node group that has a gloss shader that uses the some of the same inputs and roughness mapped to a more diffuse range and then optionally mixing 50% to a empty shader to same brightness level as normal principled shader.
I was hoping to create a addon that would replace all the principled BSDFs with the nodegroup, but it was bit more complex than I imagined. Didn’t help that most of the relevant examples of similar scripts were pre 2.8.
Here’s the test scene for the latest node group I did. Haven’t touched it for a while so I’m not 100% all values are at the best defaults or nodes are cleaned up.
There are problems with things looking too metallic and normals being too harsh on skin as they don’t get blurred. The workaround in that file is just to change the normals to neutral if there’s any bigger value in SSS input.
This is amazing, however having to modify every single material for it to work is a dealbreaker. @hypersomniac should definitely implement it as Eevee native feature.
There are also couple of cases where you need to have non linked copies of the nodegroups as in some cases it fails to produce expected result, so you need to slightly tweak values based on assets, making it even worse. Having it implemented correctly as actual diffuse bounce light it shoudn’t have any of those issues. Based on my experience in UE4 with SSGI works great with lower fidelity GI techniques (also with irradiance volumes?) as it fills in the details they miss.
Thank you very much for sharing this,
gave it quick try and loving it, no time to dig into it more today but will definitely follow this thread.
Great contribution to the community!
@pixelgrip That 50% black is actually intended as I used add shader instead of mix for flexibility while testing. Add shader by itself gives too bright results.
Looking at this now I way too many problems with it, as there are quite a lot of inputs that don’t look as they should, fixing the handling of them case by case seems kinda counter productive, might as well try to create a uber shader from ground up, as was my inital idea, but I think I had trouble with getting the SSS behave in a similar fashion. Still, finding a old pbr ubershader and tweaking that might have better results.
I also took a look at Eevee SSR shader code while I was messing around with this, even tough that is way way too advanced to even have a shot at understanding it, I kinda found the relevant sections, but I didn’t get where or how in code it was that it was decided that what gets written into specular roughness buffer.
That’s exactly what I was thinking. I am using SSGI in UE4 too and it’s great. Given the simplicity of the implementation, there’s really no excuse to not have it in Eevee.
Spent a good part of the weekend trying to understand eevees source code.
Managed to turn diffuse node into a glossy node and then eventually get SSR working on it.
Doing it with notepad++ and no source control definately isn’t the way to do it, so I guess I have to learn how to this properly.
Converted principled, diffuse to use glossy closures. Not sure if there’s much point to touch translucent.
Next step would be to try to edit blender\source\blender\draw\engines\eevee\shaders\lit_surface_frag.glsl diffuse closures to include SSR in physcially plausible way and then switch diffuse and principled back to diffuse closure.
I could share the current build, but I don’t think there’s much practical use for it.
I ran into a problem. Since I needed to edit some of the files that are used when creating the nodes then you still need to replace the principled node with another principled node, doesn’t work with just opening the scene.
If someone knows if there’s a way to recreate/reload nodes then that would fix it. If there isn’t then the build is about as useful as a node group.
I haven’t looked extensively at all the categories there, but I’m hesitant to take up developer time for a hack that probably will only work situationally. As for a proper implementation, I sure can’t do it, so it would be pretty much a feature request.