Cycles: support for motion vector and UV passes.
Most of the changes are related to adding support for motion data throughout the code. There's some code for actual camera/object motion blur raytracing but it's unfinished (it badly slows down the raytracing kernel even when the option is turned off), so that code it disabled still. Motion vector export from Blender tries to avoid computing derived meshes when the mesh does not have a deforming modifier, and it also won't store motion vectors for every vertex if only the object or camera is moving.
This commit is contained in:
@@ -25,8 +25,7 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
Camera::Camera()
|
||||
{
|
||||
shutteropen = 0.0f;
|
||||
shutterclose = 1.0f;
|
||||
shuttertime = 1.0f;
|
||||
|
||||
aperturesize = 0.0f;
|
||||
focaldistance = 10.0f;
|
||||
@@ -35,6 +34,10 @@ Camera::Camera()
|
||||
|
||||
matrix = transform_identity();
|
||||
|
||||
motion.pre = transform_identity();
|
||||
motion.post = transform_identity();
|
||||
use_motion = false;
|
||||
|
||||
type = CAMERA_PERSPECTIVE;
|
||||
fov = M_PI_F/4.0f;
|
||||
|
||||
@@ -124,7 +127,7 @@ void Camera::update()
|
||||
need_device_update = true;
|
||||
}
|
||||
|
||||
void Camera::device_update(Device *device, DeviceScene *dscene)
|
||||
void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
|
||||
{
|
||||
update();
|
||||
|
||||
@@ -140,10 +143,28 @@ void Camera::device_update(Device *device, DeviceScene *dscene)
|
||||
kcam->rastertocamera = rastertocamera;
|
||||
kcam->cameratoworld = cameratoworld;
|
||||
kcam->worldtoscreen = transform_inverse(screentoworld);
|
||||
kcam->worldtoraster = transform_inverse(rastertoworld);
|
||||
kcam->worldtoraster = worldtoraster;
|
||||
kcam->worldtondc = transform_inverse(ndctoworld);
|
||||
kcam->worldtocamera = transform_inverse(cameratoworld);
|
||||
|
||||
/* camera motion */
|
||||
Scene::MotionType need_motion = scene->need_motion();
|
||||
|
||||
if(need_motion == Scene::MOTION_PASS) {
|
||||
if(use_motion) {
|
||||
kcam->motion.pre = transform_inverse(motion.pre * rastertocamera);
|
||||
kcam->motion.post = transform_inverse(motion.post * rastertocamera);
|
||||
}
|
||||
else {
|
||||
kcam->motion.pre = worldtoraster;
|
||||
kcam->motion.post = worldtoraster;
|
||||
}
|
||||
}
|
||||
else if(need_motion == Scene::MOTION_BLUR) {
|
||||
/* todo: exact camera position will not be hit this way */
|
||||
transform_motion_decompose(&kcam->motion, &motion);
|
||||
}
|
||||
|
||||
/* depth of field */
|
||||
kcam->aperturesize = aperturesize;
|
||||
kcam->focaldistance = focaldistance;
|
||||
@@ -151,8 +172,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene)
|
||||
kcam->bladesrotation = bladesrotation;
|
||||
|
||||
/* motion blur */
|
||||
kcam->shutteropen = shutteropen;
|
||||
kcam->shutterclose = shutterclose;
|
||||
kcam->shuttertime= (need_motion == Scene::MOTION_BLUR)? shuttertime: 0.0f;
|
||||
|
||||
/* type */
|
||||
kcam->type = type;
|
||||
@@ -175,8 +195,7 @@ void Camera::device_free(Device *device, DeviceScene *dscene)
|
||||
|
||||
bool Camera::modified(const Camera& cam)
|
||||
{
|
||||
return !((shutteropen == cam.shutteropen) &&
|
||||
(shutterclose == cam.shutterclose) &&
|
||||
return !((shuttertime== cam.shuttertime) &&
|
||||
(aperturesize == cam.aperturesize) &&
|
||||
(blades == cam.blades) &&
|
||||
(bladesrotation == cam.bladesrotation) &&
|
||||
@@ -192,7 +211,9 @@ bool Camera::modified(const Camera& cam)
|
||||
(right == cam.right) &&
|
||||
(bottom == cam.bottom) &&
|
||||
(top == cam.top) &&
|
||||
(matrix == cam.matrix));
|
||||
(matrix == cam.matrix) &&
|
||||
(motion == cam.motion) &&
|
||||
(use_motion == cam.use_motion));
|
||||
}
|
||||
|
||||
void Camera::tag_update()
|
||||
|
Reference in New Issue
Block a user