Author Topic: [Tut]Creating models  (Read 1380 times)

0 Members and 1 Guest are viewing this topic.

Not Yet Rated!

Offline Endymion

  • Modder
  • Hero Member
  • *
  • Topic Author
  • Posts: 55
  • Country: aq
  • Karma: +1/-0
    • View Profile
    • Awards
  • Time Zone: ?
[Tut]Creating models
« on: 26 August 2018, 22:22:12 »
In this thread I'll try to do a quick write-up on how to create a mesh for Titan Quest using 3ds Max.

1) MSH tools by tokloo v1.0.8.3
Spoiler for Links:
MSH tools is a macroscript for importing & exporting .msh and .anm files. At the moment it's the only tool that allows you to import meshes and animations from the game formats as it is, which gives you crucial points of reference.

Spoiler for Installation:
Place the script in your 3ds Max Scripts folder.
Launch Max, click MAXScripts and run MSH Tools script.


Right click on Utilites Panel, click Customize... In the popped up window choose MSH Tools in Category rollout.


Drag Export & Import MSH buttons onto Utilites Panel.

Spoiler for Description:
Partially salvaged from tq.net via wayback machine

Spoiler for Import:
Open Import MSH to import a mesh or animation to your scene.


Choose the file format in "Files of Type:" rollout.



Spoiler for Export:

Spoiler for I. Scenery decorations:
Mesh

Before exporting a model, make sure it's converted to Editable mesh and has texture coordinates.
Open Export MSH and add your model under Objects tab, Meshes rollout.


Choose a shader in Textures tab below. Click Add button, you'll see the default list of shaders.
Usually you'll be using StandardStatic - for unanimated objects, and StandardSkinned - for everything that has bones and Skin modifier.
You can set any shader existing in the game and edit their properties manually.


Double click and set your texture paths in baseTexture & bumpTexture fields accordingly. Via Import button you can import texture sets of existing meshes.


Once you've set up your texture, assign its number to a model in Meshes rollout by doubleclicking on it.


Hitbox

Use Box objects to create a hitbox for your mesh.


You'll need to Center Pivot to Object for your newly created Boxes.


Then place them at zero Absolute coordinates, otherwise they won't be exported properly. After that adjust your Boxes in accordance with the model.


Convert the Boxes to Editable Mesh and add them in Objects tab under Hit Boxes rollout.


Finally your mesh export is set.
Under General tab, click brouse and choose the name for your file.
CLick Export to export your model.



Spoiler for II. Pieces of equipment:
A) Weapons



When working with equipment you'll be better off importing some similar mesh from the game and using it as a template.
Import a dummy weapon.


Align your model accordingly. Notice Anchor1 & Anchor2 attach points, the space between them defines trace effect's source (when characters swing a weapon).


Add your mesh & assign textures in Export MSH. Weapons are unanimated models, use a static shader.

Add the attach points under Objects tab, Dummies rollout. You can select every objects in the scene (Ctrl+A) and click Add Selected button, it'll only add Dummies.


Now your model is ready to be exported. Note that equipment doesn't need hitboxes.



B)Armor

To adjust your armor properly you'll need the player character mesh imported(Creatures\pc\female\femalepc01.msh; Creatures\pc\male\malepc02.msh).
Just like with weapons, you can use a dummy armor mesh.


Align your mesh accordingly. Add Skin modifier and required bones, tweak weights.


Once you've done, open Export MSH and add your mesh, textures (you're using a Skinned shader now). Export it.

Spoiler for III. Collision mesh & Ground points:

Collision mesh is used to create a pathable surface for a mesh.


Create a low poly copy of your mesh.


Add it in Objects tab under Collision Mesh rollout.


Double click on it to see pop up menu.


Click Show button, it'll autoselect the mesh. Select pathable faces for your collision mesh. The unselected parts will serve as a hitbox (on a side note: You don't need to create a hitbox if a model already has a collision mesh). Click Set button.



Ground Points are used to attach the pathable part of a mesh to terrain, which is necessary in order for characters to be able to walk up on to the mesh from terrain and vice versa.

Use Cross Point Helpers to create ground points. Attach each ground point to vertices of the pathable part of your collision mesh in the counter-clockwise order. Click Edit button under Ground tab to see the list of ground points.


Another example of ground points placement

Now your mesh is ready for export.




Multiple Ground Points groups
TBW

Spoiler for IV. Portals, i.e. grid entrances:


Use a Plane object to create a portal plane. Convert it to Editable Mesh before exporting.
In order for portals to work properly, entrance & exit meshes need to have an attach point called "ChokePoint" with carefully adjusted coordinates. Use a Dummy object to create ChokePoint and place it at the bottom center of the portal plane.


Z axis of the dummy should face a character as he enters the portal.


Add the portal plane and ChokePoint under Portals and Dummies rollouts respectively.


It's worth noting that outer grid entrances (the ones being placed on a terrain region as opposed to a grid)  usually have a collision mesh to smooth pathing transition.
Spoiler for V. Vertex Color:
TBW
Spoiler for VI. Attach Points:
Using dummies you can attach a .dbr to your mesh, be it an effect entity, light source, or a piece of equipment.
Double click on an attach point in Dummies roll out to fill in an entity's records path. To attach it to a specific bone, set the bone's name in Parent field.



Spoiler for VII. Animation:
Couple of notes about animation:
Animation only works with bones.
First frame of an animation has to be the default T-pose, in order for the script to capture beginning of the animation correctly.

When exporting, animations only require bones, you don't need to set up the model/hitboxes/dummies. In most cases you'll need to have Export all bones box checked.

2)TQ's 3ds max plugin (x86 max)
There's no official documentation to be found anywhere, however evidently its set up is similar to 3ds plugin for GD.

Spoiler for Setting Up:
In order for Max to be able to see the game's contents, proceed to C:\Users\*User*\Documents\My Games\Titan Quest - Immortal Throne\ and open Tools.ini. Set core Titan Quest directory (If you have mods with custom assets you'll be using add their paths too) path in additionalbuilddirs field.


Copy over .dlls found in Titan Quest core directory to 3ds Max installation folder. Copy MaxPlugins.dlo to your 3ds max plugins folder.

For the game shaders to work properly you'll need to set Direct3D in renderer settings. Launch Max, in Preferences Settings (Customize->Preferences on Utility Panel) open Viewports.
Click Choose Driver, then Revert from Direct 3D. Select Direct3D and press OK. Restart 3ds Max.

Spoiler for Description:

Materials
To export a model you'll need to assign it a one of the game's shaders.
Open Material Editor (M), set it in Compact Mode. Click Standard button and select "Shader" material.


Click on the elipsis to choose a shader.


After you've set textures' paths the material is ready to be applied to a model.


Hitboxes
Use hitbox helpers found on Create panel/Helpers to create a hitbox for your mesh.


Export Object


Upon finishing up, place one Export Object somewhere on the scene.


Save your .max to your mod's source folder.
Open Art Manager and Auto-Create Asset for your model. Build your mod.






3) GD's max plugins ('09/'11/'12 x86 max)

Guide by one of the devs is found here.

GD and TQ meshes differ by the fourth byte in their files. 02 for GD; 0a and 0b for TQ. 0a type allows only one texture per mesh so you'll never really need that.
Once you've built your models in Asset Manager convert them via any hex editor and they're good to go for TQ.
Spoiler for Hiden:
Although I have to add GD uses more advanced technology, some of the mesh data will essentially be a dead weight when used in TQ. No idea whether it affects the game performance in any way.
« Last Edit: 15 September 2018, 21:46:02 by Endymion »

Not Yet Rated!

Offline tokloo

  • New Member
  • *
  • Posts: 1
  • Country: de
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • Awards
  • Time Zone: ?
Creating models
« Reply #1 on: 16 January 2019, 04:26:24 »
Note - Checking links on own risk, all uploaded on site with name "fast-files". - efko

This is the original text of the tutorials, that I published on www.titanquest.net  in 2016.

Spoiler for links:
MSH Tools v1.0.8.3 (19 Jun 2016)
MSH Tools v1.0.8 (15 Jun 2016)
MSH Tools v1.0.6 (12 Aug 2015)
MSH Tools v1.0.5 (23 Feb 2015)
MSH Tools v1.0.4 (18 Feb 2015)
MSH Tools v1.0.3 (14 Feb 2015)
MSH Tools v1.0.2 (26 Oct 2014)
MSH Tools v1.0.1 (23 Oct 2014)
MSH Tools v1.0.0 (13 Oct 2014)

MSH Tools is the macroscript for the 3dmax to import and export TQ's files of models(.msh) and animations(.anm).
It was created by 3d max 9.0 (Errors may be on low versions)

This script also can work with files of Grim Dawn, but errors may be.

Excuse me for spelling and report about serious mistakes to me, please.

I'll try to tell about all functions of my script by examples.
It still has many errors.

Installation
Spoiler for Hiden:
  • 1. Download and move the script into the ...\ui\macroscripts directory.
  • 2. Then on the Utilities panel, click MAXScripts -> Run Script... and run this script.
  • 3. Click the Customize menu and choose Customize User Interface.
    • a) to add a button to a toolbar
      • 1. Click the Toolbars tab.
      • 2. Choose MSH Tools in the Category drop-down list.
      • 3. Drag Import MSH and Export MSH from the list to some toolbar.



    • b) to add a command to a menu
      • 1. Click the Menus tab.
      • 2. Choose MSH Tools in the Category drop-down list.
      • 3. Drag Import MSH and Export MSH from the list to the right list.



For example, add to the File menu on the Utilities panel.

Import MSH
Spoiler for Hiden:

  • 1. Click the Open button.
  • 2. Choose necessary a file type in the File Types drop-down list.
  • 3. Open the file.
  • 4. Select necessary for import to the 3dmax scene (if you will select import an animation, then all checkboxes will be disabled).
  • 5. Click the Import button.

Export MSH - Tutorials

Weapons
Spoiler for Hiden:


Import some original weapon to the scene.



Then import your mesh.

To export it correctly your mesh should be Editable_mesh geometry class and has texture coordinates.
Texture coordinates must be in the first map channel.

Also it's necessary that each vertex of your mesh has one normal.



Align your mesh and set correct scale.
Now you can delete old mesh.

There is the trace of the weapon between "Anchor1" and "Anchor2" attach points .
There is "Anchor1" on the tip of the sword and "Anchor2" on the sword handle.

The others attach points define position temporary effects.

Preparations is finished, now open the Export MSH macros.



In the first rollout add your mesh.



Then choose Dummies (They are Attach Points) in the first drop-down list and add all here.



Below in the Texture rollout add your texture.

You can click the Add button to choose a template to create new texture.



There is the empty template and three often used shader templates there.

But you click the Import button to import the texture list from another file.

There are many shaders and their properties. It's for another article.



Double click on "baseTexture" and "bumpTexture" in the texture list and set the path to your textures.



Now return to the first rollout and choose Meshes in the drop-down list, then double click on the name of your mesh and set the number of the texture more zero.
It's important because if some mesh has the texture number equal zero then the model will not be displayed.



In the last rollout click the Brouse button to select the name of the file to be saved.

.mif is really mythical file format. I didn't find any original file, but in some article it is written that this file include attach points and other text data, which you will set later.
Therefore you can write here what you want or pass it or click button below to import the path to one from the original file.

Textdata include the skeleton geometry and cannot be changed by this macros, therefore it should be imported from the original file, if it's necessary.
But now pass this edit box because the textdata of weapon files include only attach points.

Click on the Export button.



Now can test the model.

Effects
Spoiler for Hiden:


To create an effect choose Dummies in the drop-down list of first rollout and double click on some point of the list.



There is a parent bone in the Parent edit box, if it exists.

Export attach points already have their parent bone and the list of effects from the export file.



Click the Add button and then double click on the added point of the list.
Write path to some .dbr file in the showed dialog.

One attach point may contain several effects.

You can look effects in Editor.


For example



I have created new dummy and moved it at the sword pommel.



Then I have added two effects:
records\effects\projectiles\343_arrowfrost_flight_fx.dbr
records\Lights\staticlights\10mlight_stat_blue.dbr



It looks so



or with my own effect.

The .dbr file can have not only effects but also something other.
Vertex Color
Spoiler for Hiden:
Also the .msh format lets you set vertex color.



After import you may open the VertexPaint modifier to see vertex color



and alpha channel.


Now about export.

Open the VertexPaint modifier.



Leave the closed lock not to get confused later.



After you painted vertexes in the VertexPaint modifier, open Export MSH.

You must use texture shaders with "vertexcolors" words that vertex color will be displayed.

In this case I use standardvertexcolorstatic.ssh.



Don't forget to check the Vertex Color checkbox.



So it looks in Editor.




To paint the alpha channel create new channel.



Choose alpha in the shown dialog.



Each channel must have own modifier.



Export the mesh.



See in Editor.
Armors
Spoiler for Hiden:
At first, import the model of your hero.



We need it to try on our armor, but first of all we need its bones.



When your armor is completed add the skin modifier.



Then add bones that must have vertices of the armor and set their weights.

All is ready for export. Here do all in same way as in the first tutorial.



But shader must have word "Skinned".
It's necessary because the mesh won't displayed if the mesh has the skin modifier and the shader don't support the skinned meshes.
And on the contrary it's impossible to use the shaders support the skinned meshes with the mesh has not the skin modifier.

In this case it's StandardSkinned.ssh

It's all. Click on the Export button.


Decorations
Spoiler for Hiden:
Choose some mesh, open the script and..



..do just as in the first tutorial.



To create an impassable area choose Hit Boxes in the drop-down list and add some mesh.

It may be the object directly but only its border box are exported.



Or create a box yourself. Don't forget to convert to Editable Mesh.


Platforms
Spoiler for Hiden:


If you create some building then you may need impassable and passable areas of any form.



Create a low poly mesh.



In the first rollout choose Collision Mesh in the drop-down list and add this mesh.



Double click it in the listbox to show its options.

If you added the imported mesh in the list, you can click the Show button to see its passable faces.



Select your low poly mesh, open the Modify Panel, Faces Sub-Object level and select faces that will be passable, then click the Set button.

You can export.


Ground points
Spoiler for Hiden:
Many buildings link with the map. For this purpose there are the Ground points.





But sometimes it's necessary, that there was some area is between the mesh and the map plane. Especially if the mesh has not right borders.



This area (1) is simple mesh that is imposed on the collision mesh (2) and links the basic mesh and the ground points (3).

It's logical to begin from the collision mesh.



To exclude cracks between the mesh and the ground area detach some faces from the collision mesh for it. Then edit this plane, if it's necessary.



Add this mesh in the Meshes listbox as other meshes then in the Ground rollout set the number of this mesh in the list.

Also create a new texture for this mesh and in the shader property write TileBlendingStatic.ssh
Now transparent texture vertices will have a map texture. It's not necessary to create a new texture file for this purpose, a small transparent part can be created in the basic texture as it was done by creators.

The ground mesh is not obligatory. Let's come back directly to the ground points.



Click the Edit button in the Ground rollout.

It's recommended to place ground points on vertices of the ground mesh or the collision mesh.
To create new ground points select some mesh and go to the Modify Panel, Vertices Sub-Object, then select some vertex and click the Add button in the earlier shown window.

Ground points should be located in a counter-clockwise direction and not more than in 2-units steps between each other.

For ease of sorting, a click of the ground point in the list selects this point.
The Add button adds the ground point to the current item of the list.
Also there are the Up and Down buttons for this purpose.


(another bridge is on this picture)

And remember that ground points must be normal(perpendicular) to the map plane.
For ease, there is the Show Axis Tripod button in the Ground rollout, a click of it shows axises of all points on the scene. The Z axis is the normal.



Sometimes it's necessary to create several not connected with one another groups of the ground points.
Ground points are sorted by colour therefore create a new point and set another colour to add a new group. To show the new group reset the Edit window.


Portals
Spoiler for Hiden:
Create any plane, don't forget to convert to Editable Mesh. It will be the portal directly.



Faces of plane should look at the hero, which will enter to it.



Add this mesh in the Portals list.



Now create a dummy with name "ChokePoint", that is necessary to set orientation of portal. In other words, it's connection dot of two portals.

The Z axis of the dummy should be directed as portal faces. The dummy usually is on the plane of portal in center of bottom side.



Add the dummy in the Dummies list and export.



The portal is ready for use.
« Last Edit: 16 January 2019, 05:23:11 by efko »

Not Yet Rated!

Offline efko

  • Administrator
  • Full Member
  • *
  • Posts: 569
  • Country: cs
  • Karma: +15/-1
  • Gender: Male
    • View Profile
    • Awards
  • Time Zone: +1
Re: [Tut]Creating models
« Reply #2 on: 16 January 2019, 05:25:56 »
Welcome to the forum tokloo :)
I made a small orange note for other users on beggining of your post so they can know to where they will go if click.
discord: efko#5979
╚►They say "Before you die your whole life flashes before your eyes…". Make it worth watching. It's true, even for a blind man... ◄╝
              ╚►It is said some lives are linked across time, connected by an ancient calling that echoes through the ages ◄╝

Tags: