I still don't understand how reflection probes could help reflecting all the scene

Especially during our apartment configurator production, I took a long time on a task: create one reflectionProbe per room, so as to tend to realistic reflections on all objects. But I never ended to get a result, and I didn’t retake time to go deeper into this goal, until now.

So of course I’ve started a playground, using the cornellBox:

https://www.babylonjs-playground.com/#K030U0#6 : here, it’s just the probe helper which get the probe cubemap into its material, other scene materials just use the scene.createDefaultEnvironment.

But things getting bad when starting to assign this probe into all materials: https://www.babylonjs-playground.com/#K030U0#7

I even try dark & ugly things like that, just to be sure :smiley: https://www.babylonjs-playground.com/#K030U0#8

The things that make me crying it that in Unity I can get the desired result in not time:

or also into Unreal Engine (which I doesn’t know, but my scene setup seems ok for this test):

So is it me doing something wrong? Or is something missing into our beloved engine?

I’ve the feeling that when the probe render the scene, if it’s cubeTexture is used into the material, this break the render, instead of ignore material reflectionTexture.


This is because it is recursive :slight_smile:

You cannot render into the probe a mesh that use the probe :slight_smile:

And is recursive-bypass would be difficult to implement into BJS?

It seems Unity3D & Unreal do this trick (ignoring reflection pass during probe rendering - I may be wrong here, it’s just my feeling).

'cause without this bypass, it forces us to create one probe per object, which is of course not performance friendly :smiley:

Well from a realistic standpoint you DO have to create one per mesh else the probe will be wrong as it will not be wrongly positioned

Also it is not a recursive issue but more the fact that when rendering to the probe, if the probe is already attached as reflectionTexture for the objects to render then we end up with the texture in the read and write channesl which is not possible in webgl:

Interesting topic. Thanks for raising it. I haven’t tried reflection probes yet but am looking forward to it and had a similar concept of how they could be used as @Vinc3r i.e. that I’d be able to create a reflection probe for say a bathroom then apply it to smaller objects in that room like chrome taps and porcelain bathware. Granted, as @Deltakosh said, the reflection positioning wouldn’t be perfect but for most things it doesn’t need to be. You could get good results in a bathroom with one or just a few reflection probes applied to many objects.

I also recall talk from the old forum about the future possibility of interpolating between adjacent reflection probes i.e. setting up a grid of probes, then objects in the scene get an interpolated reflection based on nearby probes or alternatively just automatically switch from one probe to another depending on proximity.

Pinging @sebavan for the interpolated reflection as this is a topic he wanted to explore

1 Like

Yep like inteja says, one probe per room should be a lot enough to fake realistic reflections.

So we can’t get probe.cubeTexture applied in a mesh included in a renderlist refreshed each frame.

BUT :slight_smile: If we create the probe, and tell it to render the scene only once, before applying the cubeTexture to scene materials, it should be OK right? Apparently it’s not: https://www.babylonjs-playground.com/#K030U0#12

Same if we clone the texture: https://www.babylonjs-playground.com/#K030U0#13

By the way, cloning this texture actually seems to break the cubeTexture property? (look at the reflProbe01Helper): https://www.babylonjs-playground.com/#K030U0#14

Still same problem:

In case we’ll able to cloning the probe texture into a classic static cubeTexture, this could be a solution isn’t it?


  • probe creation inside a room, rendering all elements
  • stop refreshing the probe for perf reasons
  • cloning the probe.cubeTexture into a new static cubeTexture
  • assigning this cubeTexture to all elements
  • if we need cubemap refresh, just reactivate the probe and redo steps above

But for now, cloning doesn’t works: https://www.babylonjs-playground.com/#K030U0#13

1 Like

Theorically this should work :slight_smile:

Love where this topic is going.
Thanks @Vinc3r for raising it.

I have a sense that I am going to run into similar issues in my projects soon.
As of now, all my reflection maps are authored in DCC tools and are static.

Sure would be nice to do it semi-dynamicly in the engine.

1 Like

Unless my playground above is missing something, for now it does not :face_with_monocle: (same playground but with more comments, cloning is l.37).

I think this is due to the fact that the probe cubeTexture is actually a RenderTargetTexture, and we probably want this one converted to a classic cubeTexture, to be used nicely into reflection channels. But I don’t see how to do that.

Maybe we miss something like that?

var probeTextureCopied = reflProbe01.cubeTexture.getCubeTexture();

Let me ping @sebavan (to see if he can have a look after his holidays)

1 Like

My guess is there is probably a clever trick to be found with a ring rotating texture:

I might have some work around Probe in 4.1 So I ll see if I can take this in account probably with a limitation to static objects.


I was first thinking that your playground is buggy: on Firefox you better have to not be epileptic :smile: On Chrome it’s OK.

Actually it’s a nice trick you’ve found!