S4L Model Exporting

Post questions about game models here, or help out others!
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Re: [Request]S4 League Model Exporting

Post by fatduck »

Seyren,
multimap[v].opacityMap.monoOutput = 1

for Transform, I end up using a custom switch in GUI to force the transform by parent or not.
No more Fatduck, no more FatImporter, Byebye everyone!
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

fatduck wrote:Seyren,
multimap[v].opacityMap.monoOutput = 1

for Transform, I end up using a custom switch in GUI to force the transform by parent or not.
Aaaw, whoops x2, i'm sorry :( , thanks again for answering that

Since i don't have a gui yet, i did this:

Code: Select all

if((findstring fSCN "background") != undefined) then TValue = 0.1
else if((findstring fSCN "character") != undefined) then TValue = 0.1
else TValue = 0.2	
Since luckily all the ones from the same folder have the same "transformation", i can do this and will work fine for now.

Animation chunk is probably fully parsed, remember there was an issue with "special animations" such as the katana? well, here it is:
Image

So once i manage to fix the skinning i think we are ready to go for the animations :P (Have no idea how to, but well, everything at it's time)

That being said, i'll list up again what is left:

To be fixed:

Skinning
And if someone discovers the hidden mistery of it, the Transformation Matrix, but i can perfectly deal with what i did before.

To do:
Animations(This is probably the hardest thing of all, i can imagine :[ , but everything at it's time).

I'll post or edit this post if something new pops up, but there is nothing real new but fixes at the moment.

Again thank you all for helping me this far and being so patient with me, nothing of this could have been done without you :]
ChrisX930
veteran
Posts: 154
Joined: Sun Feb 23, 2014 4:10 pm
Has thanked: 4 times
Been thanked: 3 times

Re: [Request]S4 League Model Exporting

Post by ChrisX930 »

Could you tell me how can I extract a Map (for Example Station 2) so I can use it in 3dsmax?
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

I just decided to add a lot of checks according to the models to display the model properly, i'm not going to bother anymore on the matrices for now, i'll leave it for later.

Working on skinning now.

Image

Still having the same issue, not all the vertex get parsed, looks like many of them do and get properly positioned, but others don't, and i honestly have no idea why this is going on.

I am not really sure why this is happening since i think the process is fine, or at least that's what i thought.

Code: Select all


					num_Skin_Data = readlong f

					append Skin_Data num_Skin_Data
					for i = 1 to num_Skin_Data do
					(
						Vert_Index =readlong f #unsigned
						Weight = readfloat f
						skinOps.setVertexWeights skinMod (Vert_Index+1) bone_id Weight
					)
				)
If someone is good at skinning please i would like to know how to gets this solved, since althought i know how to rig in 3DS max and i'm kind of good at it, this is another different world and i don't get how to get the proper formula

i tried a lot of different combinations but this is the one that gives me best results.

attached the full thing for testing, i would thank a lot if someone knows how to fix this, because it has been bugging me for almost two months and i have no idea on how to...
ChrisX930 wrote:Could you tell me how can I extract a Map (for Example Station 2) so I can use it in 3dsmax?
I am not sure what do you mean, what do you want to do with the map?
Last edited by Seyren on Fri Jun 13, 2014 12:02 am, edited 1 time in total.
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Re: [Request]S4 League Model Exporting

Post by fatduck »

Since in your i loop, you will add a new bone to skin modifier.
That is the index of your bone in skin modifier, so:
skinOps.setVertexWeights skinMod (Vert_Index+1) i Weight
No more Fatduck, no more FatImporter, Byebye everyone!
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

fatduck wrote:Since in your i loop, you will add a new bone to skin modifier.
That is the index of your bone in skin modifier, so:
skinOps.setVertexWeights skinMod (Vert_Index+1) i Weight
Did you test it? because it doesn't work for me :c

Code: Select all

-- Runtime error: Bone index out of range: 2
The loop is from i = 1 to Num_Skin_Data, which is the number of vertex the bone has skinned, so if for example they are 45 i do a loop of those 45 vertices, get each vetrex ID and the Weight they should have, and the bone id is stated here:

Code: Select all

					k= 1; 
					while k < kmax do
					(
						k = k + 1; --print k
						BN1 = skinOps.GetBoneName skinMod k 0; BN2 = (GetNodeByName BoneSkinName).name
						format "<%> <%>\n" BN1 BN2
						if BN1 == BN2 then
						(   
							bone_id = k
							k = kmax; print "break k-loop"
						)
					)
So the bone ID should be fine o.o
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Re: [Request]S4 League Model Exporting

Post by fatduck »

In your script:

for i = 1 to Num_Skin_Bone do
(
...
for i = 1 to num_Skin_Data do
(
...
)
...
)

You are using the same variable twice! Although 3dsmax will set all variable as local variable, you can't reference to the outer loop inside inner loop...
No more Fatduck, no more FatImporter, Byebye everyone!
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

fatduck wrote:In your script:

for i = 1 to Num_Skin_Bone do
(
...
for i = 1 to num_Skin_Data do
(
...
)
...
)

You are using the same variable twice! Although 3dsmax will set all variable as local variable, you can't reference to the outer loop inside inner loop...
Yes, but it gives the same result i do have :s

It's true though, that the bone id integer is now useless since i could have used the i value, didn't think of it :keke:

Image

It's like some of the vertex are linked to the other bones, or something like that, i don't know.

Then i realized something:

Image
Image

They have the vertex weights properly positioned.

If for example, if the left boot was carrying away part of the right boot when rotating it how come there are no weighted vertex on the right one?

Image

There are not a single weighted vertex on the right boot in the left boot bone, however, let's move the left boot.

Image

It doesn't make any sense!

This means i had the vertex weight properly done all this time and for some other reasons this is happening to me...

I have no idea what is going on... could this be some weird 3DS Max Settings? Or how could this happen? It's really weird...
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Re: [Request]S4 League Model Exporting

Post by fatduck »

OK, I tested with your method and it seems that evertime you addbone to your skin modifier, the skin weight changed!!!
(Mainly in 1st skin bone)

So you have to add all bones before start on weighting!
No more Fatduck, no more FatImporter, Byebye everyone!
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

I tried both, once i set all the bones and while setting them in, ended up in the same result, i ended up fixed it by using replacevertexweights instead of setvertexweights, i don't know how, but it worked.

Image

I'm not sure if it's about the files or just me but there are still some flaws in skinning

Image

Am i the only one getting this? (lilit.scn)


Also i'm having some problems positioning the skirts and accessories of the clothing...

Image

This is the skirt and the bones from the skirt are down there, does anyone know how to put them on the top?

All the bones are parented to a Dummy, and this Dummy is parented to BONESYSTEM, and since BONESYSTEM is always on 0,0,0.

So there must be a way to put the bones up to the skirt.

Any suggestions? :C
Last edited by Seyren on Tue Jun 10, 2014 8:31 am, edited 1 time in total.
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

More Weird checks

Image

This check function is just too big, i am probably doing it wrong but since there is no way i can find a clue on when to apply global and local transformation and the 0.1/0.2 is not even enough i must proceed to more weird stuff.

Anyway, although there are a lot of stuff to fix i guess i'm going to animation now :P

Let's see how it turns out

Image

I did put them by layers since i thought it was more organized this way, correct me if wrong, i have no idea about animations either how to continue, i'll keep looking up stuff i guess.
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

Sorry for not posting very often, i have been doing some research about the game.

I discovered that the accessories of the clothes is attached automatically in-game with the engine, so there is no way i can actually put that, maybe reading a game file or something, but that's not a priority for now.

I'm working on animations.

Working on animations, and well, since i have no clue how animations work, i did the following:

For Position animation for example:

Code: Select all


		--Initial_Translation=#()   
		(
		Pos_vx = readfloat f
		Pos_vy = readfloat f
		Pos_vz = readfloat f
		
		Ipos = point3 Pos_vx Pos_vy Pos_vz		
		--format "Initial Translation: [%,%,%]\n" Pos_vx Pos_vy Pos_vz
		)
                num_Trans_Animation = readlong f
		--format "Translation Animations: %\n" num_Trans_Animation		
		for x = 1 to num_Trans_Animation do
		(
			Tick_Time = ((readlong f #unsigned) / 80)
		  
			vx = readfloat f - Pos_vx
			vy = readfloat f - Pos_vy
			vz = readfloat f - Pos_vz
			
			Apos = point3 vx vy vz
			--Apos = Anode.pos * Apos
			
			if ANode != undefined then
			(
				with animate on 
				(
				   at time Tick_Time
				   (
						--in coordsys local ANode.pos += Apos
						in coordsys parent ANode.pos += Apos
						--in coordsys world ANode.pos += Apos
				   )
				)
			)
		)
So what basically i do is to animate using parent coordinate system, or that's how it's supposed to work (First i do the current cord - the Initial position (vx = readfloat f - Pos_vx), and i'm sure this is not the best way to do it.

As you can see i tried using local, global and parent transformation, global is totally messed up, so it's discarded, while local and parent do give the same result.

Here is a comparision of the supposed original animation and the one i am having (Mine is on the left, the good one is on the right)
http://puu.sh/9zZSQ/89d31daf9e.avi
(The weapon is in This Folder, assault_rifle.scn)
(The video doesn't even last 1 second so i recommend you to stop it frame by frame to see the difference)

You may think this is not that different but when the animation gets more complex everything goes all over the place, and is very messy.

So it looks like the animation is "FINE", but it goes way harder than it should, like it moves and rotates more than it should, and the more the animation goes on, the further it goes

Image


So it's like there is a value that makes it get more screwed the harder the animation goes.

Does anyone know how to apply animations correctly? This is my first time i ever do an animation maxscript and i'm failing horrible at it, so it would be great if someone tells me how, since i'm 100% sure what i am doing s wrong, i searched all over the place and i can't really get a clue on how to do this.


Thanks in advance
Seyren :)
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: [Request]S4 League Model Exporting

Post by Seyren »

Position Animation and Scale work now :)

Image
Image
Image

[X]Pos
[]Rot
[X]Scale
[]Alpha/Transparent
[]UV Animation

Without a doubt the rotation is the hardest one.

I'm using this for rotation:

Code: Select all

	for x = 1 to num_Rotation_Animation do
		(
			Tick_Time = ((readlong f #unsigned) / 80) --Frame
		  
			vx = readfloat f
			vy = readfloat f
			vz = readfloat f
			vw = readfloat f
			
			Arot = quat vx vy vz vw
			
			if ANode != undefined then
			(
				with animate on 
				(
				   at time Tick_Time
				   (
					   
						in coordsys parent ANode.rotation = IRot --this is the initial rotation of the model/bone before the whole thing starts
						in coordsys parent ANode.rotation += Arot --Stated before this is the rotation of the current frame
						
				   )
				)
			)
		)
I have been playing with + and - to get different animations, also with local, world and parent but this is the most accurate thing i got.

Image

You see the thing from the right goes to the left instead of right, it's like the whole thing is inverted, but i tried putting -vw, -vy, -vx and -vz to see if it could get fixed
Image
This one is creepy, yet curious.

The bones are actually reversed for some reason, if i comment the animations it goes like this:
Image

What is actually impressive is that the bones and skinning are working properly, lol.

And the one that is totally screwed up.(sentipumbe.scn)
Parent rotation:

Image

Local:

Image

World:

Image

This actually makes me chuckle every time i see it.

We can conclude that parent rotation is the one.

You may think that the problem is in in coordsys parent ANode.rotation = IRot but it's not since if i left only that line alone everything is fine and the bones don't get screwed at all, the problem is in the other one.

I am probably doing this wrong and there is actually a better way to do this, but i can't really tell, if someone cand recommend me a script with a rotation animation already made that would work better than this it would be appreciated it.

Until then, i'll keep working on this.

EDIT: I tried to divide the values (v rotation values) by 100000 and 500000 (because why not) and this happened:
100000:
Image
500000:
Image

Does it make sense? No (At least not to me)

Works? Not really, but for some reason the animations is clearer.

So now this means that i have to divide the value by a number and that the angle is reversed in some models, I honestly don't know how is this going on but well, i had to try.
User avatar
Seyren
advanced
Posts: 63
Joined: Sat Oct 30, 2010 1:39 pm
Has thanked: 18 times
Been thanked: 9 times

Re: S4L Model Exporting

Post by Seyren »

Animations "work" now:

Image

See the asteroid being blown in low framerate :P

However, there is a issue that in a lot of models although the angles are okay, the angles are reverted, let me show it:

Image

You can see that the fingers are going up instead of down, this happens on a lot of anims.

Image

Here is even worse, lol.

I have no clue why this happens, i tried a lot of stuff and i can't manage to get it right.

Since the devs work on maya i'm trying to do a py script on maya in hopes of getting this working somehow, because i did all sorts of attempts on MS and i can't manage to get it.

I'll keep working on both 3DS and Maya to get some clues.
raykingnihong
mega-veteran
mega-veteran
Posts: 178
Joined: Sun Apr 06, 2014 8:06 pm
Has thanked: 215 times
Been thanked: 6 times

Re: S4L Model Exporting

Post by raykingnihong »

Seyren wrote:Animations "work" now:

Image

See the asteroid being blown in low framerate :P

However, there is a issue that in a lot of models although the angles are okay, the angles are reverted, let me show it:

Image

You can see that the fingers are going up instead of down, this happens on a lot of anims.

Image

Here is even worse, lol.

I have no clue why this happens, i tried a lot of stuff and i can't manage to get it right.

Since the devs work on maya i'm trying to do a py script on maya in hopes of getting this working somehow, because i did all sorts of attempts on MS and i can't manage to get it.

I'll keep working on both 3DS and Maya to get some clues.
Hello friends can share latest 3dmax script, please, thank you
Post Reply