WIP: Snap Individual: improvements with mixed Face Nearest and Face Project #116149
No reviewers
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116149
Loading…
Reference in New Issue
No description provided.
Delete Branch "mano-wii/blender:transform_mixed"
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?
When Individual Face Project is enabled, occluded elements being
transformed are moved in front of the occluding object.
This is old behavior, and may even be desirable in some cases.
But when we enable Face Nearest together, it seems to be more
advantageous to use Nearest for occluded elements.
Therefore, this commit changes the behavior of Face Project + Nearest
so that Nearest is used not only for elements that don't hit an object,
but also for elements that are occluded.
@blender-bot build
@blender-bot build package
Unknown platform
package
. See documentation for details.@blender-bot package
Package build started. Download here when ready.
Now I got it. Sorry :D
It's almost working well afaiks.
The snapping seems unstable and some selected elements fly off into infinity.
They flicker a lot. Maybe because the keep switching between Face Nearest or Projecting into the background?
Fixed.
I didn't know that I couldn't use
FLT_MAX
for maximum distance inED_transform_snap_object_project_ray_ex
. Must beBVH_RAYCAST_DIST_MAX
.@blender-bot package
Package build started. Download here when ready.
For the most part this already works exactly like expected and is a big timesaver!
But I still think comparing for example individual vertex normals of the selected mesh with the view angle could get us better results. Maybe you also have an idea @mano-wii ?
Here are some cases where the occlusion logic fails:
There are still regular cases where vertices along a loop cut will snap to something in the distance, because they were no longer on top of the part of the object right next to them. This will happen a lot on overlapping shapes.
There are also going to be lots of cases where the Face Nearest snapping is getting it wrong the first time and instead snaps to the backside of an object.
In that case the combined snapping won't fix this, since it's always occluded on the side it's supposed to be snapped to.
But when looking at the vertex normals, we can see that the vertex is roughly facing the view and verices along the rim of shapes are roughly at a right angle away from us.
The proposed solution of checking the normal of the vertices with the direction of the view and using some factor to decide between nearest or project adds a lot of complexity to the code since it would be necessary to store information about the original normals before the transformation.
To implement this, we would also have to consider other types of objects with transformable points:
And adds some questions:
From the point of view of someone who maintains the transform code, the benefit of this feature does not compensate for the complexity it would add to the code :\
Transform: Test occlusion in individual Face Project if Nearest is also enabledto WIP: Transform: Test occlusion in individual Face Project if Nearest is also enabledI think I found a solution.
If the angle created by: nearest position, original position, projected position, is greater than 45 degrees, use the nearest position.
This would be a generic solution that doesn't add much complexity.
It might be worth testing.
EDIT:
That sounds great! Let's try that.
In the case of Armatures, Curves, Metaballs and Lattices it would make sense to fall back on the current implementation of the PR. In general if there are points that we can't get a normal from.
The ideal factor is something to find out. I think it would be fine to land it as an experimental feature at first with a factor setting that the user can tweak. Once it's clear that there's an ideal setting, that can be the default and the setting can be removed.
I can be responsible for stress testing the feature.
In terms of benefits vs complexity it's hard to judge from my point of view.
I can only speak in favor of improving it further because the current state in
main
is very time consuming and frustrating and the current PR is still often leading to problematic results.Aren't there various edit mode operators that use the original normal of the selection? Shrink/Fatten as a direct example of using individual vertex normals.
54fef8d406
to18b6763490
I implemented the solution I had in mind.
It no longer depends on the normal, so it applies to all types of objects.
I made this ugly drawing to try to explain the solution:
One thing in this patch that perhaps deserves attention is the occlusion test.
Currently it is done with the transformed position without snapping (which can be a little unpredictable as the user may not know where the vertex would be without the snap).
Should the occlusion test only be done at the beginning to detect hidden vertices and therefore only have the nearest snap?
@blender-bot package
Package build started. Download here when ready.
I tested it for a bit. This update solves the core issue I pointed out!
As I see it this combined snapping will never lead to drastic position changes. And if the position changes a subtle it will use Projected snapping, which is more responsive 👍
Maybe there could be a better factor than 45 degrees? Right now it results in 'Face Nearest' snapping happening way more often.
If we want to fine tune this I'd love to tune the factor while testing and see a debug color overlay which vertex is using which snapping. But if that's too much time and effort we can stick to 45 degrees.
What do you think?
The update won't fix this issue:
But that ok. Temporarily disabling snapping or using a transform operator that doesn't use snapping can also fix those issues.
It's a bit hard to picture a case where the occlusion test really adds something to the new behavior.
Would there be any case where the surface that occludes the transformed position (basically same as projected position) is having an angle lower than 45 degrees to the nearest position? I find it hard to think of an example.
So maybe it doesn't matter.
@mano-wii Do you think we should do some more testing? Otherwise I'm also fine with merging the current state 👍
If the vertex is in front of the Mesh, it will almost always be Face Project, maybe what is happening is the occlusion?
With occlusion, if you move a vertex that is on the side of an object towards the object, the vertex moves to inside the object (occluded), so Nearest is used in this case.
The image below shows the case described. The black triangle at the bottom is the observer. The vertex (Green) is being moved in the direction indicated by the arrow.
In this case, the observer might expect the vertex to be projected onto the Mesh (gray) when the vertex passes through it.
But with this patch, technically the vertex is occluded and Face Nearest is being used instead of Face Project.
I'm not sure if this is desirable. Perhaps it's worth testing alternative solutions to occlusion. I have in mind a somewhat complex idea that involves checking distances and the direction of the snap movement (if the direction is opposite, use the Nearest; otherwise, check the distances and use the snap that is closer to the observer).
@mano-wii Ok I think I understand. I think the current implementation is good. Even on very complex models like the Skull of the Blender Base Meshes, the snapping never fails to snap to the correct surface.
That is the most important part.
One issue I could still point out is that once there's a switch in the snapping method on selected elements, it jumps drastically in position. This is a only bit jarring on single vertices. But on selected patches or loops of geometry this is problematic.
An idea to improve this: When the snapping method is switched to Nearest Face on at least one selected element, it's switched for the entire selection. A consistent transformation behavior across the selection is more predictable and useful.
18b6763490
tof0a5071e0a
I tested a different occlusion strategy, but it didn't really help. In the end I combined the two and it was the same thing.
You can test with the experimental options.
And you can test different angles:
@blender-bot package
Package build started. Download here when ready.
I don't really notice a difference between "Test Occlusion + Angle" and "Test Depth + Angle".
The angle of 45 degrees works really well. Anything above that leads to more snapping issues.
There are some cases where Projected snapping is used where I think it is exceeding the 45 degree value. Not sure what's happening here.
Lowering the angle can mitigate this but doesn't fully solve it.
f0a5071e0a
to08f3cd4b56
I've been thinking about solutions to the issue of inclusion, and I believe I've found a good one.
The rules for choosing the snap are:
@blender-bot package
Package build started. Download here when ready.
I hadn't seen that message!
However, it looks like there was an error in the previous code. The angle was inverted (bigger was smaller).
You can still edit the preferences and put 45 degrees back.
@mano-wii I tested it out a bit and the behavior is now the wrong way around. At directly view facing faces the Nearest snapping is used, while steep angles use the Projected snapping.
Also what do you think about my suggestion from a previous comment?
WIP: Transform: Test occlusion in individual Face Project if Nearest is also enabledto WIP: Snap Individual: improvements with mixed Face Nearest and Face ProjectCheckout
From your project repository, check out a new branch and test the changes.