Grid Fill is generating mesh that's inconsistent with selected edge loops #39210

Closed
opened 2014-03-16 05:26:22 +01:00 by Yan Shi · 12 comments

System Information
Ubuntu 13.10 with nVidia GeForce GT 630M

Blender Version
Broken: 2.70 36279af

Short description of error

After invoking grid fill on 2 parallel edge loops the generated mesh does not connect the two loops straightly but instead forms a distorted shape.

Exact steps for others to reproduce the error

  • Open the attached .blend file example.blend
  • Invoke grid fill with CTRL-F G

Comment

I've done my side of investigation. This behaviour can only be observed when the surface normal of the interpolated face is [0 0 -1].
It seems that the C function rotation_between_vecs_to_quat doesn't handle the degenerative case in which 2 vectors are parallel to each other correctly.

**System Information** Ubuntu 13.10 with nVidia GeForce GT 630M **Blender Version** Broken: 2.70 36279af **Short description of error** After invoking grid fill on 2 parallel edge loops the generated mesh does not connect the two loops straightly but instead forms a distorted shape. **Exact steps for others to reproduce the error** - Open the attached .blend file [example.blend](https://archive.blender.org/developer/F81343/example.blend) - Invoke grid fill with CTRL-F G **Comment** I've done my side of investigation. This behaviour can only be observed when the surface normal of the interpolated face is [0 0 -1]. It seems that the C function rotation_between_vecs_to_quat doesn't handle the degenerative case in which 2 vectors are parallel to each other correctly.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @ian.shi

Added subscriber: @ian.shi

Added subscriber: @ignatz

Added subscriber: @ignatz

I can confirm that behaviour on my system. (Windows 7 Pro - Blender 2.70 - hash 2aff243

Starting from the edges already selected in the example file, the grid fill operation produces the incorrect result seen in the first image file "grid-fill extra 00.jpg"

Just out of curiousity, I ran the operation again, but using the other set of edges perpendicular to the first set. In this case grid fill worked as expected. Image "grid-fill extra 01.jpg"

grid-fill_extra_00.jpg

grid-fill_extra_01.jpg

I can confirm that behaviour on my system. (Windows 7 Pro - Blender 2.70 - hash 2aff243 Starting from the edges already selected in the example file, the grid fill operation produces the incorrect result seen in the first image file "grid-fill extra 00.jpg" Just out of curiousity, I ran the operation again, but using the other set of edges perpendicular to the first set. In this case grid fill worked as expected. Image "grid-fill extra 01.jpg" ![grid-fill_extra_00.jpg](https://archive.blender.org/developer/F81359/grid-fill_extra_00.jpg) ![grid-fill_extra_01.jpg](https://archive.blender.org/developer/F81358/grid-fill_extra_01.jpg)

Added subscriber: @mont29

Added subscriber: @mont29

Added subscriber: @ideasman42

Added subscriber: @ideasman42

@ian.shi: thanks a lot for this investigation, saved me some time! :)

Here is a proposed code for rotation_between_vecs_to_quat(), which fixes the issue:

void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
{
	float axis[3];
	float angle;

	cross_v3_v3v3(axis, v1, v2);

	if (len_squared_v3(axis) < FLT_EPSILON) {
		if (dot_v3v3(v1, v2) < 0.0f) {
			/* Colinear but opposed vectors, 180 rotation... */
			float a2[3];
			ortho_basis_v3v3_v3(axis, a2, v1);
			axis_angle_to_quat(q, axis, (float)M_PI);
		}
		else {
			/* Same vectors, zero rotation... */
			unit_qt(q);
		}
	}
	else {
		angle = angle_normalized_v3v3(v1, v2);

		axis_angle_to_quat(q, axis, angle);
	}
}
@ian.shi: thanks a lot for this investigation, saved me some time! :) Here is a proposed code for `rotation_between_vecs_to_quat()`, which fixes the issue: ``` void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3]) { float axis[3]; float angle; cross_v3_v3v3(axis, v1, v2); if (len_squared_v3(axis) < FLT_EPSILON) { if (dot_v3v3(v1, v2) < 0.0f) { /* Colinear but opposed vectors, 180 rotation... */ float a2[3]; ortho_basis_v3v3_v3(axis, a2, v1); axis_angle_to_quat(q, axis, (float)M_PI); } else { /* Same vectors, zero rotation... */ unit_qt(q); } } else { angle = angle_normalized_v3v3(v1, v2); axis_angle_to_quat(q, axis, angle); } }
Bastien Montagne self-assigned this 2014-03-16 09:22:10 +01:00

@mont29, nice fix, suggest replacing ortho_basis_v3v3_v3 with a simpler function though,

@mont29, nice fix, suggest replacing `ortho_basis_v3v3_v3` with a simpler function though,

This issue was referenced by blender/blender-addons-contrib@0e9084d5ec

This issue was referenced by blender/blender-addons-contrib@0e9084d5ece71185884d7a63b3e0617254430a29

This issue was referenced by 0e9084d5ec

This issue was referenced by 0e9084d5ece71185884d7a63b3e0617254430a29

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 0e9084d5ec.

Closed by commit 0e9084d5ec.
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
5 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#39210
No description provided.