TextureCamera / scene monitor?

I need to have a scene with a monitor of the scene from a different angle right in it. Think a concert, political convention, or maybe like the Hall from the ‘Wizard of OZ’. A large screen, so people in the back can see.

A “Mipmap” camera is not going to work for a number of reasons:

  • It is a rectangluar area of screen. Would not “move” in the view of the other cameras as they moved.
  • Not WebXRCamera friendly.

I believe taking snapshots are what would normally be displayed & I want a different angle.

Something like a scene after render could load it back into a dynamic texture. Being a frame behind is not really a problem, but seems like a waste of overhead to send things back to the CPU, only to be sent back.

Getting a certain camera to render first is fixable with just an ordering of scene.activeCameras. Any ideas on the rest?

I would recommend using rendertarget texture. They can handle different camera than the main camera.
Something along these lines:
https://www.babylonjs-playground.com/#0QAGE9#9

1 Like

Just checking, I have implemented this. I do get an error although it does it. It stops complaining after 32 times, but now I cannot get any further errors, should they exist. Is this something I should be concerned about?

Error: WebGL warning: drawElements: Texture level 0 would be read by TEXTURE_2D unit 0, but written by framebuffer attachment COLOR_ATTACHMENT0, which would be illegal feedback.

Also errors on chrome, though it reports 256 times:

[.WebGL-0000017E74005C10] GL_INVALID_OPERATION: Feedback loop formed between Framebuffer and active Texture.

Do you have a repro I can check?

Not right now. I will endeavor to keep reducing my scene, till I get a scene that still errors which I am comfortable living on the outside, in the near future.

Checking the PG you made in the original response, it does not error. I followed it pretty closely this morning.

1 Like

Every once in a while, an error message means EXACTLY what is says. Just kept turning stuff off till the errors stopped, one at a time. Fortunately, did not have to anything, but reload the page.

The only thing I had done differently is I cannot hard code the meshes, so I wrote a loop. Failed to exclude the mesh which is going to be the display of the camera from the render list. Shown below with test added.

for (const mesh of scene.meshes) {
    if (mesh.name !== 'hall.bigScreen')
        renderTarget.renderList.push(mesh);
}
1 Like