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.
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.
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.
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 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
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.
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();
I know that this post is old but I have not found any other ressources on the subject.
Do you know if Babylonjs offers in it’s latest version a way to capture a reflection probe of the full scene without creating a reflection loop (applying a probe to an object that is part of the probe)
I am guessing that it’s not that simple but would it be possible to set a maximum amount of inter reflection so the probe and material don’t update each other indefinitely?
I’ll try to think of a way to hack something together but if anyone has any pointers for me I’m all ears