UVs offsets when using displace-modifier #67523

Closed
opened 2019-07-23 15:51:09 +02:00 by Tobias Lijsen · 12 comments

System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 416.34

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-18 14:52, hash: 38d4483c6a
Worked: (optional)

Short description of error
grids UVs offsets when using displace-modifier - in UV-Editing everything looks fine

Exact steps for others to reproduce the error
add > mesh > grid
F9 > grids subdivisions > X=1000 Y=1000
N > Dimension X=1.0 Y=0.8
STRG+A > apply scale
new Modifier > add DISPLACE
Displace Mod > NEW Texture > and switch to Texture-Props
Open the Image Texture (see attached file)
Switch back to Modifier-Props
Displace-Mod > set Texture-Coordinates to UV

Tex-Coordinates are offset in X by Factor 0.5 - in UV-Editing everything looks fine - in 3D UVs are offset

Schleife-2.tiff

**System Information** Operating system: Windows-7-6.1.7601-SP1 64 Bits Graphics card: GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 416.34 **Blender Version** Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-18 14:52, hash: `38d4483c6a` Worked: (optional) **Short description of error** grids UVs offsets when using displace-modifier - in UV-Editing everything looks fine **Exact steps for others to reproduce the error** add > mesh > grid F9 > grids subdivisions > X=1000 Y=1000 N > Dimension X=1.0 Y=0.8 STRG+A > apply scale new Modifier > add DISPLACE Displace Mod > NEW Texture > and switch to Texture-Props Open the Image Texture (see attached file) Switch back to Modifier-Props Displace-Mod > set Texture-Coordinates to UV Tex-Coordinates are offset in X by Factor 0.5 - in UV-Editing everything looks fine - in 3D UVs are offset ![Schleife-2.tiff](https://archive.blender.org/developer/F7624795/Schleife-2.tiff)
Author

Added subscriber: @blenderhilfe

Added subscriber: @blenderhilfe

Added subscriber: @WilliamReynish

Added subscriber: @WilliamReynish

I cannot reproduce this. Can you create a demo blend file that demonstrates this issue?

I cannot reproduce this. Can you create a demo blend file that demonstrates this issue?
Author

Okay, blend file attached.
Here u see the Error in Action, switch to EditMode and you see UVs are straight... mapping is messed up.

INFO: i got the error an all different machines...

UV_Problem1.blend

Okay, blend file attached. Here u see the Error in Action, switch to EditMode and you see UVs are straight... mapping is messed up. INFO: i got the error an all different machines... [UV_Problem1.blend](https://archive.blender.org/developer/F7628193/UV_Problem1.blend)

I don't understand how you created that object, since you have applied the modifiers.

When I unwrap it using UV > Unwrap from View (Bounds), it works normally. So how you got those wrong UV coords it's impossible to say.

I don't understand how you created that object, since you have applied the modifiers. When I unwrap it using UV > Unwrap from View (Bounds), it works normally. So how you got those wrong UV coords it's impossible to say.
Campbell Barton was assigned by William Reynish 2019-07-25 18:36:05 +02:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Ah, I have now been able to reproduce this issue.

Turns out it has nothing at all to do with the displace modifier - the issue is that the Grid primitive's auto-generated UV's go bad if you have more than around 300 segments.

200 segments:
Screenshot 2019-07-25 at 18.32.56.png

300 segments:
Screenshot 2019-07-25 at 18.33.14.png

@ideasman42 assigned to you but feel free to re-assign. I assume it's a precision issue somewhere.

Ah, I have now been able to reproduce this issue. Turns out it has nothing at all to do with the displace modifier - the issue is that the Grid primitive's auto-generated UV's go bad if you have more than around 300 segments. 200 segments: ![Screenshot 2019-07-25 at 18.32.56.png](https://archive.blender.org/developer/F7628406/Screenshot_2019-07-25_at_18.32.56.png) 300 segments: ![Screenshot 2019-07-25 at 18.33.14.png](https://archive.blender.org/developer/F7628408/Screenshot_2019-07-25_at_18.33.14.png) @ideasman42 assigned to you but feel free to re-assign. I assume it's a precision issue somewhere.

Added subscriber: @matc

Added subscriber: @matc

The smallest one I could find is 13 by 3.

bpy.ops.mesh.primitive_grid_add(x_subdivisions=13, y_subdivisions=3, enter_editmode=False)

13x3.png

The smallest one I could find is 13 by 3. `bpy.ops.mesh.primitive_grid_add(x_subdivisions=13, y_subdivisions=3, enter_editmode=False)` ![13x3.png](https://archive.blender.org/developer/F7629235/13x3.png)

This should solve the problem. An alternative would be to introduce a counter.

diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index cf3d6b8bf56..bea437d63d0 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -807,6 +807,7 @@ void BM_mesh_calc_uvs_grid(BMesh *bm,

   const float dx = 1.0f / (float)(x_segments - 1);
   const float dy = 1.0f / (float)(y_segments - 1);
+  const float dx_half = dx / 2.0f;
   float x = 0.0f;
   float y = dy;

@@ -844,7 +845,7 @@ void BM_mesh_calc_uvs_grid(BMesh *bm,
     }

     x += dx;
-    if (x >= 1.0f) {
+    if (x + dx_half >= 1.0) {
       x = 0.0f;
       y += dy;
     }


This should solve the problem. An alternative would be to introduce a counter. ``` diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index cf3d6b8bf56..bea437d63d0 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -807,6 +807,7 @@ void BM_mesh_calc_uvs_grid(BMesh *bm, const float dx = 1.0f / (float)(x_segments - 1); const float dy = 1.0f / (float)(y_segments - 1); + const float dx_half = dx / 2.0f; float x = 0.0f; float y = dy; @@ -844,7 +845,7 @@ void BM_mesh_calc_uvs_grid(BMesh *bm, } x += dx; - if (x >= 1.0f) { + if (x + dx_half >= 1.0) { x = 0.0f; y += dy; } ```

This issue was referenced by a542f50b51

This issue was referenced by a542f50b51af0167acc55d4cf2b06490a704ce93

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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#67523
No description provided.