GSkinViewer is a model and animation viewer for SWAT3 G Engine models. It can load and display GSM (GSkinMesh) models and animate them using GSA (GSkinAnimation) animation files. The viewer can also edit textures in GSM files and save out a new mesh, making it a convenient alternative to gsmhacking for simple editing purposes.
Versions prior to 1.11 had a bug which breaks hit detection for models reskinned with the viewer. If you still have the original model with working hit detection you can repair your reskinned model with gsmhacking version 3.1.51 or later.
gsmhacking --fix-hit-detect <original.gsm> <reskinned.gsm>
Please see the requirements list to see what you need to run GSkinViewer. Usually it will be sufficient to extract the program and DLLs to some directory on your hard drive and launch it from there.
There is also a short FAQ list.
Milkshape 3D support
GSkinViewer now supports Milkshape 3D models. Load your model into the viewer and save it out in GSM format. Easy. Make sure you read the tutorial on preparing your weapon models for export, and play with the supplied character model to see what to do with officer models.
This section describes how to perform common tasks with GSkinViewer.
- Understanding the window layout.
- Loading and viewing the model.
- Previewing GSA animations.
- Reskinning models.
- Locating missing textures.
Also see the command line arguments that GSkinViewer accepts.
The window layout
GSkinViewer works with five main windows. Only two of these, the 3D view and the menu are visible when you first start the program. The others are shown as needed. Each window floats, which means you can keep them open to one side when not in use. Users of Maya and GIMP should feel at home with the floating windows.
The windows are:
The 3D view
This is of course the most important view. The model is displayed and animated here. If you close this window, the program will exit. See the Loading and viewing the model section for details on changing the model view.
The main menu
The main menu window allows you to open the Mesh and Animation menus, as well as choose a background image for the 3D view.
|Click the GSM icon to open the GSM menu window.|
|Click the GSA icon to open the GSA menu window.|
|Click the Exit icon to close GSkinViewer.|
|Click the Background button to browse for a new background image for the 3D view. BMP, TGA and JPEG images are supported.|
The GSM menu
This window lets you load and save GSkinMesh models, change certain display settings and access the textures menu. You can close this window without exiting GSkinViewer.
|Click the Load GSM icon to open a fileselector window and choose a GSM model to load.|
|Click the Save GSM icon to save the current GSM model disk. This is only really useful if you have edited the textures of the model. If you want to make advanced adjustments such as converting between model classes, you need to use gsmhacking.|
|Click the Remove GSM icon to remove the currently displayed model. Quite why you'd want to do this is anyone's guess but there you go, that's what this icon is for!|
|Click the Textures icon to open the textures menu.|
The GSM menu window also displays some information about the GSM and lets you change the way the model is rendered in the 3D view.
- Select the Bones checkbox to display the model's skeleton and gripper templates. Default: OFF.
- Select the Mesh checkbox to display the model's mesh. Default: ON.
- Select the Textures checkbox to display the model's textures. Default: ON.
- Select the Hit detect checkbox to display the models' hit detect colours. Default: OFF.
- Select the Wire checkbox to use view the model in wireframe mode. Default: OFF.
- Select the AA checkbox to render the model with antialiasing enabled. How good this looks - and how much of a performance hit it incurs - depends on your system specs and graphics drivers. Under normal circumstances it should look good, especially in wireframe mode. Default: OFF.
Note that the Hit detect checkbox was labelled Lighting prior to version 1.13.
The GSA menu
The GSA menu window lets you choose an animation to display with the currently loaded model.
|Click the Load GSA icon to open a fileselector window to choose a GSA to load. You can't load an animation if there is no model in the 3D view and you can only load an animation with the same number of bones as the model. For example, if you have a TAC class model loaded you cannot load a SWT class animation. gsmhacking can convert animations (and models) between the different classes.|
|Click the Remove GSA icon to delete the current animation and reset the model to the its default pose. Usually this is the Da Vinci pose though some models have different default poses.|
|Click the Play icon to pause or play the current animation.|
|Click the Next frame and Previous frame icons to control the currently playing animation. These buttons only work if the animation is paused.|
The textures menu
The textures menu displays the current model's textures and allows you to choose new textures to display. See the Reskinning section for more details.
Loading and viewing a GSM
Click the GSM icon from the main menu window.
The GSM menu window opens. Click the Load GSM icon and choose a model to load.
The model displays in the 3D view. To see the model:
- Hold the LEFT MOUSE BUTTON and move the mouse to rotate the view.
- Hold the LEFT and MIDDLE MOUSE BUTTONS and move the mouse to rotate the view about the Z-axis (into the screen). If your mouse only has two buttons, hold ALT instead.
- You can also use a joystick to rotate the view.
- Hold the RIGHT MOUSE BUTTON and move the mouse to drag the model around the screen.
- Hold the MIDDLE and RIGHT MOUSE BUTTONS and move the mouse to move the model closer or further away from the camera.
Keyboard alternatives are also available:
- Use the W and S keys to move the model closer to further away from the camera.
- Use the A and D keys to move the model horizontally.
- Use the R and F keys to move the model vertically.
See the missing textures section to see what to do if GSkinViewer is unable to find all the model's textures.
First load a model if you haven't already done so.
Click the GSA icon from the main menu window.
The GSA menu window opens. Click the Load GSA icon and choose an animation to load.
The animation you choose must be of the same character class as the currently loaded model. For example, if you are viewing a SWT class model you can only load SWT animations. GSkinViewer considers an animation to be of the "right" class for the model if it has the same number of bones in its skeleton.
By default the animation is paused at frame 1. You can watch the whole animation or step between frames. Press the Play/Pause icon or the SPACEBAR to pause or unpause the animation. When the animation is paused you can use the next/previous frame icons or the LEFT and RIGHT ARROW KEYS to change frame.
Enabling and disabling texturing
GSkinViewer can display a model's textures or it can be told not to. See the section on missing textures if GSkinViewer needs a hint on finding a model's textures.
Texturing is enabled by default unless you pass the
--notextures argument when starting GSkinViewer. You can toggle
texturing on and off from the GSM menu.
Please note that GSkinViewer will not even attempt to load textures when texturing is disabled. You must reload the model or click the Reload textures button from the textures menu after re-enabling texturing.
Note also that GSkinViewer automatically disables texturing when it cannot find a single texture for the model it just loaded.
As well as letting you view models, GSkinViewer lets you retexture them too. You can update the model in memory every time you change a texture, which means reskinning is much much faster using GSkinViewer than making your changes with gsmhacking or a hex editor and then loading up SWAT3 to check out the new model.
The first button you see is the Reload textures button. Press it when you have edited a texture file on disk. GSkinViewer will reload ALL the textures for the model.
Underneath that is a list of all the model's textures. You can select one or more items from the list in the usual way. Control-clicking, shift-clicking and marquee selecting all work normally in this list. Once you have a group of texture names selected you can choose to display ONLY those parts of the model which use those textures, using the Show only selected button, or to replace them with whichever file name is listed in the edit box at the bottom of the window. Use the Browse for texture button to open a filselector to choose a new texture and then press the Replace textures to replace the selected textures with the new name. GSkinViewer will automatically reload the model's textures for you, so you can see the results immediately.
Once you're happy with your reskinned model you can save the mesh from the GSM menu window and incorporate it into your mod.
See also the brief guide to reskinning using GSkinViewer.
Locating missing textures
GSkinViewer may not always be able to find all the textures needed to display a particular model. Check the FAQ to see how it looks for texture files.
To solve this problem you need to - in effect - reskin the model using the same steps described above. The missing textures show up in the textures window highlighted with an exclamation mark. Select all those with the same name, browse for the right file and hit Replace textures. Repeat for all missing files and the model should now display correctly.
Please note that you don't necessarily have to save the model for it to work in-game. SWAT3 knows how to find all the textures included in the game data and in user mods whereas GSkinViewer does not. If you get the green and white texture of death when playing you should put the missing texture in your mod's zip file.
Command line arguments
Disable joystick support. Use this if you have a joystick but don't want it to control the model view. Note that if you don't have a joystick the program will still work even with this argument.
Do not attempt to load any textures at first. You can still re-enable texturing and refresh the texture list later. Use this argument if a model crashes GSkinViewer and submit a bug report if the model loads correctly with textures turned off.
Draw bones by default. GSkinViewer will not usually draw bones unless you explicitly enable them from the menu.
Do not draw mesh by default. Probably only useful if you enable bones as well.
GSkinViewer is an OpenGL application. You will need a compliant OpenGL implementation on your system in order to run it. If you can run SWAT3 you can probably run GSkinViewer but this is not 100% certain since SWAT3 uses Direct3D for rendering.
One further library was used in the creation of GSkinViewer. PLIB is another library which, like SDL, is covered by the GNU LGPL. You can download the PLIB source code from http://plib.sourceforge.net/ but you do not need to do so, as it is included in GSkinViewer and not as a DLL.
Please note that because the required DLLs are all bundled with GSkinViewer, you do not need to download any of them. Simply extract the DLLs to the same directory from which you run GSkinViewer or copy them into your system directory.
How does GSkinViewer look for textures?
First GSkinViewer tries the texture name as it is stored in the GSM. This is unlikely to work for you unless YOU made the model or you have, by strange coincidence, stored all your textures in the exact same place as the person who did. Next it looks in the current working directory and all its subdirectories. That is to say the directory where GSkinViewer was run from. Finally it will try the directory where the model was loaded from and all subdirectories.
For example, say you start up GSkinViewer from
C:\Sierra\SWAT3\Tools\GSkinViewer and load
Martin Brenner's face is listed in the GSM as
GSkinViewer will first try to load
H:\SWAT3_cqb\FINAL_CHARACTERS\A_MAR_BRE\BG3_MAR_BRE_TEX\BG3_MAR_BRE_FACE.bmp. If that fails it will search
C:\Sierra\SWAT3\Tools\GSkinViewer for a file named
BG3_MAR_BRE_FACE.bmp. If it still can't find the file, it will
See the section on locating missing textures if GSkinViewer can't find your textures.
What's with the DOS window?
It's provides debugging and informational output. If it annoys you, minimise it.
Why does the viewport keep rotating?
You may have a badly calibrated joystick connected. Make sure your joystick is centred correctly or GSkinViewer will think you are trying to rotate the view.
Why does the 3D view freeze when it is obscured by another
Why does GSkinViewer appear to use 99% CPU at some times but not always?
GSkinViewer redraws the 3D view every time another window is moved in front of it. If it didn't do this, it would look very ugly. In fact you can see this effect by moving a fileselector window on top of the 3D view.
If another window, such as the task manager, is on top of GSkinView, the 3D view needs to be constantly redrawn, thus using a lot of CPU. Make sure the 3D view is on top and you should see the CPU usage fall.
Why does the program crash when I try to load GIF or PNG images?
This was a bug with SDL_Image. Newer versions of GSkinViewer use DevIL for image handling and shouldn't suffer from this bug.
What if GSkinViewer can't load a model or animation?
GSkinViewer uses all new code to load GSM and GSA files. The new code works on every file I've tested it on but that doesn't mean it will work on ALL files. If you have a GSM or GSA which the program can't load, you might have found a bug in GSkinViewer. Or you might have a broken file.
gsmhacking's GSkin loading code is considered stable. gsmhacking loads some files that crash SWAT3 itself. If you think that you have found a bug, try to parse the file with gsmhacking. Instructions on installing and running gsmhacking are available on its homepage. You'll either get an error message or a brief description of your file when you process it with gsmhacking. If you get an error, it means the file is invalid and there's no way it will work in GSkinViewer or anywhere else. If gsmhacking loads it OK, you've found a bug in GSkinViewer and you should send me the dodgy file so I can find and fix the problem.
Send any comments to firstname.lastname@example.org.