Object motion blur, handling previous transform data?

Started by
4 comments, last by superpig 14 years, 1 month ago
When implementing object motion blur, how do you handle the "previous transform" vertices for all your objects? Do you store them, do you recover them? How do you take into account physics state, skinned animation, etc? Any help on this topic would be most appreciated.

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

Advertisement
You just store the previous transform(s) from the last frame and compute both the current and previous positions. Get the difference and there's your motion vector.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
Perhaps I should clarify. I am asking about how you manage that data for all your visible geometry? Depending on how many static/skinned objects there are on screen, that seems like a lot of data to manage.

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

For any node/ transformed object of your scene, just add another member variable, so you´d have:

-local position, rotation, scale
-orient transform
-local transform
-world transform
.
.
.
-previous world transform

Each frame, you swap the previous transform and the current one (if you use pointers to them).
It is not very hard to do if your engine is well designed.
I could see that one, but what do you do about skinned objects? The problem I see is that I want to skin them in the vertex shader. So if I wanted to go that route, I would have to upload the bone matrices for both the current and previous frames. However, that is an awful lot of constant data to be uploading to the GPU every frame for every skinned object.

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

Couldn't you use two separate constant buffers, and just switch between them? That way you wouldn't have to (explicitly) re-upload the skinning matrices for the previous frame; they'd just still be in video memory. (Unless of course they've been evicted, but there's not much you can do about that).

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement