ENVmaps

Information and tutorials related to modding BF2.
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

ENVmaps

Post by Rhino »

I thought as i updated my tut on the BF2editor forums with all my new knowlage i would post it here aswell. I would suggest all mappers to read this even if they think they know all there is to know on this subject ;)

First before you start this Tutorial you should have crated a basic map and have generated you Lightmaps.


I've made this Tutorial by reading and trying to understand a few posts but by putting a load together i have finally got id and then thought i would make a detailed tutorial seeing that i could not find any :D


By Generating your Envmaps you will get water that will look like normal BF2 water which will reflect from any angle and reflections off objects in your map like Sniper Scopes, Car mirrios, water puddles, ect. It also shows the reflection of hills and the terrain around where u generate the envmap in the water 8)


1. Open your map in the Level Editor in the BF2 Editor.
Here is my map i made for this:
Image
Notice the Hotel in the left sunk in the water, there is a reason for that which we will go into later ;)


2. In the Resources box expand bf2>content>object>common>

Image

In the "common" folder you should see DefaultEvnMap

Note. If you are making a map in a mod the "content" folder will be under your mod name.



4. Now lets drag and drop the first DefaultEvnMap into your map like you would to any other object. It looks rather much like a white cube, with 1 side which is very white and the other sides a ligth gray. You MUST make sure its ABOVE the water / terrain or its going to look really horribal! The first ENVmap I allways use as the ENVmap for the water reflections. So you will want to place this ENVmap somewhere in the middle of your sea / river so that you will get the terrain around your sea/river reflecting off it. So place it wiseley. As my map has a big island in the middle, i can only really place it on 1 side of the island to get the reflections of it.

Image

Now after you have placed your first ENVmap, you will want to maybe, but you do not have to, place more ENVmaps around so that when ppl walk around with the M24, they will see the refelction of the ENVmap they are closeest too. So if you are in a city, and u have a ENVmap in that city, they will see a refelction of the city around them in there scope, if they move out into the desert, and you have a ENV map in the desert aswell, when they get close to that desert ENVmap, they will see the desert in there scope. If you do not put a desert ENVmap out there, and you still have the 1 inside the city, they will still see the city in there sniper scope even thou they are way out in the desert. This is not a huge detail but every small detail counts so you choose, ENVmap files are not that big ;)
So now lets place our other ENVmaps around, to show you want i mean about the sniper scope refelctions, im going to put 1 ENVmap ontop of my island, and anouther on the hotel way out in the see :D

ENVmap on the island:
Image

ENVmap on the Hotel:
Image

5. Now that we have the DefaultEvnMap in your map you can now generate them.

Go to the Compile>Envmaps>Generate Envmaps

Image

After u have clicked on Generate Envmaps you should see this bit of code in your output window which tells you it has compiled them.

Image



6. Now Save your map and quit the editor



7. Now go to your Levels Folder in EA GAMESBattlefield 2modsbf2Levels*YOUR MAP*

In there crate a folder called "water"

Now go into your "Envmaps" Folder and copy the file called "EnvMap0.dds" (which is the ENVmap you did for your water refelctions)
Paste that file in your water folder which you just crated.

Now Rename "EnvMap0.dds" TO "EnvMap.dds"



8. Your done, now you should have ENVmaps in your map now 8)


Here is what your map should look like:

what the water looks like before

Image


and what the water looks like After

Image


Also now i can show you what im on about with the sniper scope reflections in areas. The first pics is of the refelction i got when on the island:
Image
And the 2nd is of the pic i got when on the hotel roof.
Image
The pics aint grate as i didnt have fog and the outside terrain enabled which i would need to do to get my ENVmaps looking just right so bear thous things in mind when doing yours. Enable things like over and under growth and make sure its on detail texture mode and things like that to make them look as good as possible 8)

Hope this helps :D


(Last Updated: 18-7-06)

Dr Rank's Special Bonus Tip!!!!! :D

If you want your overgrowth to show up in your scope's etc, what you need to do is:

1 ) backup your map

2 ) load it up in the editor, sort out your envmap objects as Rhino has instructed above

3 ) When they're all ready to go, make sure you have run the lines "renderer" "minculldistance" "2000" and "staticmeshrenderer" "nolods" "1" in the console command, 3 boxes, usually top left, looks like this:

Image

Image

Image

4 ) Select one of your objects (choose something simple like a tirestack to save time.)

5 ) Go to lightmap, then choose the option's "lightmap selected" (deselect the object and terrain options if they're on), choose "Final" in the quality options, and then run the lightmaps

6 ) Once that lightmap has run your tree's will render in the editor in the same way they will when you set up to capture your 'perfect minimap' i.e. they will render accross the whole map for the editor. If you run your env's now it will include the overgrowth in your envmaps :D

7 ) Exit, then copy all your envmaps into your backed up version of your map, making sure you copy the "EnvMap0.dds" into the "water" folder of you backed up version as per above. Then delete/move the version you used to envmap into anther backup folder, and put your orginal backed up version that you copied your envmaps into back into your pr_edit/levels folder.

8 ) That version of the map will then have its envmaps with overgrowth included!! :D Now you can see all the pretty tree's etc in you scopes :mrgreen:

Hope that was a useful addition :D

( added 23/08/08 )

p.s. Dr Rank is l33t
Last edited by Dr Rank on 2008-08-23 21:03, edited 2 times in total.
Image
V3N0N_br
Posts: 592
Joined: 2005-08-14 16:12

Post by V3N0N_br »

Nice one rhino...
Really helps to have 1 post telling what a lot scattered posts would do, thanks :D
Image
matt.b
Retired PR Developer
Posts: 992
Joined: 2006-04-07 23:24

Post by matt.b »

thx for the info :thumbsup:

looking at the envmap folders for the bf2 maps, they've only got a single 768*128 cubemap texture, eg for sharqi it's an envmap rendered over the sea.

if you do multiple envmaps, do they all get packed into the single envmap0, or are they numbered envmap0, envmap1...?

also, what do you reckon the limit for these is (to save on texture load)?
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Post by Rhino »

'[R-DEV wrote:matt.b']thx for the info :thumbsup:

looking at the envmap folders for the bf2 maps, they've only got a single 768*128 cubemap texture, eg for sharqi it's an envmap rendered over the sea.

if you do multiple envmaps, do they all get packed into the single envmap0, or are they numbered envmap0, envmap1...?

also, what do you reckon the limit for these is (to save on texture load)?
if you look at muttrah, i have a load, in the ENVmap folder there is loads of them around the place. I dont know if there is a limmit, probaly is but mainly would be on map size. and its ye they are numbed like envmap0, envmap1, envmap2 ect.
Image
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Post by Rhino »

bump, can u stick it egg :)
Image
NikovK
Retired PR Developer
Posts: 1616
Joined: 2005-10-28 09:56

Problem on Hills of Hamgyong

Post by NikovK »

I'm having trouble on Hills of Hamgyong. I have three water planes on Hills of Hamgyong. The original is a small lake and I had its envmap cube sitting on top of it through most versions. This plane renders very well. My ocean also renders very well. But my two new water planes, both a foot above the rice fields (and one running under the other a large amount) are rendering sky blue with only a sunflare. The water needs to be nearly clear, like the lake's. I tried placing envmap cubes all over my map according to your tutorial, but my map then began to freeze up at 14% loaded. I am not sure if that is the case, or if it is because some sandbags were erroneously labed for the 64p game mode. If you've figured anything out for using the water planes, let me know.
Mapper of Road to Kyongan'Ni and Hills of Hamgyong;
Genius behind many Really Stupid Ideas, and some Decent Ones.

Image
IronTaxi
Retired PR Developer
Posts: 4925
Joined: 2006-05-31 12:56

Post by IronTaxi »

nice tut,,totally understand envmaps now thanks...
.:XDR:.FRIJJ
Retired PR Developer
Posts: 212
Joined: 2006-05-17 13:47

Post by .:XDR:.FRIJJ »

Nikcovk the water planes you have to run object lightmaps on them to make them look like water in-game. Envmaps are for enviromentle reflections only so you will see the terrain/object reflect in glass/water. This should sort it mate :)
NikovK
Retired PR Developer
Posts: 1616
Joined: 2005-10-28 09:56

Post by NikovK »

AH!
Mapper of Road to Kyongan'Ni and Hills of Hamgyong;
Genius behind many Really Stupid Ideas, and some Decent Ones.

Image
NikovK
Retired PR Developer
Posts: 1616
Joined: 2005-10-28 09:56

Post by NikovK »

Actually that might not have worked... I'll check again tomorrow.
Mapper of Road to Kyongan'Ni and Hills of Hamgyong;
Genius behind many Really Stupid Ideas, and some Decent Ones.

Image
.:XDR:.FRIJJ
Retired PR Developer
Posts: 212
Joined: 2006-05-17 13:47

Post by .:XDR:.FRIJJ »

hmmm... it should do mate, select the water plane in questions, run object lightmaps, then save, then in-game the water should look like your water in level. let us know how you get on :)
NikovK
Retired PR Developer
Posts: 1616
Joined: 2005-10-28 09:56

Post by NikovK »

Absolutely not working. Water has its lightmaps rendered, but still comes out as a blue texturless plane with a sunflare reflection.
Mapper of Road to Kyongan'Ni and Hills of Hamgyong;
Genius behind many Really Stupid Ideas, and some Decent Ones.

Image
Griffon2-6
Posts: 2487
Joined: 2006-05-26 04:21

Post by Griffon2-6 »

Did you set the water animation speed?
.:XDR:.FRIJJ
Retired PR Developer
Posts: 212
Joined: 2006-05-17 13:47

Post by .:XDR:.FRIJJ »

hmmm the water should be the same as the other water planes. Are these two custom water planes mate? If they are it could be an export issue
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Post by Rhino »

'[R-CON wrote:NikovK']Absolutely not working. Water has its lightmaps rendered, but still comes out as a blue texturless plane with a sunflare reflection.
try useing the water.con file from a stock map. If it dont work, try and do a trial and error of stuff till you find the prob :p
Image
NikovK
Retired PR Developer
Posts: 1616
Joined: 2005-10-28 09:56

Post by NikovK »

Solved by rendering lightmaps for the plane while it is mostly above ground.
Mapper of Road to Kyongan'Ni and Hills of Hamgyong;
Genius behind many Really Stupid Ideas, and some Decent Ones.

Image
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Post by Rhino »

ye the plane dose need lightmaps for it to work :p
Image
Deer
Posts: 1603
Joined: 2005-03-17 09:31

Post by Deer »

'[R-DEV wrote:Rhino']if you look at muttrah, i have a load, in the ENVmap folder there is loads of them around the place. I dont know if there is a limmit, probaly is but mainly would be on map size. and its ye they are numbed like envmap0, envmap1, envmap2 ect.

Hmm well here is what i did and noticed that there wasnt answer for that ? :

-Placed 51 envmaps around my map.
-Generated envmaps in the editor.
-Copy pasted all 51 envmap files from "Envmaps" to "Water" folder.
-Was starting to rename the first "envmap0.dds" to "envmap.dds" but then i noticed that how im supposed to rename the rest 50 envmap files??

All other maps "server.zip" has only one envmap.dds/envmap0.dds in water/envmap folder so what happened to all other files ?
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Post by Rhino »

you can only have 1 ENV map for your water, ENVmaps do much more than just do the refelection off the water, they do reflection on sniper scopes, like i showed you in the tut and that requires more than 1 ENV map in diffrent places, if you want that reflection to change with respects of which one you are nearest to.

if the same happened for the water, it would look really odd it flickering though lots of diffrent ENV maps, would look nuts.
Image
IronTaxi
Retired PR Developer
Posts: 4925
Joined: 2006-05-31 12:56

Post by IronTaxi »

50 enviornmaps!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

i have 3
Post Reply

Return to “Modding Tutorials”