PixelModeler Class



pixelwing.png

There has been a fair amount of talk on the Papervision3D list lately (and off it with me) about being able to map Pixels to a 3D object - so I have made a class to do just that.

See an example here. **Click and hold to see the Pixel model underneath. and your browser didn't crash - just let it load for a little while.

How to use the class

To get a Pixels object mapped to a 3D model, all you need to do is create a PixelModeler object and call createPixelModel.

Actionscript:
  1. //Create cube and modeler
  2. var c:Cube = new Cube(new MaterialsList({all:new ColorMaterial()}),500, 500, 500, 10, 10, 10);
  3. var modelr:PixelModeler = new PixelModeler();
  4.  
  5. //get a Pixels Object
  6. var p:Pixels = modelr.createPixelModel(bitmapEffectLayer, c.geometry.faces,1,1,0xFFFF6644);

createPixelModel takes 5 parameters:

  • layer - BitmapEffectLayer to attach Pixels too.
  • faces - Array of Triangle3D elements you wish to map your Pixels too.
  • subdivisions - How many times you want to subdivide the faces. (Creating a new center point)**
  • quaterFaces - How many times you wish to split each face into 4 new faces.**
  • color - Color of the Pixels

**Subdivision allows you to see the individual faces better. A new point is created in the center of each face. Subdividing faces is relatively quick. quaterFaces is great so you can more easily see the edges of your objects. But it is a very costly operation, so it would be better to divide your model's faces before you create your Pixel model - otherwise you will have a pause before you model loads.  There is no difference in speed once the Pixels have been generated.

Here is how the faces are split for subdivision and quarterfaces:

subdivision_quaterfaces.jpg

Get the Source here


7 Comments, Comment or Ping

  1. mobilebmx1988

    Fantastic!!!

    January 13th, 2008

  2. Wow! Excellent stuff Andy!

    January 13th, 2008

  3. aYo

    Simply Brill

    January 13th, 2008

  4. super tight andy!

    January 13th, 2008

  5. Evan

    Thank you so much Andy! Amazing and inspiring work!

    January 15th, 2008

  6. You should use this to simulate a slo-mo explosion.

    January 16th, 2008

Reply to “PixelModeler Class”