How Can I Change the Render Order?

Software: Away3D 4.x

Avatar
Max Did It, Newbie
Posted: 20 February 2013 11:00 PM   Total Posts: 16

I have a relatively complex scene with several objects in it. I want to make sure that Away3D always renders one of those objects last.

I want to use the Context3DCompareMode.GREATER mode on the material of said object, so that only the pixels that are behind other objects are rendered.

But this obviously doesn’t work if it isn’t the last object in the scene to be rendered. Can someone help me with this?

   

Avatar
Max Did It, Newbie
Posted: 21 February 2013 11:33 AM   Total Posts: 16   [ # 1 ]

Okay, I’ve looked into the source code of Away3D, and I know now that by default, all entities in the scene will be put into a single NodeBase object contained by one Partition3D object.

But I still don’t know how the order of the EntityNodes in the NodeBase object comes to be.

The order in which the objects are added to the scene or any containers doesn’t seem to make any difference. Can anyone give me some insight on this?

   

_kihu, Jr. Member
Posted: 21 February 2013 03:36 PM   Total Posts: 43   [ # 2 ]

Not sure if it would work, but maybe try creating two views using stage3Dproxy.
Like here:
http://away3d.com/tutorials/Away3D_and_Starling_Interoperation

But instead of creating Starling layers, make a second Away3D layer.

Then, place the ‘front’ 3d object on the top layer and the rest on the bottom.

Haven’t tried it, but I think it’s worth a try.

   

Avatar
Max Did It, Newbie
Posted: 21 February 2013 06:13 PM   Total Posts: 16   [ # 3 ]

Thanks, that did help!

I tried doing something similar, but I hadn’t seen this tutorial before.

It’s working now, though having more control over the drawing order in Away3D would still be nice.

   

Avatar
alihm, Jr. Member
Posted: 26 February 2013 08:29 AM   Total Posts: 49   [ # 4 ]

They have added a zOffset property to the Entity object (it’s not finalized yet, you have to download the dev branch) which can be used to manually control rendering order of transparent objects.

So if you enable alphaBlending in your object and set a large positive number to zOffset you can force it to be rendered last (appear in front).

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X