*blog... kind of... *rss
graphics.beginBitmapFill, opacity? blending? pretty please...
1 commentThe classic question on interviews lately is "What would you ask Adobe to improve on the Flash player?". Well, I finally have a real thing to ask the guys and is to give some love to graphics.beginBitmapFill.
Since the beginning there were 2 ways of rendering your 3d scene in flash.
1. Render everything in a single Sprite / MovieClip.
2. Create a Sprite / MovieClip for each triangle or Mesh.
The second option was the most useful because you had easily properties such as opacity and even blending as Sprite/MovieClip have already those properties, but, performance-wise, option 1 was the winner hands down. So, as people wants speed, some engines have gone through the option 1 and then spent time trying to find ways to hack the properties that you get for free with option 2.
If you take a look on the drawTriangle loop inside Papervision3d in instance you'll find this:
I even had to do a hack for a project where in order to be able to change the opacity of one material dynamicaly I had to generate an array of bitmapDatas with the original texture with different levels of transparency... nasty!
Wouldn't it be great if you could tell the amount of opacity and which blending to use to the beginBitmapFill?
Since the beginning there were 2 ways of rendering your 3d scene in flash.
1. Render everything in a single Sprite / MovieClip.
2. Create a Sprite / MovieClip for each triangle or Mesh.
The second option was the most useful because you had easily properties such as opacity and even blending as Sprite/MovieClip have already those properties, but, performance-wise, option 1 was the winner hands down. So, as people wants speed, some engines have gone through the option 1 and then spent time trying to find ways to hack the properties that you get for free with option 2.
If you take a look on the drawTriangle loop inside Papervision3d in instance you'll find this:
graphics.beginBitmapFill( altBitmap ? altBitmap : bitmap, _localMatrix, tiled, smooth);
I even had to do a hack for a project where in order to be able to change the opacity of one material dynamicaly I had to generate an array of bitmapDatas with the original texture with different levels of transparency... nasty!
Wouldn't it be great if you could tell the amount of opacity and which blending to use to the beginBitmapFill?
*profile

traditional id: Ricardo Cabello Miguel
based in: London, UK
more: github, twitter, twitpic, soundcloud and flattr
*post nav
Em cartoons
FlashDevelop3 Beta6 - Ctrl+Shift+1
Navis explains the demoscene
Kokoromi's Fez
Hierarchy definition
graphics.beginBitmapFill, opacity? blending? pretty please...
My code.google
TypeError: Error #1010: A term is undefined and has no properties.
Jordi "Shine" Ros and his Hobbies
Back from Hong Kong
and... can I share a printer in Ubuntu so I can print from Windows XP?
I have coded a 3D engine in flash AS myself, and I found this article while searching for existing solutions. I guess there simply aren't any.
Making a Sprite per triangle and then set its alpha is indeed an expensive method as it will cost me way to many triangles compared to drawing all triangles in one Sprite.
As a coder, I prefer a smooth game over a beautiful game. I'll stick to basic shading for now, let's hope I can get the gradientFill working properly and fast enough to enable smooth groups.
Cheers all..