mesh corruption with 3ds max 8(FIXED)

Users who are viewing this thread

dejawolf

Knight
tried a few export and import plugins for 3ds max, and i get this:
mess1.jpg

mess2.jpg


so the skin modifier isn't applied correctly or something. dunno.
i'm going to try and add a space on the end of the file.
 
durr...
well after some additional forum digging i found someone with a similar problem:

http://forums.taleworlds.com/index.php/topic,44225.msg1149660.html#msg1149660

so anyone know where manitas exporter is then
 
that happens to me when I dont have the mesh selected when I export it.
 
Are you trying to use and SMD plugin for max? 

The issue you are experiencing looks like the vertex order is messed up.  I had that happen to me a long time ago, when I worked on meshes for the vapormod Age of Ash.  I think it has to do with the plugin.

Did you get this one:
http://www.wunderboy.org/3dapps.php#max_smd
 
jik said:
Are you trying to use and SMD plugin for max? 

The issue you are experiencing looks like the vertex order is messed up.  I had that happen to me a long time ago, when I worked on meshes for the vapormod Age of Ash.  I think it has to do with the plugin.

Did you get this one:
http://www.wunderboy.org/3dapps.php#max_smd

nah, i'm on max 8.

vertex order seems fine, i think its the order they've been assigned to the bones that got messed up.
not sure why how or something else. hrm.
 
i tried these tools as well:

http://www.chaosincarnate.net/cannonfodder/cftools.htm

but still corrupted.
 
eh, to hell with this, i think i'll just make my own exporter.
the SMD format seems very friendly anyways, so it should be fairly easy.
 
dejawolf said:
eh, to hell with this, i think i'll just make my own exporter.
the SMD format seems very friendly anyways, so it should be fairly easy.

If you do so, I notice that the one I found does not export the animation.  If you can do that as well, then it would be a great asset, though importing animations is monopolized by MAXHARDMAN.
 
lol, figured out whats wrong!
i noticed the filesize was too small, so i compared the BRF exported file to the max exported file, and i found this:

BRF:

8 -1.272660 -1.730810 13.800040 -0.325531 -0.936517 0.130252 0.561471 0.935582  1 8 1.000000
that would be parentbone,  XYZ, normXYZ, UV, links, bone ID, and weight.
this is what was exported out of max:

12 -5.1729 -0.4559 15.0659 -0.0019 -0.8771 0.4801 0.8006 0.5800

its missing links, bone ID and weights!
gonna modify it so those are included.
 
hah!
mb9.jpg


i'll just sit back and bask in my own awesomeness now :razz:
this was hideously easy..

code isn't finalized, as there is no easy way to select the proper objects in the scene, but its basically a cleaned up version of chris cooksons exporter.
this is the exporter script, which i think will only work on max8 for now:

Code:
fn p val =
(
	if abs(val) < 0.0001 then return 0.0
	else return val
)

fn p3 p3 =
(
 	 rp3 = [0.0,0.0,0.0]
	 if abs(p3.x)>0.0001 then rp3.x = p3.x
	 if abs(p3.y)>0.0001 then rp3.y = p3.y
	 if abs(p3.z)>0.0001 then rp3.z = p3.z
	 return rp3
)

 fn printvert nd vnr skn =
 (skeen=rootnode.children[2].modifiers[#Skin]
 ps = p3(nd.verts[vnr].pos)
 norm=p3(getnormal nd vnr)
 tc=p3(gettvert nd vnr)
 wc = skinops.getvertexweightcount skn vnr
 if wc == 0 then (
 	skinops.SelectVertices skn vnr
 	throw "One or more vertices don't have bone assignment!"
	)
 b1 = skinops.getvertexweightboneid skn vnr 1
 format "  % % % % % % % % % " (b1-1) ps.x ps.y ps.z norm.x norm.y norm.z tc.x tc.y to:output_file
 format "%" wc to:output_file
 if wc > 0 then (
 	for w = 1 to wc do (
 	  bon = skinops.getvertexweightboneid skn vnr w
 	  wght = p(skinops.getvertexweight skn vnr w)
 	  format " % %" (bon-1) wght to:output_file

 		)
 	)
format "\n" to:output_file
)

output_file = createfile "C:\mbmodel.smd" 

format "version 1\nnodes\n"  to:output_file

-- NODES AREA ------

skeen=rootnode.children[2].modifiers[#Skin]
max modify mode
modPanel.setCurrentObject skeen

numbones = skinops.getnumberbones(skeen)

for num = 1 to numbones do (
name = skinops.getbonename skeen num 0
noode = getnodebyname name
parent = noode.parent

if parent==undefined then parentname="-1"
else parentname = parent.name

index = num-1

format "  % \"%\" %\n" index name parentname  to:output_file
)

format "end\nskeleton\ntime 0\n"  to:output_file


 --SKELETON--------

for num = 1 to numbones do (
	 index=num-1
	 name = skinops.getbonename skeen num 0
	 noode = getnodebyname name
	
	 in coordsys parent (
	 	 postion=p3(noode.pos)
	 	 rott=[noode.rotation.x_rotation,noode.rotation.y_rotation,noode.rotation.z_rotation]
	 	 )
	
	rott.x=p(degtorad rott.x)
 	rott.y=p(degtorad rott.y)
	rott.z=p(degtorad rott.z)
	

	format "  % % % % % % %\n" index postion.x postion.y postion.z rott.x rott.y rott.z  to:output_file

)

format "end\ntriangles\n" to:output_file


for noode in rootnode.children do(
	if classof noode == Editable_mesh then (
		faces = noode.numfaces
--		texname = noode.material[1].name
		texname = "Textures/costumes1.dds"
 		m = snapshotasmesh noode
 		for i = 1 to faces do(
 			format "%\n" texname to:output_file
 			currface = getface m i
 			for num =1 to 3 do (
 				vrt=currface[num]
 				printvert noode vrt skeen
 				)
 			)
 		)
 	
 )

format "end\n" to:output_file


close output_file

just copy this into a script file, and run it.

in the --NODES-- section of the script, you have something that looks like this:

skeen=rootnode.children[2].modifiers[#Skin]
this is the expression that saves whatever the mesh children[2] might be.
you need to make sure this is the shirt object you want to export.
to do this, first type

show rootnode.children into the maxscript listener.

you'll get something like this:
No Info Found on: #children($0, $shirt)

children($0, $shirt) is an array of all the lowest level objects in the max scene.

$0 would be the lowest level of the bones mesh, and $shirt is the shirt, or whatever is there.

so the array is this: children(1, 2)
if you wanted to export the bone, you'd write:
skeen=rootnode.children[1].modifiers[#Skin]
and if the mesh you wanted to export was the third object in the array, you'd write:
skeen=rootnode.children[3].modifiers[#Skin]

this is roundabout, but i'll figure out a way to make the selected mesh be the one thats exported.
 
seems like a new problem has appeared. changing the UVs even slightly causes them to be messed up when imported into BRF edit.
looks like this thing is more deeply messed up than i first thought. i guess a rewrite is in order after all.
 
the problem is a lot more internal than i first thought..

actually, it seems almost like the problem is with the mesh, and not the program... hmmmmm..
 
Back
Top Bottom