PBR subSurface parameters question

Hi guys,
I’m playing with pbr materials and have a questions to subsurface section. There are two options:
pbr.subSurface.isTranslucencyEnabled = true (https://playground.babylonjs.com/#FEEK7G#37)
pbr.subSurface.isRefractionEnabled = true (https://playground.babylonjs.com/#FEEK7G#17)
both of them works well in the playground - I mean I am able to change diffusion distance color to any color I want.

when I’m trying to create a new PBR material in our application, changing these colors does not work in case of translucency diffusion distance color and in case of refraction enabled I’m only able to change color to pure red, green etc. (I’m not able to set in Color3 for example (1, 0.6, 0.5) - when I do this, color changes to black). I want to ask you what setting can cause this? Maybe there is something that needs to be on or off to have these colors work correctly. Below are pictures that showing this behaviour (these colors were changed through BABYLON Inspector):
translucency enabled:


refraction enabled:

refraction enabled pure color:

Are you by chance able to set up a repro, because if it works in the playground, it must be related to your parameters, which can be hard to guess?

It will be hard but I will think how to show it to you. I compared subSurface object parameters in the playground and in my pbr material and there was no differences that can pointing the reason, I also compared whole pbr material object to that in the playgroud and all main properties that can be changed in BABYLON Inspector were the same.
I also tried to create new PBR material from BABYLON inspector and link it to sphere and the same behaviour.

Do you have HDRI environment texture set? I think refraction and translucency only apply to refraction texture, so without one they only show black color.

In case of why pure green works: Afaik translucency is applied as exponent of the tint color, so if you have any of the RGB values at 1.0 they never get scaled down. Therefore pure green stays pure green. (Which kind of is a bug)

1 Like

Ok, I was able to solve the problem. In materials section of our application we used sphere mesh imported from gltf as a base model on which we change material properties. From some reason which I didn’t find it doesn’t work with this gltf mesh in that scene (in other place in our application where we import models this gltf sphere works as expected). When I used this gltf file in babylon playground it is working fine also. So I created a mesh through BABYLON.MeshBuider.CreateSphere to check if it will work and everything works fine. So this is strange that in this scene this gltf doesn’t work properly. Thanks guys for your help and suggestions.

1 Like