Author Topic: SAF's Dev Diary no. 3 - The Long Road to Asym Chests & Hips  (Read 896 times)

SilverAgeFan

  • Global Moderator
  • Newbie
  • *****
  • Posts: 13
  • Inf: +4/-0
    • View Profile
    • Awards
Back in early March of this year, while my work on Rebirth Issue 1 was winding down to just bug fixes and polish, I sat down and charted out the range of possible small, medium, and large art projects I could undertake for Rebirth's future development.

Some of the projects I weighed included: new full body patterns based on some of the capes players were loving on Rebirth's Public Test Server (PTS), our own version of full body glowing and animated skins that other players expressed excitement about while playing on other private servers, a more modest female chest piece which I refer to as single panel tights (and others in cruder terms call the "uniboob"), and even a player request for the classic golden age jodhpur style pant that we all associate with adventurers and pilots.

One thing all these projects had in common is they would add to our existing library, on top of the foundation we currently have. There was one other project that I was aware of out of the corner of my eye that was more foundational than any of these additions: full torso asymmetry. The promise of the idea always excited me. Back on live, I was definitely one of those in the costume forums floating the idea repeatedly to the Paragon devs. Back then, we were told there was no easy way and it was essentially impossible.

Truth is it was never impossible. But it always represented a lot of work.

The Challenge:

Early in City of Heroes development, the original team decided to use mirrored textures on central body parts. They would later go back and revamp heads, giving us the possibility of asymmetric faces. But they never got into the complex nest that is the torso library. Late in the development of the Live game, they would circumvent this, making new chest geometries for some First Ward enemies and even a new hip geometry used only by the post apocalyptic pants. These were nice add ons that gave a tiny taste of what chest and hip asym might do for the game's aesthetics. But they did nothing to attack the real problem: our massive and widely used library of symmetric legacy geometries.

I knew if I were to take this on I needed to take a systems approach, as I go into in my prior diary, and be thorough about it. Chest and hip asym would need to neatly bookleaf into our existing library of parts.

In our game, 3d objects all have what is called a UVW map (also called UV map for short by many 3d artists). This map tells the computer how to wrap a flat 2 dimensional graphic around the 3d coordinates to give it color, surface, and other details. It can even be used with bump maps or normal maps to give the lighting renderer clues as to how to shade fine surface detail.

The legacy male chest geometry has a map that looks like this:


The bottom of that image is the front of the chest. The top is the back. And the shapes jutting out to the left are the upper arm.

You'll notice that it looks like just the left half of the body. That is because the right half has been cleverly mirrored and folded to overlap exactly with the left side. In this sense, the original UV maps were very much like an old school paper doll you may have cut out in kindergarten.

What that means is that a texture intended to look like this


would actually show up in game looking more like this


Working towards a robust, viable solution:

So the first task was to take that paper doll and make sure it was no longer overlapping. There were a couple ways I could have gone about this. But I ultimately settled on a technique referred to as "tiling." Here, tiling is a fancy way of saying "repeat." This way, with the help of some of that X_ texture code I described in the last diary, I could implement chest and hip asymmetry in a manner that only required that I remaster (reformat and double up the graphics in an outside program like Photoshop) of the pattern masks and not every single base texture, normal map, compound mask, and glow map that players might employ. (There are over 350 pattern masks in game. The base patterns, normals, and glow maps are several times that!)

Also around this time, while doing bug fixes for Ri1, it became clear to me that I could not do this universally because some of the parts we use--both geometries AND textures--are utilized by enemy groups throughout the game. And I knew that those needed to be left alone or the scope of this project would just bloat to a place that was once again impossible for me to see through alone!

This is what the new UV map of the tiled version of the legacy male chest tights geo now looks like


With some rudimentary X_ texture code in place, I was finally able to look at the modified chest geo to see if anything was showing up properly.


It was close. Much further along than it had been. But you may notice there is a distinct streaking phenomenon on the left side of the figure's torso. At the time, I was certain my code was correct to make the graphic tile up properly. But clearly something was wrong.

The issue is even more apparent in this combination


It took me several days to maybe a week of experiments and digging deeper and deeper into how the game manipulates textures before I sorted out what was going wrong. In the games internal lingo, when referring to 2d textures, the letters `S` and `T` represent the dimensions x and y. I knew there was something that was locking out the S dimension from tiling, since it is a left right streaking.

The answer for me ended up becoming clearer when Naomi, an awesome art dev from the Homecoming server consulted with me regarding a graphic bug that Draggynn first identified on the Ri1 cape patterns: there were these little ghosted edges showing up on any of the alpha cut out capes. This was because the graphics were trying to tile. And the solution to fixing this was to get clampS and clampT flags associated with each of these new patterns. What these flags essentially do is tell the game "HEY, You! Graphics engine! Don't tile these graphics." On the capes, the chance of tiling meant the last row of pixels was sampling from the other side of the graphic and picking up a touch of the solid edge and trying to dither to it.

For the issue with smearing chests, I needed to do the opposite, and make the textures yell at the game and say "HEY, You! Graphics engine! TILE these graphics--especially in the S dimension!" It took a lot of digging and several experiments, but it turns out another flag that you can apply to textures is RepeatS. But this needs to be done at exactly the right place in order to override any clampS flag which can often be baked into the header of the legacy .texture files.

Though I was still nervous that all this alpha-stage research and effort was for naught, on March 20, 2021 something magical happened. I loaded up my latest iterations of changes, muttering to myself "if this doesn't work, I don't know if asym chests are possible." I went into the CC and to my test entry, started fiddling with the options and lo and behold


This is the first screenshot, to my knowledge, of a generalized asym chest piece in the game. It is definitely the first combination I laid eyes on and the first screenshot I took.

Current Development:

With the alpha proof of concept finally successful, I set aside my very sloppy alpha stage test assets and code, reverted the copy of the game I was working on to what was on PTS and then began taking notes. Long copious notes inventorying each and every geometry I would need to adjust for each and every gender.

I also decided at this point that it made sense to start integrating the new geometries that I'd identified as common standards that arguably should have been in from day 1, like the single panel chest for females and the golden age jodhpurs for all genders, but oddly never made it into the game. (The third, latest, and likely final addition to this short list is the '70's style bell bottom pants.)

It's definitely been a slow grind since the end of March through now. But I'm nearly done with the full system conversion for females, currently wrapping up some of the last categories of hips. Luckily, much of the X_ texture code I need to write, covering every single base texture entry in game for these parts, can be recycled across genders. So the first pass is always the most time consuming. I anticipate male and huge conversion will take about 50% the time it has taken to do the female model. (Plus a lot of time was spent perfecting the single panel tights and their associated chest details! But when you finally get to play with them in detail, I'm certain you will agree that it was time well spent!)


Addendum:

To underscore the scope and scale of this endeavor, this image is a capture of all of the geometries bundled into the female asym torso core system. Again, this is only for female characters. When I get to male and huge, they each will have their own bundle of converted geometries.

« Last Edit: June 04, 2021, 11:00:50 am by SilverAgeFan »

Draggynn

  • Newbie
  • *
  • Posts: 38
  • Inf: +16/-0
    • View Profile
    • Awards
Re: SAF's Dev Diary no. 3 - The Long Road to Asym Chests & Hips
« Reply #1 on: May 30, 2021, 02:04:08 am »
I have been looking forward to getting somewhere with a good enough internet connection to read this for days.  I really enjoyed reading it and appreciate your taking the time to explain what's going on behind the curtain to the rest of us.  I've been curious about what the technical hurdles were that were required for this since you started teasing asymmetry months ago.  You always do a really good job of making things accessible with these dev digests (especially providing valuable illustrations).  A huge shout out to Naomi for her assistance; it's always nice to see examples that remind us that we are still one community!

I look forward to doing my part to help test when the time comes.
@Draggynn: Storm Summoning Psychic Defender and Badge Hunter, formerly a resident of Virtue
See my collection of commissioned art: https://www.deviantart.com/drag-gynn