Overgrowth Field Placement
Posted: 2009-08-26 16:54

For this Tutorial I will be using an updated version of Qwai River but you should use what ever map your working on.
For this tutorial you will need the following:
- the good old BF2 Editor
- Photoshop (I'm using version CS3) with the nVidia DDS plugins
- EditPad Lite (free) or anouther Text Editor that is capable of Multi-Line Search and Replace (S&R)
- A Map which is pretty much final. If there is any chance of the terrain drastically changing in areas where you have fields its worth putting this stage off until your terrain and map is more or less final.
- A decent PC since this process will be quite CPU and memory intensive at some stages.
Undergrowth and Overgrowth Files:
Since only the wildgrass fields where included in the last release you will need to download and install all the other types of fields and the custom undergrowth some field types have.
These files are protected by copyright and are only allowed for use in the Project Reality mod or a map that will be running on the Project Reality mod and only the Project Reality mod. If you wish to use them in anouther mod please seek permission from the Project Reality Team.
Download: http://realitymodfiles.com/rhino/statics/Fields.rar (Lasted Updated: 30/08/09)
Installation:
Extract Fields_Undergrowth.rar into:
...\EA GAMES\Battlefield 2\bf2editor\Content\Terrain\
Extract Fields_Vegetation.rar into:
...\EA GAMES\Battlefield 2\mods\pr_edit\
The Theory
Before we start it is important that you understand the basic theory behind these new Overgrowth Fields before you try to implement them otherwise you may end up with lots of floaters if you try to place these fields on terrain that isn't suited for them etc.
Basically what we are essentially going to be doing is repeating a small disk of what ever crop we are doing, all over a field area which since its a repeated mesh and texture it is much easier for BF2 to use and as such, shouldn't cause a huge performance drop and from testing we have found no to little performance impact from these fields.
Since we are placing a small disk of crop instead of a huge square 100x100m chunk of crop, it gives us quite a bit of flexibility in terms of what shape our fields are and also means we do not have to place field on terrain that is 100% flat, but the terrain still needs to be very smooth. If the Terrain is not smooth with any sudden change in height or any bumps here and here in the field it will cause the field patches to float. So you can have changes in height of terrain in your field, but you need to smooth it out so you have a nice gradual slope going upto the new height of terrain.
Here is some little diagrams I've drawn up to explain. The black base is the terrain and the green boxes with red outline is representing each clump of field and how they will behave on the terrain.
First we have terrain with sudden changes in height which leads to lots of floaters etc, this is what you need to try and avoid in your terrain where you want fields on.


So the main tip here is, smooth the **** out of the terrain you plan to put a field on before you even think about placing a field on it
Step 1: Setting up your Undergrowth
Before we can begin with placing your Overgrowth Fields, we first need some Undergrowth where your fields will be since the way we eventually get the Overgrowth Fields in relys off where the Undergrowth Fields are painted and that mixing in the Undergrowth with the Overgrowth fields helps fill in any gaps and also makes the field look much more full up close + you can add nice little details like rocks in on the ground
But before we worry about that we need to paint it. Now when painting your undergrowth down its not simply slapping down any undergrowth any where, any how. We need to think ahead here and plan what types of fields you want where. So first off lets crate a bunch of Undergrowth Materials, one for each type of field you want to have in your map and do not even think about trying to use one undergrowth material for two types of fields since it wont work. I would also advise that you name your undergrowth with the name of what type of field its used for, IE, if its a rice field name it something like "rice" or something, not "crop1". It will help later when having to browse though them all.
At the moment, these are the types of fields that are so far available for you to make but eventually there should be more in time. It isn't hard to make a new type the only hard bit is really getting a new texture for them since there model is fairly simple etc so if you really needed anouther type of field, it might be worth looking into.
- Rice
- Wild Grass (3 types)
- Corn - Maize (3 types)
-- corn_maize_clump_01
-- corn_maize_clump_02 - Small (2.5m radius instead of 5m) - Poppies (6 types, we recommend that you only use one type in your map)
-- Closed
-- Pink
-- Pink & Closed
-- Purple
-- Red
-- White - Wheat (new in v0.95)
For Qwai I'm just using the Rice and the Maize fields.
Now onto painting your undergrowth. First of all, you need to understand that each patch has a radius of 5 meters, as such, you want to leave a good 4 meter or 6 meter gap round the inside edge of your field when painting down your undergrowth since when the overgrowth is placed on it, the overgrowth will reach outside the edge of where your painting a little and if you have a ditch just on the edge of your field, this will make the overgrowth bits float or if you have a fence or something on the edge, it will look silly in most cases having the field growing though it
So you need to pick between a 4m or 6m gap. Basically if you want the overgrowth patches right upto the side of your field edge, go with a 4m but if you dont mind them going upto the side and would rather not have to deal with the hassle of cleaning up all the overgrowth after which may be caused by only leaving a 4m gap if the edges of your fields have ditches etc next to them, go with a 6 meter gap.
Also keep in mind, if your working on a scale two map, you have the choice between a 4m and 6m gap around your fields but if your working on a scale 4 map, you really only have the choice of a 4m gap, unless you want to go with an extreme 8m gap which IMO is far too much.
I'm going to use this field here for my example of how you need to paint your field which for me is a Maize field but the same rules apply to any type of overgrowth field since they all work more or less the same.




By the end all your fields should look something like this:


Step 2: Converting your Undergrowth to Overgrowth
Before you do anything more I would recommend backing up your entire map in a safe place encase you, the editor or photoshop screws up which is pretty likley.
Then once you have done that go into your map folder and backup your overgrowth folder by copy and pasting it then rename it to something like "overgrowth_normal". This is important since you will want to revert back to this after we have finished.


First things first, change both your Overgrowth.raw and your Undergrowth.raw to the "Indexed Colour" mode from default "Grayscale" mode.

Best way to do this is Select the entire canvas (Ctrl+A), choose black from your colour range (make sure its 100% black otherwise it wont work, ie, R:0, G:0, B:0) and then fill the entire canvas with that colour (Shift+F5). Now you should have an entire blank (black) sheet to work on.
Now switch to your Undergrowth.raw file and now we need to copy the fields we have painted onto the Undergrowth into the Overgrowth. First to make it easier for photoshop to select the fields and not select other fields etc which it sometimes dose, we need to adjust the image a little. Go to Image>Adjustments>Brightness and Contrast:

In the new window make sure you check the "Use Legacy" box in the bottom left then bump the brightness upto 100. This will then increase the brightness evenly over the image and not distort it which is what we want as the brightness will septate the different "channels" of undergrowth types making them easier for photoshop to select and for you to see them.

Once you have done that you need to now select your fields. Simplest way to do this is via the colour range selection tool, but what colours do you select? Well you can tell this by what channel each undergrowth has. When you crate a new undergrowth material you have a range of channels to select from which to most mappers all they care about is the pretty colours but its a little more in depth than that


Now all we need to do to select the fields back in photoshop is to select channels 1 and 4. Well how dose this transfer to photoshop? Quite simple really, to get channel 1 all we need to do is add 10 onto the front of w/e value so for Channel 1 it will be 101, which in RGB terms is a RGB value of 101, 101, 101 like so:




After you have done that for all your fields if you check your channels you should now see your selections you have saved:



Now in your Overgrowth.raw file, if you go back to your main Index channel as you will most likley have your last duplicated selection channel selected, then go into the layers and go Selection>Load Selection.



Once you have done that for all your channels, delete your saved selections out of your Overgrowth.raw file since if you try to save your Overgrowth.raw file with them it will screw up the save and your overgrowth will be screwed up.


Now all we need to do is save this up. Simply go File>Save and select the format "Photoshop Raw (*.RAW)" and save over the old Overgrowth.raw and then a options window should pop up that looks like this, if it looks different you most likley have the wrong format or something. If not just push ok. Another window should pop up after that asking are you sure you want to save it as this format since printer settings etc will get lost, just ignore it and click ok again.

Now if you reload your map and switch to render Overgrowth Mode for your terrain you should see all the areas of your fields and different colours for different types of field.

NOTE: - read though Step 4 BEFORE you continue with Step 3 as you may need to exit and reload the editor first, if you decide to remove your staticobjects outside of the editor (Dr Rank's tip!
Step 3: Placing the Overgrowth Fields
First things first, lets get rid of all the old overgrowth settings. Dont worry, you have these all backed up, twice if you followed my instructions early on
Go into the Terrain editor, Overgrowth tool and right click on each overgrowth material and remove them.

Crate a new Overgrowth Material for each type of field you have and for each one you need to give it the appropriate channel for each. So what ever field type you gave a RGB value of 1,1,1 for you need to select the dark blue box with "[1]" in the centre of it. If you gave the field type a RGB value of 2,2,2, it needs channel 2 which is the aqua blue box with "[2]" in the centre of it. The other simple way is just to render your terrain in overgrowth mode and look for what colours are where and match the colours with the correct material.


Now lets add the fields into our materials. I'm going to start with my rice so just going to right click on my material and click on add type. Then for its geom I'm going to select the rice_clump_01.

Once you have done that save your current settings as now bumping up the density will most likley make your editor crash.
After you have saved bump up the density settings on each to something between 300 and 100. The lower the density the better but keep it high enough to there are as few gaps as possible like so:

Step 4: Converting the Overgrowth to Static
First of all backup your staticobjects.con again, I've backed it up in the main qwai folder and renamed the backup to "StaticObjects_normal_24-8-09.con".
We now need to first delete everything out of it in the editor (or you can do it outside of the editor by just deleting its entire contents with a text editor if you want to reload the editor). Simplest way to do this inside the editor is to go into the layer bit, right click on the main layer and click "select all in layer". Once that's finished (will take a bit of time) delete all the objects and ensure there are no staticobjects in any of the other layers (some times they can find there way in).
Now this process aint strait forward and some of you might get this same error I do after lightmapping which disables your view which is a real pain in the *** since it makes the bit after it 100x harder so I can't give you any pics of that part but I'll try and explain it as best as possible.
After you have deleted all your staticobjects on your map, drag in a small simple object like a 1m crate and place it anywhere and lightmap it on low settings. Once its lightmapped, delete it. You should now be able to select your overgrowth. Select each type of overgrowth you have and then once you have selected it click the "select all of same type" once its finished selecting all your overgrowth you can now in the tweaker tab check the box "IsSaveable", and apply that to all selected objects.

NOTE: Before continuing I would advise reducing the overgrowth density for your field back down to 0 as it is no longer needed. This will help you avoid the editor crashing (Dr Rank's Tip Number 2!
Once that has finished it is now best that you crate a new layer called something like "fields" (if you dont know what layers are or how to crate them read this tut here).
When crating the layer since we are not going to be using this for GamePlayObjects (GPO) ie, vehicles spawns etc you can uncheck all the game modes and layer sizes.
Then with all your fields selected right click on the layer and click "Add to Layer". This will put all the fields in layer 5, this will overall make it easier to work with later on and help with coding these fields later to use the correct settings so it is important you add them to there own layer.

Once you have done all that save your objects then open up your staticobjects.con and check all your fields are in there and that they are not in layer 1 and in the layer number you put them in. It should look something like this:
Code: Select all
if v_arg1 == BF2Editor
console.allowMultipleFileLoad 0
[b]run /objects/vegitation/pr/fields/rice_clump_01/rice_clump_01.con
run /objects/vegitation/pr/fields/rice_clump_01/rice_clump_01_lod.con
run /objects/vegitation/pr/fields/corn/corn_maize_clump_01/corn_maize_clump_01.con
run /objects/vegitation/pr/fields/corn/corn_maize_clump_01/corn_maize_clump_01_lod.con
run /objects/vegitation/pr/fields/corn/corn_maize_clump_02/corn_maize_clump_02.con
run /objects/vegitation/pr/fields/corn/corn_maize_clump_02/corn_maize_clump_02_lod.con[/b]
console.allowMultipleFileLoad 1
endIf
[b]rem *** rice_clump_01 ***
Object.create rice_clump_01[/b]
Object.absolutePosition -597.286/28.593/-818.649
Object.rotation 166.5/0.0/0.0
[b]Object.layer 5[/b]
Object.isOvergrowth 1
rem *** rice_clump_01 ***
Object.create rice_clump_01
Object.absolutePosition -606.589/28.593/-811.783
Object.rotation 149.3/0.0/0.0
Object.layer 5
Object.isOvergrowth 1
rem *** rice_clump_01 ***
Object.create rice_clump_01
Object.absolutePosition -591.316/28.593/-800.753
Object.rotation 41.6/0.0/0.0
Object.layer 5
Object.isOvergrowth 1
etc.....Step 5: Cleaning Up
There is more than likley going to be a few floaters here and there depending on how your terrain is setup. On Qwai there is a load of terrain that can easily crate floaters so I really need to keep my eye open for them and do an entire scan of the map to find any. The best way to fix them is to clean them up by hand after you have converted them to static, which you should have done in the last step.
Now its best you just stick with your staticobjects.con that only has your overgrowth in it for now and we will get all your other statics like buildings etc back into your staticobjects.con later after we have fixed all the fields since its going to be hard enough for the editor to select the fields as there is going to be a huge amount in the editor and its hard for it to process. In Qwai I have 7,280 field clumps alone.
Anyways best way to find these floaters etc is to fly around the map and mainly look in areas with terrain that might cause them. Main thing your looking for is floaters like this that just come over the edge of the side of a field:



Just select the offenders in turn and fix them one by one, quite simple
But what your looking for is a nice clean finish by the end like so:

After the floaters the next item on the agenda is filling in any major gaps etc. There will most likley be lots of places where you dont think there is enough overgrowth there and as such, best to fill them in by hand.
Here is a good example of two fields that both could do with some filling in around the gaps and the lower field has a entire section mission field clumps.


Step 6: Finalizing
Once you have finished cleaning up all your fields and everything is good you can then get your fields ready to go ingame and getting all your statics and normal overgrowth back into your map
First Lets rename your current "StaticObjects.con" that contains your fields (and should contain only your fields) to "Fields.con" (without the quotes).


After that, open up your new "Fields.con" with EditPad Lite (free) or anouther Text Editor that is capable of Multi-Line Search and Replace (S&R) then once its open, go to Search>Show Search Panel (Ctrl+F):


First take note of what layer number you put your fields on, in my case its Layer 5 thou for you the number may be different and if it is you just need to enter what ever number in your search and replace your original layer was.
So for me, since my layer number is 5, I need to get EditPad to search for the following:
And then need to replace that with the following:Object.layer 5
Object.isOvergrowth 1
Like so:Object.layer 5



NOTE: If you edit your fields in the editor again the editor will add back the "Object.isOvergrowth 1" line to all your fields so if you do edit these fields after this in the editor, make sure you remove this line and before releasing your map check its removed.
Once you have finished doing that we need to make the "Init.con" load our new "Fields.con" file. To do this open up the "Init.con" with your favourite text editor (I'm going to use the Crimson Editor with custom BF2 Syntax files but you can use what ever you like including notepad or EditPad)
Now what we want to do is add in a line of code to load our new "Fields.con" right under this "run TriggerableTemplates.con" line here:

Like so:run Fields.con

Moving on, lets get our original "StaticObjects.con" and our Overgrowth back into the map. You should have backed up your original "StaticObjects.con" at the beginning of Step 4, if not also before. I backed mine up inside the main level folder by simply copying it then renaming it to "StaticObjects_normal_24-8-09.con" so all I need to do is rename it back to "StaticObjects.con" and its all good
Now onto your Overgrowth. First we should not get fully rid of your Overgrowth you used to make the fields. I like to backup everything encase its needed so lets rename our current "overgrowth" folder which should have your fields in it to "overgrowth_fields_backup". The "_backup" in the name will not only show you, the user its a backup but if you also use my map build script you can find here the "_backup" in the name will tell the build script not to pack this folder into any of the .zips which means you do not have to manually delete it out of there each time you pack your map
Then at the beginning of step 2 you should have backed up your normal overgrowth. I did by copying it then renaming the copy to "overgrowth_normal", so all I need to do is rename that folder back to "overgrowth" and I'm done.
Then that should be it!
Pack your map up and test it ingame (note: you may need to pack the fields into the mod)






I need to do a little more tweaking with the undergrowth etc but other than that its looking good!
I hope many of you have found this tutorial useful and hope to see these overgrowth fields in many more maps in the future!
Frequent Asked Questions & Answers
Q: Why do I need to paint the fields as undergrowth then use photoshop to make it undergrowth? Can't I paint it strait down as overgrowth to start off with?
A: Yes you can but I would advise you to paint it down as undergrowth to start off with, not only because it means less painting time (which when you get a hang of the photoshop process it only takes a few mins to do) but also because doing it via overgrowth can cause bad lag if your working with overgrowth in that material. If you want you can, there is nothing stopping you but if nothing else I hope I have shown you how you can use photoshop to edit undergrowth and overgrowth .raw files.
Q: Can I place down the overgrowth clumps by hand?
A: Yes you can thou doing so will overall take a lot of time and if you dont rotate each one your field may look too uniform and unrealistic where the overgrowth tool will put down everything very randomly which is what we want
Q: If I generate my terrain or object lightmaps with these fields in the editor, will they cast shadows onto my terrain or objects like the old overgrowth fileds?
A: No, these fields have a special setting in them which stops them casting shadows on lightmaps
Q: I want a field type that dose not currently exist, how can I get this new field type I want?
A: Best thing to do is make it yourself. If you can't make it yourself the only other option is to put in a request on the public forums with lots of refs and info on the type of field you want and hope someone will make it for you. We are all very busy so dont expect anything.
Q: Why dose the light on my fields look uneven with one half of the patches being dark/black and the other half really light?
A: This is due to your map's light settings for the overgrowth. Try making the TreeAmbientColour really light and make the TreeSunColour really dark and you should find it will help a lot.



