Skip to content
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 crashes during rendering or exporting animations. #1200

Closed
OmarEmaraDev opened this issue Oct 5, 2019 · 60 comments
Closed

Blender crashes during rendering or exporting animations. #1200

OmarEmaraDev opened this issue Oct 5, 2019 · 60 comments

Comments

@OmarEmaraDev
Copy link
Collaborator

@OmarEmaraDev OmarEmaraDev commented Oct 5, 2019

What is the issue?

Blender crashes during rendering or exporting animations implemented using Animation Nodes. The crash is not always reproducible, but it seems highly reproducible in certain cases. In particular, when Animation Nodes is adding/removing objects or altering object data such as meshes or splines.

Why haven't we fixed this issue yet?

The issue is caused by an upstream Blender bug, or rather, a design limitation. Consequently, there wasn't much we can do. However, we are currently looking into possible workarounds to mitigate the issue.

What can I do to render my animation?

To render your animation, you may try to use one of the following methods. Non of the methods are guaranteed to work, but they proved effective in many situations.

Background Render

You may try to render the animation in the background (Without the UI). To do so, execute blender from the terminal/console using the -b flag. For instance:

blender -b filename.blend -a

For more details and examples, see the Blender man page.

Render Individual Frames

You may try to render frames individually using the following script:

import bpy

scene = bpy.context.scene
render = scene.render
directory = render.filepath

for i in range(scene.frame_start, scene.frame_end):
    scene.frame_set(i)
    render.filepath = f"{directory}{i:05d}"
    bpy.ops.render.render(write_still = True)

render.filepath = directory 

The script render frames from Start Frame to End Frame and saves them in the scene's file path directory.

@juangea
Copy link

@juangea juangea commented Oct 6, 2019

Shouldn't this be fixed already in latest 2.81?

I think I remember Sergey solved the culprip bug about this, but there could still be some crashes, but those crashes were solved enabling "lock interface" while rendering.

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Oct 6, 2019

@juangea We are still not sure if what Sergey did actually solved the issue. In Animation Nodes, we use timers for automatic execution, while Sergey was talking about handlers. Some users also reported that the crashes still happen. I tried couple of tests scenes and Blender crashed even with "Lock Interface" enabled. However, it never crashed when using the two methods outlined above.
Can you try some scenes and report back?

@samytichadou
Copy link
Contributor

@samytichadou samytichadou commented Oct 15, 2019

Hi, would it be a good idea to make a kind of "poor boy render operator" based on this kind of frame by frame script shipping with AN ? In case users can't render in a classic way their animation without crash, there would be a simple out of the box solution !

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Oct 15, 2019

@samytichadou I guess we can consider that. But I am planning on diving deeper into the problem at some point because even the described methods don't work all the time.

@samytichadou
Copy link
Contributor

@samytichadou samytichadou commented Oct 15, 2019

@samytichadou I guess we can consider that. But I am planning on diving deeper into the problem at some point because even the described methods don't work all the time.

neat :D great news !
meanwhile, if i have spare time, i'll made a quick poor boy operator patch to have quick solution while it is not solved, i had to use this kind of scripts a lot with AN, a proper op would be handy ! i'm feeling pythonic these days ;)

@erhn-gif
Copy link

@erhn-gif erhn-gif commented Dec 23, 2019

a solution for those who still have a problem about animation nodes rendering:
1-animate with animation nodes,
2-add start-end keyframes but not only for driver mesh; but also all driven meshes,
3-do render settings how do you want, and don't forget to enter output path
4-quit blender UI
5-win+x and open windows command prompt (admin)
6-enter this:
cd C:\Program Files\Blender Foundation\Blender 2.81
(enter blender path wherever it is in your comp.)
7-enter this:
blender -b file.blend -a
(write the location of your .blend file with animation nodes you want to render)

@Gerstmann-Bradley
Copy link

@Gerstmann-Bradley Gerstmann-Bradley commented Dec 24, 2019

I found render from viewport can also work. The good part is that it allows me to render mp4 directly, since I don't know how to use a script to render a mp4 instead of an img sequence.
You can also see the render result by using this method as usual.

@ewhac
Copy link

@ewhac ewhac commented Jan 18, 2020

Is there any value in providing .blend files that reliably crash?

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jan 19, 2020

We can reproduce the issue readily. However, it is rooted in Blender itself, so it is much harder to solve, as we can only implement a workaround, not a proper fix.

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jan 25, 2020

@ewhac On second thought, it would be nice if you can provide a blend file that can reliably crash. Thanks in advance!

@ewhac
Copy link

@ewhac ewhac commented Jan 30, 2020

@OmarEmaraDev: Cool, where should I send it?

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jan 30, 2020

@ewhac I think you can just zip it and attach it here.

@Finnste
Copy link

@Finnste Finnste commented Jun 24, 2020

Thank you very very much for your quick help, also for a beginner like me. Using Matrix Input seems to solve my problem and also lock interface prevents Blender to crash.

@alessandro-zomparelli
Copy link

@alessandro-zomparelli alessandro-zomparelli commented Jul 16, 2020

Just a turnaround, but maybe it may help someone. I created an operator in Tissue in order to render all the frames allowing to press ESC for Cancel the operation. I have the same problem with Animated Tessellations with Tissue add-on. I cannot render the animation or export as alembic:
image
image

It's currently available in the development branch of Tissue: https://github.com/alessandro-zomparelli/tissue/tree/b280-dev
Looking forward to find a real solution to this issue though...

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 16, 2020

@alessandro-zomparelli Did you take a look at #1294 and b1ac938?

@alessandro-zomparelli
Copy link

@alessandro-zomparelli alessandro-zomparelli commented Jul 16, 2020

@alessandro-zomparelli Did you take a look at #1294 and b1ac938?

Thanks, I'll check it!

@alessandro-zomparelli
Copy link

@alessandro-zomparelli alessandro-zomparelli commented Jul 16, 2020

@alessandro-zomparelli Did you take a look at #1294 and b1ac938?

Hi Omar, thanks for the hint. I gave a look to your strategy and I tried to adapt to my code, but then I realized that during the Tessellation I'm actually adding and deleting some modifiers each time. I'm worried that this doesn't allow me to use the DAG_EVAL_RENDER . Is that correct? I understood that this is a picture of the dependencies graph passed by the event frame_changed_post , am I right?

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 16, 2020

@alessandro-zomparelli I see. I am not entirely sure if that will be a problem or if we can work around it. Can you point me in the direction of the code you are talking about? Maybe a minimal example that illustrates the issue would be nice as well.

@alessandro-zomparelli
Copy link

@alessandro-zomparelli alessandro-zomparelli commented Jul 16, 2020

@OmarEmaraDev I'll try to explain:

case 1) basically I use an array modifier inside the tessellation.
I create a single copy of the original component, then I apply an array modifier to that, in order to have my desired mesh topology/indexes. Coordinates of the vertices of each component are elaborated with numpy, and then I use foreach_set() in order to adapt the regular array to the target geometry. In my tests this was the most efficient way, maybe there is a better way though...

case 2) Another example is the Patch Tessellation, I need to compare a base mesh before and after the subdivision surface modifier, in order to have a structured grid for each subdivided face.

case 3) If more iterations are used, then I may have to repeat case 1 and 2 to the previously generated object.

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 16, 2020

It seems to me like it should work even with those ops.

@AticAtac80
Copy link

@AticAtac80 AticAtac80 commented Jul 17, 2020

Hi everybody, I'm having the same issue: an not updating during animation render (i'm using time info for an overlaying frame counter + timing . I'm trying baking to frame with no result. Is it correct to render animation after baking?
Thanx

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 17, 2020

@AticAtac80 Are you using the latest version of Animation Nodes? https://animation-nodes.com/#download

@AticAtac80
Copy link

@AticAtac80 AticAtac80 commented Jul 23, 2020

@OmarEmaraDev
I've tried many versions on Blender 2832. I've experienced both no frame update values on render frame and, when working, random crash in a range of 2-120 frames from start.
I would go for the baking workaround, but if once baked the procedure is render animation this not worked for me (still effect not updated in render frames)
Thanx for the link! I wil check and report result asap.

@AticAtac80
Copy link

@AticAtac80 AticAtac80 commented Jul 24, 2020

@OmarEmaraDev
Still no update of rendered frames: the frame+time counter based on time info (see attached ss) freezes the frame datas of the current curson position on the viewport for EVERY rendered frame of the animation.
Blender 2832
AN from suggested link
VC_redist.x64 installed
Untitled-1

@AticAtac80
Copy link

@AticAtac80 AticAtac80 commented Jul 24, 2020

Auto exection ON

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 24, 2020

@AticAtac80 Can you add the file?

@AticAtac80
Copy link

@AticAtac80 AticAtac80 commented Jul 24, 2020

@AticAtac80 Can you add the file?

It's a video edit. Is it ok for you without the linked video sequences?

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 24, 2020

@AticAtac80 Yes.

@AticAtac80
Copy link

@AticAtac80 AticAtac80 commented Jul 24, 2020

Thanx for your help! :-)
Edit with Anim Nodes.zip

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 24, 2020

@AticAtac80 I can replicate the issue. I will investigate.

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Jul 24, 2020

@AticAtac80 Seems like a Blender bug where the frame change handlers don't execute if the sequencer exists in the rendering pipeline. I will confirm it and report it to the developers.

@AticAtac80
Copy link

@AticAtac80 AticAtac80 commented Jul 27, 2020

@AticAtac80 Seems like a Blender bug where the frame change handlers don't execute if the sequencer exists in the rendering pipeline. I will confirm it and report it to the developers.

Great! Will wait for the news! :-)

@Misterdudeman
Copy link

@Misterdudeman Misterdudeman commented Dec 3, 2020

Any update on this thread?

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Dec 3, 2020

@Misterdudeman What issue are you having?

@Misterdudeman
Copy link

@Misterdudeman Misterdudeman commented Dec 3, 2020

Same issues as this thread. In addition I'm having differences in renders from single frame to command line renders.
Currently the Render By Frame script seems to be working for me but its not ideal.
I tried the trigger frame_current which seems to help the Render By Frame but not Render Animation.
From profiling my graph I have a feeling that there is an accumulation of node updates that get more and more out of sync with the global time as cycles doesn't always seem to rebuild the graph for every frame when running an animation range on its own.
I have also turned off sequencer in the render pipe but haven't noticed a difference.
I'm running AN 2.1.7 + Extra Nodes and Blender 2.83.

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Dec 3, 2020

@Misterdudeman Does enabling Lock User Interface fixes the crashes? What kind of differences are you experiencing?

@Misterdudeman
Copy link

@Misterdudeman Misterdudeman commented Dec 3, 2020

It seemed to help it not crash but still didn't run correctly in the Render Animation.

@OmarEmaraDev
Copy link
Collaborator Author

@OmarEmaraDev OmarEmaraDev commented Dec 3, 2020

Lock User Interface should always be enabled when rendering AN animations, there is no way around it unfortunately.
What is the expected output of your animation and what did you get instead? It would be nice if you attach the node tree as well.

@jamesa08
Copy link

@jamesa08 jamesa08 commented Feb 20, 2021

Not sure if anyone has suggested this, but baking the keyframes and then disabling the node trees did the trick for me!

@EstEsca
Copy link

@EstEsca EstEsca commented Apr 24, 2021

Not sure if anyone has suggested this, but baking the keyframes for each node tree and then disabling the node trees did the trick for me!

Wow, this one really saved me! Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests