2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ How about removing all lights, then replace all camera positions with extremely strong point lights and (if in cycles) disable multiple bounces by setting them to 1. Bake only diffuse in sRGB colorspace and you should get completely black areas, where the lights don't reach. Then you'd have that information on a texture (which was the goal, right? $\endgroup$ – Leander Jun 22 '18 at 8:16
  • $\begingroup$ @Leander That is an option, although not ideal. The point lights will give me occlusion from perspective, when I need occlusion from ortho. (Although maybe I don't need to do ortho, not sure, haven't considered that.) And using a plane light would light areas that were occluded from the ortho render. $\endgroup$ – Nathan Jun 22 '18 at 8:31
  • $\begingroup$ Use a sun light. $\endgroup$ – Leander Jun 22 '18 at 8:33
  • $\begingroup$ @ Leander Duh. That might just do it :) $\endgroup$ – Nathan Jun 22 '18 at 8:35
1
$\begingroup$

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.

enter image description here

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

$\endgroup$
  • $\begingroup$ Thanks, I've tried this before, but didn't consider triangulation. However, for whatever reason, a box select from a distance does not select all the appropriate faces-- I need to zoom in on the object past where I can select it in one big box, which leaves me vulnerable to making a mistake and distrustful of the technique even when zoomed in. $\endgroup$ – Nathan Jun 22 '18 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.