Jump to content

Grass Sprites


Recommended Posts

I was creating a new grass texture/shader and realized that I didn't know how to change a few of the sprites' properties.  I want to know what determines sprite size (height of grass blades), and density (how many there are per brush).
 
Below is an example of one of my shaders.

 

 

 

textures/2_modernist/wildgrass
{
	q3map_normalimage	textures/2_modernist/grass_normal
	qer_editorimage textures/2_modernist/wildgrass
	q3map_material ShortGrass
	q3map_forceSunlight
	q3map_nonplanar
	q3map_shadeangle 120
	tessSize 2048
	{
		map $lightmap
	}
	{
		map textures/2_modernist/wildgrass
		blendFunc GL_DST_COLOR GL_ZERO
	}
	{
		map textures/2_modernist/grassprites2
		surfaceSprites vertical 15 10 20 250
		ssFademax 1600
		ssFadescale 1.0
		ssVariance 1 2
		ssWind 0.5
		alphaFunc GE192
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		depthWrite
		rgbGen vertex
	}
} 

 

 

 

This functions well in game, yet the grass is almost as tall as the player, and density is not very desirable.  I tried changing the ssFadescale value, but anything above 3000 lags.

 

The cause of lag is somewhat of a mystery to me, since my PC is able to run GTA V and SWtoR at maximum graphics without issues.

 

For those who haven't seen it, below is an image of SWtoR grass.

 

 

BtsAo.jpg

 

 

 

Finally, this is what I'm attempting to achieve with my grass shader.

 

 

ReachEpilogue.jpg

 

 

NumberWan likes this
Link to comment

@Asgarath83

I am afraid, the creature you speak of is the Dashade from Star Wars: The Old Republic, and that is the actual screenshot from this game. The second picture is likely from a different game.

 

But I am not unfamiliar with the shader @Vegeta mentions. I have a few examples back at home, but if you need these badly, try looking for the map with swoop bike trip. In the canyons a few shaders recreate grass growing in some areas. 

For the size, try changing these parameters: surfaceSprites vertical 15 10 20 250

Link to comment

@Asgarath83

I am afraid, the creature you speak of is the Dashade from Star Wars: The Old Republic, and that is the actual screenshot from this game. The second picture is likely from a different game.

 

But I am not unfamiliar with the shader @Vegeta mentions. I have a few examples back at home, but if you need these badly, try looking for the map with swoop bike trip. In the canyons a few shaders recreate grass growing in some areas. 

For the size, try changing these parameters: surfaceSprites vertical 15 10 20 250

A Dashade?? Oh, i understand. So no model :( ç_ç

thanks for istruction, grass sprites of default of yavin texture is not much good as visual >.< mmm i think i will edit the yavin grasssprites of game with quicktrip grassside + surfacesprites vertical .15 10 20 250 :)

Link to comment

Unfortunately you're not going to be able to get the same density of grass over such a large area and with good frame rate in JKA. It wasn't built to efficiently render that many things :/

 

True, unfortunately. But you can play with density and have quite a lot of grass and decrease it on the distance. I think a good mix is possible - likely not what you're trying to achieve, though.

Maybe having grass as an effect instead of sprite might help the framerate, after all effects also have a hide distance and shouldn't be (dynamically) as heavy as grass sprites.

 

Even though it's just a bunch of planes? How shit!

 

It's more than that, I think the wind effect that deforms them is one of the causes why the grass is so heavy.

It would be interesting to see if other types of surfaceSprite or zero wind affect the framerate as much as the "original".

Vegeta and Asgarath83 like this
Link to comment

Well you could just make grass MD3 models, and put them in with misc_model. Sure they won't deform, but still might be cheaper fps-wise.

for the sound that's need too a custom shortgrass material physic clip shader ... otherwise, place the model upon a grasssprite textured brushes. but i think short grass not need a solid clipper like a tree or a bush. :)

Vegeta likes this
Link to comment

@@Ramikad

 

That q3map_surfaceModel option seems as though it may work.  I have an idea.  Perhaps I could make a grass model that is a single surface with a grass sprite texture, then animate that texture in a shader to simulate wind.  I could then use that model in a texture shader that makes use of the surfaceModel option.  Unfortunately I foresee this method as causing more fps drop than before, due to the high amount of models that would be rendered, regardless of their simplicity.

 

Still, I feel as though there must be some kind of loophole that we could exploit in order to get more realistic grass in game.

Link to comment

@@mrwonko

 

Do you know of any OpenJK mods that include "trueview" in their source code?  I've never understood code very well, but I'm fairly confident that the set of .dlls that I'm currently using are what allow for "trueview."  It would be very nice to have a more efficient renderer, but at the same time I can't really afford to lose the nice camera effects in my current set of code.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...