Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / paste a 2d sprite in 3d space without using planes?

Author
Message
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 26th Jul 2011 00:10
I seen some QuickBasic code years ago that allows 2d images/sprites to be pasted into a 3D space. It had lots of translation maths that projected a 2D sprite onto the 3D matrix. Now for the life of me I can't seem to find the code anywhere on the net.

Anyone got any links or code? Thanks

Home is where my souped-up computer is...
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 26th Jul 2011 16:40
Seems like the QBasic forum would be a good place to start searching:
http://www.network54.com/Forum/637533/

Are you using a TGC product (I assume)? If so, can I ask why you don't want to use planes? The same image used for a sprite can be used to texture a 3D plane (my understanding is that DBP uses 3D planes to display sprites anyway). Planes can easily be positioned, rotated, scaled, textured, collision checked, pointed, etc. There are no transition maths to deal with.

If you are using DBC or DBP I would be glad to provide an example of how to use planes in a 3D scene.
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 26th Jul 2011 19:57
the only reason I would want to use sprites rather than planes is speed. I can only put so many planes on the screen before my framerate sinks to a crawl.

Sprites may be faster with with some of the addons I've seen with DBPro. And yea, I am very familiar with using planes to draw images in 3D space.

But thanks for the link

Home is where my souped-up computer is...
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 26th Jul 2011 21:21
Can't say I have seen speed comparisons of sprites versus planes. I did some quick tests with 1000 planes vs 1000 sprites on-screen and I saw no difference in the execution speed of the program. They both held 60FPS on my computer. At sync rate 0, they varied widely from 177 to 510 FPS, but both were similar.

Do you have a decent graphics card? How many planes did you have to use before you saw a slowdown in your game?
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th Jul 2011 02:21
That's probably because all sprites are really 3D planes... that's why the blue backdrop shows up when we use sprites.

Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 27th Jul 2011 14:37
Quote: "That's probably because all sprites are really 3D planes... that's why the blue backdrop shows up when we use sprites."


Gee, wish I had said that.....oh wait, I did:
Quote: "(my understanding is that DBP uses 3D planes to display sprites anyway)"


This does not mean that perhaps DBP or it's plugins include optimizations for sprite handling that could speed things up. Is it possible that having the backdrop on / off will make a difference in speed? I don't know at this point, but I suppose it is worth investigating.
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Jul 2011 09:40
Hahaha... sorry I overlooked that you mentioned it already.

Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 28th Jul 2011 19:00
I ran some unscientific tests regarding using / not using the backdrop. I also ran some tests using planes (moved them the same number of times as the sprites).

I ran a simple program that started a timer, placed a certain number of sprites / planes at the left side of the screen (1000, 100, 10 and 1) and the program moved them all at 4 pixel / screen unit increments to the right side of the screen. The timer was read again to calculate an elapsed time. Each test ran 20 times and the results were averaged. I used a 1024 X 768 screen

1000 sprites:
backdrop on: 1126 backdrop off: 1146

1000 planes: 158

100 sprites:
backdrop on: 110 backdrop off: 250

100 planes: 42

10 sprites:
backdrop on: 32 backdrop off: 50

10 planes: 47

1 sprite:
backdrop on: 33 backdrop off: 30

1 plane: 39

It seems the more sprites / objects you have, that planes are considerably faster. These tests were not in windowed mode. I did run a few tests in a maximized window. Planes tended to be slower than in fullscreen mode and sprites were faster.

Login to post a reply

Server time is: 2024-04-19 21:59:09
Your offset time is: 2024-04-19 21:59:09