Page 1 of 8

Grass Node v0.3.x

Posted: Sun Jan 08, 2006 11:38 pm
by bitplane
update: Updated to work with Irrlicht 1.5

Image

The grass node creates grass for your terrain.. grass nodes should be created and destroyed by your seamless world, but the example uses a 10x10 grid of them.

demo here, or get the latest source from the irrExt svn repository (Irrlicht 1.5 compatible)

Re: Grass Node v0.1

Posted: Sun Jan 08, 2006 11:55 pm
by Other
That is really cool! Wow! nice work!!! :D

Posted: Mon Jan 09, 2006 12:01 am
by krama757
Most definately, the bomb :)

Posted: Mon Jan 09, 2006 1:25 am
by Guest
maybe you can add a rand() so that each gras "particle" is at a slight other size (or just other height) because it does not look very realistic when they all have the same size&orientation :)

but cool work !!

see you!

Posted: Mon Jan 09, 2006 1:27 am
by afecelis
yup! excellent work! :D also making it render a bit further away would make it look cooler. (I'm sure it's possible with the code you provide)


I would also like to have this node for my bald head, heheheheheh :wink:

Posted: Mon Jan 09, 2006 2:07 am
by sRc
afecelis wrote:I would also like to have this node for my bald head, heheheheheh :wink:
:lol: :lol:

i dont think Niko has added "Human Body" support to Irrlicht yet acefelis ;) :D

Posted: Mon Jan 09, 2006 2:47 am
by bitplane
thanks for the feedback guys :D
It needs 3 more things though to make it fully usable tho...
1) a new render mode/shader that does transparrent alpha channel and vertex alpha together
2) a daddy class that spawns and kills grass nodes as you walk around
3) an editor, or integration with an existing editor (hint hint, etcaptor ;))

I think the ultimate would be to join meshes together instead of using billboards, use irrSpintz hardware mesh buffers, and do wind and the fading with vertex shaders (hint hint, omar ;))

@gfx- they do have dimension2d for size, and it is randomized, but thats the problem. different plant types should be different sizes and stuff.. someone just needs to walk around with a lawnmower and a watering can (set grassnode->Partlicles[n].size and sprite) and make the place look nice, then call grassnode->Save().

@afecelis- i tried doubling the distance but the framerate drops a lot. next version will have user defined draw distance.. also if you gimme a heightmap and texture for your head, and a texture of one of your eyebrows I'll see what I can do :lol:

what kind of framerates are you guys getting?

Posted: Mon Jan 09, 2006 3:14 am
by genesisrage
im getting 100-120 fps
p4 2.8, 2gb ram, ati 9800xt 256mb

have an idea about the drawing distance... instead of having it show or not show at a specific distance, make it tapered... something like 0-100 units 100% of nodes, 100-120 80%, 120-140 60%, and so on... this might give it a more natural feeling.

Posted: Mon Jan 09, 2006 3:28 am
by Eternl Knight
One of the best implmentations of this type of thing I ever saw was by Croteam in Serious Sam 2. If I recall correctly, there were three things they did two things to make it work & look good.

Firstly they trimmed the amount of grass shown depending on the distance to the camera. That is, the further away from the camera - the less "grass particles" there were (and this was a linear progression).

Secondly, the particles were semi-randomly scattered & slightly oriented. This gave the grass a moe natural "wild" look than the standard "grass soldiers" look.

Finally, there were generally two types of grass which were mixed together. There tended to be a "common type" and an "uncommon" type mixed together at about 3:2 ratio. Again adding to the "natural look".

The trick to these methods I guess is making sure that the "semi-randomness" is constant (so that moving does not cause the grass to shift locations, orientation, etc).

--EK

Posted: Mon Jan 09, 2006 5:27 am
by bitplane
made a small update, use Z, X, C and V keys to adjust max distance and max density (you cant go past about 1300 per patch unless you regenerate)
the problem with creating them procedurally is getting the height from the terrain. if this was changed to read the heightmap instead of using a triangle selector, it might be feasable to generate patches on the fly in realtime. i might give this a try, but i really like the idea of lawnmowers and watering cans.
to get the same grass every time you just set the random seed the same: (pos.X * 1000 + pos.Z) or something
also i tried the falloff thing but didnt get it quite right yet.

Posted: Mon Jan 09, 2006 5:46 am
by Eternl Knight
Procedural Grass: Good point. Serious Sam only allowed the "grass type" effects on the "terrain" so I am assuming that this is what they did (i.e. height from height map image).

--EK

Posted: Mon Jan 09, 2006 6:33 am
by etcaptor
Awesome work bitplane! :shock:
Now Irrlicht scenes will get more realistic view. Keep your good work. I will include your node with your permission in VisualEditor. Also if you have any idea for creating of any tool especially for this node will try to help.

Posted: Mon Jan 09, 2006 8:01 am
by Xaron
bitplane wrote:1) a new render mode/shader that does transparrent alpha channel and vertex alpha together
Thank you bitplane! :) This looks really great!

I'll try to create such a material as I already did some investigation in that direction. ;)

Regards - Xaron

Posted: Mon Jan 09, 2006 8:21 am
by Emil_halim
good work. Thank you bitplane.

there is something wrong with the Rotation,when moving mouse to the left or to
the right the grass will rotate which means the grass is not fixed in the land.

any way it is really nice and one step for Irrlicht to be more realistic just
like the OGRE demos.

Posted: Mon Jan 09, 2006 12:42 pm
by bitplane
okay i changed it from billboards and added in a rotation. creation is now weighted between how far away and how important a blade is (how low its index is), and i added a camera frustrum bounding box check. i'm now getting the height for each blade using this code.. creation time is much faster - good enough for realtime, so loading is only an option now :)