Xonotic Forums
[PoC, kind of][Grass] Can I borrow your lawn mower? - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10)
+--- Forum: Xonotic - Editing and Concept Art (https://forums.xonotic.org/forumdisplay.php?fid=11)
+--- Thread: [PoC, kind of][Grass] Can I borrow your lawn mower? (/showthread.php?tid=1346)



[PoC, kind of][Grass] Can I borrow your lawn mower? - sev - 12-15-2010

I was experimenting with LOD models, and what would they be more suitable for than a nice lawn?
Turns out they are not fit for this purpose, at least not several hundred models in one map.

HOWEVER, I was impressed how well DP (and q3map2) can handle the good old q3map_surfaceModel, with ultra-low-poly models.
And because there's no point in keeping it to myself, I put together a test map to share my little grass experiment:

[Image: Vho5uLgt.jpg][Image: pUZkI1Ct.jpg]
http://www.mediafire.com/file/jlz9nnzlt3bmuas/sev_grass.pk3 (6MB)
(~6250 grass models with 8 triangles = ~50'000 individual grass blades)

It's a bit over the top and not very refined, but makes me chuckle every time I see it.
It could easily be improved with more diverse plant models and some further experimenting.
In an actual map, one would obviously need to be very careful about how many of the models are rendered at any given time.


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - Minkovsky - 12-16-2010

Right. I'll try it after Christmas, as I'm getting a new video card (yay!).


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - rainerzufalldererste - 12-16-2010

*hugs sev

thank you! I'd love to see this grass in some maps *.*


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - Cortez666 - 12-16-2010

(12-16-2010, 02:16 PM)rainerzufalldererste Wrote: I'd love to see this grass in some maps *.*

Ons Reborn used that feature.


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - Lee_Stricklin - 12-18-2010

Looks closer to shards of glass Big Grin, still impressive though. I don't even think Crysis had that many models on screen at once.


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - unfa - 12-18-2010

Dude Big Grin I love grass! No! Not that grass! Regular grass!
And I miss foliage in DP badly Smile If this could run smoothly, then - your name shall always be seen in this grass Smile sev, the creator of grass Big Grin

Btw: Can't it be improved by using textures istead of models for every single leaf (?) of grass?
You could have planes with textures and that could maybe save a lot of DP's power... much less triangles IDK...


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - FruitieX - 12-18-2010

(12-18-2010, 04:46 AM)Lee_Stricklin Wrote: Looks closer to shards of glass Big Grin, still impressive though. I don't even think Crysis had that many models on screen at once.

Crysis probably counts their total on-screen models as multiples of 6250. Tongue


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - sev - 12-18-2010

(12-18-2010, 08:27 AM)unfa Wrote: Btw: Can't it be improved by using textures istead of models for every single leaf (?) of grass?
You could have planes with textures and that could maybe save a lot of DP's power... much less triangles IDK...

It highly depends on how it's done. It's often quite obvious and simply feels "cheap". There are also some other problems, like propper lighting of bigger texture surfaces (the models above are vertex lit).

I also have the experience that textures with an alpha channel are not necessarily performance friendly. (In Desert Factory v1r1, I replaced the alpha foliage and grates with actual models, without a performance loss)


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - _para - 12-18-2010

i really like this it will turn flat grass textures into a authentic grass landscape Big Grin

maybe it would be good to have a maximum view distance of the grass and the grass which is far away will become smaller and not just disappear


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - divVerent - 12-19-2010

I'd really like to see this grass used on an official map... unlike ons-reborn, this one actually looks good.


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - Cortez666 - 12-19-2010

i think in combination with the facility114 texture pack you can make a pretty sci fi biosphere or spacestation


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - CuBe0wL - 12-20-2010

To kill your GPU, just copy paste this into your data/scripts folder, and name is as grass.shader:

Code:
textures/skies/bluesky
{
    qer_editorimage env/bluesky/bluesky_up.tga

    surfaceparm sky
    surfaceparm nolightmap
    surfaceparm nodlight
    surfaceparm noimpact
    surfaceparm nomarks

    skyparms env/bluesky/bluesky - - //farbox cloudheight nearbox
    q3map_sunExt 1 0.96875 0.9375 320 55 50 0 16 //rgb intensity degrees elevation deviance samples
}

textures/grass/grass1
{
    qer_editorimage textures/grass/grass.tga

    surfaceparm nomarks
    q3map_surfaceModel models/grass/grass.obj 21 0.25 8 24 0 360 1
        //modelpath density odds minscale maxscale minangle maxangle oriented
        {
        map textures/grass/grass.tga
            }
    {
        map $lightmap
        rgbGen identity
        tcGen lightmap
        blendFunc filter
    }
}

textures/grass/grass2
{
    qer_editorimage textures/grass/grass.tga

    surfaceparm nomarks
    q3map_surfaceModel models/grass/grass.obj 19 0.5 8 24 0 360 1
        //modelpath density odds minscale maxscale minangle maxangle oriented
    
    {
        map textures/grass/grass.tga        
    }
    {
        map $lightmap
        rgbGen identity
        tcGen lightmap
        blendFunc filter
    }
}

models/grass/grass
{
    qer_editorimage models/grass/grass.tga

    surfaceparm trans
    surfaceparm nonsolid
    surfaceparm nomarks
    surfaceparm noimpact
    deformVertexes wave 75 sin 0 2 0.1 0.1
    cull none

    {
        map models/grass/grass.tga
    }
    {
        map $lightmap
        rgbGen identity
        tcGen lightmap
        blendFunc filter
    }
}



RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - theShadow - 01-27-2011

sorry to dig this up, but do you think sev or someone could write a full tutorial on how to set this up?


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - TRaK - 01-28-2011

You just need to add the q3map_surfacemodel parameter to your shader, then q3map2 will randomly spawn models anywhere you apply the texture.
http://www.robotrenegade.com/q3map2/docs/shader_manual/q3map-global-directives.html#q3map_surfaceModel

You should try applying a deformvertexes wave funciton to the grass, that would be schweet Tongue


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - CuBe0wL - 01-29-2011

I've posted a modified shader above with wave function. low.cfg gives 2-5 FPS Big Grin


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - GiffE - 04-14-2011

Sorry for bumping, but I would really hope we take a second look at this. It can give a REALLY realistic effect, and its just something that most modern engines are capable of doing. As I described on #darkplaces, foliage systems can mask a very simple terrain we are limited to using by the q3bsp. It allows for creating a much more visually impressive outdoor landscape. I can only imagine how good greatwall would look with the addition of 3d grass.

I changed the model to a 3-sided polygon with a dozen blades of grass on the one plane. Just like the above I used surfacemodel to place them about the map.
Code:
textures/grass/grass1
{
    qer_editorimage textures/ground/grassdead.jpg
    surfaceparm nomarks
    //modelpath density odds minscale maxscale minangle maxangle oriented
    q3map_surfaceModel models/plants/grass/grass.md3 20 0.25 0.5 2 0 360 1
    {
        map textures/ground/grassdead.jpg
    }
    {
        map $lightmap
        rgbGen identity
        tcGen lightmap
        blendFunc filter
    }
}
textures/plants/grass/grass1
{
    nomipmaps
    nopicmip
    surfaceparm nomarks
    surfaceparm pointlight
    surfaceparm trans
    surfaceparm nonsolid
    cull none
    {
        map models/plants/grass/grass01a.tga
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        alphaFunc GT0
        depthWrite
        rgbGen identity
    }
    {
        map $lightmap
        rgbGen identity
        tcGen lightmap
        blendFunc filter
    }
}
produces:
[Image: dp000001.jpg]
The problem is there is no way to cull and thin out the grass that is far away.
What I'd suggest is it possible to add this feature to the engine? Whats stopping us from adding a per-distance culled model which gets randomly placed about a given shader?
Why can't we have this shader keyword?:
Code:
dp_foliage modelpath density odds minscale maxscale minangle maxangle oriented distance-cull
This would remove the limitation on misc_models that surfacemodel has and load the models into the map at run-time.


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - FruitieX - 04-14-2011

(04-14-2011, 02:07 PM)GiffE Wrote: Sorry for bumping, but I would really hope we take a second look at this. It can give a REALLY realistic effect, and its just something that most modern engines are capable of doing. As I described on #darkplaces, foliage systems can mask a very simple terrain we are limited to using by the q3bsp. It allows for creating a much more visually impressive outdoor landscape. I can only imagine how good greatwall would look with the addition of 3d grass.

I changed the model to a 3-sided polygon with a dozen blades of grass on the one plane. Just like the above I used surfacemodel to place them about the map.
Code:
textures/grass/grass1
{
    qer_editorimage textures/ground/grassdead.jpg
    surfaceparm nomarks
    //modelpath density odds minscale maxscale minangle maxangle oriented
    q3map_surfaceModel models/plants/grass/grass.md3 20 0.25 0.5 2 0 360 1
    {
        map textures/ground/grassdead.jpg
    }
    {
        map $lightmap
        rgbGen identity
        tcGen lightmap
        blendFunc filter
    }
}
textures/plants/grass/grass1
{
    nomipmaps
    nopicmip
    surfaceparm nomarks
    surfaceparm pointlight
    surfaceparm trans
    surfaceparm nonsolid
    cull none
    {
        map models/plants/grass/grass01a.tga
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        alphaFunc GT0
        depthWrite
        rgbGen identity
    }
    {
        map $lightmap
        rgbGen identity
        tcGen lightmap
        blendFunc filter
    }
}
produces:
[Image: dp000001.jpg]
The problem is there is no way to cull and thin out the grass that is far away.
What I'd suggest is it possible to add this feature to the engine? Whats stopping us from adding a per-distance culled model which gets randomly placed about a given shader?
Why can't we have this shader keyword?:
Code:
dp_foliage modelpath density odds minscale maxscale minangle maxangle oriented distance-cull
This would remove the limitation on misc_models that surfacemodel has and load the models into the map at run-time.

Hmm, we can use LOD on misc_gamemodel already (see entities.def in the Xonotic gamepack for NetRadiant), I don't see why it couldn't be extended to this. Of course our LOD implementation lies in QuakeC afaik, and this would have to be an engine feature.


RE: [PoC, kind of][Grass] Can I borrow your lawn mower? - sev - 04-15-2011

(04-14-2011, 06:05 PM)FruitieX Wrote: Hmm, we can use LOD on misc_gamemodel already (see entities.def in the Xonotic gamepack for NetRadiant), I don't see why it couldn't be extended to this. Of course our LOD implementation lies in QuakeC afaik, and this would have to be an engine feature.

That would be nice if it's adapted for foliage.
In the current implementation though, that didn't work. Even a few 100 models make the map unplayable (crash; memory overflow ?).
Loading times are extremely long in any case.
And lights are less efficiently added as well, I guess. I got very poor performance with only a few dozen models.