Fix cycles motion blur not working correct with shutter time > 2.0. The soft
limit is 2.0, and anything beyond that is extrapolation which might not work so well but is still allowed.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "bvh.h"
|
#include "bvh.h"
|
||||||
#include "bvh_build.h"
|
#include "bvh_build.h"
|
||||||
|
|
||||||
|
#include "camera.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "light.h"
|
#include "light.h"
|
||||||
@@ -722,6 +723,7 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
|
|||||||
foreach(Shader *shader, scene->shaders)
|
foreach(Shader *shader, scene->shaders)
|
||||||
shader->need_update_attributes = false;
|
shader->need_update_attributes = false;
|
||||||
|
|
||||||
|
float shuttertime = scene->camera->shuttertime;
|
||||||
#ifdef __OBJECT_MOTION__
|
#ifdef __OBJECT_MOTION__
|
||||||
Scene::MotionType need_motion = scene->need_motion(device->info.advanced_shading);
|
Scene::MotionType need_motion = scene->need_motion(device->info.advanced_shading);
|
||||||
bool motion_blur = need_motion == Scene::MOTION_BLUR;
|
bool motion_blur = need_motion == Scene::MOTION_BLUR;
|
||||||
@@ -730,7 +732,7 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
foreach(Object *object, scene->objects)
|
foreach(Object *object, scene->objects)
|
||||||
object->compute_bounds(motion_blur);
|
object->compute_bounds(motion_blur, shuttertime);
|
||||||
|
|
||||||
if(progress.get_cancel()) return;
|
if(progress.get_cancel()) return;
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ Object::~Object()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::compute_bounds(bool motion_blur)
|
void Object::compute_bounds(bool motion_blur, float shuttertime)
|
||||||
{
|
{
|
||||||
BoundBox mbounds = mesh->bounds;
|
BoundBox mbounds = mesh->bounds;
|
||||||
|
|
||||||
@@ -64,7 +64,10 @@ void Object::compute_bounds(bool motion_blur)
|
|||||||
/* todo: this is really terrible. according to pbrt there is a better
|
/* todo: this is really terrible. according to pbrt there is a better
|
||||||
* way to find this iteratively, but did not find implementation yet
|
* way to find this iteratively, but did not find implementation yet
|
||||||
* or try to implement myself */
|
* or try to implement myself */
|
||||||
for(float t = 0.0f; t < 1.0f; t += 1.0f/128.0f) {
|
float start_t = 0.5f - shuttertime*0.5f;
|
||||||
|
float end_t = 0.5f - shuttertime*0.5f;
|
||||||
|
|
||||||
|
for(float t = start_t; t < end_t; t += (1.0f/128.0f)*shuttertime) {
|
||||||
Transform ttfm;
|
Transform ttfm;
|
||||||
|
|
||||||
transform_motion_interpolate(&ttfm, &decomp, t);
|
transform_motion_interpolate(&ttfm, &decomp, t);
|
||||||
@@ -109,7 +112,7 @@ void Object::apply_transform()
|
|||||||
|
|
||||||
if(bounds.valid()) {
|
if(bounds.valid()) {
|
||||||
mesh->compute_bounds();
|
mesh->compute_bounds();
|
||||||
compute_bounds(false);
|
compute_bounds(false, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tfm is not reset to identity, all code that uses it needs to check the
|
/* tfm is not reset to identity, all code that uses it needs to check the
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
void tag_update(Scene *scene);
|
void tag_update(Scene *scene);
|
||||||
|
|
||||||
void compute_bounds(bool motion_blur);
|
void compute_bounds(bool motion_blur, float shuttertime);
|
||||||
void apply_transform();
|
void apply_transform();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user