Basic 3D shading test

// June 25th, 2009 // Experiments, Flash 3D, Source code & tutorials


as3 shading drawingAPI

An other try at 3D, this time a shading test.

I first wanted to try it with a PixelBender shader, but I found out you can’t use UVW mapping with a shaderFill? I also abandoned the whole drawTriangles method (to much disadvantages) and switched to the drawGraphicsData method, it’s not that fast as drawTriangles, but its much faster than the classic drawing API.

» View test

(drag to rotate the cube)
Source code: shader_source (Warning! Its a mess :) )

Share:

Post on Twitter
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Stumble Now!
Digg This
Reddit This
Vote on DZone

7 Responses to “Basic 3D shading test”

  1. Niels says:

    Looks pretty amazing, is this based on papervision or something?

  2. Kris says:

    Hi Niels,
    It’s no papervision3D it’s just native AS3, but I must say I learned a lot from it over time. There are certainly some similarities.

  3. Niels says:

    How far can you take this ? Is it just basic shapes and shading?
    I believe papervision is rebuilding large parts of its code-base to make more use of the native 3d functions of Flash.

    Now, this ‘drawTriangles’ thing is supposed to make 3d faster, what limitations made you abandong it?

  4. Kris says:

    I think you can go pretty far with it. And I’m waiting for the new Papervision3D to see how the handle the new 3D features

    There are a loot of problems with the drawTriangles method
    to name a few:
    -it doesn’t do z sorting
    -it uses the same indices for the UV mapping and the vertices
    -it can only mange one bitmap

    These things are all problematic for rendering complex models. I would be really surprised if drawTriangles is used in Papervision X.

  5. promethe says:

    Nice experiment! :D

    I’m working on a 3d API that handles the whole drawTriangles/z-sorting/shading mess.

    You can see a few samples here: http://www.directflex.net

  6. [...] a client asked me to do something which involved a lot of 3D cubes. I did some tests with cubes in the past and I knew the number of cubes you can render in Flash are relatively limited. Lets say [...]

  7. [...] object, then you will probably need to write your own classes to do just that, much as this post by Neuro Productions [...]

Leave a Reply