Blender 2.78 can't render a plane with subdivision surface, displacement modifier & normal map on it #49523

Closed
opened 2016-10-01 16:56:32 +02:00 by Syntex · 15 comments

System Information
OS: Windows 10
GPU: GTX 1080
CPU: intel i7 5820k
RAM: 32gb
drivers: GeForce Game Ready Driver version 372.90
system-info.txt

Blender Version
Broken: 2.78
Worked: 2.78 release candidate v2

Short description of error
Blender cycles won't render a subdivided plane with displacement modifier & normal map on it. The program goes unresponsive or gets stuck when using either GPU or CPU to render it & won't close unless closed from task manager. I rendered a scene that had the same plane in it with 2.78 release candidate v2 and it worked fine.

Open the .blend file, press render and it won't render the image. If you use the preview render in viewport, it will say Blender is not responding at the top left corner. You can't cancel the render either.
BUG.blend

Exact steps for others to reproduce the error
Add a plane, scale it up > CTRL+A > appply scale. subdivide it 100 times in edit mode using w > subdivide. Add a subdivision surface with subdiv level 2 or 3. Then add a displacement modifier & a 4k displacement texture. It will still render it just fine. Then add a diffuse material. Add a normal map node & an image texture node with non-color data. Add a 4k normal map texture to the image texture node & connect it to the normal map's color input. Then connect the normal map node's output to the normal input of the diffuse shader. Try to render the scene > it gets stuck and won't render. If you change the viewport to rendered, blender stops responding & you have to close it from task manager.
reproduced_bug.blend

**System Information** OS: Windows 10 GPU: GTX 1080 CPU: intel i7 5820k RAM: 32gb drivers: GeForce Game Ready Driver version 372.90 [system-info.txt](https://archive.blender.org/developer/F372213/system-info.txt) **Blender Version** Broken: 2.78 Worked: 2.78 release candidate v2 **Short description of error** Blender cycles won't render a subdivided plane with displacement modifier & normal map on it. The program goes unresponsive or gets stuck when using either GPU or CPU to render it & won't close unless closed from task manager. I rendered a scene that had the same plane in it with 2.78 release candidate v2 and it worked fine. Open the .blend file, press render and it won't render the image. If you use the preview render in viewport, it will say Blender is not responding at the top left corner. You can't cancel the render either. [BUG.blend](https://archive.blender.org/developer/F372206/BUG.blend) **Exact steps for others to reproduce the error** Add a plane, scale it up > CTRL+A > appply scale. subdivide it 100 times in edit mode using w > subdivide. Add a subdivision surface with subdiv level 2 or 3. Then add a displacement modifier & a 4k displacement texture. It will still render it just fine. Then add a diffuse material. Add a normal map node & an image texture node with non-color data. Add a 4k normal map texture to the image texture node & connect it to the normal map's color input. Then connect the normal map node's output to the normal input of the diffuse shader. Try to render the scene > it gets stuck and won't render. If you change the viewport to rendered, blender stops responding & you have to close it from task manager. [reproduced_bug.blend](https://archive.blender.org/developer/F372220/reproduced_bug.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @Syntex3D

Added subscriber: @Syntex3D

#49576 was marked as duplicate of this issue

#49576 was marked as duplicate of this issue
Member

Closed as duplicate of #49472

Closed as duplicate of #49472
Author

Changed status from 'Duplicate' to: 'Open'

Changed status from 'Duplicate' to: 'Open'
Syntex reopened this issue 2016-10-01 17:08:03 +02:00
Author

I used normal subsurf modifier, not adaptive subsurf & the material is not black. This is not a duplicate of that bug

I used normal subsurf modifier, not adaptive subsurf & the material is not black. This is not a duplicate of that bug

Added subscriber: @Sergey

Added subscriber: @Sergey
Sergey Sharybin self-assigned this 2016-10-05 10:56:36 +02:00

Can reproduce the error on Windows. Doesn't happen on Linux tho. Indeed 2,78-rc2 synchronizes the scene quite fast while 2.78 release is getting stuck.

Something weird, will dig into!

Can reproduce the error on Windows. Doesn't happen on Linux tho. Indeed 2,78-rc2 synchronizes the scene quite fast while 2.78 release is getting stuck. Something weird, will dig into!

Added subscriber: @brecht

Added subscriber: @brecht

@brecht, this is caused by recent mikkspace fix from you. There seems to be some really suspecious code around "else" when updating min/max value. Leaving it out seemsto be more clear. But unfortunately, this particular bug seems to be a compiler bug of some sort. Here is a patch which works it arond:

P408: Fix for #49523

diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index 8d51816..8c74c68 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -579,13 +579,18 @@ static void MergeVertsFast(int piTriList_in_and_out- [ ], STmpVert pTmpVert- [ ], cons
 {
 	// make bbox
 	int c=0, l=0, channel=0;
-	float fvMin- [x] = {INFINITY, INFINITY, INFINITY};
-	float fvMax- [x] = {-INFINITY, -INFINITY, -INFINITY};
+	float fvMin- [x], fvMax[3];
 	float dx=0, dy=0, dz=0, fSep=0;
-	for (l=iL_in; l<=iR_in; l++)
-		for (c=0; c<3; c++)
+	for (c=0; c<3; c++) {
+		fvMin- [x] = min(pTmpVert[iL_in].vert- [x], INFINITY);
+		fvMax- [x] = fvMin[c];
+	}
+	for (l=(iL_in+1); l<=iR_in; l++) {
+		for (c=0; c<3; c++) {
 			if (fvMin- [x]>pTmpVert- [x].vert- [x]) fvMin- [x]=pTmpVert- [x].vert[c];
-			else if (fvMax- [x]<pTmpVert- [x].vert- [x]) fvMax- [x]=pTmpVert- [x].vert[c];
+			if (fvMax- [x]<pTmpVert- [x].vert- [x]) fvMax- [x]=pTmpVert- [x].vert[c];
+		}
+	}
 
 	dx = fvMax- [x]-fvMin[0];
 	dy = fvMax- [x]-fvMin[1];

But can't doublecheck whether the initial report you've been fixing here is still fixed (for some reason reverting the fix does not cause any crashes or anytthing).

Mind having a second glance perhaps?

@brecht, this is caused by recent mikkspace fix from you. There seems to be some really suspecious code around "else" when updating min/max value. Leaving it out seemsto be more clear. But unfortunately, this particular bug seems to be a compiler bug of some sort. Here is a patch which works it arond: [P408: Fix for #49523](https://archive.blender.org/developer/P408.txt) ``` diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c index 8d51816..8c74c68 100644 --- a/intern/mikktspace/mikktspace.c +++ b/intern/mikktspace/mikktspace.c @@ -579,13 +579,18 @@ static void MergeVertsFast(int piTriList_in_and_out- [ ], STmpVert pTmpVert- [ ], cons { // make bbox int c=0, l=0, channel=0; - float fvMin- [x] = {INFINITY, INFINITY, INFINITY}; - float fvMax- [x] = {-INFINITY, -INFINITY, -INFINITY}; + float fvMin- [x], fvMax[3]; float dx=0, dy=0, dz=0, fSep=0; - for (l=iL_in; l<=iR_in; l++) - for (c=0; c<3; c++) + for (c=0; c<3; c++) { + fvMin- [x] = min(pTmpVert[iL_in].vert- [x], INFINITY); + fvMax- [x] = fvMin[c]; + } + for (l=(iL_in+1); l<=iR_in; l++) { + for (c=0; c<3; c++) { if (fvMin- [x]>pTmpVert- [x].vert- [x]) fvMin- [x]=pTmpVert- [x].vert[c]; - else if (fvMax- [x]<pTmpVert- [x].vert- [x]) fvMax- [x]=pTmpVert- [x].vert[c]; + if (fvMax- [x]<pTmpVert- [x].vert- [x]) fvMax- [x]=pTmpVert- [x].vert[c]; + } + } dx = fvMax- [x]-fvMin[0]; dy = fvMax- [x]-fvMin[1]; ``` But can't doublecheck whether the initial report you've been fixing here is still fixed (for some reason reverting the fix does not cause any crashes or anytthing). Mind having a second glance perhaps?

Added subscriber: @jkmonsun

Added subscriber: @jkmonsun

This issue was referenced by 5a0f397eaa

This issue was referenced by 5a0f397eaa6b5c05a6d312617eeebd96e977fa80

It's odd, the else indeed shouldn't have been there but not sure why this is happening. Restoring it to work more like the old code seems to fix it, so I committed that. I left out the min() since I don't think it's needed.

It's odd, the `else` indeed shouldn't have been there but not sure why this is happening. Restoring it to work more like the old code seems to fix it, so I committed that. I left out the `min()` since I don't think it's needed.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

@brecht, seems to be some sort of compiler issue. I remember having similar crazy thing happening, but that was caused by code area not having SSE2 flag and which tried to use SSE2 function.. But nowadays SSE2 is enabled globally. Also didn't see anything odd with CFLAGS or anything. Would be interesting to see if the issue happens with MSVC2015, but it'll take forever for me to test that on my laptop, so can't be bothered right now. It also didn't happen in debug builds and in release builds on Linux.

Thanks for giving an extra help here!

@brecht, seems to be some sort of compiler issue. I remember having similar crazy thing happening, but that was caused by code area not having SSE2 flag and which tried to use SSE2 function.. But nowadays SSE2 is enabled globally. Also didn't see anything odd with CFLAGS or anything. Would be interesting to see if the issue happens with MSVC2015, but it'll take forever for me to test that on my laptop, so can't be bothered right now. It also didn't happen in debug builds and in release builds on Linux. Thanks for giving an extra help here!
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#49523
No description provided.