Difference between revisions of "Creating tracks"

From VDrift
Jump to: navigation, search
(New page: ==Directions for creating tracks== {{note|These instructions are meant for Linux}} * Model the scene. See the track modeling tutorial * If you use a 3d editor other than blender, * ...)
 
m (→‎Other Notes: Fix tab instead of space)
 
(25 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Directions for creating tracks==
+
==Video Tutorial==
 +
NaN has produced this nifty video tutorial (Windows, but mostly applicable to Linux too): http://www.youtube.com/watch?v=oju-vKVVaho
  
{{note|These instructions are meant for Linux}}
+
==What you need==
 +
* VDrift
 +
* VDrift level editor
 +
* Blender 2.33 or higher. Tested on 2.45 with Python 2.5.1
 +
* Blender JOE export script. Get that here: https://github.com/VDrift/blender-scripts
 +
Get the '''export-all-joe-0.3.py''' script. The difference in the files is that one exports all the object in the scene and the other only exports the one that is selected.
  
* Model the scene.  See the [[track modeling tutorial]]
+
==Getting the level editor==
* If you use a 3d editor other than blender,
+
In the Linux console, copy ''everything'' below:
* Unzip and put racer files in temporary folder RACER_TP (temporary track path). Make sure the path has no spaces (dof2joe doesn't like spaces).
+
git clone https://github.com/VDrift/trackeditor vdrift-trackeditor
* Create new folder for track in track editor folder TRACKEDITOR_TP.
 
* Convert all texture names to lowercase in TRACKEDITOR_TP via
 
  
  find . -type f -name \*.tga|sort -r|awk '{f=tolower($1);
+
==Directions for creating tracks==
if(f!=$1 && p[f]!=1){print "mv "$1" "f}p[$1]=1}' | /bin/sh
+
* Model the scene. See [[3D modeling]] for resources to help with this step.
* Make folder TRACKEDITOR_TP/objects/
+
* If you use a 3D editor other than blender, import the track into blender.
* Run the following command:
+
* Use the '''export-all-joe-0.3.py''' blender export script to export all objects.  This script can be found in the VDrift art repository under the tools folder.  The export script creates a number of '''.joe''' files and a '''list.txt''' file.  The '''list.txt''' file may be named '''somename-list.txt''', in which case you should rename it to '''list.txt'''. At least one '''.joe''' file should get created for the curve track. Also verify that '''list.txt''' is mentioning all the '''.joe''' files. An empty '''list.txt''' will not load anything in the editor.
dof2joe/dof2joe -p TRACKEDITOR_TP/objects/ RACER_TP/*.dof
+
* Create new folder for track in track editor folder ''TRACKEDITOR_TP'' (if your track is called parkinglot, the path could be '''/home/joe/trackeditor/data/tracks/parkinglot''').
If there are thousands of .dof files, you may have to do this in steps to avoid a "too many arguments" error from your shell. This will take a while. Textures are automatically converted using nconvert. No filenames should have spaces.
+
* Make folder '''''TRACKEDITOR_TP''/objects/'''
* Open track editor /data/tracks/editor.config and set active track to TRACKEDITOR_TP.
+
* Copy all of the '''.joe''' files and the '''list.txt''' file to '''''TRACKEDITOR_TP''/objects/'''
* Run the track editor. Trace the roadways and mark the starting position (press H for help).
+
* Open track editor '''data/tracks/editor.config''' and set active track to ''TRACKEDITOR_TP''.
* CD to the TRACKEDITOR_TP/objects folder (this is important, the packfile stores relative paths) and run
+
* Create a '''''TRACKEDITOR_TP''/track.txt''' file with at least a line "cull faces = on". '''track.txt''' is modified by track editor to add all starting positions and lap sequence points. Read the track editor inhelp for more information.
  joepack/joepack -c objects.jpk *.joe
+
* Run the track editor. Trace the roadways and mark the starting position (press H for help). A track may not always appear on the screen. Move the mouse around and you could see it in the black space. The first time, check the console output of track editor for any warnings.
* Copy TRACKEDITOR_TP into the main VDrift tracks folder VDRIFT_TP. Erase VDRIFT_TP/objects/*.joe (since they are in the pack file).
+
{| style="border: solid 1px black; background-color: #e0e0e0"
* Add your VDRIFT_TP to VDrift/data/tracks/track_list.txt
+
|- valign="top"
* Add VDRIFT_TP/about.txt and ensure that the first line is the name of the track.
+
|width="250px"|'''Why trace roadways?'''
 +
[[Image:Track-smoothing.png]]
 +
This is a visual depiction of the track smoothing that occurs when tracing a roadway. Imagine this image is showing the track surface from a side view. The black lines represent the track mesh, and the red lines represent the bezier patches. Once the track has been traced in the track editor, VDrift will use the red lines to do collision instead of the black lines. On the top, this represents a dip in the road. You can see how collision using the red line will behave properly. On the bottom, this represents a bump road. You can see that the red line doesn't change the magnitude of the bumps, it just makes them realistically smooth instead of unrealistically pointy.
 +
|}
 +
* <code>cd</code> to the '''trackeditor/joepack''' folder.  Compile the joepack tool by running
 +
scons
 +
* <code>cd</code> to the '''''TRACKEDITOR_TP''/objects''' folder (this is important, the packfile stores relative paths) and run
 +
  /path/to/trackeditor/joepack/joepack -c objects.jpk *.joe
 +
* If you want, this command will show you the files in the joepack to allow you to verify the previous step worked correctly:
 +
/path/to/VDrift-trackeditor/joepack/joepack -l objects.jpk
 +
* Copy ''TRACKEDITOR_TP'' into the main VDrift tracks folder ''VDRIFT_TP'' (for example '''/home/joe/vdrift/data/tracks/parkinglot'''). Erase '''''VDRIFT_TP''/objects/*.joe''' since they are all in the pack file now.
 +
* Add '''''VDRIFT_TP''/about.txt''' and ensure that the first line is the name of the track.  You should put information about the track author, where the track came from, etc in the second line and on.
 
* Run VDrift and check out what the track looks like in-game. Note that you will only be able to drive on the roadways you defined in the track editor since no other surfaces have been flagged as collideable. Also take a screenshot for the track selection screen.
 
* Run VDrift and check out what the track looks like in-game. Note that you will only be able to drive on the roadways you defined in the track editor since no other surfaces have been flagged as collideable. Also take a screenshot for the track selection screen.
* Add the track selection screenshot to VDrift/gui/tracks/VDRIFT_TP.png (hopefully these png files will be moved into the folders of the individual tracks soon).
+
* Create a track selection image (a 512x512 png file works best) and save it to '''''VDRIFT_TP''/trackshot.png'''
* Open up all of the texture files in TRACKEDITOR_TP/objects and review which textures belong to objects that should be collide-able (roads and walls), have full brightness (trees), be mipmapped (fences and fine transparent objects should not be mipmapped), or be skyboxes.
+
* Open up all of the texture files in '''''TRACKEDITOR_TP''/objects''' and review which textures belong to objects that should be collide-able (roads and walls), have full brightness (trees), be mipmapped (fences and fine transparent objects sometimes look better when not mipmapped), or be skyboxes.
* Any textures that have transparent areas are usually colored #FF00FF in the Racer textures. You'll need to make these truly transparent in the PNG files. An easy way to do this is to use ImageMagick. Use the command
+
* Set the correct object properties using the '''trackeditor/listedit''' tool (more documentation to come).
mogrify -transparent rgb\(255,0,255\) file.png
 
This can be scripted to speed things up of course.
 
* Set the correct object properties using the VDrift-tracked/listedit tool (more documentation to come).
 
 
* Done!
 
* Done!
 +
 +
==Other Notes==
 +
* A track should be of a minimum size for loading within VDrift. If the editor is not allowing to adjust the camera poistions correctly, probably the track is very small. Scale everything in the blender twice or more and try again.
 +
* Starting points are set within the track editor. After the track is loaded, position the track like you were in the car on the track i.e. first person view. Press L to save the position as a starting position. Continue to add positions depending on your track. Also add a lap sequence i.e. lap starting/ending point track.
 +
* Track editor does not paint or mark the starting points or lap sequence numbers on the track. These are only saved in track.txt. Also, the editor will always continue adding more starting positions if track.txt had some already. Therefore, consider deleting everything in '''track.txt''' if you wish to reedit the positions.
 +
* A .joe file gets created when the track has a texture.
 +
* The export-joe script should be loaded within blender along with the track, and executed.
 +
 +
[[Category:Tracks]]

Latest revision as of 14:51, 24 December 2014

Video Tutorial

NaN has produced this nifty video tutorial (Windows, but mostly applicable to Linux too): http://www.youtube.com/watch?v=oju-vKVVaho

What you need

Get the export-all-joe-0.3.py script. The difference in the files is that one exports all the object in the scene and the other only exports the one that is selected.

Getting the level editor

In the Linux console, copy everything below:

git clone https://github.com/VDrift/trackeditor vdrift-trackeditor

Directions for creating tracks

  • Model the scene. See 3D modeling for resources to help with this step.
  • If you use a 3D editor other than blender, import the track into blender.
  • Use the export-all-joe-0.3.py blender export script to export all objects. This script can be found in the VDrift art repository under the tools folder. The export script creates a number of .joe files and a list.txt file. The list.txt file may be named somename-list.txt, in which case you should rename it to list.txt. At least one .joe file should get created for the curve track. Also verify that list.txt is mentioning all the .joe files. An empty list.txt will not load anything in the editor.
  • Create new folder for track in track editor folder TRACKEDITOR_TP (if your track is called parkinglot, the path could be /home/joe/trackeditor/data/tracks/parkinglot).
  • Make folder TRACKEDITOR_TP/objects/
  • Copy all of the .joe files and the list.txt file to TRACKEDITOR_TP/objects/
  • Open track editor data/tracks/editor.config and set active track to TRACKEDITOR_TP.
  • Create a TRACKEDITOR_TP/track.txt file with at least a line "cull faces = on". track.txt is modified by track editor to add all starting positions and lap sequence points. Read the track editor inhelp for more information.
  • Run the track editor. Trace the roadways and mark the starting position (press H for help). A track may not always appear on the screen. Move the mouse around and you could see it in the black space. The first time, check the console output of track editor for any warnings.
Why trace roadways?

File:Track-smoothing.png This is a visual depiction of the track smoothing that occurs when tracing a roadway. Imagine this image is showing the track surface from a side view. The black lines represent the track mesh, and the red lines represent the bezier patches. Once the track has been traced in the track editor, VDrift will use the red lines to do collision instead of the black lines. On the top, this represents a dip in the road. You can see how collision using the red line will behave properly. On the bottom, this represents a bump road. You can see that the red line doesn't change the magnitude of the bumps, it just makes them realistically smooth instead of unrealistically pointy.

  • cd to the trackeditor/joepack folder. Compile the joepack tool by running
scons
  • cd to the TRACKEDITOR_TP/objects folder (this is important, the packfile stores relative paths) and run
/path/to/trackeditor/joepack/joepack -c objects.jpk *.joe
  • If you want, this command will show you the files in the joepack to allow you to verify the previous step worked correctly:
/path/to/VDrift-trackeditor/joepack/joepack -l objects.jpk
  • Copy TRACKEDITOR_TP into the main VDrift tracks folder VDRIFT_TP (for example /home/joe/vdrift/data/tracks/parkinglot). Erase VDRIFT_TP/objects/*.joe since they are all in the pack file now.
  • Add VDRIFT_TP/about.txt and ensure that the first line is the name of the track. You should put information about the track author, where the track came from, etc in the second line and on.
  • Run VDrift and check out what the track looks like in-game. Note that you will only be able to drive on the roadways you defined in the track editor since no other surfaces have been flagged as collideable. Also take a screenshot for the track selection screen.
  • Create a track selection image (a 512x512 png file works best) and save it to VDRIFT_TP/trackshot.png
  • Open up all of the texture files in TRACKEDITOR_TP/objects and review which textures belong to objects that should be collide-able (roads and walls), have full brightness (trees), be mipmapped (fences and fine transparent objects sometimes look better when not mipmapped), or be skyboxes.
  • Set the correct object properties using the trackeditor/listedit tool (more documentation to come).
  • Done!

Other Notes

  • A track should be of a minimum size for loading within VDrift. If the editor is not allowing to adjust the camera poistions correctly, probably the track is very small. Scale everything in the blender twice or more and try again.
  • Starting points are set within the track editor. After the track is loaded, position the track like you were in the car on the track i.e. first person view. Press L to save the position as a starting position. Continue to add positions depending on your track. Also add a lap sequence i.e. lap starting/ending point track.
  • Track editor does not paint or mark the starting points or lap sequence numbers on the track. These are only saved in track.txt. Also, the editor will always continue adding more starting positions if track.txt had some already. Therefore, consider deleting everything in track.txt if you wish to reedit the positions.
  • A .joe file gets created when the track has a texture.
  • The export-joe script should be loaded within blender along with the track, and executed.