Friday, 28 February 2014

ZBrush Sculpting and Texture Maps


Sculpting in ZBrush


          Whilst preparing to animate once I had received the environment sent to me from David, I began finishing off the character sculpt I started several days ago. All that is left is to do the sculpting for the sword a little later on.

I began the process by importing the meshes separately as sub-tools so that I could work with high levels of subdivisions without having tens of millions of polygons on the screen at the same time; I just hid the sub-tools that I wasn't working on.  I would like to say I recognise that although my mesh is far from being organic, I don't think what I was doing could be strictly defined as hard-surface sculpting, as that tends to include the use of slicing into a mesh at hard angles using slice, curve and clipping tools in ZBrush, however the final result I was aiming for wasn't organic by any means.


I had been advised by David that the best brushes to work with for the type of stone ageing and damaged effect were 'clay tubes' and 'mallet fast'. These brushes worked great, and I also discovered a technique for making cracks using the 'dam standard' brush to make sharp and deep cuts into the mesh, and to then use the 'pinch' brush to pull the edges in, making it even more sharp. I'd then chip away at these cuts with clay tubes brush to make it look more stone like. Using these brushes I worked over the whole character.

The higher amounts of detail and more realistic cracks were put in through the use of alphas in ZBrush. ZBrush had no alphas that were helpful to my character, therefore I had to learn to make my own. Taking a few different types of cracked textures from a Google image search and placing them into Photoshop, I played with the levels and contrast until the cracks were dark and the rest of the information was washed out. Once imported to ZBrush I used the 'inflate' brush on the character as to not affect the mesh structure and push the alpha through onto it.


Cracked Alpha 1

Cracked Alpha 2
Whilst sculpting there was an issue with the reversed side (or back face) of the mesh being affected if I sculpted too deeply into the front of the mesh. I tried smoothing out the side that I didn't want to be affected, but this removed the details I wanted on the front side too. Thankfully I have a friend, Josh Williams, who does character modelling and uses ZBrush a lot for it. After speaking with him he suggested turning on 'back-face masking', an option hidden in the brush menu. This solved the issue instantly and there was no longer accidental sculpting on both sides of a mesh.
Another issue I had was only found after I had baked out the normal map. I was using a feature in ZBrush called 'noise' in the surface sub-menu. With a bit of tweaking on the graph this feature was great for producing tiny chips. I didn't realise that you had to press the apply to mesh button, and until you do the feature was only visually represented within ZBrush and would not be included in the actual mesh export. I noticed it when I couldn't see the detail in the normals, and so had to apply the noise in ZBrush and re-export the meshes and re-do the normals. It wasted about an hour, but at least I've learnt this for next time.

Inside ZBrush
Inside ZBrush
Normals applied to Low Poly

Normals applied to Low Poly

Normals applied to Low Poly



Texture Maps


          For the diffuse map I plan on using ZBrush's poly painting tool. For everything else xNormal was used. The size of the maps will be x2048 as I plan to carry as much detail from the sculpting across as possible, without using excessive sizes like x4096.

For the normal map I checked the results of xNormals on default (see fig. 1). They were decent but I found a few issues, such as stepping in lines caused by only a 1x Anti-Aliasing as well as information from a different part of the character leaking onto another part. I realised this was because they were in very close proximity of each other. To better this I changed the Anti-Aliasing to x4, the edge padding to 8 (16 seemed excessive) and the 'maximum frontal and rear ray distance' both to 1 instead of 0.5 (see fig. 2).

Fig. 1  Normal map with issues highlighted in red. - xNormals on default settings
Fig. 2 Normal map, issues resolved. - xNormals with 4xAA and Ray Distance set to 1
The AO map has similar issues, with ray information being applied to other close proximity meshes (fig. 3). This was solved by the ray distance being set to 1 just like in the normal maps. For the AO I looked at a guide found on the internet which suggests good settings to work with for the best results, which indeed did produce better, more detailed results (fig. 4).

Fig. 3 AO issues highlighted in red - poor detail and mesh clipping
Fig. 4 AO with solved mesh clipping and much greater detail.

Finally I produced a cavity map extracted from the normal map. I'll be applying this and the AO to the diffuse once I've created that using poly painting.

Fig. 5 Cavity map extracted from the normal map
          Animation is my priority since I have now received the environment models and package for UDK. I will be working on the animation and alpha-state diffuse textures ready for the coming presentation.

Bibliography

Donald Phan. (N/A). Ambient Occlusion in xNormal. Available: http://www.donaldphan.com/tutorials/xnormal/xnormal_occ.html. Last accessed 28th Feb 2014.

Sunday, 23 February 2014

UDK Import Test Issues

          Over the past week I have been working on the sculpting of my character within ZBrush, and I will post a blog entry soon to show the current state that it is in. For now the work on sculpting has been stopped as I need to focus my priorities on producing what is required for a successful alpha presentation that will soon be upon myself and David. With that being said I began to test the process of importing my character/rig into UDK and whether animation carries across from Maya to UDK correctly.

I began by selecting the skeleton hierarchy and character mesh and exporting into a .FBX format. In doing so Maya presented me with a few errors on export, errors which I have seen before, signalling that the meshes have multiple transform nodes that UDK might not accept. I tried importing this .FBX into UDK and it failed ('Import Failed' with no indication as to why). I figured it was to be expected because of the transform nodes, and so delete the character's non-deformer history which usually resolves the problem, however for this particular case it did not, and to this date I still don't understand why. I wasn't too concerned however because I had come across the same issue in my Game Development module, and knew a work around for it; I made two versions of the rig, one is the completed rig with all the splines, IKs and control curves etc., and one that was a 'clean' version with only the bones and mesh, no constraints or tools on it of any kind. All I'd have to do when it comes to creating and importing the animations would be to animate on the 'complete' skeleton, bake the animations to its bones and then transfer the baked information across to the 'clean' rig via the use of a MEL script.

I tried importing the 'clean' rig into UDK and still I was presented with 'Import Failed'. After hours of looking for answers on the internet and trying various methods I decided to try importing the simplest of rigs to determine whether it was my rig, Maya or UDK that is causing the problem. I created a single bone chain, skinned a sphere to it and tried importing, which again presented as a failed import. So I had presumed it must be a UDK issue, however after trouble shooting I tried the same test of importing the simplest of rigs but this time exported it using Maya 2013 version, and not the 2014 version which I had been using. This worked, and so it also worked for importing my 'clean' rig too. I can only presume that there has been a recent update for Maya 2014's FBX exporter that is causing the issue. Either way, the importing now works and the rig behaves the way I intended it to.

          I now have to focus on creating the alpha-level block out animations ready for the alpha presentation in week 7.

Monday, 17 February 2014

Character Update 2, Rigging Issues and ZBrush preparation


Character Update 2


          The character is now fully UV'd and ready for progression into ZBrush for hard surface sculpting. Although the character is mirrored I made the choice to keep the UVs unique as to give me more options when it comes to texturing. The reasoning behind keeping the UVs unique is that it gives me the option to have one side looking differently from the other. I believe this can improve the overall quality of the character as usually mirrored objects are easily noticed, which takes away from the character and removes the viewer from the feeling of the cinematic.

I had to make a few changes to the character topology to allow for better animation deformation of the mesh. After completing the UV layout and rigging the character I noticed that in some areas the mesh still doesn't deform the way I would like it to, however I believe this is because of the rig joint placements rather than the mesh topology, and so a bit of tweaking in both the rig and the skin weights should correct the issue.


Rigging Update


          For rigging I followed the Digital Tutors' tutorial 'Rigging game characters in Maya'.
Fig. 1 Rigging for game characters in Maya - Digital Tutors

          Though this tutorial helped me a great deal I had to make alterations and re-use techniques learnt from the tutorial in other areas of my rig. The rig I created has a good deal more bones and controls as I needed to take control of the shoulder armour, the cape and the skirt and legs independently of one another. I also have a sword in my animation. For the sword I had a number of different thoughts as to how I should rig it. From my experience in another module, Game Dev, I knew that if I wanted to use a weapon as UDK defines a weapon then I would have to have it as a 'plug-in' for the character. Doing it this way would have required research and implementation of scripting/coding for UDK, something I've never done before as this was handled by the programmers in my team for the Game Development module. I didn't have room in my work schedule for research into coding and so I decided not to take that route. I also realised that whilst this is for potential in-game use, the character I am animating is only for the cinematic; the character is not controllable and therefore would not need to have a weapon that could be used, which is what the coding route would have produced.

I looked at two other methods for rigging the weapon to the character. One method was to use locators and having the parent constraint of the weapon being a variable attribute on a controller that defined whether it would be located at the hand or wherever else I might want it, however I realised that the animations for the character could change at a later date, and therefore locators put in a certain position would not suffice as the weapon could only be at one locator position or another, not 'free' to move wherever I wanted it. So with that being crossed off as an option I found a better way (Fig.2): I created an extra bone at the right hand with its own controller, and then skinned the sword mesh to the bone using an orient and point constraint, then point constrained this to the hand control. This meant that controller/bone was in charge of it's own rotation and translation, yet still follows the translation of the hand, which meant I could manipulate the sword to do whatever I want and yet still be part of the rig. My reasoning was that this would produce the best results for what I needed.


Fig. 2 Sword Integration into the Rig
Fig. 3 Rig Set-up
The final rig has bones and controls set up specifically for my character that I created by extrapolating on what I had learnt from the tutorial. These include 3 cape controllers and 6 skirt controllers (3 for each leg) to allow for a greater control over mesh deformation instead of just following the leg inverse kinematic (IK) controls, sword controller and shoulder armour controllers. I contemplated having these controls as extra attributes as to reduce on screen clutter, but decided against it as I find being able to click and quickly move or rotate controls a lot better for animation as it doesn't require you to stop and interpolate numbers into your flow, this helps you to stay creative as you can see what is happening as you are doing it rather than inputting numbers until you are happy with the visual representation.

As a side note, I learnt quite a lot from the Digital Tutors lesson, and through it discovered a new way to set up a spine in your character; I used to have only forward kinematics (FK) on the spine as IK never produced quality results. However, I learnt that you can use control clusters and splines to allow for a very smooth and realistic bending of the spine without having to use FK controls on each individual spine bones.



Rigging Issues


          I have encountered a few issues with the rigging of the character, the most obvious ones to me were the placement of the joints as they didn't allow for the type of deformation of the mesh that I would have liked, however I put this mainly down to my little experience in rigging, as now I have a better understanding of how the mesh will interact with the bones once skinned. Another issue that still exists is the orientation of the wrist bones. Although both hands (wrist bones) rotate on the same local axis, they do it in opposite values in the Y and Z axis; the left hand will rotate in positive space on these axis, whereas the right hand rotates in the negative space on these axis. I have tried using locators and aim constraints to re-orient the right hand to the right direction, but as it stands this doesn't fix the issue and is still a problem. Thankfully this isn't a huge issue, it just means that when animating and using the graph editor one hand will be predominantly in the positive space on the graph, whilst the other in the negative - more of an annoyance than a problem. If I had time to redo the rig I would make sure that the bones are correctly orientated, but for now this isn't a big enough issue for me to dedicate time to it, and so I am moving on.


ZBrush Preparation


          With finishing the UVs and rig I am now moving onto sculpting in ZBrush, which I have not attempted before when it comes to hard sculpting. I separated the model into individual meshes so that I could have them as individual sub-tools within ZBrush, however on import I realised there were a few issues stopping me from properly sculpting on the meshes. After speaking with my team mate David, who has been doing this type of sculpting for the environment, he pointed out that ZBrush prefers quads and not triangle polygons, and that the meshes should be fairly equal in terms of their polygon placement as to make for better sub-divisions. I've spent the majority of the day preparing the mesh topology for ZBrush import, which doesn't need to take into consideration of UVs as all I am doing is preparing the mesh - the low poly with correct UVs stays the same, then all I need to do is sculpt the high poly from the prepared low poly mesh, and transfer the normals onto the UV'd low poly mesh. 



Bibliography

Fig. 1 Digital Tutors. (2011) Rigging Game Characters in Maya, CD-ROM, Digital Tutors. Available: http://www.digitaltutors.com/tutorial/476-Rigging-Game-Characters-in-Maya

Wednesday, 5 February 2014

Work Schedules, References and Character Updates.

Micromanaging


         In the last post I spoke about my plan of action to carry out the work that was required to complete this module. I have now made a more detailed schedule of the work I plan to do on each day to help micromanage as much as I can in order to keep me on track for completion. Admittedly I have not modelled a character in a number of years, and so the time slots I have given for certain aspects of my work might be more or less time than is actually required for me to complete it, however as it stands if I keep on track and follow the schedule then the work should get done without too many issues, with the 'polishing' time being enough to correct for any possible contingencies.

Things may have to be moved around according to the updating state of the work and unexpected issues.



Schedule:

Schedule for aspects of A3D module

References


          After the first attempt at the character creation I decided to do a bit more referencing to find the type of hard surface, armour wearing Nordic look that I was aiming for. I had already found and used references from The Hobbit: The Desolation of Smaug; the dwarf stone statues found in the film were very useful for hard surface inspiration. To help out even further I gathered references from the game Skyrim, the armour there is very Norse-esque, and from the Tomb Raider: Underworld concepts.


Fig.1 Skyrim Nordic armour

Fig.2 Tomb Raider: Underworld  concept art

Character Update


          I have completed the character base mesh and have begun UV mapping it. It stands at around 50% UV mapped. I made the decision to use ZBrush's polypaint tool for two specific reasons. The first is that it is something I would like to gain a skill in considering this module is about learning new techniques and technologies in the production of the cinematic. The second reason is because I believe it will produce more interesting results rather than using photo images. This makes the process more linear in its pipeline also, as I can now create the different texture maps and high poly mesh in ZBrush without the need to swap to Photoshop. This means less time spread across multiple pieces of software.

         I created the base mesh using an organic male body as 3D reference for anatomy scale. I have been using Maya's latest set of modelling tools, namely 'Quad Draw' to quickly build a low poly mesh with intuitive methods for repositioning polygons and edge flows for the sake of an animation-ready topology. 


I knew a decent amount about topology for animation already, due to just the nature of being an animator and wanting to know more about the specialisation. However building a model with the correct topology was relatively new to me, and so I found two great sources to understand edge flows and the placements of polygons here http://wiki.polycount.com/CategoryTopology and here cgcookie.com/blender/cgc-courses/learning-mesh-topology-collection/. The second link is focused for blender users, but the knowledge is cross compatible with any 3D software.

Fig.3  Example of topology for animation
I took into consideration that although it needs to be anatomically correct the character is a statue and would have exaggerated features, therefore I increased the volume of the chest / arms. The idea was to keep it looking 'blocky' and hard surfaced like you would expect from a stone statue.

Character base mesh (Front)

Character base mesh (Persp.)

Character base mesh (Side)
From here I need to complete the UV process and then begin rigging and sculpting.


Bibliography

Fig.1  The Elder Scrolls Wiki. (2013). Ahzidal's Armor. Available: http://elderscrolls.wikia.com/wiki/Ahzidal's_Armor?file=AncientNordArmor-Ahzidal.png. Last accessed 5th Feb 2014.

Fig.2 Tomb Raider Hub. (N/A). Tomb Raider Underworld. Available: http://www.tombraiderhub.com/tr8/extras/images/environment42.jpg. Last accessed 5th Feb 2014.

Fig.3 Polycount. (2010). Shoulder Topology. Available: http://wiki.polycount.com/ShoulderTopology?highlight=%28%5CbCategoryTopology%5Cb%29. Last accessed 5th Feb 2014.