I am having a really tough time trying to get motion blur to work ***correctly***. I'm working on a rather simple particle system so I am attempting to create a new world for every particle, and transform it with motion blur. I have scoured this forum inside out and pieced together a working piece but since there is no documentation anywhere that explains what part of the transform matrix relates to what, I am not getting anywhere.
Here is the meat of the code:
PF_CompositeMode mode; mode.opacity = alpha * 255 + 0.5; mode.opacitySu = alpha * 32768 + 0.5; mode.rgb_only = false; mode.xfer = PF_Xfer_IN_FRONT; PF_FloatMatrix mat1; PF_FloatMatrix mat2; double ratio = (double)in_data->downsample_x.num / (double)in_data->downsample_x.den; double scale = 1.0 * ratio * psize; // Before matrix // i is the current particle in the loop mat1.mat = mat1.mat = mat1.mat = i; // identity mat1.mat = px2 - checkoutLayer.u.ld.width * scale / 2; // This is the x translation mat1.mat = py2 - checkoutLayer.u.ld.height * scale / 2; // This is the y translation mat1.mat = scale; // This is the scale mat1.mat = scale; // This is the scale // After Matrix mat2.mat = mat2.mat = mat2.mat = i; // identity // lastpx & lastpy are arrays holding the previous frame (time) particle position mat2.mat = lastpx[i][time+1] - checkoutLayer.u.ld.width * scale / 2; // This is the x translation mat2.mat = lastpy[i][time+1] - checkoutLayer.u.ld.height * scale / 2; // This is the y translation mat2.mat = scale; // This is the scale mat2.mat = scale; // This is the scale PF_FloatMatrix my_matrices; my_matrices = mat1; my_matrices = mat2; PF_Rect dest; dest.bottom = in_data->height; dest.left = 0; dest.right = in_data->width; dest.top = 0; int quality = PF_Quality_HI; err = suites.WorldTransformSuite1()->transform_world(NULL, quality, F_MF_Alpha_STRAIGHT, PF_Field_FRAME, &particle_world, &mode, NULL, my_matrices, 2L, true, &dest, output); ERR(suites.WorldSuite1()->dispose_world(in_data->effect_ref, &particle_world));
Although this code works to some degree, it basically motion blurs every particle together, one after another, resulting in what looks like one long stream. I have attached a screengrab of what that looks like. It almost seems as if it's not separating the particle motion blur for each frame, but rather motion blurring them across frames as well. You can also see a streak going to the top-left hand corner which I have to figure out what that is.
I think this has something to do with the 'identity' but of course, there is no documentation anywhere that explains how to do this! I should add that all of this code is occuring inside the for-every-particle loop. So for each particle, I am creating a new world, copying the selected layer from it, transforming it, and destroying it. I didn't add the initial part that shows the creation and copying of the selected layer as that is rather self-explanatory and not likely the issue here.
I feel like I am close. The motion blur is there, it's just not separated by frames. But I won't be able to get anywhere if I can't find documentation that explains how to use it correctly.
Any helpful advice would be MUCH appreciated!
Thank you for your reply. Yes, I have seen that thread - I've litereally come across every transform_world thread in the forum, at least the ones still available before the great Adobe purge...
The problem is that none provide any practical examples and / or documentation, let alone explain what each parameter does. The transform_world function in the documentaion doesn't mention how to use the matrix, or, even more importantly, what relates to what. For example, how do I know which matrix cell relates to position? Or to rotation? I have only been able to piece that together through the fragments I've found on the forum.
Is there even a project that shows how to use Transform_world with motion blur (2 matrices)? I checked Transformer but it doesn't even use Transform_world and CCU doesn't either.
The 'identity' part of the transform_world matrix is a complete msytery with absolutely no supporting examples anywhere from me to learn from. I don't know what it is, what it's for, etc. So that is the problem I am having. I just don't have any literature or examples that show how to use this function (among many others)! And without examples, I don't know how to correctly use or work with it (whether new worlds should be created outside a loop, inside, etc, etc).
the matrices used are standard 3x3 transformations matrices. it's a mathematical concept, not one the is specific to any software that uses them.
the one difference you might find between 3x3 matrices explanations and code abundantly found on the internet and AE's matrices, is that in some cases the matrix lines and rows are swapped. (i.e, what is located at [1,2] should be placed at [2,1] instead)
once you get transform_world to do a transformations as you expect them to be without motion blur using a single matrix, then venture on into multiple matrices for motion blur.
Yup, it's working 100% correctly with one matrix, but with two, it doesn't break motion blur from particle to particle. Just one continuous ribbon like in the image I attached.
Oh well... if I can't find even one example project that uses motion blur with transform_world & two matrices I guess I will have to start considering having to code my own motiob blur... 😞