Documentation/Articles/Overview of Mesh Editor
From NeoAxis 3D Engine Wiki
|Language:||English • Russian||Status:||Approved|
The 3D Models Editor is a part of the Resource Editor. It allows you to check and modify the following settings of 3D models:
- view *.mesh files,
- move, rotate and resize 3D models,
- view and generate Level of Detail (LOD) of the models,
- calculate tangent vectors,
- view the model's unwrap texture (UV channels), skeleton and animation.
In order to enable the edit mode, right-click on the model file on the Resources panel and select Edit. You can also double click on the model file.
Move, Rotate, Resize
If you need to change the position, rotation angle or size of the model, you can use the editor's built-in tools.
If you want to move the model, you need to press the Move button. In the dialog box, you can enter a relative displacement for model in the local coordinates - X, Y, and Z.
To rotate the model you need to press the Rotate button. In the dialog box, choose the axis around which you want to do the rotation, and set the angle in degrees.
To scale the object, press the Scale button. In the dialog box, you can change the scaling coefficients according to three axes - X, Y and Z. If you need to double the size of the model, use 2 as a coefficient. At the same time the coefficient 0.5 will make the model 2 times smaller. Additionally, the dialog have a Proportional Scaling checkbox. If you uncheck it, you will be able to choose a different coefficient for each axis.
If the model is using a skeleton, you can apply all these transformations (move, rotate or resize) to it by checking the Apply to skeleton checkbox.
Every model contains one or more sub meshes, which are represented as subcollections on the model file. For each submesh, you can see the polygons and vertices count.You also have the ability to set a material for every sub mesh.
To assign a material to a specific submesh, you first need to expand the SubMeshes rollout of the Properties window. You can then choose an attribute MaterialName for the desired submesh by pressing the "..." button. Please note that the geometry of the selected sub mesh will be highlighted in green.
In the window popup, you need to choose the material file that will be associated with the sub mesh.
If a material with Normal Mapping is applied to the model, the editor may inform you that tangent vectors need to be recalculated. In order to do it, press the Channels button in the properties window.
In the Mesh Vertex Channels window that just opened, in a group of elements called Tangent vectors, simply press the Generate button to recalculate tangent vectors.
Skeleton and Animation
The model can refer to a sceleton's file (.skeleton)., It's path name appears and can be changed in the SkeletonName field.
To see the skeleton, you need to check the Show skeleton checkbox. You can find it at the bottom of the properties window.
While hovering the mouse cursor over a bone, it is possible to see its name as well as the vertices it influences.
You can browse animations in the Animations drop down list located in the properties window. If an object is not animated, you will only see 'None'.
Level of Detail Setting
The Level of Detail (LOD) setting can be used to improve the rendering performance. Usually, when an object is far from the camera, there is no need to draw a complex, high poly object. You can instead use a LOD model, with a lower triangle count. You can use several LOD models for a mesh, and set the distance from the camera they will start being used for each of them.
There are two ways of setting up LOD models:
- automatic - the model editor will generate the simplified variants of the model automatically
- manual - You manually create the LOD models in your modelling application. In the model editor, you choose the add the references to your LOD models in your main .mesh file
In the properties window it's possible to check which LOD are used in the drop-down list LODs.
Automatic LOD Generation
The automatic generation of LOD levels is very fast. However, the result of automatic generation can be unsatisfactory. In that case it is necessary to prepare the LOD manually.
In order to generate LOD automatically, press the Generate LODs button in the properties window.
In the dialog box, you need to set the number of LOD levels you want to be generated, the distance from the camera (in meters) and a percentage of polygon reduction for each level compared to previous one.
For example, the model has 994 faces. If you set the number of LOD levels to generate at 3, the distance to 20 and the polycount reduction to 40%, you will end up with 3 LOD models. Counting your basemodel, you will have 4 level of details for this model. While the distance from the camera increase, every 20 meters a lower detailed model will be used. You can see it on the example below:
Manual LOD Setting
The second way of setting up the LOD models is to do it manually. In this case, you will need to have the LOD models in a separated .mesh files. In order to use them, it's necessary to use theManualLODs property. Select the property and press the button "..." at the right of the line.
To add a LOD level, you need to press the Add button. The FromDepth setting correspond to the distance minimal distance from the camera that is necessary for this new level to appear.MeshName is the name of the model that will be used as LOD. Click the browse button "..." in order to choose it.
The Layers of Texture Coordinates (UV Channels)
The drop-down list UV Channels allows you to see the texture coordinates of the model sub meshes.
The layer with texture coordinates can be marked as UV Unwrap. This is used to show that this layer is unwraped, and thus can be used for static lighting calculation (lightmaps). To set a flag UV Unwrap for one of the layer of texture coordinates, you first need to click the Channels button. In the Mesh Vertex Channels window that appears, you can choose one of the texture coordinates channels in the list, and mark it as UV Unwrap by clicking the Mark/Unmark channel button.
Models can be unwrapped automatically with the editor's built-in utility, though it is not perfect and should only be used for testing. It's better to unwrap models in your 3D modeling application. The utility is located on the Mesh Vertex Channels window, you open by pressing the Channels button.
To start the automatic UV generation, simply click the Generate button.
Calculating Ambient Occlusion
You can calculate the ambiant occlusion for a model directly in the model editor. In order to do it, click the Utils button and then choose Calculate Ambient Occlusion.
The following properties are used:
|Blur||Enable / disable the blurring after calculation.|
|IterationCount||The number of iterations. An higher iteration count means a better end result.|
|MapSize||The size of the Ambiant occlusion map created.|
|Power||The power of the lighting. The higher it is, the higher the contrast of the generated ambiant occlusion map will be.|
|RayLength||The length of the ray of the light source.|
|OutputFileName||The name of the generated ambiant occlusion texture.|
|SplitBySubMesh||Enable / disable the creation of one Ambiant occlusion texture per submesh. If True is chosen, a single texture will be created for each sub mesh.|
All the editor settings are located in the Resource Editor settings window, which can be opened through Tools -> Options.
Settings include the next parameters:
|Background Color||The background color of the working area. It is possible to see the background only when there is no SkyBox set.|
|Show Axes||Enable/disable the visual display of axes coordinates.|
|Show Grid||Enable/disable the visual display of the grid. The size of one square is automatically 1 meter.|
|Sky Box||Set a Skybox (sky), which is displayed as the editor's background.|