The Ten Commandments of Texture and Color

"With all my resources I have provided for the temple of my God - gold for the gold work, silver for the silver, bronze for the bronze, iron for the iron and wood for the wood, as well as onyx for the settings, turquoise, stones of various colors, and all kinds of fine stone and marble - all of these in large quantities." (1 Chronicles 29:2, NIV)


I.
Introduction - All Punch! creations are confections created out of sheets of pure light (talk about a light dessert! Heh, heh). They are created and delimited by mathematics, but they are - simply color. There is nothing more to them. In fact, if there is any pattern to them, that pattern is visible from both sides, one side being the mirror image of the other, as if painted on glass, and then the glass removed. This artifact is not usually seen in Punch! because most objects in Punch! are solid (that is they have two or more "sides". The "substance" of these sheets is pure color or texture. Color is pretty obvious; texture is a pattern of differing colors; usually the pattern is repeating, and consists in a tiled series of rectangular images. It follows that a surface in Punch! can be colored or textured, but not both.
II.


Standard Textures - Punch! delivers a fixed set of textures with the software (see The Ten Commandments of Content). They are organized into a single-tiered set of categories; for example, there are categories for bricks, another for groundcover, and another for sky patterns. There have been some minor changes through the Punch versions, but in the main, the categories and the individual textures have remained fairly constant through the versions. These categories are "hardwired" into Punch! in such a way that neither the categories nor the number of textures in each category can be changed. Therefore, up until AS4000 (version 8.0.0) the textures have been fixed in place, could not be recast or added to. It has been possible to substitute a new texture for an existing one, but of course, that change would have been reflected in all models that used the old texture, including some that are beyond the user's control, such as the floor texture used in the shower installed by the shower tool in the plumbing tab. For this reason, Punch! has never officially published a procedure to do the substitution, even though it has not complained about others doing so (as we will do below, for instance).
III.


Custom Textures - In AS4000 Punch! has finally given the user the ability to create their own textures (or "materials", as Punch! prefers to call them). The user can now create textures using the Materials Workshop PowerTool, which places them in a user-defined two-tiered category system. Note that this does not mean that user textures can be mixed into Punch! categories, though the reverse can be done. The Punch! categories are still hardwired. The user categories are added-on. Note also that if you define new textures and them use them in your model, if you take your model to another Punch! system those textures will not be available. Punch! uses a very annoying yellow texture with a large black exclamation point if it cannot find a user texture.
IV.


Implementation - A texture is defined by three files. One holds the picture of the texture (called the "sample"), a second describes the texture, and a third is a small picture of the sample that is used in the menu "thumbnail". All three of these files have the same name, with differing extensions (the extension is the three character suffix added after the name and a dot character). In the Punch! standard textures the files' name is derived from the Punch! category and a serial number. For example, sky1 is the filename for the cloudy sky that Punch! uses by default, and ground is the grass. The extensions are also standardized. The sample is in sky.pt (for the cloudy sky), the description in sky.pt, and the thumbnail in sky.ppv.
 
.bmp files are universal in Windows, but they were not the graphic format of choice for the World Wide Web, and officially, web browsers don't handle bmp files. However, if you should take a .ptx file, rename it with a .bmp extension, and drop it on either IE or Firebox, the graphic will be displayed, just as it will for acceptable .jpg, .gif and .png files.
 
The .ptx and .ppv files are both files in the Microsoft bitmap format. In common use they usually have the extension .bmp or .dib; they are simply renamed with the extensions that Punch! expects. The sample is always either 256 x 256 or 512 x 512 pixels in size; the thumbnails are always 50 x 50 pixels. The sample may be an 8 bit, 16 bit or 24 bit bitmap. Those into math can see that the samples take up between 65KB and 780KB, depending on the options. Bitmap files can be easily edited with an image editing program like Paint Shop Pro, Photoshop or even MS Paint.
 
The .pti file is a text file and can be edited with a common text editor, such as NotePad. It is formatted in the MicroSoft ".ini file" format, in which lines of text are separated into named categories, and each line is of the form "variable=value". For example, here is the .pti file for the first brick texture, in file Brick1.pti:
 
[Size]
Width=100
Height=100
 
[Description]
Name=Brick, Rusty Red
 
There are two categories used by textures, "Size" and "Description". The lines used by Punch! in the Size category define the number of inches, horizontally and vertically, the sample covered on the original wall. These numbers allow Punch! to recreate the bricks in a realistic size on the LiveView wall. The line under the Description category is pretty much self-explanatory. That name will be displayed on the status line whenever a user rolls the mouse cursor over the thumbnail in the texture menu.
 
P.S.: Plants are handled as textures, and the files are stored in subfolders within the "Textures" folder. In all ways they are the same as Textures - the same three files with essentially the same content. The .pti text file uses other descriptors than textures do, however. Opening an existing plant's .pti file will show you what information is stored within. ALso, the color black (RGB (0, 0, 0)) used in the image file has a special meaning - black pixels are rendered as transparent. Creating a useful plant image therefore involves blacking out all the background pixels in the image (and can also be used to create textures with "holes" in them, which is sometimes useful for creating screens or the like).
 
Some people - and I've seen this advice in the Punch! forum - get clever and leave holes in their plants between the leaves by painting them black-transparent, thinking this increases the realism. My advice is not to leave holes; where holes would be, paint with a near-black color, like RGB (0, 0, 16). The reason is that in nature, holes in plants usually allow one to look into shadowed, relatively dark areas. In Punch!, where all objects glow of their own light, the areas behind or under a plant are bright, and shine through a hole like a flashlight, giving an unreal appearance. Hance coloring them dark, to simulate shadow.
 
[Note hot off the wire - in version 10 Punch! no longer distributes .ppv files with its textures. What they do instead, in version 10, is reproduce a copy of the main sample in reduced size, making a thumbnail on the fly rather than having one pre-canned. This works for textures and plants, but will not work for objects.]
V.


Texture Substitution - So, to create a substitute texture for a Punch! texture (or plant), one only needs to create the three files for the new texture, naming them the same as the three files for the texture that is to be replaced (after hopefully renaming the target files so they are still available for putting back in place at a later time). Punch! doesn't care what the contents of the file are, only that they are formatted in the proper manner, and goes ahead and replaces the thumbnail, the displayed description and uses the sample in the drawings at the specified size.
VI.


Materials Workshop - The custom textures created with the Materials Workshop have the same three files; the only difference is that they are placed in the user categories (defined by the user) and are named by the user. One might infer that a user could create a texture in the same old ways that users in the past have created then, and then simply stick them into the category hierarchy, just like they used to for Punch!. And this is true, it can be done without the good offices of the Materials Workshop. The only fly in the ointment is that the Materials Organizer won't see the new texture, because it keeps a separate database of custom textures, which the Materials Workshop makes an entry into when it places a new texture in the user's space. We won't discuss the details of that here; it would be too easy for a user to permanently disable the materials organizer by messing around in the database.
VII.


Texture Mapping - The textures are applied to the surfaces in such a way as to preserve the surface geometry. When they are displayed they show perspective effects, as one would expect them to do. They are wrapped around edges when that is appropriate, so the patterns match along the edges. The incorrect mapping of textures is most obviously seen in roof panels and bookroofs, and is manifest in several ways. Mapping at 45 degree angles and mapping at extremely high and low pitches are all results of the same problem, which can also be seen in certain 3D objects.
VIII.


Color - Colors in Punch! are handled from two palettes. The first is Punch!'s version of the classic color wheel, giving the user access, potentially, to the entire 16.7+ million colors that current PC technology is capable of (known as True Color). These colors are quite close to the limit of the human eye to discern colors as well, at least colors that are reproducible on a monitor screen. The other palette is a series of swatches which yield colors someone thinks is appropriate to the four seasons, 12 colors for each, followed by twelve "contemporary" (read bright) colors, and then twelve grayscale colors. The color that walls and objects have by default, by the way, is the fourth gray scale value from the top of the menu, a light gray.
IX.


Shading - Colors and textures in Punch! are modified when applied to a surface by a shading algorithm. If you paint a simple wall with a color, you can see that the color varies from light at the top to dark at the bottom. This is also true of the trim texture on the wall's trim, as a close inspection will show. Humans are used to surfaces shading, it's one of the clues that the brain uses to build a 3D model based on the 2D vision each eye sees, and makes it possible to walk down a corridor and into a doorway without hitting the wall.
 
Punch! shading is not entirely natural - in fact, it is completely unnatural, being based not on lighting sources and angles, as it is in the real world, but rather on distance across a surface and arbitrary shading directions. However, an untrained eye picks it up and comments on the unexpectedly realistic 3D way Punch! models look. Achieving real, natural shading is a hot topic in computer graphics. After all, you cannot do realistic animation without it. The thing is, it's expensive. The film "Final Fantasy" from which this pic was taken, released in 2001, was wholly animated, and realistic to the state of the art, and cost $140 million to produce, much of which went into computer time. The shading that Punch! uses is not realistic, but it is cheap.
 
If the shading bothers it can be suppressed by simply changing the Intensity lighting control. Running it up to full intensity displays the colors modified only by the brightness control. You can also see that the picture losses it's "Wow! 3D!" factor.
 
One color is magical in all the 16+ million colors. The darkest, most absolute shade of black has a special meaning. Pixels colored this color are turned transparent rather than black. In this way a rectangular image can be shaped to be a tree or a set of drapes around a window by coloring the parts that are not tree or drape this absolute black; when they are displayed they will be turned transparent and won't interfere with seeing what is behind them.
X.


Materials Painter - Before Punch! had the Materials Workshop it had the Texture Customizer. The TC came out in Platinum 4.5 in an effort to satisfy the need for more textures than Punch! supplied. Using the TC, a user could take one of the Punch! textures and tint it, by darkening any or all of the red, blue and green primary colors (what, you thought the primary colors were yellow, red and blue? Nope, not when you are mixing light rather than Crayons). This was OK to an extent, but changing a gray brick wall to some other color played havoc with the cement lines, as they changed as well. The TC could also change the sizes that the texture represented in the real world, allowing for, say, longer bricks than the normal size. When The Materials Workshop was released in AS4000, the TC was retired - mostly. The problem was that the TC was a component of Platinum 4.5.x, and when Platinum 8 was developed, switching to the Materials Workshop would kill any use made of the TC in the earlier tool. The resolution to the problem was to build the TC as a new PowerTool called the Materials Painter, and release that with Platinum 8. Then if the user wanted to upgrade to the Workshop, that could be done by simply buying it and replacing the Painter. The Painter actually creates new textures indistinguishable from those created by the Materials Workshop; it is just that these new textures are limited to modifications of the standard ones.
 
BTW, even though customized textures is no longer officially supported in AS4000 (and likely into the future as well), such custom textures are still rendered properly.
XI.


Good Texture Images - Not every image makes a good texture. Here are some of the things that need attention applied in order to create a pleasing texture:
  • The picture must be square. The Texture Workshop will make sure in the end that it is either 256x256 or 512x512 pixels in size before saving it. If the pic is not square a stripe may appear along the edge of a finished texture.
  • The picture should not differ significantly from edge to edge (in any direction) or from the middle.
  • Even lighting is very important in a good texture. Again, it should be even side-to-side in every direction. It should leave shadows where there is relief (as in a corrugated metal sheet) but the shadows must all be of uniform direction. The light source should be far off beyond the upper left of the image; avoid close-in point sources, such a naked flashes. The shadows should not be overly deep; the lighting should be somewhat diffuse.
  • Randomness in the fine grain of a surface is pleasing; unfortunately, the tiling of a random pattern doesn't lead to overall randomness, as you can see with any tiled pattern when you pull back from it. This can be overcome to an extent by making the texture cover more real area on the surface (a 6'x6' square rather than 4'x4', for example, but that requires a bigger tile (512x512, rather than 256x256) at four times the disk space and additional rendering time. It doesn't help to internally tile a texture (using four copies of a texture at 256x256 to make up a 512x512 image, for example).
  • Avoid colors and shadows so deep they verge on true black (RGB (0, 0, 0)). Pixels of pure black will appear transparent when rendered. CHange them to an off-black like RGB (0, 0, 12) to avoid this.
  • It is impossible to create a texture so fine that it will not pixelate (break down into colored squares) if the surface it is on is approached close enough, but a pixilated texture when viewed at a few feet in distance means the original picture was not fine enough in detail to accomplish the goal. FInd another image to use.
  • After all the above requirements are fulfilled, then you have to worry about making the image seamless, which means making it so that the tile seams aren't obvious when the tiled surface is inspected. This is a whole field of artistic merit on its own, and one I won't get into here.
  • Punch has made it possible to have textures which are stretched to fill a space rather than being tiled. These, of course, don't have the requirements above (except for the first one).

Home || E-Mail

This page last updated on Fri Sep 22 2006
This page, and all contents except as noted, are Copyright©1999-2006 by ThistleKeep Engineering.
"Punch!" and other titles of Punch! operations, such as PhotoView, PowerTool and 3D Custom Workshop
are trademarks of Punch! Software L.L.C.