-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add motion blur support #260
Conversation
Hi @dictoon , I'm wondering if I understand correctly time offset for motion blur in appleseed: I used object's coordinate on the current frame for the frame 0 and coordinates with time offset for the frame 1 in appleseed file. Time offset equals to (shutter_duration * ticks_per_frame). |
Nice work Sergo! |
Thanks @Mango-3 , |
Yes, that should work, independent of how the shutter time is set (frames, seconds, 1/seconds,..) in the UI, as you sad. |
if (is_animated) | ||
{ | ||
float shutter_duration = 0.5f; | ||
if (view_node != nullptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If view_node
is nullptr
, shutter_duration
remains set to 0.5f and so we'll set a transform at time offset 0.5f * GetTicksPerFrame()
. Is that what we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's we want, because only physical camera provides shutter duration parameter. If there's no physical camera then 0.5f is safe choice I guess. I honestly don't remember where 0.5 came from, maybe it's default for the physical camera
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's actually not quite right, even when there is a Physical Camera in the scene.
It seems to me that we should always set the camera's transforms at t=0 and t=1, and then we should set the camera's shutter times such that:
- Opening times (begin and end) set to
GetShutterOffsetInFrames()
(or 0.0f when there is no Physical Camera) - Closing times (begin and end) set to
GetShutterOffsetInFrames() + GetShutterDurationInFrames()
(or 0.5f when there is no Physical Camera).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dictoon ,
Are 0 and 1 frame numbers? Can I set transform for 1 to GetObjTMAfterWSM(time + GetTicksPerFrame())
?
You mentioned camera transforms, but line 837 is about assembly transforms. What do we do here? Can I leave this place as is?
I added changes for camera transforms, only for physical camera case. I think only physical camera has Enable Motion Blur checkbox. Other cameras have it as a viewport multi-pass effect. I don't know if we should consider it or should not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, they're arbitrary times. The idea is as follow: you set transforms (for transformation motion blur) or poses (for deformation motion blur) at arbitrary times, be it seconds, frames, etc. Then you tell the camera when to open the shutter, at what speed (and following what curve) and when to close it. The exact unit for the times is not specified by appleseed, it simply needs to be consistent.
Fixed comments and rebased. |
// Set motion blur parameters. | ||
const float opening_time = phys_camera->GetShutterOffsetInFrames(time, FOREVER); | ||
const float closing_time = opening_time + phys_camera->GetShutterDurationInFrames(time, FOREVER); | ||
params.insert("shutter_open_begin_time", opening_time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's recap:
-
You're setting the first transform at time 0: since you adopted "frames" as the unit of time, that means you're setting the first transform at frame 0.
-
You're setting the second transform at time 1, i.e. at frame 1.
-
You're setting the shutter open and close times at (fractional) frame values, which I hope are between 0 and 1.
So it looks correct.
{ | ||
float shutter_duration = 0.5f; | ||
if (view_node != nullptr) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct thing to do might be to remove everything related to the camera here, and simply set the object's transform at time = 0 (frame 0) and time = 1 (frame 1).
That means you would need to call GetObjTMAfterWSM()
at time
and time + GetTicksPerFrame()
.
This stuff is tricky... I suggest to compare your results with V-Ray and/or Arnold to make sure we're handling transformation motion blur correctly in all cases. |
Turned out I only have mental ray on my max 2016 and it looks little different than appleseed. I'll test on something more modern if I can get trial/demo access to it. |
You can download Corona for Max (2013-2019) and test it for 45 days free, even for commercial purposes in unlimited demo mode (no resolution limits or watermarks). |
Hi @dictoon , I compared last version of object motion blur with Arnold and it looks fine except when open/close duration on the camera is longer than 1 frame. |
I'm not sure what Arnold does in this case: does it extrapolate the motion outside the [0, 1] range? In appleseed, we assume that the object stops moving before the first transform or after the last, i.e. we clamp motion. Using Can you show a comparison between Arnold and appleseed for, say, t=2, t=3 (and maybe t=-1, t=-2) when transforms have been set only at t=0 and t=1? |
Hi @dictoon , |
I propose to merge this as it looks reasonable and actually matches Arnold for shutter durations in [0, 1]. Once merged we can continue testing and iterate. Thanks for the quality work! |
Hello!
This is quick attempt to add motion blur support. Both object and camera motion blur are supported.
appleseed object properties
modifier needs to be added andoptimize instances
should be turned on. Plus Object motion blur should be enabled in standard object properties.In both cases physical camera's shutter speed is used to determine time offset.