Derek Nedelman

I've been trying to adapt the C++ DirectX motion blur sample to XNA. This sample works perfectly on my NVidia 7900GT.

In my own program I successfully create a "velocity" render target with SurfaceFormat.HalfVector2. Unfortunately something goes wrong with the graphics system when I set this with SetRenderTarget() - the program doesn't hang, it just refuses to render anything after that. This is very strange because I don't even have to use the blurring pixel shader (which in turn uses the velocity render target's texture) for the problem to exist. The act of calling SetRenderTarget() with the HalfVector2 render target seems to cause the problem. If I use SurfaceFormat.Color for the render target the program renders as normal, though of course the blurring doesn't work correctly with this format.

Any ideas



Re: XNA Framework Problem using SurfaceFormat.HalfVector2

Jon Watte

If you choose format 8888 instead, does it work
Are you saving the previous render target so you can restore it when done
Are you using RealizeRenderTarget() after rendering, before switching back to the previous render target






Re: XNA Framework Problem using SurfaceFormat.HalfVector2

Derek Nedelman

The 8888 format works in the sense that it doesn't mess up the graphics system like the HalfVector2 format does, but it doesn't produce the desired blur effect.

Yes, I save the previous render target, and I do call ResolveRenderTarget() after rendering but before switching to the previous render target.

The key thing that I can't figure out is that even if I completely ignore the velocity textures in the pixel shader and just output the screen's texture unmodified, things are still messed up. The act of just setting the HalfVector2 render target seems to cause the problem. If I use a SurfaceFormat.Color render target (and completely ignore it in the pixel shader as well) the screen appears normally.





Re: XNA Framework Problem using SurfaceFormat.HalfVector2

Jon Watte

Actually, this mirrors what I've been seeing -- I haven't been able to make HalfVector2 work at all (on GeForce 7 series). I wonder if they have actually tested it -- it'd be interesting to see what their test suite covers.






Re: XNA Framework Problem using SurfaceFormat.HalfVector2

Derek Nedelman

Well I feel somewhat better knowing that someone else is having the same issue, though of course that doesn't solve my problem.

Anyone at Microsoft care to comment on this I'm not sure if this needs to be reported as a bug or not.