Make 3d Object be always drawn on top

Software: Away3D 4.x

Dragoola, Newbie
Posted: 11 September 2013 06:18 PM   Total Posts: 16

Hi,

I want to have some guidelines in my program(represented by line segments) and I would like them to be always drawn on top, regardless of any object that may be in front of them but maintaining their 3d space proportions. Is there any way to achieve that with a 3D object?

Thanks!

   

Mario M., Newbie
Posted: 15 September 2013 01:11 PM   Total Posts: 12   [ # 1 ]

Use Stage3DManager in order to merge two different scenes+camera (with same position). Then you can use them as layers when rendering:

var stage3DManager:Stage3DManager;
var 
stage3DProxy:Stage3DProxy;

//IF FIRST TIME CREATE VIEWS AND LOAD ASSETS
if(stage3DManager == null){
 
// Define a new Stage3DManager for the Stage3D objects
 
stage3DManager Stage3DManager.getInstance(stage);
   
 
// Create a new Stage3D proxy to contain the separate views
 
stage3DProxy stage3DManager.getFreeStage3DProxy();
 
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATEDonContextCreated);
 
stage3DProxy.antiAlias 2;
 
stage3DProxy.color 0x0;
}

mainView
= new View3D();
mainView.stage3DProxy stage3DProxy;
mainView.shareContext true;
addChild(mainView);  

layoutView= new View3D();
layoutView.stage3DProxy stage3DProxy;
layoutView.shareContext true;
layoutView.layeredView true;
addChild(layoutView);
layoutView.scene.addChild(layoutView.camera); 

then you only need to render in the right order

mainView.render();
layoutView.camera.transform mainView.camera.transform;
layoutView.render(); 
   

Dragoola, Newbie
Posted: 16 September 2013 03:58 AM   Total Posts: 16   [ # 2 ]

Hi,

What I am trying to achieve is have for example a road mesh appear right on top of the ground mesh. They would both be planes and the distance between them would be infinitesimally small. However, due to margin of error, having two planes very close to each other may result in the plane that is underneath being rendered on top and pixels flickering between the two planes.

It seems to me that the stage proxy is more for things like having a 3d gui and would not allow me to achieve my purpose.

   

bxc, Newbie
Posted: 03 June 2014 06:25 AM   Total Posts: 19   [ # 3 ]

Material.depthCompareMode=Context3DCompareMode.ALWAYS

   

BobWarfield, Newbie
Posted: 03 June 2014 08:08 PM   Total Posts: 19   [ # 4 ]

Stage proxy does work for your application.  I’m not sure it is necessarily the best way to do what you want, but it would absolutely work.  I use 2 Away3D layers in my app, which is sort of a CADCAM app.  The “bottom” layer is a background grid for reference and the top is a 3D object.  Both are composed entirely of line segments in SegmentSets.  It looks like this:

http://www.cnccookbook.com/img/GWizardE/rendertiming2.jpg

It has worked well other than that I am seeing some timing issues that I have posted about in another thread.

Cheers,

BW

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X