Layer Dependent Reflections

Hello!

I can’t seem to find any answers on this seemingly simple problem.

Briefly, I would like environment reflections (like what a reflection probe does) per layer.

But maybe if I explain what my scene is like a little, you can guide me to perhaps a better solution.
I have a room that consists of two meshes: one for the outside and one for the inside. I would like the surrounding area to be reflected on the outside of the room but not the inside. I am using Deferred Shading and screen space reflections as well.
Reflection probes are the easiest, but I can’t get them to not apply to the inside mesh. It is also possible that I would like a different reflection to be applied to the inside mesh.

The closest I’ve gotten is to render a camera into a cubemap of the surrounding environment, and use a custom shader to apply the reflections using the normal map to the emission output of the shader; however, the problem I had with that is decreasing the smoothness on the shader didn’t blur the reflection like Unity does with environment reflections (as this doesn’t register as a reflection and a texture in the end). I can’t seem to find a way to blur the texture to make it look like it’s “semi-smooth” either.

You should be able to use 2 different probes for this exact purpose - have one main probe on the outside of the building that covers a large area, and one on the inside of the building that just covers the interior. Unity should automatically blend between them (if the exterior one is overriding the interior, you can increase the importance of the interior probe).

As for blurred cubemap reflections, you can use the same technique that the probes do. Make sure that your cubemap generates mipmaps, then in your shader;

//Instead of
texCUBE (_Cube, refl);
//Use
texCUBElod (_Cube, float4 (refl, (1.0 - smoothness) * 8.0));