Can a view have multiple cameras? If so how?

Software: Away3D 4.x

thatflashdude, Newbie
Posted: 11 October 2012 12:36 AM   Total Posts: 19

im trying to implement a split view of a, well, view.

its been suggested by Fabrice to try a view with many cameras

how is that accomplished exactly in code. all googling turns up is two views with cameras. but not one view with many cameras

   

Ivan Moreno, Newbie
Posted: 12 October 2012 12:40 PM   Total Posts: 22   [ # 1 ]

Hello,

Try this to see if is that what you need smile

package
{
 import away3d
.cameras.Camera3D;
 
import away3d.containers.Scene3D;
 
import away3d.containers.View3D;
 
import away3d.entities.Mesh;
 
import away3d.materials.ColorMaterial;
 
import away3d.primitives.CubeGeometry;
 
 
import flash.display.Sprite;
 
import flash.events.Event;
 
import flash.geom.Vector3D;
 
 
[SWF (width="1280"height="700"backgroundColor="0x000000"frameRate="60")]
 
 
public class Test extends Sprite
 {
   private 
var topView:View3D;
  
 private var bottomView:View3D;
  
 private var cube:Mesh;
  
 
   public 
function Test()
  
 {
    addEventListener
(Event.ENTER_FRAMEupdate);
   
 
    
var camera1:Camera3D = new Camera3D();
    
camera1.position = new Vector3D(00, -400);
    var 
camera2:Camera3D = new Camera3D();
    
camera2.position = new Vector3D(0400, -400);
    var 
scene:Scene3D = new Scene3D();
    
    var 
cp:Vector3D = new Vector3D(000);
    
camera1.lookAt(cp);
   
 camera2.lookAt(cp);
   
  
    topView 
= new View3D(scenecamera1);
    
topView.width stage.stageWidth;
    
topView.height stage.stageHeight*.5;
    
addChild(topView);
   
  
    bottomView 
= new View3D(scenecamera2);
    
bottomView.width stage.stageWidth;
    
bottomView.height stage.stageHeight*.5;
    
bottomView.stage.stageHeight*.5;
    
addChild(bottomView);
   
  
    
var c:ColorMaterial = new ColorMaterial(0xff0000);
    
cube = new Mesh(new CubeGeometry(), c);
   
  
    scene
.addChild(cube);
  
 }
   
   private 
function update(e:Event):void
   {
     cube
.rotationY += 5;
   
  topView.render();
   
  bottomView.render();
  
 }
   
 }

ICheers.

   

thatflashdude, Newbie
Posted: 12 October 2012 04:17 PM   Total Posts: 19   [ # 2 ]

hi thanks for trying but i mean just ONE view and multiple cameras within that ONE view.

the reason is that ipad does not support more than one view because each view needs one level of stage 3d

   

Ivan Moreno, Newbie
Posted: 15 October 2012 12:06 PM   Total Posts: 22   [ # 3 ]

Ok.

I think this will not be possible to achieve without using 2 different views at the moment, and this is not because of Away3D issue.

You require 4 elements to build any 3D view. One is the viewport, which is the canvas/rectangle where you draw your scene. The scene is the main container where you put your 3D objects. The camera is the point of view that gets the field of view of your scene and the renderer that put the data of the container and the point of view together in your viewport.

Away3D does simplify all these steps for you in the View3D class. And when you need to have an extra camera that renders the same scene at the same time you MUST have a new viewport where it draws what the second camera is seeing. Stage3D and most of the 3D technologies allow you to have 4 renders at the same time for multiplayer and/or many views options. I guess mobile devices do not support this in this moment because the performance will decrease considerably; they do not have so powerful GPUs and to safe battery, among other reasons.

Cheers.

   

thatflashdude, Newbie
Posted: 15 October 2012 08:34 PM   Total Posts: 19   [ # 4 ]
Ivan Moreno - 15 October 2012 12:06 PM

Ok.

I think this will not be possible to achieve without using 2 different views at the moment, and this is not because of Away3D issue.

thanks for providing more info on how you think view3d works. I think this is an away3d ‘issue’ in not supporting multiple cameras in one view.

would it not be possible to merge two camera views into one viewport? at the end of day everything isa triangle so how it could it take flattened snapshot of what it sees (like bitmap caching works..but instead of a bitmap, it returns the triangles necessary for stage3d

Id love to try to hack the code to to this..but i just dont have any kind of grip on 3D. Do you know of any good introductory tutorials or communities or books to get me on the road?

Also i know this is not a limitation of ipad because unity is able to render to screens at once

Cheers.

   

Ivan Moreno, Newbie
Posted: 16 October 2012 10:06 AM   Total Posts: 22   [ # 5 ]

You have more information than I have, apparently. Because of this I can’t help you with your problem. Maybe you can do:

1. Report the issue here.
2. Keep waiting for someone to answer in this forum.
3. Solve the problem by yourself. Consider this a good option since is a lovable task for you, and you will enjoy and learn doing it.
4. Try with other Stage3D 3D rendering frameworks. If the issue is not happening with them, then certainly is a problem here. If they do have this issue then the problem could be in the platform.
5. Use Unity3D to build your project. Because you already know that your requirements are working with it, this could be a good option for you too.

Hope you find a solution and all the best smile

   

stalem, Newbie
Posted: 02 May 2013 11:24 PM   Total Posts: 1   [ # 6 ]

This is a fairly old post by now, but I just stumbled upon it. And as no answer has been posted yet, I figure I might give it a try.
The reason being, I’m trying to do exactly what you want, but with my own 3D engine.

This is not an Away3D issue, but a limitation in Stage3D. So if anything, it’s Adobes fault. The thing with Stage3D is; you cannot choose where to draw on to the Stage3D. You can position it on the screen, and choose a width and/or height of its back buffer, but in the end, the only way to actually display the 3D contents (ie render) is by a function named present(). This function, when called upon, will present the back buffer on the screen.
There is no possible way to draw two separate things, in two different places, on the same Stage3D.

As of today, there is only one solution to your problem, and that is to use multiple Stage3Ds, or in your case; multiple views.

   

xelanoimis, Newbie
Posted: 12 May 2013 10:43 AM   Total Posts: 3   [ # 7 ]

Hi,

I’m new to Away3D (and air) but I think I have found something related to this. I’m using Starling with Away3D and the Stage3DProxy.

I was interested in the idea of 2 cameras so I can display 2D content over the 3D content directly with Away3D. So in my test I created another View3D sharing context and having the same stage3DProxy (but different scenes). In the main View3D I have the 3D geometry with a 3D camera and in the second I have 2D geometry and an orthogonal camera.

The stage3Dproxy it’s cleaned only once (per frame), then the 2 views are rendered, then finally the stage3Dproxy is presented. It seems to work, as it show 3d content and 2d content overlapping (like Starling does).

The thing is the second view only works in full coordinates. Can’t make it smaller, if needed a picture in picture with the content relative. Probably makes sense since the common stage3dProxy defines the large viewport. But still would be nice to have something like SetViewportRectangle and have all painted on the same backbuffer.

I hope this helps.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X