## SLG v2.0 Preview

Discussions related to GPU Acceleration in LuxRender

### Re: SLG v2.0 Preview

vimax wrote:I'm sorry to insist but has anyone tested instances with the latest windows 64bit builds in the repository?

I get:
Code: Select all
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<program source>:2424:38: warning: incompatible pointer types passing 'float __attribute__((address_space(1)))(*)[4]', expected 'float __attribute__((address_space(1)))**'const float area = InstanceMesh_Area((__global float (*)[4])(meshDesc->trans), iVertices, iTriangles, triangleID);

as posted above in 64 bit but the 32 bit works.

For me it works fine.
i7 860, 16 GB RAM, NVIDIA Geforce GTX 560 + GTX 460, Windows 7 64bit, Blender 2.66
neo2068

Posts: 485
Joined: Sun May 03, 2009 2:11 am
Location: Germany

### Re: SLG v2.0 Preview

Just to be clear, I'm talking about a scene with multiple instanced objects in a scene like the one here and using the executable from here.
EDIT: with MQBVH as accelerator...

It worked ok? what drivers are you using?

vimax

Posts: 192
Joined: Wed Jul 02, 2008 9:39 pm

### Re: SLG v2.0 Preview

I'm trying to add motionblur and while I think I got the ray generated correctly I get a completely black screen even though it's rendering.
So then it hit me:

Shouldn't the default current behavior be that if you enable motionblur it simply gets neglected and it uses only the initial orig, dir, up camera parameters?

As it stands, if you add the scene.camera.motionblur.enable = 1 in the scn regardless of the rest of parameters you get a black screen as output even though the rendering speed gives a hint that it is rendering the scene pretty much just as before, it's not thrown away to an empty part of the scene.
Last edited by vimax on Tue Jul 19, 2011 5:12 am, edited 1 time in total.

vimax

Posts: 192
Joined: Wed Jul 02, 2008 9:39 pm

### Re: SLG v2.0 Preview

Vimax, camera motionblur is not supported at all in 2.0 and, as you wrote, using motionblur options should not affect the rendering at all. I will check what goes wrong.

Posts: 4797
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

### Re: SLG v2.0 Preview

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.
slg2_motionblur.zip
slg2_failed_motionblur.zip

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.

vimax

Posts: 192
Joined: Wed Jul 02, 2008 9:39 pm

### Re: SLG v2.0 Preview

Hi,

If you want to get correct results, you need to use quaternions to interpolate between the 2 matrices otherwise when doing rotations you'll get strange results.

Jeanphi
jeanphi

Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

### Re: SLG v2.0 Preview

I don't understand.. I interpolate betweeen the 2 origin points of the initial and final camera position as if it were moving on a straight line and I also do that for the 2 directions, after they are transformed to world space.
After normalization I don't see how that could create problems. I even tested with a stronger rotation and saw no artifacts.

What would exactly be the strange results you mention?

vimax

Posts: 192
Joined: Wed Jul 02, 2008 9:39 pm

### Re: SLG v2.0 Preview

Hi,

If you don't use quaternions and your shape is off the rotation axis it won't along a circle. This can lead to strange deformations during motion.

Jeanphi
jeanphi

Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

### Re: SLG v2.0 Preview

Well, I did as I was told and generated the transformation matrix just as the camera.h in the luxrays library does so now I don't need to interpolate matrixes.

Here are the modified files, who knows, maybe this time someone will actually download it..
Attachments
slg2_mb.zip

vimax

Posts: 192
Joined: Wed Jul 02, 2008 9:39 pm

### Re: SLG v2.0 Preview

Seems that slg preview is the slg 2.0. Anyways new processors are coming out with new instructions. AMD also releasea a new cards with lots of possibilities like support direct programming.. (PR?). Well, at least processors will have the long awaited instructions for different calculations.