How can I bake camera occlusion? I'm perfectly willing to entertain answers like, "You shouldn't, do it like this instead," so I'll explain my ultimate goal.

I've been working on a model in Blender, including materials, and I'd like to prepare textures for use in a different, much more primitive engine.  Because I've been building for Blender appearance, I would like to use renders from orthographic cameras (starting with 6, but we'll see) to build a texture up on an unwrapped UV.

My problem is concavity.  Some areas of the model will be occluded from any given camera-- from all cameras.  I can manage that by separating these faces out, but I'll need to know which ones.  The ideal way for me to know would be to have a texture on my unwrapped UV that represented whether a given pixel was visible to the camera (or any proxy for it), in a black-or-white fashion, no grayscale, so that I could feed that into a nodes setup to integrate all of my renders into a final image.

Is there some way that I can create a material that returns white if and only if it is visible from a given position with an orthographic perspective?  Obviously, I can do this just fine for the render-- everything that renders is visible and everything that doesn't, isn't-- but I need it mapped to my model's unwrapped UV coordinates, like a bake.
From what I gather, you want a pure black and white mask for face visibility.

If this is purely a geometric issue then a face (triangle) will either be visible or not. You could probably get away with a fairly accurate representation without needing any rendering.

With that in mind then you could just place the 3D viewport at the correct view angle with an orthographic camera.
With the border selection tool select all object faces. If you have the Limit Selection to Visible option enabled, occluded geometry wont be included.
You may have to triangulate your mesh beforehand if partial visibility is an issue, like if you have many NGons or highly distorted quads.

From then on, with the selection at hand you can do whatever you want with it.

Either give them a different material and OpenGL render the viewport, texture paint it, export its UV map and paint it in an external editing application, etc.



Alternatively if you require partial per-face visibility you could try texture painting it from a certain viewpoint.