Weird behavior when using nodeMaterial with ssr

I have two planes, the upper plane using nodematerial, setting ior to 1 to escape ssr, but after I added the lower plane, the ssr began to show on the upper plane.
So how can I keep the upper plane away from the ssr while I have to use the nodeMateiral?

Pinging @julien-moreau our SSR master :smiley:

The problem does not come from the node material (which is not supported by the pre-pass / geometry renderer, so can’t be used with SSR) but from the other plane (you can remove ground1 and you will see it still fail) because of this PR:

It changed the values that are written into the reflectivity channel, making it incompatible with existing SSR code.

Namely, before the changes the value which was written was coming directly from the reflectivity texture. So, this texture acted as a mask for the reflective parts: 0=not reflective at all, 1=fully reflective. Also, no reflective texture meant no reflection.

Now, it is the reflectivity final computed value which is written, and this value is never 0 as it is a mix between 0.04 and a computed color based on the metallic property of the material, even if no reflectivity/metallic texture is provided.

So, I think we should check that the reflectivity value is higher than 0.04 instead of 0 in the SSR shader before computing the reflection (actually it’s toGamma(0.04) because we output gamma values for the reflectivity - I’m not sure it’s the best thing to do). However, it will then fail for standard materials (maybe we should remap the 0-1 range to 0.04-1 for them…).

I will let @Deltakosh and @sebavan comment on this one as I’m not really sure of the fix…

I guess the remapping from 0-1 to 0.04-1 should be ok as well as the min value check. would you be willing to do a PR for it ? if @julien-moreau validates the assumptions as well ?

Yes, I will see to do it.

Maybe the 0.04 value can be a parameter so that the user can control when the reflections occur…


Hi @Evgeni_Popov, just checking here have you made the PR? If not, would you like me to create an issue to track? :slight_smile:

Actually, I’m not sure we will do this remapping…

There’s a SSR PR which is currently ongoing (SSR improvements by Mannns · Pull Request #12728 · BabylonJS/Babylon.js · GitHub) and I will have a more thorough look at the PBR case once I come back.