About that obj-to-smd converter

Posted 10 months ago2023-05-26 18:25:26 UTC

Hi again!

I thought that now that I've broken the ice with making journals, I could talk a bit about the obj-to-smd converter I've been working on.
I mentioned it in my previous journal entry and I've talked about it in the Discord server. The project basically began as a test to see how easy it'd be to convert an .obj exported from J.A.C.K into a .smd file that could be compiled into a studio model for goldsrc. Apparently it wasn't that hard and it didn't take too long until I had something basic working.

Other people had shown interest in the project, and I could see the potential it could offer to other mappers, so I decided to build on the project to make it into something others could use. I added a logger to display info in the console and save warnings and errors to a file. I added the functionality for it to write a .qc file for a basic static prop along with the .smd to make compilation easier and faster. I set up a condition to make it skip any faces with NULL texture. I made it collect all textures with {-prefix and write a $texrendermode-entry for each one to make them use the masked mode.

Then I sent out this alpha version of the program to a few select individuals that had agreed to test it.
I've already gotten some very valuable feedback from two of them. The first helped me track down a coordinate system related error I had missed. The other brought to my attention some errors with the logging and input prompt which I hadn't noticed earlier either, and gave me an idea for how to make the program a bit more convenient to use.

During my own testing I had mostly just focused on whether all the polygons seemed right, whether the UV maps were correct, that weird geometry didn't throw exceptions here and there, and that sort of stuff. These two testers were able to notice things I wasn't paying attention to. This is why this sort of testing is very valuable and I appreciate the help a lot! Their names are already included in a special thanks section in the readme that will be included in a full release of the program.
Currently I'm working on a class for reading Wad3 files. This feature was inspired by the second tester.
The problem with the .obj file from J.A.C.K and the assosciated .mtl file is that they only include a reference to the texture used, but not the texture file itself. So in order to compile the model one would need to manually extract the textures from the assosciated .wad package and place it in the work directory. A solution we came up with was to let the program look for .wad packages in the work directory and search them for the textures by name, and automatically extract them. One would still need to place the .wad into the work directory, but that's definitely a whole lot less work than manual extraction. Especially when the model contains many different textures.

Before I started on the above feature I was working on a smooth shading functionality. I'm not completely sure how an user would turn on the feature, but so far I've thought of just looking up a _smooth[x] keyword in the end of the filename where x is the angle threshold and not using x (or using 0) would smooth all edges. I think the Wad3 support is far more useful and should be prioritized, so I switched to working on that instead.
After I finish the two features mentioned above I want to add some commandline support to the program. Currently it works by just drag-and-dropping the .obj file onto the executable which is plenty good enough for the typical use but one might want to be able to mess with various options, such as whether to not skip NULL-textured faces, not automatically set masked rendermode on {-textures, and setting a different output folder. Possibly also the ability to set various .qc options as well, such as $scale, $origin and $gamma.

I also want to add in support for reading .rmf/.jmf as well instead of just .obj (many thanks to Captain P for showing me the MESS code for parsing those!) This will make the program useful to even more mappers and break down the paywall due to the .obj export only being supported by J.A.C.K.

– Erty

6 Comments

Commented 10 months ago2023-05-26 21:17:31 UTC Comment #105293
MS3D?
Commented 10 months ago2023-05-26 21:55:10 UTC Comment #105294
What about MS3D?
Commented 10 months ago2023-05-27 11:03:30 UTC Comment #105298
Extract in general means to remove or obtain or derive a thing from something else. In this context it means to obtain a texture image from a .wad package.

To be able to compile a model you need to have the texture files in the texture directory specified by the .qc (the same directory as itself by default) and since the program cannot provide those textures for you (the .mtl file only contains references to the texture name but not any texture file data) it's necessary to extract those textures manually. Currently at least, until the next version.
Commented 10 months ago2023-05-28 00:23:52 UTC Comment #105299
What about MS3D?
I use it to convert OBJ from SMD. Works fine for me.
Commented 10 months ago2023-05-28 05:51:06 UTC Comment #105300
Yeah, and I use Blender to do that.

Part of the point of the program is to have an easy-to-use utility that avoids the use of any 3D editors. Not everyone wants to use something as antiquated like MS3D, or the intimidating UI of Blender, or the price tag of 3dsMax, or have the know-how to use these.
Commented 10 months ago2023-05-29 21:59:38 UTC Comment #105301
You know, that actually sounds pretty neat and useful.

You must log in to post a comment. You can login or register a new account.