Grass variables

Learn more on how to use Sandbox, or submit your own tutorials or resources.
User avatar
Captain_Ahab
Member
Member
Posts: 98
Joined: June 10th, 2009, 5:12 pm
Name: Richard

Grass variables

Postby Captain_Ahab » October 19th, 2011, 8:22 pm

I thought I'd get back into the game by taking a good look at grass.

There are several variables which affect the way grass looks in the game and some of these variables can help with frame-rate issues; the fewer alpha planes the game has to render, the faster it can go and the higher the frame-rate. This can help with lower-spec machines.

in the following list, the numbers in the parenthesis represent the lower limit, the default value, and the upper limit for the values used.

grass (0,1,1) turns the fx on and off

grassdist (0,256,10000) gives the distance from the player in which the grass is rendered. Beyond this distance, grass is not rendered saving the engine from drawing so many alpha-masked planes. In general, the lower the number of alpha planes drawn, the higher the frame-rate. With normal player eye-height, a large value won't be that noticeable unless you're looking up the side of a hill or down into a valley. This is less noticeable if the base texture is about the same color as the grass.png being used in the autograss command.

grasstaper (0, .2, 1) provides a rate of taper between the player's location and the edge of the area determined by grassdist. If the value of 1 is used, the grass does not taper at all and just 'stops' at the grassdist distance. By tapering the grass, the transition between areas of rendered grass and plain ground textures are less obvious. As a floating point value, it appears to be a the fraction of the grass plane that is showing at the grassdist.

grassstep (.5, 2, 8) determines how 'thick' the grass is. That is, how closely the grass planes are spaced apart. Lower numbers here cause the grass to be denser and higher numbers cause the grass to become more sparse. By using higher values, you can have the grass effect, but because fewer planes need be drawn, the framerate doesn't suffer as much. It is a floating point value.

grassheight (1, 4, 64) is how tall the grass planes are. They greater the value, the taller the grass becomes. It becomes easy to make grass so high that its like running through a wheatfield or corn maze.

grassscale (1, 2, 64) is the number of times that the grass.png is drawn on the alpha plane. High numbers will cause the graphic to be drawn many times causing the graphic to be 'squished' and the grass to be very thin...like strands of spaghetti.

grasscolour ( 255, 255, 255 ) this causes the grass.png graphic to be tinted. This should normally be left as 255,255,255 ( white ) and let the colors of the graphic show cleanly. This would allow a nice contrast between different grass colors used with different textures.

grassalpha ( 0, 1, 1) is the transparency of the grass.png graphic on the plane. '0' is completely transparent and '1' is completely solid with numbers in between making the grass translucent or see-through. For example, .5 would make the grass 50% transparent. This is a floating point value.

grassanimmillis ( 0, 3000, 60000) This controls the speed at which the grass waves. It is the time, in milliseconds, that it takes for the grass to wave to-and-fro one time. Lower numbers make the grass wave back-and-forth faster and higher numbers make the grass wave more slowly. With extremely low values, the grass will wave so fast as to effectively blur like a tuning fork.

grassanimscale (0, .03, 1) this gives the amount that the grass will wave. '0' will cause the grass to remain stationary and low values will make the grass move barely at all. High values will make the grass wave a greater amount. This is a floating point value and this variable works closely with the grassanimmillis value to make the grass be as wild/wind-blown or as calm/still as you like without changing the floatspeed or any other part of the game.

These are all global variables and effect all grass rendered.

I encourage everyone to change these values in-game, using the command inputs and see how they work.
It can help make grass look like something other than a mowed lawn and can even help boost framerate without taking too much detail away.

next, I have to make weed and flower and clover .png's and autograss textures to use with texture blending and see about making patches of flowers and weeds to break up the golf course quality of the ordinary grassy landscapes.
Image

User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: Grass variables

Postby kddekadenz » October 20th, 2011, 2:57 am

Thank you for this helpful list ;)
Kelgar is an advanced RPG beeing developed in Sandbox

chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Grass variables

Postby chocolatepie33 » October 20th, 2011, 7:54 pm

man, I was wondering what happened to all the grass commands. I used to love making HUGE fields of grass, taller than the player... a jungle. THANK YOU SO MUCH! :D :D :D
Julius wrote:Contribute to http://www.opengameart.org NOW!

Save the wiki!

justanother1
Member
Member
Posts: 37
Joined: October 9th, 2011, 3:18 pm
Name: Joe

Re: Grass variables

Postby justanother1 » November 9th, 2011, 7:58 pm

Can I Not have grass as the Default texture. Say I want to build a Spaceship, or Snow, How can I change the Default ?

User avatar
BlackGulf
Member
Member
Posts: 127
Joined: August 28th, 2011, 5:07 pm
Name: Trevor
IRC Username: BlackGulf
Location: Stalkin' Your Mom
Contact:

Re: Grass variables

Postby BlackGulf » November 10th, 2011, 9:19 pm

edit defaultmapsettings.cgf then look for the texture near the top of the line of code and find the texture named "aardograss" texture or something like that. and take the code for the texture you want to use and paste it above the "aardograss" texture.
Image

Current Project
The Adventures Of NotaPig

Models Image
Maps Image
Coding Image
Textures Image
Music and SFX Image

In Need Of Staff.

User avatar
Captain_Ahab
Member
Member
Posts: 98
Joined: June 10th, 2009, 5:12 pm
Name: Richard

Re: Grass variables

Postby Captain_Ahab » November 12th, 2011, 6:13 pm

yep
As I recall, the first texture slots are the default textures for the top, each side, and the bottom of the default cubes.
I plan on making a 'mapping' .cfg that sets them to dev-textures with slightly different colors for each side, so that I can see what side is visible after moving corners around.
Image


Return to “Tutorials and Resources”

Who is online

Users browsing this forum: No registered users and 1 guest