Basic 3D shading test
// June 25th, 2009 // Experiments, Flash 3D, Source code & tutorials
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
)












Looks pretty amazing, is this based on papervision or something?
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.
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?
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.
Nice experiment!
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
[...] 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 [...]
[...] object, then you will probably need to write your own classes to do just that, much as this post by Neuro Productions [...]