object raycast only returns the original face index for evaluated meshes of objects with mirror modifiers #86766

Closed
opened 2021-03-20 18:36:59 +01:00 by MACHIN3 · 9 comments

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: 02948a2cab
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.
obj_raycast_mirror_mod_evaluated_mesh_face_index.blend

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
**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: `02948a2cab` 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. [obj_raycast_mirror_mod_evaluated_mesh_face_index.blend](https://archive.blender.org/developer/F9901137/obj_raycast_mirror_mod_evaluated_mesh_face_index.blend) 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
Author

Added subscriber: @MACHIN3

Added subscriber: @MACHIN3
Member

Added subscriber: @filedescriptor

Added subscriber: @filedescriptor
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

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

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

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Currently the original index is looked up, we could optionally support returning the final index.
See: rna_Object_ray_cast

Setting as TODO.

Currently the original index is looked up, we could optionally support returning the final index. See: `rna_Object_ray_cast` Setting as TODO.
Campbell Barton changed title from object raycast returns wrong face index for evaluated meshes of objects with mirror modifiers to object raycast only returns the original face index for evaluated meshes of objects with mirror modifiers 2021-04-22 10:20:21 +02:00
Author

Returning the final index is what I would expect yes. It already does return the final distance, location and normal. For boolean mods it also already returns the final index too, hence why I was caught off guard, when getting these results for mirror(and potentially other?) mods.

Current workarounds to get the final index are inefficient.

Returning the final index is what I would expect yes. It already does return the final distance, location and normal. For boolean mods it also already returns the final index too, hence why I was caught off guard, when getting these results for mirror(and potentially other?) mods. Current workarounds to get the final index are inefficient.
Author

FWIW, scene.ray_cast does not have these issues either.

FWIW, scene.ray_cast does not have these issues either.
Philipp Oeser removed the
Interest
Python API
label 2023-02-10 09:04:39 +01:00

This is an effect of the same issue described in #72113

So I'll merge the reports.

This is an effect of the same issue described in #72113 So I'll merge the reports.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-09-15 18:11:31 +02:00
Germano Cavalcante added
Status
Duplicate
and removed
Status
Archived
labels 2023-09-15 18:11:40 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#86766
No description provided.