Environment Upgrade

The last few weeks I’ve been trying to follow my latest project schedule for a beta release in mid-April (hopefully).  Up until now, I’ve been loosely following schedules that I revise every few weeks.  I always stray off to focus on additional tasks that reveal themselves as I’m working on my current tasks.  This totally wreaks havoc on my schedule but it’s also quite fun to work this way.  Now that the game is near complete, I hope I can finally set a schedule and stick to it.

Last week, I focussed completely on environmental artwork.  The last time I did any work on the environment must have been over a year ago so this was long overdue.  I only allowed myself one week to work on this and I completed pretty much what I wanted to get done.  But I do want to put in another week of changes sometime after beta release.  I’ve been playing a lot of Rayman Legends with my boys and I really like the artwork.  You just don’t see many games like this anymore.  Half of the times we were playing, I was actually just focussing on the artwork and observing how they created such amazing environments.  I used that as inspiration as I created new textures and meshes for my background.  I actually played Rayman Legends and moved my character to some locations that I really enjoyed and left it running for hours as I painted textures for my game.  Here are some of the textures I was able to create.

Here are images of the new environments in action.

The bamboo clusters turned out far better than I expected! They animate too!

The rock textures are used for floating islands in the background. They’re organized in different parallax layers. You’ll noticed the effect when you ascend up to the next platform.

I’m very happy with the results, not bad for programmer art.  After looking at these screens, I find the lighting in the scene is too flat though.  I will try to add some subtle shading to add more depth.

For comparison, here are how the same levels looked like with the old environments

The new environment artwork also makes the mountain texture used in the background stick out.  It just looks horrible plain and simple.  I think this texture was done a year ago and I actually spent a whole day on it before giving up and settling for this monstrosity.  It’s good to see how much my digital artwork has improved.  I will definitely replace this eye-sore before release.

Performance Issues

After adding the new environment artwork, I loaded up Unity on my Mac and made all my usual tweaks to the texture import settings to compress them with minimal visual artefacts.  I deployed my game on my iPad 2 and noticed a significant drop in performance for levels that used the bamboo clusters.  For the first time ever, I was hitting below 30 fps and animations definitely looked jerky.  I changed the project settings in the XCode project to view some profiling information and found the draw calls had grown substantially.  Each frame was now making around 350 draw calls.  Clearly this wasn’t optimal and I went back to see what I could do with the bamboo clusters.  They were originally modelled in Blender as separate objects with their own animations.  I typically use a vertex shader for swaying objects but I decided to animate the bamboo directly so I could create more interesting animations.  I tried a combination of different things but in the end, I combined the entire bamboo cluster (of about 10 bamboo) into a single mesh and used an armature to do the animations.  This cluster is then instanced a few times and scattered in the background.  The texture for the bamboo is very minimal, just a single bamboo texture that can be tiled vertically.  The leaves are also part of the texture but occupy another side so that it does not affect tiling.  I achieve different looking bamboo by using vertex colors.  With my new changes, draw calls were back down to about 150 and I’m getting around 45-50 fps.

Beware of Point Lights?

While investigating the performance issues related to the bamboo clusters, I noticed the rendered triangle count reported by Unity was abnormally high.  I was close to 30K triangles per frame!  The only objects in the scene with fairly dense meshes would be the characters but there’s no way it should have been so high.  I tried disabling one of the body parts during gameplay and noticed that the rendered triangle count would decrease by double the triangle count of the mesh itself.  So it turned out the characters were rendering in 2 passes.  I looked at the shaders I have written and found they were all Unity surface shaders.  I rewrote one of the shaders as vertex and fragment programs using CG and tested it out.  It was still rendering in 2 passes.  So I checked the one an only light source in the game.  It was set to a point light so I tried changing it to a directional light.  That was it, changing to a directional light made every body part render in a single pass and my render triangle count was back down to under 20K.  I didn’t really notice any hard evidence of performance increase though.  So I wonder if the reported triangle count might be buggy in Unity (version 3.5.7f6).  But just to play it safe, I’ll keep it as a directional light.  When I have time, I may try and track down the cause of this issue.

Next

I’ll be focussing on the player mesh this week.  You can already see some of the changes I’ve made in the latest screenshots.  The head I have been using is very old and it’s about time I replaced it.  I’m only giving myself one week to work on this, hopefully I can get enough done in that time to move on to my next tasks.  But it has been while since I have done character modelling and animation.  I always stumble badly when it comes to rigging and this is the first project I’ve done using facial animations.  The player character will use a more elaborate rig than the enemy heads.  I’ve been reading through a lot of online tutorials for modelling and rigging and I’m trying to create a cleaner topology that is more suitable for animating.  Ok, back to work!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>