• Register

Timeforce: Operation Robo-Hitler is a satirical RPG set in an alternate universe where Hitler is 40 feet tall, a robot, a vampire, and still a Hitler. You play the CHRONO-COMPUTER, a sentient super AI that controls a machine that can travel through time. Due to mistakes made by your master, the DIPSHIT TIME TRAVELER, Hitler is now almost unimaginably powerful. By controlling 40 of history’s greatest individuals, you will destroy Hitler and SAVE TIME ITSELF.

Post tutorial Report RSS Texture Basics and Entering Them Into Unity

We'll teach you the difference between a normal and an alpha and tell you how to import textures into Unity!

Posted by on - Basic Textures

How are you doing folks?!

Today, we continue our work on making the game pretty, this time through TEXTURES! As such, we decided to give you nascent developers some pointers on how to go about implementing these in your game. Please note that while the concepts are generally applicable, in this case we will be using Unity.

A texture in any video game is essentially a pattern that you repeat over the surface of a 3D object. This is usually meant to replicate the aesthetics and physical nature (especially the component materials) of a real life object. As such, the easiest way to get started is to snap some photos of patterns you see in your day to day and think would fit with the look of your video game. You don't need a fancy camera and in fact any modern cellphone camera will do just fine. Here are some examples:

BP 8 002

Tutorial 07

BP 8 009

Take care after taking pictures of the textures to center them. The crop tool in any image processor, along with guidance lines, will help that process enormously. Take our bricks below, for example. Although originally slanted, with a little keystoning....

Screenshot 2018 05 16 15 08 14

Screenshot 2018 05 16 15 08 22

Screenshot 2018 05 16 15 10 04

Screenshot 2018 05 16 15 13 56

Things become right as rain.

Once we've picked and cropped our texture, we have to start the process of preparing it for use in our video game. The core of that task is separating the color of the pattern from it's height or z axis (it's bumps, crenellations, etc....). With our pattern in photoshop, we save the file and call it “Alpha” for alpha texture. This will represent our colors.

Our goal for many of these steps will be to MINIMIZE or ELIMINATE the influence of lighting on our sample pattern. This is a reflection of reality: light sources are emittive and do not come from the objects which that light bounces off of. Light bulbs might be made of glass and filament, but if they're generating real light they are white, hot points with at most a color cast. A chair can sit in the dark. An active light, by definition, cannot.

black and white cartoon donald d


LED chair

This means that for our alpha we will want to limit the dynamic range of the file to represent actual differences in shade. We do this by using the spectrogram, which you can find and manipulate using either the “levels”, “curves”, or even just a contrast slider tool. We can also select small parts of the pattern and selectively change their coloring. We want things not to be too bright and not to be too dark, but rather middling. While reducing contrast is one way to think about it, what you are actually trying to do is bring high white and high black values closer together. If you would like to change the coloring of your pattern, now would be the time.

Screenshot 2018 05 16 14 00 46

Screenshot 2018 05 16 14 02 33

Screenshot 2018 05 16 14 04 46

Once we have our alpha texture we can move on to the normal map. Save another version of your original pattern and call it Normal, or N; whatever will help you remember what it is. We will immediately make it grayscale by turning the saturation all the way down. This will give us a black and white image which should roughly mirror the topography of the pattern. To make it starker, we do the opposite of what we did before: while we don't try to crush dynamic range, we still try to increase it as much as we possibly can. Our goal here is to capture as much detail as possible, but Unity can be variable in it's sensitivity to different textures. You may have to play around with it to get what you want.

Tutorial 01

Tutorial 02

Tutorial 03

We have slight shade issues from top to bottom, but the difference is too fine for selective changes. As such, we apply a blank (note BLACK!) and white gradient.

Tutorial 04


Tutorial 05

This lightens up our source more selectively. The final histogram looks something like this.

Tutorial 06

Two caveats to note: a plethora of wildly different colors will sometimes confuse the normal map and the pattern needs to look good next to itself. This is because ultimately the texture needs to be something which can repeat across the surface of an object: anything with huge differences between one side of the pattern vis a vis the other will make that very difficult.

Now that we have our normal and alpha, all we need to do is load them into Unity. This, thankfully, is very easy. What we do is import the two textures (just drop them in your file folders) and then make sure to set our "normal map" to be iterpreted as such in the inspector on the right hand side. Make sure to have the "convert from grayscale" option selected when you do. These are persistent effects that you can change at any time.

Screenshot 2018 05 16 12 30 01


That's it! From here on, we can apply our cool textures to anything and everything.

warningspin

Thank you for joining us, if you'd like to subscribe to the Timeforce mailing list or wish to learn more, please click here!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: