IPB

Welcome Guest ( Log In | Register )

> spray tutorial, make a css spray with transparencies
Omalley
post Dec 28 2009, 02:25 PM
Post #1



Leader of *MOAB*
Group Icon

Group: Admin
Posts: 2,912
Joined: 11-September 05
From: N.J.
Member No.: 2
Level: 24
Fav Kit: Soldier
Fav map: VV
First name: Scott
X-Fire: ihomalley
Gamers Name: SofaKingWeToddIt





Half Life 2



Static CounterStrike: Source spray tutorial (using transparencies) :

Welcome to my static spray tutorial, intended for Counter Strike: Source. The tutorial is written using Photoshop 7.0, but everything is applicable to version 7.0 and above (no guarantee's with < 6.0 however).

On a side note, if you are using version 7.0, as a standard installation, it doesn't support TGA files with alpha channels, so click here to download the updated TGA file format file (instructions included), and you'll be able to follow the tutorial correctly.

I won't be going into detail on how to create graphics in this tutorial because there are plenty of sites out there that deal with that, I will however be giving you an initial graphic (the Half Life lambda logo created by myself), showing you how to apply a layer style to it that incorporates transparencies (namely a drop shadow), and then how to take this information and put it into the alpha channel so that it looks correct in-game.

Click here to download the sample PSD (Photoshop file) we will be using for the tutorial. For a good range of Photoshop graphics tutorials from Phong click here.

 

Okay, lets begin.

Open Photoshop (I'm presuming here if you're at this stage and you're using 7.0, you've also already installed the updated TGA file format mentioned above). Once Photoshop is loaded, open the file 'sample_psd.psd'.

Now. If you look at the layers palette(shown right) you'll notice that there's 3 important parts:

1. (layer 'Lambda'). This layer is the layer the actual lambda logo (shown left) resides on.

2.(layer 'background_layer'). This layer is currently blank (but I've included it, because it is needed eventually).

3. (folder 'original elements'). This folder contains all the original elements that make up the lambda in an un-flattened state. They aren't needed, but I thought I'd include them anyway.

Concerning spray file sizes: File sizes for sprays are important. The current limit as of the 26th August is 130k.

All sprays must also be sized correctly (to the power of 2), e.g. 64x64, 64x128, 128x128, 128x256, 256x256.

Hint: Although rectangular sprays (i.e. 128 x 256) are accepted in-game all sprays appear square, so it's probably best to steer clear of these.

 

Now. left-click the layer labeled'lambda' as this is the layer we are going to be working with, and to do anything with it, we need it to be active (you can tell if a layer is active or not by the colour of the layer. i.e. blue = active). If the layer is already active, ignore this step.

Once selected click on the 'add layer style' button (shown right) (the icon in the bottom left of the layers palette that looks like a purple 'F'), and select 'Drop Shadow' .

A drop shadow menu will then appear. Use the following settings (shown below) and then press OK :

    


You should now have a lambda logo that's casting a pretty decent shadow (shown left... a bit lower down) .

Now. Press 'D' with Photoshop active (all this does is default the two Photoshop swatch colour's in the 'tools' palette to the colour's black & white).

Concerning Alpha Channels:

Source uses what's known as alpha channels (basically a separate layer in grayscale) to determine what parts of a spray you want to be shown and what parts you don't.

The way the source engine interprets information within an alpha channel is simple:

Black = Invisible, White = 100% visible and the gradients of grey's in between vary from fully visible to fully invisible depending on how close to black or white they are.

With that in mind when we look at our picture we can see that there are 3 shades we want in the resulting alpha channel for our image, which are:

1. we want the logo shape to be fully white.

2. we want the drop shadow to be a shade of grey (so that it appears semi-transparent in-game).

3. we want the rest of the image (show in checkerboard here) to be black so that it can't be seen in-game.

 

Now. Incorporating layer-styles (i.e. the drop shadow) in the alpha channel isn't as easy as just pressing copy.

We have to basically copy this information (in a flattened format) onto a separate layer so that it can all be marquee selected (because if you try and select the shadow as it stands you'll find you can't)!

With the
'lambda' layer highlighted press 'Ctrl & Shift & Alt & N' all at the same time. This will create a blank layer above the 'lambda' layer named 'Layer 1'. It's a good idea (but not totally important) to rename this layer, which is done by double clicking in the area where it says 'layer 1' .

Next, click 'Ctrl & Shift & Alt & E'. This is the Photoshop command to copy all the information in the layer below into the layer selected (in our case layer 1).

This is a good command to remember, because it means you can keep the layer information of 'lambda' in fact, should you choose to change something later.

Now you may have notice the drop shadow just got darker. This is because there are currently two layers displaying a drop shadow now. Simply click the 'eye' (far left of the lambda layer) to toggle it's visibility off.

 



Okay, so you're still following the tutorial... phew!

Now we need a marquee selection of the shape (including shadow), so holding Ctrl select 'layer 1' (or whatever you named the layer) in the layers palette and you should see the shape become marquee selected (as show to the left).

With the marquee still active select the channels palette(next to the layers palette) and click the 'create new channel' button (the little button second to right on the bottom of the channels palette) shown in the image to the right.

This will create a new alpha channel (called 'Alpha 1') and the image file will turn black.

The marquee should still be active at this point and you should basically have a black box with an outline of the Half Life logo (seen below).
 

Now, with 'Alpha 1' active press Alt & Backspace (background fill) and the alpha channel should be filled (just once) in the same fashion as the gif image to the right.

Next, press Ctrl & D (deselect) to deselect the selected marquee.

Remember the layer 'background_layer'? Select the layers palette and highlight this layer and fill it with a shade of grey.

To select a colour an easy way is to use the colour's palette located above the layers palette.

Simply enter 128 into each of the RGB values to get a good shade of grey, and then with the background_layer active press Alt & Backspace to fill it with the new colour.

Once the background layer is filled with grey all that is left to do (with Photoshop at least)is to save the file. Click File - Save As and from the format menu select *.TGA.

If you installed the TGA updated file format correctly 'Alpha Channels' should now be checked. Choose a suitable file name, click save, and make sure 32bit is checked.
 
Converting the spray to CS:Source VTF format
Now we've saved our spray as a 32bit TGA owing to the fact that Source doesn't support TGA sprays we have to convert it to the *.VTF file format so that it knows what to do with the spray. Download vtex from here and extract to wherever you want (maintaining the directory structure of the rar file) and follow these steps:

1. Place our newly created TGA file in the following folder * vtex\hl2\materialsrc\sprays
2. Run the file tga2vtf.bat to create the VTF file
3. Move the newly created *.vtf and *.vmt files from* vtex\hl2\materials\sprays and put them in the following directory:

"C:\Program Files\Valve\Steam\SteamApps\your-user-details\counter-strike source\cstrike\materials\VGUI\logos"
 

When you run Counter Strike: Source for the first time after creating a new spray before joining a server you will need to select your newly created spray from the options menu.

Once you have selected it, join a server and try it out, and if you've got something similar to the image to the left, well then you've done alright for yourself tongue.gif

Now you've learnt about the wonder of alpha channels & transparencies how about going and making some fun skins!

Any questions, you'll find me on the forums @ Teammoab.com most days.


 



--------------------

Player profile at BattlefieldHeroes.com, Free Shooter Game
You know you have played too many hours of Battlefield when...
You get a promotion at work the first thing you ask is "Where do I get my unlocks?"
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies(1 - 3)
Sheep
post Dec 28 2009, 02:43 PM
Post #2



Newbie
Group Icon

Group: Forum Member
Posts: 16
Joined: 15-November 09
From: Reinholds, PA
Member No.: 2,497
Level: above yours
Fav map: google
First name: Eric
X-Fire: black5h33p
Gamers Name: alot of them





nice tutorial any tips on objective C ???


--------------------
Player profile at BattlefieldHeroes.com, Online Shooter
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Omalley
post Dec 28 2009, 05:46 PM
Post #3



Leader of *MOAB*
Group Icon

Group: Admin
Posts: 2,912
Joined: 11-September 05
From: N.J.
Member No.: 2
Level: 24
Fav Kit: Soldier
Fav map: VV
First name: Scott
X-Fire: ihomalley
Gamers Name: SofaKingWeToddIt





QUOTE(Sheep @ Dec 28 2009, 02:43 PM) *

nice tutorial any tips on objective C ???



fuck apple and their overpriced shit products or you talking about the actual language?


--------------------

Player profile at BattlefieldHeroes.com, Free Shooter Game
You know you have played too many hours of Battlefield when...
You get a promotion at work the first thing you ask is "Where do I get my unlocks?"
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sheep
post Dec 29 2009, 05:43 PM
Post #4



Newbie
Group Icon

Group: Forum Member
Posts: 16
Joined: 15-November 09
From: Reinholds, PA
Member No.: 2,497
Level: above yours
Fav map: google
First name: Eric
X-Fire: black5h33p
Gamers Name: alot of them





ive been wanting to make a iphone app but not to familiar with the code objective C i understand alittle like line 1 is button
line 2 is what it does

or some shit like that lol withstupid.gif


--------------------
Player profile at BattlefieldHeroes.com, Online Shooter
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 9th September 2010 - 10:15 AM


subBlack shadows and light edition © 2005 - DreamCaster
Original subBlack phpbb2 style by spectre