Texture and ase models

Hi having a little troble with textures being loaded with an ase model.

I have loaded an ase model (which i converted from .3ds using 3DSmax) the model itself loads properly and the textures seem to load, judging by the console output, but only a block color is applied to each model, the color assigned seems to be the average color of each texture.

I have the render options set to use textures, lights and shadows as in the ase demo.

The lights and shadows are also not working this would obviously suggest that the render options are not set for some reason but it is as in the ase demo supplied.

the ase demo supplied with xith3d works fine

thanks all

Are you exporting texture coordinates?

You can use this code:


Texture2D texture = (Texture2D) TextureLoader.tf.getMinMapTexture("rustycan.jpg");
            Appearance a = new Appearance();
            a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
            a.setTexture(texture);

            TexCoordGeneration texGen = new TexCoordGeneration(TexCoordGeneration.SPHERE_MAP, TexCoordGeneration.TEXTURE_COORDINATE_2);
            a.setTexCoordGeneration(texGen);

to generate the texture coordinates for an Appearence but it’s best to export them from 3DMAX.

Do you call: calculateFaceNormals(); on your GeometryArray ? That can generate your normals if you dont’ export those.

The tutorial has a recommended export options screenshot - did you follow that?

Can you post some of your code please?

Hope that helps,

Will.

Im not doing any texture loading maually as i presumed the ase loader would attach them itself. Im a little new to 3D graphics but i’ll try exporting the texture co-ords tonight and load them as you said.

I wont bore you with the source code just yet as im probably doing something fundamentally wrong as in presuming the ase model loader attaches the textures to each model itself.

The model loader source code is pretty mush a carbon copy of the ase model loader tutorial code, but im just extracting differently named models.

The class that sets up the scenegraph does it also in a standard way except i set the texture loader path and the rendering options for textures, lights and shadows.

I suspect from your post i’am supposed to be loading textures manually using the texture loader??

it is possible you are doing nothing wrong. Jani is also having similar problems.

Strange - I am running an up to the minute version of Xith3D and my AseTest demo (from the GSG) works fine.

The only difference I can see between my app and Jani’s (which like yours is playing up) is that I am using JPEG images and he is using PNG.

What format are you using? Can you try with JPEG and see how you go?

Not sure why but something seems to have broken relating to the image loading (there’s been a lot of changes to that code recently I think).

Will.

Alright my problem is sorted, the code was fine, i wasn’t exporting the mesh (If i just paid more attension to the tutorial :slight_smile:

To answer the image format question i’m using .jpeg and having no problems now.

My lights still aren’t working but im going to give another look at that myself before posting about it. They are added to the scene though.

Thanks for the help :wink:

I checked the case with ASE CarTerrainExample and can say that with current CVS version it works OK (with exception of one minor problem with CarTerrainExample itself). Check my comment to Issue #65.

Yuri

thanks, I have replied to that issue.

Just a coincidence it turns out - Preacher and the Odejava team both had problems with the ASE loader and textures, but for different reasons.

Cheers,

Will.

Will, as you emailed me, Odejava’s helper class OdejavaToXith3d needs some work. All my troubles vanished after I added “ignoreGeom” method to this class. I was creating two times the Terrain. Once by my own Xith3d related code, and once (without my knowledge) through OdejavaToXith3d.

I’ll fix this next sunday (tomorrow).

Forget my previous posts about ASE Loader and texture problems, they were self inflicted.