Perspective camera ignores depth on render texture?

I have an XY-aligned GUI with an ortho camera, and I added a perspective camera and render texture to preview 3D models on a separate layer. And of course, the RT material just goes on a quad on the ortho camera’s layer.

The model was too small in the preview, so I moved the RT camera closer to the model… and nothing changed.

If I move the model on the X and Y axis, or if I change the RT camera XY, the image shifts around as you’d expect. But no matter where I position the model or camera on the Z axis, nothing changes. I’ve also played around with the camera’s FOV and it has no effect.

In fact, I can change the RT camera’s Z position so that the model is behind the camera, and it still renders.

Also, Z and FOV changes do show up in the RT camera’s editor preview – they just don’t change anything in the actual Render Texture.

What the heck is going on here???

(I also have several models that don’t render at all, for some reason. They’re set up right and I can see them in scene view when they’re activated, but the RT is blank. Even weirder, they’re actually copies (placeholders) of models that do render, which is very confusing. I’m guessing whatever fixes the first problem will probably fix this other one, though.)

(Also, changing the model scale does change the size in the RT, but I don’t want to do that.)

This is on Unity 5.5.0p1.

Well that was dumb.

A) I forgot to scale the quad, so it was tiny compared to my ortho GUI.

B) I forgot Unity “helpfully” adds every new layer to the main camera, so the ortho camera was also rendering the ship models… and hiding my very tiny quad in the process.

Success!

1 Like