Difference between revisions of "My first: Character"

From Divinity Engine Wiki
Jump to: navigation, search
Line 134: Line 134:
 
== Root Template ==
 
== Root Template ==
 
To be able to spawn a character in the editor you will need to create a root template for it.<br />
 
To be able to spawn a character in the editor you will need to create a root template for it.<br />
More advanced [[ https://docs.larian.game/My_first:_Root_template|guide about root templates here]]
+
More advanced [[My_first:_Root_template|guide about root templates here]]
 
[[File:RootTemplateTroll.jpeg|none]]<br />
 
[[File:RootTemplateTroll.jpeg|none]]<br />
 
You will need to edit following parameters for your creature:<br />
 
You will need to edit following parameters for your creature:<br />

Revision as of 13:44, 11 October 2017

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

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.


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