With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
The place for eye candy.

Moderators: Joe Kari, Coup'George

A little texture tutorial

Postby Joe Kari » Sat Apr 19, 2008 3:01 am

Hi !

Because many people have helped me so many time, I have decided to help potential mappers in return :)
I know that tutorials are the key of a mapping community. And I know that I would have probably give up mapping if Red Neckerson haven't made for me that nice little tutorial, explaining the basis of GtkRadiant (thanks a lot Red ! ;) ).

So my little contribution is a texture tutorial.

Maybe me, or some others would add some stuff here later... Today's subjects are :
* Why power of 2 textures are better than non-power of 2
* How to save jpeg files
* How to refresh old textures

Let's go !

Why power of 2 textures are better than non-power of 2

For those who don't understand what I mean, here is a little list of power of 2 numbers :
1 2 4 8 16 32 64 128 256 512 1024 2048
As you can see, you simply have to multiply per 2 the last number to obtain the next one... very simple !

For example, 512x256 is a power of 2 textures.

Why is power of two better than others ? Because OpenGL (and video cards) only handle power of 2 textures (for performance issues). Quake3 engine and other games interpolate non-power-of-2 at runtime (when the game loads the level), and transforms them into valid power of 2 textures. But it only supports it roughly.

Now, the proof !
Let's try it with 4 textures variation taken from my map "Alamo".
Here are the source textures :

128x256 :
Image

130x260 :
Image

250x500 :
Image

256x512 :
Image




This is what it looks like in-game (sorry for the wide image, but if I resize it, you will miss the difference... I hope it isn't too annoying for those who have smaller screens) :

Left : 128x256 texture, right : 130x260 textures
Image

As you can see, the right texture is blurry, and especially if you look at the border.

Left : 250x500, right : 256x512
Image
This time it is more impressive ! You can see that only a few pixels can entirely change the feeling of the texture. Left we have a blurry texture, while the one on the right has sharper detail.


If you look at the first and the second in-game screenshots, you will see that even the 128x256 texture looks better than the 250x500 textures...
And the filesize of the 128x256 textures is 19Ko, when the filsize of the 250x500 texture is 66Ko. Three time the size for something less desirable...
What a waste of quality and of hard-drive space ? (and bandwidth for server with auto-download enabled)

That's why it's bad to use non-power-of-2 texture :D

So how to efficiently save your work? That's the second part of today's tutorial ! ;)




How to save jpeg files

First, if your texture isn't a power-of-2, you need to resize it.
If you are using Photoshop or The GIMP, or you have some alternative, use the BICUBIC algorithm !

Note : Don't worry if resizing a texture wastes the height/width ratio : you just have to set a different X and Y scale for that texture in Radiant ! As you can see in the previous part, my painting textures look too thin, but in-game, it has a good ratio.


If you run Photoshop, don't save with "Save As", use "Save for Web" instead, because filesizes are more optimized (especially for small files).
Disable the "progressive" checkbox, Q3 doesn't know how to handle progressive jpegs (this feature is only useful for web-browsers, allowing pictures to be displayed with multiple passes, with less blur at each pass).
Enable the "optimize" checkbox (reduces filesize).
Use a quality of 80%, you wont see any difference between 80% and 100% quality, but anything over 80% uses twice the space.
Don't drop quality under 80% because of the famous JPEG artifact ! Nobody wants crappy textures !!!

About the TGA format, use it only if you need alpha channels for that texture. TGA is a non-destructive file format. You will have max quality using this, but in fact, JPEG at 80% looks the same, but takes... hum... 10 times less space most of time.
If you have semi-transparent textures or see-through textures, you must use TGA because of the alpha-channel requirements (too bad PNG-24 aren't handle by Q3).
If you use Photoshop, save it as 32bits, enable "alpha channel", and
enable RLE compression (a rough non-destructive compression).




How to refresh old textures

Third part of my little tutorial :)

In Alamo, I wanted an old western wallpaper, so I have looked at the standard Smokin' Guns texture set and picked this one :
Image

Run the game, get close and look at the wall... Damn... has a lot of noise and artifacts... Even at mid-range...
Because it's very difficult to find western wallpaper pictures on the internet (never found one), I have decided to remake this one.

Because it is an old wallpaper, it was very simple. No sharp detail... Just needed the original color and contour...

First I have resized it to 512x512 (bicubic of course !).
Then I have applied a Gaussian Blur of 2 pixels (photoshop : filter>blur>Gaussian Blur). This removes all JPEG artifacts, but at a loss of detail... But I don't care : just want the color and basic shape !
Then I have applied an Artistic Filter, I don't remember which one, sorry :D Maybe "sponge". Just test many of them (photoshop : filter>artistic>?), until it looks good. Because it is a wallpaper, it was logical that an artistic filter should look good. I had only the color and a blurry shape, but now I have a nice texture with a painting feeling :)
Finally, I have added a Canvas effect texture (sorry, I run a french version of photoshop... something like : filter>textures>textures, then choose Canvas or something you like).

After only five minute, I have made this texture :

Image

Nice ! Isn't it ?



This is the end of my little tutorial, I hope it could be useful!
Good night!

PS : Moderator : feel free to edit my post to correct my bad english syntax, if needed ;)
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby Joe Kari » Fri Jan 02, 2009 4:02 am

Just to say that I have started a blog, with tutorials for mapping, texturing, md3 modeling, and shaders engineering... And about few others things that are really undocumented:

http://sgq3-mapping.blogspot.com/

I will probably post the same tutorial on this forum and on my blog.

See you ;)
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France




Return to Texture Artists

Show Sidebar
Show Sidebar

User Control Panel

cron