Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile

<a href="http://www.game-advertising-online.com/" target=_blank>Game Advertising Online</a><br> banner requires iframes

LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 5 - Modders Workshop > Thread: [Tutorial] Texture Editing
Thread: [Tutorial] Texture Editing [ This thread is 2 pages long: (1) 2 ]
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted January 01, 2008 09:58 PM bonus applied.
Edited by Gnoll_Mage at 20:27, 08 Jan 2008.

[Tutorial] Texture Editing

Texture Editing Tutorial

DISCLAIMER - the exact sequence given in part II has not been tested, it is written from experience, so I may have missed something - I'll get round to checking it at some point, and I may also upload some screenshots if anyone thinks they might be helpful.

Lets see I if can be of help here. Texture modding is one of the easiest things that we can do to HoMM, which can make a big – visible – difference. Since we can’t insert our own models and animations into the game, this is one of the best options for creating new-looking creatures (indeed we can sort of edit models through texture editing). This guide ought to be something from the ground up, suitable for (almost) total newcomers – if you already know bits of it such as how to use Photoshop or how to access the data files, please just ignore those sections. I’m not a huge expert though, so there’s bound to be problems in here somewhere…


Contents

This tutorial works through editing the Imp. The simplistic modification is in part II (check out section 16 too). Parts III and V work through more advanced changes, using the Imp -> Abberant Scourge conversion as a guide. If you want to find some other textures to play with, sections 13 and 16 will be useful I hope.

I. Preamble
1. Current guides in existence
2. Introduction
3. How the game deals with textures
4. File format

II. A retexturing – the Imp
5. Where are all the textures?
6. Creating the working environment
7. The first edit
8. Further edits
9. Getting it in-game

III. How to retexture in Photoshop
10. Basic advice
11. How to use Photoshop - return to the Imp
12. The alpha channel - transparency

IV. Appendix
13. How to find textures in the data zip
14. MIP maps
15. DDS types
16. Editing the combat texture of the Imp (and some other creatures)

V. Editing other graphical things, rather than textures
17. Animsets - back to the Imp and Scourge again
18. How to swap animations
19. Effects - yet more Imp and Scourge
20. Icons

Right at the end: how to distribute the mod.



Preamble

1. Current guides in existence

There have been many generous donations to the tome of modding knowledge. I apologise if I have duplicated anything from these and others in this, my own tutorial.

Radar’s creature appearance changing tutorial: http://heroescommunity.com/viewthread.php3?TID=24678
There's some advice here about changing icons.

sfidanza’s post on general editing including the following handy diagram: http://heroescommunity.com/viewthread.php3?TID=24582&pagenumber=2


Kronos1000’s guide: http://heroescommunity.com/viewthread.php3?TID=23393

Plus of course the modding wiki: http://www.heroesofmightandmagic.com/heroes5/modding_wiki/

In particular the extant texturing tutorial -
http://www.heroesofmightandmagic.com/heroes5/modding_wiki/modding_for_dummies:texture_modding

...and 2ndHero's GIMP tutorial: http://heroescommunity.com/viewthread.php3?TID=24612


2. Introduction

Texture editing requires a powerful graphics editor. This guide is for ADOBE PHOTOSHOP, because it’s the only thing I can use (sorry I know it’s not the easiest option for many since it’s quite costly) – in my case CS3. You will also need a DDS plugin – this is the one for Photoshop:
http://developer.nvidia.com/object/photoshop_dds_plugins.html
If you don’t have Photoshop you can use any image editor than can read and save DDS files, or alternatively convert them to a different format, edit that, then convert back. The link at * above has some info on this. GIMP is a good free alternative to Photoshop apparently – try Googling GIMP DDS to find a plug-in.


3. How the game deals with textures

As you can see from the diagram, any given creature has making up its model:
- Materials
- Skeleton
- Geometry

The skeleton is a collection of `bones` that is used to move the creature. The animset gives the instructions for how to place and move the bones (it can also scale them), and the game engine then joins the geometry – the skin – to the skeleton, moving it appropriately to give something that looks good and isn’t impossible to program. It then `paints` the right textures onto this geometry.

Of course, these are complicated 3D structures, so there’s no easy way of turning the desired texture on the model into a flat, 2D file. Imagine trying to wrap a sheet around yourself so that it follows your shape exactly – it’s just not possible. This means the game stores little pieces of texture, which it then paints on to a part of the geometry, stretching it so that it does fit perfectly. These little bits aren’t stored separately; they’re all in one single image file, jumbled up. You might find arms jammed between legs, and shoulders next to teeth. This does cause a little bit of a problem – just looking at this image (the texture file), there’s no way of knowing which part will be painted on which bit of the geometry. You can only make educated guesses based on the colours of each bit – and of course, experiment and see what happens when the game pastes on the texture.


4. File format

Texture files aren’t jpegs or bmps – they’re stored as DDS files. Not all DDS files used by the game are of the same variety – just like a HoMM savegame could be for a campaign or a single-player map, etc.. For creature textures there is a general format used, which will be looked at later. Unlike your average image file, this doesn’t just store the texture as an image, it also stores what’s called an `alpha` channel. This determines the translucency of each part of the image, see section 12.

Section 15 may also be relevant.


A retexturing – the Imp

5. Where are all the textures?

Bundled up with all the other data for Heroes – in the data folder of your game’s install directory (likely C:\Program Files\Ubisoft\Heroes of Might and Magic V\data\, TotE has its own folder under Ubisoft and HoF has its own folder under HoMM5, dataa1). You need to get inside data.pak / dataa1.pak / whatever the TotE one’s called. Fortunately this is just a zip file, so you can open it with any program that reads the zip format. I recommend 7-zip.

Let’s pick the adventure-map Imp as a creature to retexture. You can find his DDS at: data.pak\_(Model)\Creatures\Inferno\Familiar_LOD-Familiar_LOD.(Texture).dds. (Yes, their names really are swapped round.) Navigate there now inside your zip program.


6. Creating the working environment

The editor loads the files in data.pak of course, but it will also load files sitting `loose` in the data folder. Create a _(Model) folder within the data folder, then a Creatures folder within that, then an Inferno one inside that. Extract the DDS from the zip to this location. The editor will now use this file instead of the one in the data.pak file, so we can edit it and see what happens. Open the editor, and create a new map. Put an Imp on it. Unsurprisingly, it looks just as it always does.

Right click on the DDS and go Properties, where you need to make sure Read-only is not checked.

Now fire up Photoshop and open the DDS file in the Inferno folder using File>Open. If the DDS plug-in is installed properly, you should be presented with another dialog box. For now, untick “Load MIP maps” (MIP map explanation coming at the end) and select “Load Using Default Sizes”. The Imp file will now open up, and as you can see, his bits are all jumbled up – some pieces are obviously a head or hand, others are a bit more mysterious.


7. The first edit

In Photoshop, go Ctrl+U. Play around with the three sliders as much as you wish to recolour the Imp, then click OK, then save – up comes a scary dialog box. From the top drop-down list, select the third item on the list (should be "DXT3..."), and also make sure “Generate MIP maps” is selected. Everything else ought to be fine left as it is. Click Save. Go back to the editor and save your map as something. You’ll notice the Imp still looks the same, because the editor has loaded his original texture into memory. Close and reopen the editor and reload the map, and this time the editor will pick up the new texture that you created. With any luck, you should see your new recoloured Imp!


8. Further edits

Do something else to the image in Photoshop – another recolour will do. To view your new texture in the editor, just click the Reload map button (on the toolbar it’s an R within an arrow). The editor ought to update with the new texture. The in-combat Imp will not look any different if you were to view it in the editor (ask if you want to know how to do this). More later on how to edit the in-combat imp.


9. Getting it in-game

The easiest method (in terms of explaining it!) is the following:
Zip up the _(Model) folder and its contents with your zip program, maintaining the folder structure, and rename its file extension to “.h5m” from “.zip”. Then simply move this file to the Maps folder within your Heroes install directory. (Don’t forget you may need to turn file extensions on to rename the extension, ask for details).

Hopefully if you now run the game, any adventure-map Imps will now have the new texture – obviously you’ll need to start a game that will have an Imp stack present in it somewhere (I don’t think loading a saved game will suffice). If you can’t find one, go back to the map you were editing in the editor and turn it into a proper map, then play that map in the game (add a hero and town for each player, give the heroes armies, the towns specialisations, name the map etc. – when you save it will tell you what else you need to do).


How to retexture in Photoshop

10. Basic advice

Normally a simple recolouring will create no wonders, although this does of course depend on the situation. At the very least, you should probably do a multiple recolouring, for example by in the Ctrl-U dialog selecting something in the drop down list, editing the sliders for that, then selecting something else in the list. There are loads of useful tools in Photoshop; in particular, off the top of my head:
- Clone tool
- Lasoo and other selection tools
- Quickmask
- Copying bits off other textures or images!

Often trying to draw things yourself with the brush and pencil tools looks bad, alas we are not all Nival graphics artists…
It’s very hard to learn to be creative, but generally keeping things colour-matching and realistic and the result should be good.


11. How to use Photoshop - return to the Imp

Well this one could take some explaining . What I'll do I think is explain how I went about making the Abberant Scourge for Tales of Karador, which was based on the Imp:
Daystar and Cepheus (I think) helped greatly here by giving me a good start - the downgraded Troglodyte texture (based on the Imp as said):



I knew the Scourge needed to be similar to the other creatures on page one of the ToK thread. Since blue looks more realistic than purple in most cases I decided first to use Ctrl+U to change the green to blue. Moving the sliders helps select just the range of colours I want to be changed (this is more precise than the drop-down list). I did this again to change the bands on the texture to dark blue, after trying purple and deciding that the colours didn't match well. Sometimes using the sliders on the dialog is not specific enough. To only change certain areas of the image you need to select them first. The lasso and magnetic lasso tools do a good job of this (the latter is like the lasso selector but `sticks` to edges) - type L to select the lasso, then Shift+L twice to go down to the magnetic lasso. The polygonal one that you can get to by doing this just once may also be useful. Once you've selected an area, Ctrl+U will only affect that area. You can still be selective about the range of colours that are being changed, as ever. IIRC, selection was needed for the Scourge.

That was the basic colouring done, but now it needed to look different from the Troglodyte. Firstly I removed the bands from the Imp's fingers. This was done using the clone tool (type S for it). Hold Alt and click on the area you want to clone. Then when you paint, it copies this area to the new area. I copied some plain skin from lower down the fingers, on top of the bands, so that they disappeared.

Nextly I wanted some glowing parts. Glows are hard to draw straight off or by using a gradient or something. Remember the problem earlier, that we weren't Nival graphics artists? Well true as it is, we can still copy their work. By this I mean, steal some texture from another creature that is suitable and also much better than something you could do yourself (image searches on the internet can also provide this facility!). For me this meant using the glowing blue of one of the Ghosts from Ghost Mode (I actually copied the glow from a screenshot). Again using selection tools I selected the area I wanted, then copied and pasted this into my Scourge File. Once there, I duplicated it multiple times using Ctrl-J. For each one, I used Ctrl-T to resize and rotate it so that it fit a certain part - for example the glow was used on the feet and hands. To allow texture to show through underneath the glow layer, I either changed the opacity of the layer in the layer palette, or (perhaps, I can't quite remember) used a different layer mode from the drop-down box next to the opacity one. Sometimes I had to mold the shape of the layer using the eraser tool (type E). Don't forget that it is okay to overlap onto the surrounding black bits of a part of the texture, since these are generally not used at all to render the creature in the game/editor.

I also needed to make the edge of the glows soft, so that they blended in with the blue skin. This is a little trickier, and requires layer masks, which I'll go into at some other point.

Don't expect the first thing you do to look perfect. This creature went through many states before I was happy - for example I tried putting lightning on the body, and the glows moved around a lot too. You always have Ctrl+Alt+Z for undo, and Ctrl+Shift+Z for redo, if you need to get rid of a change that you've just made.

Also for the Scourge, I changed the animset (see section 17) to change the shape of the creature, and gave it an effect, the lightning (see section 19).

Final image (I may upload the texture file at some point):



Cepheus made the wings transparent by using the alpha channel...


12. The alpha channel - transparency

Once you have a fair grasp of Photoshop, you ought to become aware of channels. DDS files, like many other image files, store pixels with values of red, green and blue. All screen colours are made up of different combinations. Photoshop allows you to see these individually if you click “Channels”, usually in the layers box (you may have to enable it on the Window menu first). You can click on the eyes to see the RGB channels, and you should also see an alpha channel, which you can edit like any normal image, except only using black, white and greys.

When only the alpha channel is in view, you will see these greys, otherwise it will appear as a red overlay on the image. You can use all the standard tools to edit this, but you are limited to greyscale. Bits that are red / black are invisible in the game, and you can therefore paint over bits of the texture to stop them appearing on the creature, useful for getting rid of pointy bits in the model such as wings or weapons (this method tends to leaves a hole through the geometry so it’s not suitable for much else). This is one technique for model editing.

Grey in the alpha channel creates translucency (c.f. Spectres). Daystar explains this here.


Appendix

13. How to find textures in the data zip

Dear Nival scattered the DDS textures throughout the data file, located in all sorts of places. Combined with multiple DDSs for some creatures (see section 16) and some creatures being named differently in the data to what they are in game (remember the Imp / Familiar confusion earlier), it can be hard finding what you want. I'll explain more later, for now ask if you can't find one which you want.


14. MIP maps

If you load these in when you open a DDS, you will see multiple differently sized versions of the texture. The game uses these to speed things up. Imagine if, when you zoomed out, the game still had to render as much detail as it did close up – it would get very slow! So it uses the low-resolution textures. Before, we had Photoshop generate these when we saved, but you can edit them ourselves if we like, so long as you select “Use Existing MIP maps” when saving. If you are doing a colour change, you should always use this method really, since you will affect all the different sizes at once. For more detailed changes, use the method detailed above.

The reason why you should always edit the MIP maps yourself whenever possible is that the low-resolution sections provided by the game are of a better quality than those Photoshop generates itself.


15. DDS types

Every texture file (DDS) in the data paks has a corresponding XDB file with data about the image. This tells you what DDS type the relevant DDS is. When you save in Photoshop, you need to pick something from the drop-down list that fits with the text inside "<format></format>". If you see "TF_DXT3", the choice is obvious, it's the third one down, as said. "TF_8888" requries selecting one of the "8.8.8.8" ones.


16. Editing the combat texture of the Imp (and other creatures)

Coming soon. Please note that only creatures from the original game suffer this problem. If you were to edit the texture of a HoF (or presumably TotE) creature, it would update the combat creature too.

Editing things other than textures - animsets and effects

17. Animsets - back to the Imp and Scourge again

To the best of my knowledge, we can extract animations, skeletons and geometries in various formats, such that they can be modified. However, I don't think we are yet able to load these back into the game. Investigations are ongoing, I hope! I look forward to the day that it becomes possible, but it is looking like this is unlikely to happen.

Given this, I thought it would be a good idea to see if any geometries could be mixed with another creature's skeleton to create a new-looking creature. Unfortunately, none of the combinations I tried worked at all, and I assume none of them will. However what we can do is change just the animset for a creature. This does create some working combinations.

Let's return to the Scourge. After trying just about every humanoid animset, the ones that worked were two Dwarf ones, plus the Hunter set. The animset modifies the shape of the Scourge to what it is in section 11 - no longer the standard Imp shape at all. However, the animations are not perfect - you'll see that there is a stretched panel near the neck, and the feet look a bit strange. This obviously limits the professionalism acheivable by modification of the animset. Given this Kronos decided that the ToK Beta at least would use the Imp animset. As such, I have not completely checked all the individual animations (death, attack, move etc.) of the above animsets.

18. How to swap animations

I haven't tested this yet, so I won't go into detail until I do. That's likely to be a in a fair while's time I'm afraid.

19. Effects - yet more Imp and Scourge

You'll notice from the image at the end of section 11 that the Scourge is surrounded by lightning. This is an effect, not part of the model itself.

More coming soon.

Try Eugen_Cosmarul's guide here.

20. Icons

Coming soon.



So there you go, hope this is useful to someone out there. To distribute the mod just upload the h5m file that I talked about earlier to something like Mediafire. You should probably change the ending to ".h5u" first. Don't forget to complete a texture mod you may well need to change the icon(s) for the creature etc. too - try looking at Radar's guide for now. Editing those works much like creature textures (the DDS type may be different). Section 20 will detail this at some point.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted January 02, 2008 12:09 AM
Edited by Wulfstan8182 at 04:14, 02 Jan 2008.

Awesome job! this is exactly what i was waiting for!!! it goes perfectly with radar's turorial! now maybe someone should make one like that about special effects on creatures(you know, like Thane's flame on his hand). it would be an awesome trio on editing the creature's appearance.
EDIT: what about how to make parts transparent so you can't see them and there is no hole in the creature. like some people do. i really need to remove the spikes off the crystal dragon.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
guarder
guarder


Supreme Hero
posted January 02, 2008 07:19 AM

Qp worthy, imho, but it is no longer a Mod(erator) in MW yet

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted January 02, 2008 07:26 PM

we all know it is a QP for sure
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted January 02, 2008 11:04 PM

Cheers guys! If I can find the time, I'll add stuff about effects, transparency, animsets and such, and I would also like to add more about good use of Photoshop.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted January 03, 2008 12:22 AM
Edited by Wulfstan8182 at 00:22, 03 Jan 2008.

TRANSPARENCY??? yaaaaaaaaaaaaaaaaaaay! this is what i was looking for for ages!!!! a really good guide to transparency! please make it as soon as possible!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted January 04, 2008 04:40 PM
Edited by Gnoll_Mage at 18:12, 04 Jan 2008.

Section 12 ought to explain it, tell me if it's unclear. If it doesn't solve the problem then it may be unsolvable... sounds like you are getting holes in the geometry, which is to be expected generally.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
BIGJOCKER
BIGJOCKER


Promising
Supreme Hero
I'm Back
posted January 04, 2008 05:09 PM

I'm waiting for the Effects section most.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted January 04, 2008 07:12 PM

well, i don't think someone would put an imp in the game who has holes in his back, so probably people got rid of them. i am simply asking how.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted January 04, 2008 07:30 PM
Edited by Gnoll_Mage at 19:33, 04 Jan 2008.

:confused: Of course you wouldn't want holes in the back of an Imp - but I don't think anyone's ever created them in the first place...

I think I'm misunderstanding what you want done

Basically these creatures aren't like cheese, you can't take off a bit and find some more underneath. If you make an arm transparent, the place where the arm once joined will be a hole. There is no way of plugging these up - no-one has done this to my knowledge, because it would require editing the model (there are one or two exceptions though). In the back of my Scourge there are indeed holes where the wings once were. Hope that clears things up, please post more if not

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted January 04, 2008 08:17 PM

oh, ok, so we gotta wait till someone who works for Nival comes and tells us how to do that. and do you mind giving us a little more about Effects?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted January 04, 2008 08:20 PM

Not so confident about how to modify them, so am testing things and stuff atm.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nebdar
Nebdar


Promising
Supreme Hero
Generation N
posted August 27, 2008 03:39 PM
Edited by VokialBG at 09:35, 05 Sep 2008.

Hey can somebody guide me how or where i can learn how to give Plague zombie which i gave him mana destroy ability now i whant to give him an animation like the familiar has when his ability is actived(now the zombie is just making funny move)
or Vampire Lord Lizard bite looked as normal attack

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Reven
Reven


Hired Hero
posted April 30, 2009 12:00 PM

good tut but i use gimp with a plugin to edit skins

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted May 08, 2009 05:27 PM

Thanks .

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Kronos1000
Kronos1000


Promising
Supreme Hero
Fryslân Boppe
posted May 08, 2009 06:07 PM

Gnoll_Mage, long time no see!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted May 25, 2009 04:50 PM

Long time no answer
I'm still around in the background occasionally, just very busy and have lost interest in modding for the time being...
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
TroggyMan
TroggyMan


Adventuring Hero
Ragin' Tard
posted July 02, 2009 08:19 AM

I am sad to see there haven't been any updates regarding portraits, I have been trying to get my custom portraits to work for a long time now but can't figure out what I'm doing wrong.

Else I say it is a very good tutorial, though I would like to see information regarding other programs than photoshop.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
VokialBG
VokialBG

Hero of Order
First in line
posted July 02, 2009 08:49 AM

You are tring to place your portrait oh hero or...? If yes tell us what you're doing...
____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
TroggyMan
TroggyMan


Adventuring Hero
Ragin' Tard
posted July 02, 2009 09:06 AM
Edited by TroggyMan at 05:55, 03 Jul 2009.

I am trying to change the portrait of a hero, yes. Sorry for not being exact there.

I copied the original hero portraits from the data.pak, and used one and it's smaller equalivent as bases, converting the files to tga and then bmp, to later be turned into tga again with new alpha channels.

I then converted the files back to dds, but at this point I got problems- i made different attempts in making m3u files, the folders within guiding it to "Textures\Icons\Heroes\Heaven" and "bin\Textures\Icons\Heroes\Heaven", but neither worked. I then tried to directly dump it into it's original's place in the data.bak (and made a backup) but it just got buggy in game, being the portrait of another hero but with colored stripes. I believe there is something wrong with the picture's resolution or something similar, but can't put my finger on it.

EDIT: Now the game finds the path properly, but the image is stripes and in game, it consists of random textures mashed together. I made "isdxt" "true" but no change. NMip (I take this is MipMapping?) I tried to change but again, no positive result.

I do not intend to buy photoshop as I am certain there is another way to solve this, but I am starting to lose hope.

EDIT: I found a program that fixed the problem- "DXTBmp", to fix the files, and that I had converted them to rar by mistake all along.

No probs lads.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
[ This thread is 2 pages long: (1) 2 ] < Prev Thread . . . Next Thread >
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.4093 seconds