Velvet Assassin on Mac (Patch)

I just got news that Vel­vet Assas­sin has been port­ed over to the Mac and is avail­able on the App Store! How­ev­er, I was not at all involved in the Mac port and I don’t know the devel­op­ers who did—it came as a sur­prise to me as to any­one else in the for­mer team. Here is a direct iTunes link: http://itunes.apple.com/app/id586878367.

Shader Bug on ATI graphic cards

Unfor­tu­nate­ly there is a shad­er bug with ATI graph­ics chips.  It hap­pened to me while try­ing it out on a 2011 iMac with an ATI Radeon HD 5670. I got reports from friends that this is not a prob­lem of the Mac port itself but it hap­pens on PC too. The prob­lem is relat­ed to ATI chips with dri­vers that are new­er than 2010 or so. Here is a screen­shot:

Screen shot 2013-01-11 at 04.09.06

The bug appears as low frame rate and with the main char­ac­ter shad­ed sol­id black, except for eyes and attach­ments. This hints at a numer­i­cal float­ing-point prob­lem con­nect­ed to soft-skin­ning. And indeed, I was able to track down the cul­prit and there are two things hap­pen­ing:

  • There is a square-root oper­a­tion in the ver­tex shad­er that gen­er­ates NaN, but only when soft-skin­ning is enabled. This is respon­si­ble for the black shad­ing on the char­ac­ters.
  • The low frame rate is relat­ed to the address reg­is­ter indi­rec­tion used for soft-skin­ning. The dri­ver is some­how mis-com­pil­ing this code, since the per­for­mance returns to nor­mal when this part is com­ment­ed out (but then, of course, the char­ac­ters are not ani­mat­ed). There is not much that can be done about this with­out a fix from ATI.

Patch

I have made a patch to at least fix the visu­al appear­ance, so the char­ac­ters are no longer black. Unzip the patch and replace the two shad­er files in the Vel­vet Assas­sin data fold­er. On the Mac, this is locat­ed inside the app pack­age, exact­ly here:

Screen shot 2013-01-11 at 03.24.17

Down­load the patch:

Down­load “Vel­vet Assas­sin Shad­er Fix” VelvetAssassinShaderFixATI.zip – Down­loaded 554 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 dis­sect the shad­er code, you’ll find the fol­low­ing fea­tures in there:

  • Algo­rith­mic anti-alias­ing of spec­u­lar high­lights (and envi­ron­ment maps too), when high qual­i­ty is select­ed. It is done via a heuris­tic that low­ers the mate­r­i­al glossi­ness depen­dent on the ddx/ddy of the nor­mal, so both nor­mal-map per­tu­ba­tion and fine geom­e­try is tak­en into account.
  • Envi­ron­ment maps are inte­grat­ed in the shad­ing mod­el, with auto­mat­ic selec­tion of a mip lev­el that cor­re­sponds to the size of spec­u­lar high­light.
  • Two modes of alpha-trans­paren­cy: One mode to be used as a trans­par­ent but sol­id sur­face (like glass), then the spec­u­lar reflec­tion is not mod­i­fied by the alpha val­ue; and anoth­er mode for alpha as a cov­er­age val­ue (for instance when fad­ing-out strands of hair) so the spec­u­lar reflec­tion must be atten­u­at­ed too.
  • Lots of gam­ma/de-gam­ma mag­ic.

Enjoy!

 

10 thoughts on “Velvet Assassin on Mac (Patch)

  1. Thanks for cre­at­ing these files, but with which pro­gram can i unzip these on mac. With The Unar­chiv­er and oth­er famous pro­grams it dont work.

    • Hi Alex
      this prob­a­bly means that the down­load was bro­ken. The file is a stan­dard zip file and can be opened with Archive Util­i­ty and Unar­chiv­er etc.

    • Hi Chris­t­ian, I’m Alex again. I’ve extract­ed the files into the tar­get loca­tion. But unfor­tu­nate­ly, there’s no dif­fer­ence in game play. That was because I thought I must unzip these.
      My Sys­tem: HD 5770, core 2 duo 1,86 ghz, 4GB RAM 800mhz

    • There should be no dif­fer­ence in game play indeed. This patch only fix­es the visu­al glitch of a pitch black main char­ac­ter. I only rec­om­mend apply­ing this patch if you have this prob­lem. It also seems that upgrad­ing the OS brings new­er dri­vers that fix­es the prob­lem com­plete­ly. I upgrad­ed from 10.6 (Snow Leop­ard) to 10.8 (Moun­tain Lion) and all bugs are gone.

  2. I meant the visu­al glitch when I said game­play. (I m ger­man) I run OS X 10.6.7. There is no option to run my sys­tem on new­er soft­ware. The game can run at 10.6.6 how it is rec­om­mend­ed in mac app store. So is there any option for my sys­tem. Is it real­ly the OS that made these prob­lems?

    • The prob­lem seems to be with cer­tain ver­sions of the ATI dri­vers, as the prob­lem can appear on PC too. Very old dri­vers from 2009 work ok, the newest seem to be ok too. The range in between is bug­gy. The new­er Mac OS sim­ply comes with new­er dri­vers.

  3. Thanks for answer­ing my ques­tions. 10.6.7 was the first ver­sion 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 work­ing with it.

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

Leave a Reply

Your email address will not be published.