Multiple Away3D scenes sharing a context

Software: Away3D 4.x

NickStone1983, Newbie
Posted: 11 December 2013 12:15 AM   Total Posts: 8

I have a flash application where two 3d Views are sharing the same Stage3DProxy, because I need one to be overlaid/drawn over the other at all times. However, they seem to share the same 3d space/z-buffer(?).

My update function currently looks like this:

private function onEnterFrame(event Event) : void {   
    stage3DProxy
.clear();
    
away3DView.render();
    
away3DView2.render();
    
stage3DProxy.present();

Clearly, this is not enough on its own - I read somewhere that the setDepthTest method can be used eg:

stage3DProxy.context3D.setDepthTest(falseContext3DCompareMode.NEVER); 

...setting it to different modes between each view’s render() call, but I’m not at all clear on how this works, and documentation does not seem to address a situation like this. I’ve played around, setting it to different things between render calls, but no joy.

The only examples I can find for setting up a Stage3DProxy use one Away3D view and two starling - which isn’t what I’m after. I read on the forums a comment which says you have to specify certain setDepthTest settings in about ‘8 other places’, but doesn’t elaborate on where they are or what they need to be set to, and this sounds like quite a hack for something which should be pretty basic!

If anyone could help I’d be very grateful, or if anyone knows another way to do this - forcing a particular drawing order seems like it should be a relatively trivial task yet I can find nothing useful about doing it, I want to stick with Away3D as it’s got a nice API and feature set, but this is a real obstacle to my current project!

Thanks in advance

   

John Brookes, Moderator
Posted: 11 December 2013 10:23 AM   Total Posts: 732   [ # 1 ]

Seem to remember you just need to set

yourTopView.layeredView = true;

And that will clear the buffer for that view.

   

NickStone1983, Newbie
Posted: 11 December 2013 05:59 PM   Total Posts: 8   [ # 2 ]

I can’t believe it’s that simple, I was literally about to give up!

Thank you so much, I really didn’t want to move away from Away3D but this was really doing my nut!

I’ve bountied this question on SO if you want 100rep for it…

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X