Game Development Community

Creating Materials For High-Density, Low-Poly Environments Torque 3D 1.2

by JR Wilde · in Artist Corner · 07/04/2012 (7:58 pm) · 0 replies

i1066.photobucket.com/albums/u405/Synchronicity3D/lowpolyenvironments_gg_html_1f4af310.jpg
Note: game image is rendered on an HP Pavilion dv7 notebook using one of Intel's Graphics Accelerator Chip set. For your convenience I've made a PDF that has more details and images to show in-game examples. If you'd like, get it here.

These concepts are for the times where the textures are too bright or dark and simple gamma correction is not sufficient. Gamma correction should be a final step anyway in my opinion.
This is a �down-n-dirty� how to �reign-them-in� article;
I'm using Photoshop and I recommend that you be somewhat familiar with the curves, levels, adjustment dialogs, layer modes and how to use them.

Quickly then, here are some things to think about before you begin your texture work:

How bright will the overall scene be?
Will there be any cloud-cover? If so, how dense will it be?
What color will the clouds be -does the color match the time of day you have chosen?
i.e. will you have sunset colored clouds in high noon?
What color will the fog be in the level?
Is there fog in the level?
What will the ambient color be?
Sun color?
What will the sky brightness/exposure settings be? (Scatter Sky)
What size and how dense in the air are the atmospheric particles and how much will they be allowed to affect the sky? (Mie/Rayleigh scattering)

I'd imagine you've noticed that every one of these questions has one thing in common: Light -or something that affects it. To my eyeballs, every aspect described above affects the materials; as do the post processing effects. Some to a surprising degree.
What does this really mean? Don't put lighting into the textures themselves. Torque takes care of that in real time for you. They have some really nice shaders that can do amazing things and I highly recommend that you experiment around with them.
Shaders then, are another thing that should be taken into careful consideration. If you have worked with previous incarnations of the engine, its probably a good idea to drop the �old way� of thinking about textures. Torque uses a full-blown materials system. In general, we use multiple textures to create one material. In this article, I'll briefly explain the prominent textures used to create said materials. Keep in mind that you are creating textures for shader materials and shaders are sensitive.


Terrain Material Textures

The Diffuse Map or texture is for color only. When a Detail texture is added to the Diffuse, the material will become much more intense than either of the textures are alone. The normal map's �shadowing� can help exasperate the issue in the game; of course a great deal of any compounded lightness or darkness in the game can be due to how the normal map is created in the first place.
Sometimes I use Photoshop's layer blending modes as a �preview� to get a very general idea of how light/dark the texture is and what it might look like in-game -not exactly, but fairly close. The closest mode that approximates this intensifying effect, again, to my eyeballs, is the overlay mode, and sometimes the multiply mode is a more accurate representation. This is a good starting point only.
At this point I wouldn't recommend adjusting your textures until they �look right.� The overlay trick merely tells you what needs to be done to each individual texture. Switch it back to normal mode. If the image is too bright/dark, lightening or darkening one or both usually does the trick.
Another thing that works quite often is the legacy brightness/contrast function in Photoshop ( Image>>Adjustments>>Brightness Contrast). If the �Use Legacy� tic box is empty, click it. If you are using an older version of Photoshop, un-tic the preserve luminosity tic box. If you need your texture brighter still, it can be lightened up later.
Now adjust the image until it has a very even brightness and very little contrast.
Be aware that if your images are photo-based, it is not a trivial matter to create a very good texture that bears such qualities. It's quite possible, but its best to have a very, very good, evenly lit photograph to begin with.


The Detail Map is much more involved than its innocuous name might imply. This texture is by far the most powerful. If you don't want massively over-dark or bright materials, you'll need to make certain that the detail texture is as �tame� as possible. What this means, is you want as little variation between the lightest and darkest parts of the image as seems appropriate. When the Detail is combined with the Diffuse, the differences become much more pronounced.
Use the high pass filter (filter>>other>>high pass) -or not depending on how ugly the results. For me, gray scale has always worked best with the high pass -they can be colored later if need be. Remember though, detail textures do not necessarily need to be gray scale at all -that's the old-school way of thinking about them.
You can also use the curves (ctrl + M) and/or levels (ctrl +L) to sooth it.
Try adjusting the lightness through the hue saturation dialog (ctrl +U) instead of or in addition to the levels and curves.
Taking out a great deal of the saturation can help as well -you may need to lighten it.
If you have spikes all over the place in the histogram, blurring the image slightly will smooth them out; sharpening them will increase the spikes and amplitude -not a good thing to do to the image. A smooth, bell curved histogram is what you want. You must have a fair amount of space between the highest or narrow part of the �bell� and the top of the graph. If the bell part goes higher than the highest part of the graph, you are clipping your texture. This means you are going over the value 1. There is a high likelihood that the texture will not behave as expected.
If its too dark, duplicate the layer and switch the duplicated layer's blending mode to Lighten or Screen; check your histogram to see if you need to do this more than once. The reciprocal is also true: if the texture is too light, use darken, overlay, or multiply modes. There are more subtle and blatant modes, but the ones above have worked well for me and have primarily given the quickest results. To lessen the effect, decrease the layer's opacity or the fill opacity if you have any layer effects on the layer you are changing the mode on. Pay particular attention to the luminosity blending mode as well.

The Normal Map can be made from a high-poly model, then mapped to a much lower poly model but often it is made from the image being worked on. Normally this is accomplished using a �Normal Mapper� application such as nVidia's Normal map plug-in for Photoshop or xNormal by Santiago Orgaz -a plug in or standalone. xNormal can do the high to low poly model mapping so I use both xNormal and the nVidia Filter.
A final thing about terrain textures that is important to me is scale. You do not need a 1024x1024 image if you plan on using it for a small intricate detail texture. In the image below, you can see that the size of the fir needles and ground foliage are indeed the correct size, yet still have the texture retain as much sharp detail as possible and most important, tile well; this is because I can't stand seeing tree needles the size of baseball bats when I'm playing a game.

Other Material Textures

The other textures used in creating the materials involved in an outdoor environment can be treated very much like the terrain textures. There are the Torque-standard Diffuse, Detail and Normal maps -no surprises there. Torque gives us the option to use several other maps that give us much more control over our materials and, in my humble opinion, should be fully exploited. For this article, I'm using four: Diffuse, Normal, Detail, Detail Normal. With just these four, you can achieve a tremendous amount of variations and effects. The texture cost to use all of them should be considered.

The Detail Map is just as fussy to brightness in these other materials as it is in the terrain materials. Tame it as best as you can using the techniques described for terrain textures.
If you cannot tame the beast, there's a hack available to you: Use just a Diffuse and Normal. You will need to put the lacking detail into the Diffuse however. This is a useful trick for undergrowth in a pinch. As an experiment, I have employed this style on some of the undergrowth -do I really need four maps on a 256 material that no one will likely notice? I really don't think so. But the colors are so much richer and details so much deeper if several maps are used.
The [b}Detail Normal Map[/b] needs to be fairly, well, �detail-y.� I've noticed that if the Detail N map is somewhat smooth like the Diffuse N map, it merely �casts a darker shadow� on the material. If, on the other hand, its �sparkly� and �detail-y,� it can make the material brighter and/or enhance the depth of the Detail map due to the illusion of shadowing. To me, the Detail Normal looks more �sparkly� than the normal Normal map.
One way to do this is to adjust the contrast so the image is extremely contrasty, and then send it through the nVidia mapper. In the mapper I select the 4x4 sample and, depending on the amount of �bumpiness� the source image has, set the height from anywhere between 10 and 50. Little changes to this map can have massive consequences on the materials.
The Specular map is a black and white map showing what parts of a material is shinny. White is shinny, black is matte. Most plants don't necessarily need to be shinny but some do. Metals and stones often have specular highlights, so its good to know what this map is.
Although brief, I hope this has been helpful to you. I've tried to get you �in the ball park� so you can feel free to experiment with all the many possibilities available to you.