JOSM/Plugins/Kendzi3D/Custom models

From OpenStreetMap Wiki
< JOSM‎ | Plugins‎ | Kendzi3D
Jump to: navigation, search

Model Layer

How to load custom models

Configuration by UI

Is not completed.

Run "Menu > 3D > List of Models"

Manual configuration

Models are stored inside plugin archive. Plugin is normal zip archive with extension „jar”. To see models and textures locate file „kendzi3d.jar” inside JOSM plugin directory. It is possible to change models, textures and plugin configuration inside plugin archive. Changes will be available after JOSM restart.

Configuration file

Configuratnion is stored inside files:

  • {JOSM}/models/modelsLibraryInternalLayer.xml
  • {JOSM}/models/modelsLibraryLayer.xml

Example of file format:

<modelsLibrary>
  <nodeModel    matcher="(test=my_model)"
                model="/models/my_model/model.obj"
                translate="vectorY(65)"
                scale="0.154" />
	
  <wayNodeModel matcher="highway=*" 
                filter="hightway=light" 
		model="/models/hightway_light.obj"
		translate="vector()" 
                scale="height(1)" 
                direction="wayNodeDirection(90)" 
                offset="3" />
</modelsLibrary>


  • nodeModel - model for node

Attributes:

matcher – filter decide to with nodes model will be apply (JOSM search format)

model – path to model file. Only relative path are supported. Relative path starting from directory {JOSM}\plugins\kendzi3d\

translate – translate (move) model in model coordinate space

scale – scale model. It can be a number or scale function

modelParameter - additional parameter for model like texture name


  • wayNodeModel - models on way nodes.

Attributes:

matcher – filter decide to with nodes model will be apply (JOSM search format)

filter- filter for selected way nodes (JOSM search format)

model – path to model file. Only relative path are supported. Relative path starting from directory {JOSM}\plugins\kendzi3d\

translate – translate (move) model in model coordinate space

scale – scale model. It can be a number or scale function

direction - function for direction of model WORLD SPACE

offset - model offset from the way

modelParameter - additional parameter for model like texture name

Example of configuration

It is possible to setup custom models and configuration by putting models inside JOSM plugin directory (with out need to repack kendzi3d.jar file). Please follow steps:

  • locate JOSM plugin directory (it will be named {JOSM}) (!LINK!)
  • enter kendzi3d directory {JOSM}\plugins\kendzi3d
  • create directory models directory {JOSM}\plugins\kendzi3d\models
  • put inside directory your 3d model. Now only models in format „OBJ” are supported. This means you need to copy: model file with extension „.obj”, optional material file with extension „.mat” and optional texture files with extension „.png”. Put your model inside new directory eg. it might look like this:
{JOSM}\plugins\kendzi3d\models\my_model\model.obj
{JOSM}\plugins\kendzi3d\models\my_model\model_material.mat
{JOSM}\plugins\kendzi3d\models\my_model\model_texture.png


Waring:

Inside ".obj" file only relative patch to materials files are supported!!!
Inside ".mat" files only relative patch to textures files are supported!!!


  • now it is required to create configuration to connect model with node object in Map. Create configuration file modelsLibraryLayer.xml. {JOSM}\plugins\kendzi3d\models\pointModelLayer.xml
  • add to file content:
<modelsLibrary>
  <nodeModel matcher="(test=my_model)"
              model="/models/my_model/model.obj"
              translate="vectorY(65)"
              scale="0.154" />	
</modelsLibrary>


  • Click in menu “Menu>3D>Clean up”. This should reload configuration and show model at all nodes with key “test” and value “my_model”

Model coordinate system for wayNodeModel

Kendzi3d model translate.svg

Functions

Scale functions

{number}

receive given double value

height({default height})

Receive height from OsmPrivitive tags, if tag height is not set it return default value

Args:

{default height} – default model height

Example:

0.8 * height(5)	

Direction

wayNodeDirection()

For nodes located on ways its read way direction (orthogonal to bisector in this point. Result is in degrees.

Example:

90 + wayNodeDirection()

Direction functions

wayNodeDirection({angle})

Function for return way direction for nodes located on ways. Direction is orthogonal to bisector.

Args:

{angle} - optional parameter, if specified it is added to direction from way

Vector functions

vector()

Function create 3d vector (0, 0, 0)

vector({x}, {y}, {z})

Function create 3d vector ({x}, {y}, {z})

vectorX({x})

Function crate 3d vector ({x}, 0, 0)

vectorY({y})

Function crate 3d vector (0, {y}, 0)

vectorZ({z})

Function crate 3d vector (0, 0, {z})

Model parameters

Allow to parameterize some model attributes. Currently it is possible to change material texture.

Model texture

Parameter is stored like string:

material.{material_name}.texture0={texture_name}


{material_name} - material name stored inside model.

{texture_name} - new value with texture name for given material name.

Parameter allow to change model texture. In 3d models textures are connected with material. Materials have assigned some information about surface lightning, reflection, texture path etc. They usually have names which can be changed in 3D editor. This parameter allow to search inside model for all materials with given name. For all matched materials, new texture name is setup. Texture name can be file name relatively from model file or function for texture generation.