After quite a bit of time spent in which I got better aquainted with the code I found the problem in my motionblur atempt;
It is that the scene->camera->GetCameraToWorldMatrix().m called in compiledscene.cpp in camera definition returns an empty matrix, then I noticed that it's because it isn't initialised (..obviously..) when motionblur it turned on, so looking deeper I found in camera.h in the luxrays library at line 111 that if motionBlur is on the cameratoworld transformation is not initialised in Update. I have found a way to work with that and I know it would be useless but I propose that you add the 2 lines that initialise it, that way if there are iterations that will not have code for motionBlur they will get the correct initial camera.
- Code: Select all
if (motionBlur) {
mbDeltaOrig = mbOrig - orig;
mbDeltaTarget = mbTarget - target;
mbDeltaUp = mbUp - up;
/* + */ Transform WorldToCamera = LookAt(orig, target, up);
/* + */ CameraToWorld = WorldToCamera.GetInverse();
} else {
Transform WorldToCamera = LookAt(orig, target, up);
CameraToWorld = WorldToCamera.GetInverse();
}
I tried to do in the correct way of the camera.h in luxrays, that is compute a cameratoworld transformation of the intermediate camera position but it resulted in a failed attempt and I could not find the problem. BTW how do you debug the .cl files?
SO I calculated 2 cameratoworld matrix one for the initial position and one for the final one, computed both rays and then mix them to get an intermediate camera. It's more expensive in computationtime but with the luxball scene I don't notice the difference.
Here are the modified files I propose to add motionblur to slg2 together with my failed attempt.
Here are a couple of result of my test:
I would add binaries but I only have 32bit linux files since I can't yet get cmake to cooperate in windows and I'm working on a netbook with an intel atom that doesn't support 64bit.
I suppose it would be more elegant to have a global motionblur parameter instead of the camera parameter and if you think it's better I'll get on that modification ASAP.