nib's Mapper Resource Center
     

The Mapper's Diary - Volume 5


Oct. 15th, 2002
5:00pm

After doing some additional sketching last night, I decided to start with building another rough outline of a second building I decided I wanted in the central part of the map. Again, this is just a basic outline of the building to get scale right and get a feel for ceiling height and time.

When I compiled and tested it with my choosen sky (mx_forestsky2), I realized that the shadows were coming out much darker than I wanted as seen here:

Small Image

So, that tells me that I need to create my own custom sky shader that will be based on the original mx_forestsky2 shader so I can lighten it up some. Here is the original shader:

textures/skies/mx_forestsky2
{
	qer_editorimage textures/skies/sky_4.tga
	q3map_lightimage textures/skies/n_blue.tga
	surfaceparm noimpact
	surfaceparm nolightmap
	surfaceparm nodlight
	q3map_globaltexture
	q3map_lightsubdivide 512
	q3map_sun	1.0 0.8 0.6 130 220 50
	q3map_surfacelight 25							

	fogvars ( .3 .3 .38 ) .000065
	
	skyparms full 200 -
	
	{
		map textures/skies/newclouds.tga
		tcMod scroll -0.001 -0.003
		tcMod scale 6 6
		depthWrite
	}

	{
		map textures/skies/assa_clouds1.tga
		blendfunc blend
		tcMod scroll 0.0005 0.00
		tcMod scale 2 1
	}

}

The first thing I did was create a new shader called textures/nib_factory/nib_factory_sky and put it in my nib_factory.shader file that goes in the main/scripts directory. Don't forget you also need to update your shaderlist.txt file with your newly created shader file if you want it to show up in gtkRadiant.
Back to the shader, the line we're interested in is "q3map_surfacelight 25". That line determines how light/dark your shadows will be, the lower the number, the darker the shadow. Twenty five is a very low number. I first bumpped it up to 200 and got this:

Small Image

Look at the back of the building. Two problems, first, the shadow on the ground is too bright and the second problem is the shadows look blue! Let's deal with the first problem first. Since 200 was too bright, I'm going to drop it down to 150:

Small Image

Better. It still may look a tad bright to me but, I want to fix the blue light issue first and see if that helps before I darken that shadow any more. Now, on to the blue shadow that looks like crap. So where is the blue coming from? That comes from the "q3map_lightimage textures/skies/n_blue.tga" line. Let me explain what's going on.

Outside light color (i.e. light from a sky shader) is determined one of two ways. The first way is by simply taking an average color of the sky shader image and using that. This works OK if you have a fairly plain sky texture and it is the color you want. This works bad, however, if you're sky is some sort of complex image or is an odd color. In our case here, the sky is a mix of blue and white. An example of where you have a complex sky is with my map Mountain Assault. That maps sky texture is a combination of blue sky and brown mountains. When you blend those colors you get something ugly.

That's where q3map_lightimage comes in. This is just a very basic texture that is the color you want your shadows to be. You'll note in the original shader it points to textures/skies/n_blue.tga. I looked for that texture but couldn't find it in the pk3 files but we can safely assume its a blue color, which is causing our blue shadows.

So what do we do? Well, what I did was this. The line "q3map_sun 1.0 0.8 0.6 130 220 50" is the line where it determines the color, intensity and angle of the sun. The first 3 numbers (1.0 0.8 0.6) represent the rgb color of the light used when compiling the outside lighting. I simply made a 64x64 texture that was that same color to be my lightimage texture. Here is what it looks like:

Light Image

Ok, so lets see what our map looks like with the new light image and the adjusted surfacelight parameter both in use at the same time:

Small Image

Looking much better. However, I still think the shadow is too bright, especially considering I'm running this in a window and that seems to always make my maps darker than they are when I run in full screen. So, I'm going to drop my q3map_surfacelight line down from 150 to 100. This is a much better look and I expect if I ran this in full screen it would be perfect:

Small Image

One other thing that needs to be mentioned about the sky shader. The line "q3map_lightsubdivide 512" needs to be looked at. This determines how to split the sky shader's brush up for lighting purposes. It basically helps distribute the lighting. ydnar gave me the guidline that you want that value to be about 1/4 of the size of your longest/highest sky brush. In this map I'm going to set it at 1024 based on the size I think the map will be. There is the added benifit that you save triangles by making that number bigger!

And, finally, after chatting with ydnar some more about the default sky shaders in wolf, he pointed out some other issues/ineffeciencies with the default shaders. Basically, the "skyparms full 200 -" line got changed to "skyparms - 200 -" and the tcMod Scale lines got moved before the tcMod scroll lines (these lines scale your textures and the scroll line is what give you the moving/rolling clouds). Also, he recommended that I remove the depthWrite line.

After all those changes, here is my final texture that I intend to use with my map:

textures/nib_factory/nib_factory_sky
{
	qer_editorimage textures/skies/sky_4.tga
	q3map_lightimage textures/editor_icons/factory_lightmap_01.tga

	surfaceparm noimpact
	surfaceparm nolightmap
	surfaceparm nodlight
	q3map_globaltexture
	q3map_lightsubdivide 1024

	q3map_sun	1.0 0.8 0.6 130 220 50
	q3map_surfacelight 100

	fogvars ( .3 .3 .38 ) .000065

	skyparms - 200 -
	
	{
		map textures/skies/newclouds.tga
		tcMod scale 6 6
		tcMod scroll -0.001 -0.003
	}

	{
		map textures/skies/assa_clouds1.tga
		blendfunc blend
		tcMod scale 2 1
		tcMod scroll 0.0005 0.00
	}

}

As you can see, this is a lot of trial and error. I didn't intentionally pick wrong values just to show you the differences in light. I simply don't know off the top of my head what will work so I pick something, test it, and adjust accordingly. If anything, I hope this shows those of you that are just getting started that even those of us that have made a few maps still spend a lot of time simply testing out new things when trying to get something to work. And honestly, I wouldn't be at all surprised if I start tweaking this sky shader again down the road, but for now, it will do.

You can get a copy of the .map and the .shader here. Also, if you try to use/copmile/run this map, you're going to need to be sure and put all the files in their appropriate place. Remember, the .shader file goes in your main/scripts directory, the .map and .bsp goes in your main/maps directory and you'll need to create a textures/editor_icons directory for the light image file. And, if you want the shader to load up in radiant you're going to need to update your main/scripts/shaderlist.txt file and add nib_factory to the list of shaders in that file.

<<   Previous Entry Next Entry   >>