Mixing 2D and 3D - what's the problem again?

Blitz3D Forums/Blitz3D Programming/Mixing 2D and 3D - what's the problem again?

Warren(Posted 2003) [#1]
I was experimenting with doing 2D in 3D (using quads aligned to the screen) and after writing a few test programs, I started converting my main project over. To my surprise however, DrawImage still worked perfectly fine on the 3D window. I had a rotating cube in behind my main menu GUI which is using DrawImage for everything.

Now, what is the problem with this exactly? I know people have posted that it's terrible for performance and what-not, but what specifically is the issue? Because, honestly, it seems to work perfectly fine.


Odds On(Posted 2003) [#2]
there's no problem as far as I know..


jhocking(Posted 2003) [#3]
The problems were specific to certain video cards and drivers. There were enormous slowdowns on certain setups. I think the problems may have all been resolved but since I'm not 100% sure of that I still avoid using 2D commands in 3D games. Plus doing faked 2D with 3D surfaces makes the GUI resolution independent (ie. it always looks the same, at the same size, no matter what resolution the screen is at.)


Michael Reitzenstein(Posted 2003) [#4]
What Joe said. Some cards (like the Voodoo 3) have 0 performance loss when combining 2D and 3D. Others will have a lengthy state change which will kill FPS instantly. If you are aiming for the shareware market, I wouldn't do it. Otherwise, there is nothing really to worry about, as later cards don't suffer from slowdown at all.


Warren(Posted 2003) [#5]
Suppose you do it intelligently and draw all of your 2D elements last? I'm not talking about randomly drawing 2D and 3D objects ... that would only be one state change per frame and I really can't imagine that would be a killer, regardless of the card you're using.


Beaker(Posted 2003) [#6]
I suppose it also depends on the type of game you are making, and whether screen update speed is a critical issue or not: Quake4 vs Chess.

Also, bear in mind that some drivers on some cards don't seem to display the text at all. If you aren't expecting your users to juggle/update drivers then this might also be a consideration.


CyBeRGoth(Posted 2003) [#7]
The problem was with the last (not latest) NVIDIA drivers which pretty much broke 2d support in general, and 2d over 3d = 10 fps :P

Its all fixed now with the new drivers from what I can tell


Warren(Posted 2003) [#8]
Well, I'm talking about DrawImage exclusively. After my last fiasco involving the Text command, I won't ever be using that command again. ;)


_PJ_(Posted 2003) [#9]
AFAIK the probn affectecd DrawImage and Text in fact, ALL d draw commands that relied on DirectDraw.

I agree, dependant on how quick you wanted your refresh, but it was still a pain. Also, latest ATI drivers and NVidia drivers have addressed the issue.

While on the subject, I remember comments about most users wopuldn't have the latest drivers - I disagree. There are a lot more apps out there etc. reminding people and tutoring them how to go about updating drivers.


Anthony Flack(Posted 2003) [#10]
Well, I must have missed them 'cause I've never updated my drivers...

Okay, so the problem is - with the nvidia driver fiasco, all 2d was buggered, from text to drawimage to the rest. This has now been sorted out, but some cards do still experience (less serious) slowdown when mixing 3d and 2d. So while it's not recommended, it's not totally forbidden either; I imagine if you do 3d and 2d in 2 straight sweeps it *should* minimise this, as you say... (not sure about this), but if you were doing something intensive in 3d I think you would notice more slowdown, as switching to 2d stops the card from rendering ahead, or doing some of that clever pipeline stuff it does that I don't understand. I think.

But apart from that, if you *don't* use any 2d commands, then you get to set the game to run at any res you like, at no extra cost. LCD screen users will appreciate that.

I also think mixing 2d and 3d puts you in an uncomfortable pinch between the future and the past - you're dependent on 3d hardware acceleration, but you're also dependant on proper direct draw support.


Rob(Posted 2003) [#11]
If you're using 3D it makes perfect sense to eliminate 2D I suppose.


Warren(Posted 2003) [#12]
If you're using 3D it makes perfect sense to eliminate 2D I suppose.

Yes and No, which is why I was asking.

If DrawImage works, and you aren't going to allow resolution switching, it would ease development a lot to just keep using it. Especially if you already have a bunch of code written using it.

Just giving a perspective from the other side.


BlitzSupport(Posted 2003) [#13]
I would personally avoid it, just because I remember people with crappy gfx cards complaining about heavy slowdown just after B3D came out (ie. way before the NVidia drivers thing). For maximum compatibility it seems it's best to go all 3D or all 2D...


Warren(Posted 2003) [#14]
Noted.


Lilprog(Posted 2003) [#15]
So if your going all 3d then what is the suggestion for displaying scores, health meters etc.. on the screen?


Warren(Posted 2003) [#16]
Screen aligned quads or sprites.


(tu) ENAY(Posted 2003) [#17]
Not mixing 2D and 3D has the benefit in that when you change resolution, the gfx are still at the same scale.


Beaker(Posted 2003) [#18]
Epicboy - if you want any help getting FONText to do what you need then feel free to drop me an e-mail.

There is a fairly major update coming soon that might help along the line.


Anthony Flack(Posted 2003) [#19]
It's true though, that mixing 3d and 2d is sometimes the simplest option. I'm just a little wary of it myself.


FlameDuck(Posted 2003) [#20]
Damned. Did I just miss an oportunity to talk trash about nVidia? Damned, damned, damned.

Oh well. In that case the problem is "you're using Windows". :o>