Making a sprite involves making a material. The ideal tool to use to compile a sprite is VTEX, or Nem's VTF Plug-In for Photoshop.
A sprite is always a flat, nonsolid image floating somewhere in the world. Most grass as seen in Source games consists of sprites. The glows around light sources are also sprites. Most explosions and fires are sprites.
Sprites are very easy to create and implement, as they are only images (VTFs) modified to appear in a certain position, with a certain orientation.
If you're using Nem's Photoshop plugin, just save a VTF with No level of detail, Clamp S, and Clamp T. If you use VTEX, however, see Paragraph 13 of Tutorial: Making a Custom Texture:
Take your TGA and place it in the materialsrc folder. Now, make a TXT file with the same name as the TGA--for instance, if your TGA is named yellow.tga, then you'll make an empty file named yellow.txt. The TXT file is used in special cases to modify the texture in special ways.
This TXT file will now become important for VTEX. Write the following contents to this file:
"nolod" "1"
"clamps" "1"
"clampt" "1"
You may now compile the texture normally (drag and drop either the TGA or the TXT onto vtex.exe).
Explanation: No level of detail ensures that the sprite looks the same for all users--it is not garbled and fuzzy for users with old video cards. Clamp S and Clamp T
ensure that the image does not "leak" over the sprite's edges--without them, the top pixels of the sprite would appear to have come from the bottom, and so on for each side. The Sprite's VMT
Now we have a VTF, somewhere in the ./materials/
Sprites need a special VMT. Somewhere in ./materials/, we'll have a raesprite.vmt, whose contents are formatted like this:
folder of our mod, but recall that the Source engine cannot use raw VTFs. Instead, an information file called a VMT is invoked. "Sprite"
{
"$spriteorientation" "vp_parallel"
"$spriteorigin" "[ 0.50 0.50 ]"
"$basetexture" "rae/raesprite"
}
This looks very much like a normal VMT. The first difference is the shader (found on line 1): we use "Sprite" for sprites, instead of "LightmappedGeneric"
The second difference is the inclusion of $spriteorigin. The value of this property is always [ S T ], where S and T are real numbers between 0.00 and 1.00 which denote where the center of the sprite is. A value of [ 0.2 0.8 ] would place the sprite's center 20% from the left side and 80% from the top. When a sprite is created at a point, it is translated so that its center appears at the point where it was created.
A major difference is the presence of $spriteorientation. This key controls how the sprite will orient itself to viewers.
- The value vp_parallel always orients the sprite to face its viewer, rotated counterclockwise by the entity's Roll (the third value of the Angles (Pitch/Yaw/Roll) property). Explosions are typically oriented this way.
- The value vp_facing_upright always orients the sprite to face its viewer, but the sprite never rotates or tilts. Grass is typically oriented this way--it rotates around the Z axis only, so standing on top of it does not flatten it against the ground as would occur with vp_parallel.
- The value oriented requires that the sprite be given a direction to face. It will always face this way. This can be useful for cheating the engine, by forcing a sprite to be displayed where a more expensive object would normally be used.
- The value facing_upright orients the sprite toward the origin, (0, 0, 0), but will not allow the sprite to rotate or tilt, like vp_facing_upright. This orientation will revert to vp_parallel if the sprite is too close to (0, 0, n) for all n.
$basetexture, as usual, is the path to the VTF, relative to ./materials/.
Having this VMT, you can use the sprite however you want.
or some other.
Take your TGA and place it in the materialsrc folder. Now, make a TXT file with the same name as the TGA--for instance, if your TGA is named yellow.tga, then you'll make an empty file named yellow.txt. The TXT file is used in special cases to modify the texture in special ways. |
Env_sprite
A popular use for sprites is the env_sprite entity. This versatile entity can be placed around light sources as a halo, requiring transparency and translucency. Sprites are also used for flames, explosions, and other simple effects; this involves multiple frames. Generally, sprites should use the Additive rendermode.
A popular use for sprites is the env_sprite entity. This versatile entity can be placed around light sources as a halo, requiring transparency and translucency. Sprites are also used for flames, explosions, and other simple effects; this involves multiple frames. Generally, sprites should use the Additive rendermode.
0 comentarios:
Publicar un comentario