MovieMaterial Smoothing problem Away3D 3 (latest FP10 trunk) & Away3Dlite 1.0.4

Software: Away3D 3.x

PiV, Newbie
Posted: 24 November 2011 09:07 AM   Total Posts: 3

Hi forum members,

it’s one month that I start to work with both Away3D & Away3D Lite but I don’t know if I wrong understand the documentation or if there is a bug in the both latest version of the two engine.

Why the Engine apply Smoothing on MOVIEMATERIAL only with SWF file?

If I try to load FLV, MOV (h263), MP4 etc. the movie material that is currently applied to a plane that changes its size is displayed so horrible (this not seems to apply to the same FLV if I embed it in SWF file).

I’ve checked the material properties during runtime and Smoothing is always set to TRUE.

Any help would be appreciated.
Thanks in advance.

PART OF CODE:

var planeMaterial:MovieMaterial;
var video:Video = new Video();
video.smoothing = true;
 
var connection:NetConnection = new NetConnection();
connection.connect(null);
 
var stream_ns:NetStream = new NetStream( connection );
stream_ns.addEventListener(NetStatusEvent.NET_STATUS, loop);
 
var client = new Object();
stream_ns.client = client;
client.onMetaData = onMetaData;
 
video.attachNetStream( stream_ns );
stream_ns.play( sPath );

var movieSprite:Sprite = new Sprite();
movieSprite.addChild( video );
 
planeMaterial = new MovieMaterial( movieSprite, null, true, false );
planeMaterial.smooth = true;
createPlane( planeMaterial, nWidth, nHeight, true );

   

Avatar
Fabrice Closier, Administrator
Posted: 24 November 2011 10:47 AM   Total Posts: 1265   [ # 1 ]

Why not using VideoMaterial?

note that you can define the size. As the first “canvas” size is defined as a default 320x270. I bet thats why it’s not smooth.
Using fixedWidth, fixedHeight you can ensure its 1/1 as you want it to be.

Note that you could do this as well, except you would declare the movieMaterial once you got the w&h on metadata.

   

PiV, Newbie
Posted: 24 November 2011 10:55 AM   Total Posts: 3   [ # 2 ]

Hi Fabrice,

first of all thanks for your support. I’ve not consider VideoMaterial because the project was developer in Away3DLite (after this problem we have made some test using the Away3D engine but unfortunately with the same results….. but we have discovered that in our case the speed of two engines are not so different)

Anyway, what do you mean for for first “canvas”? Should I enable the ownCanvas for the planes that contains video materials?

Another question: why smooth properties doesn’t works as expected?

   

PiV, Newbie
Posted: 24 November 2011 11:19 AM   Total Posts: 3   [ # 3 ]

Fabrice I’ve got the point (or you have inspired another solution)....

When you talked about canvas I’ve first edited the material constructor adding the Rect dimension of my video as following:

pre:
planeMaterial = new MovieMaterial( mcVideo, null ));

post:
planeMaterial = new MovieMaterial( mcVideo, new Rectangle( 0, 0, nWidth, nHeight ));

As result of this change I’ve seen that the movie was displayed very small in the top left corner of the plane (that was created with the correct dimensions).

So I’ve god the point: probably the problem was that the texture was stretched because the movieclip/sprite container doesn’t has the right dimensions.

var mcVideo:MovieClip = new MovieClip();
mcVideo.addChild( video );
mcVideo.width = nWidth; <-I thought it was set automatically
mcVideo.height = nHeight; <-I thought it was set automatically

I’ve set the MovieClip container size and voilĂ , the texture finally sees correctly.

Actually I don’t understand why I’ve to set both MovieClip and Rect properties to obtain the correct result but the most important thing is that now all works well.

——

Do you think that the VideoMaterial of Away3D engine should be the best and, more important, the fast way to display a video texture?

(sorry for my poor English)

 

   

Avatar
Fabrice Closier, Administrator
Posted: 24 November 2011 12:59 PM   Total Posts: 1265   [ # 4 ]

Yes you got the picture. By “canvas”, I mean the bitmapdata that the material draws into (we’re are in html5 era man, I use html5 terms to be hip). It needs to be set at the dimensions of the video.

mcVideo.width = nWidth; <-I thought it was set automatically
mcVideo.height = nHeight; <-I thought it was set automatically

No because you do not use VideoMaterial, that’s your job to set the dimensions either at init if you load only videos of same size or change the vars describe above so that they update the size on metadata.
The material bitmapData is a “receiver”, it doesn’t know your video size.

By defining a rect, you do like html embeds (being hip again) you do reserve a space. You even have another option, probably not usable in your case, but say you have a massive video, camera is still, and left in a 50x50 region there is a dude dancing…  if you would define clipRect = 100,100, 50 50, only the dude region would be updated… less draw, less cpu. So if you push the optimalisation a bit further, keypoints set in your video could even update this runtime…


(sorry for my poor English)  -> I’m French, don’t worry about that smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X