regarding nightmaps

If you know something thats not in here please share it

regarding nightmaps

Postby Sgt.Killboy » Mon Apr 04, 2011 5:06 am

When i left the BF42 modding community, theres always been some open questions about getting nightmaps done. In my opinion, theres a few things to keep in mind:

1. Theres no such thing as blue heaven and blue reflections at night in real life. (Never ever)
2. If you don't make real life look better, why fake it?

Let's say you want to make a night map of a vanilla one...maybe kursk or so.

1st you might want the skybox to be another one. Lets assume you already got one. (tutorial about creating skybox here: http://www.bfmods.com/viewtopic.php?f=9&t=1021) Put your textures in the maps folder in a new folder called textures, and name them like -texturesname here-. )for some reason i get PHP errors when using brackets)
Thenn add the following code to the init.con file of your map:

Code: Select all
rem *** textureManager.alternativePath Texture/texturesname here
textureManager.alternativePath Texture/texturesname here


However the sky will work now, the ground still looks dayish.

If you use Photoshop, you got 2 options to change that.

The first and -pain in th ass- one is to import all 6 textures into Photoshop. You now got 6 images in PS.

Duplicate the image on top and add a new layer. Color it with the bucket tool by using opacity of whatever percent...lets say 50% and a black color . You now have the texture of the copy darkened by using a new layer.
Now just drag the new layer on the other pics and use Ctr+E to combine them to one layer, then save em as .dds files.

The other way, or an alternative or even another adjustment ist, to just open the -detailmap.dds- file an darken it a bit, by useing PS's general funktions.

I personally bought a german copy of PS CS2 for 300 bucks, so i dont know what this funktion is called in engleeshe...in germany its just -Image-Adjustement-Brightness-

Be carefull. Darkening it too much, will make your ground look like coal.

The last thing will be to get the maps shadows into the right shape. Now just open the existing map in Battlecraft and adjust the shadows color like the skymap is colored at its bottom. Save it as Kursk Night and unpack it, to steal the shadows code.

Lets say this one:

Code: Select all
shadow.shadowColor 0.550000

Game.setViewDistance 400
Game.spawnPlayers 1
renderer.fogstart -20
renderer.fogend 150


_____________________________________

well now senshi wrote some things about the ambient color 'n stuff. Follow his steps, and you will be fine with the results.

So basicly its a few steps to a cool night map.

1. Darken the ground textures either by darkening the .dds labeled like "Tx00x00.dds" and so on or by darkening the detail.dds or even both.
These files are located in you maps directory in the Textures folder.
2. Add a costum sky
3. Adjust the ambient color and water color and everything senshi wrote about in the next post.
Last edited by Sgt.Killboy on Fri Apr 29, 2011 5:17 pm, edited 2 times in total.
My anger management class pi**e* me off.
Image
Sgt.Killboy
 
Posts: 59
Joined: Thu Mar 24, 2011 6:16 pm

Re: regarding nightmaps

Postby fo0k » Wed Apr 13, 2011 4:03 pm

Thanks Killboy, useful tut!
User avatar
fo0k
 
Posts: 1416
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: regarding nightmaps

Postby Senshi » Fri Apr 29, 2011 11:30 am

For nightmaps I usually take some extra steps. You can fiddle with all the light settings individually. Your things are good basics, but won't work for e.g. city maps, as you don't touch the static lightmaps (which don't give a sh*t about the color codes set in the init.con). Also, you forgot animated meshes and specular colors, which can be very important for maps with lots of statics and buildings as well.


The first section (between beginrem and endrem) were the original settings of a map I "nightified" for BG42. The lower ones are the dark ones. I made annotations as explanations.
Code: Select all
beginrem
renderer.globalAmbientColor 0.062745/0.062745/0.086275
renderer.ambientColor 0.062745/0.062745/0.086275
renderer.diffuseColor 0.298039/0.298039/0.247059
renderer.specularColor 0.298039/0.298039/0.247059
renderer.vertexFogEnable 1
renderer.fogColorVec 0.094118/0.101961/0.149020
renderer.animatedMeshAmbientColor .3/.3/.25
endrem
renderer.globalAmbientColor 0.030/0.030/0.032 <-------- overall ambient color&brightness that is used to light statics that do NOT have lightmaps (usually small props like sandbags, bins, streetlights, buckets etc.)
renderer.ambientColor 0.030/0.030/0.032 <----------use the same as above, else you get an ugly inconsistent look
renderer.diffuseColor 0.20/0.20/0.22 <------overall ambient shadow color&brightness used for the shadow side of statics without lightmaps
renderer.specularColor 0.055/0.055/0.0552 <------ overall color and intensity of specular maps (applies for lightmapped statics as well!). Specmaps are mostly used on "metal" things (e.g. the big russian oil silos in vanilla) and make the "shiny-reflection" effect. Obviously, use a low setting for night...
renderer.vertexFogEnable 1
renderer.fogColorVec 0.094118/0.101961/0.149020 <----fog color, obviously. Use a color that matches the sky color at horizont level for best aesthetic looks
renderer.animatedMeshAmbientColor .25/.25/.252 <---- ambient color and brightness of animated things. This means soldiers, soldier weapons and things like that. Very important to make a night map feel really "nightish".

shadow.shadowColor 0.00020


The color codes used above make for a really dark map that makes it actually difficult to spot enemy soldiers in dark corner. Best way to spot them is by watching for muzzle flashes. Very unique for BF42 as most "night maps" are still way too bright, especially the animatedmeshes.
Overall tip for night maps: Remember that during night, blue is the most dominant color. Giving all your light settings and textures a very slight (don't go overboard with this, this effect can very quickly appear "cartoonish" if used too strong!) blue tint. Check my light settings, most of them have a slight extra stretch on the blue value (the last one). Subtle effects like these can do a lot for immersion.

Altering building lightmaps is another thing:
Lightmaps for statics are rendered either in BC or via the debugger in a simple grayscale image. The actual "coloring" and brightness of these is defined by the palette.pal file in the objectlightmaps folder. These are color tables that define a range of colors that is used for the lighting part, defining colors from "white" to "black". On a desert map this palette usually ranges from a dark/near black value (25/27/34) to a sand-color bright one (186/165/134). Bright does not mean "255" bright, remember!
Now, for a true night map you obviously don't want a weird sand colored brightness on your buildings while the rest of the terrain drowns in darkness. You now can either choose to replace your palette.pal with one of any other map that might look better, but due to the lack of true nightmaps in BF42 vanilla this is difficult. So just make your own.
Start Photoshop, open any file (doesn't matter, or just create a new one). Then go to Image->Mode->Indexed Color...
Hit ok. Then go to Image->Mode->Color Table...voila, this is your palette file! You can now use "load" to load any of the palette.pal files you have from bf42 to get a feel on how these are used and to get the correct number of indexed colors. To change them yourselves is very easy:
Select ALL squares. This causes a color picker to pop up. By selecting all squares you automatically tell Photoshop you want a color gradient. The first color to pick is your shadow color. Go for a dark one here, obviously (I used 15/15/17). Avoid pitchblack, that looks unrealistic ingame. Hit OK. After that another color picker pops up. This is your light color. Pick a "brighter black", it's night, remember ;) . I went for 35/35/37. Yeah, THAT dark. The range is so small simply because during nights there are no strong shadows visible, due to the lacking light power of the moon. Makes sense, right?
Now, hit "Save" in the color table and save it as "palette.pal" in your map's ObjectLightmaps folder, overwriting the old one.
Done. Now you have nice dark building shadows with a slight blue tint for extra niceness.



Another thing to do: Darken water color.

Code: Select all
water.scrollDirectionNormalmap 1.000000/0.000000
water.scrollDirection1 1.000000/-0.500000
water.scrollDirection2 1.000000/0.500000
rem water.specularColor 0.650000/0.550000/0.400000
water.specularColor 0.10000/0.10000/0.1200000 <----darkened a lot, as the reflection of the moon obviously should be way more subtle than the one from the sun
water.scrollLayer1 0.020000 <------- Lowered this a lot to achieve a "calm sea" effect to make my night map more eerie
water.scrollLayer2 0.010000 <------- using asymetric speeds for the scroll layers is a good thing, makes water appear more "natural/random"
water.scrollNormalmap 0.020000
water.specularStreakFactor .001000 <---- the raw strength of how much the water should reflect with the spec map. The higher, the bigger the reflection will be. Obviously, very small number for moonlight.
water.tileLayer1 0.300000 <---- This defines how the water texture is tiled. I used a low value, which means the texture is stretched a lot. Which in turn makes the water appear very calm, with some large, slow waves rolling in
water.tileLayer2 0.300000
water.tileNormalmap 3.000000
water.lightDirection -0.300000/0.500000/-0.650000 <----obviously, make this the same as your sun direction
water.color 0.200000/0.300000/0.300000 <---- water overall color, dark, with a purplish tint
water.deepColor 0.200000/0.300000/0.300000 <----- water color in "deep water" (I used the same, as it didn't matter for my harbour map. No shallow water there.)
water.waterAlphaDepth 0.300000 <----- Defines the depth of the "transparent" water on the coast. The higher the value, the deeper water can be and still be transparent. If you have island maps with large shallow areas, try increasing this value to 2 or 3 for some very awesome reef-water-effects
water.waterShallowAlpha 0.500000 <----defines the transparency of the water in the shallow area. 0,5 means half-transparent, obviously. If you use a higher "AlphaDepth" value, you should use a LOWER Alpha value here, else it will be difficult to see where the water actually hits the shore.

The above one makes for a blue-blackish calm water as commonly seen during night. Perfect for lakes or calm ocean parts (e.g. harbor bay).

So, as a general checkpoint list:
1: Choose a nice night sky texture. Either make one or pick sky_telemark_m1 (I think it's from Secret weapons? Or is it BG-exclusive? Dunno...)
2: Darken your ground textures with the detail.dds method killboy describes above
3: Edit your palette.pal as described above to make it darker
4: Edit your fog color settings
5: Edit ambient/diffuse/specular/water settings

As you will have to fire up BF42 with your map regularly to check how things look ingame, there's a small way to make life a bit easier. But only for step 4 and 5.
For that we use the magic wand that is bf1942_r.exe, also known as the debugger.
Start your map with it. Run around, choose a nice spot where you can see most of the things (or use the free camera. console -> game.enablefreecamera 1).
Then hit (P)AUSE. This prevents the console being cluttered with debug messages.
Now open the console.
Type in the very code from the init.con you want to edit
Hit Enter.
*abracadabra* The engine instantly displays the changed settings!

Useful hints for maneuvering in the console: It supports autocomplete with the TAB key!
So:
Type "rend", hit TAB-> get "renderer."
Now type "anim", hit TAB -> get "renderer.animatedMesh"
Now, as there are multiple commands to go from here, double-tap TAB to get a list saying:
"renderer.animatedMeshambientColor"
"renderer.animatedMeshDiffuseFactor"
Now type "a", hit TAB -> get "renderer.animatedMeshambientColor"
If you are unsure what values to set in, tap TAB another time
You'll get "renderer.animatedMeshAmbientColor Vec3->void"
This means a triple vector is needed. A triple vector is 1/1/1 . Each value can be a float number.
Other common possibilities:
"renderer.animatedMeshDiffuseFactor float->void"
This means a float value is needed. Float values are any negative or positive numbers, with or without decimals. E.g. -0.12341555166 . However, sometimes the float range is limited. E.g. colors always range from 0 (black) to 1(full color). You can set "-2" or "100000", but as you can't get any brighter than maximum color or any darker than pitch black, it will always be interpreted as the maximum possible value. Making -2=> 0 and 10000=>1. Kind of failproof, really :) .
"water.specularEnable [bool]->bool"
This means a boolean value is required. Boolean values are "0" and "1". They are basically switches "on" and "off". Makes sense, as you can only enable or disable something, but not half-enable it...
TAB is a very sweet tool to quickly code in the debug console. Requires some getting-used-to, but it saves A LOT of time and typing. And especially helps avoiding typos.
Remember that in the console you can switch through the 10 recent commands you entered with the arrow UP/DOWN keys. Most important if you want to compare two settings swiftly or similar.
Also, for code in general:
1.0/1.0/1.0 equals 1/1/1 equals 1 . Three identical vectors can be shortened to a single float value.
0.5/0.5/0.5 equals .5/.5/.5 equals .5 . decimal numbers between 0 and 1 can be shortened, it is not necessary to type the "0".


I also made a short gallery of GIFs showing different settings for the most important light and water settings:
ImageImageImageImageImageImageImageImageImageImage
User avatar
Senshi
 
Posts: 695
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany

Re: regarding nightmaps

Postby Sgt.Killboy » Fri Apr 29, 2011 3:25 pm

Oh wow! *lol*

I am not sure how I could have forgotten to talk about that...

Well thanks for adding this! Will Edit my 1st post and guide people to read yours.

Theres just one thing i don't agree with you: The blue color thing. It's just a point of view, but when i leave my house at night, i don't see any blue at all. Or let's say there is blue, but blue is not the dominating color, neither the real life's skybox is, nor the ambient color. It's more like a slight blue touch. I will try to get a map done soon, to post my examples.
My anger management class pi**e* me off.
Image
Sgt.Killboy
 
Posts: 59
Joined: Thu Mar 24, 2011 6:16 pm

Re: regarding nightmaps

Postby Senshi » Sat Apr 30, 2011 1:23 am

That's what I'm saying. Do not use a blue color. Use a slight blue tint. On a clear sky, full moon night go outside. Things are black/white. But if you look carefully you will notice there indeed is a blue touch to everything. If you don't believe me, get your camera out and make a clean night shot (without artificial lights, obviously) of some landscape. Open that pic in PS and color pick some areas. You'll see the blue value almost always is a tad higher. This is atmosphere and physics 1x1: The moon acts as a mirror of sunlight. However, the moon is not a clean mirror. It's actually pretty dirty. And moon dust has the unique property (as does the average atmosphere) of absorbing short-wave red and green light better than long-wave blue light.
If you work with remote sensing raw RGB data, one of the most important steps is to correct for atmospheric influences on the spectral input, which mostly means filtering out blue light. As said, even during day the world is more blueish than anything else. Of course this is not directly apparent to us (accommodation factor), but in computer graphics that are to simulate reality it is important to simulate these unconscious effects, as they can have a big impact on immersible "feel" of maps.
Best example: Look at the sky at day. What color is it? Exactly, it is blue. Why? Because the atmosphere filters the sun light (which actually has even more of a red/yellow tint in light emission) and filtrates the shorter-wave wavelengths (red/yellow/green). Blue, as the longest-wavelenght-color in the visual range manages to penetrate most of the atmosphere better and thus arrives at the human retina with a blueish tint. That's all there is to it. The same goes for night skies, which also is blueish. But as night skies are very dark/black anyway, it's more difficult to see the relatively smaller difference.
User avatar
Senshi
 
Posts: 695
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany

Re: regarding nightmaps

Postby Sgt.Killboy » Sat Apr 30, 2011 3:25 am

Thats what I was trying to say!

;)
My anger management class pi**e* me off.
Image
Sgt.Killboy
 
Posts: 59
Joined: Thu Mar 24, 2011 6:16 pm

Re: regarding nightmaps

Postby Senshi » Sat Apr 30, 2011 8:09 am

Hehe, then we're all good. I just skimmed through the thread and I have to say, this probably is the most elaborate and in-detail tutorial about advanced lighting in BF42 that ever existed :D
User avatar
Senshi
 
Posts: 695
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany

Re: regarding nightmaps

Postby Sgt.Killboy » Sun May 01, 2011 1:29 am

Wait...lighting? I was talking about ground textures!

*rofl*

We should kinda merge this tut someday. But since u should be busy doing the animation one...omg...mate....lets merge this later. I'm kinda affected by beer and....dude...wait....what?

Image
My anger management class pi**e* me off.
Image
Sgt.Killboy
 
Posts: 59
Joined: Thu Mar 24, 2011 6:16 pm

Re: regarding nightmaps

Postby cajunwolf » Mon Oct 29, 2012 10:25 am

This is a great thread and to quote Senshi

this probably is the most elaborate and in-detail tutorial about advanced lighting in BF42 that ever existed


Very true!

I have been looking for someone who knows about this stuff for years. This is especially useful information for setting up lighting with custom skyboxes. I have many questions to post when I have the chance.
Image

"When you're up to your butt in alligators, you forget your original intent was to drain the swamp!"
User avatar
cajunwolf
 
Posts: 115
Joined: Tue Jul 10, 2012 2:03 am
Location: Houston, Texas


Return to Modding/Mapping Tutorials

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron