View Full Version : Tutorial for creation of shaded Leaderheads


Ploeperpengel
Jul 08, 2007, 05:53 PM
In FFH most models get produced with Blender but some abilities like making shaded models is currently only doable with expensive programs like 3Ds max. In the FFH team I often get nice models from C.Roland who is blendering solely and do some minor tweaks in in order to have a product that fully uses the abilities of civs graphics engine. For this tutorial I got such a model that was created in Blender. For how to see C.Rolands nice tutorial "HOW TO import/modify export Leaderheads"
http://forums.civfanatics.com/showthread.php?t=183742

This tutorial should explain about everything

However to create a shadermodel you'll need 3Ds max and the niftools plugin:
http://sourceforge.net/project/showfiles.php?group_id=149157&package_id=195073

Make sure you also got the texporterplugin:
http://www.cuneytozdas.com/software/3dsmax/

For the second part of the tutorial you will also need Nifscope:
http://sourceforge.net/project/showfiles.php?group_id=149157&package_id=170735



Step 1:


Import the model.

http://img451.imageshack.us/img451/1253/1aimported2.th.jpg (http://img451.imageshack.us/my.php?image=1aimported2.jpg)

I usually uncheck the autosmooth mesh option because this sometimes get weird. We will apply a smoothmodifier to the model later again.

http://img412.imageshack.us/img412/9207/1bdidoimportedsk9.th.jpg (http://img412.imageshack.us/my.php?image=1bdidoimportedsk9.jpg)

As you notice the model's bones are displaced. Unfortunatly the importscripts don't work reliable but that's nothing we have to worry about now. We only care about the mesh itself now and fix our export with nifscope later.

EDIT: Of course you don't need to create a model in Blender and import it. It's possible to create entirely new models in Max and get them into the game as described here(or any other program that can export to fileformats that can be imported in Max). In this case you'll have to make sure it has the same bonestructure as vanilla LHs or you will have to create your own animations. Check the appendix for animationsettings. Basically all you need from vanilla models (as long no Leaderhead SDK gets released) is the camera and the lights which you attach to the nif with nifscope.

Step 2:


Press "m" to open the material editor. Select the pipette(pick material from object) and press "h" to choose the mesh. Rename the Material to something meaningfull so you don't get cofused in the process.

http://img169.imageshack.us/img169/7788/2amaterialselectionbf0.th.jpg (http://img169.imageshack.us/my.php?image=2amaterialselectionbf0.jpg)

Switch to the next material box and select the next mesh. Do this repeatly until you got a material assigned to all meshes. The last two meshes (here Teeth lower and Teeth upper use the same material so just pick teeth lower selct teeth upper and assign material to selection-third button from the left in the material editor).

http://img183.imageshack.us/img183/788/2bmaterialselectionll9.th.jpg (http://img183.imageshack.us/my.php?image=2bmaterialselectionll9.jpg)

Now we have 4 materials in the editor. You'll see they show all white - this is again a problem of our importscripts which fail to import the material settings.


Step 3:


We start setting up the first material. First thing I allways do is change the emissive color to black so the meshes can actually produce good render results in max and we can see what the model roughly will look like.

http://img107.imageshack.us/img107/4637/3aemissiveda9.th.jpg (http://img107.imageshack.us/my.php?image=3aemissiveda9.jpg)

Dido is based upon Isabella so what we should do is check the material of the original model via nifsceneviewer (how to use that program is detailed in Rabbit Whites tutorials found on this forum). The nifviewer can tell us exactly how we need to set up the material if we want to stay true to the original (we still might change some settings to our liking though depending on what we want).

Doubleclick the editable poly beneath the ninode "isabella_eyes". The nifviewer shows the type of Shader we're going to apply in the geometrie rollout. Open up Niproperties and doubleclick NiAlphaproperty.

http://img105.imageshack.us/img105/4562/3balphapropertyxh8.th.jpg (http://img105.imageshack.us/my.php?image=3balphapropertyxh8.jpg)

Now apply those settings to our Eyesmaterial: switch on alpha testing, no sorter, testmode greater go down to custom shader select TLeaderheadshader_20 and hit apply. Btw I have no idea what that stuff about the alphasettings really is about but experience tells us it's better to do what Firaxis does.

http://img19.imageshack.us/img19/1732/3capplyshadernx2.th.jpg (http://img19.imageshack.us/my.php?image=3capplyshadernx2.jpg)

Also you might have noticed there isnt a stencil property so you might uncheck vertexcolors as well(again no idea what that is about but I had problems with vertex colors earlier- the model showed entirely black- so I usuall tend to switch them off).

Now doubleclick NiTexturingProperty in Nifviewer to learn what maps we use on this material. In max below the Shader opened another Rollout "TLeaderHeadShader_20 custom attributes".

http://img19.imageshack.us/img19/6638/3dshadermapsox1.th.jpg (http://img19.imageshack.us/my.php?image=3dshadermapsox1.jpg)

Select "NormalMap" and choose "Bitmap", go to the path where you stored the dds files and select isabella_norm.dds, for SpecularIntensity select isabella_spec.dds, for EnvironmentIntensity select isabella_env_msk.dds and for the last spot isabella_eyes_env.dds - note the sequence is in another order in the nifviewer. Whatever there is to read about Shader Map 0 - 3 the order you apply maps in max should allways be:

_Norm
_Spec
_ENV_MASK
_ENV

http://img183.imageshack.us/img183/4779/3eshadermapseb7.th.jpg (http://img183.imageshack.us/my.php?image=3eshadermapseb7.jpg)

Do the same now for the other meshes checking every time the refering editable mesh/poly in the sceneviewer for maptypes and materialsettings.

Optional:
If you want to use specularmaps to have some reflection on Leaderheadmeshes - Isabella only uses specularmaps for her jewelry but most vanilla LHs have a specular light a little above 200(color) with a shininess of a little above 90(95 mostly) - you got to alter the settings shown below:

http://img526.imageshack.us/img526/3931/3fspecby0.th.jpg (http://img526.imageshack.us/my.php?image=3fspecby0.jpg)


Step 4:


If the material is set up we apply a smoothmodifier to each of the meshes else the model will look like a work of picasso after export.(should be covered in sharicks tutorials somewhere already this point)


Step 5:


Export and use Nifscope to complete the rest. Remember to hide the bones! Don't worry about the LH export showing all black in the nifviewer now. That's because we don't have lights in our scene yet and of course we changed the emissive color to black once we get lights from other firaxian LH files in this will also display in the sceneviewer.
Now it will get complicated if you want to follow the procedure of making the maxexport work and polish it for the game you can download the exported model as attachment(you can use vanilla textures of isabella for it);)

EDIT: It's allways a good idea to apply some animation even if you want to stick to vanilla animations(check appendix below post 3 for animationsettings) just in order to create a non-accum node. Just assign a couple of animationkeys and define an animationsequence, then export nif and single kf. It's not needed since you can fix this with nifscope but just might be less grunt work later.

C.R. it's your turn:p

C.Roland
Jul 08, 2007, 06:41 PM
When you have your freshly exported leader, the next step is quite simple. In fact, it’s the same process that you may have used to have your noshader LH in this tutorial (http://forums.civfanatics.com/showthread.php?t=183742).

You only need to do in Nifskope the steps explained in the Import/Modify/Export LH tutorial (http://forums.civfanatics.com/showthread.php?t=183742), but with the vanilla shaded leader and your modified shaded leader instead of the no shaded one.

Here a brief recapitulation.

1. Open you modified shaded LH
2. File/New Window http://forums.civfanatics.com/uploads/71990/a.jpg
3. In your new window, open the vanilla shaded LH
4. Right Click on your modified leader (In the block list : Block/Copy Branch) http://forums.civfanatics.com/uploads/71990/b.jpg
5. Paste Branch in your new window (the one with the vanilla leader in)
6. Replace the children of the NiNode, change the vanilla NiTriShape for your modifien NiTrishape (On the screenshot, I have to change the child 331 to 334) http://forums.civfanatics.com/uploads/71990/c.jpg
7. Remove the vanilla leader, right click on it ( In the block list : Block/Remove Branch) http://forums.civfanatics.com/uploads/71990/d.jpg
8. Do a translation to your modified mesh to be sure that the eyes, the teeth, etc. are at the right place
9. Check if all the textures are linked correctly. Normaly, it should be fine if you have linked them correctly in Max http://forums.civfanatics.com/uploads/71990/e.jpg
10. Import it in game and have fun … http://forums.civfanatics.com/uploads/71990/f.jpg

Here a little comparison between the vanilla Isabella and our brand new Carthaginian queen. I made this model pretty quickly because I do not have a lot of free time and I know the community was impatient to know how to do this, so the model still look like the original, but it’s possible with this technique to create something that look as good as the vanilla LH but really different from the base model.

http://forums.civfanatics.com/uploads/71990/g.jpg

Because I have changed some of his cloth to skin, the shading makes a clear edge on his skin near his left shoulder. It something that I may fix before I release this LH, but as I already said, this Dido LH was made quickly for the purpose of this tutorial, so I didn’t take the time to fix it before the writing of this tutorial.

Ploeperpengel
Jul 08, 2007, 06:45 PM
Appendix

If you want to create custom animations here's a list of eventcodes that will work with the animationscriptpart of the Maxplugins:

_greeting_ec0
_friendly_ec1(loop)
_pleased_ec2(loop)
_cautious_ec3(loop)
_annoyed_ec4(loop)
_furious_ec5(loop)
_negativ_ec6
_affirmative_ec7

seZereth
Jul 09, 2007, 01:50 AM
well so far, it was quite easy to follow, I mean if you want someone to produce something like this with max, then he should be capable of following these easy things like materials and maps...
I think the complicated part is still to follow. Its what I get mad about every time I have to work with something else than Melee Units... its the damn unclean export which has to be fixed by improvisation.

great tutorial :goodjob:

C.Roland
Jul 12, 2007, 09:40 PM
Sorry Ploper and all, I didn't find the time to do it. It's the fault of my job (and I have to admit that I just played tennis instead ... :blush: )

I'll try to do it this weekend, sorry again ...

seZereth
Jul 13, 2007, 01:50 AM
edited,.... whatever
great tutorials ;)

wilboman
Jul 13, 2007, 01:59 AM
Edit: whatever.

Ploeperpengel
Jul 13, 2007, 03:54 AM
Guys! You ARE aware that this thread is going to be moved into the public, right? Just to remind you not to talk about anything here you don't want to have published;)

C.Roland
Jul 13, 2007, 04:19 PM
edited,.... whatever
great tutorials ;)

I'm curious to know what this post was :p ...

EDIT : Well, I saw it ... when this thread will move to public forum, they will all know why we all have over 1000 posts ...

wilboman
Jul 13, 2007, 04:24 PM
Check out Important news.

C.Roland
Jul 15, 2007, 01:55 PM
I did my part, so do you think we should change something before this can be moved to public ?

Ploeperpengel
Jul 15, 2007, 02:45 PM
I think it's fine. I will move it to public and we can make updates later;)

Edit: moved

Civmansam
Jul 16, 2007, 04:44 PM
Nice tutorial guys :thumbsup:

I wonder what actually goes on in that private forum?:hmm:

ambrox62
Jul 26, 2007, 02:17 AM
Good job, guys :goodjob:

Next step should be "How to create-new or edit-existing .KF animations" :)

I spent a lot of time testing different animations for each LHs. Sometimes they worked fine but most of time they worked wrong. I haven't 3dmax and Nifscope didn't help me :sad:

I hope this tutorial will bring us as many as new LHs soon, but we also need an easy guide to switching, shuffling, edit or create KF animation files :D

C.Roland
Jul 26, 2007, 05:45 PM
Good job, guys :goodjob:

Next step should be "How to create-new or edit-existing .KF animations" :)

I spent a lot of time testing different animations for each LHs. Sometimes they worked fine but most of time they worked wrong. I haven't 3dmax and Nifscope didn't help me :sad:

I hope this tutorial will bring us as many as new LHs soon, but we also need an easy guide to switching, shuffling, edit or create KF animation files :D

If you want to see what can be done, all the Final Frontier and FFH : Age of Ice LH are made by me with the help of Ploper using this method.

Ploeperpengel
Jul 29, 2007, 07:07 PM
Good job, guys :goodjob:

Next step should be "How to create-new or edit-existing .KF animations" :)

I spent a lot of time testing different animations for each LHs. Sometimes they worked fine but most of time they worked wrong. I haven't 3dmax and Nifscope didn't help me :sad:

I hope this tutorial will bring us as many as new LHs soon, but we also need an easy guide to switching, shuffling, edit or create KF animation files :D

I updated the 3rd post with the eventcodes that are supposed to work with custom leaderanimations. Else than those eventcodes there's no difference to animating a unit which is explained in Firaxis' and sharicks 3D max tutorials.

kipkuhmi
Aug 18, 2007, 10:50 AM
Appendix

If you want to create custom animations here's a list of eventcodes that will work with the animationscriptpart of the Maxplugins:

_greeting_ec0
_friendly_ec1(loop)
_pleased_ec2(loop)
_cautious_ec3(loop)
_annoyed_ec4(loop)
_furious_ec5(loop)
_negativ_ec6
_affirmative_ec7


Hi everybody,

I'm currently busy creating a custom leaderhead, and my big problem is that I'm using 3ds max 9, which can't use the Civ IV MaxTools plugin.

My leaderhead is almost ready but I don't know how to apply those eventcodes which Ploeperpengel mentioned above. I mean, it's just code, right? Is it possible then to copy/paste it from an existing leaderhead and then import it to a maxskript in max 9?

Ploeperpengel
Aug 18, 2007, 05:10 PM
Sorry can't help with this. 3D max 9 is currently not supported by firaxis scripts and I doubt you will be able to make custom animations work unless you make those scripts work with the latest maxversion. If you can export your model to nif format with niftools you might get lucky using vanilla animations if you nifedit your model unto a vanilla leaderhead with nifscope though.

kipkuhmi
Aug 19, 2007, 04:51 AM
Ok, I now have 3ds max 8 demo installed, with niftools and MaxTools plugins.

There are several things which I haven't fully understood so far. E.g., the "Getting your units into Civilization 4" tutorial mentions a Animation Flow Chart with different "animation sequences".

Now what exactly are those "animation sequences"? Is each a.s. a different max file for its own, and put together later? Or is an a.s. just a special segment in the animation time line? I always thought it was the second one, but how do you make it clear to the time line where one sequence ends and where the next one begins, so that later you can refer to the different sequences in the MAXScript?

Ploeperpengel
Aug 19, 2007, 08:20 AM
Those flowcharts are jpegs to be found inside the unpacked vanilla assets in the unitfolder.

kipkuhmi
Aug 19, 2007, 11:27 AM
I know, but I just don't understand how the eventcodes and the leaderhead animations go together.

As far as I understand, with the units you have one single file containing all the different states of the unit. But with the leaderheads, you have a couple of kf files (xy_action_01_negative, xy_idle_03_cautious ... etc.).

So why do I need the eventcodes when all the different "moods" are already seperated in different files? And where and how do I apply the eventcodes?

EDIT: Sorry, I've seen that the units also are splitted into different kfm files. When I said that it was one single file I had the "raw" max scene in mind like the one Praetorian that you can download

So maybe you could tell me if the following thought is a correct one:

1. In 3ds max you model the leaderhead.
2. You do the rigging and texturing of the model head.
3. Then you animate it, with all the different "moods" in one and the same timeline, as it seems with no limitation of how long they have to be.
4a. You start the MAXScript / Civilization IV plugin, where you chose the "actor root" (still don't know what that is and how you define it).
4b. In the "Active Sequence" rollout you define the names of the sequences and which is what (eg. frames 100-130: "_cautious_ec03").
5. Then you apply the exporter and by doing that you automatically create all those different kf files.

Sorry to bother you with all those questions, but it would be a great help if you told me if I'm following the right path ... :)

Ploeperpengel
Aug 19, 2007, 11:37 AM
No you're wrong it's the same with units. How to use the animationscripts is described in the tutorial by firaxis and I also believe in sharick's tutorial. Check those out;)

kipkuhmi
Aug 19, 2007, 11:43 AM
No you're wrong it's the same with units. How to use the animationscripts is described in the tutorial by firaxis and I also believe in sharick's tutorial. Check those out;)

Sorry, you were TOO quick with your answer while I was editing my last post ... :)

However, maybe you could nontheless tell me if my "thought chain" is correct. :)

Ploeperpengel
Aug 19, 2007, 11:50 AM
Well yes basicall that's it. Keep in mind to export kfm not single kf though in the exporter;) The actor root is defined the same way as for units. With LEaderheads it's normally named Master not MD like with units but the Name doesn't matter that much. You really should read the unitmaker tuts carefully about the details as most of the stuff there applies to Leaderheads as well as other animated models like animalressources or anything.

kipkuhmi
Aug 19, 2007, 12:10 PM
Thanks for the help. I've read the Firaxis tut over and over, but I made that basic brain twisting mistake thinking that units had only one kf file. Now it's much clearer.

With that MD / Master helper dummy, it's still not so clear ... I still haven't figured out how can use that "add actor root" button. However, maybe it won't be necessary, if I can just copy the structure from Bismarck or Alexander.

Btw, why is Alexanders MasterDummy called "Julius Caesar"? Well, Firaxis guys probably just forgot to rename it.

Thanks again for the advice!

TheBladeRoden
Aug 19, 2007, 02:16 PM
Never knew MD stood for Master Dummy before this day!

6underground
Nov 20, 2007, 12:51 PM
I'm a bit perplexed, when i import the leader head,the model is entirely white, despite me checking "render textures" in the dialog box. I can't seem to manually apply the textures either because ".dds is an invalid filetype" for 3dsmax (8)?

kipkuhmi
Nov 20, 2007, 01:16 PM
I'm a bit perplexed, when i import the leader head,the model is entirely white, despite me checking "render textures" in the dialog box. I can't seem to manually apply the textures either because ".dds is an invalid filetype" for 3dsmax (8)?

Sorry, what do you mean exactly: The body is white when importing it into max or when importing the completed nif file into CivIV? (Both can happen, but the reasons are quite different, I think.)

Referring to max: For all I know, it should be possible to import dds graphics with 3ds max 8 and Windows XP (maybe check out the latest max patches), but not with Windows Vista. However, it's not a problem, because I think graphic files don't necessarily have to be in dds format. I used tif and jpg for my Richelieu, and it worked fine all along. dds might be a bit quicker, and it offers some transparency / animation gimmicks (eg the clouds moving in the background picture), but that's it.

Referring to Civ IV: When your exported leaderhead is appering white in the game (or even black without any lighting), then it is a shader problem. I used a workaround by baking the light into the textures (using the Render -- Render to texture ... menu command). However, there's a tutorial made by Ploeperpengel somewhere in this forum which explains the correct use of the shaders.

6underground
Nov 20, 2007, 01:24 PM
I've only gotten so far as importinginto 3dsmax. after the point in the tutorial about "TLeaderHeadShader" in the material dialog. I can't for instance select "Chalamagne_Norm.dds" because Max says it's an invalid file type. So I can't apply it to the model. :confused:

kipkuhmi
Nov 20, 2007, 10:09 PM
Convert the dds image to jpg or some other format, then you should be able to select it.

Ploeperpengel
Nov 21, 2007, 12:24 AM
You will need the texporter plugin for max as well. I put a link in the first post.

6underground
Nov 21, 2007, 07:12 AM
Convert the dds image to jpg or some other format, then you should be able to select it.

yeah, that's what I essentially had to do afterward, thanks though :)

You will need the texporter plugin for max as well. I put a link in the first post.

just installed it.

I guess my question is then, if in max the model is using bmp/jpeg instead of .dds, when it comes to exporting won't the model you save and open up in Nifskope search for "charlamagne_norm.bmp" instead of "charlamagne_norm.dds", for instance? or doesn't it matter?

Or? :cool:

Ploeperpengel
Nov 22, 2007, 12:21 AM
yep the export doesn't change the texturenames but dds files should work with max if you got texporter(if not maybe you have vista? I read something about max having trouble with dds files under vista somewhere on the web - you should google for solutions, otherwise it's fairly easy to rename the textures within nifscope, just doubleclick on the texturename and change it)

6underground
Nov 22, 2007, 12:44 PM
gotcha, I see what you mean now.

http://img255.imageshack.us/img255/3230/exportsettingsxi6.jpg

Those are my obviously incorrect export settings, i've been uncheking and checking them at random because for some reason max exports Chalmagne's beard in the wrong place (on the right hand side of him near the mid-torso.

Could I possibly see your export settings or anyone else who has exported from Max successfully?

kipkuhmi
Nov 22, 2007, 01:28 PM
Reporting from my own experience, I wouldn't recommend using that exporting module. I tried it out several times, but it never worked out for me (always had problems with the animation).

Download and install the official MaxTools from Firaxis (Civ IV download section), then you'll have a "Civilization IV" file type available for export. It was meant to be used by Firaxis themselves, so I can't see any reason why you should use a different exporter.

RulerOfDaPeople
Mar 18, 2008, 10:51 PM
How do you install them when they are done?

kipkuhmi
Mar 18, 2008, 11:47 PM
How do you install them when they are done?

Do you mean the MaxTools or the nif files?

Ploeperpengel
Mar 19, 2008, 12:58 AM
How do you install them when they are done?

the official plugins are just unpacked inside the 3Dsmax folder. Make sure to download the documentation as well.

RulerOfDaPeople
Mar 19, 2008, 01:45 AM
Do you mean the MaxTools or the nif files?

No I mean the new leaderheads/leaders themselves.

kipkuhmi
Mar 19, 2008, 08:57 AM
No I mean the new leaderheads/leaders themselves.

Well, after you created your LHs, there is some xml work to do. It's not very difficult, but rather complex to explain. I recommend you simply download one of the many user mods and look how it's done there. E.g., at

http://forums.civfanatics.com/downloads.php?do=file&id=7482

you can download my Frizzimod where I integrated my Richelieu leaderhead.

GarretSidzaka
Apr 14, 2008, 03:07 AM
im gonna have to give this one a read :)

thanks ploeperpengel

cool3a2
Sep 11, 2008, 03:59 PM
I tried to shader a part of an LH (helmet), but I got a problem. In the finished nif the helmet is moved downwards, but only if I start nifviewer without double-click on the nif (first start nifviewer, then loading the nif via the menue). If I start nifviewer simply be double-click or if I open the nif in nifskope, everything seems to be okay. Unfortunately in civ4 the helmet is moved downwards as well. I tried to move it up, but it doesn't move. Even if I try to moved it in nifskope. To solve this I did the procedure described in the first post step by step. The problem occurs if I select the shader and press apply. At this point in step 3:
go down to custom shader select TLeaderheadshader_20 and hit apply
Any ideas?

EDIT: The reason is, that the helmets poly doesn't have a SkinInstance. Would be a bunch of work to fix that...