[IMPORTANT] How to edit poly flags on skeletal models.

Lessons and tutorials about mods and maps
Posts: 406
Joined: Fri Apr 20, 2012 6:38 pm
Personal rank: Master of Coop
Location: Odessa, Ukraine

[IMPORTANT] How to edit poly flags on skeletal models.

Post by Torax »

Hello everybody :highfive:

Before nowadays, i didnt heard about any stuff that will able modellers to edit poly flags for skeletal meshes, as for example, UnrealFX allowed to do with LOD meshes. Sure, there are few ways available, yes, - for example by giving specifical names to materials before export to .psk. But, as i heard, that worked fine mostly for 3DS users (famous ActorX exporter, supported by Epic).

I making models with Blender, so this way is not my way - Blender doesnt supports such stuff much (as was found during experiments). And really, i did not checked this way for Blender deeper - because plugin that allows export to psk from blender is a real nightmare to set it correctly imo.
I digged deeper into this problem and finally found result that WORKS. Tested it recently.

Zip file with stuff attached.

This tutorial describes how to set polygon flags for skeletal models

  • * Decide which flags apply to which materials. The flags must apply to a whole material, at the moment (so you could have Skin00 translucent, Skin01 two-sided, Skin02 masked and Skin03 normal, if you wanted).

    * Obtain a C compiler. It used to work with MinGW; try http://mingw.sourceforge.net/download.shtml (I think MSYS-1.0.9.exe is the right one).

    * Put the exported PSK and the pskhack files somewhere on the same drive you installed MinGW on (MinGW is a Windows port of Unix tools which assume you only have one filesystem root, but Windows has one filesystem root per drive).

    * Obtain a usable text-editor. If all else fails, you have Notepad.

    * Edit pskhack.c (look for the big comment that says "HACK ME", my editor says it's line 233) to do whatever particular bit of tweaking you're after. For instance, the version in the zipfile sets Skin02 to be masked and Skin01 to be two-sided. The POLY_whatever constants are listed at the top of pskhack.h, and if you're lucky, they might even be correct.

    * Open a command prompt (or a DOS prompt, if still using Win9x like me) and cd to the directory with pskhack and the PSK in.

    * Compile the executable with: gcc pskhack.c -o pskhack.exe (you may need to add the MinGW "bin" directory to your PATH, or invoke gcc as \mingw\bin\gcc instead of just gcc, or something like that).

    * Run the executable: pskhack.exe myfile.psk

    * If all goes well, your modified PSK file is in hacked_myfile.psk. Compile into UT and test as usual.
Only two cons for this method - it needs minimum knowledge of programming (but it is really more easy than sounds), and second one that polygon flags can be changed only per material, assigned to some group of vertices (UnrealFX allows that to separate polygons, not depending on materials). But those cons are really nothing in cause of new possibilities :mrgreen:

Will be good i think, if someone expirenced in native C++ programming will take a look at source codes and somehow improve stuff if it is possible - add GUI for example, model/material viewers and so, to make usage of things more easy for those who are not such expirenced in programming.
You do not have the required permissions to view the files attached to this post.
Unreal. Alter your reality..forever...
User avatar
Posts: 5498
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: [IMPORTANT] How to edit poly flags on skeletal models.

Post by Feralidragon »

Nice find :tu:
I was planning to do a tool to be able to edit them (after all the psk internal format is documented in UDN), but since I won't need to do it anymore in the model directly, I ended up scrapping the idea.