Motion Blur like Doom4


Looks really neat and smooth.
So it uses camera transform and only affected by camera motion? Or it uses full velocity vectors pass, and can blur many separated objects?

[quote=“Bananaft”]Looks really neat and smooth.
So it uses camera transform and only affected by camera motion? Or it uses full velocity vectors pass, and can blur many separated objects?[/quote]
only camera motion

nice.

Its pretty cool. I am getting bugs on my OSX. The motion blur is jittering and there is motion blur only in some areas of the screen.

try to turn on vsync (options -v)

Also whether you are using the latest version of the engine?

Wow! looks nice, does it work on GLES iOS/Android?

I have not tested

Very nice ! ( with -v that work fine here ) , great job ! what the next ? dof ?

This shader is not finished yet (it uses an additional forward light pass for weapon and I can not solve a couple of issues). I have reworked version with mask for weapon, but additional texture affects performance
dof already implemented by monkeyfirst github.com/MonkeyFirst/urho3d-post-process-dof (but as far as I remember, there is need to improve)

Please test updated version. Whether there is a problems WITHOUT vsync? New version render scene to texture and blurs it there, but not just in the viewport
EDIT: for launch still use START_DEMO.bat

work fine without vsync.

ok, but now it is impossible to turn off effect by tag, need use another renderpath without motion blur …
EDIT: although I have an idea

It works properly with vsync it looks pretty cool.

Have you problems with other shaders (Blur, Bloom) when VSync is disabled?
EDIT: a have a hypothesis that engine on some frames start showing viewport before bluring when vsync is disabled and fps is high
EDIT2: someone can test problem by using WithoutMask.bat in repo (u can change window size to 200x700 for increasing fps)

For some reason I had to use -ap flag for the Urho3DPlayer to locate the CoreData folder and then merge the Final folder into that one and the Data folder for it to find all the resources. Then I saw a baked room (Andrew Price’s right?) and a textured pistol, but no blur.
I’m on Xubuntu Linux 64-bit using the proprietary Nvidia drivers. Which - apart from the occasional heavy frame drops - tends to outperform the open Xorg drivers. Switching back to Xorg is a pain though, otherwise I’d be happy to test with those.
I’ve tried the -v option; no help.

[quote=“Modanung”]For some reason I had to use -ap flag for the Urho3DPlayer to locate the CoreData folder and then merge the Final folder into that one and the Data folder for it to find all the resources. Then I saw a baked room (Andrew Price’s right?) and a textured pistol, but no blur.
I’m on Xubuntu Linux 64-bit using the proprietary Nvidia drivers. Which - apart from the occasional heavy frame drops - tends to outperform the open Xorg drivers. Switching back to Xorg is a pain though, otherwise I’d be happy to test with those.
I’ve tried the -v option; no help.[/quote]
Any warnings or errors in log?

None

I have no ideas. Try output in shader intermediate steps.
Weapon maskt:
[code]void PS()
{
float weaponmask = texture2DProj(sDiffMap, vScreenPos).a;
gl_FragColor = vec4(weaponmask);
}
[/code]
Depth:
[code]void PS()
{
float depth = ReconstructDepth(texture2DProj(sDepthBuffer, vScreenPos).r);
gl_FragColor = vec4(depth * 20);
}
[/code]

I am getting identical result with those pixel shaders.
Also it turns out the path argument required to be enclosed in quotation marks to get all three folders across.
WithMask: Same as Final
WithoutMask: A screen filling flickering in tones of the room with the occasional contour of a window. The gun is rendered fine.
ViewportAlpha: Like Final, but with a pitch black gun.

Try
[code]
void PS()
{
float weaponmask = texture2DProj(sDiffMap, vScreenPos).a;
//gl_FragColor = vec4(mask);
//return;
if (weaponmask == 0)
{
gl_FragColor = texture2DProj(sDiffMap, vScreenPos).rgba;
return;
}
// HWDEPTH
float depth = ReconstructDepth(texture2DProj(sDepthBuffer, vScreenPos).r);
vec3 worldPos = vFarRay * depth / vScreenPos.w;
worldPos += cCameraPosPS;
vec4 oldClipPos = vec4(worldPos, 1.0) * cOldViewProj;
oldClipPos /= oldClipPos.w;
vec4 oldScreenPos = vec4(oldClipPos.x * vGBufferOffsets.z + vGBufferOffsets.x * oldClipPos.w,
oldClipPos.y * vGBufferOffsets.w + vGBufferOffsets.y * oldClipPos.w,
0.0, oldClipPos.w);
vec4 offset = (vScreenPos - oldScreenPos);
offset = offset / (cTimeStep * 20.0);
gl_FragColor = offset;
}[/code]
It should show different colors when you move a the mouse
Also try to remove all comments from shader. May be it not works with UTF8 comments

Also are you using the latest version of the engine?

Yep

Repo moved to github.com/1vanK/Urho3DMotionBlur

Is it possible to use the same technique for a depth of field effect?

I think there is nothing in common. Even pixel blurring algorithm is other. Easier write a DOF shader from scratch, than try to take something useful from this