AFTC TUTORIAL: Away3D 4.0.9 - Build your own VideoMaterial (demo and full source)

Software: Away3D 4.x

Avatar
Darcey, Moderator
Posted: 08 October 2012 04:01 AM   Total Posts: 209

Ok, it’s been a while, but here’s the start of the AFTC Away3D 4.x branch.

NEW Article:
Away3D 4 - How to create your own Video Material using NetStream & NetConnection. As always online demo and full source available.

http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article.php?index=4&subindex=3&aid=331


Code on…

   

Avatar
80prozent, Sr. Member
Posted: 08 October 2012 01:33 PM   Total Posts: 430   [ # 1 ]

hi darcey

great class
runs very smooth on my machine

thank you

have you tried if this works with a skybox (cubeTexture) ?

 Signature 

sorry…i hope my actionscript is better than my english…

   

Avatar
Darcey, Moderator
Posted: 08 October 2012 01:40 PM   Total Posts: 209   [ # 2 ]

It shouldn’t be a problem with a cube texture…
The second article I wrote was using the same texture on planes placed at cross sections on a wire frame sphere.

My server will be up and down for a while today, seems hostpapa are having some issues and can’t be arsed to pick up the phone….

Skybox article will be online soon but using standard materials for people to get the basics of it 1st… I will cook up a video one after it for fun smile

   

Avatar
Darcey, Moderator
Posted: 08 October 2012 08:57 PM   Total Posts: 209   [ # 3 ]

@80prozent:

The resources limit was hit too easily with skybox and it’s bitmap setup so I just made one out of planes with the classic plane cube. Doesn’t drop below 30/30 for me.

http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article.php?index=4&subindex=3&aid=334

   

JoeMac, Newbie
Posted: 12 October 2012 02:25 PM   Total Posts: 7   [ # 4 ]

This is great!  I have a question before I get to work on my version. Should it work on Air on an Android?  I tried loading a video using Netconnection etc, and the first frame displayed (so it found it), then it crashed my entire Away3d app.  (The same app worked on my pc in Flashbuilder Android emulator mode.) Thanks!

   

Avatar
Darcey, Moderator
Posted: 12 October 2012 03:21 PM   Total Posts: 209   [ # 5 ]

If the video file is found via netconnection in AIR then it should work, but it may be a bit much for many phones.

Try a very small video file size and width & height and place it on a very small plane and see what happens.

I’ve discovered AIR and 3D is just to unstable and not quite working correctly, so, I personally am leaving the AIR dev to 2D based flex applications. I’ve taken the 3D side of things over to either direct devlopment via Eclipse and the Android SDK or Unity.

Also don’t trust the AIR emulators in FlashBuilder for the mobiles, the results are often never the same. Same goes for the emulators in the Android SDK but I feel they are more on the ball than FB 4.6 & AIR 3.4

If you enable stencil drawing, the limit on the Galaxy S1 is 72 textured planes with directional light produces a correct z sorting thanks to stencil drawing set to true/enabled but cpu lag jump on accelerometer movement and a steady 10/30 fps. Turn off stencil drawing and the things runs smooth as can be but z-sorting is out the window, thus my move away from FB AIR Android for 3D.

Good luck

D

   

Avatar
Darcey, Moderator
Posted: 12 October 2012 04:08 PM   Total Posts: 209   [ # 6 ]

DEMO: Air 3.4 + Away3D 4.0.9 + 2D Video for Android mobile phones
Video, animation stencil off - z-sorting issues
Galaxy S1 - 10 to 15FPS - With delayed reaction times
Video plays 1st frame then nothing, click and wait for close video
http://www.allforthecode.co.uk/dev/apk/MobileCubePresentationDepthAndStencilOff.apk

DEMO: Air 3.4 + Away3D 4.0.9 + 2D Video for Android mobile phones
Galaxy S1 - 10 to 15FPS - With delayed reaction times
Video plays 1st frame then nothing, click and wait for close video
Video, animation stencil on - z-sorting fixed
http://www.allforthecode.co.uk/dev/apk/MobileCubePresentationDepthAndStencilOn.apk

DEMO: Unity 2 x OBJ models, textures, lightins and plane
http://www.allforthecode.co.uk/dev/apk/3DUnityOBJModelAndTextureTest.apk


So next up for me is to see how much work and how much faster using Eclipse with the Android SDK direct for 3D application development (will probably look at a few api’s for it).


D

   

JoeMac, Newbie
Posted: 12 October 2012 07:18 PM   Total Posts: 7   [ # 7 ]

I installed the first 2 apks and they worked great on my tablet as far as switching between the cube views, but I’m not seeing and live video.  Am I missing something?  (I appreciate the Air/Away3d 4 combo, I’m afraid that’s the environment I have to continue in, since I don’t have the chops that you do.)

Joe

   

Avatar
Darcey, Moderator
Posted: 12 October 2012 07:22 PM   Total Posts: 209   [ # 8 ]

Its often better to use “FileStream” with AIR for IO access.

Note, Adobe AIR is not as cross platform friendly as it says, I often find I have to make custom classes 1 for Mac and 1 for PC.

I just tested the Away3D 4 test apps on a different version OS on Galaxy S1 and it was 10fps faster - sadly an older version of driod :(

   

JoeMac, Newbie
Posted: 15 October 2012 04:49 PM   Total Posts: 7   [ # 9 ]

I’ve tried all sorts of things to get video to play through AIR on my Samsung Galaxy Note 10.1.  And I mean at all, let alone your Videomaterial test, that would be so great for my application.  I’ve tried StageVideo, different formats of videos… I get sound, but it turns my screen black.  Sorry for the confusion, but were you able to get video to play on your Galaxy?  I can run away3d Apps, no problem, but when I add video to it, I get the black screen.  (Same code works on Windows Desktop Air).  Sorry to keep bothering, but if you have some code that would run a video on a Galaxy via AIR that would be great.  Thanks!  -J

   

Avatar
Darcey, Moderator
Posted: 15 October 2012 04:55 PM   Total Posts: 209   [ # 10 ]

I will run some tests specifically on video for you and get back to you here.

That demos was built for desktops but it plays a single frame on my galaxy and then sound only.

I will make some tests in standard 2D and then 3D if 2D works and let you know.

D

   

Avatar
Darcey, Moderator
Posted: 15 October 2012 05:46 PM   Total Posts: 209   [ # 11 ]

Demo and Source for: Android AIR Mobile 2D Video Playback (using packaged video mp4 file):
http://www.allforthecode.co.uk/dev/air/index.php?folder=AIRMobile2DVideoPlaybackWithPackagedVideoFile


Demo and Source for: Android AIR Mobile 2D Video Playback Streamed (f4v): http://www.allforthecode.co.uk/dev/air/index.php?folder=AIRMobile2DVideoPlaybackStreamed


I just used my standard set of tools/classes (see my VideoPlayer in libs/com/darcey)


I am testing a 3D build now.

D

   

Avatar
Darcey, Moderator
Posted: 15 October 2012 06:36 PM   Total Posts: 209   [ # 12 ]

And here’s the VideoTexture working on AIR Android Mobile (streaming f4v):
http://www.allforthecode.co.uk/dev/air/index.php?folder=AIRMobile3DVideoTextureTest

As expected it was a cpu issue so I had to throttle the bitmap update.

The last 3 links all run on my Galaxy S1.

When are mobiles going to start shipping with NVidia graphics cards wink

   

JoeMac, Newbie
Posted: 17 October 2012 01:41 AM   Total Posts: 7   [ # 13 ]

Thanks, again!  I struggled to get it working on my Samsung Tablet, but finally figured out the issue.  If the video has the capability to run on the gpu, it will.  That eliminates the ability to do transformations, like getting the bitmap needed for the texture.  (at least that’s what I think.)  Once I use a .flv video, the Render State becomes software, and it all works.  Nice to have video material back.  Thanks,

Joe

   

Avatar
Darcey, Moderator
Posted: 17 October 2012 04:11 PM   Total Posts: 209   [ # 14 ]

Process flow as I see it goes:
1. Create 2D video player
2. Draw 2D video pixels to BitmapData
3. Update 3D objects texture with BitmapData

As for specifying GPU, Direct or Native modes, if you specify the incorrect one for the target device the application wont work at all.

As for my attempts at doing this in the Google Android SDK, talk about doing things the hard way! And the support community is not very helpful. I’m trying LibGDX at the moment. I got 2D OpenGL working in ES1.x and ES2.x but nothing in 3D yet. Documentation on what I need to do is hard to find and when I do find something on it, it’s either the wrong version for an obsolete version of the SDK/API or specifically for OpenGL ES2.0. Either way a lot of brick walls, and issues with the development environment setups.

File size differences from AIR apk files are laughable, on average 0.25mb to 1.5mb so far compared to AIR landing in around 9mb for hello world (but as far as im concerned air must be included in the apk as it’s an extra step for the user to use AIR content which is just not going to happen).

I would love to see Away3D OGLE API for Googles Android SDK wink

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X