Michael Jackson Pearl Jam Stevie Ray Vaughan Ozzy Osbourne Finntroll MP3 list A Fine Frenzy Capone Phil Collins Shakira Pink Floyd Keane

Basic Texturing (v2)

basic-texturing
download-source

Even if you had a chance to look at Getting started using BasicView.as this tutorial provides another example of basic texturing in Papervision.

In Papervision for the most part you have objects (planes, cubes, cones, 3D Models, etc) and then you have the textures or materials that you add to these objects. Think of it as getting a brand new iPhone and then buying a case or skin for that iPhone. We are essentially doing the same thing in principle - we have our object a cone (iPhone) and a material a bitmapMaterial (iPhone skin).

Actionscript:
  1. package 
  2. {
  3.     import flash.events.Event;
  4.     import org.papervision3d.view.BasicView;
  5.     import org.papervision3d.objects.primitives.Cone;
  6.     import org.papervision3d.materials.BitmapFileMaterial;
  7.    
  8.     public class Main extends BasicView
  9.     {
  10.         protected var cone:Cone
  11.         protected var bitmapMaterial:BitmapFileMaterial;
  12.        
  13.         public function Main()
  14.         {
  15.             super();
  16.             createChildren();
  17.             startRendering();
  18.         }
  19.         public function createChildren():void
  20.         {
  21.             //Create a new 3D object
  22.             bitmapMaterial = new BitmapFileMaterial("images/ourtex.jpg")
  23.             cone = new Cone(bitmapMaterial, 20, 200);
  24.            
  25.             //Set some properties
  26.             cone.scale = 4;
  27.             cone.pitch( -10);
  28.            
  29.             //Add to scene
  30.             scene.addChild(cone);
  31.         }
  32.        
  33.         override protected function onRenderTick(event:Event = null):void
  34.         {
  35.             super.onRenderTick(event);
  36.  
  37.             //Rotate
  38.             cone.yaw(3);
  39.         }
  40.     }
  41. }

As you can see from the code above we have a cone and a bitmap texture.

download-source

Post to Twitter Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to StumbleUpon Stumble This Post

4 Responses to “Basic Texturing (v2)”


  • Hi there,

    Thank you so much for these tutorials!
    Very helpful!
    It saved me a lot of time!

    Cheers!

    Ninja Girl

  • Is there a way I can create a texture on the back of an image so that the “material” is an image on oneside and a texture on the back side?

  • I really like your tutorials :)
    I ha ve a question. How to make a swf file as material?

  • Which editor are you using? I can get your sources to work but if I replace the dae files with mine they don’t work. I use Google Sketchup/Blender 2.49b Collada 1.4.0

Leave a Reply


Follow WovenCharlie on Twitter

Flash and the City banner
2010 Flash And The City Speaker

RSS Feed