Wierd behavior of Motion Blur

Mkay, so I decided to try and add a motion blur for my lil project but (as usually) failed miserably. I'm using quite small objects (obj.*) imported from 3ds max, tried all different motion blur strenght options but it still did not work.

Here is my code:



  try
        {


            GameTaskQueueManager.getManager().update(new Callable<Object>()
            {

                @Override
                public Object call() throws Exception
                {
                    motionBlurRenderPass = new MotionBlurRenderPass(cam);
                    rPass = new RenderPass();

                    return null;
                }
            }).get();
        } catch (InterruptedException e)
        {
            e.printStackTrace();
        } catch (ExecutionException e)
        {
            e.printStackTrace();
        }
_passManager = new BasicPassManager();
motionBlurRenderPass.add(rootNode);
motionBlurRenderPass.addMotionBlurSpatial(bulletNode);
motionBlurRenderPass.addMotionBlurSpatial(b);
motionBlurRenderPass.setUseCurrentScene(true);
rPass.add(rootNode);
_passManager.add(rPass);
_passManager.add(motionBlurRenderPass);
 rootNode.updateRenderState();
rootNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);



And here are the results:

"space ship" attached to motionblur:


"bullets" attached to motionblur:


"background" attached to motionblur (which seems to be only one working):


Any idea of simple way to fix it? Or what is causing this behavior?

Thanks in advance!

Hi Morq,



i have similar results. Sorry don't know whats the reason - but you're not alone. I implemented it like in TestMotionBlur.

Hope anyone can help.



Best Regards

Woidl

TestMotionBlur dosen't seem to look that nice also.



You could try to look for a better glsl implementation and replace the vert/frag shaders in the MotionBlurRenderPass.

Thanks for the replies!

On the first sight it seems to be above my skill to do such thing, but from my past experience many things seem much more complicated than they are in real, I will surely give it a go and look for other implementations and try to use them.



Cheers!

Hi Morq,



currently 'm looking into the MotionBlurRenderPass code - seems there's some geometry streching and velocity calculation.

and in my impl i notice strange geometry distortion (similar artefacts as in your screens) - seems to be something out of bounds in calc - problem with the vert-shader? but the code looks ok. and frag-shader seems to be ok. i also controlled blurStrength and the input matrices. i use many (differently rotated/translated) shared-meshes, but have to look if this is a problem for that code - i'm new to glsl - worked with directx before…



has anybody out there some suggestions what there can be wrong?

many thnx for your help!

Hi Morq,



i've found the reason why my implementation did not work correctly - seems MotionBlurRenderPass has problems with SCALING of a spatial. i did a downscaling of 0.1f to my object nodes and got distorted geometry with motion-blur.

if i use normal (1.0f) scaling, everything works fine.

looking into the MotionBlurRenderPass code seems it considers the scaling for matrix calc, but maybe in a wrong way…

have to do some experimenting with that stuff.



best regards,

woidl

Awesome! Thanks a lot, i will give it a try as soon as I wake up!

Good night everyone :slight_smile:

Thanks for your time but unfortunately it did not solve my issues, here is how it looks after I disabled all of the localscales and scaled object up in 3d software:







Have a happy Easter :slight_smile:

Hi Morq,



hmmmm the new screeny seems to show that there happens nothing with motionblur… but i do not see any more vertex-artifacts as in your earlier screenshots!??

very difficult to say what's the problem here. have seen in one forum entry that there were problems with ATI-cards, the solution was a loop-unroll in the frag-shader.

good thing to do is to debug MotionBlurRenderPass first with the TestMotionBlur app and then with your own - and compare!!! check if all renderpass-related stuff is in it's right order and place ((simple-)update, render, …) and maybe have a look into the matrices in both cases - hope that helps!



best regards,

woidl

Well tried messing up with the code, but I couldn't get any further with solving my issue.

The motion blur effect in previous post of mine "does something", when I move it (with localtranslation) it changes depending on direction of movement change. So when I move left it is a bit more blue, when I move right a bit less, when I move backwards it looks almost as if blur worked but only until I stop moving my object.



Thanks for your time :slight_smile:

Hi,



but motion-blur does only "something" when objects ARE moved. this implementation calculates a speed vector in image-space using the last transformation and the current of the model.

a nice pdf-doku of the algorithm can be found by googleing: "stupid opengl shader tricks"

maybe you can post some more screens, where the effects you describe can be seen?



best regards

woidl

Okay, so I have turned motion blur on again, made sure everything is on scale 1f, and moved cam far away to capture the ship, here's what I get depending on movement direction:



http://img411.imageshack.us/img411/3182/monkeysend.jpg



Ship model in ^ this screenie is quite big so motion blur effect on the "move down" is almost invisible, but from what I remember from the past, when I used smaller model motion blur seemed to affect ship "almost correctly" when it flew down.



Thanks for your help mate :slight_smile:

hi - cannot see any MB in this screenshot… and you're using SimplePassGame to implement your stuff?

otherwise be aware of correct renderpass-code in update() and render() - compare with code in SimplePassGame…

Heh, yah thanks to your help I managed to remove artifacts,but still not able to render mb correctly.

Anyway I'm sure I got it right, check out my first screenies, there were "working mb" there before.

I'll try to dig into it more later, it isnt high on my priorities atm, have to do other stuff first :slight_smile:



Thanks a lot for your help :*