24390

OpenGL motion blur without accumulation buffer

Question:

I'm trying to implement a <em>real</em> motion blur using OpenGL, but without the accumulation buffer (due to it not working on my graphics card). Here is my idea for the implementation:

<ul><li>Have a fixed array of (temporarily) blank framebuffers & textures for each "blur"</li> <li>Whenever a new frame is encountered, move the first element to the end, and render to <em>that</em> framebuffer instead</li> <li>Render them all, first frame having 1/<em>n</em> opacity, second one having 1/(<em>n</em> / 2), etc... until the newest one having 1.</li> </ul>

Is there any simpler/faster/more optimized way than this? Or is this the best solution?

Answer1:

What NicolBolas says in his comments is correct: To get real motion blur you must apply vector blur which is controlled by each fragment's speed; calculate the screen space speed of each vertex and pass that as another uniform to the fragment shader. Then apply a vector blur in the direction and distance of the fragment's speed.

Since this will blur with other fragments you're ending up with a problem of transparency ordering. Hence you should apply this as a post processing effect, ideally with depth peeled layers. You can save on the depth sorting complexity by using a backlog of previously rendered frames to blend into, which is essentially the framebuffer method you suggested, with vector blur added.

Answer2:

There are two general approaches to doing this kind of thing:

<ol><li>Render every "subframe" of the final frame separately and then in a final pass combine all of them</li> <li>Render subframe by subframe where in each pass you would read the result of the previous pass, multiply it by your weight coefficient, and as a result your final pass will be a composition of all of them.</li> </ol>

It's not trivial to tell which of these methods would work better. Method (2) has the disadvantage that you're making many passes, therefore a lot of overhead. Method (1) will be bottlnecked at the texture reads. Although in method (1) you still ultimately read all the data you would in method (2), in method (1) you'll be able to take advantage of multiple cache lines for the texture memory fetches. So the two most important factors that determine performance here are

a) How many "subframes" you have b) How big your screen is and thus how big the textures to be read and written to will be.

Recommend

  • Is there a way to group nth-child CSS rules for same parent
  • Navigation drawer is always inflated
  • Rails + Amazon RDS : latency issues
  • Why integer division and modulo isn't optimized out in NVRTC
  • Making a vectorized numpy function behave like a ufunc
  • How can I detect errors in an HTML document fragment with Ruby?
  • React textarea with value is readonly but need to be updated
  • Kubernetes 1.7 on Google Cloud: FailedSync Error syncing pod, SandboxChanged Pod sandbox changed, it
  • Running a Service from ASyncTask or Thread?
  • How to get or calculate size of Azure File/Share or Service
  • Back press fragments issue in android
  • Best Datagrid for Bootstrap/jQuery?
  • How to model a mixture of finite components from different parametric families with JAGS?
  • Unity 5.1 Animator Controller not transitioning
  • WebApp in AppServices vs CloudService
  • How to get file download speed (transfer rate) with php?
  • How to initialize context? [closed]
  • SQL Server re-calculate or not?
  • Receive mouse move even cursor is outside control
  • runtime-check whether an instance (Base*) override a parent function (Base::f())
  • Is there a package like bigmemory in R that can deal with large list objects?
  • Application level floating views with navigation in Android
  • AndEngine Applying Transparancy to AndEngine View
  • Using a canvas object in a thread to do simple animations - Java
  • Reduction and collapse clauses in OMP have some confusing points
  • How can I speed up CURL tasks?
  • How to determine if there are bytes available to be read from boost:asio:serial_port
  • Marklogic : Query response time is very high
  • MongoDb aggregation
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • D3 nodes and links from JSON with nested arrays of children
  • Avoid links criss cross / overlap in d3.js using force layout
  • Initializer list vs. initialization method
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • TFS: Get latest causes slow project reloading
  • Menu Color Fade on Hover with Jquery
  • ActionScript 2 vs ActionScript 3 performance
  • WPF Applying a trigger on binding failure
  • MATLAB: Piecewise function in curve fitting toolbox using fittype
  • Programmatically clearing map cache