goto AutomaticCourseGeneration for faster simpler method

3D Model Course Designing Tutorial

In this tutorial we will use the MilkShape version 1.7.7a  modeling tool.  GGS is now being shipped with this tool but in case you don't have it you can download it free of charge direct from the developer at www.milkshape3d.com. However, you can use any other 3d Modeling tool if you prefer. Details of how to make courses in 3D Studio Max 8 will soon be published on this site. 

To create new courses from 3D Models for the GGS golf simulator, the following files are required for each hole.    

        File naming convention is standard GGS. ie  The first 2 characters in the file name are the first 2 characters in the name of the course you choose.
        e.g. if the course name you choose is “Augustin” then “Au” is used.
        This is then followed by the string “TerrainModel”.
        And finally the hole number e.g. “4” if it is the hole number 4 you are defining.
        The final file name with the file extension is then “AuTerrainModel4.3ds”

        In order that GGS loads and renders 3dStudio terrain models the "Use 3d Models when exist" option in the Setup/Graphics section must be set on.

Why a Height Map when the 3d Model already contains height values?

The height map is used by GGS to determine terrain height at any x,z coordinate on the course. This information is required so that the golf ball follows the terrain when hitting or rolling on the ground. In order that the ball follows the terrain smoothly the height map must be high resolution. At least 2 million plus entries are needed which, if contained in the 3D model, would make the model impossible to render in real time.

A big advantage with using a 3d model as a base to render the terrain is that we can utilise a method known as Level of Detail. This method allows us to define more polygons where needed - as in complex terrain - and less where the terrain is more flat.

In so doing, the 3D model only contains height values where polygon vertices exist which, although ideal for rendering, is not fine enough to be used to determine terrain height in high resolution.

Terrain generation 

To create terrain you have basically two choices. 

  1. You create the terrain in a gray scale map using the air brush tools in Photoshop.(see Step 4: Create the Height map in Course Desgning Tutorial)
  2. You create the terrain in the 3D model using the modeling tool's capabilities. 

Depending on what modeling tool you use, these capabilities will vary. Vue 5 and WorldBuilder offer good terrain editing tools and are powerful enough to handle large high resolution terrain maps.

MilkShape on the other hand can't handle such large high resolution terrains so it is not so suitable. Here you will have to resort back to the Photoshop gray scale method.

However, making terrain directly in the 3D modeling tool is still a somewhat complex and time consuming process so you may want to create the terrain in a simple graphics tool anyway. If only to save time.

If you make the terrain in the 3d Modeling tool directly then you will have to additionally export the terrain to a gray scale map (8 or 16 bit). So make sure the tool has this cabability. WorldBuilder  and Vue 5 can do this very well.

As this tutorial will be using the MilkShape 3d modeling tool we create the gray scale map using the air brush tools in Photoshop.see Step 4: Create the Height map in Course Desgning Tutorial)

Coordinate system

GGS uses the above shown coordinate system as does OpenGL, Microsoft and Milkshape which seems very logical. However, most other 3D modeling tools reverse the y and z axis because it's supposed to be internationally acceptable. Beats me why this should be but you should be aware of it because if you create 3D models in one of these other tools, your model will be displayed on it's side when rendered in GGS and Milkshape

Note: 

You can flip the model over directly in MilkShape:

To flip the model from it's side we need to reverse the y and z vertices with the MilkShape Rotate tool. To do this first select the entire model, press the Rotate button and enter 90 in the Y and Z edit boxes. When you now press the small Rotate button on the right the model will flip over correctly. Save the file via the export, 3ds option.

OK. Now on with the tutorial...

Step 1. Create surface recognition map

As with the standard GGS method of creating golf course holes, you should make the basic hole layout in a standard graphics tool first. See Step 2: Create surface recognition and object map  in the standard method tutorial for details.

Step 2. Create Height Map

As previously mentioned, you can create this in a 3dModel tool and export it to a bmp height map or just create it with Photoshop. See Step 4: Create the Height map  in the standard method tutorial for details.

Step 3. Start the MilkShape 3d modeling tool. (Please ensure that it is the latest version 1.7.7a)

Apart from the image in the window on the bottom left, MilkShape should look like this when you first start it. Four view windows are shown. Front, Back, Top and 3D views.

Each window's view of the object can be selected with the pull-down combo box in the top right hand corner of each window and you can maximize each window by clicking in the window and pressing the space bar.

Step 4. Load the template image.

The image in the top view window (bottom left here) is our surface image file. It will be used as a template.

Load this image by right clicking in the Top View window and selecting the Choose Background Image ... item.

Browse and select your Surface Recognition map bmp file.

Select offsets to 0 and  Scaling to 0.50 for both X and Y.

Step 5. Load the height map

As mentioned before, Milkshape can't load a high resolution height map model (ie 1024 * 2048 vertices) but this is ok because GGS can't render such a high polygon count model in real time either ( nor, for that matter, can any other graphics engine on a standard PC. At least none that I know of.).

So in order to load the height map we have to scale it down a bit. 

To do this, load the height map in Photoshop, select Image/Resize and resize it from 1024/2048 to 64/128 pixels and save it to a work file (ie AuHeight1small.bmp.) or any other name you choose.

In Milkshape, select the Height Map Generator from the Tools drop down menu 

(note: this tool is only available as of Milkshape version 1.7.7a so make sure you are using this or a higher versioned one. If not then down load from www.milkshape3d.com.)

 

Press the Load Height Map button and select your new scaled down height map. Press OK.

 

Your height map should now be displayed in Milkshape similar to the above screen shot.

You should take a while to read the MilkShape help files but I can give you a few tips on how to navigate the images here.

Select a view window by clicking into it.

To zoom in out use the mouse wheel. Hold the shift key down at the same time to zoom fast or 

Mouse drag zoom by holding the shift key down and draging the mouse cursor up / down in the view window.

Hold the ctrl key down and left mouse key to drag move the model.

Press the space bar to miximize/minimize a view window.

In the 3D view window you just have to mouse drag to rotate the model.

Select the Window/Viewports menu item to choose the number of view windows and sizes to be displayed on your screen.

Right mouse click in window to show the view window properties.

Most of the time in the 3D window you will use either the Smooth Shading with WireFrame Overlay or the Textured mode. At this stage we don't have any textures defined or assigned so you  won't see any change if you select this now.

Step 6. Scale the model to fit the course background image.

Here the model (in Red) is only 1/8 th of the backround course image.

When we loaded the course hole background image we loaded it half size by setting the scaling to 0.50. So our image went from 1024* 2048 to 512* 1024 pixels. Our Height map model however was scalled down to 64*128 pixels. (only a 16th of it's original size). In so doing we reduced the polygon count to suit MilkShape and GGS which is what we needed to do. To get the model to the same scale as the image we therefore have to scale the model by a factor of 8. This process doesn't increase the polygon count. It just scales the existing polygons.

To do this, press ctrl/A to select the complete model (or Edit/Select All). Select the Model Tab, select the Scale button in the Tools box and set the xyz values to 8,4,8 and then press the Scale button in the Options box. The model should now fit the course background image.

Save the model by selecting File and Save. The model should be saved as the ms3d type file. You can name it as you want at the moment because it's just a work file. In fact you should save your work regularly to different work files just in case you make a mistake. That way you can reload an earlier model work file if something goes wrong so you haven't lost all your hard work.

Step 7. Setup the Level Of Detail.

GGS is a real time graphics engine, however, in order to accomplish this the total scene polygon count should be kept as low as possible without degrading image quality too much. Too many polygons will require more graphics processing time and will therefore slow the scene rendering frame rate down so that scene movement will become jerky. (or even none existent). Professional landscape modeling tools like Vue 5 and WorldBuilder, althhough excellent tools, can require 30 seconds and more to render just one scene. For real time rendering we need to render at least 24 scenes every second! (so you only have around  0.04 seconds to render the complete scene. That's 750 times as fast!)

We loaded the height map with a bmp file size of 128 * 64 pixels which is equal to 8192 vertices and 16384 triangle polygons.

When loading into MilkShape the vertices were used to make a uniform grid mesh. 

This uniform grid mesh doesn't account for any Level of Detail so that too many polygons exist where not needed (ie Pond base) and not enough where more detail is required (ie Pond Banking, Bunkers etc).

Fortunately there's a MilkShape plugin tool that can make out of our uniform grid mesh a Level of Detail mesh

To do this:

  1. Select the DirectX Mesh Tools from the Tools menu in MilkShape.

  2. Drag the mouse down over the model image to turn it towards you.

  3. Move the slider bar to set the polygon count to about 10000.

  4. Press the Save button (diskette image)

You will now see that unnecessary polygons have been removed - where terrain complexity is low (ie Pond Base) - and replaced with larger ones.

Our polygon count for the same image quality has now gone down from 16,384 to 10,000.

You can check this is the 3D window with soft shading switched on if you like.

We can also reverse this process where terrain complexity is greater and  where we need to generate more polygons.

The DirectX Mesh Tool also allows us to increase the polygon count but this doesn't give us enough control. It will divide all existing polygons by a factor 2, 5 or 7.

A more controlled method is to simply select the polygons where terrain complexity is greater and use the MilkShape tool to divide them by a factor (2,3 or4).

 

Select the polygon faces where terrain or surface boundaries require an increased polygon count.

Select the Face pull down menu and select Subdivide 4 to make out of each selected polygon, 4 polygons.

You can do this it any stage in the design so leave it for the moment until the areas have been selected and textured and you can see the results of the existing poylgon resolution when rendering in GGS. 

Continue on with tutorial part 2 ...