Train Fever Converter (BR146)
Beschreibung
Hier klicken, um zum Diskussionsthread zu gelangen.
Click here to go to the discussion thread.
[Blockierte Grafik: http://ftp.train-fever.net/flaggen/de.png] Allgemeines
Der Train Fever Converter von BR146 (TFC_BR146) ist ein Tool zur Konvertierung zwischen Wavefront Objektdateien und Train Fever's Modelldateien (*.msh & *.msh.blob). Dies schließt die Möglichkeit mit ein, von *.msh/*.msh.blob zu *.obj zu konvertieren. Bei der Konvertierung wird das Modell so aufbereitet, dass sämtliche Funktionen - mit Ausnahme von Joints - der originalen Modelle unterstützt werden (lt @UnixRoot). Mithilfe der zahlreichen Parameter kann die Konvertierung desweiteren stark angepasst werden. Auch drehen, strecken und verschieben des Modells ist möglich.
Da sich das Tool in Entwicklung befindet, kann keine Funktionsgarantie gegeben werden. Bei Problemen bitte im Diskussionsthread posten.
Ich möchte an dieser Stelle "Danke" an alle sagen, die mit bei der Entwicklung - auch im entferntesten Sinne - mitgeholfen haben, sei es durch Wissen zu dem Dateiaufbau als auch durch "Stresstests" des Programms an sich.
Bedienung
Das Tool wird über die Eingabeaufforderung (Konsole, cmd) bedient. Für einfachere Bedienung ist es sinnvoll, eine Batch-Script zu schreiben. Als Beispiel wurden zwei Scripte dem Archiv hinzugefügt.
Parameter
| /? | Zeigt die Hilfe zum Programm an. Weitere Parameter werden ignoriert. |
| /help | Zeigt die Hilfe zum Programm an. Weitere Parameter werden ignoriert. |
| /parameter | Zeigt die dem Programm übergebenen Parameter an. Wirkt sich nicht auf Konvertierung aus. |
| /make "ABC" VON ZU | Bestimmt grundlegende Konvertierungseinstellungen. Dabei gilt folgende Zuordnung:
|
| /mtl "Pfad/zum/Material" | Spezifiziert den Pfad, in dem sich die Materialdateien bei Train Fever befinden werden. Der Pfad ist relativ zum Train Fever Ordner "res/models/material". Zusammen mit dem Materialname wird die Zuordnung in der Mesh-Datei (falls Ziel) gebildet. |
| /noTangents | Überspringt die Tangentenberechnung. Damit wird die *.blob-Datei kleiner, jedoch geht die Unterstützung für Normal Maps verloren. |
| /flip | Invertiert die Seite, auf der die Texturen gezeichnet werden (Flächennormalen werden umgekehrt). |
| /X <axis>/Y <axis>/Z <axis> | Ordnet der Achse X/Y/Z des Zielkoordinatensystems die Achse <axis> der Ursprungsdatei zu. Das Modell wird, je nach Angabe, gedreht und/oder gespiegelt.Standardzuordnung:
|
| /SX <float>/SY <float>/SZ <float> | Skaliert das Modell im Zielkoordinatensystem in X/Y/Z Richtung. <float> gibt dabei den Skalierungsfaktor an. Standardwert ist 1.0, d.h. keine Streckung bzw. Stauchung des Modells.Gültige Formate für <float>:
|
| /TX <float>/TY <float>/TZ <float> | Verschiebt das Modell im Zielkoordinatensystem in X/Y/Z Richtung nach dem Skalieren. <float> gibt die Strecke an, um die Verschoben werden soll. Standardwert ist 0.0, d.h. keine Verschiebung.Gültige Formate für <float>:
|
Hinweis zu den Dateien:
Die zu konvertierende Datei(sammlung) muss sich dabei im aktuelle Arbeitsverzeichnis befinden.
In der Konsole wird dieses durch den Befehl cd geändert. Näheres in der Windowshilfe. Hierzu in der Konsole folgenden Befehl eingeben: cd /?
Hinweis zu Drehen, Skalieren und Verschieben:
Das Modell wird zuerst gedreht, dann skaliert und danach verschoben!
Außerdem unbedingt darauf achten, dass ein Punkt als Dezimaltrennzeichen verwendet wird!
Um das selbe Ergebnis bei den Achsen zu erhalten wie bei Omich's Converter sind folgende Parameter zu nutzen: /X -Z /Y -X /Z +Y
Beispiel OBJ zu MESH:
Die Datei "bsp1.obj" muss im aktuellen Arbeitsverzeichnis existieren. Das Tool liegt hier im Verzeichnis "C:\".
Optional kann der Pfad zu Materialdateien angegeben werden (ggf. '[' und']' weg lassen). Die weiteren Parameter bestimmen Drehung, Skalierung und Verschiebung des Modells.
Aufruf: "C:\TFC_BR146.exe" /make "bsp1" OBJ MESH [/mtl "vehicle/train"] [/X +X] [/Y -Z] [/Z +Y] [/SX 1.0] [/SY 1.5] [/SZ 0.9] [/TX -0.15] [/TY 1] [/TZ -1.5]
Beispiel MESH zu OBJ:
Die Dateien "bsp2.msh", "bsp2.msh.blob" müssen im aktuellen Arbeitsverzeichnis existieren. Das Tool liegt hier im Verzeichnis "C:\TF\".
Aufruf: "C:\TF\TFC_BR146.exe" /make "bsp2" MESH OBJ
Anmerkung zu Objektdateien
*.obj-Dateien müssen folgende Dinge beinhalten:
- Eckpunkte (edges)
- Materialien
- Texturkoordinaten (UV)
- Flächen nur als Dreiecke
In Blender müssen folgende Punkte beim Export angewählt sein, um diesen Bedingungen zu genügen:
- Include Edges
- Include UVs
- Write Materials
- Triangulate Faces
Geplantes
- zunächst warten auf Rückmeldungen, ggf. Bug-fixing, etc.
- weitere Konvertierungsoptionen nach Wünschen und Möglichkeit (keine Garantie, dass ich alles umsetze!)
- ASE-Unterstützung (gewünscht von DasMatze) -> geplant für v1.4
Sourcecode
Der Sourcecode wird zeitnah hier als extra Datei hochgeladen. Dies ist speziell für unsere Linux-, Ubuntu- und was-auch-immer-Nutzer. Ihr könnt damit das Programm für euer Betriebssystem selbst kompilieren. Es wird zum Kompilieren zusätzlich die Library von http://www.lua.org/ benötigt. Ggf. muss der Include-Befehl in der Datei "io_mesh.h" angepasst werden. Sollte jemand einen potentiellen Bug finden oder auch Hinweise zum Sourcecode haben, dann bitte im Forum (hier) melden oder direkt mit mir eine Konversation starten.
Bei Fragen zum Kompilieren bitte im Forum (hier) melden. Dort kann euch besser geholfen werden als hier unten in den Kommentaren.
Lizenz
Copyright (c) 2014 "BR146" from http://www.train-fever.net
(User page: www.train-fever.net/index.php/User/18313-BR146)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including the right to distribute and without limitation the rights to use, copy and/or modify the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Distribution permitted only at "www.train-fever.net".
The Software uses Lua (Copyright (c) 1994-2014 Lua.org, PUC-Rio.).
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[line][/line]
[Blockierte Grafik: http://ftp.train-fever.net/flaggen/gb.png] General
The Train Fever Converter from BR146 (TFC_BR146) is a tool for converting between Wavefront object files and Train Fever's model files (*.msh & *.msh.blob). This includes the possibility of converting from *.msh/*.msh.blob to *.obj. During conversion, the model is processed so that all functions - with the exception of joints - from the original models are supported (according to @UnixRoot). By using the numerous parameters you can modify the conversion further more. Also rotating, stretching, and moving the model is possible.
Since the tool is in development, function can not be guaranteed. Please post in the discussion thread in case of problems. I want say "Thank you" at this point to all who participate in the development, either through knowledge of the file structure as well as through "stress tests" of the program itself.
Operation
The tool is operated via the command prompt (console, cmd). For easier operation, it is useful to write a batch script. As an example, two scripts have been added to the archive.
parameter
| /? | Displays help for the program. Additional parameters are ignored. |
| /help | Displays help for the program. Additional parameters are ignored. |
| /parameter | Displays the parameters passed to the program. Has no effect on conversion. |
| /make "ABC" VON ZU | Specifies basic conversion settings. The following assignment applies:
|
| /mtl "Pfad/zum/Material" | Specifies the location where the material files will reside. The path is relative to Train Fever folder "res/models/material". The mapping in the mesh file is formed with the material name. |
| /noTangents | Skips the tangent calculation. Thus the * .blob file is smaller, but the support for normal maps is lost. |
| /flip | Inverts the side on which textures are drawn (surface normals are reversed). |
| /X <axis>/Y <axis>/Z <axis> | Assigns the axis <axis> of the original file to the axis X/Y/Z of the target coordinate system. The model is, depending on specification, rotated and/or mirrored.default mapping:
|
| /SX <float>/SY <float>/SZ <float> | Scales the model in the target coordinate system in X/Y/Z direction. <float> thereby specifies the scaling factor. Default value is 1.0, that is, no stretching of the model.Valid formats for <float>:
|
| /TX <float>/TY <float>/TZ <float> | Shifts the model in the target coordinate system in X/Y/Z direction after scaling. <float> specifies the distance. Default value is 0.0, that is, no shift.Valid formats for <float>:
|
Note to the files:
The file to be converted must be in the current working directory.
In the console this is changed by the cd command. More details in the Windows Help. Enter this command in the console: cd /?
Note to rotating, scaling and moving the model:
The model is first rotated, then scaled and afterwards shifted!
Also be sure that a point is used as the decimal separator!
To obtain the same results for axes as in Omich's Converter following parameters are to be used: /X -Z /Y -X /Z +Y
Example OBJ to MESH:
The file "bsp1.obj" must exist in a current working directory. The tool is located here in the directory "C:\".
Optionally, the path to material files can be given (if necessary omit '[' and ']'). The other parameters determine rotation, scaling and translation of the model.
Aufruf: "C:\TFC_BR146.exe" /make "bsp1" OBJ MESH [/mtl "vehicle/train"] [/X +X] [/Y -Z] [/Z +Y] [/SX 1.0] [/SY 1.5] [/SZ 0.9] [/TX -0.15] [/TY 1] [/TZ -1.5]
Example MESH to OBJ:
The files "bsp1.obj", "bsp1.msh.blob" must exist in a current working directory. The tool is located here in the directory "C:\TF\".
Aufruf: "C:\TF\TFC_BR146.exe" /make "bsp2" MESH OBJ
Note to object files:
*.obj-files must contain the following things:
- edges
- materials
- texture coordinates (UV)
- only triangles
In Blender the following points must be selected when exporting to fulfill these conditions:
- Include Edges
- Include UVs
- Write Materials
- Triangulate Faces
Planned Features
- first wait for feedback, if necessary bug fixing, etc.
- more conversion options according to the wishes and possibility (no guarantee that I-converting everything!)
- ASE support (desired by DasMatze) -> planned for v1.4
source code
The source code will be contemporary uploaded here as a separate file. This is especially for our Linux, Ubuntu and what-so-ever users. You can use it to compile the program yourself for your operating system. To compile, the library from lua.org is needed. If necessary the include command in the file "io_mesh.h" must be adjusted. Should anyone find a potential bug or have notes about the source code, then please report or start directly with me a conversation in the forum (here).
For questions about compiling please report in the forum (here). There, you may be better served than here in the comments below.
License
Copyright (c) 2014 "BR146" from http://www.train-fever.net
(User page: www.train-fever.net/index.php/User/18313-BR146)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including the right to distribute and without limitation the rights to use, copy and/or modify the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Distribution permitted only at "www.train-fever.net".
The Software uses Lua (Copyright (c) 1994-2014 Lua.org, PUC-Rio.).
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Kommentare 20
Neu erstellte Kommentare unterliegen der Moderation und werden erst sichtbar, wenn sie durch einen Moderator geprüft und freigeschaltet wurden.
Neu erstellte Kommentare unterliegen der Moderation und werden erst sichtbar, wenn sie durch einen Moderator geprüft und freigeschaltet wurden.
Hannah
hey,wenn ich bei manchen modellen versuche die body mehs in eine obj datei konvertieren will stürzt der converter kommentarlos ab,was kann ich da tun?
GreenPie
Same. Even on the old 32x Windows 7.
BR146
Hinweis: Mit v1.3.3.5 scheint es bei einigen Modellen Probleme bei der Normalen-Berechnung zu geben. Daher empfehle ich dringenst, Normalen mit zu exportieren. Bei Blender durch die Option "Write Normals" zu aktivieren.
BR146
Added english description.
Tattoo
I just seen this today. Thank you.
Nicely written.
amigo
Thank you!
DasMatze
Hinweis an alle: Damit ihr mit den Achsen nicht allzu lange herumprobieren müsst (was sehr zeitaufwendig sein kann), hier die Werte, die ich benutze: /X -Z /Y -X /Z +Y um dieselben Ergebnisse zu bekommen wie Omich's veralteter Converter.
BR146
Habe ich mal als Hinweis mit in den Text eingefügt. Nicht das das nachher in den Kommentaren untergeht.
DasMatze
Bei mir will es einfach nicht funktionieren. Ich habe eine LIDL.obj im selben Ordner wie die .exe und führe TFC_BR146.exe /make "LIDL" OBJ MESH /mtl "LIDL.mtl" per .bat aus. Die Konsole sagt mir "Loading "LIDL.obj" Material: todo" dann erscheint das "TFC_BR146.exe funktioniert nicht mehr"-Fenster.
BR146
fixed mit v1.1
DasMatze
Sehr gute Arbeit, vielen Dank! Wenn du jetzt noch statt der Eingabe der mtl Datei es so lösen würdest, dass die zu der obj Datei gehörende mtl Datei ausgelesen wird und die Meshes automatisch nach Textur gruppiert werden, dann wäre das Tool so ziemlich perfekt für mich.
BR146
im Moment wird keine mtl-Datei ausgelesen. Es wird nur der Pfad aktuell in die msh-Datei reinkopiert.
SpoorObjecten
Hmm, to be honest, I'm not happy about this tool! When I work on a model for many hours, it's not a great thing to know that people can just convert the model back and use it for their own purposes
BR146
well, I didnt thought about that... Hmm. I may add a notice to only convert mesh files if the license from them is granting modification (like my license).
BR146
I took a quick look at your files online here. I could not find any licence information. So someone could asume, that he is allowed to copy, modify (edit mesh, convet it and so on) and distribute it (on train-fever.net under his name /w or /wo your name). This is just to think about. (Use licences to avoid things you don't like - a user, who breaks the licence, is not my fault).
SpoorObjecten
Nah the biggest issue is that the people that care, will nicely ask even if there isn't a license. My issue is about the little kids jumping around, thinking it's normal to just download someones work
SpoorObjecten
Just what I'm trying to say: A license won't stop someone from downloading your model, convert it to OBJ and sell it or use it for other things
BR146
I got your point. Your right, the tool is simplifying this "stealing", because an obj-file can be converted in mostly everything else. I hate thos "little kids"
Grimes
Super Vielen Vielen ... Dank !!
Tattoo
Sweet. Thanx for this. Now I can figure out some stuff with this. I just found out that a model can have multiple textures, which I didn't know. And this will help with figuring out how things go together. Thank you...