A Simple First Megatexture

From Mod Wiki
Revision as of 15:20, 11 December 2007 by MoP (talk | contribs)

So now that you've made A Simple First Terrain, no doubt you'll want to apply a MegaTexture to it! This MegaTexture won't be as detailed or as attractive as an advanced MegaTexture, but will demonstrate the basics of creating a Surface Tree, assigning textures, and compiling it all into a working MegaTexture file.

Introduction

For this tutorial you must:

  • Have a terrain model UV-mapped in the 0-1 range (covered in the simple first terrain tutorial)
  • Have access to some tiling textures. TODO: Link to MegaTexture media!
  • Have a little understanding the ETQW material system

If you don't have either of the above things, you are not ready to do this tutorial!

This tutorial covers:

  • How to set up a MegaTexture material
  • How to create a Surface Tree
  • How to add texture nodes in the Terrain Editor
  • How to render and compile a full MegaTexture

This tutorial does not cover:

  • How to use Blender/Maya/Lightwave/ZBrush/Mudbox/3DSMax/Photoshop
  • How to create tiling textures or heightmaps
  • Anything overly complicated


Creating a MegaTexture Material

Firstly you need to create a new material for your terrain to use. If you have never made a new material before, read the article on Adding Custom Textures. All you need to do is create (or use an existing) .mtr file and place a material declaration in it, in the manner shown here:

material megatextures/mapname		{ useTemplate megatextures/default_ambient< "mapname" > }

This material would automatically search for a MegaTexture called mapname.mega in the /megatextures/ folder. This example material uses the "default_ambient" template, which expects a 3-channel RGB MegaTexture. These are generated by the default settings of the MegaTexture tab in the SDK Launcher.

Obviously you would want to use the actual name of your map instead of "mapname", for consistency's sake and ease of reference.

Remember that if you made a new .mtr file after the game or editor was started, you'll have to restart the whole game and editor before it will read your new file.

Assigning the Material

You should assign the material you just created by naming a material in your 3D application and applying it to your terrain mesh, then export the model to your preferred format (LWO, ASE or OBJ). Tips on this process can be found in the simple first terrain tutorial.


Creating the Surface Tree

As described in the Simple First Terrain tutorial, terrain models are set up in the Terrain Editor, accessible via shiftN in editWorld. This tool creates a Surface Tree file (.sft) that contains all the information about the terrain, including roads, stamps, and detail texture information that MegaGen needs to generate a MegaTexture.

Add the Terrain Mesh

Root node set up to use the correct terrain mesh

Here's how you bring the terrain mesh into the surface tree:

  • RMB on the left-hand pane, and choose New -> Tree via the menu.
    • If you already have a Root node, click the "Begin Editing" button instead.
  • Click on the Root node, and set Model to the name of the terrain mesh, in this case models/terrain/simpleterrain.obj.
  • Press enter to confirm the selection, and the terrain should appear in the 3D view.

Be aware that your terrain model will probably appear bright orange or red. The console will probably give you a few WARNING messages, don't worry about these for now, this is because your Megatexture doesn't exist yet!


That's it!

File:Simple mega ingame.jpg
The MegaTexture in-game!

You've now created a map with your very own MegaTexture!


See Also