OpenArena Message Boards

OpenArena Contributions => Graphics => Topic started by: Czestmyr on January 05, 2007, 12:19:24 PM



Title: Transparent shaders (grates, trees and such)
Post by: Czestmyr on January 05, 2007, 12:19:24 PM
Hi, I tried to create my own tree branch texture with a transparent shader. Here's the code:

Code:
textures/trees/vetev
{
qer_editorimage textures/trees/vetev.tga
surfaceparm nomarks
surfaceparm nonsolid
cull enable
{
map textures/trees/vetev.tga
depthWrite
alphaFunc GE128
}
{
map $lightmap
blendfunc subtract
tcGen lightmap
depthFunc equal
}
}

But there are a few issues:
* The shader has to be one-sided because if I disable culling, both sides share the same portion of the lightmap, which looks weird.
* The surfaceparm nonsolid and surfaceparm nomarks parameters don't seem to work
* I want the surface to occlude the sunlight and cast nice shadows, which it doesn't (view the attached picture)

Edit: The bushes in the attached picture consist of three crossing planes, which in turn consist of two 3x3 patch meshes, so that these planes are visible from both sides (as I said, using just one patch mesh and making the shader two-sided would look odd)


Title: Re: Transparent shaders (grates, trees and such)
Post by: dmn_clown on January 06, 2007, 06:47:49 AM
Those look good, at least with that lighting.  The only bad thing is that it is insanely difficult to do realistic vegetation in a video game.  I think the better route would be to do a playerclipped md3 model.

Even the commercial games can't seem to get vegetation to look right, an example would be Croteam's Serious Sam 2 which had awesome looking fields of wildflowers until you looked at it closely and realized that everything was an autosprite (in q3 shader terms). 


Title: Re: Transparent shaders (grates, trees and such)
Post by: fromhell on January 06, 2007, 02:11:32 PM
In speaking of vegetation, JKMakowka's tree models for q3a are under the GNU GPL, i haven't bothered committing them to the project yet