Grass sprites generated on a texture? -1 reply

Please wait...

xode

The Internet ends at GF

50 XP

16th August 2008

0 Uploads

136 Posts

0 Threads

#1 9 years ago

What is the necessary line on a shader to generate grass sprites across the surface? I've looked into it, using various 'clampmap' and 'map lines and copied stuff from Raven shaders, but either it doesn't work, or the sprite is generated flat across the surface, rather than sticking up as a sprite. When entering the parms (I think this is what they are) for the 'clampmap' line, I used 'flattened' for the sprite type. If I had to guess, this would make it flat which is what I don't want and what happened occasionally when I tried. However, in the t2_trip level, there are grass sprites, and 'flattened' is used in the quicktrip.shader. Any shader experts help me out?




lassev

Degenerate scripter

50 XP

21st June 2004

0 Uploads

847 Posts

0 Threads

#2 9 years ago

Basically you just need an extra stage for a shader, nothing more. The key is "surfaceSprites vertical" line, and the accompanying other commands and attributes. You'll find them in Raven's shaders easily enough.

However, if memory serves, somebody mentioned it won't work if the shader is lightmapped. I tried to add it directly to one of my terrain shaders and it never rendered, so I made a nodraw type auxiliarity shader and added the stages to that, and it worked no problem immediately. Though that meant adding clones of terrain brushes in the level, textured with that null shader (except for the sprites).

Anyway, this is what my shader looks line, if somebody's interested (it's somewhat redundant, so it's probably best to only have a look at it, not use it as such): textures/punk_ter/heinakoe { qer_editorimage textures/system/nodraw_grass // q3map_material ShortGrass // cull twosided surfaceparm nomarks // surfaceparm nodraw surfaceparm nonsolid surfaceparm nonopaque surfaceparm trans q3map_nolightmap { map textures/system/nodraw blendFunc GL_ZERO GL_ONE } { map gfx/sprites/kuivaheina3 surfaceSprites vertical 18 18 86 800 ssFademax 1600 ssFadescale 1 ssVariance 1 1 ssWind 0.7 alphaFunc GE192 blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA depthWrite rgbGen vertex } { map gfx/sprites/rakuuna surfaceSprites vertical 18 18 120 800 ssFademax 1600 ssFadescale 1 ssVariance 1 1 ssWind 0.7 alphaFunc GE192 blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA depthWrite rgbGen vertex } }




xode

The Internet ends at GF

50 XP

16th August 2008

0 Uploads

136 Posts

0 Threads

#3 9 years ago

Thanks lassev