Jump to content
Official BF Editor Forums

Lightmap Tutorial For Beginners


Bensta

Recommended Posts

Lightmapping Tutorial for Beginners

Lightmaps are the shadows in your map cast from the sun direction, there are two types of lightmaps, Terrain lightmaps and Object lightmaps. First i suggest to render lightmaps when your map is totally finished and you are not going to change or add an object or shape the terrain, as they will need to be done again, (and final lightmapping takes a long time!). However painting terrain, or placing vehicles and flags can be done after.

Before Lightmap

omhbulig8.jpg

After Lightmaps

omhb4fr7.jpg

Important!

Object lightmaps need the 700mb lightmap samples downloaded from HERE and placed in dir' bellow, you can only generate object lightmaps for retail boxed bf2 objects, not sf/ef/2142 ect as there are no sample files for them. Only other option is to lightmap with 3dsmax if you have it.... http://bfeditor.org/forums/index.php?showtopic=7896

Place sample files here still zipped...

omhblmmmmkx6.jpg

First you need to set your sun direction to the sun in the sky. The best way if your using a normal bf2/bfsf..ect sky texture, is to just copy the sky.con from the BF map you want to use sky of, into your maps folder, then the sun direction will already be set. or you can do it by selecting "set sun direction to camera" or "set sun direction from camera" under the "light" tab in editor.

omhbslmb0.jpg

Then you need to set the lightmap settings found in tweakbar, now i could explain these all day...but im not going to as thats a tutorial inits self :P, but below are some good basic settings to get you started, you will need to experiment with these yourself.

omhbtmkf2.jpg

Right click to switch from object settings to terrain settings. Or just copy and pase code to "Your_Level/Editor/TerrainLight or objectlight.con" files

Terrain settings.

rem ******** Lightmap Generation Settings ********
if v_arg1 == BF2Editor

LightMapGeneration.init
LightMapGeneration.GILightsBaseDir 0/0.33/-0.66
LightMapGeneration.GILightsIntensity 0.33
LightMapGeneration.GILightsShadowIntensity 1
LightMapGeneration.GILightsFov 45
LightMapGeneration.UseGITopLight 1
LightMapGeneration.GITopLightIntensity 0.1
LightMapGeneration.GILightsViewDistance 10
LightMapGeneration.skyWhite 0.3
LightMapGeneration.numberOfGILights 8
LightMapGeneration.sunLightShadowIntensity 1
LightMapGeneration.sunLightFov 2
LightMapGeneration.sunLightIntensity 1

endIf

Object settings.

rem ******** Lightmap Generation Settings ********
if v_arg1 == BF2Editor

LightMapGeneration.init
LightMapGeneration.GILightsBaseDir 0/0.33/-0.66
LightMapGeneration.GILightsIntensity 0.33
LightMapGeneration.GILightsShadowIntensity 1
LightMapGeneration.GILightsFov 45
LightMapGeneration.UseGITopLight 1
LightMapGeneration.GITopLightIntensity 0.1
LightMapGeneration.GILightsViewDistance 10
LightMapGeneration.skyWhite 0.3
LightMapGeneration.numberOfGILights 8
LightMapGeneration.sunLightShadowIntensity 1
LightMapGeneration.sunLightFov 2
LightMapGeneration.sunLightIntensity 1

endIf

Now your ready to lightmap, open the lightmapping window, by selecting "Compile" tab at the top, then "lightmaps" , "Generate Lightmaps"

omhblmws4.jpg

omhblmsde5.jpg

Trace terrain - Render terrain lightmaps.

Trace objects - Render object lightmaps.

Trace selected - Render the objects lightmaps you have selected (Applys to objects only)

Only nearest - Renders the nearest terrain patch nearest the camera.

Primary - Renders all the primary terrain

Secondary - Renders surrounding terrain (If activated)

Low - low lightmaps (quick and crap looking)

Medium - Medium lightmaps (Not too bad looking and not too long to render)

High - High lightmaps (Best quality- and should be used for finished map, use others for testing purposes only during mapping).

Resume options - self explanitory, (and ive never used them, so cant comment)

Texture size - The compiled object lightmaps atlas texture size. (an atlas is basicly all the individual object lightmaps files compiled into only a few atlas textures files).

DXT format - Lightmap .dds file type (not for sure whats best, but i keep with dxt1)

Then "generate" and go sleep because final lightmaps will take hours and even day/s on very detailed maps and low end computers. ;)

Once done "generate lightmap atlas" if you have rendered object lightmaps.

Happy lightmapping :P

Bensta

Edited by Bensta-IDF
Link to comment
Share on other sites

havent done anything with the editor in the last time .. but im pretty sure that u can delete the generated lightmap files ( for the objects! ) and just keep the atlas.

think that way its done in vanilla maps

Edited by debconf
Link to comment
Share on other sites

Ohh yes, forgot that thanks, The editor woun't display the atlas lightmaps, only the lightmap files. The game will only display the atlas files, so keep the generated lightmap files some where safe ;)

Edited by Bensta-IDF
Link to comment
Share on other sites

One of the most important values is the 'GIFillIntensity'. Unfortunately this value is not saved in the two con files.

The higher the GIFillIntensity, the higher the indoor ambient light. Setting the Fill intensity to 0 leaves you with pitch black interiors. A good value for the Fill intensity seems to be around 0.6 up to 0.95, depending on the desired athmosphere and GI Lights intensity.

Keep in mind: Before rendering new object lightmaps, erase the old ones for this object in /Lightmaps/objects/

Link to comment
Share on other sites

Only a small sidenote for you guys using custom statics. The latest editor ( 0.1.237.0 ) accepts 4 lightmapsamples archives, so you're fine zipping up your samples into a 'lightmapssamples04.zip' file and add it to the other 3 (stock) archives.

Edited by mschoeldgen[Xww2]
Link to comment
Share on other sites

  • 11 months later...
  • 4 months later...
  • 1 year later...
  • 2 months later...
First you need to set your sun direction to the sun in the sky. The best way if your using a normal bf2/bfsf..ect sky texture, is to just copy the sky.con from the BF map you want to use sky of, into your maps folder, then the sun direction will already be set. or you can do it by selecting "set sun direction to camera" or "set sun direction from camera" under the "light" tab in editor.

After opening the sky.con file (I copied Operation_Harvest sky.con to my map) there are lines which i think calls for the a location outside of my maps directory. Am i to change this to something else?

Lightmanager.init
Lightmanager.skycolor 0.360784/0.396078/0.427451
Lightmanager.ambientcolor 0.682353/0.682353/0.682353
Lightmanager.sunColor 0.537255/0.513726/0.462745
Lightmanager.sunSpecColor 0.478431/0.458824/0.396078
if v_arg1 == BF2Editor
LightSettings.TerrainSunColor 0.37/0.35/0.30
LightSettings.TerrainSkyColor 0.58/0.65/0.67
LightmapSettings.waterSunIntensity 0.8
else
terrain.sunColor 0.37/0.35/0.30
terrain.GIColor 0.58/0.65/0.67
terrain.waterSunIntensity 0.8
endIf
Lightmanager.staticSunColor 0.38/0.37/0.29
Lightmanager.staticSpecularColor 0.36/0.36/0.33
Lightmanager.staticSkyColor 0.60/0.63/0.65
Lightmanager.singlePointColor 0.00/0.00/0.00
Lightmanager.sunDirection -0.209633/-0.6289/0.748691
Lightmanager.enableSun 1
Lightmanager.effectSunColor 0.47/0.47/0.41
Lightmanager.effectShadowColor 0.29/0.33/0.33
Lightmanager.defaultEffectLightAffectionFactor 1
Lightmanager.hemilerpbias 0.3
hemiMapManager.setBaseHemiMap Levels/OperationHarvest/groundhemi 0.000000/0.000000/0.000000 2048.000000 500.000000
Lightmanager.treeAmbientColor 0.34/0.35/0.24
Lightmanager.treeSunColor 0.24/0.32/0.24
Lightmanager.treeSkyColor 0.28/0.29/0.22

if v_arg1 == BF2Editor
else
run /Common/Sky/SkyDome/skydome.con
run /Common/Sky/Flare/flaresprite.con
endIf

Skydome.skyTemplate skydome
Skydome.cloudTemplate cloudlayer
Skydome.hasCloudLayer 1
Skydome.hasCloudLayer2 0
Skydome.scrolldirection -0.004/-0.004
Skydome.scrolldirection2 -0.002/-0.002
Skydome.cloudTexture common\textures\cloud\Cloud00_XP2
Skydome.cloudTexture2 common\textures\cloud\Cloud04
Skydome.skyTexture common\textures\sky\harvest_sky
Skydome.domeRotation -40
Skydome.fadeCloudsDistances 320/600
Skydome.cloudLerpFactors 0.6/0.5
Skydome.flareTexture common\textures\sunflare\Harvest_32bitglow.dds
Skydome.flareDirection -0.21/-0.53/0.25

Renderer.fogColor 127.00/134.00/133.00
Renderer.fogStartEndAndBase 20.00/470.00/1.60/0.60

OK, so messing around with the tweak i found that i can keep the sky animation the same as harvest, but i had to change the textures to get rid of Uncle Sam who plagued my skydome. It was a very easy process, so my question above is no longer needing answers. :)

Edited by gamer.supreme.1
Link to comment
Share on other sites

  • 1 month later...

Only a small sidenote for you guys using custom statics. The latest editor ( 0.1.237.0 ) accepts 4 lightmapsamples archives, so you're fine zipping up your samples into a 'lightmapssamples04.zip' file and add it to the other 3 (stock) archives.

Nice Tut !

But i seem to be having a problem still

I created a small map just to play around with and the editor did generate my lightmaps but for some reason it will not generate the lightmap atlas

I've went thru this tut 3 times and all i ever get from bf editor is

*** Generating atlas lightmaps for [levels/barricade/lightmaps/objects]... ***

*** Failed ***

The LightMapAtlas.tai is there but it's pretty much empty

# mods/bf2/levels/Barricade/lightmaps/objects/LightmapAtlas.tai
# 
# 
# <filename>		<atlas filename>, <atlas idx>, <woffset>, <hoffset>, <width>, <height>
# 
# Texture <filename> can be found in texture atlas <atlas filename>, i.e.,
# <group><idx>.dds with texture coordinates boundary given by:
#   A = ( <woffset>, <hoffset> )
#   B = ( <woffset> + <width>, <hoffset> + <height> )
# 
# where coordinates (0,0) and (1,1) of the original texture map correspond
# to coordinates A and B, respectively, in the texture atlas.

Thanks in advanced

Link to comment
Share on other sites

Well great ;) and what fixed it?

I was only generating the lightmaps for the terrian, once i created the lightmaps for the objects it created the lightmapatlas.tai which took the black out of the game but my terrain is screwed up, in the editor it looks like it's supposed to but in game it's kinda like its got a checkered board thing going on.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...