1

I'm working on a spherical movie viewer in Away3D & am having a problem when I apply a VideoMaterial texture to a 3D primitive. The video appears heavily pixellated, like it's being scaled or hugely compressed. When I apply a BitmapMaterial of a single still image from the video it appears fine, so I don't think the resolution of the video is the problem.

I found [this discussion][1] suggesting a solution by specifying the "fixedHeight" & "fixedWidth" when I call the constructor, but those arguements seem to have no effect, and I can't find them in the API either. I do see something called "lockH" & "lockW," [in the API][3], but I they don't seem to have any effect either.

Here's the code constructing the VideoMaterial.

//basic intro setup stuff and then...
var videoURL:String = "assets/clip.flv";
this.primitive = new Sphere({material:"blue:#cyan", radius:50000, rotationX:100, segmentsW:30, segmentsH:30});
//more code to setup the rest of the scene, and implement some texture switching, then...
this.primitive.material = new VideoMaterial({file:videoURL, lockH:1000, lockW:2000});

For reference, I'm building off this example as a starting point, and I'm using Away3D 3.6 & Flex 4.5.1 in Eclipse Indigo.

[1]: [3]:

aVeRTRAC
  • 121
  • 5
  • Links I couldn't post: the discussion I mention: http://groups.google.com/group/away3d-dev/browse_thread/thread/c63933543f84b781?pli=1 the API reference for 3.6 Video Material: http://away3d.com/livedocs/3.6.0_lib/away3d/materials/VideoMaterial.html#protectedMethodSummary – aVeRTRAC Aug 11 '11 at 22:16

2 Answers2

2

To get rid of the pixelation, set smooth to true. This will obviously not increase the resolution, but it will activate anti-aliasing, the same way that smoothing=true on a native BitmapData does (internally that's exactly what it does.)

If you are going to use a video or bitmap material on a sphere that is used as an environment in a full-screen view, you will need to have a really high resolution video/bitmap. At any one time you can only see at most a third of the sphere surface, and it covers a screen area of more than 1000 pixels in width, so that tells me that your video will need to be at least 3000 pixels wide for it not to suffer from stretch issues.

richardolsson
  • 4,041
  • 1
  • 17
  • 19
  • The resolution of the material was not the problem. If I used a single image from the same video sequence at the same resolution, it looked acceptable. – aVeRTRAC Apr 17 '12 at 19:47
0

I'm afraid to say that this is 'normal'. It mostly has to do with the efficiency of actionscript code and the lack of hardware acceleration and anti-aliasing. It's essentially impossible to do a transform of your video onto a primitive without having some sort of loss in quality because frankly, actionscript isn't really made for this kind of intense calculations.

With that said however, there is hope. There's a new Flash Player coming out "soonish" (or so I've heard) that will have a basic hardware accelerated 3D renderer (codename "Molehill") that Away3d and other 3d engines (like Alternativa) is hard at work implementing already. This would mean that the video would then be anti-aliased and should therefor be smooth, but I can't confirm this since I've never tried.

J_A_X
  • 12,857
  • 1
  • 25
  • 31
  • I thought that Away3D *did* support hardware acceleration. Or was that just some message board hype I got confused with? – aVeRTRAC Aug 12 '11 at 15:18
  • @jonnyflash, yes and no. Flash Player does hardware accelleration when it can, but Away3d can't do 3d acceleration right now until molehill comes out. However, I have seen some demos of Away3d with molehill (which isn't out yet) and it's amazing. Maybe that's what they were talking about... – J_A_X Aug 13 '11 at 02:17
  • Here's a link to my project. Does this look like a HW acceleration issue? It looks like a scaling issue to me(as in my texture is being scaled waaay to big, hence the aliasing.) [SWF file](http://artslab.unm.edu/pano/app.swf "SWF File") & [Source Code](http://artslab.unm.edu/pano/away3d_3_6_pano.txt "Source Code") – aVeRTRAC Aug 15 '11 at 18:01
  • It could be that your texture is scaled too big. Did you try reducing the size? Still, AA on away3d is probably not up to part with GPU accelerated counterparts. – J_A_X Aug 16 '11 at 01:29
  • What do you mean "reduce the size?" I tried setting the radius of the sphere to 5000(10%) and it had not noticeable difference. As I mentioned earlier, changing the lockW & lockH parameters also has no noticeable differences. – aVeRTRAC Aug 16 '11 at 17:49
  • I meant, the width/height of the texture. Yeah, I don't think you can fix it. You can always try to bug the creators of Away3d (they probably have a forum). – J_A_X Aug 16 '11 at 23:26