Lightmapping a non-vanilla map in Battlecraft 1942?

Ask questions, discuss ideas, get answers
Skull Kid
Posts: 173
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Lightmapping a non-vanilla map in Battlecraft 1942?

Post by Skull Kid »

I have seemigly tried everything. I cannot get Battlecraft 1942 to lightmap or generate shadows on my own map "The Hill". It won't show any shadows in Battlecraft 1942 or in-game either. Any clues why this occurs?

Thanks in advance to anyone for help!
Regards,

Skull Kid
duffman
Posts: 55
Joined: Tue Apr 15, 2014 8:02 am

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by duffman »

Every object that you want to cast a "shadow" needs to have a ".samples" file in:
C:\Program Files (x86)\EA GAMES\Battlefield 1942\StandardMesh\
or
C:\Program Files\EA GAMES\Battlefield 1942\StandardMesh\

And ofcoz the model should be in there as well.
Example:
afr_house1_ste_closed_m1.rs
afr_house1_ste_closed_m1.sm
afr_house1_ste_closed_m1.samples

The models needs to be "properly" done, but thats a different topic...

Assuming you are using bf1942, or bf1942_r to do raytracing, these files contain the parameters
for your map, default is probably fine, stuffing them up not so much..
terrainLightmap.con
objectsLightmap.con

But without the .samples files you dont get any shadows at at all..

Learn more about samplesmaker here:
http://www.cajunwolf.com/dev/sampmaker.php

When you do generate object or terrain shadows do you see a "console" doing some sort of processing, if you do then the problem is one of the above, if you see nothing at all or it seems to "crash" or start then quickly go away then you have different issue...
Skull Kid
Posts: 173
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by Skull Kid »

Yes, I do see a console window coming up when trying to generate shadows for my map, but once it is done, and then merges the shadows, I see no change on the actual map.

I also used the SamplesMaker by CoinCoin to generate shadows for the wanted objects to cast shadows, but no difference in Battlecraft 1942, despite lying in the Battlefield 1942 root folder, under StandardMesh.
Regards,

Skull Kid
duffman
Posts: 55
Joined: Tue Apr 15, 2014 8:02 am

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by duffman »

yea that sounds a bit weird.

Check the folders under:
C:\Program Files (x86)\EA GAMES\Battlefield 1942\ShadowWork\bf1942\levels\YOUR_MAP

\ObjectLightmaps
Contains lightmap for each object in the map that was rendered and would/should
be added to RFA file.

and

\textures
Should contain your terrain textures unmerged, and the pure lightmapped as _lgt.tga files.

\textures\Merged
Contains the merged version of the 2 above and in dds format. These are the files that
should/would be added to the RFA file.

BC42 should add those files automatically to the RFA. But sounds to me like you need to check
there if there is something wrong with some of the files or missing etc. You should be able to
spot if some of the lightmaps are completely white/black etc.

At least should help you to pin point where the problem might be...
Skull Kid
Posts: 173
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by Skull Kid »

About the objects lightmaps, I'm not getting any object lightmaps when trying to generate them with Battlecraft 1942. It simply pops up a black "console" window with BF1942.exe and then crashes Battlecraft 1942. But generating shadows doesn't make Battlecraft 1942 crash, but doesn't show the shadows.

Anyway, the _lgt.tga is all white. Could this be the problem? I don't even have a merged folder in the map's .rfa archive.

EDIT: It seems that the Battlefield 1942 executable does indeed make the _lgt.tga files show like they should, but not Battlecraft 1942. Wonder why... :?
Regards,

Skull Kid
duffman
Posts: 55
Joined: Tue Apr 15, 2014 8:02 am

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by duffman »

Battlecraft doesnt actually do the raytracing aka shadows/light, it actually executes a shell command to battlefield to do the job.

When you select generate terrain shadows in battlefield and you select which "boxes" (surface area) to render it actually
just saves that into the textures/lmlist.dat as binary number which battlefield uses as a list of boxes to render.

Then it executes bf1942 with arguments to do the job, and thats the black screen that comes up..

Both the bf1942.exe and the debug executable bf1942_r.exe can be used to do the rendering.
I do all the rendering from batch scripts instead, gives you better control, and you can use battlecraft while
its rendering in background. This is pretty much what i use (replace the variable names):

cd /d "C:\Program Files\EA GAMES\Battlefield 1942\"
bf1942_r.exe +game %GAME_MOD_NAME% +workingFolder "ShadowWork\" +traceTerrainShadows "bf1942\levels\%BUILD_NAME%\" %BUILD_NAME%\lmList.dat "ShadowWork\bf1942\levels\%BUILD_NAME%\textures"

Better example maybe:
bf1942.exe +game DesertCombat +workingFolder "ShadowWork\" +traceTerrainShadows "bf1942\levels\dc_vernazza\" "ShadowWork\bf1942\levels\dc_vernazza\textures"

Which is exactly what BC42 runs in the background.

The only drawback with running it this way is that once battlfield has generated all the lightmaps they are not automatically
added to the RFA, you would have to do merge terrain lightmaps in BC42 afterwards..

The terrainLightmap.con is the settings used by battlefield for rendering, make sure you didnt put funny values in there, that
could cause it to crash or create everything black or white etc. This file is pretty much overwritten by BC42 with settings you have
set for light shadows etc. and if got those values messed up you could get black/white lighmaps or crash issue.
Skull Kid
Posts: 173
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by Skull Kid »

Alright, thanks for that information duffman =)

I will make sure to look into this soon.
Regards,

Skull Kid
Skull Kid
Posts: 173
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by Skull Kid »

I've put this "lightmapping problem" to the side for a bit, and got the wrecks on my map showing up with collisions enabled, thanks to some .con scripting ;)
Regards,

Skull Kid
Skull Kid
Posts: 173
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by Skull Kid »

Two years later, I'm onto this again. Shadow generation works fine for Forgotten Hope Secret Weapon. In fact, it all works, except for object lightmappnig... I have been sitting with this all day, no result.

I have been checking the init.con for "BF1942", it adds FHSW, as expected. Although it doesn't change anything... my Forgotten Hope Secret Weapon map's objects are still not lightmapped. As of writing this, it crashes Battlecraft 1942 upon reaching a certain percentage.
Regards,

Skull Kid
reegad
Posts: 81
Joined: Mon Nov 09, 2009 3:43 pm

Re: Lightmapping a non-vanilla map in Battlecraft 1942?

Post by reegad »

Skull Kid wrote: Tue Feb 27, 2024 11:56 pm Two years later, I'm onto this again. Shadow generation works fine for Forgotten Hope Secret Weapon. In fact, it all works, except for object lightmappnig... I have been sitting with this all day, no result.

I have been checking the init.con for "BF1942", it adds FHSW, as expected. Although it doesn't change anything... my Forgotten Hope Secret Weapon map's objects are still not lightmapped. As of writing this, it crashes Battlecraft 1942 upon reaching a certain percentage.
I have the same issue if the object im lightmapping has an error in the uvw channel 3 or missing .samples files
uvw channel 3 mostly gives error when there are overlapping parts, can you try backing up your map and running objectlightmaps with only 1 type of staticobject in the map?
Image
Post Reply