Transparency/alphaBlending causes objects to appear where they shouldnt!

Software: Away3D 4.x

dubletar, Member
Posted: 01 August 2012 01:06 PM   Total Posts: 73

Hi all,

I am currently trying to get our landscape (a flat, plane, tiled map) to sit on top of the water.
I first create the water -> then create a 3d object container to hold the landscape -> inside of 3d container I create planes and put the images on the planes.

The images I am using on the planes are ‘.png’.

Here’s the problem. When I turn on alpha blending on the textures on the plane, the water appears ABOVE the land no matter what height it’s at in the code.
Please view the attached image.


Can anyone help with this? The code is below.Any help is appreciated.

Fyi, I reordered the way objects appear on stage, just to make sure that wasnt the issue. The land is broken up in an 11 tile x 11 tile landscape, with each tile at 512x512 size, so that isnt the issue.

I placed changed the order of the objects being added to the stage, adding the water first, and everything else later, but that didn’t help at all.
-Adam

The code for the water:

//prepare water
   
waterMethod = new SimpleWaterNormalMethod(new BitmapTexture(new WaterNormals().bitmapData), new BitmapTexture(new WaterNormals().bitmapData));
   
fresnelMethod = new FresnelSpecularMethod();
   
fresnelMethod.normalReflectance .3;
   
   
waterMaterial = new TextureMaterial(new BitmapTexture(new BitmapData(512512true0xaa071113)));
   
waterMaterial.alphaBlending true;
   
waterMaterial.lightPicker lightPicker;
   
waterMaterial.repeat true;
   
waterMaterial.normalMethod waterMethod
   waterMaterial
.addMethod(new EnvMapMethod(skyTexture));
   
waterMaterial.addMethod(fogMethod);
   
waterMaterial.specularMethod fresnelMethod;
   
waterMaterial.gloss 100;
   
waterMaterial.specular 1;
   
   
//create water
   
plane = new Mesh(new PlaneGeometry(56325632), waterMaterial);
   
plane.geometry.scaleUV(5050);
   
plane.0;
   
scene.addChild(plane);

The code for each plane:
   function 
testLoaderCompleted(evt:Event):void
   {
    
var testLoaderContent testLoader.content;
    
    
terrainMaterial = new TextureMaterial(new BitmapTexture(Bitmap(testLoaderContent).bitmapData));
    
//terrainMaterial.diffuseMethod = terrainMethod;
    //terrainMaterial.normalMap = new BitmapTexture(new Normals().bitmapData);
    //terrainMaterial.lightPicker = lightPicker;
    //terrainMaterial.ambientColor = 0x303040;
    
terrainMaterial.ambient 5;
    
terrainMaterial.specular .2;
    
terrainMaterial.alphaBlending true;
    
//terrainMaterial.addMethod(fogMethod);
    //leContainer.addChild(terrainMaterial);
    
    //create a ground plane
    
var ground:Mesh = new Mesh(new PlaneGeometry(51251211), terrainMaterial);
    
ground.castsShadows false;
    
ground.200;
    
    
leContainer.addChild(ground);
   

 

   

Richard Olsson, Administrator
Posted: 01 August 2012 02:15 PM   Total Posts: 1192   [ # 1 ]

There was a bug that sneaked into the Gold release right before the release day but that has been fixed since. Try the latest codebase from the master branch in the Git repository.

If you are unfamiliar with Git, you can download that branch in it’s most recent state from the following URL: http://github.com/away3d/away3d-core-fp11/zipball/master

Let us know whether this fixes it!

 

   

dubletar, Member
Posted: 01 August 2012 02:53 PM   Total Posts: 73   [ # 2 ]
Richard Olsson - 01 August 2012 02:15 PM

There was a bug that sneaked into the Gold release right before the release day but that has been fixed since. Try the latest codebase from the master branch in the Git repository.

If you are unfamiliar with Git, you can download that branch in it’s most recent state from the following URL: http://github.com/away3d/away3d-core-fp11/zipball/master

Let us know whether this fixes it!

Thanks for the quick response.

I downloaded both from Git and from your link… lol discovering it was the same: away3d-away3d-core-fp11-v4.0.0-beta-508-g8f6e673.zip

The file you pointed to is the Beta version. I was also using Beta. I downloaded the Gold version from the download section here, and the problem seems to be solved.  I am going to do a few tests and update this post again within a few minutes.

Thanks again.

 

   

dubletar, Member
Posted: 01 August 2012 03:39 PM   Total Posts: 73   [ # 3 ]

Correction!

The Gold version I downloaded from Away3d site (here) did have bugs…

I went back to the GitHub src code. Problem persists :(

 

   

dubletar, Member
Posted: 01 August 2012 10:57 PM   Total Posts: 73   [ # 4 ]

Nevermind, lol.

I’ve abandoned the 2d planes. Im now using 3d maps.

I thought 3d landscapes would be too much of a drain on memories. But so far, its actually pretty great.

Thanks again for the help.

Im sure I’ll have more problems and come to the forum nagging about those too.

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X