Jump to content

rag2gltf, RSM to glTF model converter


Recommended Posts


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

Hi everyone,

 

A few days ago I started working on an "RSM to glTF 2.0" model converter as an excuse to toy with the glTF file format. I don't know if this'll be useful to anyone but I'm making it open-source so people can re-use it (maybe as an alternative to xarple's converter).

glTF, unlike most other formats, allows easily sharing/showcasing models on the web, like so:

* https://tinyurl.com/na33zm9s (model made by @Syouji from here)

* https://tinyurl.com/22vs9nhm (model made by @Naruto from here)

 

The project is still very early in the development process so it's not refined at all but it should be fairly usable as it is.

You can find it on github: https://github.com/L1nkZ/rag2gltf

 

Limitations

* glTF 2.0 doesn't support texture animations

Releases

0.1.3 - https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.3

0.1.2 - https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.2

0.1.1 - https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.1

0.1.0 - https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.0

Screenshots

Microsoft 3D Viewer

kKe8Xl0.png

Blender

Better quality: https://webmshare.com/play/d7BBY

nk5t6Us.gif

AausDLB.png

Edited by L1nkZ
  • Upvote 2
  • Love 2
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  830
  • Reputation:   316
  • Joined:  02/11/19
  • Last Seen:  

What a great contribution! I've seen that many mappers seek to convert rsm2 to rsm to use with browedit, it would be great if your converter could do it.

  • Upvote 1
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   115
  • Joined:  10/20/17
  • Last Seen:  

OOOHHH!!!
Finally, something to convert RSM2 ; W ; !! THANK YOU!!
And for making a new converter! The other one is good, but has got some problems and often it doesn't convert the models x3

But I have a question: is  glTF 2 better than fbx and obj? The tools that we currently have (rsm converter and Bromedit) can only import fbx and obj (as a mesh) respectively, to save them as rsm afterwards).
*I ask because it would be good to have those formats too, but maybe for later on! RSM2 is way more important right now >w<

Oh by the way, is it possible for it to have an exe file later on? x3 thank you!

Edited by Mina-chan
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

On 3/26/2021 at 2:14 PM, Mael said:

What a great contribution! I've seen that many mappers seek to convert rsm2 to rsm to use with browedit, it would be great if your converter could do it.

Ah yeah, I've seen many requests about this. Generating RSM files from other formats (including RSM2) was not in my priority list but I'll see if I can do something about this.

On 3/26/2021 at 5:04 PM, Mina-chan said:

OOOHHH!!!
Finally, something to convert RSM2 ; W ; !! THANK YOU!!
And for making a new converter! The other one is good, but has got some problems and often it doesn't convert the models x3

But I have a question: is  glTF 2 better than fbx and obj? The tools that we currently have (rsm converter and Bromedit) can only import fbx and obj (as a mesh) respectively, to save them as rsm afterwards).
*I ask because it would be good to have those formats too, but maybe for later on! RSM2 is way more important right now >w<

Well, RSM2 files are not handled yet!

Comparing file formats is always a matter of pros and cons. The OBJ format lacks some features and is less compact than glTF 2.0, that's for sure.

About FBX vs glTF 2.0 though, the main advantage is about development and maintenance I'd say. Since glTF is an open-source format, it's easy to find implementations, re-use them and also maintain a working converter in the future. Another advantage of glTF is its portability (to the web notably). FBX might be better for general purpose model editing at the moment though.

On 3/26/2021 at 5:21 PM, Mina-chan said:

Oh by the way, is it possible for it to have an exe file later on? x3 thank you!

Yeah I understand standalone executables are easier to use. I'll see if pyinstaller can do the trick.

Edited by L1nkZ
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   6
  • Joined:  09/01/15
  • Last Seen:  

Great. I hope that the progress of R & D of rsm2 conversion can be brought to the forefront. So far, the most troubling problem for everyone is how to degrade the rsm2 model, resulting in various game maps not working properly. This is not my familiar field, and I can't give much help. Tokei Uploaded an article before, which may serve as a reference

 

  • Upvote 1
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

On 3/29/2021 at 8:38 AM, 312200492 said:

Great. I hope that the progress of R & D of rsm2 conversion can be brought to the forefront. So far, the most troubling problem for everyone is how to degrade the rsm2 model, resulting in various game maps not working properly. This is not my familiar field, and I can't give much help. Tokei Uploaded an article before, which may serve as a reference

 

Hi! Yes I'm currently working on supporting RSM2 models (without animations at first) and I'm totally basing that on Tokei's work (thanks a lot to him for releasing his code).

 

RSM2 models are now supported (still without animations)!

Thanks again to @Tokei, who made this a lot easier by sharing his work on the format.

 

e7u3Szh.png

Edited by L1nkZ
  • Upvote 1
  • Love 2
  • MVP 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   6
  • Joined:  09/01/15
  • Last Seen:  

On 4/4/2021 at 5:35 AM, L1nkZ said:

现在支持RSM2模型(仍然没有动画)!

再次感谢 @Tokei,他通过共享格式工作简化了这一工作。

 

e7u3Szh.png
 

HI~~I finally see this exciting news. Do you plan to release the conversion program after repairing the animation??

Edited by Mael
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

On 4/6/2021 at 8:02 AM, 312200492 said:

HI~~I finally see this exciting news. Do you plan to release the conversion program after repairing the animation??

Yes, of course, everything is published on the github repository (see the first post).

Animations are now converted as well, except for texture animations, which aren't supported in glTF 2.0 unfortunately!

Better quality: https://webmshare.com/play/d7BBY

nk5t6Us.gif

Edited by Mael
  • Upvote 1
  • Love 1
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  830
  • Reputation:   316
  • Joined:  02/11/19
  • Last Seen:  

@L1nkZ I recommend adding some kind of executable or a precompiled version, so those who have no experience with phyton can use it.

Edited by Mael
  • Like 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

On 4/8/2021 at 10:14 PM, Mael said:

@L1nkZ I recommend adding some kind of executable or a precompiled version, so those who have no experience with phyton can use it.

Alright, I pushed a very rough release as an exe for people to try it out (and give some feedback): https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.1

Edited by L1nkZ
  • Love 2
  • MVP 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   6
  • Joined:  09/01/15
  • Last Seen:  

Thank you. This is very useful for us. I have successfully converted the model

 

 

 

Edited by 312200492
  • Love 1
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   115
  • Joined:  10/20/17
  • Last Seen:  

On 4/8/2021 at 5:24 PM, L1nkZ said:

Alright, I pushed a very rough release as an exe for people to try it out (and give some feedback): https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.1

thank you soo much!
I'm finally free to give this program a try ; v ;
I'll let you know if I find anything or if I have a suggestion ^^

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   6
  • Joined:  09/01/15
  • Last Seen:  

@L1nkZHello, most of the current use of your developed software to convert the rsm2 format is very normal, but there is a model that cannot be used after exporting the gltf file and has been reporting errors. Please take time to help me check the problem

 

image.png.2459a66b3dc1268edf06c1b01dfb202d.png

Model and texture file:  stone_s_02.zip

Edited by 312200492
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

18 hours ago, 312200492 said:

@L1nkZHello, most of the current use of your developed software to convert the rsm2 format is very normal, but there is a model that cannot be used after exporting the gltf file and has been reporting errors. Please take time to help me check the problem

 

image.png.2459a66b3dc1268edf06c1b01dfb202d.png

Model and texture file:  stone_s_02.zip

Hi, thanks for the feedback! The file contains two nodes with same name but rag2gltf expects that not to happen, which is why the conversion is incorrect.

I released a new version that should convert this file and others correctly: https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.2

  • Upvote 1
  • Love 1
  • MVP 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   6
  • Joined:  09/01/15
  • Last Seen:  

2 hours ago, L1nkZ said:

嗨,谢谢您的反馈!该文件包含两个具有相同名称的节点,但是rag2gltf希望不会发生这种情况,这就是转换不正确的原因。

我发布了一个新版本,应该可以正确转换此文件和其他文件:https//github.com/L1nkZ/rag2gltf/releases/tag/v0.1.2

Great. Your reply is so timely XD, thank you!

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   115
  • Joined:  10/20/17
  • Last Seen:  

Hii! I have some questions, because I don't really quite understand
There's a file that mentions these as requirements:
fire==0.4.0
gltflib==1.0.6
kaitaistruct==0.9
Pillow==8.1.2
PyGLM==1.1.7
Also, there's this other requisite:
## Prerequisites

* Python >= 3.7

Do I need to installall of  these programs?

Additionally, it mentions something about a command line, but I was unaware of what that means until now.

Maybe it's because this is a rough release, as you mentioned. Are you going to make the program "standalone" and easier to use in the future? Like rsm converter

But for now for me it's a bit difficult to understand what to do, so maybe I'll wait for a final release x3 thank you!

Oh nvm, I got it x3 there's a rag2gltf.exe in the "windows" version

Edited by Mina-chan
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   6
  • Joined:  09/01/15
  • Last Seen:  

@L1nkZHello, I found another mistake in the process of conversion. I need your help,

image.png.0f96c33d791377e6615d4c0bc291a218.png

File and texture compression package::data.rar

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   115
  • Joined:  10/20/17
  • Last Seen:  

Hii! I think I found a bug
image.png.c58f01ebcf7855bbcd497fb6b76acaa2.png

I think I can't convert if the folder path has spaces in them, so it only catches "My".

Also, I have a suggestion: Since there are hundreds of new models, is it possible to have batch conversion in the future?
Thank you so much!! /lv

Meanwhile, since I  had not much idea about how to use this properly (I'm very nob /swt), someone very kind sent me this:

@echo off
for /r change\ %%i in (*.*) do (
    echo %%i
    rag2gltf.exe %%i
)
pause


It can be made in a text file, saved as "change.bat", and placed in the program's folder. So you only have to click on it for each conversion.

a single rsm2 file should be in "change", and texture folders in "data"

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

14 hours ago, 312200492 said:

@L1nkZHello, I found another mistake in the process of conversion. I need your help,

image.png.0f96c33d791377e6615d4c0bc291a218.png

File and texture compression package::data.rar

Good catch, there was a slight problem with the parsing of some part of the format. I pushed a fix that solves the issue. ?

Here's the release: https://github.com/L1nkZ/rag2gltf/releases/tag/v0.1.3

1 hour ago, Mina-chan said:

Hii! I think I found a bug
image.png.c58f01ebcf7855bbcd497fb6b76acaa2.png

I think I can't convert if the folder path has spaces in them, so it only catches "My".

Also, I have a suggestion: Since there are hundreds of new models, is it possible to have batch conversion in the future?
Thank you so much!! /lv

Meanwhile, since I  had not much idea about how to use this properly (I'm very nob /swt), someone very kind sent me this:

@echo off
for /r change\ %%i in (*.*) do (
    echo %%i
    rag2gltf.exe %%i
)
pause


It can be made in a text file, saved as "change.bat", and placed in the program's folder. So you only have to click on it for each conversion.

a single rsm2 file should be in "change", and texture folders in "data"

Hi,

Issues with spaces are common when using command line tools. You should always put quotes around paths that contain spaces, for example:

rag2gltf.exe "C:\Path With Spaces\file.rsm2"

Yes, a batch conversion feature is doable and would be handy. The batch script you got there does just that, so I guess you're covered in the mean time at least ?

Edited by L1nkZ
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   115
  • Joined:  10/20/17
  • Last Seen:  

hii! I found another bug. But this is very strange.
When I convert one model, it's fine
but when I convert another model, the first one becomes broken, and it appears with the same shape as the second converted model
however, the modified date of the first model doesn't appear any different. so I suspect this has something to do with the other files, such as "tex_vertices.bin"
(maybe that's why it's not possible yet to convert several models at a time yet)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

32 minutes ago, Mina-chan said:

hii! I found another bug. But this is very strange.
When I convert one model, it's fine
but when I convert another model, the first one becomes broken, and it appears with the same shape as the second converted model
however, the modified date of the first model doesn't appear any different. so I suspect this has something to do with the other files, such as "tex_vertices.bin"
(maybe that's why it's not possible yet to convert several models at a time yet)

Ah yeah, this might be a bit misleading ... The idea is that several generated files have fixed names, so if you do multiple conversions in a row, in the same folder, those will be overwritten yes. Generating unique files names (with a prefix) or saving files in a unique folder for each model could fix that problem.

If you don't mind duplicating texture data, you can use the "--glb" argument to generate GLB files (these won't have the overwriting problem as they contain everything in a single file:

rag2gltf.exe --glb data\model.rsm

I created two issues on github to keep track of your suggestions: https://github.com/L1nkZ/rag2gltf/issues

Edited by L1nkZ
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   6
  • Joined:  09/01/15
  • Last Seen:  

Hello, now I have successfully converted to RSM file through your software, but now there is a problem. After entering the game, most of the models are flipped vertically, and the height of some models is problematic

Model flipping:unknown.png?width=819&height=499

The model is too high:unknown.png?width=564&height=499

Model flipping:image.png.e21e8172a1e32a9752118556a7bbbba0.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   115
  • Joined:  10/20/17
  • Last Seen:  

On 5/5/2021 at 2:48 AM, 312200492 said:

Hello, now I have successfully converted to RSM file through your software, but now there is a problem. After entering the game, most of the models are flipped vertically, and the height of some models is problematic

Model flipping:

The model is too high:

Model flipping:

Oh that's true. I noticed that if you view them in grf editor, it's as if they were mirrored in 2 axis, X and Y

This is a top view of this RSM2 mode, pglass_s_03.rsm2:
pglass_s_03.rsm2

This is the same model converted into RSM. I used this program to convert it into a glb, then exported into a fbx and then exported into ro using rsm converter:
pglass_s_03.rsm

Apparently, they're flipped when they're converted with this program, because I can notice it's already flipped when I open the glbs in Blender. Please take a look into it >w<

Edited by Mina-chan
I added more explanation
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   72
  • Joined:  01/24/18
  • Last Seen:  

On 5/5/2021 at 9:48 AM, 312200492 said:

Hello, now I have successfully converted to RSM file through your software, but now there is a problem. After entering the game, most of the models are flipped vertically, and the height of some models is problematic

Model flipping:

The model is too high:

Model flipping:

 

On 5/6/2021 at 10:28 AM, Mina-chan said:

Oh that's true. I noticed that if you view them in grf editor, it's as if they were mirrored in 2 axis, X and Y

Well, when converting back to RSM and including that model in an RSW there's a lot of things that can "wrong" when it comes to the exact position of the models' instances. I'd have to investigate to find out what goes wrong exactly.

According to what you (@Mina-chan) observed, the flipping could be due to the FBX -> RSM conversion itself.

Edited by L1nkZ
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   115
  • Joined:  10/20/17
  • Last Seen:  

On 5/12/2021 at 9:30 AM, L1nkZ said:

 

Well, when converting back to RSM and including that model in an RSW there's a lot of things that can "wrong" when it comes to the exact position of the models' instances. I'd have to investigate to find out what goes wrong exactly.

According to what you (@Mina-chan) observed, the flipping could be due to the FBX -> RSM conversion itself.

Oh who knows! I'm not certain of the cause either
But what I'm doing for now is, after merging the vertices and assigning the textures that are repeated, I flip the models in Blender in the X and Y axis in the Global Scale mode (the other flip option changes the angle of the model, but not this one). Then in Object Edit mode, I press Ctrl + A and "Scale" to make the new orientation its "default orientation". Finally, when the model is exported , it comes out perfectly!
(I'm currently using RSM Converter for this last step, for the "two side" and "shading mode" functions)

Actually, someone made a guide of the full conversion process, based on our posts in Borf's Browedit discord, but currently the site isn't working. I'll post the link here when it's available though, it may help you have more insight in what's missing and what could be added >w< but so far, it's been an amazing program!!

Edited by Mina-chan
  • Upvote 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...