4
$\begingroup$

Background

Using Blender 4.1 and a wireframe modifier to project a mountain mesh as a blueprint. Subterranean structures must remain visible. I'd like to remove parts of the mountain that aren't directly observable from the camera's perspective. Consider:

Subterranean Objects

Setup

Modifiers:

Modifiers

Ignore the topmost modifier.

The Geometry Nodes:

Node Setup

The node setup, which uses the dot product of the camera and the mesh normals, removes the majority of hidden faces.

Problem

Using the normals doesn't eliminate all faces that would be invisible from the camera's perspective, as shown here:

Mesh Topology

When rendered, faces from behind the mountain are appear as a broad white band:

Render Topology

I'd like to eliminate that white band.

Idea

Here's the node setup for raycasting:

Raycasting

That setup doesn't delete any vertices, despite the lines showing an intersection of the rays and the mesh:

Raycast Lines

Manual

Here are the steps taken by hand to achieve the desired effect, using the Blender 2.9 keyboard hotkeys:

  1. Select the mesh.
  2. Press NUM 0 to change to the camera's view.
  3. Press TAB to enter edit mode.
  4. Press a to deselect all vertices.
  5. Press b to enter vertex selection mode.
  6. Click and drag to select all visible mesh vertices.
  7. Assign to a vertex group.
  8. Add a mask modifier.
  9. Assign the vertex group to the mask modifier.

While this works, an automated way would be most welcome.

Question

How would you render a mesh wireframe such that all occluded faces are not rendered (i.e., the occluded wireframe is suppressed) while objects inside the mesh may be seen?

I'm using Geometry Nodes but other solutions are welcome.

$\endgroup$
7
  • 1
    $\begingroup$ you could use the raycast node and shoot from each face position to the camera (e.g. make a dummy plane there) and if it hits the plane, you could delete the face....but...if faces are bigger you will "see" in the render that there are missing faces at "edge conditions" where e.g. a mountain is in between. I think GN isn't a good choice to do that tbh. I would go with a shader for that. Is there a special reason why you wanna use GN? $\endgroup$
    – Chris
    Commented Jun 15 at 10:24
  • $\begingroup$ GNs aren't required. I couldn't get the plane solution (youtube.com/watch?v=KoLF99PFLFM) to work. Do you know of any wireframe shaders that can accomplish this task? $\endgroup$ Commented Jun 15 at 19:07
  • $\begingroup$ Maybe render both the wireframe and the original geometry, and use a holdout shader on the original geometry? The downside here is that you will display only half of the wireframe, but maybe that's enough - otherwise you could use something like solidify or displace to push the wireframe a little above geometry, or hide geometry a little below wireframe. In the end of the day the solution will depend on nuances like do you want to show wireframe, when the spawning geo is occluded, but barely, and so the wireframe stick out? $\endgroup$ Commented Jun 16 at 0:33
  • $\begingroup$ The simpler question is this: What node setup deletes vertices occluded from the camera? (That is, ignore the part about the wireframe, that's pretty much solved.) $\endgroup$ Commented Jun 16 at 1:22
  • 1
    $\begingroup$ This might be helpful: blender.stackexchange.com/questions/268525 $\endgroup$
    – quellenform
    Commented Jun 16 at 11:11

1 Answer 1

3
$\begingroup$

The raycast setup is very simple:

As mentioned first by Chris later by me in comments, the effect is not ideal, because it works on vertices and doesn't cut edges/faces:

Perhaps the resolution is satisfying enough, however, because it happens far enough, or the mesh is subdivided well enough:

But for wireframe modifier typically you want low poly so I don't know... Maybe you could use simple subdivision and then keep only edges that where there before subdivision:

I use a 0-extrusion hack as a quick workaround for the wireframe modifier requiring faces, but you try better workarounds...

This is an x-ray mode both to show the wireframe is not visible behind the Occluder Monke, and to get rid of artifacts caused by doubled wireframe (which you could try to mitigate with Weld modifier maybe).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .