Author Topic: Using Tamschi's MeshView  (Read 13330 times)

0 Members and 1 Guest are viewing this topic.

Rated 1 time
Excellent

Online nargil66

  • Forum Moderator
  • Full Member
  • *
  • Topic Author
  • Posts: 2490
  • Country: bg
  • Karma: +67/-1
  • Gender: Male
  • Mesh-Texturing Beautifier :)
    • View Profile
    • Awards
  • Time Zone: ?
Using Tamschi's MeshView
« on: 01 March 2019, 18:37:38 »
« Last Rated on: 13 March 2023, 17:09:44 »
Original description of MeshView by Tamschi:

Spoiler for Hiden:
I'm working on a new mesh viewer for TQ and IT:



This is an early screenshot, but you can already see the default material. It's a gradient based on the texture coordinates, so the borders you see are where the texture is stitched.



The program supports loading more than one mesh at a time and the meshes' source folders are automatically scanned for textures. (The texture's extension is ignored, it starts with the shortest matching filename, in alphabetical order, then proceeds to the longer ones.)



Supported texture formats are TQ textures and XNA or WIC compatible image files:
tex, dds, dib, hdr, pfm, ppm, tga, jpeg, tiff, gif, png, bmp and HD Photo + any WIC plugins installed on the computer.



Additive shaders are rendered as emissive textures, so it is possible to preview glowing auras.



The background color can be changed the same way as the colors of the lights. Text inputs in MeshView are somewhat different from those in most other programs: Because there are no input dialogs or save buttons every input is applied directly to the rendering. If the input is invalid, the background turns red and the value is ignored until it changes to a valid one. If a valid value is entered, the text field's background turns green as soon as the changes are applied.
(In case there is an input that takes some time to process, the text field will first turn yellow and then green or red to show whether the changes have been saved.)

I finished the save module for meshes, so this is now a functional mesh editor.

The COLLADA export seems to be easier than I though: I finished a very basic export for vertex positions and normals! The code is relatively simple, so I should be able to add texture support and skeleton export in the next few days.



Imports are more complicated, but it's doable.

I finally got the texture coords working:



Softimage's crosswalk import seems to be picky about where I link the vertex parameters, so I moved it where every 3D program can understand it. I still had to manually select the textures, because the program didn't recognize the effect definitions. The next thing I want to add are bone definitions and proper rigging...

On a side note: I ran a test on some of the msh files: Most were working fine, but some of the shader definitions contained duplicate texture references. I added a workaround, but the exporter's behaviour may differ from the game's when loading these meshes.

The bone indices in the weights are a bit... strange. You can sort them manually with the panel under "Vertices".

---

I updated MeshView to version 1.2. It's now portable and you can import .obj files over existing meshes. It's similar to MeshDrawCS' import function in that you need a base mesh to load a .obj, but works properly, merges multiple normals per vertex and lets you import small meshes over larger ones to create objects with any number of vertices and triangles.
(The last one is untested, should work though...)
« Last Edit: 07 March 2021, 08:23:03 by nargil66 »

Rated 1 time
Excellent

Online nargil66

  • Forum Moderator
  • Full Member
  • *
  • Topic Author
  • Posts: 2490
  • Country: bg
  • Karma: +67/-1
  • Gender: Male
  • Mesh-Texturing Beautifier :)
    • View Profile
    • Awards
  • Time Zone: ?
Using Tamschi's MeshView
« Reply #1 on: 14 April 2019, 22:44:59 »
« Last Rated on: 22 December 2021, 23:29:45 »
Here are a few tips and tricks from my experience with MeshView - just have in mind that what i know comes mostly by trial and error - some of the info may be incomplete or even wrong.

I. Initial Setup

First, we want to make sure every TQ mesh opens with MeshView by default.
To do it, right-click on an extracted .MSH file from the game, and in the dropdown menu pick “Open With…” and in the window that opens tick “Always open with this program”. Then browse to MeshView.exe and click on it. From now on all meshes will automatically open with MeshView.

Some of the changes made in MeshView (such as edited bones, attached effects and other) does not show directly or correctly in it. To preview them faster, you may use the Viewer tool that comes with the main game along with MeshView. Or just launch the game each time. I’ll get back on previewing later.

II. Interface & Functions
This is a list of all sections you will find in MeshView’s interface, with info of what you can do in some of them.

1. Background
Here you can change the background color and lightness.

Set a value for each color (Red, Green and Blue), from 0 to 255.
0-0-0 is pure black, 255-255-255 is white. The default is set to 128-128-128 (middle gray).
Play around with the values to set a certain color.

2. Camera
Here you can rotate, move and zoom the camera to view the mesh from different angles.

“Position” - moves the camera, “Yaw” and “Pitch” rotate it, “FOV” zooms in/out, “Reset” restores the default settings.
You can also change camera mode - the two options are Perspective and Orthographic. In difference from the Perspective view, in Orthographic view the far parts of the mesh does not become smaller. This is especially useful for previewing huge meshes, like this Ladon mesh:

Perspective


Orthographic


3. Lights
Here you control the lights - their color, strength and position.
In the main “Lights” section you can add new lights from different directions. This is very useful for previewing textures. For example, if you rotate the mesh Yaw by 180 degrees in the Camera settings, you will see its back side is dark:


Try adding a new Ambient Light:

You can add a new directional light in the same way. Directional lights can be rotated around the mesh in difference from ambient lights, which surround the mesh from all sides.

You can change the color of each existent light in the Lights subsections. For ambient lights you can change color in the same way as you do with the background:


For directional lights, you can set color (default is white), as well as position:


New added lights will multiply with the old ones. I don’t advise you to use colored lights when retexturing, use normal white light instead. When previewing changes in your texture with MeshView, you can turn off directional light by setting it to black (0-0-0) and then set the ambient light to white (255-255-255). This way the mesh will be illuminated equally from all directions.

4. Mesh
This is the main section of MeshView, where most of the manipulations are done. There are many subsections in it, I’ll stop on each one separately.

When you click on the main Mesh section, you will see two options: “New Mesh” and “Load Mesh”.
New Mesh - I assume that it allows you to change the current loaded mesh, but for me it crashes the program, so I’ll move to the next option.
Load Mesh - It allows you to load a different mesh on top of the current one. This is useful when comparing mesh sizes or to check if certain equipment will fit. Lets try to load a piece of armor over the Jackalman. Click on Load Mesh and browse to the second mesh you want to load (in this case - tigerman torso). Do they fit? Let’s find out:


Nope, they don’t :P

I haven’t tried this ever, but this may also be useful when making mounted creatures. Load both the rider and the mount, and then move rider’s MoveAxis to the needed position. Ima try this when we come to Bones subsection.

4.1 Mesh (v…)
This is where you can Save the mesh after editing. You can also export in different formats or add missing sections.

“Add MIF Section”- Adds a new empty link to a MIF file (used by Viewer to load mesh data) if the mesh doesnt have one. To edit or remove existing links you have to do it in the MIF subsection below.

‘’Resize” - When you click on this, a small window appears, where you can enter an new scale value for the mesh. Let’s try to fit the jackalman to the armor a little better, by making it larger by 10%. We change scaling factor from 1 to 1,1 (MeshView only accept commas, not dot symbols):


Result:

Meh. It was just an experiment.
After resizing, the mesh scale will always show as 1, no matter its larger now.

“Add TextData Section” - Adds a new empty TextData field (you will be using it most frequenty) if the mesh doesnt have one. To edit or remove the mesh TextData you have to do it in the subsection below.

“Save” - Saves the edited mesh. You can choose a new name and location.

“Close” - close a chosen mesh you have loaded. In the above case, you can close the tigerman armor, leaving only the Jackalman.

"Save Partial Data (.OBJ)" - Exports the mesh as OBJ format (without bones) for editing in another 3D program. Tested importing it in 3DS Max and Blender and the model is correct size and rotation, so you can use that option without problems.

"Load Partial Data (.OBJ)" - I'm not sure how this works, every time i try to import another OBJ file MeshView crashes. So i'll just let it be.

"Replace Data (.OBJ)" - I assume this option is supposed to replace the current mesh with another, but it doesn't work. The replacing mesh is visible in MeshView, but ingame its corrupted (invisible), except if the two meshes are exactly the same. However, this gives two nice opportunities:
- First, you can quickly preview mesh changes while editing in 3D program. For example you edit some facial features in Blender, export as OBJ, then load back in MeshView to see how it looks (MeshView shows models much closer to how they look ingame than Blender).
- Second, you can corrupt a mesh on purpose to make it always invisible. Invisible meshes has multiple uses in modding (we will come back to this later).

Rest of the options - "Export Collada" doesn't work af far as i know, and i'm not sure what the other options do, so i won't risk giving you false info.

4.1.1 MIF
In this section you can change or remove the mesh MIF link, as described in the previous part.

4.1.2 TextData
As far as my knowledge goes, here you can change or add attach points. You can also attach new entities - effects, items or even creatures to the main mesh.

4.1.2.1 Attach Points - They define the position, rotation and size of equipment, effects, character cameras or custom attached entities to the mesh. Here is an example of a basic attach point (in this case, Torso Armor):
Quote
AttachPoint
{
    name   = "Upper Body"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 1.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}
This type of attach point is fixed to the base coordinate system. It may follow the mesh animation, but if the mesh is moved, the attach point will stay in place.

There is another type of attach point - one that has a certain bone as parent. Its position is dependent on that bone. Weapon attach points are a good example:
Quote
AttachPoint
{
    name   = "R Hand"
    parent = "Bone_R_Weapon"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, -1.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}

4.1.2.2 Modifying the attach points
Editing text data will allow you to move, resize or rotate attach points. But first, let me explain a little about the 3D coordinate system. There are 3 base axes:
 
X - widht/horizontal axis
Y - height/vertical axis
Z - depth/perspective axis



Each axis has + and - values. The positive directions are:
 
+X - right (from our point of view)
+Y - up
+Z - front (pointing toward us)

The negative (-) directions are pointing exactly in opposite of the positive ones - left, down, back.

4.1.2.3 Moving Attach Points
Knowing this, lets try to move an attach point. For this example, we'll move the hair helmet of the main female character (as its always there by default). The only thing you need is extracted femalepc01.msh (its located in Creatures.arc - “Resources/Creatures/PC/Female” directory). Extract it, and then place it in the same directory, only in Database folder (Database/Creatures/PC/Female). If the folders does not exist, just create them. After you move the mesh in that directory, open it with MeshView and locate the “Head” attach point in TextData section:


Right now its control point is the coordinate center, which is exactly between the feet of the character. To move the helmet,  you need to edit only the “origin” part:


Which stands for:
Quote
origin = (X - 0.000000, Y - 0.000000, Z - 0.000000)
The helmet attach point is 0 aside, 0 high, and 0 deep compared to the center - its exactly in it.
Lets say we want to move the helmet slightly left (for us), up, and in front of the character. Look above to the axis cross again. According to it, for left, up and front, we need -X, +Y and +Z. Lets try:


Here all values are equal, but you can change them as you wish. This will define how far up, left and in front the attach point moves. Just preserve which is "+" and which is "-" .

After editing, open “Mesh (v…)” section and save the mesh in the same Database location, overwriting the old one.


Time to check the result ingame. Launch the game, it will read your modified mesh from Database folder instead of that in the Resources ARC file. Here is the moved hair helmet, exactly as we wanted it:


4.1.2.4 Scaling Attach Points
You needed the origin for moving, for scaling you don’t. You need the X/Y/Z axes instead.
We moved the hair helmet, what if we want to make it bigger or smaller now? Or only wider while keeping its height/depth the same?
How about making it so small, that its “invisible”? This is very useful when making “Play as Monster” mods - for example a human helmet doesn't fit a Minotaur. its better if we scale it down to get it out of the picture.

Since we already started with the hair helmet, lets just keep modifying it. For start we will make it smaller by 50%, this time only by the X axis. This is how:


Lets see ingame:

The attachment width is reduced by 50%, height and depth remain the same. To change the entire hair by 50% while preserving its shape, do this:
Quote
AttachPoint
{
    name   = "Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (0.500000, 0.000000, 0.000000)
    yAxis  = (0.000000, 0.500000, 0.000000)
    zAxis  = (0.000000, 0.000000, 0.500000)
}

And to make it “invisible” (microscopic):
Quote
AttachPoint
{
    name   = "Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (0.000001, 0.000000, 0.000000)
    yAxis  = (0.000000, 0.000001, 0.000000)
    zAxis  = (0.000000, 0.000000, 0.000001)
}
This way it’s scaled down by 100000%.

Scaling up works in similar way. To increase the attachment size by 50%, we change the values to these:
Quote
AttachPoint
{
    name   = "Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (1.500000, 0.000000, 0.000000)
    yAxis  = (0.000000, 1.500000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.500000)
}

To triple its height only:
Quote
AttachPoint
{
    name   = "Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 3.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}
You get the idea :)

4.1.2.5 Rotating Attach Points
Here comes the tricky part. Rotating is hardest to do - you need to use a formula to calculate rotation by a certain angle (say 18 degrees). To not make things overly complex, i'll just give you the values of more common rotations - by 180 and 90 degrees.
The basic rule here is - when you rotate, you change the values to all axes except the axis you are rotating around.
We will use the female hair again for the examples, but before we do that, let's reset it's position to default:
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (1.0000000, 0.0000000, 0.0000000)
    yAxis = (0.0000000, 1.0000000, 0.0000000)
    zAxis = (0.0000000, 0.0000000, 1.0000000)
}

Rotating by 180 degrees
This is the most simple rotation. Here is the basic rule for 180 degrees - you switch + to - (and - to +) on all axes, except the one you are rotating around. For example, if you want to rotate by 180 degrees around the vertical Y axis, do it this way:
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (-1.0000000, 0.0000000, 0.0000000)
    yAxis = (0.0000000, 1.0000000, 0.0000000)
    zAxis = (0.0000000, 0.0000000, -1.0000000)
}

Both rotated axes remain on the same position, only their values are flipped to the negative. Result ingame:


Rotating by 90 degrees
Now lets reset it again and rotate it by 90 degrees around the vertical axis. Remember, we are rotating around it, so the Y value and position must remain unchanged. The X and Z axes however will have different positions:
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (0.0000000, 0.0000000, -1.000000)
    yAxis = (0.0000000, 1.0000000, 0.0000000)
    zAxis = (1.0000000, 0.0000000, 0.0000000)
}
Result ingame:


To rotate by 90 degrees on the opposite direction, all we have to do is switch “+” and “-” of the X and Z axes. Again, we don’t touch the Y.
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (0.0000000, 0.0000000, 1.000000)
    yAxis = (0.0000000, 1.0000000, 0.0000000)
    zAxis = (-1.0000000, 0.0000000, 0.0000000)
}
Result:


The same rule applies for other axes. For example, if you want to rotate the attachment on 90 degrees around the Z axis, you do this:
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (0.0000000, -1.0000000, 0.0000000)
    yAxis = (1.0000000, 0.0000000, 0.0000000)
    zAxis = (0.0000000, 0.0000000, 1.0000000)
}

Or:
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (0.0000000, 1.0000000, 0.0000000)
    yAxis = (-1.0000000, 0.0000000, 0.0000000)
    zAxis = (0.0000000, 0.0000000, 1.0000000)
}

Examples:



Around the X Axis:
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (1.0000000, 0.0000000, 0.0000000)
    yAxis = (0.0000000, 0.0000000, -1.0000000)
    zAxis = (0.0000000, 1.0000000, 0.0000000)
}

Or:
Quote
AttachPoint
{
    name = "Head"
    origin = (0.000000, 0.0000000, 0.0000000)
    xAxis = (1.0000000, 0.0000000, 0.0000000)
    yAxis = (0.0000000, 0.0000000, 1.0000000)
    zAxis = (0.0000000, -1.0000000, 0.0000000)
}

Examples:


The system is pretty simple.

Rotating by a certain angle
Here things become more complicated. To rotate by a chosen angle purely using numbers, you need to use a formula. It was kindly provided by Soa, so i'll just copy his post here.

Here's the basic formula for the rotation matrixes around the reference axis:



Angle is positive when your turn :
+y axis towards +z axis
+x axis towards +y axis
+z axis towards +x axis

In Viewer or PSE Editor axis are this way, x is red, y is green, z is blue


For instance, 45° around y (positive angle, +z goes towards +x) gives
cos 45°  0     sin 45°
     0      1       0
sin 45°   0    cos 45°

Hence
Quote
AttachPoint
{
    name   = "Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (0.707107, 0.000000, 0.707107)
    yAxis  = (0.000000, 0.000000, 0.000000)
    zAxis  = (-0.707107, 0.000000, 0.707107)
}
In general, its recommended to use Viewer for more complex rotations (unless you want your head to overload with math haha).
« Last Edit: 07 March 2021, 08:22:45 by nargil66 »

Not Yet Rated!

Online nargil66

  • Forum Moderator
  • Full Member
  • *
  • Topic Author
  • Posts: 2490
  • Country: bg
  • Karma: +67/-1
  • Gender: Male
  • Mesh-Texturing Beautifier :)
    • View Profile
    • Awards
  • Time Zone: ?
Using Tamschi's MeshView
« Reply #2 on: 31 July 2019, 18:19:19 »
4.1.2.6 Attaching Entities
After covering attach point transform options, lets move to the attachments themselves. Here you will learn how to attach Entities (effects, items, monsters, decorations and such) directly to a mesh.

An Entity is basically a link to a .DBR file in the game's records. You must know the exact file path of the Entity you want to attach for this to work.
To attach anything, scroll down in the mesh TextData and on the bottom use the following entry:
Quote
CreateEntity
{
    attach = "*Entity Attach Point Name*"
    entity = "*Entity Record Path*"
}

Here is an example. Lets say we want to attach a common leather helmet that always remains visible on the character. We open Art Manager and click on "Import Record..." to browse existing items. In this case, the leather helmet record path is "records\item\equipmenthelm\c01_helm01.dbr". So our attachment entry would look like this:


We relaunch the game to see the result:


The helmet is attached permanently now, not equipped. But there is a small problem - the default hair (and all equipped helmets) remain visible too. Lets fix it by scaling down the "Head" Attach Point again and make it invisible as we learned above:
Quote
AttachPoint
{
    name   = "Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (0.000001, 0.000000, 0.000000)
    yAxis  = (0.000000, 0.000001, 0.000000)
    zAxis  = (0.000000, 0.000000, 0.000001)
}

Remember, normal helmets Attach point is "Head", while the leather helmet one is named "Helmet", so even if you shrink the first, it won't affect the size of the attached item. Result ingame:


Ok, we attached a piece of armor, but how about an effect? It's the same method, again we browse the database to find a suitable effect record. In this example I'll use a well known aura effect - Art of the Hunt. It's record file path is "records\effects\hunting\343_trailblazing_fx01.dbr". Lets try by adding a new Entity, beside the leather helmet:
Quote
CreateEntity
{
    attach = "Helmet"
    entity = "records\item\equipmenthelm\c01_helm01.dbr"
}
CreateEntity
{
    attach = "Effect"
    entity = "records\effects\hunting\343_trailblazing_fx01.dbr"
}

Here is the result ingame:


4.1.2.7 Attaching Entities to Bones
Now, let's say we want to move the attached effect up, around the head like a halo. Right now we cant - the Effect origin remains at the center ot the coordinate system, and the position of the effect itself (or any other attached Entity) depends on the default position it was created with according to that origin. To move, scale or rotate an entity in any way, we must first attach it to a certain bone. And to do that, we need to create a new attach point that depends on that bone.

The easiest way to move the position of any effect or armor piece is to attach it to the base bone that lies in the very the coordinate center - MoveAxis. It's normally invisible, but its location is between the feet of the character. Let's create a new attach point now, corresponding to the "Effect" entity and depending of MoveAxis:
Quote
AttachPoint
{
    name   = "Effect"
    parent = "MoveAxis"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 1.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}

The attach point name and the entity name must be the same, otherwise it wont work.
If you launch the game now, you won't see any difference - the effect will stay at the same position, as MoveAxis' origin is exactly at the center. The only difference is the Entity is controllable now. So we just proceed to moving the effect up via the attach point. Let's try this:
Quote
AttachPoint
{
    name   = "Effect"
    parent = "MoveAxis"
    origin = (0.000000, 1.0000000, 0.000000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 1.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}

Checking the result:


As you see, sometimes attachments may appear on places that are unexpected, depending on the initial rotation/position of the parent bone or the attached entity itself. With some trial and error however you'll learn how to manage that. After a few more tests, here is the correct attach point position:
Quote
AttachPoint
{
    name   = "Effect"
    parent = "MoveAXIS"
    origin = (0.000000, 0.000000, 0.800000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 1.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}


Just a note when attaching particle effects - usually they cannot be scaled or rotated, unless when they come with a mesh of their own. In this case Art of the Hunt effect is just particles, so we can only change its position.

Ok, we made the halo and it looks OK-ish, but there is one problem when attaching effects to MoveAxis - they will always stay at the same height, no matter how the character is moving. Example is this crouching animation:



The better solution in this case is to attach the effect directly to Bone_Head of the character. In difference to MoveAxis, Bone_Head will follow the character's animation, and the attached effect will move with it. Lets try that now, by reseting the attach point and changing the parent bone:
Quote
AttachPoint
{
    name   = "Effect"
    parent = "Bone_Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 1.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}

After you check ingame, you will see that the effect follows the character's head now, only it appears high above it:


Not what we want, so lets try finding the correct position again. After some time, here is a decent attach point for this particular effect:
Quote
AttachPoint
{
    name   = "Effect"
    parent = "Bone_Head"
    origin = (-1.250000, 0.600000, 0.000000)
    xAxis  = (0.000000, 0.000000, 1.000000)
    yAxis  = (1.000000, 0.000000, 0.000000)
    zAxis  = (0.000000, 1.000000, 0.000000)
}



Sadly, armor pieces cannot be attached to bones this way - or they can, but the animations will be terrible. You may think a helmet will fit good attached to Bone_Head.. it seems so, but it doesnt. The only bone armors CAN be attached to with no problem is the mentioned MoveAxis. This gives some interesting opportunities for creature transformations... but that will be a topic of another tutorial.

4.1.2.7 Attaching Animated Decorations

Alright, we learned how to attach armors and particle effects, now lets move to something cooler - how about something moving, like wings?
For this example i'll show you how to attach butterfly wings to the character. This is not very hard to do, as butterflies are already existing ingame as ambient animals (decorations), and they are animated. Lets browse in Art Manager to their file path:


In this case we need an "idle" butterfly record file (doesnt matter what color) - it has static position with only wings moving, while the other one is flying in circles and will be difficult to attach. Copy the record link and create a new entity in the character mesh, with a new attach point to control it:

Quote
CreateEntity
{
    attach = "Wings"
    entity = "records\creature\ambient\butterflyblueidle01.dbr"
}

Quote
AttachPoint
{
    name   = "Wings"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (1.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 1.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 1.000000)
}

Checking ingame:


You can see the butterfly between the character's feet. Now remain two things - to make it bigger and to attach it to the character's back, where the wings should be, and make them follow her movements. Lets start with increasing the size:
Quote
AttachPoint
{
    name   = "Wings"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (5.000000, 0.000000, 0.000000)
    yAxis  = (0.000000, 5.000000, 0.000000)
    zAxis  = (0.000000, 0.000000, 5.000000)
}


The wings are 5 times bigger now, probably enough. All we need now is a suitable bone to attach them to. The best bone for this purpose is Bone_Spine02 - its located on the upper part of character's torso. This time ill skip the rotation/adjustment steps (again, i recomend to use Viewer for that) and just give you the ready to use attach point:
Quote
AttachPoint
{
    name   = "Wings"
    parent = "Bone_Spine02"
    origin = (0.300000, -0.150000, 0.000000)
    xAxis = (0.0000000, 0.0000000, 5.0000000)
    yAxis = (0.0000000, -5.0000000, 0.0000000)
    zAxis = (5.0000000, 0.0000000, 0.000000)
}



4.1.2.8 List of Attach Points
Here i'll briefly describe the default attach points in the player character's meshes. Monsters usually have similar, but their attach points may differ.

"SpecialHit01", "SpecialHit02", "SpecialHit03", "SpecialHit04" - TBH, im not sure what these do. I assume they are used for landing a hit with weapon attacks, but its better to not mislead you with false info.

"Head", "Upper Body", "Forearm", "Lower Body" - These are the default attach points for armors - for helmet, torso armor, armbands and leg armor respectivelly. "Forearm" and "Lower Body" attach points are missing in the default character meshes. To edit the position of arm and leg armors, just create new attach points with these names.

"R Hand", "L Hand" - These are the default attach points for weapons. Usually they are tied to Bone_R_Weapon and Bone_L_Weapon, but for creatures that doesnt have these two bones, you can also use Bone_R_Wrist and Bone_L_Wrist as parents and after adjust the attach point position manually.

"Camera", "HeadCam" - "Camera" defines in what position (mostly height) the in-game camera will show the character when zoomed. Play around with the Y origin to adjust it if needed. If you remove or disable this attach point, the camera zooms at character's feet. "HeadCam" is responsible for the character's portrait in the upper left corner. If you are making a creature PC mod and the head of the character is missing from the portrait, try adding this attach point.

"Target" - As with SpecialHit, im not sure. Probably defines the aim of enemy weapons or ranged attacks.

"Light", "Prey_Effect", "Head Effect", "Particle1" - These are effects. "Light" is the light that surrounds the character at night, "Prey Effect" is the attach point for Study Prey eye effect when cast on the character; the rest are for some other effects or auras, not sure which.
To disable a default attach point, just rename it - for example, "Camera" to "Caamera". This will make it inactive.

4.1.2.9 Rest of TextData section
Besides Attach Points and Entities, rest of the TextData consists of Rigid Bodies data, Joint data and Skeleton Emitter Bones. I'm not very familiar with these. Roughly, Rigid Bodies and Joints define the way a creature mesh reacts on death. You know how a Satyr randomly "splashes" on the ground when killed? That depends on the Rigid Bodies - basically they are boxes around each bone that mimic normal physic laws when falling. If you remove Rigid Body/Joint data and the creature has death animation, it will use it instead. But if it doesnt have death animation, it will just freeze. I assume Skeleton Emitter Bones is related to effects, but cant say for sure.

4.1.3 Bones
I'll skip the next 3 sections of MeshView - Vertices, Triangles nad DrawCalls, because their functions are mostly unknown to me. Let's move straight to the Bones section - you can do some pretty cool things there. To begin, ill try to give a brief definition of what are bones in 3D models.
Basically, bones are invisible objects used to deform the surface of a mesh through animation. Each bone has a certain influence over its surrounding vertices (points on the surface of the mesh that build it's geometry structure). Also, bones usually have their own hierarchy of Parent > Children, which means deforming the parrent affects its children bones. Here is an regular example of a skeletal structure in Titan Quest (in this case i'm using a Machae model):



The arrows show the connection between parent and child bones. This hierarchy is important to know when making animations or when changing the size and shape of a certain bone. But i'll stop to this in more detail in the next parts. For now lets just open the Bones section of the Machae mesh by expanding it:


Here you can remove all bones if you desire so. Not much else to do here, so we move to the next part - the bone data.

4.1.3.1 Bone Data
Lets open the first bone in the list - MoveAXIS. We see this:


"Name" - Here you can change the name of the bone. This is useful when you dont want this bone to be affected by animations (disabling it), or to fit with a certain animation of a bone with different name. I'll come back to this a bit later.

"First Child" - Not sure, probably which bone is the next child of this bone in the list.

"Child Count" - how many child bones this bone has.

Under these are 4 columns, where you can see the position, rotation and size of the bone. From left to right column - X, Y, Z, Origin. This is very similar to the attach poins, only here we can edit parameters of the current mesh instead. In this case, if we translate the values of MoveAxis into Attach point values, it makes this:
Quote
    origin = (0.000000, 0.000000, 0.000000)
    xAxis = (1.0000000, 0.0000000, 0.0000000)
    yAxis = (0.0000000, 0.0000000, -1.0000000)
    zAxis = (0.0000000, 1.0000000, 0.000000)

Sadly, you are more limited with the manipulations you can do to bones than to attach points, especially with this particular bone. One basic rule is - don't touch the Origin values ever, or the mesh will become distorted. I'll show you more of what you can do with the next bone - Bone_Root.

4.1.3.2 Reshaping a Model through Bone Data
For this example i'll be using the vanilla female model again, to show you how you can reshape it just by changing the scale and rotation of different bones in MeshView. This is how i started modifying the early versions of Ariadne. It's a bit time-consuming and based on trial and error, but i still refine my models using this method sometimes, because its very precise.
After opening the mesh, we expand Bones section and click on Bone_Root, to see the values are not as clean as they were with MoveAXIS:


First, if you want to simplify things, all the values that contain letters in the first 3 columns (for example: 2,503327E-08) can be made 0 without problem. My guess is that these are very small numbers for rotations and they have almost zero influence on the mesh. Let's clean them:


Now remain the values that matter. Values that are close to 1 mostly define height, width and depth of the bone, values closer to 0 mostly define rotations. Since Bone_Root is a base parent bone, it affects all other bones in the skeleton. Lets look again at the model in-game, before changing anything:


To make things easier, i'll give you some more directions of what value is for what for which type of bone. For Bone_Root in particular:


For all Vertical bones, aligned with the main Y axis:


For all Horizontal bones, aligned with the main X axis:


For all Horizontal bones, aligned with the main Z axis:

 
Knowing this, we can start experimenting. Let's return to Bone_Root and increase its width by half, just for the try:


Checking ingame:


Lol. What did you expect? :D
If you notice the bones stretch, but they keep their default position. It's because we don't change the origin, only the width.
But that was way too much haha. Lets reset the width value to default again and try editing the rotation values this time:




Even by a small amount the result is drastic... and quite alien looking lol. If you want to make a model prettier though, you need much smaller changes.
I'll leave further experimenting to those who are curious. If you want to make a thin Satyr Brute, a fat Machae, or you just want a monster to fit better with armors that are uncommon to it, you can try this method. Just find which bones to stretch or rotate and to what degree.
BTW, talking about fitting armors... there is one more thing you can do using bone data - transfering bones. I'll explain about it in the next part.
(Continuing on 5-th post)
« Last Edit: 08 March 2021, 10:32:49 by nargil66 »

Not Yet Rated!

Offline monkas

  • Beginner
  • *
  • Posts: 8
  • Country: vn
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • Awards
  • Time Zone: -7
Re: Tips & Tricks with MeshView
« Reply #3 on: 02 August 2019, 09:09:14 »
Thanks for you for your tutorial.  :-* :-* :-*
« Last Edit: 02 August 2019, 10:42:29 by monkas »

Not Yet Rated!

Online nargil66

  • Forum Moderator
  • Full Member
  • *
  • Topic Author
  • Posts: 2490
  • Country: bg
  • Karma: +67/-1
  • Gender: Male
  • Mesh-Texturing Beautifier :)
    • View Profile
    • Awards
  • Time Zone: ?
Re: Tips & Tricks with MeshView
« Reply #4 on: 02 August 2019, 13:25:05 »
4.1.3.3 Transfering bones between meshes
To show you how to transfer bones from one mesh to another, ill use another example. Let's say you want to make a character addon mod that replaces the vanilla female character with a nymph (also vanilla). You extract the nymph mesh and textures, copy them to your main game Database folder (you are probably familiar with the directories if you played any of my addon mods) and rename them to default female ones. Seems easy, but when you launch the game the attach points are a mess:




Normal adjusting of attach points won't be enough in this case. Why? Because the two meshes have different bone position, size and rotation, which makes things even harder. However, transfering bones can help. All you have to do is copy the data from human female bones and replace the nymph bone data. The nymph mesh appearance won't change much, but with some adjustments human armors will fit much better. Lets start with Bone_Head. We open the female model in another instance of MeshView and start transfering the data:



Again, you dont need to copy values containing letters - they are insignificant. And here too we dont touch the Origin column. Save the Nymph mesh with the changes and launch the game to test:



Even with this small change it looks much better. Now we can move to adjusting the torso. After tranferring Bone_Spine01 however (the lower torso bone), the helmet and armband positions are moved:



Hehe, you didn't think it will be THAT easy, did you? Bone_Spine01 is a parent bone of the upper body chain, so all its children bones get affected even by a slight change. We have to transfer the entire chain, which gones like that: Bone_Spine01 > Bone_Spine02 > Bone_Neck01 > Bone_Head; and for the arms: Bone_L/R_Clavicle > Bone_L/R_Shoulder > Bone_L/R_Forearm and perhaps Bone_L/R_Wrist. Its better to start with transferring the upper torso and neck bones. When you reach transferring Bone_Neck01, you may notice that the bone is named differently on the nymph (just Bone_Neck without 01). Is this important? Yes, because we want the nymph to react better to human animations. Right now the neck of the nymph is "stiff", like wooden. Well, adding "01" to the bone name will fix that:




Left - Before, Right - After
« Last Edit: 08 March 2021, 10:07:34 by nargil66 »

Not Yet Rated!

Offline soa

  • Modder
  • Full Member
  • *
  • Posts: 517
  • Country: fr
  • Karma: +21/-0
    • View Profile
    • Awards
  • Time Zone: +1
Re: Tips & Tricks with MeshView
« Reply #5 on: 12 March 2020, 00:46:42 »
Here's the basic formula for the rotation matrixes around the reference axis :



Angle is positive when your turn :
+y axis towards +z axis
+x axis towards +y axis
+z axis towards +x axis

In Viewer or PSE Editor axis are this way, x is red, y is green, z is blue


For instance, 45° around y (positive angle, +z goes towards +x) gives
cos 45°  0     sin 45°
     0      1       0
sin 45°   0    cos 45°

Hence
Quote
AttachPoint
{
    name   = "Head"
    origin = (0.000000, 0.000000, 0.000000)
    xAxis  = (0.707107, 0.000000, 0.707107)
    yAxis  = (0.000000, 0.000000, 0.000000)
    zAxis  = (-0.707107, 0.000000, 0.707107)
}

The result you gave for a 45° turn is actually a -135° turn.

Now I'm trying to adjust a shield on a Valkyrie model, I've successfully made it close to okayish using this method but is there a easier way to change the angles of the attach points in Viewer, or elsewhere ? It keeps giving me an alert of "Attachments points not editable ! Set active in Art Manager" when I try to touch them. Set As active in AM does nothing.
« Last Edit: 12 March 2020, 00:49:54 by soa »
Soulvizier for AE, Ragnarok and Atlantis [released] :
https://titanquestfans.net/index.php?topic=1201.0  / Discord : https://discord.gg/qs9t6AA
Overhaul mod with many new monsters, skills, items, features, balance and bugfixes. Increased difficulty.

Not Yet Rated!

Online nargil66

  • Forum Moderator
  • Full Member
  • *
  • Topic Author
  • Posts: 2490
  • Country: bg
  • Karma: +67/-1
  • Gender: Male
  • Mesh-Texturing Beautifier :)
    • View Profile
    • Awards
  • Time Zone: ?
Re: Tips & Tricks with MeshView
« Reply #6 on: 12 March 2020, 01:36:29 »
The easier method is if you just use 3d editing program like Max. You import the valkyrie model with attach points, then import the shield, then Align and Link the shield with the attach point dummy (L Hand in this case). Next you start rotating the dummy (+the shield) to the position you need it. Finally, you export the character mesh + the attach point and you copy TextData from the exported mesh to your actual mesh.
Aside from Viewer, thats the only other method i know of.

Not Yet Rated!

Online nargil66

  • Forum Moderator
  • Full Member
  • *
  • Topic Author
  • Posts: 2490
  • Country: bg
  • Karma: +67/-1
  • Gender: Male
  • Mesh-Texturing Beautifier :)
    • View Profile
    • Awards
  • Time Zone: ?
Re: Using Tamschi's MeshView
« Reply #7 on: 06 March 2021, 23:08:16 »
Added more info (see first two posts).
« Last Edit: 07 March 2021, 08:27:20 by nargil66 »

Tags:
 


SimplePortal 2.3.7 © 2008-2024, SimplePortal