Blender plugin to export a scene to a level for the 3dcam PSX engine.
Go to file
2020-12-29 15:01:44 +01:00
cube.blend rename io_export_psx_mesh.py to io_export_psx_tmesh.py 2020-12-27 17:13:21 +01:00
cube.c now export/import gouraud textured meshes with UV! 2020-12-29 15:01:44 +01:00
io_export_psx_tmesh.py now export/import gouraud textured meshes with UV! 2020-12-29 15:01:44 +01:00
Makefile now export/import gouraud textured meshes with UV! 2020-12-29 15:01:44 +01:00
primdrawG.c Add PSX code 2020-12-27 17:36:47 +01:00
primdrawG.jpg add pic 2020-12-27 18:31:51 +01:00
README.md README max polycount 2020-12-27 18:11:41 +01:00

Pic or it didn't happen

blender_io_export_psx_tmesh

Blender <= 2.79c plugin to export a gouraud shaded PSX mesh to a C file.

Specifically, it generates a C file containing :

  • an array of SVECTOR containing the vertices coordinates
  • an array of SVECTOR containing the normals
  • an array of CVECTOR containing the color of each vertex
  • an array of int that describe the relation between the tri meshes
  • a TMESH struct to ease access to those arrays

From libgte.h :

typedef struct {
        SVECTOR         *v;                     /*shared vertices*/
        SVECTOR         *n;                     /*shared normals*/
        SVECTOR         *u;                     /*shared texture addresses*/
        CVECTOR         *c;                     /*shared colors*/
        u_long          len;                    /*mesh length(=#vertex)*/
} TMESH;

Install the plugin

Put the io_export_psx_tmesh.py file in the addons folder of blender 2.79 :

On Linux, that's :

~/.config/blender/2.79/scripts/addons

Steps to load your mesh

  1. You must first triangulate your mesh (manually or via the modifier).

  2. When your model is ready, you can then vertex paint it. If you don't, the vertices colors will default to white.

  • If you modify your geometry after vertex painting, the plugin will faile to export the mesh. This is because the vertex color data is set to 0 each time you modify your geometry.
  1. If needed, edit the primdraw.c file , lines 29 and 30, to reflect the number of tris you want to be able to draw ( Max seems to be ~750 in NTSC, ~910 in PAL )
#define OT_LENGTH	2048	// Maximum number of OT entries
#define MAX_PRIMS	1024	// Maximum number of POLY_GT3 primitives

seem to be safe values.

Compiling

The provided Makefile uses the Nugget+PsyQ setup.

Create a folder in (...)/pcsx-redux/src/mips/, put the Makefile, cube.c and primdrawG.c in it, then in a terminal, just type make to build the ps-exe.

Credits

Based on the code provided by TheDukeOfZill, 04-2014, on http://www.psxdev.net/forum/viewtopic.php?f=64&t=537#p4088

PSX code based on example by Lameguy64