New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blender 2.80 render crashes (EEVEE) (Feedback Wanted) #403

Open
rlguy opened this Issue Dec 12, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@rlguy
Copy link
Owner

rlguy commented Dec 12, 2018

Blender Version (including hash): Blender 2.80 (d415b5c7b85)
FLIP Fluids Version: 9.0.5.1 (Experimental)
Operating System: Windows 10
CPU: Intel Core i7-7700 @ 3.60GHz
GFX: GTX 1070 8GB
RAM: 32GB

The FLIP Fluids addon is currently unable to render a frame in EEVEE without crashing (using F12). EEVEE rendering in the viewport appears stable. This seems to be related to this issue: https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Scene-Troubleshooting#blender-often-crashes-suddenly-or-does-not-apply-transforms-while-rendering

A workaround that helps render stability is to lock the Blender interface during render (Blender > Render > Lock Interface).

Hoping to get to the bottom of this issue quickly!

@rlguy

This comment has been minimized.

Copy link
Owner

rlguy commented Dec 13, 2018

This issue may have been solved and the fix may also prevent the Cycles render crashes in Blender 2.79 as well! EEVEE has been successfully rendering thousands of frames without a crash while using the viewport. The culprit seems to be the way we transferred materials an smooth shading from the previous mesh to the next frame mesh.

I am not entirely sure why the following fixes work, but changing either to the original method would consistently result in a crash:

Material Transfer

Caused Crashes:

for m in src_mesh_data.materials:
    dst_mesh_data.materials.append(m)

No Crashes:

material_names = []
for m in src_mesh_data.materials:
    material_names.append(m.name)
for name in material_names:
    for m in bpy.data.materials:
        if m.name == name:
            dst_mesh_data.materials.append(m)
            break

Code Context

Smooth Shading Transfer

Caused Crashes:

for p in mesh_data.polygons:
    p.use_smooth = True

No Crashes:

values = [True] * len(mesh_data.polygons)
mesh_data.polygons.foreach_set("use_smooth", values)

Code Context


Feedback from users will be needed to determine if this fixes the issue or if render crashes still persist.

@rlguy rlguy changed the title Blender 2.80 render crashes (EEVEE) Blender 2.80 render crashes (EEVEE) (Fixed) Dec 13, 2018

@rlguy rlguy changed the title Blender 2.80 render crashes (EEVEE) (Fixed) Blender 2.80 render crashes (EEVEE) (Feedback Wanted) Dec 13, 2018

@rlguy

This comment has been minimized.

Copy link
Owner

rlguy commented Dec 13, 2018

Blender 2.80 seems to crash more frequently when rendering scenes created in Blender 2.79 (Such as example scenes). Locking the interface during render seems to prevent these crashes (Blender > Render > Lock Interface).

@rlguy

This comment has been minimized.

Copy link
Owner

rlguy commented Dec 14, 2018

I have created a simplified script that reproduces the EEVEE render crashing issue. This causes a crash in Blender 2.80 but not in Blender 2.79. I'll submit a report to the Blender developers perhaps tomorrow once I double check the script and check that this issue has not already been filed.

Script and Explanation:

import bpy

"""
DESCRIPTION:
    
This simplified script reproduces a crash I am experiencing in an addon. The addon's function is to
load and render mesh geometry for each frame of an animation. The addon does this by creating a Blender
object, and on each frame swap out the object's mesh data with new geometry and then delete the old
mesh data.

The crash happens after after attempting to modify the object, such as by smooth shading the mesh data, 
adding materials, or setting location/scale/matrix_world of the object. The more frequently the object is 
modified, the more frequent the crashes.

This crash only happens while rendering. The crashes can be reliably prevented by locking the interface 
(Blender > Render > Lock Interface).

TO REPRODUCE:
    
1. Open the .blend file
2. Press 'Run Script'
3. Begin rendering the animation

ERROR OUTPUT:
    
Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF7B09D5D85
Module  : C:\\Users\\ryanl\\Downloads\\blender-2.80-d415b5c7b85-win64\\blender-2.80.0-git.d415b5c7b85-windows64\\blender.exe
"""


def frame_change_pre(scene):
    # The addon would load geometry from a file, but for a simplified test an icosphere works
    vertices = [
        (0.0000, 0.0000, -1.0000), (0.7236, -0.5257, -0.4472), (-0.2764, -0.8506, -0.4472), (-0.8944, 0.0000, -0.4472),
        (-0.2764, 0.8506, -0.4472), (0.7236, 0.5257, -0.4472), (0.2764, -0.8506, 0.4472), (-0.7236, -0.5257, 0.4472),
        (-0.7236, 0.5257, 0.4472), (0.2764, 0.8506, 0.4472), (0.8944, 0.0000, 0.4472), (0.0000, 0.0000, 1.0000)
    ]

    triangles = [
        (0, 1, 2), (1, 0, 5), (0, 2, 3), (0, 3, 4), (0, 4, 5), (1, 5, 10), (2, 1, 6), (3, 2, 7), (4, 3, 8), (5, 4, 9),
        (1, 10, 6), (2, 6, 7), (3, 7, 8), (4, 8, 9), (5, 9, 10), (6, 10, 11), (7, 6, 11), (8, 7, 11), (9, 8, 11), (10, 9, 11)
    ]
    
    # Create a new mesh with geometry
    new_mesh_data = bpy.data.meshes.new("mesh_data" + str(scene.frame_current))
    new_mesh_data.from_pydata(vertices, [], triangles)
    
    # Swap the new mesh data and delete the old mesh data
    mesh_cache = bpy.data.objects.get("mesh_cache")
    old_mesh_data = mesh_cache.data
    mesh_cache.data = new_mesh_data
    bpy.data.meshes.remove(old_mesh_data)
    
    # This is what causes the crash: the more frequently the mesh cache data is accessed, the more frequent the crash occurs.
    # For a simplified test, we will repeatedly set smooth shading on the mesh data polygons. This also happens if setting the 
    # object location/scale/matrix_world, mesh data materials, and other data.
    for i in range(1000):
        for p in mesh_cache.data.polygons:
            p.use_smooth = True
    

# Create a cache object to store the current frame mesh    
mesh_cache_data = bpy.data.meshes.new("mesh_cache_data")
mesh_cache_data.from_pydata([], [], [])
mesh_cache_object = bpy.data.objects.new("mesh_cache", mesh_cache_data)
bpy.context.scene.collection.objects.link(mesh_cache_object)

bpy.app.handlers.frame_change_pre.append(frame_change_pre)

Blend File Including Script

bug_script_280.zip

To Reproduce:

  1. Open the .blend file
  2. Press 'Run Script'
  3. Begin rendering the animation
@igarrison

This comment has been minimized.

Copy link

igarrison commented Dec 17, 2018

FWIW, I grabbed the experimental version of FLIP fluids today along with the latest build of Blender 2.80 64-bit for win10, THANK YOU for starting the work to get FLIP running in 2.80! While I can enable rendered mode in the viewport with Eevee I absolutely cannot render an animation and very rarely can I use F12 to render a single frame out of eevee. Full screen mode, locking the UI, and using the command-line to render all did not work for me.

Cycles in 2.80 does work for viewport and animations, but only with the workarounds you suggested (fullscreen, locked UI, command line animation renders). I also confirmed that the "No Crashes" code changes you mentioned were seen on my system. So at least I can render with Cycles, but Eevee can't be used to render output files.

@rlguy

This comment has been minimized.

Copy link
Owner

rlguy commented Dec 17, 2018

Thanks for the feedback! We have had similar reports that some users are unable to render an animation or a single frame using F12 when trying the workarounds. At the moment there are many bugs related to Blender 2.80 render crashes on the Blender issue tracker. I'll be keeping an eye on the issue tracker and continue investigating this problem. It is possible that this issue could be caused by a Blender bug, a problem with our code, or a combination of both.

A note about Cycles in 2.80: There is a Blender bug that will make it not possible to render dupliverts in Cycles, so this will affect whitewater rendering. Issue here: https://developer.blender.org/T58956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment