How to display 2 (or more) View3D together in Away3d 4?

Software: Away3D 4.x

jtopaz, Member
Posted: 12 July 2011 10:01 AM   Total Posts: 53

I want to display a View3D in the major screen and have a small popup preivew View3D panel. I tried but it seems the small popup review View3D panel cover the major screen. Does anyone know how to do it?

Thx

   

Somokon, Member
Posted: 12 July 2011 05:06 PM   Total Posts: 75   [ # 1 ]

Maybe looking at MultiViewTest.as in the examples will give you some ideas?

   

jtopaz, Member
Posted: 13 July 2011 04:16 PM   Total Posts: 53   [ # 2 ]

Thx, Somokon. It works.
But I am dealing a more complicate case.
My case is using away3d inside Flex Spark.
I try to put first View3D in the Background and try to open a popup with the second View3D.

The first View3D work when I wrap it inside SpriteVisualElement. When I try the same way using popup, the second View3D draw on the first View3D and cover it.

Any solution? thx

=================Code=================
<?xml version=“1.0” encoding=“utf-8”?>
<s:Application xmlns:fx=“http://ns.adobe.com/mxml/2009”
    xmlns:s=“library://ns.adobe.com/flex/spark”
    xmlns:mx=“library://ns.adobe.com/flex/mx”
    xmlns:sh=”*”
    width=“640” height=“480” frameRate=“60”
    backgroundAlpha=“0”    applicati>
<fx:Script>
  <![CDATA[
  import mx.events.FlexEvent;
  import mx.managers.*;
 
  protected function handler(event:FlexEvent):void
  {
  var 3d:SomeView3d= new SomeView3d();
  cont.addChild(3d);
 
  var pop:SomePopup= new SomePopup();
  PopUpManager.addPopUp(pop, this, false);
  }
 
  ]]>
</fx:Script>
<s:SpriteVisualElement id=“cont”>
</s:Application>
=================Code=================

=================Popup Code=================
<?xml version=“1.0” encoding=“utf-8”?>
<s:TitleWindow xmlns:fx=“http://ns.adobe.com/mxml/2009”
    xmlns:s=“library://ns.adobe.com/flex/spark”
    xmlns:mx=“library://ns.adobe.com/flex/mx” width=“381” height=“258” title=“Popup”    creati>
<fx:Script>
  <![CDATA[
  import mx.events.FlexEvent;
  import mx.managers.*;
 
  protected function handler(event:FlexEvent):void
  {
  var 3d:SomeView3d= new SomeView3d();
  cont.addChild(3d);
  }
  ]]>
</fx:Script>
<s:SpriteVisualElement id=“cont”>
</s:TitleWindow>
=================Popup Code=================

   

jtopaz, Member
Posted: 16 July 2011 05:51 PM   Total Posts: 53   [ # 3 ]

Anyway can help me for the “more complicate case”? thx

   

HowlingBard, Newbie
Posted: 24 August 2011 12:20 PM   Total Posts: 20   [ # 4 ]

Hi everybody and hi jtopaz! How are you?
So, I think we are facing quite the same problem, jtopaz. I need to transform a render in a texture or, in this case, in a bitmapData.
I was planning to capture images from a camera, set it in a material and set this material in a Sprite3D, then I found a method in the Away3D (v.3.5.0) docs(http://away3d.com/livedocs/3.5.0_lib/away3d/core/render/BitmapRenderSession.html) that does exactly what I need (“getBitmapData(view:View3D):BitmapData”). But I couldn’t find it neither in later docs(v.4.0 Beta) and neither in the Away3D files.
So, can anyone tell me if this method gonna be in this version or another way else to solve this problem?
Thanks for your time.

   

HowlingBard, Newbie
Posted: 24 August 2011 06:04 PM   Total Posts: 20   [ # 5 ]

Anyone have a suggestion?

   

Avatar
theMightyAtom, Sr. Member
Posted: 24 August 2011 08:18 PM   Total Posts: 669   [ # 6 ]

jtopaz > I think your problem is that Spark is designed to manage members of the flash displaylist, and not Molehill windows that have a separate life below the display list. So when you move a pop-up window, it’s not going to move the Molehill window automatically.
In Molehill you would use Stage3D[0].x and Stage3D[0].y as well as setting the size of the backBuffer in Context3D.
With Away3D you can set the size and width of the window. Try setting the size and position of the Away3D view, every time you position or move your floating window.

HowlingBard > until recently you could get the back buffer directly in Away3D using

_view.renderer.context.drawToBitmapData(outputBmd); 

which would draw the window contents into the specified BitmapData.
(I used it for test at the end of july http://videometry.net/broomstick/transparentMolehill/ )
I can see this no longer works in the more recent builds of Away3D 4.0 and should be reported as a bug. (I’ll get on to that wink

Good Luck!

   

Avatar
theMightyAtom, Sr. Member
Posted: 24 August 2011 08:36 PM   Total Posts: 669   [ # 7 ]

To get it working, add this function to RenderBase.as in your away directory (or wait for update smile

public function get context() : Context3D
  {
   
return _context;
  

I’ve no idea why they removed it in the last month.
You need to set swapBackBuffer to false and render the scene just before you take the snapshot.
Something like:

private function screenToBitmapData(evt:Event):void {
_view
.renderer.swapBackBuffer false;
   
_view.render();
   
_view.renderer.context.drawToBitmapData(outputBmd);
  
   
_view.renderer.swapBackBuffer true
   
  

Anybody have an idea why context is no longer public?

 

   

HowlingBard, Newbie
Posted: 25 August 2011 12:23 PM   Total Posts: 20   [ # 8 ]

theMightyAtom, thank you so much!
It’s working very well!

   

HowlingBard, Newbie
Posted: 25 August 2011 04:41 PM   Total Posts: 20   [ # 9 ]

Hi, muflo. Well, I don’t understand your problem. What you didn’t find? Could you explain it with more details, please?

   

Avatar
Ringo Blanken, Administrator
Posted: 06 September 2011 09:25 AM   Total Posts: 120   [ # 10 ]

_view.renderer.swapBackBuffer = false;
_view.render();
_view.stage3DProxy.context3D.drawToBitmapData(bitmapHolder.bitmapData);
_view.renderer.swapBackBuffer = true;

Seems to work.

 Signature 

Freelancer: http://www.ringo.nl/en/
http://www.jiglibflash.com
http://www.awayphysics.com
http://www.away3d.com

   

nad, Newbie
Posted: 28 August 2012 08:56 AM   Total Posts: 1   [ # 11 ]

I also encountered a similar problem at the bottom, I display ArcGISTiledMapServiceLayer loaded pictures titlewindow display 3d This when ArcGISTiledMapServiceLayer picture block the 3d display away to see, do not know how to solve this?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X