Bug: Orthographic camera is rendering Default layer content
I think I've found a Lens bug that manifests itself only on-device (not in Lens Studio): the orthographic camera, which is set to render a layer called "Orthographic", renders "Default" layer content. For example, I have a 3D model on the Default layer and a UI element (a 2D image) in the orthographic layer. Initially, Lens Studio places the ortho camera off to the side in world space but if the 3D content makes it over there, it will be rendered on-screen with an ortho projection.
This is not reproducible in Lens Studio but happens in Snapchat only. The easiest way to test this is to move the ortho camera to the same position as the default scene camera so that when the lens runs, the 3D content is simultaneously in the both frustums. You will see the 3D content rendered normally and another copy overlaying it but pinned to the screen with an orthographic projection.
Is there any workaround? I can place the camera really far away but I am concerned that there might be pathological cases where the SLAM system loses tracking and repositions itself near the ortho camera, as unlikely as that may be.
Just to elaborate further: it looks like layers are not being respected at all. The 2D image that is a child of the orthographic camera renders in the 3D camera as well if positioned at the world origin and when I tried creating a new layer for the 3D content, playing one mesh on that layer, both the ortho and perspective cameras continued to render *all* layers.
Things seem to work in Lens Studio's preview -- the failures are all in the Snap app.
Hi Bart,
That does sound like a bug to me. One thing you could try in the meantime is to output each camera/layer combo to a separate render target. I'm not entirely sure that will solve your problem, but it is worth a shot. So create a new render target for the perspective camera, and then on the orthographic camera change the clear color option to texture and use that new render target as the input texture.
Hi modelsbymike3d -- thanks for the response. I tried this but I'm not sure if I'm doing it right. I created a second "Render Target Ortho" and made sure the ortho camera renders to that. The clear color on this render target is a texture set to the perspective camera's original render target.
The render order for the ortho camera wasn't changed. See attached screenshots.
I usually set the clear color of the camera rather than the render target. I think even if you set the clear color of the render target, the camera might be setting the clear color to something else.
And since the render target feeds into the orthographic camera, I do recommend reordering them in the Scene Config (you can click the three dots to the left and drag to reorder). For some lenses that ordering is important, for others it isn't so you might be fine without reordering.