While working on the next demo for the new improved PhongMaterial, i wanted to add some animated texture on a model... but the MovieMaterial was just eating my cpu resources! So I've reused a concept I had in my bitmapdata engine.
I think that the animators among us will love this one: the new Away3d AnimatedBitmap class...
it's using no expensive draw(), no expensive copyPixels(), and it renders at the speed of regular texture like the BitmapMaterial!
It supports also loops, and will support much more play options since it seams to be fast, but right now i've more than enough to play with, so I will first finish that PhongShading demo!
It's been a while since my last post on materials. I thought it might be good to let see we are VERY busy right now with Away3D.
One of the latest feature, like this demo shows, is the normal mapping. Now natively implemented in the engine.
Any mesh using this new Material will reflect the environement or a given reflection map.
This is the first of this kind of materials and i have already a few more in the making.
How would you find being able to add phong shading coming from a given light source to your model?
Check this blog to see soon more of that shiny stuff!
Away3D rocks people!
k, Back to code now... too much fun!
Fabrice
PS: Rob is actually busy merging our codes for the next release.
PS2: Right click on model, open the Flashplayer menu, and select Away stats if you want some fps details...
Update
Made some tests last nite.
Code seams stabile and perform pretty well no matter model geometry being loaded...
Tried a 4206 faces overkill head model. FPS dropped down to 2fps and on init of the mesh the head.obj needed arround 2 seconds to intialize due to enormous amount of precalculations. The hummingbird model however with a respectable 974 faces count was running at a steady 25 fps very smootly.
I will try to improve the code on this...
I've turned 40 this weekend, so i thought it would be nice to celebrate...
First idea was: i do a cake! Nah... doesn't shine...
Since Away3D is now able to create anything looking expensive like gold or silver, i thought, what's the most expensive material on earth? Diamonds of course!
Everyone who has played with transparent objects knows you need alpha info, and then... well here it comes, what comes next? You need something to move light! So most go for double geometry, above each other. Did that too, but then you get a z-sorting artifact, all faces are swapping on and off. Useless.
So i've updated the enviroMaterial again to render faces another way...
Enjoy the Away3D diamond! The right amount of shinyness and face count!
Fabrice
I just couldn't accept having phong shading only facing you, this would simply be useless in most cases and you would probably choose to have textures with 'pre-baked' shading in order to get light coming from another direction just to better translate the scenery you want to build.
The model displayed in this demo has around 650 faces, all being runtime shaded by the code.
The code generates random color, camera position and light position. So some camera angles might look pretty weird but I think it adds some pretty cool drama on screen!
Keep in mind that sometimes the light will quickly turn when it is very near the target center of the model...it's because the light is being calculated at object level, just to save thousands of calculations per sec.
Fabrice
After days working on the code, it's finally there. A smooth shiny reflecting surface!
I let you judge of the quality and the performance... i'am very happy with this result, that's all i can say!
To get there and be able to make this demo, i got help from my friends Rob Bateman and Peter Kapelyan. Without them, i could have spend days on the code trying to find the bug i was looking for. And it was a nasty one... Peter shown us the way with his sharp eye and Rob killed the beast!
I'm very proud of the Away3D team, thank you guys, real teamwork!
Fabrice