thanks for checking on me I unfortunately got sidetracked by other parts of my projects and didnāt get a chance to look at this thoroughly but to be honest I donāt really know where to start from so I would absolutely love some help!
Is this something youāve done before? any pointers would be very welcome.
Havenāt done it before (well, only reflections in ray tracing which is easier) but thereās always a first time! Iām trying to tinker with @Vinc3r 's idea of cloning the texture, but instead of using .clone(), trying to copy the texture pixels so we donāt get the framebuffer loop:
Itās not working yet, I think instead of just calling scene.render() just once like Iām doing, this process will need to be repeated on each frame, or we need some other way to guarantee the reflection probe will only run when the rest of the scene is ready.
EDIT2: Third try! I feel this one is cheaty but⦠It doesnāt result in a loop and might be better performance wise if there are fewer reflective objects? I created a copy of the object we want to apply the probe on and also render, but with the reflection texture not applied to it. So the probe renders the non reflective version, and I apply the probe to the reflective one: Testing reflection probes | Babylon.js Playground (babylonjs-playground.com)
First I was āhidingā the non reflective version from the final scene by making it a bit smaller than the reflective, so that it was hidden inside, but layer masks also seem to work!
Thatās correct! I was tinkering with a way to optimize it (Iām finding this really fun ), and one option could be to use a simplified version of the mesh for the reflection. I built this veeery ugly one from spheres and cubes:
Placed it along our proper Suzanne:
Aaaand ran the reflection probe again:
At that distance, itās pretty hard to distinguish the reflections with the original and simplified meshes, and even more if the reflective material has a bit of bump/roughness, which would distort/blur the reflection:
Iām playing to Mafia 3 these days, and Iāve noticed it seems theyāre disabling a lot of render properties for the rear-view mirror. Maybe theyāre doing a kind of trick like you do: using a ghost scene for this mirror plane. (I, until now, donāt payed attention about details in the cubemaps used for the car body, 'will check next time Iāll launch the game)