Page MenuHome

object raycast returns wrong face index for evaluated meshes of objects with mirror modifiers
Confirmed, NormalPublic

Description

System Information
Operating system: Linux-4.15.0-136-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.39

Blender Version
Broken: version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: rB02948a2cab44
Worked: -

Short description of error
If you have and object with mirror modifiers and obj.raycast on them, the returned face index will be wrong, especially on the mirrored side. If the modifier uses bisect, the face index will be wrong on the original side as well.
I'm only aware of the mirror modifier doings this. For instance, I have boolean modifiers on the object in the sample scene, creating faces only present in the evaluated mesh, and those indices are returned correctly.

edit: The weld mod (if at the end of the stack) seems to be affected as well. Can report separately if necessary.

My current workaround is creating the evaluated meshes manually via bpy.data.meshes.new_from_object(obj.evaluated_get(dg), depsgraph=dg) and a BVH raycast, but that's not always practical, and I would really prefer doing this on the fly using obj.ray_cast(origin, direction, depsgraph=dg)

The supplied blend file, uses the "operator_modal_view3d_raycast.py" template with minimal modification.

demonstration:
https://www.youtube.com/watch?v=crbCdO6mItM

Exact steps for others to reproduce the error

  • open the blend file
  • run the script in the text editor
  • run the Raycast op from the search menu
  • click on various faces and compare the raycast results in the terminal to the text objects on the faces, indicating the correct indices on the evaluated mesh

Event Timeline

Falk David (filedescriptor) changed the task status from Needs Triage to Confirmed.Mon, Mar 22, 1:34 PM

I can confirm this issue on the latest 2.93.0 Alpha, branch: master, commit date: 2021-03-22 11:23, hash: rBc4c195672ddd.

MACHIN3 (MACHIN3) updated the task description. (Show Details)