Page MenuHome

Animated object visibilty 1 frame off when turning on motion blur
Closed, ResolvedPublic

Description

System Information
Win7 x64 Geforce 980ti

Blender Version
Broken: blender-2.77.0-git.bfc5a94-windows64 buildbot
Worked: 2.77a official

Short description of error
Moving objects with animated render visibility show up one frame late when motion blur is turned on, thus the viewport and render show different results.
In 2.77a it still worked as expected.

Exact steps for others to reproduce the error
Open attached .blend -> render:

Event Timeline

Bastien Montagne (mont29) triaged this task as Normal priority.

@Alexander Gavrilov (angavrilov) think you did some changes in this area in past months, mind having a look? Thanks.

This is sort of by design: rB1f19fba566

The reason is that Cycles cannot correctly render motion blur for objects that appear or disappear during the shutter window, so you can either hide them completely, or have rendering artifacts (specifically, object rendered as if it was perfectly stationary for half a frame). I'd argue that artifacts are worse, especially in case of a cloud of rapidly moving particles.

This is an example of those artifacts. They are very noticeable among other normally rendered particles, and even in the best case can only be removed by manual touch up of the image.

I see the problem. But in case of normal objects this behaviour introduces a lot of new problems.

My current scene has many objects switched for others.
Here is the problem: If I animate the visibility so that one object appears when another one disappears, I get a frame without any object in it. So with the new behaviour I would need to make the new object appear one frame before the old one disappears if I want motion blur. But then I get the following problems:

a) I have to keyframe viewport visibilty differently because otherwise the objects would overlap in viewport
b) If I decide to render without motion blur, I have to change the visibility keyframe for all objects, that is overkill
c) playblasts have the overlay issue as well, so I would need to change keyframes for playblasts as well

All in all I got lots and lots of work to do and need lot of muscle memory and the benefit is almost invisible in my case :(

My proposed solution: Keep the old visibilityl behaviour for regular objects and the new one exclusively for particles.

That's how my original patch worked, but @Brecht Van Lommel (brecht) decided to apply it to everything.

This close to the release the safest approach may be to revert the modified version that applies to all objects, and apply my original that only works on particles. Changing the current code to only work on particles may be tricky, because it uses invalid transforms to store the state instead of separate bool flags that can just be safely ignored for non-particles.

I restricted it to particles again, but kept most of the current code because I want it to work in a more appropriate way for Cycles standalone. In that context is_particle does not clarify what it does exactly, and having to specify and sync separate valid_motion_pre and valid_motion_post is not ideal.