PDA

View Full Version : How does WoW manage Character Textures?


D-Wang
04-26-2007, 02:02 PM
Hi all,

I am currently working on a social MMO and was wondering how Blizzards character textures are divided and how the game engine works to display them.

From what I've seen using the various "viewers" available, It seems that they have a base texture for the whole character then also have the character divided up into sections (uppertorso, lower torso, upper arm, lower arm, upper leg, lower leg, hands, feet and head) and are somehow able to use layers to combine other textures over the base material using alphas in realtime for switching clothing and some basic armor.

Is this correct? How are they able to have multiple material Id's or textures on the same meshes? Is there any documentation on how their setup works available? Any help is greatly appriciated!

- D-Wang

Gephoria
04-27-2007, 02:08 AM
well i'm not an expert on it (although i'm beginning to fall into blizzard's job descriptions) i beleive they allocated a quadrant so to speak of each map to each specific slot item, aka gloves shoulders etc, they assign the mesh to it and similar UVW unwrap methods with each slot item, the main thing here that confuses me is the shoulder slot because a newly created character would be wasting texture space if he didn't have a shoulder slot item in this method. at least the way i'm thinking of it ( i can't describe my thoughts exactly in words as you may have noticed();

well, in short
---------------------------------------------------------
| Shoulder ------------head/ -------------------chest
| ----------------------face
|
---------------------------------------------------------
| feet -----------------wrist --------------------hands
|
|
---------------------------------------------------------
| legs ----------------tabard --------------------belt
|
|
---------------------------------------------------------


at least that's my personal theory on it hope it helps :)
if ur curious on my alias in game it's Gephoria<internecion>@Haomarush (horde side)

ojko
04-27-2007, 07:10 AM
As I understand it, each character has a base texture.

Gloves, boots, shoulders & helms use their own seperate textures & meshes. However many of those textures seem to be re-usable over a variety of meshes. This makes some sense when you consider how many people can be visible on screen at any one time.

Belt, leg & chest armour seems to be done with a texture. The chest armour overlays onto the shirt (shirt is visible underneath). However the shirt does have geometry in the cuff area, which is removed when you equip bracers (which again seem to be a texture overlay).

some3dguy
04-27-2007, 09:19 AM
okay, here's my shot at it.

much like Gephoria said, all (clothing) sets in WoW share one layout. in addition, the uv layout of all races (gnomes, tauren, you name it...) is basically the same too. if you watch closely, you can see heavy stretching going on when looking at the more extreme races (figure-wise). compare dwarfs and nightelves for example. it seems they chose a medium sized race to make the basic uv layout, then adjusting the layout of all other races accordingly.

so what they do when you are wearing different items from different sets is they literally bake all the textures you have on your char into one single texture using some sort of realtime processing. if you want a more detailed explanation of exactly how this is done, i could ask one of our programmers.
so all in all, that single texture is then displayed on your model. that way you have only one texture on every single char instead of say textures 5 textures for the complete stuff you're wearing. while this seems a waste on the one hand - since more than one char you see at the screen at any given time MAY wear the same clothing as you - it is not. it is close to impossible to find two REALLY identical clothing sets on different characters.
so you're better off having one texture per char instead of holding all parts of the sets everyone in your viewrange is wearing in memory.
a little math here: seeing 40 chars (a normal raid) with lets say 5 different textures each (to build up their individual gear), amounts to 200 textures you'd have to hold in memory when combining them with alpha/overlay. using unique textures for each char results in only 40 textures plus a bit of processing power to bake them in realtime.
there is a small drawback on this kind of technique. you'll run into performance problems as soon as there are more unique textures on screen than your graphiccard can fluently bake in realtime. you'll know what i mean if you ever tried to raid a city with well over 200 other guys. since your graphic card can not bake them at once and your graphic memory can not hold all those unique textures, it takes a pretty long to load all you can see and it becomes pretty slow. that's because it's not only about displaying textures but about baking them too. but unless you don't have a vast amount of chars onscreen at any given time (which is the case in WoW for the most part), it's a great way of dealing with customizable chars.

so now how about those wide shirt sleeves, different boots-styles, helmets - all those things that change the silhouette of your char?
there is only a handful of actually different interchangeable mesh-parts on the WoW-char: the helmet, the sleeves of some of the shirts, the boots, the shoulderpads and those nifty robes.
all of those have a priority at which they are displayed. if you are wearing let's say a shirt with wide sleeves, those sleeves are a special mesh that is diplayed only when you're not wearing someting that uses the same mesh-slot as those sleeves. try putting wide gloves on while wearing that shirt - the wide glove mesh will be displayed instead of those wide sleeves (hope that makes sense).
those special meshes share the same texture coordinates as the base mesh OR have their own uv set.
gloves for example do share those texture coordinates. this way, you can have the same base-texture for two sets of gloves but by using the interchangeable mesh thingy you can have them look different in volume.
robes are seperated in two parts - the upper part beeing the same as the chest, the lower part is a special "skirt" mesh. you can see them beeing seperated by putting on a guild tabard while wearing a robe. the "skirt" - part replaces the lower part of the tabard completely while on the torso you can still see that tabard.
this "skirt" - mesh does seem to have its own texture-layout - maybe even using the same uv-layout as the guild-tabard (at least i would do it that way). but i have not really at looked at those yet since i'm not really into these kinda clothes ;) i expect them to work in a somehow similar way though.

a bit offtopic and only as a sidenote, you may want to notice that almost all char textures (and even the world-textures) in WoW are mirrored in one way or another. for chars especially important, since the majority of those textures stand at only 256x256, so saving texturespace is the key.

well, okay, alot of text. hope it helped. :)

regards!

some

edit: added some more text, yay!

D-Wang
04-27-2007, 12:29 PM
Thanks for the info Gephoria and okjo.

some3dguy, awesome info there. If you wouldnt mind running it buy one of your programmers, that would be great. Just trying to get as much info as possible.

Thanks again.

some3dguy
04-27-2007, 02:43 PM
well, i went to one of our programmers in his dark, smelly room full of pictures of sparingly dressed fantasy girls and...no i'm joking.

i have to admit that i only understand every second word they throw at me since i'm just a graphics guy. but anyway, here we go:
the main thing is what he called "off-screen-rendering". this simply means that nothing of the actual texture-building process is seen on your char but is calculated on the fly by your cpu or gpu. all that IS actually displayed is the final texture.
there are several ways to do that, all involving a (blank) texture as a rendertarget. in WoW, this texture most likely is not really blank but holds the "naked" char texture.

first way (the 2D/sprite way): all your textures are organized in a way that the texture itself is made up of different rectangular areas holding the rgb information for your different bodypieces plus an alpha value for each pixel. the exact positions of those rectangles are defined somewhere in the code.
now when you build your char-texture, you blit (write) the respective rectangular region (much like a sprite) into your rendertarget (base texture), using the alpha as a mask. think of this as cutting out the rectangles and gluing them in place on your char-texture.
everytime your char equips a new armour, the old texture is dumped and a new one is created in the same fashion.
these rectangular regions don't have to use sizes to the power of two (i.e. 64x64) which makes it pretty comfortable - at least thats what i think.
since this is all about 2D operations, your graphic card is not accelerating this process. this is a purely software-based method and can run in a seperate thread on your cpu.
looking at the textures of WoW, this seems to be the way they did it. take some of the textures and overlay them in photoshop, you'll see what i mean.


the second way involves 3D processing. remember though that this happens offscreen, so you don't see anthing of this process.
every texture holds one piece of armour plus alpha. now 2 triangles forming a quad are build in realtime. these are planar mapped with the armour-texture plus alpha, then rendered with orthogonal projection (dead on from the front). the renderoutput is written directly into the base texture/rendertarget. doing that for every piece of armour leaves you with the resulting char texture.
well, at least thats the idea behind it. after explaining this to me, the poor programmer gave up trying to be more specific without using too much of his strange terms only these guys seem to understand ;)
the advantage of this method is the use of 3d acceleration to build the textures. a drawback is that your gpu has to work trough several operations just to build the texture for a character that steps into your view while still processing the rest of what is on screen. that may lead to heavy framerate drops, especially on not-so-high-end graphic cards.
there are ways to make this process far more complicated, rendering only a portion of a armour texture and blitting the renderoutput to a specifically defined place on the char-texture. it works somehow similar to the 2D approach with different regions on the texture. but when the programmer started on that one i fainted :)



phew, there you go, pal! have fun :)

some



(hope you understand all of this stuff, since i'm no native english speaker and it's kinda hard to explain...)


*edited around after another conversation with our code-dudes

Dylan Nagel
04-27-2007, 10:06 PM
Hey, that's a clever idea. I can definitely see that working too.

I have my own new media company, Paladin Studios (http://www.paladinstudios.com). We create visualisations, small games and simulations. One of our projects is a virtual chatroom (http://www.paladinstudios.com/prj_twinners.php), with a number of characters and variations. In our set up, we split the character model into various parts with a selection of textures. In our case, it made more sense to have all the textures available in memory at all times, since there are only a few (relatively speaking):
1 base male, 1 base female, then 3 different hair sets per gender, and 3x color variations of 5 different clothing sets, per gender. So roughly 38 textures or so.

I guess that sounds like quite a few already, but of course it's nothing compared to the WoW numbers.

Anyway, we create all our real-time projects in Quest3D, something of a cross between a game engine / level editor and a dev environment. Besides being owner and managing director at Paladin Studios, I have quite a bit of experience with modeling, texturing and Quest3D programming. So I'm lucky to know a bit of everything, so to speak.

If anyone here is interested in a simple test using 'combined' textures, let me know! It should be fairly easy for me to create a demo executable with the functionality described in the posts above. If some of you guys feel like creating some mock-up textures, I would be happy to build the demo around those.

Just let me know if anyone's interested, either in this thread, or through mail: dylan@paladinstudios.com .

Looking forward to hearing from you, and reading more on the topic!

D-Wang
05-01-2007, 11:30 AM
some3dguy, thanks again. I think i understood everything I had to, and passed the rest of the info on to our programmers here :P

CGTalk Moderation
05-01-2007, 11:30 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.