Jump to content

3d max tri file morph importer script


Guest

Recommended Posts

Posted

SOLVED

 

FILE CAN BE DOWNLOADED IN DOWNLOAD SECTION

http://www.loverslab.com/files/file/509-skyrim-tri-files-importer-for-3d-max/

 

 

 

I couldt find a approporate forum to post this in so i post this here :-/

 

I have done a maxscript wich will alow u to import tri file(skyrim morphs and so on) formats direcly into max eveything goes smoothly but theres some issue in importing the morphs :s it comes out like a huge box instead of the base mesh i got extracted direcly from vertice groups outside the morph vertices.

 

can someone please enlight me where i do wrong in the code

 

ill just post the morph code section






for d=1 to nummorphs do
		(
			testar=test()
			mnamesize=ReadLong f #unsigned
			mname=ReadString f
			scaleminx=Readbyte f #unsigned
			scaleminy=Readbyte f #unsigned
			scaleminz=Readbyte f #unsigned
			scalemult=Readbyte f #unsigned
			for l=1 to vertices do
		    (
				x=Readshort f #unsigned
				y=Readshort f #unsigned
				z=Readshort f #unsigned
				vers=[x as float,y as float,z as float]
				append testar.nmo vers
			)
			testar.mname=mname
			--append testar.nmo morphsarr
			--ver=[mnamesize,mname,scaleminx,scaleminy,scaleminz,scalemult]
			append structarr testar
			lbx1.items = append lbx1.items mname
			





cando=#()
	 --mesh vertices:structarr[sel].nmo faces:polytrisarr
		for l=1 to Verticesarr.count do
		    (
				ol=structarr[sel].nmo[l]
				mok=[ol.x,ol.y,ol.z]
				mok=[ol.x,-ol.y,ol.z]
				a=Verticesarr[l].x + mok.x 
				b=Verticesarr[l].y + mok.y
				c=Verticesarr[l].z + mok.z
				morpi=[a,b,c]
				append cando morpi
			)
		mesh vertices:cando faces:polytrisarr	

the last piece of code section is prolly where it all goes all wrong :(, bc i dubbled checked the values from first code and it matches the file morph vertices

 

 

oswfpe.png

Posted

Well I'm very interested in this but I don't think I can help...

 

I have little idea about 3ds scripts. I can vaguely figure out first fragment reads the morphs from file and builds some object and the 2nd fragment loops the previous vertices, flips the y-coord?, and builds a mesh.

how is polytrisarr populated?

have you tried to update the mesh?

mm = mesh vertices:cando faces:polytrisarr

update mm

Posted

Well I'm very interested in this but I don't think I can help...

 

I have little idea about 3ds scripts. I can vaguely figure out first fragment reads the morphs from file and builds some object and the 2nd fragment loops the previous vertices, flips the y-coord?, and builds a mesh.

how is polytrisarr populated?

have you tried to update the mesh?

mm = mesh vertices:cando faces:polytrisarr

update mm

 

vertice is just like any other a  point3 value

flip is currently not needed but scale is what to say "way out of box"   :dodgy:

 

 

 

faces is populated to array like this 

since max system is 1 based instead of 0 based as most of game i have to put a 1 there to get correct mesh

for b=1 to polytris do
		(
			x=ReadLong f #unsigned
			y=ReadLong f #unsigned
			z=ReadLong f #unsigned
			ver = [x+1, y+1, z+1] 
			append polytrisarr ver
		)

and yes is gets updated eachtime u dubbleclick on morph in listbox the basehead is suposed to change to the morph

 

Posted

What are lines 8, 9 doing in your second code section? 

 

8. mok=[ol.x,ol.y,ol.z]

9. mok=[ol.x,-ol.y,ol.z]

 

Is .y value coming in negative/positive and are you trying to sign it?

Posted

What are lines 8, 9 doing in your second code section? 

 

8. mok=[ol.x,ol.y,ol.z]

9. mok=[ol.x,-ol.y,ol.z]

 

Is .y value coming in negative/positive and are you trying to sign it?

 

combining base verties with morph vertice ,excuse the name on all the variables, all that stuff will be corrected when i get stuff to work,.

this is the full script

 

http://pastebin.com/HanytZBR

Posted

OK I think I made some progress.

ReadShort f #signed
and

ol=structarr[sel].nmo[l]
mok=[ol.x,ol.y,ol.z]
--mok=[ol.x,-ol.y,ol.z]
a=Verticesarr[l].x + mok.x / 100000
b=Verticesarr[l].y + mok.y / 100000
c=Verticesarr[l].z + mok.z / 100000
Maybe:

a=Verticesarr[l].x + mok.x / 100000 * <scalemult value you read>
also for b and c. Not sure if it looks better

 

http://pastebin.com/0PGrquJq

 

Hope this helps

post-82377-0-45709300-1387484795_thumb.jpg

Posted

oki solvved it :D thank u so much b3lisario.

 

now u can change morph in real time and  did some cleaning up

 

added this

	on btn2 pressed do
	(
	readfile()
	o=mesh vertices:Verticesarr faces:polytrisarr
	o.name="Skinny Morph"
	select $'Skinny Morph'
	)
	
	on lbx1 doubleClicked sel do
	(
	for ll=1 to Verticesarr.count do
	(
	morpii=[Verticesarr[ll].x,Verticesarr[ll].y,Verticesarr[ll].z]	
	meshop.setVert $ ll morpii	
	)
	update $
	
	 --mesh vertices:structarr[sel].nmo faces:polytrisarr
		for l=1 to Verticesarr.count do
		    (
				mvert=meshop.getVert $ l
				a=mvert.x + structarr[sel].nmo[l].x /100000 
				b=mvert.y + structarr[sel].nmo[l].y /100000 
				c=mvert.z + structarr[sel].nmo[l].z /100000 
				morpi=[a,b,c]
				meshop.setVert $ l morpi
				
			)
update $
	)

this is the full script and it works now ;)

 

http://www.loverslab.com/files/file/509-skyrim-tri-files-importer-for-3d-max/

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...