Re: 2D overlay on top of 3D



I prefer you draw the GUI _after_ the 3D scene. This way you can acheive
nice transparency effects in your GUI without trouble. It might be required
that you clear the z-buffer before drawing the GUI. This depends on your
GUI's rendering actually. A complex 3D GUI with overlapping parts might
require z-testing, thus, you'd better clear the z-buffer for it before you
start rendering the GUI.
2D and simple 3D GUIs generally don't need z-testing in the first place, so
just disable z-writes and z-tests...
Oh, and don't forget ID3DXSprite... :)


--
Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez
--
In|Structurez Arabic Gamedev Community
www.instructurez.com


<nospam@xxxxxxxxxx> wrote in message news:du0ui902u0q@xxxxxxxxxxxxxxxxxxxx
Hello,

I'm writing a graphical role playing game. Right now, I have a nice 3D
view of my environment, but now it's time to add a decorative overlay to
the interface. I need to draw borders around the sides of the screen,
buttons, character portraits, an automap, perhaps a compass, etc.

I can think of a couple of ways of doing this. My first approach would be
after all of the 3D objects are draw, to clear the depth buffer and then
draw the 2D overlay on top. My 2D overlay would simply be a flat mesh with
the center portion cut out.

Does this sound like a valid approach? Do I need to clear the depth buffer
before drawing the overlay? I would think it would be necessary to prevent
any 3D objects from poking through the overlay.

It seems to me an alternative (and possibly higher performance) design
would be to only draw the 2D overlay only once, and then draw the 3D
portion of the scene using clipping, but that sounds like a much more
complex approach.

Thanks...

-----------------------------------------------------------
Posted using Android Newsgroup Downloader:
.... http://www.sb-software.com/android
-----------------------------------------------------------


.