after I've seen all the non lightmapped maps in FHSW I wondered why that is. So I did a little research and it's really simple (as stated by Mr_J) and definitely works with FHSW. See my first attempt here, someone who actually has an idea of Battlecraft/Photoshop etc. could create a better result of course. I did this completly without using ED42 or BC.
Before:
After:
Before:
After:
Doesn't that look a lot more pleasant and vivid?
I think I'll write a quick tutorial in the next days.
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
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. !!!
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.
Code
raytracer.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
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
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. 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
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
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
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.
I never tried mapmaking, as I stated in the OP I created the lightmaps without BC or ED42. I don't even have either of them installed. So I can't help you there sadly.
I think that many players, including me, would be very satisfied with the fix that finally repairs all these japanese maps. Moreover someone whu uses Twitter should let to know FHSW Devs about this thread.
(Endless_Nameless)
the resulting .tga files after the merging are always red.
Sounds like your program bakes the alpha chanell onto the ground texture. What program you use for merging?
@Mr_J: In the zipped version of FHSW there is a second objects.rfa in the folder "for modders" or something, could you please upload it for me? I somehow deleted it by accident. My Youtube Channel aka eYe.ris
Thanks, I was hoping it would solve another problem I encountered but it didn't work. Somehow it doesn't want to object lightmap objects from FHSW, only the FH and Vanilla ones.
€: Okay it's not FHSW related, it seems to be a general problem that some things can't be lightmapped. I can live with that though, since so far that have been mostly small objects like ammo crates. My Youtube Channel aka eYe.ris
@Stefan That would take a VERY long time, especially since it took eYe 3 DAYS to edit Fall of Singapore alone. However, if we all work together, it may possible. Good job eYe!
My hope is more that the devs do this, if you have everything set up it's such a simple task. You just let the PC do all the work, no creative thinking or anything required. There's really no excuse to not do it.
Fall of Singapore took so long because it's big and there are so many objects on that map, Suomussalmi was done in roughly two hours.
Maps without object and/or terrain lightmaps are (afaik):
Oh wow, Singapure looks so glamorous now. I think you must make that 'lightmap pack', there's no excuse to not to If you have 4 core processor you could process 4 maps at once, right?
Quote (Endless_Nameless)
Maps without object and/or terrain lightmaps are (afaik):
Air Raid Alert Kure Alaska Battle at River Don Battle of Iwo Jima (partially) Fall of Singapore Gazaps Hungary Forest (partially) Ilomantsi Kakazu Ridge Kushira Manchuria Moscow Outskirts Naichi Operation Coronet Kikusui Day2 Pakfront Suomussalmi