View Full Version : Export UV texture
countag 04-13-2006, 08:56 PM hi all,
i have a noob problem,
i want to export UV map, i try something but im not sur that this export UV map :/
channel_support_array = #()
for c = 0 to 99 do if meshop.getMapSupport tmesh c then append channel_support_array c
for c = 0 to channel_support_array.count-1 do
(
num_map_verts = meshop.GetNumMapVerts tmesh channel_support_array[c+1]
num_map_faces = meshop.GetNumMapFaces tmesh channel_support_array[c+1]
format "%\n" num_map_verts to:out_file
format "%\n" num_map_faces to:out_file
for v = 1 to num_map_verts do
(
get_vert = meshop.getMapVert tmesh channel_support_array[c+1] v
format "%,%,%,\n" (get_vert.x) (get_vert.y) (get_vert.z) to:out_file
)
for f = 1 to num_map_faces do
(
get_face = meshop.getMapFace tmesh channel_support_array[c+1] f
format "%,%,%,\n" (get_face.x as integer) (get_face.y as integer) (get_face.z as integer) to:out_file
)
)
if it isn t export UV map can you give me an easy code that export it please ? else im sorry for this post.
i ask it because when i export Map texture and i import it in OpenGL, the texture on the model is different :(
sorry for my bad langage (im french)
|
|
mobeen
04-15-2006, 05:44 AM
This is how i did my uv export. Assuming that pMesh is a pointer to a mesh/poly object
for i=1 to pMesh.numfaces do
(
local tIndices = (getTVFace pMesh i)
local tv1 = (gettvert pMesh tIndices.x) --tv1.x = u coordinate, tv1.y = v coordinate
local tv2 = (gettvert pMesh tIndices.y)
local tv3 = (gettvert pMesh tIndices.z)
format "% % % % % %\n" tv1.x tv1.y tv2.x tv2.y tv3.x tv3.y to:fp
)
Thanks
Mobeen
countag
04-15-2006, 09:58 AM
arf i have always a bug :-(
my code is :
fn ExportAG texture out_name =
(
tmesh = snapshotAsMesh selection[1]
out_file = createfile out_name
num_faces = tmesh.numfaces
format "%\n" num_faces to:out_file
if(texture == 1) then format "1\n" to:out_file else format "0\n" to:out_file
for i = 1 to num_faces do
(
face = getFace tmesh i
vertIndex1 = (face.x as integer)
vertIndex2 = (face.y as integer)
vertIndex3 = (face.z as integer)
vert1 = getVert tmesh vertIndex1
vert2 = getVert tmesh vertIndex2
vert3 = getVert tmesh vertIndex3
format "%,%,%," (vert1.x) (vert1.y) (vert1.z) to:out_file
format "%,%,%," (vert2.x) (vert2.y) (vert2.z) to:out_file
format "%,%,%,\n" (vert3.x) (vert3.y) (vert3.z) to:out_file
)
format "\n" to:out_file
for i = 1 to num_faces do
(
mapf = meshop.getMapFace tmesh 1 i
UVIndex1 = (mapf.x as integer)
UVIndex2 = (mapf.y as integer)
UVIndex3 = (mapf.z as integer)
vert1 = meshop.getMapVert tmesh 1 UVIndex1
vert2 = meshop.getMapVert tmesh 1 UVIndex2
vert3 = meshop.getMapVert tmesh 1 UVIndex3
format "%,%,%," (vert1.x) (vert1.y) (vert1.z) to:out_file
format "%,%,%," (vert2.x) (vert2.y) (vert2.z) to:out_file
format "%,%,%,\n" (vert3.x) (vert3.y) (vert3.z) to:out_file
)
close out_file
edit out_name
)
rollout Exporteur "Exporteur AG"
(
checkbox TextureExp "Exportation Texture" checked:false across:1
button export "Export"
on export pressed do (
file_name = getSaveFileName types:"Exporteur Atlantean-Gabriel (*.ag)|*.ag"
if (TextureExp.state == true) then Texture = 1 else Texture = 0
ExportAG Texture file_name
)
)
myExporterFloater = newRolloutFloater "Exporteur" 300 200
addRollout Exporteur myExporterFloater
and in 3DSmax i have it :
http://perso.wanadoo.fr/clshigesa/screen1.JPG
and in OpenGL i have it :
http://perso.wanadoo.fr/clshigesa/screen2.JPG
can you help me ? :( im really bocked on exporting texture :/
mobeen
04-17-2006, 07:12 AM
There may be some problem in your openGL loader. How are your loading it???
countag
04-17-2006, 07:23 AM
Im really lost now :( i changed all my code for see but nothing, i give you my C++ code et Maxscript code if its can help you to help me but now i dont know where it can comes from :/ i think in export UV texture :
http://perso.wanadoo.fr/clshigesa/loader.zip
in zip file there is an "Exporteur.ms" its the maxscript exporteur, all other think its for the C++ project
EDIT : i have a new pist : maybe there is a transformation of matrix, so i need to export this transformation and use this matrix in opengl no ?
the problem now i need to know how do it :) google :D
mobeen
04-19-2006, 05:42 AM
I tried some objects like box sphere and editable meshes and they run ok on my pc. How have u modelled and textured the character. try this before running your exporter collapse the modifier stack by converting your final character to editable mesh and then run the exporter. See if this sorts your problem.
Thanks
Mobeen
countag
04-19-2006, 12:51 PM
but you didnt try with a character textured... but i think i found my probleme
for opengl we need : u = - (1.0 - u);
and normally it work
CGTalk Moderation
04-19-2006, 12:51 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.