Velvet Assassin on Mac (Patch)

I just got news that Velvet Assassin has been ported over to the Mac and is available on the App Store! However, I was not at all involved in the Mac port and I don’t know the developers who did—it came as a surprise to me as to anyone else in the former team. Here is a direct iTunes link: http://itunes.apple.com/app/id586878367.

Shader Bug on ATI graphic cards

Unfortunately there is a shader bug with ATI graphics chips.  It happened to me while trying it out on a 2011 iMac with an ATI Radeon HD 5670. I got reports from friends that this is not a problem of the Mac port itself but it happens on PC too. The problem is related to ATI chips with drivers that are newer than 2010 or so. Here is a screenshot:

Screen shot 2013-01-11 at 04.09.06

The bug appears as low frame rate and with the main character shaded solid black, except for eyes and attachments. This hints at a numerical floating-point problem connected to soft-skinning. And indeed, I was able to track down the culprit and there are two things happening:

  • There is a square-root operation in the vertex shader that generates NaN, but only when soft-skinning is enabled. This is responsible for the black shading on the characters.
  • The low frame rate is related to the address register indirection used for soft-skinning. The driver is somehow mis-compiling this code, since the performance returns to normal when this part is commented out (but then, of course, the characters are not animated). There is not much that can be done about this without a fix from ATI.

Patch

I have made a patch to at least fix the visual appearance, so the characters are no longer black. Unzip the patch and replace the two shader files in the Velvet Assassin data folder. On the Mac, this is located inside the app package, exactly here:

Screen shot 2013-01-11 at 03.24.17

Download the patch:

Download “Velvet Assassin Shader Fix” VelvetAssassinShaderFixATI.zip – Downloaded 476 times – 12 KB

As a side effect, you’ll now get to see all the things that I did not have room to write about in the ShaderX book. For all of those who are going to dissect the shader code, you’ll find the following features in there:

  • Algorithmic anti-aliasing of specular highlights (and environment maps too), when high quality is selected. It is done via a heuristic that lowers the material glossiness dependent on the ddx/ddy of the normal, so both normal-map pertubation and fine geometry is taken into account.
  • Environment maps are integrated in the shading model, with automatic selection of a mip level that corresponds to the size of specular highlight.
  • Two modes of alpha-transparency: One mode to be used as a transparent but solid surface (like glass), then the specular reflection is not modified by the alpha value; and another mode for alpha as a coverage value (for instance when fading-out strands of hair) so the specular reflection must be attenuated too.
  • Lots of gamma/de-gamma magic.

Enjoy!

 

10 thoughts on “Velvet Assassin on Mac (Patch)

  1. Thanks for creating these files, but with which program can i unzip these on mac. With The Unarchiver and other famous programs it dont work.

    • Hi Alex
      this probably means that the download was broken. The file is a standard zip file and can be opened with Archive Utility and Unarchiver etc.

    • Hi Christian, I’m Alex again. I’ve extracted the files into the target location. But unfortunately, there’s no difference in game play. That was because I thought I must unzip these.
      My System: HD 5770, core 2 duo 1,86 ghz, 4GB RAM 800mhz

    • There should be no difference in game play indeed. This patch only fixes the visual glitch of a pitch black main character. I only recommend applying this patch if you have this problem. It also seems that upgrading the OS brings newer drivers that fixes the problem completely. I upgraded from 10.6 (Snow Leopard) to 10.8 (Mountain Lion) and all bugs are gone.

  2. I meant the visual glitch when I said gameplay. (I m german) I run OS X 10.6.7. There is no option to run my system on newer software. The game can run at 10.6.6 how it is recommended in mac app store. So is there any option for my system. Is it really the OS that made these problems?

    • The problem seems to be with certain versions of the ATI drivers, as the problem can appear on PC too. Very old drivers from 2009 work ok, the newest seem to be ok too. The range in between is buggy. The newer Mac OS simply comes with newer drivers.

  3. Thanks for answering my questions. 10.6.7 was the first version which could run on a ati hd 5770. I will try to replace the whole game again and then i will run your patch again. I think it won t work but i ll see. So thanks for doing this patch for those who got it working with it.

  4. Pingback: The Blinn-Phong Normalization Zoo | The Tenth Planet

Leave a Reply

Your email address will not be published.