custom grass sprites tutorial

indy

Newbie
Joined
Jul 27, 2004
Messages
102
Reaction score
0
Making custom grass for your terrain

First grab a copy of "detail.vbsp" from "/steamapps/yourprofile/half-life2/hl2"
drop it in your mods main folder.

Next grab a copy of "detailspites.vmf" and "detailsprites.vmt" from the materials.gcf
drop them in your mods "/materials/detail" folder.

the detail.vbsp file reads parts of the the detailspites.vmf and tells the engine which part to draw.

if you open the "detailsprites.vmf" in photoshop (plugin required) you will notice there are 9 boxes with pictures of different grass and bush sprites.
Each one of the boxes has a set of coordinates on it that can be used by the "detail.vbsp"

You can edit the "detailsprites.vmf" in photoshop and change the sprites.
Just remember that it uses an alpha chanel same as transperant textures.
After you create your sprites on the first layer, open the chanels tab and create a new one.
"BLACK = TRANSPERENT, WHITE = OPAQUE"
so you will want to paint white for the parts of your plant that shows, and the rest should remain black

Once you have your custom grass sprites done, and the .vmf is saved, open your "details.vbsp" file (use notepad) and you should see something like this

detail
{
grass01
{
"density" "600.0"

Group1
{
"alpha" "1.0"

Model1
{
"sprite" "0 0 128 128 512"
"spritesize" "0.5 0.0 40 50"
"spriterandomscale" "0.2"
"amount" "0.1"
"detailOrientation" "2"
}

}

Group2
{
"alpha" "0.5"
Model1
{
"sprite" "144 0 128 128 512"
"spritesize" "0.5 0.0 20 20"
"spriterandomscale" "0.2"
"amount" "0.6"
"detailOrientation" "2"
}
}
well not exactly like that but thats a custom one Ive made.
Heres an explanation of each part of the code.

First and most important is the "group name"
in this instance its called "grass01".
This is what allows your textures to to use sprites on em.
Simply open the .vmt file of your choice and add this line to enable sprites to render on it.(only "blend" textures can use multiple types).
"%detailtype" "detail_group_name"
or for instance, to enable the group "grass01" (the code i posted above), you would type "%detailtype" "grass01" in your vmt, and it would load the sprites listed in the coordinates along with the other variables such as:

"density"
Specifies how many points to randomly generate. Larger numbers will generate more detail props.

"amount"
The ratio of a detail relative to the others in the group. Value: 0.0 => 1.0

"alpha"
Determines which alpha to use for blended displacement surfaces. 0.5 would be between the two textures. Value:0.0 => 1.0

"sprite"
Specifies the sprite to use by selecting a region of detailsprites.vtf.
The first two numbers specify the (X, Y) coordinate of the upper left corner of the sprite as it lies within the detailsprite.vtf texture.
The next two numbers specify the width and height of the sprite.
The final number is the size of the detailsprite.vtf texture in pixels.

"spritesize"
The first two numbers specify the rotational center of the detail sprite in normalized coordinates: (0,0) specifies the lower left, and (1,1) specifies the upper right.
The final two numbers in the "spritesize" line indicate the width and height of the sprite in world units when it gets drawn (0.5, 0.0 usually suffice).

"spriterandomscale"
Specifies a random amount by which the sprite's size is scaled.

"detailOrientation"
0: Do not orient towards the player.
1: Always face the player.
2: Always face the player but rotate on the x and y axis only.
Heres an example of some custom grass i made for my mod
Project Fighter.
I find its beter to use it sparingly to keep fps low and overal asthetics crisp.
water_37000.jpg
 
Stick a link to this thread in the most relevant mapping forum sticky please :)
 
Back
Top