Box with 3 mirrors tracing each other


I’m facing difficulty to get this right. I’m trying to produce room with mirrors on 3 walls, one wall is painted, so is floor and ceiling. Mirrors work as they should but I cannot get a reflection in reflection. In other words, mirrors trace reflections only ones. Second reflection bounce shows my background color.
Just wondering if there’s some kind of tracing limit on Babylon. @Deltakosh Have you faced this situation before?

We did tests with a three.js same setup produced an image as we wanted. Somehow cannot get this working with Babylon. We try to produce an example for tomorrow.

The second question is about .obj format and smoothing groups.
Is it really so that GLTF and Babylons own format are the only suitable file formats that support smoothing groups. We started our development with .obj format but faced smoothing group issues. We had to changes to gltf format. gltf works but a downside are that we cannot re-import it 3ds max. Also, 3DS max Babylon exporter has a tendency of packing “ghost items” to gltf file. Even when Export only selected option is active. For example, if I have a scene with 10 lights and box. If I want to export only a box, sometimes exporter works, sometimes I get 1-5 random lights packed to gltf file. This can be fixed by saving every exportable file to own .max file.

So long story short question about mirrors is our first priority to get working. File format and exporter is second.

1 Like

Hey if you can provide me a repro I can definitely help for the mirror.
Random guess in the meantime, try something like that:

mirrorTexture.onClearObservable.add(() => {});

For gltf: Pinging @Drigax
For obj, @brianzinn was instrumental in improving our obj support recently and may be available to help on this one (no promise, I’m jsut the guy who pings others :))

1 Like

Can you share an .obj file with smoothing? That is not currently support in the .obj loader, but I’d be keen to add it. Looks like the loader needs to use the normals when supplied for vertices and otherwise an average. Like a post-process.

There should be lines starting with “s”. Like:
s 2
s 4
s 0/off

If you can provide an expected image would be also excellent to make sure that it is working as expected? That will make it easier to work towards. :smile:

Test (713.1 KB)
@brianzinn I created test content for you. I also included a .jpg to show what were after. Gltf smoothing groups work on Babylon. With .obj smoothing groups work when I import this model to 3Ds max or blender but groups disappear on Babylon. @brianzinn please let me know if you need more info

@Deltakosh Our team will work with mirror test content today. We’ll try to provide it to you asap.

@Territorial - What you sent is perfect.
I see the smoothing group 1 is even transparent in the .obj in the sandbox. So, I know what I am aiming for on the final result.

Is this an OBJ file we could add to our tests? I was thinking to add an OBJ loader render test with this feature, but it would require files that are public domain. either you have created them and are willing to share them or otherwise if the file has a CC license. I have seen a teapot out there on other examples. Thanks.

@Deltakosh I created an example that shows the reflection problem that @Territorial is talking about . Ropo can be found at babylonjs-demos/mirrors.html at master · pasaji/babylonjs-demos · GitHub.

The files I provided are free to use.
Just tell us if you need more content for development and testing.

Thank you @pasaji for sharing the content! Hopefully, we get this figured out :muscle:

Hey can you repro in the playground?

The example can be now found also in the playground:

Ok now I get it.
So you cannot do that with pure mirrors. They are pretty fast because they will render only once from the user point of view and then they will get that rendered view projected to the mirror mesh.
Unfortunately, to support mirrors inside mirror you need to recompute that texture for every single mirror as the point of view change when rendered inside a mirror

You may be more interested by using reflection probe: How to use Reflection Probes - Babylon.js Documentation

And probably local cubemap as well: Obtain Reflections and Refractions - Babylon.js Documentation