Maxscript for import of Trine 1, 2 and 3 .fbm and .s3d models in 3D Studio Max.
Tested with Trine 1, Trine 1 Enchanted Edition, Trine 2 Gobline Menace DLC, Trine 2 Complete Story and Trine 3 The Artifacts of Power v.1.01 (Build 2997)
This version of the script is for static meshes only, without bone geometry. Maybe next time the bones and the animations...
The script also contains Trine 3 texture converter. The convertion by maxscript is extremely slow: first uncompress, then reorder of sequences of the bits ( I'm created lz4 algorithm by my self ) You can uncompress the .fbi files using fbi-to-lz4.bms script before the maxscript convertion.
Important information: this site is currently scheduled to go offline indefinitely by end of the year.
Trine 1 / 2 / 3 .fbm .s3d model importer
Trine 1 / 2 / 3 .fbm .s3d model importer
You do not have the required permissions to view the files attached to this post.
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
The files are version 16 ( maybe from Early Access period (alpha, beta, etc. )lumekano wrote:Thx,
But Some Error Model From Trine 3 Here:
http://www.mediafire.com/download/sjcs8 ... /model.rar
Sorry, but, they are not supported at the moment. Maybe later..
Supported versions (header magic number) are 4, 7, 11 and 18
(The models are testte with Trine 3 The Artifacts of Power v.1.01 (Build 2997))
- lumekano
- advanced
- Posts: 59
- Joined: Sat Feb 25, 2012 2:20 pm
- Has thanked: 40 times
- Been thanked: 11 times
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
Well This To Baaad , thanks for trying.vallex wrote:The files are version 16 ( maybe from Early Access period (alpha, beta, etc. )lumekano wrote:Thx,
But Some Error Model From Trine 3 Here:
http://www.mediafire.com/download/sjcs8 ... /model.rar
Sorry, but, they are not supported at the moment. Maybe later..
Supported versions (header magic number) are 4, 7, 11 and 18
(The models are testte with Trine 3 The Artifacts of Power v.1.01 (Build 2997))
UnKnown
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
vallex wrote:Maxscript for import of Trine 1, 2 and 3 .fbm and .s3d models in 3D Studio Max.
Tested with Trine 1, Trine 1 Enchanted Edition, Trine 2 Gobline Menace DLC, Trine 2 Complete Story and Trine 3 The Artifacts of Power v.1.01 (Build 2997)
This version of the script is for static meshes only, without bone geometry. Maybe next time the bones and the animations...
The script also contains Trine 3 texture converter. The convertion by maxscript is extremely slow: first uncompress, then reorder of sequences of the bits ( I'm created lz4 algorithm by my self ) You can uncompress the .fbi files using fbi-to-lz4.bms script before the maxscript convertion.
Thanks man!
- ItsMeLenny
- n00b
- Posts: 10
- Joined: Wed Feb 17, 2016 1:00 am
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
I'd like to make a Blender importer for Trine models. I have Trine 1, 2, TGM and 3. (Enchanted and what not).
I'm most interested in starting with Trine 2 and Trine 3. However I'm not so interested in having it automatically import textures or skeletons at this point in time, just starting with the mesh and the UV.
Blender uses Python which I am quite competent in, however I can't quite quite understand this maxscript.
I'm hoping an outline or a pseudo-code version of the mesh section of the importer can be written out, which I can then use as a guide to write the Blender script and then I can post it here.
I'm most interested in starting with Trine 2 and Trine 3. However I'm not so interested in having it automatically import textures or skeletons at this point in time, just starting with the mesh and the UV.
Blender uses Python which I am quite competent in, however I can't quite quite understand this maxscript.
I'm hoping an outline or a pseudo-code version of the mesh section of the importer can be written out, which I can then use as a guide to write the Blender script and then I can post it here.
- shakotay2
- MEGAVETERAN
- Posts: 4291
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1151 times
- Been thanked: 2244 times
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
For the mesh you don't need the maxscript:ItsMeLenny wrote:just starting with the mesh and the UV.
I'd be surprised if anyone could/would do that for you.I'm hoping an outline or a pseudo-code version of the mesh section of the importer can be written out,
(But if you sent me a sample of an fbm model (version 4, 7, 11 or 18) you're dealing with I could create a listener log file with some kind of fingerprint of said model.)
(I can't use the above version 16 model for such because it's not loaded by the maxscript and I'm too lazy to patch it.)
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
- ItsMeLenny
- n00b
- Posts: 10
- Joined: Wed Feb 17, 2016 1:00 am
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
I guess I'm confused as to what the maxscript actually does then, I thought it was an importer for the Trine mesh into which ever 3D program.
This mesh extractor, does it allow converting any models to obj? (based on selecting the correct parameters or what not).
[edit: Oh it's a windows thing. I'm on Linux.]
This mesh extractor, does it allow converting any models to obj? (based on selecting the correct parameters or what not).
[edit: Oh it's a windows thing. I'm on Linux.]
- shakotay2
- MEGAVETERAN
- Posts: 4291
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1151 times
- Been thanked: 2244 times
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
maxscripts (as the name states) allow to import into 3dsmax - then you can export the model to obj, fbx, ... - whatever exporter plugins are installed in 3dsmax.ItsMeLenny wrote:I guess I'm confused as to what the maxscript actually does then, I thought it was an importer for the Trine mesh into which ever 3D program.
that's what most of the downloaders expect it do to.This mesh extractor, does it allow converting any models to obj? (based on selecting the correct parameters or what not).
Not any model, though, but most of them.
And yes, it depends on the correct parameters - and that's what most guys (except a handful of people)
lack in: understanding how to get them.
you could try Wine, couldn't you?[edit: Oh it's a windows thing. I'm on Linux.]
edit: version 16 - well, I didn't expect adding version 16 to be so simple:
adding 3 lines in the for k=1 to meshnum do loop:
Code: Select all
local skip2 = readbyte f --0 --1
if version == 16 and actor do fseek f 3 #seek_cur
local numverts = readshort f #unsigned
format ("numVerts: %\n") numverts
local numfaces = if actor then 0 else readshort f #unsigned
if version == 16 and actor do skip = readbyte f
if version == 18 and actor do skip = readbyte f
(or copy the switch case 11 block and rename 11 to 16)
That's all; tested with ONE (actor?) file only, so don't blame me hahaha, just realized: my previous pic was just the head bottom up
@vallex: great script! Like it.
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
- ItsMeLenny
- n00b
- Posts: 10
- Joined: Wed Feb 17, 2016 1:00 am
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
I've actually made a bit of progress with the blender importer, using these max script tools as a guide.
I will probably start up a new thread for a blender importer exporter, however for the moment I am having a slight hiccup and I'm not sure what's causing it.
Importing the thief; her bow seems to be the right aspect ratio but she herself not so much, however I'm more concerned with the extra faces. (So I have manually resized in the picture, which I also resized the bow with it which didn't need to be changed but woops).
Also, which do each of the versions relate to? As in the 3, 4, 7, 11, & 18.
The files I'm testing seem to be detected as version 3 and they come from the steam Trine 2 Complete Story.
I should point out that I am uses the vertices and faces and blender is constructing the edges itself. I can't find the edges in the maxscript.
I will probably start up a new thread for a blender importer exporter, however for the moment I am having a slight hiccup and I'm not sure what's causing it.
Importing the thief; her bow seems to be the right aspect ratio but she herself not so much, however I'm more concerned with the extra faces. (So I have manually resized in the picture, which I also resized the bow with it which didn't need to be changed but woops).
Also, which do each of the versions relate to? As in the 3, 4, 7, 11, & 18.
The files I'm testing seem to be detected as version 3 and they come from the steam Trine 2 Complete Story.
I should point out that I am uses the vertices and faces and blender is constructing the edges itself. I can't find the edges in the maxscript.
You do not have the required permissions to view the files attached to this post.
- shakotay2
- MEGAVETERAN
- Posts: 4291
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1151 times
- Been thanked: 2244 times
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
startaddress of face indices probably wrong - use 0x10B56 for the body, 0x173a3 for the bow
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
- ItsMeLenny
- n00b
- Posts: 10
- Joined: Wed Feb 17, 2016 1:00 am
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
The __BEFOREFACES body starts at 68432 and the __BEFOREFACES bow starts at 95133.
Then "if actor" 3 shorts are read, that brings the position for the faces up to the correct number for the body at least, the thief is done before the bow and also recognised as an actor.
Ahhh, I got it just now, it was me adding +1 to mimick the ms file, however I'm assuming it's something to do with python counting from the 0, I assumed that max script starts counting from the 1, not 100% sure on that but I wrote my code in that way.
Now all I have is the body being stretched in the wrong directions that I have to figure out.
I still have to add the rotation and the UV map.
edit: also on closer inspection, some of her vertices arn't joined, I'm not sure if this is normal for these models whether they were done in segments, but that will be a thing to fix in blender or in blender scripting, there is a merge doubles in blender so I'm so that would do it
edit edit: fixed rotation, almost fixed aspect ratio ( have to figure out how to get the bounding box in blenders python api)
having major difficulty with the UV, partly because I don't know how to do it in blender python api,
hoping I can get it because it's part of the main reason I wanted to do this, I want to see the models up close.
edit edit edit: in these models "backface culling" has to be turned on, it appears that for material they placed the backs infront of the fronts.
Then "if actor" 3 shorts are read, that brings the position for the faces up to the correct number for the body at least, the thief is done before the bow and also recognised as an actor.
Ahhh, I got it just now, it was me adding +1 to mimick the ms file, however I'm assuming it's something to do with python counting from the 0, I assumed that max script starts counting from the 1, not 100% sure on that but I wrote my code in that way.
Now all I have is the body being stretched in the wrong directions that I have to figure out.
I still have to add the rotation and the UV map.
edit: also on closer inspection, some of her vertices arn't joined, I'm not sure if this is normal for these models whether they were done in segments, but that will be a thing to fix in blender or in blender scripting, there is a merge doubles in blender so I'm so that would do it
edit edit: fixed rotation, almost fixed aspect ratio ( have to figure out how to get the bounding box in blenders python api)
having major difficulty with the UV, partly because I don't know how to do it in blender python api,
hoping I can get it because it's part of the main reason I wanted to do this, I want to see the models up close.
edit edit edit: in these models "backface culling" has to be turned on, it appears that for material they placed the backs infront of the fronts.
You do not have the required permissions to view the files attached to this post.
- ItsMeLenny
- n00b
- Posts: 10
- Joined: Wed Feb 17, 2016 1:00 am
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
So are Trine 3 models themselves also compressed. I extracted them from the fbq which are now compressed in LZ4 instead of LZF, I believe the images are also compressed in LZ4.
My importer doesn't work with Trine 3 models (based off the code here), because for every model it seems to print out a completely different random version number.
My importer doesn't work with Trine 3 models (based off the code here), because for every model it seems to print out a completely different random version number.
- ItsMeLenny
- n00b
- Posts: 10
- Joined: Wed Feb 17, 2016 1:00 am
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
I did get version 16 working with that treeman model, but as for any of the models from Trine 3 (from steam) they don't work, all of them begin with quite a large random number. I don't know where the error lies.
- ItsMeLenny
- n00b
- Posts: 10
- Joined: Wed Feb 17, 2016 1:00 am
Re: Trine 1 / 2 / 3 .fbm .s3d model importer
I finally got it all working (almost).
When I try to load the trine 3 models their heads dont load and I get a read error on that final bit of the mesh.
Still fiddling around with it.
When I try to load the trine 3 models their heads dont load and I get a read error on that final bit of the mesh.
Still fiddling around with it.