My first: Character

From Divinity Engine Wiki
Revision as of 14:42, 11 October 2017 by Alena (talk | contribs)
Jump to: navigation, search

Creating a character can be roughly divided into three parts:

  • Creating a creature (monster or animal)
  • Creating body parts and hairstyles (heads, hairstyles, beards)
  • Creating Armor


Creating custom characters is a very technical and complicated process. It will require artistic skills and profound knowledge of 3d modelling, texturing, rigging, skinning, animation and Larian editor.
If you do not possess all the skills mentioned above and still want to make custom characters we strongly recommend reusing existing rigs and animations.

To make a creature you can either:

  • Make your own custom creature, rig, animations
  • Make your own custom creature that will use already existing rig and animations (recommended)

Larian pipeline of creature creation in a nutshell:

  1. Concept
  2. Creation a high poly asset in zbrush
  3. Retopo, unwrap
  4. Texturing
  5. Testing your mesh in the editor
  6. Rigging
  7. Skinning
  8. Animating

Note: if you're reusing existing rig you can skip #6 and #8

File formats

In the editor 3d models are saved as granny files (.GR2).
The textures are saved as DirectDraw Surface (.dds).

More info on Granny 3D can be found here
More info on DirectDraw Surface can be found here

Creature editor set-up

Lets take an example of the troll creature.
To be able to implement a troll creature in the game you need:
Resources:

  • 3d model
  • Textures: Base Map(BM) Normal map (NM) and Physical map(PM)
  • Material
  • Physics mesh
  • Ragdoll mesh
  • Animation files (won't be covered in this guide)

Special editor files (more on them later):

  • Visual Set
  • Root Template


Example file of the troll creature: Troll example
Example of all the resource files in content browser:

Troll ContentBrowserResourses.jpeg

Modelling

General modelling tips:

  • All the joints areas should have the proper cuts (bending cuts- see below), aligned accordingly along with the respective naked model of the race you’re modeling.
  • The armors are using the same rig as the naked model, evidently joints need to be placed correctly, with as similar cuts as possible.
  • No Scaling applied to the meshes: reset X-form.
  • No N-gonsю Only 3 (triangles) and 4-gons (quads) are allowed.
  • Delete any unused vertices and floating triangles.
  • Meshes that are supposed to be cloth simulated (capes, hanging piece of cloth, flags, etc) should be built as follow: NO thickness. Try to keep their polycount optimal (500 triangles max per mesh).


Joints1.jpeg

Reasons for the Cuts:
The cuts that are made will be used to squash and stretch at joint areas.

Joints2.jpeg

The green and red meshes are skinned to the same rig and posed in the same way.
The green mesh has the correct shapes to create a nice rolling bend of the knee. whilst the red mesh is missing the shapes and cannot be bend in the same way.

Joints3.jpeg

When creating the shapes there must be enhough space to straigten the leg the red mesh has a shape to small to straighten the leg without it collapsing on itself

Joints4.jpeg

In this example the shapes do not match the location of the kneejoint and there for are not used in the skinning.
Make sure when creating the mesh to look at the size of the shape and location of the joints.

Fingers.jpeg

When making the Fingers make sure they all rotate the same way in their base position

  • Bottom of feet should be as flat as possible.
  • Use smoothing groups sparingly AND intelligently: don’t use 32 smoothing groups when 4 is enough.
  • Make sure the armor/clothing pieces are not clipping through one another.
  • The vertices along the center world line (symmetry line) should be obviously aligned correctly in the center.
  • Close your armor pieces: the player starts with a naked model then can individually dress up his character with any armor piece you’re going to make. It is therefore important there are no holes. Also, make sure your Lowerbody and Upperbody pieces hide the cut at the waistline level.
  • About objects that can bend (e.g. tails), don't put concave (=bending inwards) curves in it. They should be as straight as possible in neutral pose.
  • Final character should be centered on origin (x0,y0,z0) and fit the naked model provided.


Don't forget to make a physics mesh for your character, it needs it to collide with environment and so the player can click and select your character on the screen.

Textures


In DOS2 we use f Physically-Based Rendering (PBR).
To learn more about PBR you can read PBR Guide by Allegorithmic here.

A creature, like troll, usually needs basemap (BM), normal map(NM) and physical map(PM) textures.
Larian editor uses .dds textures.
Texture examples:

TextureExamplesTroll.jpeg

We pack Metallness in the Red channel, Roughness in the Green channel and Ambient Occlusion in the Blue channel of Physical map.
Why our NM and PM textures look different from the ones used in other game engines ?
-In image files (including dds) the red channel gets the least bytes assigned to it this causes some detail loss which you don't want.
To circumvent it/improve quality, we swivel our red channel into the alpha channel to instead of outputting RGB with output xGBR maps.
Larian primarily uses Substance Painter for texturing our characters and assets. You can get/try it here.

Materials


After you imported your mesh and textures in the editor you need to create a material.
We have a couple of Larian materials(shaders) you can use:

Materials.jpeg
character folder:
CharacterMaterials.jpeg

Character materials have fresnel effect on them so you can see your character in various environment and it also has MSK system, that helps you change colors on certan things like skin and cloths (more on MSK later).
If you don't need this functionality you can use any material from the "Base_PBR" folder.
After you created your material assign your textures in it and assign material to your mesh. (double click on material in content browser; double click on the mesh in content browser)
If your are not using MSK but still want to use character material, just leave it empty (don't enable it in the box) or assign a black texture to it.
You can edit the functionality of the material by right clicking it in content browser and selecting "Open in editor".

MaterialEditor2.jpeg

Beware if you make changes and save the material all the assets that are using the material will change accordingly.
You can always make edits and "save as" a separate copy for testing purposes.
Material source file can be easily changed if you select your material in the content browser and go to the side bar.

MaterialSourceFile.jpeg

If you change the sourcefile of the material you need to reassign textures.
You can also see a "Material Type" parameter in the side bar of the material. the parameter will trigger different sound effects in the game depending in the type of your material, so don't leave it unassigned.

Visual Sets

Visual sets are special editor files, which help us organizing characters, their armor, body parts and colors.
It also possible to a create without the visual set, in case you don't need any functionality mentioned above.
Visual Set consists of 9 visual lists, where you can put meshes and 3 color lists where you can store colors.
Visual set example:

VisualSetExample.jpeg

If you're working on a unique creature that doesn't need as many equipment pieces as our regular characters, you can put armor meshes in any visual list. (the names in brackets are for your convenience and consistency).
Although it is recommended to keep something in either list #3(Torso) or #2(Head) because of material sounds functionality.
Our troll example visual set:

TrollVisualSetExample2.jpeg

Troll creature doesn't need to equip armor so it has some unique meshes in visual 3 (torso) list.
!Important! You can also leave the meshes unassigned meshes by pressing "X" button.
Space in the visual set is very limited, cause each visual set is stored in unit64. So you might have to create multiple visual sets for different armors.

Colors in the visual set
There are 3 color tabs in the Visual lists: Skin, Hair and Cloth colors. And 5 color rows you can change on the bottom.
In the lists you can select and store colors. And in the rows on the bottom you can select colors from the list.

VisualSetColors.jpeg

To be able to edit colors from the visual set you need your mesh to use character pbr material and have MSKskin and/or MSKcloth.
Our MSK pipeline will be described below.

Root Template

To be able to spawn a character in the editor you will need to create a root template for it.
More advanced guide about root templates here

RootTemplateTroll.jpeg

You will need to edit following parameters for your creature:

  • Ai Bounds - preferably a cylinder for the creature.
  • DisplayName
  • Physical Resource (physical mesh of your character)
  • VisualResourseID - your actual mesh with the rig (could also be just a file with the rig)
  • VisualSetResourseID (if any)

Make sure it has:

  • ExplodedResourseID
  • ExplosionFX
  • HitFX
  • Icon
  • RagdollResourseID
  • Stats

Do not scale creatures unless you really need to. If scale a creature some animations, like climbing will not work properly.
Small scale like 1.1 -1.3 is generally ok.
Only use "IsPlayer" property for testing.
Beware if you make your character "IsPlayer" the equipment system will not work properly. (More about equipment below)

Root templates and Visual sets. There are 3 ways of using visual sets for creatures in root templates:

  1. Not using visual set for creatures - you put character mesh with all boned in VisualResourseID
  2. Using visual set only for armor/equipment for your character - character mesh with all boned in VisualResourseID + visual set with armor meshes, skinned to the character.
  3. Using visual set for both body parts and armor - just the rig with all bones in VisualResourseID +visual set with naked body parts and armor.

Most of the animals use #1, most of the creatures with equipment use #2 and ALL of NPC of our playable races use #3 approach.

Character creation visuals


If you want to change Character Creation(CC) visuals you need to change "hero" root templates of our playable races:

HeroRootTemplates.jpeg

Hero root templates also have their own "hero" visual sets:

HeroVisualSets.jpeg

If you add/delete meshes from hero visual sets it will appear/disappear in Character Creation(CC). So to add/modify meshes in CC you just need to add them in those visual sets.
Hair, Heads and Facial Features come from hero visual sets. while colors and armors in CC come from stats.
To change the color selection available in character creation you need to change Race Presets files:

RacepresetsFile.jpeg

To change or add color of the hair/skin you will need to change the value of the colors.
Example of the value of the color:

ExampleColorValue.jpeg

Color value is "0xff" + it's Hex Color Code. So completely while color will be 0xffffffff; completely black - 0xff000000


To change armor equipment and colors you will need to modify "ItemProgression", "Equipmet" and "Item Colors" stat files. Those will require more advanced knowledge. Guide on stats is still WIP here.


Armor and Equipment

There is a difference in code between playable and NPC characters. NPC characters, as mentioned above, use visual sets for armor, while player characters use equipment. NPC visuals is just a rig in it's root template with all the armor and body parts stored in visual sets, while player characters have their naked body parts in them, which can't be unequiped, and are hidden when player equips armor from eq root templates.
So when you make armor you need to ask yourself a question:
Do you want players to be able to equip your armor piece or is it going to be just a unique npc/creature armor?
If not:
You just need to create a mesh, import it to editor and add it it your NPC visual set.

  • If yes you need to make sure you do the following:
  • Create meshes for each race and gender. So you need to have 8 meshes + 8 skeleton version variation.
  • Your armor pieces needs to be made and cut the same way as already existing equipment, so they could fit with each other.
  • Meshes need to be textured and masked the same way (read about MSK system below)
  • Create separate eq root template and add your meshes to eq data.
  • Create foldable mesh of your armor piece (Mesh that you see when you drop an armor piece on the ground)
  • Crete an icon for your eq root template
  • Give stats to your new equipment and make sure it can be generated for loot.



Downloadable files

Example files of the creatures Animals:
Bear example
Boar example
Cattle example
Crocodile example
Deer example
Dog example
Frog example
Pig example
Rat example
Salamander example
Squirrel example
Tiger example
Turtle example
Wolf example

Example files of the creatures Creatures:
ElementalDevil example
Gheist example
Insect example
Merman example
Werewolf example
Automaton example
SourcePuppet example
Troll example