5351

Direct3d/C# - Blur area under a rectangle drawn on a sprite

Question:

Any idea how to do it? I am drawing a rectangle that is supposed to be a half-transparent window. I managed to do the transparency by drawing a half-transparent texture, but I also want to blur whatever is under the window.

Normally (eg. using GDI) I would create a bitmap of the area, blur it and paint it as the background of my window. With Direct3D I don't even know how to get the area with whatever is already rendered on it. Or even there can be a different approach, can't it. Please help.

Answer1:

The D3D way is to use a pixel shader to "blur" the area underneath your rect.

<a href="http://www.riemers.net/eng/Tutorials/DirectX/Csharp/Series3/Pixel_Shader.php" rel="nofollow">This</a> link shows you how to use a pixel shader in C#.<br /><a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=507209&whichpage=1&#3307485" rel="nofollow">And this</a> link has a guassian blur pixel shader.

Answer2:

It DOES require having your backbuffer as a texture. You can then render the whole thing to a NEW texture and blur the relevant part before putting your semi-trans window over the new texture.

Edit: AFAIK you can't use the Draw function inside a shader. You will need to write your own sprite renderer. The Begin and Draw set up a whole load of states that will break your usage of a vertex shader.

Recommend

  • What is a good tutorial for learning vmr-9?
  • is screenshotting by DirectDraw faster than GDI way?
  • Scaling of the point sprites (Direc3D 9)
  • How to use a huge array in HLSL (error X4505)
  • glGetUniformLocation return -1 on nvidia cards
  • Is it possible to determine the size of the default framebuffer using OpenGL only?
  • Text overlay not showing in GPUImage iOS
  • Geometry shader doesn't do anything when fed GL_POINTS
  • CSS animation do not work for svg in
  • How to save a large fractal image with the least possible memory footprint?
  • OpenCV OpenNI calibrate kinect
  • Anybody have any idea how the divs are emitted in pinterest.com?
  • Update data in d3.js group
  • Setting color in a row of a Jtable
  • how to get the drawing graphic on picture box in c#
  • Conditional render in tagfile depending on whether the attribute is specified or not
  • Circle movement upon rectangle Collision
  • Inserting a (g) node in the middle of a tree (SVG) using jQuery
  • Load image without autoscaling in Android
  • Differences between drawing an Ellipse in Android and Java
  • Exception in the iconization of JInternalFrame with DefaultDesktopManager
  • iOS 9 errors and correct conversion to swift 2
  • write text on image and show it to a imageview
  • c# winform DrawToBitmap offscreen
  • How to discover Font Type?
  • Issue with routerLink directive
  • Cannot get text from text area
  • Validate child input components on submit with Vee-Validate and vue js 2
  • AndEngine Applying Transparancy to AndEngine View
  • Create DicomImage from scratch using Dcmtk
  • Converting a WriteableBitmap image ToArray in UWP
  • How to define and use opencv mat of user type
  • Google Custom Search with transparent background
  • Android fill_parent issue
  • How to do unit test for HttpContext.Current.Server.MapPath
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Projection media query: browser support and workarounds?
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • How does Linux kernel interrupt the application?