Sign in to follow this  
Aardvajk

Putting backdrops on Direct3D

Recommended Posts

What's the best way to put big (screen sized) backdrops on 2D games with Direct3D? I'm used to just blitting large images with DirectDraw but read somewhere that some 3D cards won't support textures bigger than 256x256. Mapping a 640x480 texture to a quad works okay on my machine but I'm worried it might fail on other cards. Also seems to massively reduce the number of small sprites I can display in a frame which didn't seem such an issue with DirectDraw. Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by EasilyConfused
What's the best way to put big (screen sized) backdrops on 2D games with Direct3D?
I would personally go with the "Screen Aligned Quad" approach. Create a vertex with D3DFVF_XYZRHW and D3DFVF_TEX1 and render it immediately after the Clear() call with no Z-Test/Z-Write.

Quote:
Original post by EasilyConfused
I'm used to just blitting large images with DirectDraw but read somewhere that some 3D cards won't support textures bigger than 256x256.
Some very old cards won't - the last popular generation that had such a limit was the Voodoo 3's iirc. Pretty much all decent hardware for the last few years will handle 2048x2048 or larger. Still, it's best to check the device capabilities than to assume anything [smile]

Quote:
Original post by EasilyConfused
Mapping a 640x480 texture to a quad works okay on my machine but I'm worried it might fail on other cards.
Write a few fallback methods then - most cards can handle screen-sized textures, some will require 2N dimensions and others just won't handle it full stop. You could just go for a "create it as big as the hardware can" and then scale it up on-the-fly - it'll be blurry/low quality - but it'll work.

Quote:
Original post by EasilyConfused
Also seems to massively reduce the number of small sprites I can display in a frame which didn't seem such an issue with DirectDraw.
Without any more details about how you're rendering the background it's difficult to say why this might be. You'll get a performance hit for rendering a large texture (just due to the guaranteed number of frame buffer writes) but it shouldn't hurt too badly.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
I would personally go with the "Screen Aligned Quad" approach. Create a vertex with D3DFVF_XYZRHW and D3DFVF_TEX1 and render it immediately after the Clear() call with no Z-Test/Z-Write.


Lost me a bit there - bit new to Direct3D and doing everything by messing around with other people's example code I'm afraid. Any good links for some more information on this?

Thanks

Share this post


Link to post
Share on other sites
Split the image into multiple smaller ones, like:

1024x768 -> 512x512 + 512x512 + 512x256 + 512x256

Then render each one where it should be on the screen (topleft, top right etc...)

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