Sprite
- Move Source engine-specific shader stuff to Sprite (shader) and $spriteorientation. See also Shaders in Sprites\.
- GoldSrc-specific engine stuff likely belongs in SPR.
In GoldSrc and Source, a sprite is a rendered world object with some very special geometrickery. The sprite itself is a (static or animated) 2D image that looks 3D when viewed Normally (ie perpendicular to its surface). The trick is to make sure the player always views the sprite normally; which usually means rotating the sprite about its origin so it is always facing the Player. Obviously in multiplayer this rotation in World would not work, so the sprite is rotated only in the Player View.
Although their usefulness is severely limited, sprites are significantly cheaper to render than models or brushwork, and can also achieve convincing effects that would be impractical to model in 3D.
- Lighting: Sprites cannot cast or receive any kind of shadows, nor reflect cubemaps.
- Physics: Sprites cannot be Solid to anything Note:In GoldSrc,
cycler_sprite
entities can have collision (simple bounding box), but this entity is buggy and not meant for final distributables. Use a CLIP brush and/or an MDL instead.
Sprite entities
GoldSrc | Source |
|
Placement
- See Render Modes.
- See Attachments and Movement hierarchy.
Creation
- Design guidelines.
- the image inside the sprite already depicts a three dimensional object;
- the animation is constantly changing or depicts rotation;
- the depicted object has a similar appearance from many common viewing angles (such as something spherical);
- the viewer accepts that the depicted object only has one perspective (such as small plants or leaves).
- the sprite exists only briefly, is NotSolid, ... player cannot inspect it too closely.
- SPR file format...
- If using a texture that is intended to be transparent, be sure to close Hammer and restart it before compiling. Hammer likes to only half-load new sprite textures and won't display them as transparent.
- Sprite textures may also have any shade of gray (red, green, and blue values identical) interpreted as being transparent. Have not extensively tested, but it has worked in at least two cases (light_glow01 and a custom one).
- VTF: Vtex compile parameters "clamps", "clampt". note: env_sprite_oriented #angles ...
- VMT: Shaders_in_Sprites\
$spriteorientation Parameters for VMT
The number next to these types MUST be used instead for $spriteorientation when used in any shader other than Sprite[Clarify].
parallel_upright (0) ! fire1, fire2, fire, fireburst, flame01, flame03, flame04, floorfire4_, floorflame2, parallel_upright, physbeam
facing_upright (1)
- Invalid (?) Unused (?)
vp_parallel (2)
- This always faces the player.
! Most popular.
oriented (3)
- Oriented to the world (does not face player)
! flatframe, lamphalo1, lamphalo
vp_parallel_oriented (4)
- If the sprite entity is rotated, the sprite will match the rotation.
! plasma, smoke, steam1
E.G. of Stock HL2 Sprite
"Sprite"
{
"$spriteorientation" "vp_parallel"
"$spriteorigin" "[ 0.50 0.50 ]"
"$basetexture" "sprites/glow_test02"
"Proxies"
{
"lampbeam"
{
}
}
}
Reference: materials/sprites/glow_test02
E.G. of Custom Sprite
"Sprite"
{
"$basetexture" "sprites/turret_rebel"
"$spriteorientation" "vp_parallel"
"$spriteorigin" "[ 0.50 0.50 ]"
"$translucent" "1"
"$nocull" "1"
"$vertexcolor" "1"
"$vertexalpha" "1"
"%keywords" "turret .spr"
}
Download Reference: http://forum.tsgk.com/viewtopic.php?t=4699
- File Name Reference: gtamikes_custom_turrets_V3_Final.rar
- turret_rebel.vmt, turret_rebel.vtf
- turret_combine.vmt, turret_combine.vtf