Sign in to follow this  
Michael Tanczos

Advice on multiple-image alpha blending

Recommended Posts

Hey all.. First off, let me say that I have googled this but am currently looking for some advice on a best approach to solve my problem. Basically what I'm attempting to do is conceptually pretty simple but I haven't worked with DirectX in many years.. sadly. I am writing my program in vb.net or c#.. Okay, so here is the problem. I am attempting to composite a series of five fullscreen images with per-pixel alpha blending (RGBA image files) to one monitor, and a second set of five fullscreen RGBA images to a second monitor. Initially I tried GDI+ which was easy, but sucked pretty hard at getting more than 8FPS on my machine for both monitors. The problem is that I need to hit a target of 30FPS. (so 30FPS on both monitors) I am thinking that a solution that would get the 30FPS might involve either direct3d (billboards?) or the directshow video mixing renderer ? At this point I'm looking for some advice on an approach that would work so any assistance would be appreciated. Any useful URLs would also be appreciated.. ;) - Michael Tanczos

Share this post


Link to post
Share on other sites
Quote:
Original post by Michael Tanczos
Hey all.. First off, let me say that I have googled this but am currently looking for some advice on a best approach to solve my problem. Basically what I'm attempting to do is conceptually pretty simple but I haven't worked with DirectX in many years.. sadly. I am writing my program in vb.net or c#..

Okay, so here is the problem. I am attempting to composite a series of five fullscreen images with per-pixel alpha blending (RGBA image files) to one monitor, and a second set of five fullscreen RGBA images to a second monitor. Initially I tried GDI+ which was easy, but sucked pretty hard at getting more than 8FPS on my machine for both monitors. The problem is that I need to hit a target of 30FPS. (so 30FPS on both monitors)

I am thinking that a solution that would get the 30FPS might involve either direct3d (billboards?) or the directshow video mixing renderer ? At this point I'm looking for some advice on an approach that would work so any assistance would be appreciated. Any useful URLs would also be appreciated.. ;)

- Michael Tanczos


The performance with GDI+ are quite predictable, it is not hardware accelerated.
The DirectShow Video Mixing Renderer (VMR) actually use a DirectDraw Surface (for VMR7) or a Direct3D9 Surface (for VMR9) under wraps so its basically the same as using DirectX.
I recommend the use of Direct3D9/10 with SlimDX as wrapper, 30 FPS is a very low target and should be achievable with any discrete card in circulation (and almost any integrated card as well) for a simple calculation like the one you have to do.

If you have no experience in DirectX, but have the time to learn I recommend to search the internet for basic guides about using textured quads and blending techniques. (Starting with DirectX10 is better, because it is the base over the future DirectX versions will be build on (DirectX11 for example is very similiar)). After you've done a little experience with that you can try to work your way out with multiple render targets and multiple swapchains (i think using 2 swapchain on the same device is the best idea in this simple situation, but if you want you can use 2 different devices is good too)

If you have no experience in DirectX, and no time to learn try to search for an high level engine to have a solid base to start on. (even thought I doubt there will be any for SlimDX and C#.)

Obviously if you have any problem with DirectX post on these forums and we'll try to be of help. :D

Share this post


Link to post
Share on other sites
It sounds like you'd be able to use ID3DXSprite with Direct3D to render your images. No need to worry about billboarding or any transforms, just create a couple of swap chains for each window and use ID3DXSprite::Draw() to handle painting.

Share this post


Link to post
Share on other sites
Thanks for the help guys.. this saved me tons of effort trying to figure out what in the DirectX arsenal would be appropriate to use. I utilized a combination of both of your answers. For the directX wrapper I used SlimDX and am using sprites inside of SlimDX. However, I'm not sure of how SlimDX can handle swap chains.. I can't seem to find anything in the docs about it. Although for the multiple monitors the sets of composited images will both be entirely different and won't require any shared resources between the two in terms of textures.

Just for a heads up, I'm building a downstream keyer to key graphics over live video through a video mixer board. This should hopefully work, as all I need to do is genlock the analog vga signals to a black burst reference signal and feed that into the keyer inputs of the mixer board. I could fork over a couple grand for a keyer, but instead I spent $89 on a scan converter with genlock capabilities and am trying to write my own software.

I'll let you know how things progress.

- Michael Tanczos

Share this post


Link to post
Share on other sites
Quote:
Original post by Michael Tanczos
Thanks for the help guys.. this saved me tons of effort trying to figure out what in the DirectX arsenal would be appropriate to use. I utilized a combination of both of your answers. For the directX wrapper I used SlimDX and am using sprites inside of SlimDX. However, I'm not sure of how SlimDX can handle swap chains.. I can't seem to find anything in the docs about it. Although for the multiple monitors the sets of composited images will both be entirely different and won't require any shared resources between the two in terms of textures.

Just for a heads up, I'm building a downstream keyer to key graphics over live video through a video mixer board. This should hopefully work, as all I need to do is genlock the analog vga signals to a black burst reference signal and feed that into the keyer inputs of the mixer board. I could fork over a couple grand for a keyer, but instead I spent $89 on a scan converter with genlock capabilities and am trying to write my own software.

I'll let you know how things progress.

- Michael Tanczos


In SlimDX when you create a SwapChain class in DX9 it actually calls the CreateAdditionalSwapChain.
Remember that DX9 supports only one fullscreen swapchain per device. If you need the two swapchains to be fullscreen you need to use multiple devices. (I suggest to use multiple devices, as you said there are no resources shared)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this