Track Making

How to create cars and tracks, instructions, tips, etc

Track Making

Postby Eugene Cojocar » Sat Oct 20, 2012 3:24 pm

XMR Editor allows prepare tracks and cars and insert into the game.
You can import any 3d model (whole track/car or single object like tree, house, driver body, tire etc) from 3dmax. You can also create your own track without 3d max.
Tracks and cars are saved in different ways.
File types.
.tdo – single or some objects of track/car/object
.wld – world project that contains system info about scene.
.we – world environment that contains all materials, markers, cameras, lines etc
.trc – texture packet. All textures must be as .tga files.
.mtl – materials of scene/car that can be imported/exported
.mss – markers of scene/car that can be imported/exported

A typical algorithm of creating track:
1. Creating 3d model with textures in 3d max, but without materials. XMR editor uses its own material system. Make sure that a track has a natural size, where 1 meter = 1 meter.
2. Each object can contains only one texture to improve performance of the game.
3. Exporting a track from 3d max as .tdo to XMR Editor with export plug-in (can be found in ..XMREd\3dmax_export_plugin folder).
4. Converting from a single .tdo file to a track project.
5. Insert of additional objects like trees, stones, etc.
6. Setup of graphic materials for all objects.
7. Setup of physics properties for all objects and polygons.
8. Setup of lighting and shadowing.
9. Generating shadows.
10. Creating of starting grid.
11. Checking for the Null Objects (in the menu->Tools->CheckForNullObject) and delete them (with the key Del or from the context menu->Delete).
12. Exporting to the game.

A sample that contain .max, .tdo and ready files can be download here:
http://www.mediafire.com/?gymrgmk04agu9jk

A short video tutorial:


Updated version:
Last edited by Eugene Cojocar on Fri Dec 07, 2012 8:46 am, edited 6 times in total.
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Sun Nov 11, 2012 7:07 am

At first we have to create a basic 3d model of the track in 3d Max or similar software.
XMR Editor allows create tracks from the scratch but it’s more convenient to work with familiar software like 3d max.
Export scene as .tdo file. Before this you must copy an export plug-in from XMREditor\3dmax_export_plugin to your 3dmax\stdplugs directory as .dle files.

Image

Then run XMREditor and open just exported file as .tdo.

Image

Then we need to convert single .tdo file to world project.
Open from the menu World->ConvertToWorld.
After that you can see a dialog where you should define numbers of blocks (default values of 16 are quite enough for most scenes).
Type your project name and its parent directory and press Convert.

Image

Close XMR Editor (or all windows) and run it again.
Open your just created world project as .wld, but not a single .tdo file.

Image

After loading you can see something like this if default textures are not assigned.
You can configure your camera from the menu for more comfortable work.

Image
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Sun Nov 11, 2012 7:11 am

The next step is preparing texture packets for the track. These steps are similar like for cars:
http://www.xmotorracing.com/forum/viewtopic.php?f=10&t=30

You can use .tga file as textures with size 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 or 4096 pixels.
1. Create a sub-directory in your track directory and call it Textures for example \\Track30TestingArea\\Textures.
2. Copy all .tga files you need to this directory
3. Copy files texPacker.exe and tpack.ini from \\XMREditor\Textures Utility to this directory also.
4. Run texPacker.exe. It creates MyPack.trc or any file .trc that can be loaded into XME Editor. You can define your own name of texture packet in tpack.ini file.
5. Open Texture Manager from menu.
6. Open you texture pack that your just created - MyPack.trc and save the scene. Next time when you open the scene these textures pack will load automatically.
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Fri Dec 07, 2012 8:12 am

Here's the 3ds max script to detach multi-texture objects automatically.
http://forum.radiators-champ.com/t273-detachbyid-script-to-detach-multimaterial-objects
The way to detach all objects:
A common method I use is:
1) open the layer window
2) create a new layer called Layer01 (this is automatically set as the default layer for the newly created objects)
3) select groups of objects and detach them.
NOTE: objects will move from default (original) layer to Layer01. default layer will always contain objects still to be detached.
4) save often in a new file. This will prevent to loose your work if max crashes (happen often if you don't have enough RAM, and you select too many objects.


The script

Code: Select all
/*
Detach by Material ID
Version: 2
by Jefferson Lim
Terabye Inc./ Shirogumi Inc.

[features]
Detach Polygons based on its Material ID
- works on a selection of objects
- Options to name detached objects
- material propagation
  - this will assign a corresponding material by id to the detached object

[usage]
1. select any number of objects
2. set the desired paramteters
3. optional: if you know the maximun number of ids the object has
   set the Max IDs to help speed up detachment.
4. press detach

[Internal Operations]
Procedure:
- object[s] is/are copied
- then collapsed to an editable poly
- faces are finally detached by material ID

Naming:
- "Numbered"
  - will creae numbered names
  - e.g. 0,1,2,3
  - preferable to use with the Prefix option checked
- "Bitmap Name"
  - if not diffuse bitmap found, it will use the material name
  - if no material applied, it will use the object's name
- "Material Name"
  - if no material applied, it will use the object's name
- "Object Name"
  - will create a unique name based on the object's name
*/

try(destroyDialog detachByID)catch()
rollout detachByID "Detach by ID" width:140 height:250
(
local name_type = 1
local the_polyobj
local ran_color = true
local the_name
local the_mat_arr = #()
local id_list = #()


   label lbl_maxids "Max IDs:" pos:[10,190] width:55 height:15
   GroupBox grp_naming "Naming: " pos:[5,0] width:130 height:125
   GroupBox grp_prefix "" pos:[5,75] width:130 height:50
   GroupBox grp_ops "Options:" pos:[5,125] width:130 height:90
   
   radiobuttons rb_naming "" pos:[10,15] width:107 height:64 enabled:true labels:#("Object Name", "Material Name", "Bitmap Name", "Numbered") default:1 columns:1   
   checkbox chk_prefix "Use Prefix" pos:[10,85] width:70 height:15 checked:false
   edittext edt_prefix "" pos:[5,100] width:125
   checkbox chk_prop "Propagate Materials" pos:[10,140] width:120 height:15 checked:true
   checkbox btn_del "Delete Original" pos:[10,155] width:120 height:15 checked:true
   checkbox chk_rancolor "Random Wire Colors" pos:[10,170] width:120 height:15 checked:true
   spinner spn_maxids "" pos:[70,190] width:60 height:16 range:[0,99,99] type:#integer scale:0.05   
   button detach_bot "DETACH" pos:[5,220] width:130 height:25   
   
   fn getMaterialIDs obj =
   (
      id_arr = #()
     
      for i in 1 to spn_maxids.value do
      (
         obj.selectByMaterial i
         the_faces = getFaceSelection obj
         if (the_faces as array).count != 0 do
         (
            append id_arr i
         )
      )
      id_arr
   )
   
   fn getMatTextureName mat =
   (
      local the_map_name = the_polyobj.name
     
      try
      (         
         bmp = mat.diffusemap   
         if classof bmp == Bitmaptexture then
         (
            the_mapfile = mat.diffuseMap.bitmap.filename
            the_map_name = getFileNameFile the_mapfile
         )
         else
         (
            the_map_name = mat.name
         )
      )
      catch()
     
      the_map_name
   )   
   
   on rb_naming changed val do
   (
      name_type = val
      the_name = edt_prefix.text
   )
   
   on edt_prefix entered txt do
   (
      the_name = txt
   )
   
   on chk_rancolor changed val do
   (
      ran_color = val
   )

   on detach_bot pressed do
   (
      undo "Detach by ID" on
      (
         the_sel = selection as array
         if the_sel.count != 0 do
         (
            for obj in the_sel where \
            superclassof obj == GeometryClass and \
            obj.material != undefined do
            (
               try(convertToPoly obj)catch(exit; print "DetachByID: Error Occured on Object Conversion")
               the_orig = obj
               the_polyobj = copy the_orig

               the_mat = obj.material
               id_count = the_mat.numSubs
               id_list = getMaterialIDs the_polyobj
               
               -- start detaching
               for i in id_list do
               (   
                  the_polyobj.selectByMaterial i
                  the_faces = getFaceSelection the_polyobj
                 
                  case name_type of
                  (
                     1: the_name = uniquename (the_polyobj.name)
                     2: the_name = uniquename (the_mat[i].name)
                     3: the_name = uniquename (getMatTextureName the_mat[i])
                     4: the_name = uniquename the_name
                  )
                 
                  if chk_prefix.checked do the_name = edt_prefix.text + the_name
                  polyOp.detachFaces the_polyobj the_faces asnode:true name:the_name
                  theDetachedObj = (getnodebyname the_name)
                 
                  if isValidNode theDetachedObj do
                  (
                     -- added try-catch to catch Rollout Handler Exception in case the object has only one material (e.g. material had already been detached) -- by Juha Pyy
                     try(if chk_prop.checked do theDetachedObj.material = the_mat[i]) catch(print "DetachByID: Unable to convert: ReferenceTarget:ReferenceTarget to type: Material")
                     if ran_color do theDetachedObj.wirecolor = random black white
                  )
                 
               )-- end detach loop
               
               if btn_del.checked do delete the_orig
            )-- end object check loop
         )-- end selection loop
      )-- end Undo
   )-- end button press
   
)
createDialog detachByID style:#(#style_sysmenu,#style_toolwindow)



/*
[2.0]
2008-12-09
- added material propagation
- faster detachment procedure
  - old script was looping through every face to look for IDs
  - the new procedure will only search thru the <Max IDs> set by the user
- cleaned up code
- reworked UI

[1.0]
2005-05-24
- initial public release

[to do]
- make a more intuitive naming option
- save settings to ini file
- add progress bar

[notes]
- script request by Eye of Hawk (CGTalk)
- "Propagate Materials" feature request by titane357 (scriptspot)
*/
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Fri Dec 07, 2012 8:25 am

If you want to add a replay camera select in the menu->Camera->ReplayCamera->AddSceneCamera(Replay).
Then its possible to change its properties and change location/orientation in the menu->ReplayCamera->UpdateReplayCameraByViewPort and UpdateViewPortCameraByReply.

FOV means start and end deltas of the FOV for replay camera.
For example, when your replay camera begins work its FOV = default in game FOV (80, for example) + Start FOV = 80 + (-40) = 40 degrees.
When your camera finishes work its FOV tends to FOV = default in game FOV (80) + (-60) = 20 degrees.
The camera interpolates the FOV during its working period between 40 and 20 degrees.
Last edited by Eugene Cojocar on Fri Dec 07, 2012 9:36 am, edited 1 time in total.
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Fri Dec 07, 2012 8:42 am

Starting grid can be defined with the markers.
Marker 0 defines the initial position of the first car.
Two markers - 0 and 2 define the initial direction of the first car.
Marker 1 defines the initial position of the second car.
Two markers - 1 and 2 define the initial direction of the second car.
Marker 2 defines the initial position of the third car.
Two markers - 2 and 4 define the initial direction of the third car etc.

Image

Then must be added a start/finish line. You should toggle on "create poly lone" like on the picture below.
Select "AI Path", "Start", "Finish" and "On Poly" in Line dialog.

Image

Creating checkpoints is very easy.
Just select any point on the track and open context menu by right clicking and select "Add Check Points".
You can add several check points, say 2, or 3, or 5 etc.

Image


Pit stop can be added by creating the pit-stop markers with the standard names:
0_pit
1_pit
2_pit
...
The Race Number values must be as in the start markers, say 0.
As here:
Image
http://img17.imageshack.us/img17/1830/pitstopsm.jpg
Last edited by Eugene Cojocar on Fri Dec 07, 2012 9:16 am, edited 2 times in total.
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Fri Dec 07, 2012 9:08 am

Starting lights can be added by defining the standard names for the light objects.
Object name of the first line must be like:
start_light_0_0, start_light_0_1...start_light_0_4
next line:
start_light_1_0, start_light_1_1...start_light_1_4
...
start_light_4_0, start_light_4_1...start_light_4_4

Like on the picture:
Image
http://img849.imageshack.us/img849/2295/startlights.jpg
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Fri Dec 07, 2012 9:20 am

If you want to add an animate flag, you must add a flag with 4x4 polygons, define vertices ID from 1 to 25 and setup flag "Flag Object"
as in the picture:
Image
http://img87.imageshack.us/img87/8436/flagobject.jpg
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Fri Dec 07, 2012 9:43 am

Video tutorial about adding physics active objects.

XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Re: Creating track

Postby Eugene Cojocar » Thu Jan 10, 2013 3:56 pm

Here's a short tutorial of bumpmap surfaces.

At first you need to create one or some bumpmap textures and pack them into a single texture pack. This is not necessity but more convenient.

Then load your bumpmap texture packet and select any texture in the texture manager you want to use as a bump surface like

Image

Then enter any value more than 0 at the NormalMap field for the current texture. This value defines the height of the bumpmap surface.

Select one or more objects you want to add bumpmap and select from the menu->Materials->Add/Del Material like here:

Image

In the Material Manager select BUMPMAP_INDEX and press the button “Add” like here:

Image

You can see the result

Image

As you can see this is not what we expected. That’s because of the undefined bumpmap texture coordinates.

Then select the bumpmaped objects and choose from the menu->Operation->Default Tex Coordinates->Set Default BumpMap Texture Coordinates

Image

This tool uses textures coordinates from the main texture and you can scale them on u/v.

Image

You can see the result here:

Image

If you don’t like the result you can try another scale values to make it better.

Image

and

Image

Also you can tweak the NormalMap value in the Texture manager:

Image
XMR Developer
User avatar
Eugene Cojocar
 
Posts: 937
Joined: Thu Oct 18, 2012 2:49 pm

Next

Return to Tutorials and Guides

Who is online

Users browsing this forum: No registered users and 2 guests

cron