1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Ace Attorney - Athena Cykes (Kizuki Kokone)

Discussion in 'Filled Requests' started by stuntcock, Jun 4, 2015.

  1. stuntcock

    stuntcock Staff Member Moderator

    Jun 5, 2012
    Likes Received:

    This project was a collaboration between myself and ZeV. ZeV chose the character and provided the artwork; I handled the vectorization and animation.

    Widget has also created a hairstyle for this character, but his version wasn't quite detailed enough to be used in this project.

    This isn't a typical Request thread, since the project has already completed its main goal before the first post was made. I intend to add a few replies which will document some aspects of the design and implementation. This material can hopefully serve as a mini-tutorial for artists and modders who are interested in physics-based hair animation.

    ZeV hasn't yet created a thread for his hair imports, but you can easily find his work by scrolling though his Post History.
    ZeV's hair imports can be found here.

    This thread could potentially be used to resume the project or expand upon it (e.g. creating SWF imports for the character's clothing and accessories). However, it's unlikely that the original team would pursue such efforts. This particular costume doesn't have enough physics elements to keep me interested, and ZeV tends to focus on raster art. Hence, it would probably be best to create a new thread on the Revision or General Customization board, if you want to work on this costume.

    Please don't Βump this thread merely to express your enthusiasm for further work (or to request additional characters in the series). If you're experiencing technical difficulties with the files posted below (e.g. broken download links or runtime errors) then go ahead and post so that we can investigate. If you'd like to contribute to collaborate or contribute to further modding efforts, then feel free to PM ZeV or myself.

    Dynamic Hairstyle
    Click for animation sample

    SDT-dynamicHair-kizukiKokone v1.mod View attachment SDT-dynamicHair-kizukiKokone v1.mod
    This is the recommended version. It includes many independent animated elements, which makes the character visually "responsive" to gameplay events.

    Because of the large number of separate graphical components, the hairstyle will incur a moderate impact on your game's performance. If you experience a significant drop in FPS, then try downgrading to Medium graphics or reducing the size of the game window. Alternatively, you can switch to one of the Static options (see below).

    This import requires the SDT Loader, version 5.43 or greater.

    Static Hairstyle

    SDT-staticHair-kizukiKokone.swf View attachment SDT-staticHair-kizukiKokone.swf
    The version uses vectorized artwork but does not subdivide the hair strands into small segments. It is therefore incapable of animation (and remains entirely static during gameplay) but has much better performance than its animated cousin. Since it's static, it may be more useful in unusual animtools positions (e.g. upside-down) which tend to cause misbehaviour among dynamic hairstyles.

    This import has no version dependencies and can be used without the Loader.

    PNG Hairstyle

    Kizuki_Kokone.png Kizuki_Kokone.png
    This version offers the highest possible performance and the widest compatibility. Like the previous SWF file, it's entirely static and exhibits no animation in response to gameplay. Since it's a raster image, it will also show pixellation at high zoom levels.

    This import has no version dependencies and can be used without the Loader.

    Crescent-Moon Earring

    SDT-earring-kizukiKokone.swf View attachment SDT-earring-kizukiKokone.swf
    This is a simple crescent-moon earring which supports standard SDT jewelry physics (i.e. pendulum animation). It can be used in conjunction with any of the hairstyle options; it can also be mix-and-matched with other SDT hairstyles (e.g. via the moreClothing mod).

    Source Files
    The XCF file contains all of the original artwork. It has been helpfully split out into dozens of separate layers for easy extracting, editing, or re-purposing of the art assets.

    SDT-dynamicHair-kizukiKokone v1.fla
    The FLA file contains the vectorized artwork and defines the fitting of the hair strands (some of which have been moved slightly from their XCF positions). The ActionScript snippets in this file define the physics parameters (such as relative angles and elasticity coefficients). Collectively, the physics parameters tell the hairstyle how to behave.

    Note: at the moment of writing, you'll be able to open the FLA and view its contents, but you won't actually be able to re-compile the hairstyle on your own. It depends on an external library (dynamicHairExtenderV5) whose source code I haven't released yet. Give me a few more days to clean it up and run some final tests.


    The following character codes can be applied regardless of which hairstyle version you're using. They can be applied independently (if you want only one set of changes) or successively (if you want all of them).

    Face and Body
    This charcode will adjust the SDT girl's mood, makeup, iris color, skin tone, and body proportions to resemble those of the original character.
    Hair Color - Dark Red
    The standard hair color is based on a reference image which uses a very bright palette - suggesting outdoor lighting. If you'd prefer darker reds (to fit with a courtroom scene) then you can apply the following charcode:
    Note: I'm somewhat colorblind and so the match may not be exact. Feel free to customize the HSLC settings to your liking.

    Ersatz Clothing
    Custom clothing mods for this character have not been created. If you'd like to see a rough facsimile of her outfit, built from standard SDT costume components, then you can apply this charcode:
    Last edited: Nov 17, 2015
  2. Hank East

    Hank East Swell Supporter

    Jan 25, 2012
    Likes Received:
    You say the dynamic one moderately impacts my performance but I honestly have not noticed any performance drops with it, just thought I'd say that.

    Other than that, great mod! The dynamic hair is the smoothest dynamic hair I've ever seen in SDT!
  3. stuntcock

    stuntcock Staff Member Moderator

    Jun 5, 2012
    Likes Received:
    Character Selection

    ZeV brought forward a half-dozen candidates for this project. I assume that they were chosen on the basis of "characters that ZeV likes" or "hairstyles which look silly when static but would move nicely when animated." He may have more to say on the matter.

    I'll describe a few of my own considerations below, pertaining mainly to the technical aspects of dynamic-hair animation.
    • Length: there's no special bias towards long hair or short hair.
      • A few of the hairstyles that we considered were very short, but these can still be attractively animated.
      • If you consider the bangs of the Kizuki hairstyle in isolation, then you'll get an idea of how a short hairstyle might be tackled.
      • Long-hair designs lend themselves to smooth and sinuous animation patterns involving parallel or converging lines.
        • Here's a bad example. The upper (braided) section is reasonable, but the lower section is a jumbled mess of self-crossing. Even if we animated each strand faithfully and independently, the viewer would be left with a chaotic impression of a "cloud of hair" rather than any consistent sense of motion.
        • Here's a better example. Please ignore the fact that the hair is much too long to be suitable for an SDT character. Note that the hair is very thick, and that it curves gently throughout its length. Nonetheless, the lines at any given point (to be more precise: any cross-section) are parallel. The "parallel lines" suggestion does not mean that a hair strand must be perfectly straight when it's at rest!
      • Short-hair designs work best if they contain spikey or feathered elements whose lines either cross or diverge.
        • Here's a bad example. The strands are mostly parallel, but they aren't long enough to form inertial curves. When the head moves, all of the strands will tend to Skew in concert, thus denying the viewer any change in relative shapes or sizes. It would be difficult for the viewer to notice animation except during very violent movement.
        • Here's a better example. Most of the strands diverge from a common origin (the central part-line) and therefore each impulse will tend to exert longitudinal force on some of them and rotational force (torque) on others. The differing inertial responses will change the overall shape of the hair (i.e. elongation or compression along the axis of travel), and the viewer will get a clear impression of movement.
      • The advantage of the Kizuki hairstyle is that it includes both "long" elements (the ponytail) and "short" elements (the bangs, hairbow, and sidelocks) and hence it allows us to demonstrate a variety of animation techniques.
    • Internal Detail: the reference images for a dynamic hairstyle should show a moderate level of internal detail.
      • Note: "internal detail" refers to the artwork inside the outline of the hair strand. Zones of highlight and shading, longitudinal crease lines, cross-hatching, color changes which occur along the length of the hair strand, etc...
      • The vectorization workload increases with the amount of visual detail. An extremely-detailed hairstyle may not be "worth" the hours of work involved in tracing it.
      • If the level of detail is very high, then segmentation becomes tricky. Each pivot-point will introduce seams, breaks, or discontinuities in the lines or color fills within the hair strand.
      • Gradient shading presents a special challenge for dynamic-hair animation. It's not impossible, but it requires MUCH more effort in both planning and fine-tuning.
      • If the level of internal detail is very low (e.g. because the original artist used a highly stylized approach) then it will be difficult for the animator to effectively convey the impression of internal rotation or motion. All of the information must be presented via changes in the external outline of the hairstyle.
      • SDT hair animation is imperfect. The internal visual details of a hair strand will always be slightly flawed; the external outline of a strand will always include minor "kinks" or "corners" rather than forming a perfect curve. The goal is to split the viewer's attention between the two, so that the eye will believe the overall animation rather than focusing on the shortcomings of either aspect.
      • If you scan through a few reference images, you'll note that the image selected by ZeV has a fairly high level of detail. Some of the images use a very restricted palette, which would have been less amenable to animation.
    • Strand Count: a typical anime hairstyle should include at least 3 independently-animated strands, but no more than 15.
      • If you've animated only one large ponytail, then you're probably not looking hard enough. What about the sidelocks? Cowlicks? Ahoge? Adding animation details to your hairstyle - even minor ones! - can make it seem more responsive and genuine.
      • If you've previously dismissed a hair design because it has "too many moving parts at weird angles" then I'd encourage you to re-consider. The extended physics library allows us to animate a lot of hair designs -- even ones which weren't feasible under the more simplistic "ponytail-only" physics.
      • I've suggested an upper limit of 15 because you'll sometimes encounter reference images like this with an extravagant number of separate hair strands. While it's possible to tackle such a project as-is, the workload would be enormous and the runtime performance (FPS) would be terrible. Instead, you should try to find an alternate reference image which merges the strands into a smaller and more manageable set.
      • Depending on the counting method, the Kizuki hairstyle contains 5, 8, or 12 strands.
      • When finished, the Angela Balzac hairstyle will violate this guideline - it will contain 20 to 25 strands (and that's just the hairstyle itself - the costume and body mod contain a few more!). It will impose a significant performance impact on the user's PC. This is excusable, because the project was intended to challenge the limits of strand-convergence physics, and thereby force me to resolve some weaknesses in the code.
    • Layering: can be a blessing or a curse.
      • When you're working on a hair strand in Flash, you're almost certainly going to promote it to the highest visual layer (DYNAMIC_HAIR_OVER) so that you can fine-tune its appearance and behaviour.
      • After you've spent hours drawing/tracing, cropping, and animating a hair strand, you may feel reluctant to "put it back" onto its proper layer. After all - "what was the point of investing so much work, if the strand is going to be hidden behind the character's torso during 70% of gameplay time!?"
      • Try to be aware of layering issues as you're planning out your hairstyle project. You may want to deliberately "slack off" on the visual quality and animation detail of background strands. Doing so will allow you to focus on the most-visible foreground elements, and (potentially) improve the runtime performance of your hairstyle because you haven't wasted CPU cycles on background animation.
      • If your character design puts ALL of the neat animation details into background layers (where they'll never be seen!) then you might just abandon the project and choose again. Alternatively, you might attempt to mirror the character so that the animated elements are pushed into the foreground.
      • The left-side (background) ponytail is the most prominent element of the Kizuki hairstyle, but we deliberately chose reference artwork which would curve it away from the torso. Thus, it would tend to remain at least partially visible during gameplay. This initial choice was reinforced by animation decisions. For example, the distal portion of the ponytail was assigned elasticity parameters so that it can occasionally "flick" into view. Because the hairtip is usually hidden behind the character's hips, its brief appearances are very noticeable. It will appear frequently during vigorous motion (e.g. Auto Mode = Hard), which helps to emphasize the unusual/violent nature of such action.
    • Hair Accessories and Jewelry: can often be animated
      • Even if a hairstyle is tightly pinned, it may include hair ties, ribbons, ornaments, etc... Trailing elements such as ribbons can be animated conventionally. Ornaments may be allowed to move very slightly around an anchor position, thus giving a visual impression of inertia and dispelling the "unreality" of the perfectly-static hairstyle.
      • If multiple hair strands meet at a point of convergence, then that's the perfect location for a barrette, or hairclasp. The presence of the accessory "explains" the convergence, and its artwork will help to conceal any minor visual irregularities which occur at the point of convergence (due to imperfect hair physics code).
      • Independent accesories and jewelry items (such as necklaces, veils, etc) can also be animated via the "hair physics" system. Although the physics system usually anchors each hair strand to a position on the head, it has been extended to work with any bodypart. This has been demonstrated, for example, with physics-animated leashes attached to the collar, and physics-animated chains attached to the wrists.
      • The Kizuki design includes an earring (which was implemented as a standard SDT import) and a necklace (which was omitted for scope reasons). The hairband was kept as a static hair element. The loops of the hair bow were given rudimentary animation - I'll explain the technique used (and the rationale) in a subsequent post. The trailing ribbons of the hair bow were excluded, because they're concealed behind the skull 99% of the time.
  4. Vez

    Vez Content Creator

    Jan 26, 2013
    Likes Received:
    Finding References

    I personally use gelbooru for references.

    The site uses a tagging system that allows you to search for specific characters, games, animes, hairstyles, etc. You can also utilize tags such as "side" or "profile" which can help narrow down searching for those important side references. However, I would recommend searching for your character/whatever without the side or profile tag afterwards, because some images just aren't tagged properly.

    As I said above, it's very important to find images showing the side of the character's hair (or outfit for a clothing mod). While images with frontal or partial side views may be pretty, they're of little use. Images that have views like this, specifically the second view from the left, are perfect.

    Ideally, a side reference should only have one eye showing, which is the angle SDT is played at.

    Also, if you're downloading the image, be sure to download the highest resolution. If the image is available in a higher resolution, it's usually said so directly above it.

    If you aren't using gelbooru, at least don't go to Google images first. I'd only use that as an absolute last resort.
  5. stuntcock

    stuntcock Staff Member Moderator

    Jun 5, 2012
    Likes Received:
    Animation Planning and Segmentation


    The ponytail is divided into two strands - primary and secondary. For the sake of simplicity, they have a common anchor position but do not share any actual RopeLink objects. The two strands tend to remain together during animation simply because they have similar physics parameters. The anchor point of the ponytail strands coincides with the "knot" of the hairbow. This coincidence is not "necessary" (in terms of physics or layer-composition or whatever) - it simply looks nice.

    During vector-tracing, the secondary strand was deliberately given a shape whose proximal section is much too thick. If seen on its own (as in the Flash screenshot above), it would look ridiculous. Fortunately: it is not seen on its own during gameplay. The thick proximal section is covered by the primary ponytail strand, and the excessive thickness of the secondary simply acts as an "insurance policy." It ensures that the two strands are less likely to become visually disconnected - even during very violent movement.

    Example: the following screenshot shows the character in two different extreme positions (unrealistic/unstable postures, which can't be achieved without Animtools). In both cases, the hair has been allowed to settle into a resting position. Observe that the angle of separation between the two strands of the ponytail changes significantly, depending on the orientation of the character's head within the scene.

    The angle of separation exhibits much larger changes during motion, but it's difficult to demonstrate that with screenshots. And I'm too lazy to capture a bunch of GIFs for this tutorial. Just play around with the hairstyle and you'll see what I mean.

    Example: in the next screenshot, the character has moved rapidly towards the right and is now snapping back to the left. This is a very "violent" motion (approx 3g acceleration). The hairtip of the primary strand has curled into a noticeable scythe shape because its inertial rebound has not yet been resolved. Sharp kinks are visible in many places. The entire ponytail has been rotated away from its canonical rearward orientation, leaving a section of the posterior scalp exposed. In spite of all that, the two strands of the ponytail have remained visually connected. Yay!


    This "separation risk" is significant, because the plan called for the two ponytail strands to be assigned different physics parameters. The secondary strand, being visually thinner than the primary, would be made lighter and less rigid. It was intended that the gap between the two strands would grow and shrink during character movement. This is a pleasant animation feature, and it helps to distract the eye from the fact that the primary strand is unrealistically rigid.

    "Why does the primary strand need to be so rigid?" Partially because of its thickness - it would display visual flaws if any segment were to rotate beyond ± 10 degress, relative to its neighbours. But mainly because we wanted it to retain a permanently curved shape - even at rest! If we don't assign any rigidity to a strand, then its resting shape will be a straight line pointing towards the floor.

    Next, let's take a look at segmentation.


    The secondary ponytail strand uses a conventional segmentation pattern. It has a very low level of artistic detail, and most of its segment boundaries are hidden, so we could afford to be very lazy.

    The segmentation of the primary strand is more interesting. The upper segments are very long. If we allowed a lot of motion to occur within these segments, then they would necessarily form "kinks" and sharp corners -- there simply aren't enough pivot-points to generate a variety of graceful curves! Of course, we don't allow such motion to occur; the upper segments are assigned high rigidity values and so they tend to remain "frozen" in their canonical/reference shape. The extreme rigidity is made credible by the fact that the hair strand is very thick. If the viewer is willing to accept that human hair (unbraided, unpinned, unfastened) can generate this sort of shape, then they'll presumably believe that it can also retain this shape during motion.

    As we move along the strand, we see that it gradually tapers down to a more believable thickness. As it does so, you'll note that the segments become shorter (and hence that the pivot-points become more dense). This portion of the strand will be assigned moderate rigidity values and steadily decreasing mass values. The tapering of RopeLink mass values is roughly proportional to the tapering of the hair's thickness.

    Thus - the lower section of the primary ponytail strand is assigned physics parameters which will make it fairly flexible, and it is given a high segment count so that flexion will tend to produce a smooth outline without sharp corners.

    This configuration is, of course, imperfect. It's performs reasonably well within the standard SDT kneeling-fellatio scenario because it has been fine-tuned to do so. When dealing with a more exotic position, we will encounter a number of visual flaws (such as kinks in the outline - see screenshot below). Many of these could be fixed with additional testing and fine-tuning, but I haven't bothered to do so. Why not? Because the ponytail is simply too rigid to be believable in non-standard positions. Even if we corrected all of the minor flaws, we're still left with the glaring issue of "why in the hell is that ponytail perpendicular to gravity???"


    The ponytail has a curved resting shape which matches the reference artwork. So long as the character is upright, the ponytail's motion is pleasant (if not entirely "believable"). Achieving proper physicality would be difficult, and would impair the first two qualities, so I probably won't make the attempt.

    Let's begin by imagining that the bangs were laid out in the same manner as the ponytail. We'd have three strands, anchored at a position anterior and ventral to the forehead.

    This isn't true.

    The bangs are actually anchored at a point on the forehead. A short "hinge" connects this anchor to the apparent anchor position which we've previously described. The hinge piece is very rigid, but its slight degree of flexibility allows this Shared nexus point to bounce and bob by a few pixels.


    This was an important aspect of the animation plan, because the bangs were meant to be responsive to motion. Their total range-of-rotation would be constrained to ± 20 degrees from the reference orientation (implying VERY heavy styling gel). Minor [x,y] translation of the nexus point give the bangs a way to "react" to strong impulses, even when their rotational reaction is already "maxed out."

    The viewer also expects that the proximal section of the bangs would retain some flexibility, even if this section is permanently hidden from view (due to the camera angle). The Hinge allows us to fulfill this expectation.

    Lesson: if physicality is a goal for your modding project, then hair strands should always be anchored on the scalp.

    The actual rigging and segmentation of the bangs is fairly mundane. The middle strand contains only a single segment, because its artistic detail is minimal and it's mostly concealed. The fore and aft strands each contain three segments. There's some fancy rotation-blending math behind the scenes, but it's beyond the scope of this tutorial.

    The hairbow has a very simple animation plan. It was a late inclusion to the project, and at that moment I was very worried about runtime performance. It therefore includes only four segments ("moving parts") in total - each loop of the hairbow consists of two half-loops. Each half-loop shares a RopeLink with its immediate neighbour, and is anchored to an appropriate position on the "knot" (which overlies the loop, and is entirely static).

    What would happen if we simply Anchored each half-loop and assigned no special physics rules? Well, the in-game result would be similar to the "preview" that we can see in Flash - each segment would dangle downwards under the influence of gravity.


    By assigning a torque force to each of the upper half-loops, we can force them into a roughly-correct position (it's actually slightly higher than we want them to be). Since the RopeLinks are shared, the combined gravity and elasticity of each Segment pair will drag the loop into the desired position.


    The most important limitation (or "weakness") of this rudimentary approach is that it does not allow elongation or compression along the x-axis. In the case of the Kizuki project, this limitation was acceptable -- ZeV's feedback (and video samples from the game) suggested that the material of the hairbow was very stiff. If you're attempting to implement a physics-animated hairbow whose ribbon material is supposed to appear "soft", then I'd encourage you to use four segments per loop.

    It's also possible to imagine a more ambitious or holistic physics-modeling effort. Instead of making the hairbow's Knot a static element, we could have made it dynamic and shared it with the two strands of the ponytail. The entire hairbow, and the entire ponytail, would then be able to bob up and down by a few pixels if the character bounces herself vigorously (cowgirl position?). This idea was rejected because the additional complexity, workload, and testing would easily outweigh the miniscule improvement in physicality.
  6. Widget

    Widget Potential Patron

    Feb 3, 2013
    Likes Received:
    Haha wouldn't blame you for not using mine, it was my first vector ever and is in hindsight terrible :P
  7. Soccerjam

    Soccerjam Vivacious Visitor

    Feb 15, 2015
    Likes Received:
    Can you make her dynamic hair without needing the loader?
  8. stuntcock

    stuntcock Staff Member Moderator

    Jun 5, 2012
    Likes Received:
    Yes, but we'd lose most of the visual effects (such as the permanent curvature of the ponytail) and minor animation details. Some of these could be reimplemented via fine-tuned damping parameters and angled gravity, so that the hair would assume an appropriate shape when at rest. Unfortunately, these techniques result in very poor physicality (the hair looks very wrong/fake when it moves) and so it simply isn't worth the effort.

    I wrote the extended physics code because I wanted to be able to "do more" with SDT hairstyles. If people insist that I provide vanilla-compatible dynamic hairstyles then I'd probably just quit modding instead.
  9. PyramidHead

    PyramidHead Potential Patron

    Aug 5, 2014
    Likes Received:
    I'm using Loader V5.45 now. Trying to put your Athena Cykes into her own folder the same way I used to do in V5.37. But when I do that her hair comes out horribly broken.

    OTOH, if I just open the Loader, go to the Modding tab, and Import SWF Mod, your dynamic hair loads fine. But then I can't save her config into a file; I'd have to manually load her components each time...

    Is this known? Or am I doing something wrong either with your dynamic hair or with V5.45?
  10. stuntcock

    stuntcock Staff Member Moderator

    Jun 5, 2012
    Likes Received:
    You're not doing anything wrong; it's a known issue.

    Character folders invoke a special code branch which doesn't handle the fancy Loader stuff (version 5.42+) properly. Similarly - loading characters via dialogActions also shows some anomalous behaviour because it relies on an (outdated) copy-paste of the function, instead of just invoking the function remotely.

    I discussed it briefly with MG a month ago - after someone reported similar problems with Huitznahua's bikinis in character folders. He offered a quick fix ... which IIRC didn't completely resolve the problem. We dropped the issue because it looked like actual work would be involved (and nobody had followed up on the original complaint, so I figured that character folders aren't especially popular/important among SDT users).
  11. aztlan

    aztlan Swell Supporter

    Sep 14, 2013
    Likes Received:
    I use the loader character folder system almost exclusively - it would be nice to fix it.
  12. imghay

    imghay Potential Patron

    Jun 7, 2013
    Likes Received:
    I rarely do write but when I do it's with high praise. Outstanding job! Gave it a test drive with Fleacks Bundle 2.2 and no matter what position she was in everything looked smooth and probably even "natural".

    How many man hours did you put in this project?

    The tip of the front most bang trails off when she's moved violently.
  13. Huitznahua

    Huitznahua Staff Member Moderator

    Feb 6, 2014
    Likes Received:
    Just notice this dynamic hair. I wanted to let you know that the animation really look good (fluid, for each part of the hair, ...). So good job :wink:

    I've also notice a little bug : I use a custom character in my INIT folder with static hair. When I load your mod the dynamic hair appears above the static hair like this :
    I need to manually discard the static hair and reload the dynamic hair in order to use the mod properly.
    It's not a big issue and I'm not particularly interested in this character, I don't expect a solution.
    It's just to warn you for your future projects.
    Last edited: Nov 18, 2015