How to create TMD models from DXF files

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
User avatar
LameGuy64
Verified
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 388
Joined: Apr 10, 2013
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines
Contact:

How to create TMD models from DXF files

Post by LameGuy64 » October 6th, 2014, 12:18 am

I could have made this tutorial a little earlier but I somehow forgot about it and I got a lot of things to do... But here's my tutorial on how to create TMD models for rendering on the PlayStation using tools that came with the PsyQ SDK and Blender (if you don't like to use Blender, you can use any 3D modelling program as long as it can export DXF files).

First, you'll need to make a 3D model for your project. While making your model, make sure to keep the polygon count as low as possible if you want to prioritize performance over detail. But remember, don't bother applying textures or vertex colors to your model as such data will not be carried over during the conversion process.

Now that you got yourself a model to convert, you'll need to export it as a DXF file. In Blender, you'll need to enable the DXF Export plug-in by going to File, User Preferences, Addons, and then Import-Export. Once there, scroll down the window a bit until you find the option Export Autocad DXF Format as marked in the screenshot below.
Image

Once enabled, click the Save User Settings button and then close the window. After that, you can now export your model in Autocad DXF format by simply heading to File, Export, and then Autocad DXF.
Image

With the DXF file, convert it to the RSD format using the dxf2rsd tool included in the PsyQ SDK by entering the following in the command prompt (assuming that you have already executed PSPATHS.BAT in the prompt):

Code: Select all

dxf2rsd -back mymodel.dxf
If you want, you can add an -s parameter before the file name to make the polygons of your converted model gouraud shaded if you wish to take advantage of the PlayStation's lighting system and -quad if you want triangle strips to be converted into quads but it doesn't work well sometimes. And if your model appears to be inverted (culling-wise), remove the -back parameter.

After conversion, the tool will produce 4 files with the following extensions: RSD, PLY, MAT, and GRP.
The RSD file contains 'relationship' information of the PLY, MAT, and GRP files.
The PLY file contains vertexes, normals, and primitive parameters.
The MAT file contains color and texture information of the primitives.
I don't know exactly what the GRP file is for but its usually blank.

All 4 files are actually text files and additional information of the file specs can be found in Filefrmt.pdf included with the PsyQ SDK if you wish to make a custom plug-in for Blender or any 3D modelling program that supports custom plug-in scripts.

Now that you have yourself an RSD file along with a few other files to go with it, you can open it using RSDTOOL that came with the PsyQ SDK... For now, this is the only tool that can edit such files but the downside is that its clunky, awkward, and buggy at times so just deal with it for now as there are no alternatives yet.

Usually, your model starts out blank since dxf2rsd ignores the color and texture information in your DXF file (the model shown here was converted with an -s parameter which explains the gouraud shading).
Image

The RSDTOOL program is pretty self-explanatory to use especially when most of the buttons have tool-tip notes on what it does so I'm not gonna put much detail about it.

This is what a finished RSD model project would look like:
Image

Now that your model project is fully colored and/or textured, you'll need to convert the RSD and its related files into a TMD. This is done by using the rsdlink tool that came with the PsyQ SDK by entering the following parameters:

Code: Select all

rsdlink -s 32.0 -o mymodel.tmd mymodel.rsd
Note: if your model is textured, make sure your TMD textures are already set to its proper framebuffer locations and if your model is gouraud shaded, you must open the MAT file of your model project and replace all F characters into G due to a bug in RSDTOOL.

The -s parameter followed by a floating point number is the scale factor that will be applied to your final model and is required as the vertexes will be converted into 16-bit shorts. I recommend starting at 32 and if your model is still too small for your requirements, change it to a higher value in small increments.

And there you go, you now have a TMD model file ready to be used in your 3D PlayStation projects... For a slight performance boost when rendering your model, run your finished TMD model through tmdsort by entering the following.

Code: Select all

tmdsort -o sortmodl.tmd mymodel.tmd
If you need a PsyQ example on how to view such models, you can find some examples made by me in this thread: http://www.psxdev.net/forum/viewtopic.php?f=64&t=626
You do not have the required permissions to view the files attached to this post.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

User avatar
kirito1910
Interested PSXDEV User
Interested PSXDEV User
Posts: 8
Joined: Dec 09, 2014
I am a: Developer
Location: Italy

Post by kirito1910 » December 12th, 2014, 2:14 am

Wow! Great guide :D thanks!

Orion_
Verified
Legendary Programmer
Legendary Programmer
Posts: 240
Joined: Aug 13, 2012
I am a: Programmer
PlayStation Model: Net Yaroze
Location: France
Contact:

Post by Orion_ » August 5th, 2015, 3:07 am

Retro game development on Playstation and other consoles http://orionsoft.free.fr/

User avatar
LameGuy64
Verified
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 388
Joined: Apr 10, 2013
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines
Contact:

Post by LameGuy64 » August 5th, 2015, 12:29 pm

This method is old and outdated as I've already made an RSD Export Plugin for Blender.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest