Weird behavior when using nodeMaterial with ssr

PG: https://playground.babylonjs.com/#LQNAHC#1
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ā€¦

2 Likes

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.

2 Likes