3ds Max: Exporting Transparent Textures
Tools used in this tutorial
Required |
What you need for this tutorial:
- 3D Studio Max v8.0
- Civ4 Nif Exporter
- DXTBmp (maybe)
- NifSkope (and knowing how to set up texture paths in nifs through it)
- Download Max Scenes=- for this tutorial.
It's a 7-zip archive. 7-zip is a freeware zip program which can be downloaded from 7-zip.org. It can achieve superior compression compared to any other zip program out there.
In most cases these days, us 3D Studio Max modelers use gundalf's exporter, which is a very impressive and nifty tool. Before gundalf created his exporter, we had to use the Civilization IV NIF exporter instead. The Civ4 exporter is a very competent tool, with an amazing set of options... that have no bearing on Oblivion. It does have a few unique capabilities, however.
One of them is it's ability to export doublesided textures, which for instance means that if you're making a sheet of treated leather you only need to have polygons on one side and then they are automatically mirrored on the other - which can save you a bit of work as well as save you hundreds of faces in your budget without affecting the visuals. That effect is most useful, in the few specific cases where it's needed.
Another, much more common use of the Civ4 Nif Exporter over gundalf's exporter, is its ability to export transparent textures. The point of them is to give the illusion of complexity without adding to the poly count, and when used appropriately they can yield fantastic results. Bethesda use the method all the time. The leaves of a flower is one case where it's useful, frizzy edges on a rug (which is the example of this tutorial) is another.
Go ahead and open up the tutorial scene in 3D Studio Max. You'll see a top-down view of a rug, which uses textures from the Morrowind texture replacement mod "Morrowind Visual Pack". There are three textures in play; one for the center (Rug01.dds), one for the borders on the long ends (Rug03bd.dds), and one for the frizz on the short ends (RugBD01.dds). If you examine the latter texture you'll see it looks like it has pink paint on it. This is the way the texture's alpha layer looks - the one that creates the transparency effect.
On a sidenote, if you would like to learn more about creating your own transparant textures, I'd like to recommend my old Morrowind Icon Guide. I wrote it years ago, for Morrowind modders in mind, on how to create icons for that game - but believe it or not, the same method works for creating transparent textures for use with Oblivion. All made possible by that little gem of a program, DXTBmp, which lets you create transparent DDS textures with a few easy clicks. It's especially handy for those of us - like me - who don't use Photoshop, though I imagine even Photoshop users would find the program has it's advantages.
The program, which is freeware and created by MWGraphics (no relation to Morrowind) can be downloaded from our database. Start by creating a texture where the part you want to be transparent is absolutely pitch black. Load it up in DXTBmp. Select "Alpha > Create Alpha Channel (Black)". If you get a popup, press Yes (some file formats, like tga I think, create defunct alpha channels by default, which the program replaces). Now the image is displayed in black and white on the small screen to the upper right. The visible part should be white, the invisible black. Now go to "Alpha > Apply Alpha to Image" and the black part will turn transparent grey in the main window. Lastly, go to "File -> Save as -> DDS Texture". The file format MUST be "DDS DXT1", otherwise it won't work. Presto, you're done.
Right then. If you haven't already, open up the material editor in the tutorial scene and check out the middle material slot, "Tx_Rug_FrizzyEdge". Notice it has two maps set up. Usually when modeling Oblivion models you only set up the Diffuse map, since that's the only one that can be exported. In this case, when we want to export a transparent texture through the Civ4 Nif Exporter, we'll make use of the Opacity map slot too. As you can see, both the diffuse and opacity slot uses Image Alpha as the Alpha Source, *but*, the diffuse slot uses RGB Intensity as the Mono Channel Output whereas the opacity map uses Alpha as the Mono Channel Output. This is what makes it work.
Notice that in the material editor slot for Tx_Rug_FrizzyEdge there is a checkbox called "2-Sided"? If you check the box, you get to export the two-sided textures I mentioned above. It's not checked on this model because the player can never peek under the rug. If he could, he'd also notice it doesn't have an underside, so. No peeking. But if you're interested in doublesided textures I thought I'd mention it, since this is probably the only tutorial I'll write relating to the Civ4 Nif Exporter.
You might also notice that both the maps are rotated minus ninety degrees. This is just a technical solution I happened to choose when mapping the rug and doesn't have any bearing on the technique. You can control the mapping to different extents in two ways, either in the material editor or in the uvw mapping modifier on your model. The latter is usually best, but doing it in the material editor means you can for instance manipulate the maps on collapsed and/or attached meshes. That's not the case here, but... oh well, it doesn't matter *whistles innocently* Both ways can be exported.
Keep in mind that the Civ4 Exporter can't export collision, meaning you should only use it on models that don't need it. Rugs don't, for instance, because the player can't pick them up and since they lie flat on the floor it doesn't look odd at all that he walks inside them, since it's not very obvious in-game. Plants are another example, assuming you don't mind that the player can't pick ingredients from them, seeing as the player can walk into Bethesda's plants as well. Which is a good thing, because you don't want players getting stuck on carrots or walking on strawberry bushes.
If you haven't used the Civ4 Exporter before you may be unaware of the fact that it doesn't export texture paths correctly. You need to open your nif in NifSkope and set them up manually. The textures I use are usually in a folder called "ST" in the "textures" folder, so I paste
textures\ST\
to the right of the flowers.
You're free to use my rug mesh if you like, if you credit me. :D
To learn how to enable multilayered opacity, see my next tutorial.