www.tombraiderforums.com  

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Software Development

Reply
 
Thread Tools
Old 23-12-20, 17:07   #1
Bergus
Hobbyist
 
Join Date: Dec 2020
Posts: 38
Default New Blender addon to import wad objects and animation

Hi guys,
this is a Blender addon that I'm using to export Lara animations in FBX format so that I can import them into Unity. It may be useful also for other stuff, so I'm sharing the code.

I didn't test it very well, so I need some feedback. Maybe I can implement more features if they do not require too much time. Here is the github link where you can download the addon:

https://github.com/veeti512/wadblender

and here is a small video to show how to display the animations if you are not used to Blender:

https://www.youtube.com/watch?v=b9EMGA7lkiI

PS: I tested it on Blender 2.9
Bergus is offline   Reply With Quote
Old 23-12-20, 21:28   #2
VictorXD
Relic Hunter
 
VictorXD's Avatar
 
Join Date: Jan 2009
Location: ฿-₳-฿-¥-⍸L-⌽-₦
Posts: 9,496
Default

This is amazing! thank you so much for this
__________________
Persecution to all non Luds Gate believers may God's wrath fall upon you sinners
VictorXD is offline   Reply With Quote
Old 23-12-20, 21:35   #3
turneraider
Explorer
 
turneraider's Avatar
 
Join Date: Aug 2013
Posts: 560
Default

I've been looking for something like this! Thank you so much!!
turneraider is offline   Reply With Quote
Old 06-01-21, 03:01   #4
not again!
Explorer
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 969
Default

... I don't know how I missed this thread but this is incredible news! I'm speechless. You just made all the fiddling with different versions of Blender for importing and the need for at least two different MQO plugins obsolete. Not even going to mention the problems of getting the original animations into Blender.
I need a few moments to process this. A million thanks, this is amazing!
not again! is offline   Reply With Quote
Old 07-01-21, 19:09   #5
not again!
Explorer
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 969
Default

Thank you again for this awesome addon, it works great!
There has been one small inconvenience that I have encountered so far that I wanted to ask about: the textures show up fine in Blender but when exporting as OBJ the texture.png does not get written into the .mtl file. I have to re-assign/reload the texture manually in Blender for it to get added to the mtl.

I realize the addon was optimized for fbx, it's just that for Tomb Editor the .obj file format works best when a model is supposed to have shininess.
Re-assigning the texture is a small extra step and nothing to complain about, just thought I mention in case it's something that can be fixed easily.

edit: after spending a bit more time importing and exporting things, I think having to reassign textures is perfectly fine. It's probably best to manually rename the automatically created texture.png and give it a custom name so the texture doesn't get accidentally overwritten when exporting several models into the same folder and then you have to reassign textures in any case, so it's all good the way it is.

Last edited by not again!; 07-01-21 at 22:06.
not again! is offline   Reply With Quote
Old 08-01-21, 17:55   #6
Bergus
Hobbyist
 
Join Date: Dec 2020
Posts: 38
Default

Thank you guys, I'm glad that the tool is useful!
I see the problem with exporting, sometimes it also happens that the uvmap completely disappear. This update should fix it by re-importing the uvmap image:

https://drive.google.com/file/d/15xd...ew?usp=sharing

If it works I'll update in github, maybe I can also change the texture.png filename with the name of the wad? This should avoid confusion.

By the way, speaking of shine, I was not able to render this effect on blender. I got the data from the wad but I don't know how to apply it to the model since it is applied to each face. Since obj files preserve this information, can you please send me a sample obj file with shine effect so I can see how is it applied?

Last edited by Bergus; 08-01-21 at 17:56.
Bergus is offline   Reply With Quote
Old 08-01-21, 18:12   #7
Bergus
Hobbyist
 
Join Date: Dec 2020
Posts: 38
Default

I was also trying to import mixamo animations to TRLE using tomb editor. The LARA.fbx file generated using the export FBX option seems to be correctly recognized by mixamo.com. I'm able to import the animations back to blender but not in tomb editor It says "wrong number of bones". Do you guys know any easy way to import them? otherwise I can spend some time and make a script.
Bergus is offline   Reply With Quote
Old 08-01-21, 18:58   #8
not again!
Explorer
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 969
Default

Thank you once again very much, Bergus!
Quote:
Originally Posted by Bergus View Post
Since obj files preserve this information, can you please send me a sample obj file with shine effect so I can see how is it applied?
I have uploaded the tr1 cat statue as .obj with shine; blender file is also included just in case. It's the Ns value in the .mtl file which determines the shine of models in game, if that info is of any help.

https://www.mediafire.com/file/afind...tatue.zip/file

Quote:
Originally Posted by Bergus View Post
I was also trying to import mixamo animations to TRLE using tomb editor. The LARA.fbx file generated using the export FBX option seems to be correctly recognized by mixamo.com. I'm able to import the animations back to blender but not in tomb editor It says "wrong number of bones". Do you guys know any easy way to import them? otherwise I can spend some time and make a script.
The naming of the meshes and bones is important. I had not noticed yet, but just went to check and it's hopefully just the naming which causes the issue.
Lwmte explained it here (I bolded the important bit):

Quote:
Originally Posted by Lwmte View Post
Thanks! I have checked your files, and there are problems with both of them.

Ones called "unmodified_ms3d_export" don't have meshes at all (or more specifically, there's one dummy mesh), i.e. only animations are exported, not actual model. WT requires exported animation to have exported model as well to reference meshes from bone animations.

Ones called "parts_separated_and_renamed" for some reason have different names for bones and meshes. Bones are called "bone_n" while meshes are called "mesh_n". How come that you have separate bones and meshes in your animation files? Those should be basically the same. If for some reason you have actual meshes and anim bones stored separately, you may try to rename bones "bone_n" to "mesh_n_anim". Generally, any bone which is storing anim information should have a part in its name which corresponds to target mesh name. Then animation will import correctly.
So basically the meshes should be numbered from mesh_00 to mesh mesh_14, and their corresponding bones need to have the same name but with _anim appended:

00 - pelvis
01 - left thigh
02 - left shin
03 - left foot
04 - right thigh
05 - right shin
06 - right foot
07 - torso
08 - right upper arm
09 - right lower arm
10 - right hand
11 - left upper arm
12 - left lower arm
13 - left hand
14 - head

edit: on further thought I probably should have linked the entire discussion for context and not just the quote by Lwmte; it's from the WadTool thread:
https://www.tombraiderforums.com/sho...=223525&page=5

edit 2: additional info (from the same discussion)

Quote:
Originally Posted by Lwmte View Post
The problem is, since TR originally uses tree-based animation system with ugly push/pop operations, there's no way to clearly predict order of bones without referencing meshes. Usually it imports ok if you haven't messed with meshtree, but the chance to mess things up is still really big. So, as additional safety check, WT checks bone names against mesh names, and additionally checks if amount of bones is similar to amount of meshes. This way it can clearly predict if original TR animation integrity is broken or not.
[...]
as long as bone names are "synced" with mesh names (meaning - every bone name should contain full name of corresponding mesh name), you're good to go.

Last edited by not again!; 08-01-21 at 20:41.
not again! is offline   Reply With Quote
Old 08-01-21, 23:58   #9
Richard_trle
Explorer
 
Richard_trle's Avatar
 
Join Date: Aug 2003
Location: Brazil
Posts: 747
Default

I'm sorry, but if we export into fbx, can we import back using wadtool? or what? what am I missing?
Richard_trle is offline   Reply With Quote
Old 09-01-21, 08:02   #10
not again!
Explorer
 
not again!'s Avatar
 
Join Date: Feb 2008
Posts: 969
Default

^^ Yes, with this addon you can import objects and animations from a Wad into Blender, edit them and then re-import into your Wad using WadTool (importing animations into the Wad / WadTool is being worked on as mentioned above).

edit:

Quote:
Originally Posted by Bergus View Post
This update should fix it by re-importing the uvmap image
Just got around to trying it and now it works like a charm! Thank you so much!

Quote:
Originally Posted by Bergus View Post
maybe I can also change the texture.png filename with the name of the wad? This should avoid confusion.
This sounds like an ideal solution me.

Last edited by not again!; 09-01-21 at 10:32.
not again! is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 05:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.