Page 1 of 1

lightmapshadowbit.lsb - creating / editing it manually

Posted: Sun Mar 31, 2013 4:50 pm
by fo0k
Saw a post on this from apache.. appeared to manually create this file using black and white images then saving.. but in what format?
Is it just a raw file with lsb extension?

care to confirm the steps to achieve this.. thanks

Re: lightmapshadowbit.lsb - creating / editing it manually

Posted: Mon Apr 01, 2013 3:46 pm
by Apache Thunder
The raw file image is editable in Photoshop. I just open it and make changes. Then save as same type. Which in this case is grayscale 8bits. It appears the game might be able to handle values other then 100% black and 100% white, but the LSB converter we are stuck with doesn't seem to be able to convert that correctly so I've only seen ones generated by the game seemingly able to have that. (judging by the fact that transitions from light to dark in some LSBs generated by the game to be smoother or less noticeable) Any files converted by the LSB converter will have only 100% black and 100% white values in them so it's impossible to tell for sure. It may also explain while sometimes the LSB converter crashes when trying to convert LSBs from certain maps. :P


The only real trick is trying to figure out what resolution the game want's the LSB at. (that's if the generated one from the game crashes LSB or doesn't exist for your new map, thus you need to make a new one). Sometimes it will want 8192x8192 or 4096x4096. It does seem to be tied to the world size or size of the hieghtmap. But I still don't know that for sure. When resizing, I sometimes had to leave the image the same size but only extend the canvas size out, and sometimes not. So that's another thing to worry about. I suppose you'll just have to save as different resolutions until you find the one that works with the map you are using it on. :P

The 8bit raw files for pathmaps generated by the game when making new pathmaps are in the same format by the way if you're looking for something to compare them too. ;)

Re: lightmapshadowbit.lsb - creating / editing it manually

Posted: Mon Apr 01, 2013 10:50 pm
by fo0k
great, all crystal clear - thanks!

so.. this LSB converter-- hmm.. could you attach it?

Re: lightmapshadowbit.lsb - creating / editing it manually

Posted: Tue Apr 02, 2013 6:38 pm
by Apache Thunder
Sure. Here's a link to it:

RAW_2_LSB.exe

It's a simple command line program similar to the lexicon converter. Just drag and draw raw/lsb file onto it and it will output the converted file. It will convert both ways. :D

Re: lightmapshadowbit.lsb - creating / editing it manually

Posted: Tue Apr 02, 2013 10:03 pm
by fo0k
groovy, thanks.

so how does the game take the altitude of the player into consideration? if flying over a shadowed area, but clearly in the light for example..

Re: lightmapshadowbit.lsb - creating / editing it manually

Posted: Thu Apr 04, 2013 1:20 am
by Apache Thunder
There are a few commands used in the terrain.con file that govern the behavior of the objects that are impacted by the LSB File. :D

Here's some example code:

Code: Select all

Terrain.ShadowAmbient 110/140/171
Terrain.ShadowBorderFadeTime 0.075
Terrain.ShadowSamplingCullY 8
The first command is a Vec3 RGB value and ranges from 0 to 255. This controls what color the "shadow" is for the mesh of any object that is in a shadowed region in the LSB file. The second is simply the fade time. How long it takes for the mesh to transition from light to shadow when it enters or leaves a shadowed region in the LSB file.

And the last command answers your question. That command governs the height a mesh will be before the game decides to ignore the LSB and have the mesh always be at 100 percent brightness with zero shadow. It uses the terrain mesh at any given point on the map to determine how high the object is. So for example with how it's coded above once a object is greater then 8 meters from the ground at any position on the map, the game no longer considers it part of a shadowed region and thus removes all shadow color from the object.

This means the system BF1942 uses to govern light and shadow for objects in a LSB region is 2D in nature, so keep that in mind. It may present it self as a engine limitation if you are trying to use LSBs for complex maps like DC Sea Rigs for example. That map is pretty much 3D in structure as there are multiple "levels" in height the players can be at many different points in the map. So it's best to not use a LSB at all on maps like this. For maps like this, you can instead use an all black map (so that everything is in shadow). Then use a really large value for ShadowSamplingCUllY, then use the ShadowAmbient command to give an extra element of control for the general lighting of dynamic objects in the game.

Re: lightmapshadowbit.lsb - creating / editing it manually

Posted: Thu Apr 04, 2013 4:56 pm
by fo0k
very useful explanation, thanks. One uses these things without always appreciating how the big picture fits together.

Re: lightmapshadowbit.lsb - creating / editing it manually

Posted: Sun Apr 14, 2013 9:56 pm
by Apache Thunder
Did some googling and found something interesting regarding the origins of the LSB files:

http://www.3dbuzz.com/forum/threads/253 ... n-lsb-file

http://file-extension.paretologic.com/d ... ension-lsb

We need to hunt down the program that was originally designed to produce these files. Goes by the name of "Lightscape 3", but it's old and hard to track down :(

I bet if we found a way to use that program to make BF1942 LSB files, we can put more detail in the shadow bits. The converter is limited to making black and white images, but I bet LSBs can actually handle 256 color grayscale since the LSB's made by the game engine seem to have areas that aren't 100% shade or 100% light.