Jealous Jellyfish
http://jealousjellyfish.de/

Schleichfahrt Dateiformat
http://jealousjellyfish.de/viewtopic.php?f=8&t=241
Seite 8 von 8

Autor:  Kickthebaby [ Sonntag 22. November 2020, 18:59 ]
Betreff des Beitrags:  Re: Schleichfahrt Dateiformat

Licht !

Sorry not to speak German but I've almost forgot everythig now :twist:

This weekend I wanted as a little side project to make a converter using SF-Reloaded source to convert SF files to more common files

You can find it there:
https://github.com/LMCrashy/SF-Converter

There is also a binary release here :

https://github.com/LMCrashy/SF-Converte ... es/tag/0.1

The repository readme says everything.


Here is a small pic of some ships in blender :)

The size is kinda normalized using the .MOD embedded scale, but I'm not really sure how to handle these values.

Dateianhänge:
ships.png
ships.png [ 1.23 MiB | 690-mal betrachtet ]

Autor:  Nox_firegalaxy [ Montag 23. November 2020, 20:33 ]
Betreff des Beitrags:  Re: Schleichfahrt Dateiformat

Hey there. Nice work! If you are interested about the handling of the scaling factors some digging into the python code should yield somethine. Tbh it is so many years away, that I cannot recall any details. Only that one kind of model needed some extra rescaling which really bugged me.

Autor:  Kickthebaby [ Montag 23. November 2020, 21:10 ]
Betreff des Beitrags:  Re: Schleichfahrt Dateiformat

Yeah, I've seen that there is a scale param in the DES files too, yet I'm not sure if one does need to apply the mesh scale somehow before applying the .DES scale, or only the latter, and reading python gives me headaches :D

However I'm not sure what I'm going to do with these assets, I'm already very busy on my professional project. I've starded writing a vulkan toy engine as a side project and wanted to use some of the models as tests. Would be nice to render stuff from the 3D fx era with Vulkan ahah

Autor:  Nox_firegalaxy [ Montag 23. November 2020, 22:02 ]
Betreff des Beitrags:  Re: Schleichfahrt Dateiformat

https://sourceforge.net/p/schleichfahrt ... ts.py#l688 (parseCluster)
and
https://sourceforge.net/p/schleichfahrt ... ter.py#l77 (importModel)

So it is a combination of "Scale" in the "Size" section from the "VFX/SOBJECTS/" .DES file for the dtype (game object) and the input regarding scale .DES file from the "gamedata/NEWMODULE/" folder. So I think my code complete ignores the mesh scale. The python code was my very first big project with python back then and the version is rather acient by now. So this is not really an example for good python by any means. However, python is very good for rapid prototyping.
E.G. the MVI to PNG part can be written in python as:

Code:
from PIL import Image
import SF_Loader

path_to_your_SF_files   = "D:/SF"
name                    = "FILM/D02"
counter                 = 0
mvi_file                = SF_Loader.MVILoader()
mvi_file.load(path_to_your_SF_files + "/GFX/MVI/" + name)

while not mvi_file.has_finished():
    mvi_file.decode_next_frame()
    img = Image.frombuffer("RGBA", (mvi_file.width, mvi_file.height), mvifile.imgdata)
    img.save(f"frame{counter:03d}.png","png")
    counter += 1


And actually this is only because I wrote the exporter poorly. If I would have done it properly it would be:

Code:
from PIL import Image
import SF_Loader

path_to_your_SF_files   = "D:/SF"
name                    = "FILM/D02"
counter                 = 0
mvi_file                = SF_Loader.MVILoader()
mvi_file.load(path_to_your_SF_files + "/GFX/MVI/" + name)

for frame_number, frame in enumerate(mvi_file):
    img = Image.frombuffer("RGBA", (frame.width, frame.height), frame.imgdata)
    img.save(f"frame{frame_number:03d}.png","png")


So one can write very meaningful code with minimal "noise" (i.e. code which does not add information). So I can only recommend to take a closer look and give python a try. It is really worth it. Especially if your time is the limiting resource.

Autor:  Kickthebaby [ Montag 23. November 2020, 22:46 ]
Betreff des Beitrags:  Re: Schleichfahrt Dateiformat

Thank you for the insight. Your code is indeed very clear and easily understandable, it was a great help, I'm just not very used to Python, although I plan to learn more of it because I need to write some blender tools in the near future.

Seite 8 von 8 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/