PDA

View Full Version : Problems to apply textures in OpenGL with ASE file !



popom
05-08-2001, 07:35 AM
Hello !

I am looking for some informations about apply textures withe the coordinates from a ASE file.
Anyone have some informations ?
Thanks !


PS : My program use the Tvertex coord and the Tface, but the face is render with TRIANGLES and ma textures don't render in all of my objects or it renders bad !
(excuse for my bad english ...)
@+
PopomCorporation@aol.com

bsenftner
05-08-2001, 08:24 AM
It sounds like you're using the correct data from the ASE file. You should be only using the {u, v} coordinates out of the {u, v, w} provided by the ASE's TVerts array.

Check to be sure that your artists are not tweaking every little U/V/W gizmo in the Materials Editor- you can create a funky UV mapping that does not get exported correctly.

As far as the data in the plain, unmodified ASE exporter being correct for textures- yes, it is correct.

Another thing to check is if your artists are using the "Multi/Sub-Object" material. If they are, make sure that you are using the correct subMaterial via the *MESH_MTLID tag in the *MESH_FACE set of parameters.

One further thing to be sure you are doing is when getting that MESH_MTLID value, it *could* have a value greater than the number of subMaterials in your applied material, if so then do a modulo operation to bring the value back into range. That is what MAX does in its own renderers.

-Blake

aphex
05-08-2001, 09:57 PM
We've done what you comment, and our method is as follows:

- Store the U,V pairs (drop W) from the TVERTEX structure in a list

- Then, the TFACE indexes which TVERTEX goes into which FACE. You will notice that TFACE and FACE arrays have equal length.

Only make sure that, when you are scanning the FACE array to paint, then you go to the TFACE array using the same index, and get the # of the TVERTEX to apply...

In other words

(scanning face[i])
u1=tvertex[tface[i].1].u
v1=tvertex[tface[i].1].v

u2=tvertex[tface[i].2].u
v2=tvertex[tface[i].2].v

u3=tvertex[tface[i].3].u
v3=tvertex[tface[i].3].v

where the .1 refers to the first, second or third component of a face

get it? is tricky, but SURE it works

What I have not been able to solve is handling cropping properly. If an artist does that in a multi-subobject the ASE file indexes the U,V's as if the cropped area were in the range 0,1 so there is no way to get the cropped U,V's in terms of the global bitmap they are in.

cheers,



Originally posted by popom:
Hello !

I am looking for some informations about apply textures withe the coordinates from a ASE file.
Anyone have some informations ?
Thanks !


PS : My program use the Tvertex coord and the Tface, but the face is render with TRIANGLES and ma textures don't render in all of my objects or it renders bad !
(excuse for my bad english ...)
@+
PopomCorporation@aol.com

Anonymous Coward
05-09-2001, 01:48 AM
Did you swap the Y and Z axis of the geometry? Remember that 3DSMAX uses different coord system than OGL...

popom
05-12-2001, 02:20 PM
Thanks you very much ! I had forgotten a little arguments in my function !
Thanks !
bye
Cyril


Originally posted by Anonymous Coward:
Did you swap the Y and Z axis of the geometry? Remember that 3DSMAX uses different coord system than OGL...