Road trip animation in Papervision3D

Click to see the demo

I have been thinking about doing something like this for some time now, but I had no idea where to start. However, recently, after I experimented with animating vertices in Papervision3D, things started to look brighter, so a couple of days ago I sat down and started coding…

Basic concept here is that there is one Plane and two BitmapData objects - a texture and a terrain. The Plane never moves, but instead the texture and the terrain are scrolled on it.

The texture is assigned as material to the plane. At each frame the texture BitmapData is scrolled by an offset and the material is updated.

The terrain is a grey scale bitmap. It is scrolled in the same way as the texture. Each pixel of the terrain is mapped to a single vertex of the plane - the lighter the pixel color is, the higher the z position of the vertex will be. It is done the the same way as in my previous example. Only this time it is not a generated noise, but rather a map drawn manually, so that is works good with the texture.

Hills and turns. Additionally, each vertex on the plane has its x and z positions rearranged continuously using Math.sin() and Math.cos() functions with different phases - that creates the illusion of uphills, downhills and turns…

Lighting. Finally there is one more bitmap - a light map, that is blended with the texture using MULTIPLY mode to create the effect of light and darkness.

Source. I think it is a pretty nice effect and a good starting point for maybe a car racing game or something. Check the demo, try it in full screen by pressing SPACE and grab the source to see it in detail (also available in a zip bundle containing all the graphical assets I used).

Credits. In this demo I used textures from OpenFootage.net. They have some great stuff in there!

20 Responses to “Road trip animation in Papervision3D”

  1. FlashBookmarks Says:

    Thanks for the share looks really nice well done.

  2. Source | Road trip animation in Papervision3D « Flash Enabled Blog Says:

    […] Bartek Drozdz posted a cool Papervision 3D animation. Basic concept in this animation is that there is one Plane and two BitmapData objects - a texture and a terrain […]

  3. Den Ivanov Says:

    very nice demo!

    love it

  4. Fabianv Says:

    Just awesome

  5. Road trip animation « Papervision3D - Developers Says:

    […] trip animation Really nice road animation by Bartek Drozdz from Everyday […]

  6. Evan Mullins Says:

    Well done. I can totally see this as a starting point for a game.

  7. Ozgur Uksal Says:

    nice

  8. Pedro Says:

    Awesome man, great work!

  9. Raphael Santos Says:

    Very nice. Thanks for sharing.

  10. Zack Jordan Says:

    That’s pretty impressive. I can think of a lot of possibilities for something like this.

  11. Roger Says:

    Awesome, this would make a great demo-effect!

  12. Foronc Says:

    That is just excellent! You are sure good at this. Congratulations!

  13. Mark Barcinski Says:

    Great stuff!, I love it.

    Funny thing is that i wanted do the same thing :)

  14. Mr.doob Says:

    Nice use of the available resources! :D

  15. Proti Says:

    well, there is nothing to add. ;-)

  16. wonderwhy-er Says:

    Wow. Just wow :D Could be a good base for driving game :)

  17. Animando un Camino (Carretera) en 3D con ActionScript y Pv3D « Shift F12 Says:

    […] Cómo hacer para que nuestro usuario experimente el estar siguiente un camino en una carretera?… Este tutorial es la respuesta. Incluye código fuente! […]

  18. Harshal Says:

    Hi

    I am new to AS3 I just downloaded the source & made roadtrip.as the document class (Of course everything is in correct class path ). But when I try to run it is throwing some init error on runtime but not at compile time. Can u explain why this is happening ?

    Many thanks in advance.

  19. bartek drozdz Says:

    @Harshal. using the Flash IDE it is possible that is does not work correctly - because of the way I embed assets. I just posted a note on this, and it is here. If you still have problems let me know.

  20. I like it very much! Says:

    Great work!

    So,I use your soure to make my websit!

    And thank you very much!

Leave a Reply