I want to select the front face, but I don’t want to select the back face


enter image description here


enter image description here


enter image description here

How to ignore the back? The backside culling is useless.

  • $\begingroup$ What are you asking? Do you want to hide backface? Do you want to remove them from selection? $\endgroup$
    – Crantisz
    Oct 8, 2021 at 10:38
  • $\begingroup$ @Crantisz I want to select the front face, but I don’t want to select the back face $\endgroup$ Oct 8, 2021 at 12:41
  • $\begingroup$ It looks like you have x ray mode on. What happens if you use bpy.ops.view3d.toggle_xray() just before you do the select? $\endgroup$ Oct 8, 2021 at 14:57

1 Answer 1


This will select the front-facing faces of the selected object.

Conditions :

  • You must be in OBJECT mode.
  • Your object must be a MESH object.
  • You workspace must contain at least a 3D viewport editor.

You'll have to learn a bit about the dot product : https://en.wikipedia.org/wiki/Dot_product

import bpy
import mathutils

mesh = bpy.context.object.data  # Retrieve the mesh
normals = [p.normal for p in mesh.polygons]  # Compute polygon normals

# Compute the view direction
up = mathutils.Vector((0.0, 0.0, 1.0))
view3d_area = next(a for a in bpy.context.screen.areas if a.ui_type == 'VIEW_3D')
trans_world = (view3d_area.spaces.active.region_3d.view_matrix.inverted()).to_3x3() @ up

# Unselect the mesh elements
for v in mesh.vertices:
    v.select = False
for e in mesh.edges:
    e.select = False
for i, normal in enumerate(normals):
    # Select the front facing faces
    mesh.polygons[i].select = trans_world.dot(normal) >= 0

enter image description here

Related Automated way to make "Select interior faces" ignore select faces that are visible to the camera?


You must log in to answer this question.

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