BF1942: [Tutorial] Lightmapping (m)
Tools you need:
a) WinRFA
b) BF1942_r.exe
c) IrfanView to batch convert .tga to .dds (keyboard shortcut B)
d) Samplesmaker 1.0
e) .tga to .dds converter
I packed them together here.: "Link missed"
Create these folders in your BF1942 root directory (..\EA GAMES\Battlefield 1942\):
A) bf1942\levels\MAPNAME\
B) ShadowWork\bf1942\levels\MAPNAME\
C) ShadowWork\bf1942\levels\MAPNAME\Textures\
D) standardmesh\
!!! To suppress all game engine related problems if you’re using Win7, I recommend to run all shortcuts with Win98/Me compatibility mode. !!!
Object Lightmapping
1) You need a .samples file of all the objects you want to lightmap on your map (mostly buildings). For each object you have to extract the corresponding .sm file which you find in the mod’s standardmesh.rfa. Since FHSW uses objects from BF1942, FH and FHSW the file can be in either of them as well as the map itself. So the easiest way is to simply extract all three standardmesh.rfa’s in the order BF1942->FH->FHSW, put them into one folder and overwrite everything if asked. You only need the .sm files, you can delete the .rs files.
Now put the samplesmaker.exe and samplesmakerall.bat from d) into the folder you extracted the .sm files. Then go to Start -> Run and enter cmd.exe, choose the drive where your .sm files are stored (or type in cd/ if it already is at the right drive), then type in these two lines:
Code:
cd \YOUR FOLDER\
samplesmakerall medium
Then the program should start generating .samples files, ignore any errors that come up. When the program is finished put all .samples in D).
!!! If your map uses custom objects you want to lightmap extract the .sm and, contrary to regular objects, also the .rs files! Create a .samples file of these as well and put all three files (.sm .rs .samples) into D). !!!
!!! If the samplesmaker doesn't create a .samples file (or the resulting shadows are messed up) it usually means that your object doesn't have a correct channel 3 UV map. It's really simple to create it with 3ds max but be aware that you have to replace the old object in the mod's standardmesh.rfa. Here's a quick tutorial on how to do it with 3ds max: click here !!!
2) Create an ObjectsLightmap.con via notepad in A) with the text below or just take it from another map. The most important lines here are the sun direction, copy/paste it from your map’s SkyAndSun.con (sky.sunLightDirectionVec). Also play around with shadow and light intensity to make it look natural, on a sunny day you want to have strong lights and shadows, if it's cloudy tone these down a bit.
Coderaytracer.init
raytracer.ambientIntensity 0.05
rem *** Can't say for sure what these two do. Modify at your own risk! ***
raytracer.blockSize 16
raytracer.sampleOffset 0.05
rem *** You should never have to change these settings ***
raytracer.OnlyNearest 0
raytracer.shadowsNearCamera -10.0
rem *** This first instance is best left at default settings. ***
rem *** But still update the light direction on this one too! ***
raytracer.light.create
rem **** Should be sun direction ***
raytracer.light.direction 0.826002/0.312193/-0.469316
raytracer.light.selfshadowing 1
raytracer.light.objectShadows 0
raytracer.light.shadowIntensity 1
raytracer.light.intensity 0.35
raytracer.light.softness 1.0
raytracer.light.fov 130
raytracer.light.viewDistance 200
raytracer.light.create
rem **** Should be sun direction ***
raytracer.light.direction 0.826002/0.312193/-0.469316
raytracer.light.selfshadowing 1
raytracer.light.objectShadows 1
rem *** This increases shadow intensity (darkness)***
raytracer.light.shadowIntensity 1
rem *** this increases intensity of light ***
raytracer.light.intensity 0.6
raytracer.light.softness 0.0
rem *** Reduce this to make shadow edges sharper ***
raytracer.light.fov 8
raytracer.light.viewDistance 500
raytracer.addIgnoreObject terrain
raytracer.addIgnoreObject track
raytracer.ambientIntensity 0.05
rem *** Can't say for sure what these two do. Modify at your own risk! ***
raytracer.blockSize 16
raytracer.sampleOffset 0.05
rem *** You should never have to change these settings ***
raytracer.OnlyNearest 0
raytracer.shadowsNearCamera -10.0
rem *** This first instance is best left at default settings. ***
rem *** But still update the light direction on this one too! ***
raytracer.light.create
rem **** Should be sun direction ***
raytracer.light.direction 0.826002/0.312193/-0.469316
raytracer.light.selfshadowing 1
raytracer.light.objectShadows 0
raytracer.light.shadowIntensity 1
raytracer.light.intensity 0.35
raytracer.light.softness 1.0
raytracer.light.fov 130
raytracer.light.viewDistance 200
raytracer.light.create
rem **** Should be sun direction ***
raytracer.light.direction 0.826002/0.312193/-0.469316
raytracer.light.selfshadowing 1
raytracer.light.objectShadows 1
rem *** This increases shadow intensity (darkness)***
raytracer.light.shadowIntensity 1
rem *** this increases intensity of light ***
raytracer.light.intensity 0.6
raytracer.light.softness 0.0
rem *** Reduce this to make shadow edges sharper ***
raytracer.light.fov 8
raytracer.light.viewDistance 500
raytracer.addIgnoreObject terrain
raytracer.addIgnoreObject track
3) You don’t want to lightmap every tree or stone because that would take veeery long and also increase the file size of the map too much. So delete all the unwanted .samples files in D). It's a tedious process but you only have to do it once then you're set for all maps to come.
4) Create a shortcut of b) or your BF1942.exe and add the following line to the target
Code:
+game FHSW +workingFolder "ShadowWork\" +traceObjectShadows "bf1942\levels\MAPNAME\"
5) Click on the shortcut. Some errors might occur, if they are unrelated to lightmapping (e. g. missing sound files) you can just click retry to ignore them. Depending on the number of objects the lightmapping process may take some time, when it’s finished you should see a new folder called ObjectLightmaps in B).
6) Drag this folder into your map’s root. You also need a Palette.pal file there which you can copy from another map that has Object Lightmaps. This file defines the brightness and fading of your shadows. Because of that it’s best to use a Palette from a map that looks similar to the one you are working on, don’t use a desert Palette on a snow map. You can also create/edit this file by yourself via Photoshop, here’s a very quick tutorial: click here
The Palette.pal really defines the mood one your map and you should play around with it for the best possible result.
Terrain Lightmapping
1) Extract all the textures stored in the folder Textures from your map with the help of a). Batch convert these .dds files to .tga’s via c) and put them into C).
!!! If your map uses custom objects you have to extract the .sm files and put them into D) otherwise these won't cast any shadows on your terrain! !!!
2) Create a TerrainLightmap.con via notepad in A) with the text below or just take it from another map. The most important line here is the sun direction, copy/paste it from your map’s SkyAndSun.con (sky.sunLightDirectionVec).
Code
rem
rem ******** Example of a terrain shadow creation script.
rem
GeometryTemplate.setActive patchGeometry
rem *** 4.0 is 4 pixels per meter.
GeometryTemplate.shadowPrecision 4
raytracer.init
raytracer.ambientIntensity 0.3
raytracer.blockSize 16
rem *** 1 == Trace only the nearest terrain patch.
rem *** 0 == Trace all patches.
raytracer.OnlyNearest 0
rem *** < 0, trace all pixels
rem *** Else, number of meters from moving free camera to trace the shadows. Preview tool.
raytracer.shadowsNearCamera -10.0
raytracer.light.create
rem **** Should be sun direction ***
raytracer.light.direction 0.628000/0.661000/-0.410000
raytracer.light.selfshadowing 1
raytracer.light.objectShadows 1
raytracer.light.shadowIntensity 1
raytracer.light.intensity 1
raytracer.light.fov 2
raytracer.light.viewDistance 500
raytracer.light.softness 0.0
raytracer.light.create
raytracer.light.direction 0/1/0
raytracer.light.selfshadowing 0
raytracer.light.objectShadows 1
raytracer.light.shadowIntensity 0.8
raytracer.light.intensity 0
raytracer.light.fov 45
raytracer.light.viewDistance 20
raytracer.light.softness 0.0
rem ******** Example of a terrain shadow creation script.
rem
GeometryTemplate.setActive patchGeometry
rem *** 4.0 is 4 pixels per meter.
GeometryTemplate.shadowPrecision 4
raytracer.init
raytracer.ambientIntensity 0.3
raytracer.blockSize 16
rem *** 1 == Trace only the nearest terrain patch.
rem *** 0 == Trace all patches.
raytracer.OnlyNearest 0
rem *** < 0, trace all pixels
rem *** Else, number of meters from moving free camera to trace the shadows. Preview tool.
raytracer.shadowsNearCamera -10.0
raytracer.light.create
rem **** Should be sun direction ***
raytracer.light.direction 0.628000/0.661000/-0.410000
raytracer.light.selfshadowing 1
raytracer.light.objectShadows 1
raytracer.light.shadowIntensity 1
raytracer.light.intensity 1
raytracer.light.fov 2
raytracer.light.viewDistance 500
raytracer.light.softness 0.0
raytracer.light.create
raytracer.light.direction 0/1/0
raytracer.light.selfshadowing 0
raytracer.light.objectShadows 1
raytracer.light.shadowIntensity 0.8
raytracer.light.intensity 0
raytracer.light.fov 45
raytracer.light.viewDistance 20
raytracer.light.softness 0.0
3) Create a shortcut of b) or your BF1942.exe and add the following line to the target Code
Code
+game FHSW +workingFolder "ShadowWork\" +traceTerrainShadows "bf1942\levels\MAPNAME\" "ShadowWork\bf1942\levels\MAPNAME\textures"
4)
Click on the shortcut. Some errors might occur, if they are unrelated
to lightmapping (e. g. missing sound files) you can just click retry to
ignore them. Depending on the size of the map the lightmapping process
may take some time, when it’s finished you should see for each of your
textures a new file with the ending _lgt in C). These are your created shadows for the map.
5) Now you have to merge the textures and shadows. For this the first thing you want to do is to put a TerrainPalette.pal into C). Similar to the Palette.pal for object lightmapping you can extract it from an existing map and also edit it with Photoshop. This file really defines the mood one your map and you should play around with it for the best possible result. Then create another shortcut of b) or your BF1942.exe and add the following line to the target
5) Now you have to merge the textures and shadows. For this the first thing you want to do is to put a TerrainPalette.pal into C). Similar to the Palette.pal for object lightmapping you can extract it from an existing map and also edit it with Photoshop. This file really defines the mood one your map and you should play around with it for the best possible result. Then create another shortcut of b) or your BF1942.exe and add the following line to the target
Code
+game FHSW +workingFolder "ShadowWork\" +mergeTerrainShadows "bf1942\levels\MAPNAME\ 1.5 0.4"
6) Again click on the shortcut, the merging should actually take only a few seconds. After it’s done there appears a new folder Merged in C) which contains your merged textures. Now you have to convert these back to .dds files, use e) for this.
7) Put these files into your map’s Textures folder and overwrite your old textures.
Autor Endless Nameless
Source: fhsw-europe.com + bfmods.com
Keine Kommentare:
Kommentar veröffentlichen