Using blender as a track editor: Difference between revisions

From SpaceElevatorWiki.com
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
== OpenStreetMap ==
== OpenStreetMap ==
OpenStreet map has taken off since we started.  
OpenStreet map has taken off since we started.  
Use this (http://wiki.openstreetmap.org/wiki/PythonOsmApi) as inspiration, although the vast majority won't be used here. Let's just use their designs because it is easier than coming up with our own.
Let's use their designs because it is easier than coming up with our own. Here are the map features: http://wiki.openstreetmap.org/wiki/Map_Features
 
Here are the map features: http://wiki.openstreetmap.org/wiki/Map_Features


More interesting stuff here: http://wiki.openstreetmap.org/wiki/Develop/Frameworks
More interesting stuff here: http://wiki.openstreetmap.org/wiki/Develop/Frameworks

Revision as of 01:47, 13 March 2011

OpenStreetMap

OpenStreet map has taken off since we started. Let's use their designs because it is easier than coming up with our own. Here are the map features: http://wiki.openstreetmap.org/wiki/Map_Features

More interesting stuff here: http://wiki.openstreetmap.org/wiki/Develop/Frameworks and here: http://www.google.com/search?client=ubuntu&channel=fs&q=blender+openstreetmap&ie=utf-8&oe=utf-8

Intro

The point of this page is only to explore how track's high level informations can be stored in blender, then exported to a format OpenRacing can load.

I'll describe first a possible way to go from an empty blender screen to a modeled track usable from OpenRacing, featuring:

  • cars starting positions
  • roads and any other ground materials definitions.
  • lanes, i.e. areas authorized for cars to drive on, with their direction (if applicable).
  • checkpoints, so we can define a race track as a list of checkpoints.

Create the ground

make the mesh

  • Build your model as you like, here is mine:

texture

Apply a real-world (or purely virtual) map texture we'll use as a guide.

  • Create uv-map: edit mode U-key -> project from view (bounded), (do this from above: NUM-7)

  • Link uv to a map of roads or racing track.

Extract road / other areas

  • Make the polygons fit the road.

I just applied this technique for a little portion of my map, since this is only experimental.

  • Set the "road" polygons to a specific material (not useful???)

  • Split the mesh into two (P-key -> selected).

A translated the road so you can see it's now two distinct meshes.

  • Thoses steps can be repeated to any other ground materials we like to extract (ice, sand, ...).

Create starting positions and lanes

  • Starting positions are Empty objects (Add -> Empty). They have positions and orientations, where:
    • X indicates front of the car;
    • Y indicates left of the car;
    • Z indicates top.
  • Lanes are Path objects (Add -> Curve -> Path). The curve have a radius at each control point, you can change it using (W-key -> Set radius).
    • Don't forget in the Curve Tools1 panel set NSize to 1.000 so the visual size of handles equals the radius you set.

  • Create groups for the lanes and starting positions. (select both, then CTRL-G)

  • All objects in the StartPositions group are considered (surprise...) as starting positions.
  • All objects in the Lanes group are considered as lanes. They have to be curve with radius.

To rename a group, from the Outliner, click CTRL-MLB on the group name.

Sometime the orientation of the lane should be ignored (for very narrow streets where cars are allowed to drive in the two directions... or parking.. or such). Add to the lane object the property name "oriented", type "bool", value "false" (this is to be done from the Logic: F4-key panel).

After some polish, here is what looks like a relatively complex intersection, with few checkpoints and lanes..

Export your track

We will provide a blender plugin for Open Track Format (.otf), which basically is a specialisation of the Collada format.

Personal debate

Current dilemma. There are some important informations not exported to the python API, like multiple uv sets and such... I wanted to export road's "local space" informations into UV informations. I can store this as a 2nd UV in the visual mesh (see screenshot bellow), but (wth) I can't export more that 1 UV (python API doesn't present more).

So what to do??

Well, I think I'll have to cheat (and maybe this can be for good).

Let's store this in a duplicated version of the road mesh (which can be lower or higher definition, that's the good point).

The road is a single mesh for now. But we probably have to make different versions of it: the visual mesh (with LOD), the physics mesh (low details), the high-level descriptions (storing roads and lanes directions, checkpoints, etc.)