Game Development Community

dev|Pro Game Development Curriculum

fxGrassReplicator v. 1.5

by Bendik Stang · 08/25/2003 (1:42 pm) · 35 comments

Download Code File

This new...update contains some minor fixes to the fxGrassReplicator.cc file
So if you already use the fxGrass, then all you need to do is to download the new version and (backup first) replace the old fxGrassReplicator.cc with the new.

To use 'level of detail' open one of the two .txt files and copy paste the contents into one of your mission files. One has bad image names and is great for tweaking the LOD. The correct image names can always be inserted afterwards as well as the colors.

For any problems please refer to the previous resource page where there are lots of answers to various problems.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3571

If you don't have the previous version then download it from the above link.

Enjoy !

:)
-Bendik

PS: Here is a large preview video of the grass:
720x568 - 32Mb - Xvid file

In the video I have 4 fxGrassReplicators covering a circular area of 300x300.
The 4 work as level of detail.
The closes with the highest amount of detail has 200 000 elements. (smallest elements - green)
The next has 50 000 elements
The third 20 000 (orange)
And the fourth 20 000 (The pink ones - longest and tallest elements)

It needs more tweaking as it all runs at 15-20 fps on a XP1700(not XP2700 as I first wrote) with a Radeon 8500.
Page «Previous 1 2
#1
08/26/2003 (1:16 am)
Great, thanks Bendik!
#2
08/26/2003 (1:46 am)
i see all the sample using one type of grass.
if we can use different types of grass and plants, like flower and grass togheter we must use different instance of the replicator?
(this can put down the performance a lot).
#3
08/26/2003 (2:21 am)
Andrea: hmm...do you want several textures....not sure if this will change the speed much.
I'll look into the difference.

-Bendik


Here is a larger preview image, showing a blend between two screenshots.
www.student.dtu.dk/~s958608/grasLODs.jpg
#4
08/26/2003 (2:50 am)
Bendik,

Nice work. :)

If you're going down the multiple textures route then I'd recommend either sorting the billboards according to texture or ( more preferably ) storing the different textures in a different data-set and rendering them in different passes to increase performance.

Also, being as you're not using aligned billboards, something that I wanted to add was vertex-arrays. You should get a considerable performance increase here, particularly if the colours don't change and the swaying is off.

- Melv.
#5
08/26/2003 (2:37 pm)
I presume you need a monster PC to handle this?
#6
08/27/2003 (12:03 am)
Hi Melv

I guess the next logical step would be to allow low rez LOD to be billboards...but then that is what you already have done with the fxFoilageReplicator!

I'm working on a little fern piece, wich will allow you to make clusters of fern leaves. These will not sway individually. I think I will draw them with vertex-arrays. But the grass, looks so cosy when changing colors and swaying a little. ;)

Mike:
The monster PC is an AMD XP1700+/512Mb/Radeon8500

Here is a combination of fxFoliageReplicator and fxGrassReplicator:
www.student.dtu.dk/~s958608/fieldsS.jpg
By using the square placement area and no random rotation you can create fields of crop as seen in the background.
#7
09/01/2003 (12:09 am)
Bendik,

Looks great!

I guess that it's finally a good time to release my new fxCombineHarvester. :)

- Melv.
#8
09/04/2003 (6:30 am)
Bendik

How its possible to make combinations with grassy and non grassy surfaces? I mean if yoo have a bigger grassy land, with limited amount of rocky surface where we dont need ANY grass. This new 1.5 release have any chance on it ?

I think thats would be nice if this grass could be paintable, like the "paint terrain texture", or similar method, but now with the 3d grass elements with the combination for example the fxFoliageReplicator and fxGrassReplicator, where the result is similar for your cool sample picture.

keeep up the nice work :)

Gabor
#9
09/07/2003 (9:36 am)
Simply ask Ken to update his twSurfaceReference Object--or try to do it yourself. :-)

-EricF
#10
09/08/2003 (12:15 am)
Melv: Will the fxCombineHarvester work with the fxDrunkenFarmerBot? If we could make it follow a painted line on the terrain with eg. twSurfaceReference then......ooohhh! Think of the posibilites!


...anyway
twSurfaceReference object work well with the xfGrass. Just include it, and start painting the terrain with grass!

That weat field on the picture is 'painted', btw.

:)
#11
10/15/2003 (8:34 am)
Help !!

There is no header (.h) file in the zip...

Where can I get it ?


And the previous version header does not fit with the cc file...
#12
11/23/2003 (5:22 pm)
In class fxGrassReplicator : public SceneObject (header)

add:
bool GetTerrainTextures(float,class Point3F &,unsigned char *);
to the public section.

and:
F32 mSurfaceExclusionMode;
U32 mTheSurface;

Under F32 mRotateAngle;



Dunno if its correct, but it seems to be.
#13
02/27/2004 (8:33 am)
Great resource! Together with the twsurface object this is really useful.
#14
03/10/2004 (4:55 am)
Hi all!
I have just installed fxGrassReplicator accordingly to the instructions, but can't get it to work (I have doublechecked that I have done everything as said and it compiles without problems).
When I select fxGrassReplicator in the World Editor Creator and type in a name nothing happens.. I don't get any bounding boxes and it doesn't show up in Missiongroup.
What am I doing wrong?
I hope someone can help me out
- Rasmus
#15
03/16/2004 (11:03 am)
Great resource, the only thing is that i can't get the grass to stop glowing during a night cycle. i turned off luminance and light in scripts and code and it won't turn off. The fxfoliage doesn't glow, i also have compared them both and cannot find anything that would be causing this. Can anyone help please. Thanks
#16
03/26/2004 (4:05 pm)
Rasmus: As this is a old resource and people might have forgotten abit about it, try to contact the author directly, I'm sure they will be happy to help you.

GarageGamer: Read the earlier resource.
#17
04/10/2004 (12:48 am)
Luke: Where exactely do i have to put your changes in the header? i tried but still i get compiler errors. The older fxGrass worked very well, i looks like i have problems with the newer one because the .h file does not fit with the .cc file and i seem to do something wrong. Could anyone please explain me (maybe a newbie step by step?) how you made it work? I would really appreciate the video file is so cool!
#18
04/23/2004 (10:25 am)
Reply to Rasmus. I had the same problem that you were having. I resolved it by making sure that in my C++ project the proper surface and grassreplicator files were being built. Once I was building the right files, everything fell into line.
#19
08/29/2004 (7:54 am)
I did what it says in the read me in the first version, but it's not showing up in the game menu?
#20
12/23/2004 (1:52 pm)
Bendik, can you explain a little bit about tmpSplit factor in the rendering?
I'm having a bit of trouble following the logic

in particular here...
// set an abitrar angle to the face
						float tmpSplitFactor =0;
						if (mFieldData.mIsRandom){
						 glRotatef(pGrassItem->rAngle, 0,0,1);
						 tmpSplitFactor = Height/2.0;
						}
						else {
						 glRotatef(mFieldData.mRotateAngle, 0,0,1);
						 tmpSplitFactor = Height/4.0;
						}

and here...
glVertex3f		(SwayOffsetX,SwayOffsetY-tmpSplitFactor,Height);
							glTexCoord2f	(RightTexPos,0);
							glVertex3f		(2*Width+SwayOffsetX,SwayOffsetY-tmpSplitFactor,Height + pGrassItem->Direction[2]);

							// Set Ground Blend.
							glColor4f(tmpColorBtm[0],tmpColorBtm[1],tmpColorBtm[2], ItemAlpha);
							// Draw bottom part of billboard.
							glTexCoord2f	(RightTexPos,1);
							glVertex3f		(2*Width,0 + tmpSplitFactor/5,+ pGrassItem->Direction[2]);
							glTexCoord2f	(LeftTexPos,1);
							glVertex3f		(0,0 + tmpSplitFactor/5,0);
I'd like to do some of the rendering performance improvements I did for fxfoliage here too, just need to grok it a little better. have to go run errands now though.
Page «Previous 1 2