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)