A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 40

Thread: [Show - F8] 3D Tunnel Driving

  1. #1
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188

    [Show - F8] 3D Tunnel Driving

    This is just a quick example of something I've been thinkering with for a couple of hours. Now, I know that there are still some clipping problems, the view distance has to be improved, and the car looks totally out of place, but check it out anyway :

    http://www.gamesquid.com/temp_/tunnel/

    EDIT: slightly more impressive version : http://www.gamesquid.com/temp_/tunnel/tunnel2.html

    Use the left and right arrows to steer. I think it runs pretty fast, but have only checked on one computer. I'll be working on slopes and bends next.


    Anyone care to guess how it works?
    Last edited by Fall_X; 10-13-2006 at 09:05 PM.

  2. #2
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    "Anyone care to guess how it works?"

    Guess not like the similar demo I posted years back which just looped through anim frames

    Displacement maps are handy for this kind of effect

    Squize.

  3. #3
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    Nope, no anim frames, and no displacement maps

    I'd like to see your similar demo though.


    Anyone else have any idea? It's kind of an easy trick, and it's probably been done before. It's actually fake 3d, but some basic 3d math is involved.
    Last edited by Fall_X; 10-13-2006 at 10:21 AM.

  4. #4
    Senior Member
    Join Date
    Jan 2006
    Location
    USA
    Posts
    383
    Didn't really think about it much, but just noticed something that seems a little buggy to me.

    Should the background really be rotating perfectly with the tunnel? It seems like because it's out in the distance, it wouldn't rotate as much.

  5. #5
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    plain layers with opacity bitmaps in it to scroll through(prop. scalar effect),- not that impressive imo.
    It would be more interesting if you´d control the view on the x/y-axis aswell-, so that the depth effect would be visible even more.
    Like now it just feels as a motion that can be rotated

  6. #6
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    I never claimed that it was impressive, I was just curious if anyone would figure it out. The game I'll make with this technique, on the other hand, will be impressive

  7. #7
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,796
    My guess is scaling MCs

  8. #8
    self-portrait Kianis's Avatar
    Join Date
    Feb 2004
    Location
    Stockholm, Sweden
    Posts
    425
    Reminds me of torus troopers by Kenta Cho. Nice one!
    // Mazapán, my portfolio

  9. #9
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    well dont mind my harsh words then,- its just the writing:
    Anyone care to guess how it works?
    made me think you´d used something special,- something that wasn´t used that much before.

    have you tested it with animated movieClips,- or with a delay in the rotation of the layers so that you get a twist effect? There is much potential within this field

  10. #10
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    754
    Quote Originally Posted by AfternoonDelite
    Should the background really be rotating perfectly with the tunnel? It seems like because it's out in the distance, it wouldn't rotate as much.
    If you lie in your bed an d watch aside, your alarmclock is turned 90 degrees in your view, but the painting on the wall only 45?

  11. #11
    Senior Member
    Join Date
    Jan 2006
    Location
    USA
    Posts
    383
    Quote Originally Posted by walnoot
    If you lie in your bed an d watch aside, your alarmclock is turned 90 degrees in your view, but the painting on the wall only 45?
    That's a little drastic for a painting on the wall, don't you think?

    I was just saying it didn't feel right.

  12. #12
    \x3a\x6f\x29
    Join Date
    Sep 2005
    Location
    paris
    Posts
    88
    you could do this using the oldschool starfield effect. something like

    Code:
    for ( ... )
    {
    	p.z -= speed
    	  
    	if ( p.z <= 0 )
    		resetPoint( p );
    
    	tx = ( p.x / p.z ) + cx;
    	ty = ( p.y / p.z ) + cy;
    
    	if ( tx < 0 || tx > width || ty < 0 || ty > height )
    	{
    		resetPoint( p );
    		continue;
    	}
    }
    that would do the same. runs fast, i like it.

  13. #13
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    754
    Quote Originally Posted by AfternoonDelite
    That's a little drastic for a painting on the wall, don't you think?

    I was just saying it didn't feel right.
    You said something untrue, that doesn't matter, I just thought I could explain to you there's no parallax scrolling effect when you turn your head upside down.

  14. #14
    Pencil Farmer cadin's Avatar
    Join Date
    Jul 2006
    Location
    Vancouver BC
    Posts
    323
    I want to be able to drive all the way around (on the ceiling).

  15. #15
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    Quote Originally Posted by cadin
    I want to be able to drive all the way around (on the ceiling).
    Yeah, there will be parts where that's possible, in the full game. There will be parts where there is a ceiling, and also very narrow parts, holes in the floor, etc (that is, if it keeps my interest long enough). This swf was just a 50 lines experiment, so all that is for later.

    About the rotation : go stand upside down - everything will have rotated the same amount (180 degrees).

    And yes, the effect is just 5 movieclips with a hole in them, which are scaled using basic 3d maths. When one gets a negative depth, it is moved to the back. Fairly simple, but I don't think I've seen a game using this technique yet.

  16. #16
    Senior Member walnoot's Avatar
    Join Date
    Apr 2005
    Posts
    754
    Don't want to be rude, and I'd really like to see your game finished, but doesn't seconds of madness work on the same principle?

  17. #17
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    Well, yeah, probably. That's not rude at all, thanks for pointing that out. I knew this was too easy, somebody had to have done it before
    However, I will also try to have bends (those parts will have to be less detailed, more watery and alpha-blended, because it wouldn't work with straight lines etc).

  18. #18
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    Quote Originally Posted by Fall_X
    About the rotation : go stand upside down - everything will have rotated the same amount (180 degrees).
    However, I just tried moving (not rotating) the background a few pixels in the same direction as the rotation, and it does give it more depth and looks more realistic. So thanks AfternoonDelight for making me think about it.

  19. #19
    file not found Captain_404's Avatar
    Join Date
    Apr 2006
    Posts
    457
    I think one ofthe reasons people find it unnatural is because it is an ovular track, when you rotate an oval and something is on the bottom, it seems like that thing should move up or down or something. If it were a circular track, I don't think you'd get as many "it's not natural" complaints.

  20. #20
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462
    I like it but what do you do??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center