Simple 3D Texture Background

13 replies [Last post]
Matthew Pringle
User offline. Last seen 5 weeks 22 hours ago. Offline
Joined: 23 Feb 2010

Hey

Im playing about getting a 3D style, repeating background, based around an old snes game Axlay.

See here for how it should look. http://www.youtube.com/watch?v=V3F3l-SiN78&feature=related

Well this is a really early demo, it seems to work (ish) but it needs a lot of work. It must be using a ton of texture memory at the moment.

You can download a is here http://www.alienhorde.com/files/demoEngine.zip

So what needs doing

1. The background should be a sprite rather than 240 individual pngs, theres a bug with the sprite engine though and I cant set sprite heights.

2. Better maths for calculating the perspective ( any help.... )

3. Make it faster, not too sure how as the movement it based on the position in the array the moment

Tested on a 3GS and it ran same as simulator. That should get better though with a proper setup

Replies

Matthew Pringle
User offline. Last seen 5 weeks 22 hours ago. Offline
Joined: 23 Feb 2010

MarkHenryC
User offline. Last seen 10 weeks 1 day ago. Offline
Joined: 11 Nov 2009

Nice idea. Hopefully they'll fix the sprite library soon and you can load the image in one go then define 320x1 frames size (this cause the simulator to crash for me when I called sprite.prepare()

Matthew Pringle
User offline. Last seen 5 weeks 22 hours ago. Offline
Joined: 23 Feb 2010

I just tried a version where I could do per pixel based transforms on a 160px x 160px grid/image of sprites 1px x 1px. Thats 25600 individual sprites!

Needless to say the simulator runs about 1 fps and used 100% on the computers cpu power.

I expected as much so wont be trying it on an actual phone.

Back to the drawing board.

MarkHenryC
User offline. Last seen 10 weeks 1 day ago. Offline
Joined: 11 Nov 2009

Bitmap manipulation would be nice to have. Either as a Lua lib or a plain x-platform C plugin.

Matthew Pringle
User offline. Last seen 5 weeks 22 hours ago. Offline
Joined: 23 Feb 2010

Right, version 2 is up, very early sample code...

Ive rewritten it to take one image and chop it into sprites this time. Setting is 48 sprites, 20px deep. The effect is coming along quite nicely, its a lot smoother now and its setup so I can increase the resolution of the 3D effect by increasing the sprites.

Ive included some easing functions, found in the sample code area of the site, by Stuart Carnie, which are used to draw the profile of the effect. At the moment im easing in from the horizon giving the effect the background is levelling off while the texture at the front has the effect of speeding up.

http://www.alienhorde.com/files/demoEngine2.zip

From

MarkHenryC
User offline. Last seen 10 weeks 1 day ago. Offline
Joined: 11 Nov 2009

Thanks for sharing that. Very impressive. Runs real smooth on my 3GS. Amazing how many tricks you can tease out the script API.

Matthew Pringle
User offline. Last seen 5 weeks 22 hours ago. Offline
Joined: 23 Feb 2010

Its getting better, this is a 640 x 640 texture applied. Sorry for the colours but I needed a good contrast to see how the tiles were looking.

With a complete texture it looks better!

evank
User offline. Last seen 1 year 18 weeks ago. Offline
Alumni
Joined: 16 Sep 2009

Whoa -- nice effect!

Matthew Pringle
User offline. Last seen 5 weeks 22 hours ago. Offline
Joined: 23 Feb 2010

Thanks Evan

Hows about building in the option to rotate objects into the 3rd dimension or allowing us to set the 4 corner points of a plane and have the texture warp with it.

Then I could have some real fun!

chrislott
User offline. Last seen 5 days 51 min ago. Offline
Joined: 19 Feb 2010

Any updates to this? I would love to use this in some future projects!

jmp909
User offline. Last seen 10 weeks 5 days ago. Offline
Joined: 14 May 2010

looks great. will fire this up when i get home

Matthew Pringle
User offline. Last seen 5 weeks 22 hours ago. Offline
Joined: 23 Feb 2010

Its not really usable at the moment but the demos work.

I was waiting for the sprite system to become stable before picking it up.

Hopefully with Carlos looking at vector3d transforms though it can be made to work much better.

jmp909
User offline. Last seen 10 weeks 5 days ago. Offline
Joined: 14 May 2010

great stuff. who wants to make this then? ;)
http://www.youtube.com/watch?v=dYMARqdP6Vw#t=0m20s

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.