Overview:GTA3 and VC have some great surface effects for making your models more realistic. Alpha channels are used to create graphics like shadows and explosions with transparent backgrounds. Illumination (pre-lighting, glowing) and reflections can be mixed in infinite ways to create the perfect level of colorful reflected light.
At least one effect is not available to us lowly modders: the vertex lighting that Rockstar used to create the illusion of scattered light on an object is not available using either Zmod or 3ds Max. Apparently Rockstar has a better DFF filter for 3ds Max then we do.Pre-lighting is not to be confused with the ingame "light bulbs" that you can create using the 2dfx entries in the IDE file. This tutorial will not cover 2dfx lights as there is already one written at this address:
http://www.gtaforums.com/index.php?showtopic=137858This collection of tutorials is a Work In Progress so feedback is welcome and updates are imminent.
| Important Definitions |
|---|
- alpha channel - an 8 bit grayscale texture that works in conjunction with the main texture called by the DFF. Alphas are used to create complicated patterns with various levels or transparency within one simple DFF. The sections of the texture that correspond to the black in the alpha image will be transparent and the sections that correspond to white will be opaque. The different shades of gray give you different levels of partial transparency.
- opacity - Zmod and 3ds Max allow you to give the whole DFF a certain amount of transparency.
- pre-lighting - when a model glows (light comes from the object). It's caused by vertex color pre-lighting (VCPL) in both games. Reflections have pre-lighting that is not caused by VCPL in VC. Reflections in GTA3 have no pre-lighting.
- vertex color pre-lighting - for the sake of this tutorial, I will refer to this as VCPL. This is the process of placing a light in the scene of your modeling program (3ds Max) and then applying it to the models as VCPL thus giving every vertex a color and light intesity value.
- reflections - caused by the addition of a second texture that serves as the mirror image in the reflection. It uses the same mapping as the main texture and is added as the "reflection texture" in the modeling program.
|
.
.
Lesson 1: Create a Pac-man Ghost Using the Alpha ChannelAlphas can be used to give a simple four vertex DFF different levels of transparency. In this example, a Pac-man ghost will be made using the alpha channel.
required programs:
IMG Tool -
http://www.codenamegta3.co.uk/show_file.asp?Id=46TXD Builder -
http://www.steve-m.com/?lang=EN&page=2&act=details&ID=19TXD Tool 1.1 - list missing
Zmodeler -
http://www.zmodeler2.com/ (use version 1.7)
or
3ds Max r3 with DFF exporter -
http://www.codenamegta3.co.uk/show_file.asp?Id=247An image editing program like Photoshop or PSP -
http://www.jasc.com (free trial)
Important: this tutorial starts with the creation of a main texture and an alpha texture. The number of colors in the palette of the alpha PLUS the number of colors in the main texture's palette needs to be less than 256, otherwise the TXD program will not import the textures properly. For more information about color palettes, see appendix A at the bottom of this post.
1. We'll start by creating the alpha texture. Open your image editor, click new, and create an 8-bit 128x128 pixel canvas in grayscale mode. You may want a different resolution, but remember that using powers of 2 will keep you compatible with Moomapper.
2. Remember that black alpha = 100% transparency. Since we want the ghost to have a see through background, the background of the alpha should be black. If your canvas is white then click "negative image" to turn it black.
3. Draw a white ghost with a gray border to make his body opaque with a partially transparent outline. If you want to get a bit fancy like I did then make a white ghost (see 1st pic) and blur it (mine is a Photoshop gaussian blur with a radius of five pixels). Name the image GOSTA.BMP. I called it "gost" because "ghost" is already used in GTA3 and I added an "a" to remind me that it is an alpha texture. ALPHA DONE (2nd pic).

note: these are not the actual bitmaps. This board doesn't allow .bmp files.
4. Now to move on to the main texture. Since the alpha is doing most of the work, all we need in the main is eyes and color. Click new and create an 8-bit 128x128 pixel canvas in color mode.
5. Copy the alpha to the new canvas. Draw a couple of eyes with the marquee tool and make sure the eyes are white.

6. Invert the selection to paint over everything but the eyes with the color you want the ghost to be (I chose red).
7. Deselect all and paint a couple of black pupils in the eyes. Name the image GOST.BMP.

8. Apply the texture to a mesh: open your modeling program and create a mesh from four vertices (2 faces). Import the GOST.BMP into a material and apply it to the mesh and UVW map it. The mesh should now look just like the main texture. Export the object as GOST.DFF. Notice there is no need to apply the alpha to the model. That work is done by the TXD file.
For a more detailed explanation of model texturing, check appendix B at the bottom of this post for 3ds Max or the following link for Zmod:
http://www.gtaforums.com/index.php?showtopic=1380609. Now it's time to import the textures into the TXD. The only TXD program that I've had alpha success with is TXD Tool 1.1. Unfortunately that program won't create TXD's from scratch, which is why I recommend creating the TXD with TXD builder and then updating the alpha with TXD Tool:
a. Open TXD Builder, Click "Add", open the GOST.BMP file (the main texture). Click "change". Check the "has alpha" checkbox. Click "no alpha selected" and open the GOSTA.BMP file (the alpha texture). Click "apply". Click "build TXD". Name the file GOST.TXD. Close TXD Builder. If TXD Builder works properly then skip to step #10 (it won't).
b. Open TXD Tool and open the GOST.TXD. You should see the eyes with red background. Click commands -> import -> alpha and select the GOSTA.BMP. If you want to view the alpha, click commands -> draw -> alpha. Close the TXD Tool.
10. Get your new models and textures into the game:
a. create GOST.IDE, GOST.COL, and GOST.IPL files
b. make references to them in the GTA3.DAT file (GTA_VC.DAT for VC)
c. import the TXD and DFF into the gta3.img file using the IMG Tool.
Important: whenever you make a DFF with transparency, the last entry in the IDE file needs be a "4". Otherwise you won't see all the models behind the ghost properly. My IDE file looks like this when you open it with notepad:
| CODE |
objs 5000, gost, gost, 1, 300, 4 end |
BTW, the first "gost" is the DFF name and the second "gost" is the TXD name. For more info on how to get scratch models and textures into the game, check this address:
http://www.gtaforums.com/index.php?showtopic=137836
Troubleshooting:problem: your ghost doesn't look like mine. It may look like a black ghost with a pixilated red transparent outline, or it might look like a red spotted square with eyes.
answer: you need to use TXD Tool to reimport the textures.
problem: TXD Tool is giving an error when importing the textures.
answer: there are more than 256 when adding the number of colors in the palettes of the main and alpha texture. See appendix A to find out how to solve this problem.
problem: the alpha doesn't seem to be working at all
answer: it could be that the alpha is not enabled in the TXD. Both TXD Gold and TXD Workshop give you a checkbox to turn the alpha on or off for each texture. In TXD Workshop, highlight the texture, click properties, and then you can rename both textures and turn the alpha on or off. Remember, if the alpha is off then it will still be in the TXD and TXD Tool will allow you to update it, but it won't work ingame.
=================================================
Lesson 2: Make the Ghost Transparent with Zmod's Opacity Slider:of course we could have made it more transparent by starting with a gray ghost instead of a white one back in the last lesson, but this way we can explore what happens when we use both alpha and opacity (see #5). If you'd rather use 3ds Max then skip to appendix A, #4.
required programs:
Zmodeler -
http://www.zmodeler2.com/ (use version 1.7)
TXD Workshop -
http://www.infofeast.com/delfi/gtatools/in...tm##txdworkshop1. Start by importing the DFF we made in the last lesson into Zmodeler. Zmod only retains the texturing if the DFF is accompanied by a TGA file. Take this opportunity to make a proper TGA complete with alpha by using TXD Workshop to export a TGA from the TXD you made in the last lesson. Place the GOST.TGA in the same folder as the GOST.DFF and import the GOST.DFF into Zmod.
2. Open the material editor by pressing "E".
At the top of the editor, pull down the menu and select the GOST.TGA texture.

3. Under the material view change the "Type" pull down menu to "glowing" and click "apply changes". The alpha should now be enabled.
4. Adjust the "opacity" slider and click "apply changes". Notice that the whole ghost is affected. Keep experimenting with the slider to find the right level of transparency.
5. IMPORTANT: if you want to use Zmod’s glowing effect with alpha AND half-opacity, you must set the "use alpha" pull down menu to "semi-transparent glowing for depth test" and apply the GHOST.TGA texture as a "light map" (see picture). This will be covered more in the next lesson. Finally, press "ok" at the bottom of the material editor.
6. export as GOST.DFF and replace the old DFF in the gta3.img file to see how it looks in the game.

=================================================
Appendix A: How to keep the number of colors under control.Remember, the main texture and the alpha texture are treated as one 8-bit texture. 8-bit textures have up to 256 colors in their palette, so the number of grays in the palette of the alpha plus the number of colors in the palette of the main texture needs to be less than 256. Paint Shop Pro (PSP) makes it very easy to control numbers of colors in the palette.
Open PSP, open the main texture. Click image -> count image colors. In my case there are 96 colors in my "eyes with red background" texture (the main). Since 256 - 96 = 160, there needs to be less than 160 colors in my alpha texture. Take note of how many colors are in the current alpha. There are many ways to reduce the number of colors, but my favorite method is to click adjust -> brightness/contrast -> brightness/contrast (increase contrast for more black and white, increase brightness for more gray). Play with those two numbers a bit and then check the number of colors again. Repeat this until the number is 160 or less.
* the brightness/contrast trick only works on black and white images. This next method is easier and works for both b/w and color. Simply open the image in PSP and click image->decrease color depth->X Colors. Then you can choose the exact number of colors.
Appendix B: How to apply a texture in 3ds Max:1. (This is how I made my ghost) first, draw a square shape.
2. Right click on it and select "convert to editable mesh".
3. Press "M" to bring up the material editor. The top left material should be selected.
4. Click the map browser button (see pic) next to diffuse, double-click bitmap, and open the texture. Notice the opacity level just to the right.
5. Click the "assign material to selection" and the "show map in viewport" buttons, close the material editor.

6. Click the "modify" tab. Click "UVW map"
7. If you don't see your texture correctly, then scroll down through the UVW parameters until you see "alignment". Try all three possibilities (x, y, z). More adjustments could be made with the mapping parameters and the coordinates in the material editor.
8. Click file export and switch to the DFF extension. If it's not available then you need to copy the DFF filter (rw30exp.dle) into the plugins folder of 3ds Max.
Stay tuned for the next two lessons:
"Give the Ghost some Firey Reflections"
and
"Possibilities With Pre-Lighting"
and more pics and tables. We all love pics and tables

and check out Ashdexx's reflections tutorial a few posts down
This post has been edited by jcab42 on Friday, Dec 3 2010, 15:03