11 February 2017

How to make a texture with transparency, a normal texture from your photo

My tutorial also applies to a certain degree for a normal texture (depending of your camera image resolution), and if this is the case, skip to part 2. It is posible that the normal texture whould be squished in the proces.

For this tutorial i have used a free and good program called Background Eraser by handyCloset Inc. from google play on my smartphone with android version 4.2.2 for saving the .png files with transparency and also edit them by removing allot of unwanted pixel around them), and Paint shop pro 7 on windows 7 ultimate for the bellow operations.

A image with a tranparency can be used for a graffiti, poster or flag texture, etc. and be sure to add them in game to a smooth surface if you took a picture of them in real life on a smooth wall.

I Using Background Eraser:

1. Editing the program options and using ,,Auto,, tool:

After you have opened your image file (click ,,Load a photo,,), do not move the 4 crop arrows, as is not needed. Just click ,,Done,, and then ,,Zoom,, so you do not accidentaly edit the image. Do not click ,,BgColor,, and leave the transparency part of the image white with grey squares as it is.

Zoom in and click ,,Manual,, and first adjust its ,,Manual Size,, and use its below pink handle tool to move it and delete parts of the image.

Zoom with your fingers up close, click ,,Auto,, and adjust it to about 20 or 25 for the threshold of Similar Color. Drag by the below red handle tool in a place then release it. When you release it, his tool makes the transparency part of the image.

2. Use the ,,Manual,,:

- Use the ,,Auto,, tool to pinpoint the exact location for the use of ,,Manual,, tool.

If you made mistakes click the undo arrow and maybe ,,Repair,,. Personaly I do not use the ,,Extract,, tool, as i think is not necessary for this tutorial.
- When you are done, click ,,Done,, click ,,Smooth,, 0, Save and Finish. It will save the image in your Pictures/Eraser folder.

Next when you open the image with Paint shop pro 7 you will see that black is the color of transparency.

II Using Paint shop pro 7:

Edit and save your image file (in my case a .png file) to a .tga file so it works for Kingpin life of crime by editing the following:
Save the file/files with F12 and ,,Save as...,, Truevision Targa (*.tga) in a new folder to keep the originals.

1. Adjust brightness and contrast:

Open the images again and go to (or hit Shift+B):
Colors- Adjust - Brightness/Contrast...
Brightness: -60
% Contrast: -50

2. Adjust gamma correction:
Go to (or hit Shift+G):
Colors- Adjust - Gamma Correction...
Thick link, and edit to 0.60 for Red, Green and Blue.

Hit Ctrl+S to save the file/files.

Minimize them in the program or open the file/files again and:

3. Resize the image:

Go to Image-Resize... (or hit Shift+S) and leave ticked ,,Resize all layers,, and ,,Maintain aspect ratio of:,, (the number will differ by image, so do not manualy input numbers)
Thick Percentage of original Width: 25 x Height: 25
Resize type: Biliniar resample for downsizing your image.

If you have many images, remember that Shift+S gives you the resize window.

Ctrl+S to save the file/files once again.

Next time this adjustements will remain as it is in photoshop pro 7, so you do not have to imput them again.

4. Resize the image to be at the power of two:

First, see the size of the image by going to ,,Image-Image Information...,, and read the dimensions in pixels.

Go to Image-Canvas Size... and adjust width and height to a lower number.
Leave both Center image horizontaly and Center image verticaly ticked if it helps you.

The resulting size of the image (and skins for models) should be at the power of 2 and most likely is not. For example 2, 4, 8, 16, are at the power of two but small to be used for a texture. Use 32, 64, 128, or 256 and combine them if your texture is not square. Keep it around the maximum of 256, so you do not have problems running your map.

If you are making a texture from a image that does not have a size of power of two numbers, the OpenGL engine resamples the texture and posible do it poorly.

If the image does not resize with Canvas Size, see below. But if it is ok, save the file as .tga, then read 5.

First right click the image folder and click ,,Browse With Paint Shop Pro 7,, and make a screen shot of images folder (you can use Snipping Tool for this), because after 7. the image name will save as Image 21 for example and it will lose its name.

- See the size of the image by going to ,,Image-Image Information...,, and read the dimensions in pixels.
- Open and Copy the image file.
- File-New and add for example at ,,Width: 256,, and ,,Height: 128,, (keep resolution at 72.000, Pixels, Pixels/inch, Background color: Black and Image type: 16.7 Million Colors (24 Bit).
- Copy the image file from the first one with Copy(your image)-Edit-Paste-As New Layer in the second empty one.
- Close the first image and save the new image as .tga. (hit F12).
- Click ok when the program tells you that the image will be saved as a merged one.
- Right click the image folder, click ,,Browse With Paint Shop Pro 7,, right click a image and click ,,Rename...,,
Use two or three words, for example word_v_1
and use underscore for the break, as QuArk and the game needs it like this.

For example if the image is 183x137, make it 256x128, but watch out for the numbers.

Now, if you go to ,,Image-Image Information...,, you will see the image has lost its alpha (Number of alphas: 0). Do not worry :)

5. Restoring the image transparency by editing and saving the .tga back to .png., then back to .tga :

Because the images was merged, we need to restore its transparency (Alpha channel transparency).

-,,File-Save as...,, (hit F12) and save as .png, click ,,Options,, bellow.

-Tick ,,Noninterlaced,, and leave thicked ,,Optimized palette,, and click ,,Run Optimizer...,,.

-Leave ,,Colors,, tab alone, go to ,,Transparency,, tab and tick ,,Alpha channel transparency,, and ,,Areas that match this color,,.

-Pick color, choose R:0 G:0 B:0 (the last color (8) in the top first row of colors), add 0 at Hue: and leave ticked ,,Link colors,,

-Click ,,Ok,, leave the ,,Format,, as ,,Non-Interlaced,, click ,,Ok,, and save as .png. 

-Close this png. file.

-Open the .png and save it back to .tga.

In Kingpin/main/textures/ make a new folder for your textures, for example username_textures and add the textures in that folder.

For adding the new textures in QuArk read the tutorial:
,,Adding the path to the new textures folder in QuArk:,, tutorial.

No comments:

Post a Comment