[SOLVED]Z sorting on Android

Software: Away3D 4.x

textoo, Newbie
Posted: 01 March 2012 01:44 PM   Total Posts: 8

hello,

it seems that z-sorting is inaccurate on Android (maybe on any mobile devices).

sorting is OK on desktop with exactly the same code and messed up (i get a lot of conflicts between many meshes) on Android devices (tested on HTC desire and HP touchpad).

Stage3D issue? Away3D issue?

   

textoo, Newbie
Posted: 01 March 2012 03:43 PM   Total Posts: 8   [ # 1 ]

So ... Z sorting is so messed up that when i use a skybox, all other objects are hidden by it ...

   

textoo, Newbie
Posted: 01 March 2012 04:14 PM   Total Posts: 8   [ # 2 ]

i took the time to make a simple code to test this

package
{
 import away3d
.containers.View3D;
 
import away3d.entities.Mesh;
 
import away3d.lights.PointLight;
 
import away3d.materials.ColorMaterial;
 
import away3d.materials.lightpickers.LightPickerBase;
 
import away3d.materials.lightpickers.StaticLightPicker;
 
import away3d.primitives.CubeGeometry;
 
import away3d.primitives.SkyBox;
 
import away3d.textures.BitmapCubeTexture;
 
 
import flash.display.Bitmap;
 
import flash.display.BitmapData;
 
import flash.display.Sprite;
 
import flash.display.StageAlign;
 
import flash.display.StageScaleMode;
 
import flash.display3D.textures.CubeTexture;
 
import flash.events.Event;
 
 
import mx.core.mx_internal;
 
 
[SWF (frameRate="60")]
 
 
public class testAway extends Sprite
 {
  
private var viewport:View3D;
  private var 
material:ColorMaterial = new ColorMaterial(0xFFFFFF);
  private var 
cubeGeo:CubeGeometry = new CubeGeometry();
  private var 
cube:Mesh = new Mesh(cubeGeo,material);
  
  private var 
light:PointLight = new PointLight();
  
  private var 
btmp:BitmapData = new BitmapData(16,16,false,0xCCCCFF);
  private var 
skyTex:BitmapCubeTexture = new BitmapCubeTexture(btmp,btmp,btmp,btmp,btmp,btmp);
  private var 
skyBox:SkyBox = new SkyBox(skyTex);
  
  public function 
testAway()
  
{
   super
();
   
   
stage.align StageAlign.TOP_LEFT;
   
stage.scaleMode StageScaleMode.NO_SCALE;
   
viewport = new View3D();
   
viewport.backgroundColor 0x000000;
   
   
viewport.scene.addChild(cube);
   
   
viewport.scene.addChild(skyBox);
   
   
material.lightPicker = new StaticLightPicker([light]);
   
light.= -500;
   
viewport.scene.addChild(light);
   
   
addChild(viewport);
   
   
addEventListener(Event.ENTER_FRAME,enterFrame);
  
}
  
  
private function enterFrame(evt:Event):void
  {
   cube
.rotationX++;
   
cube.rotationY++;
   
   
viewport.render();
  
}
 }

on desktop cube and skybox are displayed
on Android only skybox is displayed

   

textoo, Newbie
Posted: 02 March 2012 08:26 AM   Total Posts: 8   [ # 3 ]

OK, setting depthAndStencil to true was the solution.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X