RESOLVED: BitmapData background in View3D

Software: Away3D 4.x

Flávio Keglevich, Newbie
Posted: 25 July 2011 08:09 PM   Total Posts: 1

Hi, I’m new in this forum and this is my first topic smile (And my english is bad)

My question is: There is a way to use a BitmapData instead of a background color in a View3D instance ? (something like a backgroundBitmap property)

Yes, I could use a textured plane in the back of all objects, but I really don’t know how to do it (correctly). My purpose is just to test and benchmark Augumented Reality using fp11. If I discover something, I’ll post in this topic.
Thanks wink


David Lenaerts, Administrator
Posted: 27 July 2011 12:47 PM   Total Posts: 80   [ # 1 ]

This is one that’s been requested quite often, so I added a View3D::backgroundImage property. Have fun with it smile


Flávio Keglevich, Newbie
Posted: 28 July 2011 09:51 PM   Total Posts: 1   [ # 2 ]

Oh thanks! (:


Choons, Sr. Member
Posted: 29 July 2011 12:11 AM   Total Posts: 281   [ # 3 ]

nice! Welcome to the forum, Flavio. You have already made quite an impression wink

Thanks, David! Been wanting that quite a while myself.


iwoj, Newbie
Posted: 21 September 2011 07:57 AM   Total Posts: 5   [ # 4 ]

It seems that View3D resizes the backgroundImage into a square.

This feature is almost perfect, but my backgrounds need to be rectangular. Or at the very least it should tile instead of “smearing.”


Alejandro Santander, Administrator
Posted: 22 September 2011 11:55 PM   Total Posts: 414   [ # 5 ]

If you update to the latest source on GitHub, you can now do:

view.backgroundImageFitToViewPort false

iwoj, Newbie
Posted: 23 September 2011 05:19 AM   Total Posts: 5   [ # 6 ]

Thanks Alejandro. I did a fresh git pull from away3d-core-fp11 and recompiled with the flag you provided, but now the texture doesn’t appear at all. What up with that?


Alejandro Santander, Administrator
Posted: 23 September 2011 04:17 PM   Total Posts: 414   [ # 7 ]

iwoj, I made some thorough testing again today and I don’t seem to be having a problem, can you show me a snippet of the code you are using? size of image? thx


iwoj, Newbie
Posted: 25 September 2011 10:01 AM   Total Posts: 5   [ # 8 ]

  camera = new Camera3D();
  camera.z = -150;
  view = new View3D(new Scene3D(), camera);
  view.antiAlias = 4;
  var starField:BitmapData = new StarFieldBitmapData();
  view.backgroundImage = starField;
  view.backgroundImageFitToViewPort = false;
  scene = view.scene;

The StarFieldBitmapData class is a a library Bitmap in my Flash Professional CS5 .fla file. It’s a 2500 x 1250px JPG file.

Does that help at all?


Alejandro Santander, Administrator
Posted: 25 September 2011 07:13 PM   Total Posts: 414   [ # 9 ]

Textures in Away3D 4.x must NOT exceed 2048px per side.
I’ve tried the bg image with a 2048x2048px size image and it works just fine.


Choons, Sr. Member
Posted: 25 September 2011 07:20 PM   Total Posts: 281   [ # 10 ]

you mean must not exceed 2048 px rght?


Alejandro Santander, Administrator
Posted: 25 September 2011 07:33 PM   Total Posts: 414   [ # 11 ]

yeah, thanks Choons, Sunday morning typo error… (post edited)


iwoj, Newbie
Posted: 25 September 2011 09:50 PM   Total Posts: 5   [ # 12 ]

Thanks Alejandro.

I tried updating the Flash graphic asset with a texture that is 2048 x 1250, but it didn’t appear. I also tried 1024 x 1024, but no luck. I’m probably missing something obvious. Any ideas?


Choons, Sr. Member
Posted: 25 September 2011 11:01 PM   Total Posts: 281   [ # 13 ]

how about simplifying your initialization to only:

view = new View3D();
view.antiAlias = 4; = -150;

get rid of that scene = view.scene line and the view3d parameters and just let it initialize the camera & scene by default and see if that makes a difference.

Also it looks like you may need to do

var starField:BitmapData = new StarFieldBitmapData().bitmapData; <—?



iwoj, Newbie
Posted: 26 September 2011 12:54 AM   Total Posts: 5   [ # 14 ]

Thanks for the code cleanup. It does simplify it, but it didn’t change the the scene at all.

StarFieldBitmapData is already a BitmapData object, so it doesn’t have a bitmapData field.

I never was able to get backgroundImageFitToViewport = false to work, so I just dropped my image below 2048 pixels to get rid of the smear.

Alejandro: could you describe your test code and assets?


Bill2Molehill, Newbie
Posted: 25 October 2011 08:14 AM   Total Posts: 4   [ # 15 ]

I encountered a problem when i use View3D::backgroundImage property: my view is 1024*768, and backgroundImage is 1024*1024, so backgroundImage is stretched, this is not what I expected, when i use backgroundImage with 1024*768, the backgroundImage doesn’t appear at all, beacause it isn’t BitmapData Valid.
how to deal with this issue ?

‹‹ c4d awd2 exporter


Away3D Forum

Member Login