BC42 Crashes on object lightmap

Ask questions, discuss ideas, get answers
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

BC42 Crashes on object lightmap

Post by BotHunter »

Hey guys, Every time I try to generate Object lightmaps it BC42 it crashes. Anyone have a solution to this?

Thanks!
Last edited by BotHunter on Sat Sep 06, 2014 5:54 pm, edited 1 time in total.
Walk quietly and carry a sniper rifle
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: BC42 Crashes on object lightmap

Post by Swaffy »

- Do you have any custom (non-vanilla) objects in your map?
- Did you set the sun settings?
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: BC42 Crashes on object lightmap

Post by BotHunter »

Well it crashed when I had Area 51 objects in it, So I crated a Vanilla map where the only object in it was a Hut_m1. And it still crashed.

I have no Idea about the sun settings, But I assume the work because I can create terrain shadows just fine.
Walk quietly and carry a sniper rifle
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: BC42 Crashes on object lightmap

Post by Swaffy »

Check this forum thread out: http://forums.powervs.com/showthread.php?t=4693

In case the link goes dead, this is what was said:

"d'oh. i had shadows, lightmaps, and environment mapping off in the game. and since the game engine itself is used to generate them, that's what's causing the errors. THAT was stupid of me. shots later this evening with luck! YAY!"
Though he said he got a crash, it's worth a try.

Also look into this link: http://www.pixel-fighter.com/modules.ph ... 83&start=0
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: BC42 Crashes on object lightmap

Post by BotHunter »

I have all the graphics in the game turned up as far as they can go :(

So thats not the issue.
Walk quietly and carry a sniper rifle
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: BC42 Crashes on object lightmap

Post by Apache Thunder »

What you may need to do is generate the lightmaps manually from the command line using the debugger. The debugger might generate an error message prior to the crash that might provide you with more information.

Here's an example on how I did it with an old version of Dalian Plant (this was prior to using 3DS Max for lightmapping)

Code: Select all

BF1942_r.exe +game DesertCombat +workingFolder "ShadowWork\" +traceObjectShadows "bf1942\levels\Dalian_Plant\"
(note that quotes included in that command are indeed required. So don't leave them out. ;) )
(replace "DesertCombat" with the name of the mod your map is running under. You can leave the "+game" command out entirely if it's a map for vanilla bf1942)

+WorkingFolder defines the base directory for where the unpacked level lightmaps will be generated. This is always located at the root folder of the game installation. (the same location where the bf1942_r.exe file is located). The lightmap settings con file that Battlecraft is usually either packed into the map or is in the unpacked location for the debugger if you are doing this manually. So at the game's root you would have your map unpacked to "bf1942/levels/(name of your map)". Again, this is NOT located in your mod folder. This is at the game's root directory where the bf1942.exe and bf1942_r.exe file resides. You can place temporary modifications to your map to that unpacked location for the debugger and not have to include them in the main RFA that the retail exe uses. But if you add lighmap settings that way, you'll have to be sure to use the debugger exe to gen lightmaps instead.

The "+traceObjectShadows" command points to the map you are working with. As mentioned above, it's either unpacked for the debugger or normally with how Battlecraft does things, it's the RFA of the map instead. That path just reflects the base path to the map and is relative. It's not an absolute path, so never include things like a drive letter or the full path to the map. Just replace "Dalian_Plant" in the above example with the name of your map. And if your working with Battlefield Vietnam, replace the bf1942 portion with bfvietnam instead as that's the base path folder Battlefield Vietnam uses.


Unlike normal gameplay, you don't need to edit settings so the game boots in window mode as generating lightmaps always forces the game into window mode.

Also note that graphics settings like effects quality, graphics quality, resolution, etc, and such do not impact the lightmap generation process as it doesn't render anything onscreen during this process.

You can either create a windows shortcut to run this command to the exe, or create a batch file.

If there is a problem with something on the map and you use the debugger to generate lightmaps, there's a good chance you can find the problematic object(s) by either an error message popping up during the generation process or if there wasn't one, you can check the log file the debugger creates for the last object it was working on prior to the crash.

I don't think I've ever used Battlecraft for lightmapping. Back before I used 3DS Max, I always genned lightmaps manually through the command line. I did this for terrain lightmapping as well. :P


Also because I told the game exe what mod to load (DesertCombat in the above example), the vanilla bf1942 init.con file doesn't need to be edited to include your mod and it's dependencies like Battlecraft needs to do. I don't understand why Battlecraft has to muck up the vanilla files like that when it could have just directed the game exe to load the custom mod instead as when it does, it will load the mod plus all other mod dependencies that mod's init.con calls for. There's no need for the mess Battlecrap likes to do. :P

Battlecraft likes to f***K up files and if you have to use it, I would recommend you make a copy of your game and use it on that instead. That way you don't need to worry about Punkbuster kicking you from MD5 mismatches as a result of the messy job Battlecraft likes to do. Though now a days most folks now run the Origin version of the game and Punkbuster has been discontinued for this game, so it's not as big an issue. But still it's best to use a seperate game installation so you avoid possible problems when playing your game normally. I edit files unpacked manually and use Editor42/3DS Max then repack manually so I side step this issue entirely. But not everyone can mod like that. :P
ImageImageImage
I have cameras in your head!
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: BC42 Crashes on object lightmap

Post by BotHunter »

Hmm. So I ran the shot cut, And it went till here and then closed. Is it complete?

Image

(http://www.mediafire.com/view/c8esac16sgf1gn5/Error.png)

EDIT:

I looked at the files in ShadowWork/ And the terrain shadows are the but the object lightmaps aren't :?

Am I doing something wrong?

Here is the shortcut I'm using:

"D:\Program Files\EA GAMES\Battlefield 1942\BF1942_r.exe" +workingFolder "ShadowWork\" +traceObjectShadows "bf1942\levels\MyBCTestlev\"
Walk quietly and carry a sniper rifle
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: BC42 Crashes on object lightmap

Post by exe »

Lightmapping with the .exe takes a couple of steps.

You can either use this tutorial by Senshi: http://bfmods.com/viewtopic.php?f=43&t=125

Or mine which is a bit more in-depth and easier to understand for beginners (hopefully :) ): http://fhsw-europ.ucoz.de/forum/35-356-1
Whenever I mention FHSW just replace it with DesertCombat or <mod name>.
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: BC42 Crashes on object lightmap

Post by BotHunter »

AG! No matter what I do, There are no building textures generated! :x
Walk quietly and carry a sniper rifle
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: BC42 Crashes on object lightmap

Post by Apache Thunder »

You'll need to create a couple con files that Battlecraft normally does for you. Also missing samples files will cause the game engine to skip objects that it can't find the samples files for. This would have occured in Battlecraft too and might be the source of your problems. Battlecraft won't generate the needed samples files for you either. There's a simple command line program that does this for you. Do a quick search for "samplesmaker.exe". That's the program you use to generate samples files. The program is usually used in the same folder as your SM files. Usually batch file are involved to help make the program easier to use. Don't just double click the exe since it's a command line program and has no GUI. Nothing will happen. You'll either have to setup a simple batch file or just open a command line prompt and run the program with the correct switches.

If you didn't generate sample files for all the custom meshes, the game won't gen any lightmaps for them and will skip them. The samples are usually in an unpacked StandardMesh folder in the main BF1942 directory if you use the debugger to gen the lightmaps.

Or you can pack them into a StandardMesh_001.rfa and then you can keep them seperate. It's best to pack them in a RFA file with compression enabled. They take up a lot of space otherwise. Unless you don't have a huge vereity of objects. But most big mods do and you'll easily fill up a gigabyte or two worth of samples files depending on what size setting you used when the samples files were generated. If samplesmaker crashes on a object, then that object doesn't have a valid UVMap for the channel 3 uvmap. That's the uvmap channel the game uses for lightmaps. If you have objects that are missing this, you'll need to create a uvmap for it in 3DS Max. the UVMap for the lightmap channel has to be setup in a special way and aren't setup the same way as the UVMap the main textures are assigned to. Good luck with that. Best go searching for tutorials on that one as it's too complicated to explain for here for the time being and it's late at night when I posted this. :P


Here's a simple batch file that makes automates this for mulitple files:

Code: Select all

@echo off
for /f "delims=." %%a in ('dir *.sm /b') do call samplesmaker.exe %1 %%a
(paste code into notepad and save as a file with ".bat" extension. (no quotes) )

Then place both the exe and that batch file in the same folder as the SM files you need samples files for. I have my bat file called "Samples.bat". So in the command line you just type "Samples Large" And it will create samples at 512x512 resolution settings (so any resulting lightmaps generated will be at that resolution).

It's best to create copies of your SM files and organize them into folders based on what size lightmap resolution you want for each group of objects. It's not a good idea to use the same size setting for all your objects. Small objects usually look fine with smaller size settings while more complicated stuff like buildings or any object with large surface area will need larger resolution lightmaps.

The size options you have is "Small" "Medium" and "Large". Small is 128x128, Medium is 256x256, and Large is 512x512.

Since the samplesmaker doesn't have larger resolution options and it's really the only tool for making these files right now, that's the assumed limit for the generating lightmaps with BF1942.

If you want larger resolutions then that for your lightmaps, then you will have to use 3DS Max to generate your lightmaps instead. TGA files also take up a lot of video ram compared to DDS files. All my maps have the lightmaps saved as DDS1 DXT1 compression format. You can't batch convert the tgas the game generates to DDS since they are in grayscale and rely on an external palette file to give the proper color to the lightmaps ingame.

Generally I'd recommend only using DDS format for lightmaps generated from 3DS Max. If you do manage to get them saved in this format, it cuts down a lot of the lag that might be present on maps with a lot of lightmaps. ;)

But lightmapping with 3DS Max is no simple feat, so you will be stuck with TGAs. Just don't get carried away with large resolution sample settings and you should be able to avoid having your map cause lag on older machines.
ImageImageImage
I have cameras in your head!
Post Reply