Closed MirceaKitsune closed 4 years ago
Godot have Vulkan support in roadmap, maybe after its implementation, all modern things including Motion blur will be implemented.
Motion blur should definitely be possible in OpenGL too, at least version >= 3.2 to my understanding. Just saying it doesn't need to be a Vulkan specific feature, which I'd find a bit weird personally... if it otherwise has to come after implementing Vulkan for compatibility or priority reasons, that makes sense.
Just to clarify, Godot uses the OpenGL ES 3.0 standard, which is equivalent to OpenGL 3.3 on desktop platforms. Vulkan is in mind but don't expect it to come anytime soon.
Does OpenGL ES 3.0 contain the GLSL functions needed for spatial motion blur? It sounds like it should, since like I said DirectX games got it working over a decade ago.
I think the only function missing to implement a modern motion blur (https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch27.html) is the ability to get previous inverted projection matrix in addition to the current one.
Here's my attempt at a motion blur shader. Note that it only works when the camera moves. For per-object motion blur I think we need some kind of deferred rendering, so we can store linear velocity per pixel.
@Zireael07 Since OpenGL 3.1/GLSL 140 (I think?), matrices must be explicitly passed to the shader (OpenGL matrices are deprecated). Either way, GLSL has an inverse
function to invert a matrix since GLSL 140.
@Bauxitedev's motion blur shader is fairly good but it suffers from the same limitation as all other screen-reading shaders - they happen before alpha pass.
Somehow, though, built-in postprocess like DOF Near and Far Blur also work on alpha pass. Can we please get some velocity parameter to simulate motion blur using those?
Found a workaround, but it would have to be used on all alpha things you want to be seen when motion blur is on: https://www.reddit.com/r/godot/comments/bxfyws/heres_a_dithered_opacity_aka_hashed_transparency/ so it's not that tenable for larger projects.
I think @reduz plans to add a built-in per-object motion blur effect using motion vectors in 4.0 (or maybe 4.1).
Superseded by https://github.com/godotengine/godot-proposals/issues/2933.
I noticed that despite offering support for a variety of common post-processing shaders (bloom, depth-of-field, etc) Godot 3.0 doesn't have builtin support for motion blur yet. I believe this to be an important effect for photorealism, and would like to suggest it as a camera or environment option if possible.
For clarification: My suggestion doesn't refer to the conventional method of simulating motion blur, which relies on fading previous frames across the screen (also known as "ghosting"). The modern approach includes directional blurring of textures on surfaces based on the velocity of the camera, which offers a much more immersive and realistic effect. DirectX based engines have had this ability for over a decade, with the Need For Speed series (starting with NFS - Carbon, released in 2006) offering a good example... as far as open-source and OpenGL are concerned, this shader has been implemented into the Ogre based racing sim Stuntrally which may offer an useful example.
I briefly discussed this on IRC. I was told that a reason for the setback in supporting motion blur for Godot 3.0 is the OpenGL version, which is older than the one adding the necessary GLSL functions. Perhaps this can be implemented as more renderer backends are made available in the project settings, thus offered as an option to projects using OpenGL >= 3.2?