Transmission broken unless envmap intensity set to 1

Hello. I have uploaded the test model I built for this.
box_test.zip (15.6 KB)

Playground of the bug: https://playground.babylonjs.com/#9IPTRT#2

ThreeJS

BabylonJS

Transmission in BabylonJS is 100% solid black when the envmap intensity is 0 even if there are other lights in the scene.

This isn’t how most other renderers do transmission, and it looks very different from three.js when the scene is lit with only a punctual light.

Is this the correct behavior or a bug?

The photos are from 3d sandboxes that my team has built in three.js and babylon.js.
I realize Babylon isn’t doing shadows on transparent meshes (please ignore, I forgot to enable the flag to do it)
Link to the sandboxes:

Threejs
https://evesandbox.z13.web.core.windows.net/#/?file=MjUyOTE4NjMxNWY0NjE3YzM0ZjNkOGFmOWM5ZjI2ZmVjZWY0ZGJkMWE=&scene=ulWnwrArlkIfaU9Dyun2v+CSpUF6E/C+pBysvQAAAAAqGH8/zcxMPgrXIzwAAAAA

Babylonjs
https://evesandboxbabylon.z13.web.core.windows.net/#/?file=MjUyOTE4NjMxNWY0NjE3YzM0ZjNkOGFmOWM5ZjI2ZmVjZWY0ZGJkMWE=&scene=sM50P8LiXD/gsRJAgPYMOii/hj7jpno9rdNCvQAAAADTtX8/pHB9PwrXozwAAAAA

Hi @Nowayz! Thanks for reporting this. Looping in @sebavan to get his feedback.

Could you detail how you set the envmap intensity to 0 ?

Will build a playground example.

1 Like

As reported: Load any GLTF with transmission, add light, add envmap, then set intensity to 0 and the bug appears. @sebavan

We use transmission a lot so any time there’s a transmission bug we’re going to run into it :rofl:. I think this is #3. Took me a while to figure out why certain scenes looked wrong though.

In babylon, environmentIntensity is used to control ALL environment lights e.g. reflection/refraction. So by dimming it to 0 both reflection and refraction are dropping accordingly which works as intended.

It seems confusing as we do not see the point light through the material but in case of transmission, a render target is used to create a refraction texture, and the refraction is then dimmed to 0.

in case you ONLY want to drop the reflection part, you could play with this knob instead:

4 Likes

Oh, that’s counter intuitive! The name makes it sound related. It seems like I was wrong about this being a bug.

Thank you for educating me on the difference.

@sebavan I don’t know if I should make another thread for this now. But setting level still doesn’t seem to look the same as three.js with the envmapIntensity turned to 0.

Is there a way to do this same thing in babylon that just removes the envmap from the lighting without affecting other things?

Controlling the full extents of reflections, not just the specular part of it could be done this way: https://playground.babylonjs.com/#9IPTRT#6

3 Likes

That’s exactly what we wanted to do. Though I wish there was a way to do it only for the influence of the environmental map, because while we don’t use other types of reflection in this example, it seems like the solution would also change other reflection intensity such as mirrors or reflection probes.

If we ever implement other types of reflection, it seems like I’ll have to come up with another way to do this. (maybe by altering the texture itself)

This has been a lesson for me in the design of Babylon renderer. I owe you a pizza @sebavan :wink:; thank you sincerely.

1 Like

No problem, glad it help. To do it only from the texture influence, I guess it would need to both scale the texture level as well as the associated harmonics values :slight_smile: