Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Simple 3D Texture Background
Started by Matthew Pringle Aug 21 2010 10:39 PM

13 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

Hey

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

See here for how it should look.

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
uid: 5354 topic_id: 1743 reply_id: 301743


[TOPIC: post.html]
#2

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

uid: 5354 topic_id: 1743 reply_id: 5140


[TOPIC: post.html]
#3

MarkHenryC

[GLOBAL: userInfoPane.html]
MarkHenryC
  • Contributor

  • 181 posts
  • Corona SDK

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()

uid: 3953 topic_id: 1743 reply_id: 5148


[TOPIC: post.html]
#4

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

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.
uid: 5354 topic_id: 1743 reply_id: 5165


[TOPIC: post.html]
#5

MarkHenryC

[GLOBAL: userInfoPane.html]
MarkHenryC
  • Contributor

  • 181 posts
  • Corona SDK

Bitmap manipulation would be nice to have. Either as a Lua lib or a plain x-platform C plugin.
uid: 3953 topic_id: 1743 reply_id: 5173


[TOPIC: post.html]
#6

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

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

uid: 5354 topic_id: 1743 reply_id: 5199


[TOPIC: post.html]
#7

MarkHenryC

[GLOBAL: userInfoPane.html]
MarkHenryC
  • Contributor

  • 181 posts
  • Corona SDK

Thanks for sharing that. Very impressive. Runs real smooth on my 3GS. Amazing how many tricks you can tease out the script API.
uid: 3953 topic_id: 1743 reply_id: 5210


[TOPIC: post.html]
#8

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

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!

uid: 5354 topic_id: 1743 reply_id: 5264


[TOPIC: post.html]
#9

evank

[GLOBAL: userInfoPane.html]
evank
  • Contributor

  • 317 posts
  • Alumni

Whoa -- nice effect!
uid: 3007 topic_id: 1743 reply_id: 5453


[TOPIC: post.html]
#10

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

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!
uid: 5354 topic_id: 1743 reply_id: 5486


[TOPIC: post.html]
#11

chrislott

[GLOBAL: userInfoPane.html]
chrislott
  • Enthusiast

  • 39 posts
  • Corona SDK

Any updates to this? I would love to use this in some future projects!
uid: 5022 topic_id: 1743 reply_id: 6557


[TOPIC: post.html]
#12

jmp909

[GLOBAL: userInfoPane.html]
jmp909
  • Corona Geek

  • 1,328 posts
  • Corona SDK

looks great. will fire this up when i get home
uid: 6645 topic_id: 1743 reply_id: 9971


[TOPIC: post.html]
#13

Matthew Pringle

[GLOBAL: userInfoPane.html]
Matthew Pringle
  • Contributor

  • 660 posts
  • Corona SDK

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.
uid: 5354 topic_id: 1743 reply_id: 9974


[TOPIC: post.html]
#14

jmp909

[GLOBAL: userInfoPane.html]
jmp909
  • Corona Geek

  • 1,328 posts
  • Corona SDK

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



[topic_controls]
[/topic_controls]