Face snapping fails on Orthographic view #38358
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#38358
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
openSUSE 12.3 64bits
NVIDIA 480GTX SC
Blender Version
Broken: Blender 2.69.10
c0a4089
Short description of error
Face snapping in Blender fails constantly on Orthographic view. Basically it snaps to the back faces of the model.
This problem has always existed in the raytraced snapping. I never reported it because I thought it was unfortunate but normal since I always work in orthographic mode. However I just recently noticed how in perspective mode it works flawlessly!
Exact steps for others to reproduce the error
Open Snap.blend
Slowly move X arrow to the right
Suddenly the vertex snaps to the back surface!
Changed status to: 'Open'
Added subscriber: @zanqdo
Added subscriber: @mont29
Added subscribers: @ideasman42, @brecht
Ok, so issue seems to be in ray/tri intersection code… I made some prints (the cursor is over face 3641, but very close to the boundary with face 3640, ~0.001BU away), r_loc is the intersection point found (i.e. the result):
Good result (i.e. intersection with face 3641 detected):
Next check (just a tad closer to boundary, but still over 3641): bad result (i.e. intersection with neither face 3641 nor 3640 detected):
As far as I can see, it’s another stupid precision issue, I’d say caused by the fact that the org point of ray in ortho view is rather far away (~ 940BU here), while in perspective it is much closer. This is due to
ED_view3d_win_to_segment()
(in view3d_project.c), which places org point at 1000 when in ortho view. Setting this value to e.g. 10.0f indeed fixes the issue.Not sure what we can/want to do here, perhaps switch to double, @brecht, @ideasman42, ideas?
Doubles would be enough to solve this problem I think, they need to propagate pretty far then though since snapping uses a BVH tree and all that code uses floats.
Another possibility would be to to return different values than ray start/end position from
ED_view3d_win_to_segment
. Inmadd_v3_v3v3fl(r_ray_start, vec, rv3d->viewinv- [x], 1000.0f);
it does small valuevec
+ large valuerv3d->viewinv- [x] * 1000.0f
, which causes the small value to be rounded away and precision lost.If you return a ray position (
vec
), ray direction (rv3d->viewinv- [x]
) and ray start/end distance (1000.0f
and-1000.0f
) and use those directly in the intersection function, then you would avoid the precision issue here.If you're lucky you can just modify
ED_view3d_win_to_ray
to use those values and it works, by getting a more accurate ray direction, but I'm not sure it's enough.If it's not enough, you end up with a similar issue as doubles though, in that you'll need to modify more code. You would need to carefully ensure the snapping/BVH code can handle a ray distance start/end range with the start distance negative, instead of just a single positive distance starting from 0.0 at the ray start.
Thanks for those hints, @brecht.
I can confirm having a better dir is not enough to fix the issue… I’ll have a look at modifying bvh & co to handle orco + offset, and also check knife code more in depth (Howard had a similar issue, which he fixed by bounding min/max to the object's limits… would avoid me the need to modify bvh & co). No small change in any case.
This issue was referenced by blender/blender-addons-contrib@77089a3bf2
This issue was referenced by
77089a3bf2
Changed status from 'Open' to: 'Resolved'
Closed by commit
77089a3bf2
.@mont29 That's awesome, game changer for me! However my original test file Snap.blend stopped working for some reason! It wont snap. I can't reproduce in a new file tough.
Changed status from 'Resolved' to: 'Open'
This issue was referenced by blender/blender-addons-contrib@810c6d1880
This issue was referenced by
810c6d1880
Changed status from 'Open' to: 'Resolved'
Closed by commit
810c6d1880
.