hey guys,
so i am still working on my little 3D demo thing with lots of transparent cubes…
now i implemented some kind of multiview. in other words, two differenct cameras viewing the same blue cube object but from kinda like 180° in degrees different direction where implemented. these are just two “Arc Rotate Cameras” (camera1 and camera2). implemented as 2 viewports in the browsers window object. one on the left, the other on the right side…
(see the screenshot above)
so i use the following code:
` camera1.viewport = new BABYLON.Viewport(0, 0, 0.5, 1);
camera2.viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1);
scene.activeCameras.push(camera2);
scene.activeCameras.push(camera1);`
now the problem that i have is that i use depth sort in this demo, and it doesent work with both of my cameras. it seems to only work with one of the “active cameras” (see code above)… depending which of the camera objects where first or lasted “pushed” into the “activeCameras” array…
to make that a little bit more clear, because i have no playground provided here… you can see this problem in this image of my demo.
on the left side the cube is shown with this one side where the red square is in front. the yellow is in the back and is drawn not so intense because it is in the background (actually the backside of the blue cube) and there is a transparent mesh in between… everything correct here!
but when you look on the right side (the other viewport)… it’s the same blue cube object just shown from the opposite side, the yellow square is now seen as on the front side… but here you can see that it is not drawn correctly in terms of depth sort… the yellow square is in front and should be drawn more intense… the red one is on the back side of the blue cube and should be drawn more diffuse, but the opposite is the case.
to me it looks like the depth sort algorithm is getting its data only from one of the viewports… namely the one who was last pushed into the “active cameras” array it seems.
so my question is… can i change that, so the depth sort works correctly on both of the viewports… do i need to change a property that i am maybe not thinking of? or… if there are no other options… are there possible workarounds…?
thanks guys… .
in short: depth sort on the left viewport (camera1) correct but depth sort on the right viewport (camera2) not correct!