Texture rendering problem with ATI gfx cards only [SOLVED]

Software: Away3D 4.x

lomriilod, Newbie
Posted: 02 August 2013 10:27 AM   Total Posts: 5

Hello,

I have a texture display problem which only occures with ATI gfx cards with hardware acceleration turned on. Since I am not getting any errors and my knowledge about shaders is to low, I don’t know where to search or how to fix it.

I had this problem with ati cards with variius versions of away3d with different results. Most of the times the textures where not displayed at all. In one beta dev version it worked correct.
This is how it curruently looks:

Correct textures
Wrong textures

I am handleing the texture assignment a bit different than the tutorials show, thats because I need to replace (or add another texture layer on a bitmap) them during runtime.

The mesh is generated from a loaded and parsed binary:

meshVO.mesh = new Mesh(_meshes[meshVO.name].geometrynull);
meshVO.mesh.material textureService.requestTexture(meshVO.texture); 

The textureService assigns a LoadedTextureMaterial which extends TextureMaterial to the mesh.material. The material initialy has a default blackbitmap, which is later replaced with the loaded texture.

public function LoadedTextureMaterial(nrOfLayers:int)
{
 super
(new BitmapTexture(new BitmapData(6464false0x000000)));
 
_nrOfLayers nrOfLayers;
 
_nrOfLoadedTextures 0;
 
_textures = new Array();
 
bothSides true;
 
gloss 15;
 
specular .2;
 
ambient 1;
 
alpha 0.2;
}

public function textureDataReady():void
{
 
try {
  lightPicker 
light_picker;
  
BitmapTexture(texture).bitmapData mergeBitmap(); // <- new bitmapdata
  
alpha 1;
  
alphaBlending false;
 
}
 
catch(e:Error)
 
{
  trace
("texture error.");
 
}

Again, the problem is only on ATI cards, no matter if OSX or windows, no matter if Chrom or any other browser, no matter if debug or relase flash player. The away3d lib is compiled with ASC 2.0, also the relase swf. Testet player version latest (11.8). Away3d 4.1.4.
I tryed reassigning material settings or even creating complet new materials, nothing helped.

Any help would be greatly appreciated.

Thanks

Dirk

   

Avatar
theMightyAtom, Sr. Member
Posted: 05 August 2013 05:30 AM   Total Posts: 669   [ # 1 ]

This looks like something I experienced with MD5 format some years ago.
Have you tried exporting an AWD model and importing that?
Seems to me you need to establish whether this is something happening as a consequence of your approach, or a bug in flash player 11.8, or indeed the Away3D engine.

   

lomriilod, Newbie
Posted: 05 August 2013 10:49 AM   Total Posts: 5   [ # 2 ]

Thank you for your reply,

theMightyAtom - 05 August 2013 05:30 AM

Have you tried exporting an AWD model and importing that?

We are using obj files extorted from 3dmax. All the character creation is done in 3dmax 2013 and the AWD exporter does not support this version. Moving back to a lower version of 3dmax wasn’t realy an option for our 3d people.

theMightyAtom - 05 August 2013 05:30 AM

Seems to me you need to establish whether this is something happening as a consequence of your approach, or a bug in flash player 11.8, or indeed the Away3D engine.

If it is a flash player bug, than its a long time bug, since the problem exists since a coulple of versions.
I will try to make a simple example covering two settings:
a) An imported and parsed obj where I assign a bitmap object, that has allready been loaded.
b) An imported and parsed obj where I assign an empty bitmap object and override that one with a loaded bitmapdata.

I am afraid it will show the same effect I have now, at least for b.

Still starnge for me is, that it was working in a away3d version (before that working version all textures were black) and now it does not any more.
As you can see, the texture seems to be applied correctly, but lightning seems to be missing.

I will post my results as soon as I am done.

Dirk

   

Avatar
theMightyAtom, Sr. Member
Posted: 05 August 2013 11:25 AM   Total Posts: 669   [ # 3 ]

ALERT!

The OBJ exporter that ships with MAX has never been compatible with the importer in Away3D. From what I recall normals were getting reversed, which is a good description of what you’re seeing.

I recommend this one.
http://www.guruware.at/main/objio/

Also be aware that about using mtl files. They work, but you have to group objects apparently. Shouldn’t affect you, assigning client side.

Good Luck!

   

lomriilod, Newbie
Posted: 05 August 2013 12:38 PM   Total Posts: 5   [ # 4 ]

Again, thanks for your help.

I am not using mtl (I have removed the info from the obj files).

I have asked our 3d team to use the obj exporter you have recomended. I will keep you updated with the result.

Dirk

   

lomriilod, Newbie
Posted: 07 August 2013 09:40 AM   Total Posts: 5   [ # 5 ]

Hi,

we have tried the plugin you recomended. The download contains a max9 exporter, which crashes max2013.

So next up is the test project I have mentioned above.

Even though it sounds reasonable that inverted normals would lead to wrong light rendering, why would it only happen on ati cards?

Dirk

   

Avatar
theMightyAtom, Sr. Member
Posted: 07 August 2013 03:26 PM   Total Posts: 669   [ # 6 ]

Ah, that’s a shame. Any reason you are bound to obj format? A trip through AwayBuilder could convert to AWD, and I believe there’s a MAX exporter also.

I remember there was a workaround for bad OBJ files in earlier versions, that made Away calculate the normals itself.
Try autoDeriveVertexNormals = 1; on the subgeometries.
https://github.com/away3d/away3d-core-fp11/blob/master/src/away3d/core/base/SubGeometry.as

What *may* be happening, and I admit I don’t know much about the insides of a GPU, is that the normals are missing and the card is calculating them clockwise of anti-clockwise, depending on the default.

   

lomriilod, Newbie
Posted: 09 August 2013 06:25 AM   Total Posts: 5   [ # 7 ]

HA!

I found it. After you have pointed me to AwayBuilder, I tested my obj there with different settings and everything worked there on all gfx cards. So the objs seemd to be correct and it had to be something with my setup.

I spent some time looking at the sources from AwayBuilder and what they are doing does not differ much from my texture handling.

So I went back in my code and turned one thing after the other off and removed on light after the other. After I had removed all PointLights it worked.

When the designer told me: make the fallOff as large as possible, I did this:

PointLight(l).radius Number.MAX_VALUE;
PointLight(l).fallOff Number.MAX_VALUE

This does not work for ATI. I do not know what the actual max value is, but putting it to a reasonable number fixes the rendering.

So, its solved, thanks a lot for your help.

Dirk

   

Avatar
theMightyAtom, Sr. Member
Posted: 09 August 2013 06:56 AM   Total Posts: 669   [ # 8 ]

That’s great Dirk! That will hopefully help some other poor pilgrim who will no doubt hit the same bizarre obstacle.

Cheers!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X