Browsed by
Category: Technical

Violating your classes Objective-C with method swizzling

Violating your classes Objective-C with method swizzling

Went to a iOS programmers meetup recently here in Portland and they did a talk on the C-runtime.  I missed most of the talk due to other commitments, but the topic of method swizzling came up.

Basically, it allows you to change what class methods are called by a class – at runtime.  In other words, you can start willy-nilly re-pointing your member functions at runtime by:

  1. Create your 2 or more classes as normal (class A, class B)
  2. Create some methods off each class you want to swizzle (A.thisFunc, B.thatFunc)
  3. Swap’em – using the runtime functions:
    1. class_getInstanceMethod()
    2. class_addMethod()
    3. class_replaceMethod()
    4. method_exchangeImplementations()
  4. Profit!

 

While this is obviously very, very dangerous and likely not something you’d do in production, it does create some interesting opportunities for testing and exercising record/replay and persist/restore code.

Either way – interesting write-up.  Perhaps the title of the talk should have been called ‘Stupid Objective-C tricks’. 🙂

 

Notes from PAX Prime 2013

Notes from PAX Prime 2013

Man, sorry I didn’t get around to this sooner.  Been busy with work and just slipped my mind.  With all the CES announcements, it reminded me of the notes I took at PAX Prime 2013 in Seattle.  Here they are in kind of un-filtered format.

Session: Building a Team for Indie development

A panel of several successful indie development teams answering some common questions/start-up topics.

  • Hiring:
    • One team hired 7 of their 10 employees from forums.  Forum members are often a great place to pick up passionate people.
    • The folks that team hired were valuable contributing forum members that did all kinds of crazy things like robustly testing out the latest beta features and giving really good feedback – for free.  The dev team then approached these passionate forum folks about full-time work.  They knew these high contributing forum folks were passionate since they did the work on their own.
    • Most teams hired contract people in some cases (artists, musicians, and some devs). They gave small tasks to their new folks to see if it worked out and then expanded/continued/discontinued working with them based on how well they performed/quality of their work.
  • Funding:
    • Your team WON’T get funding without a track record.  Another team of vets said that even if you do have a track record, you still likely won’t get funding.  Those days are pretty much gone.
    • You can pretty much assume your first game will be unfunded at this point.
    • One group’s team was all industry vets that bootstrapped their project with their own money.  Likely the only way you can do it anymore.  Most of the panel agreed this is what they did.
    • Meant they had to have saved up a good bit of money, balance family commitments/needs, etc.  Stressful.
  • Pay
    • Base pay for everyone was very low but with high royalties (5%-10% royalty range for key contributors)
    • Temps and those not actively working at ship got capped amounts
    • or, they split pay by hours/days spent on the project out of the total
    • One team capped royalties after one year (i.e. you got % royalties but only for first year of ship)
    • No profit sharing with brand new folks to avoid problems
    • Braid developer wanted ALL royalties so he simply paid his artist $200k flat with no royalties
  • Different time zones required good, veteran people to avoid lost time on back and forth vision differences.  Skype/Google hangouts key for communication.
  • Takeaway: Continuing a trend I saw last year, indie dev teams are more and more industry experienced developers that quit to go follow a vision they’ve been fleshing out during their day jobs and fund these endeavors themselves.  Money is tighter, which makes time tighter.

Session: Gaming’s dirty secrets – why your favorite game never left Japan/got ported/has crappy port/etc.

A panel of developers/producers/game industry vets answered questions about why games get canceled/delayed/never ported/etc.

  • Bugs and bad ports:
    • Big games: almost half of the budget is marketing.  You have to do multiple releases on multiple titles at the SAME TIME.  You can’t delay release date because one platform has a problem.
    • Often you will be forced to release with minor bugs to avoid introducing new big bugs/stop-ship regressions.  Why?  It’s easier to ship with minor bugs and then provide a day 0 patch because you can then pull patches if it breaks, but releasing with a showstopper is the end of the world.
  • Steam Early Access games/route:
    • On almost every steam early access game forum page – people railed absolutely VITRIOLIC HATRED against the problems and bugs they find.  People completely flip out – even despite all the huge warnings that beta/early access games will have problems.  You spend LOTS of time having to deal with those problems and bad PR/unhappy folks despite the fact these issues are exactly what one should expect.  People have crazy expectations.  Steam has tried to help issue by placing more warnings.
    • Plus side of early release is that it does build a community and funds you until ship if dev cycle too long for you.  Also, playtesting is ‘free’.  People trying totally different stategies that break the game/etc are revealed early.
    • My own side note: why don’t early access games only show up in B&W or with red pre-release overlay/border to make it even more clear they’re not playing a full release game.
  • Publishing slots
    • Bigger games must sign up for ‘release slots’ on a publishing houses’ schedule.  There is often a fixed schedule with only X number of Triple-A releases, Y number of Indie, Z number of casual, etc.  You have to sign up for one of these slots well ahead of time – and the slots all come with different conditions.
    • Early exclusives, for example, are often part of the conditions of a publishing houses release slot.  Often you aren’t paid for all the extra work or the fact it’s exclusive to one platform – it’s just flat a condition of xBox/Sony or the publisher’s release slot you signed up for.  So stop thinking that certain exclusives make the dev rich – they usually don’t get anything for it.
  • Patent trolls:
    • 15% of on dev’s emails were patent trolls threatening to sue.  He simply had to just ignore them and see if any bubbled up.  Other heads nodded this happened to them to lesser/greater extent.
  • Shipping:
    • Don’t fret if you hear that/your game is delayed.  Games that are in great shape get shipped (as you’d expect).  Good games that *could* be great (but are not due to flaws) get delayed.  Bad games will always simply ship because they know nothing will fix them and you just get what you can out of them.  Delayed games are a good sign because that means they’re willing to pay to fix things and you’ll really be getting a better game.
  • Managing your community:
    • You spend a LOT of time with annoying personal attacks over and over again.  Tip: the emotional damage is already done, so let it go in that moment.
    • You will get lots of hate comments every day.  Really, really hurtful ones too.  Unbelievable stuff.  Every morning.  Made one guy never want to go look at twitter/facebook.
    • Death threats are common – and becoming even MORE common.  Everyone on the panel seemed to have gotten a few.

Session: Game career management

Panel of Indie developers.  Much of this was similar to things that had been shared in previous years.

  • They re-iterated much of what was said in previous years.  You should be networking and connecting with as many Indie devs in your area/forums.
  • Indie appears to be moving towards more seasoned vets that quit ‘regular’ dev jobs to go into indie development vs fresh-out-of-college types.  Experience is more important now.
  • Do not be the naysayer on the team.  Anyone can do that.  Be a SOLUTION provider.  That’s what makes you stand out.
  • Be bold – remember that the worst anyone can say is ‘no’.  You won’t make an impact if you don’t make a difference.
  • Finish what you start.  Getting to 80% of a finished game is still no game.  You must complete it to be anything.
  • More elaboration about being ‘passionate’.  One guy was having trouble staying motivated after all the long hours, low pay, and balancing his personal relationships.  The panel pretty much said, “Get out – you’re not passionate enough’.  Personal note: This sounded nasty because his concerns were totally normal work-life issues.  Basically, the panel seemed to indicate they only wanted people that were willing to trade anything to be in the industry – family, personal life, etc.  Since when has ‘being passionate’ meant ‘be our slave-robot in our game mine’?  I would have hoped to have seen some helpful suggestions on balancing work-life and tips to staying passionate (which IS a problem for everyone at some point despite what the panelists believe).  Left a bad taste in my mouth about their companies since they clearly were of the mind you toed that line or were gone.

 

 

 

 

Japan – using your cell phone

Japan – using your cell phone

So, one of the biggest useful tools when in a strange place is being able to use your cel phone.  Looking up maps, bus, and train schedules saves you oodles of headaches, frustration, and lost time you could spend exploring and enjoying your trip.  But using a cel phone abroad is also full of horror stories.  People arriving back home with $1000 bills for roaming charges.

So, off to the forums to read about it.  Turns out my current carrier AT&T offers an international 300MB plan for $60 and 600MB plan for $120.  That felt a bit steep for me as a friend who went for a week said that 300MB was barely enough for 7 days.  So, I started digging around on traveling forums and found a variety of companies.

Googling tends to pop up lots of different companies with many options.  Some will rent you a whole phone for your trip. Some rent SIM cards that replace your current one.  Others rent wireless hubs which you can tether your cel phone and/or PC and other devices.  Depending on what you need and how long your trip is, there are lots of options.  If you are staying a long time (month+) and want to actually get a Japanese phone plan, you usually need to show a vista that indicates you have at least 90 days of stay left before they’ll let you get one so you don’t leave the country with their phone.

The tricky part about these companies is that half of them look like scams – and others are full of fine print.  Softbank comes up top on many searches for renting sim cards for your phone in Japan.  Seems like a good deal, $1/day minimum, 0.31 cents/packet with a $15/day max that then covers unlimited data.  Sounds pretty good.  Um, but a packet is 128 bytes so you hit the $15 max in 620,000 bytes, or about the size of one jpg image.  In other words, you’re probably going to pay $15/day if you even turn it on.  A 10 day stay will then run you $150 – which is worse than the plan from AT&T.

Instead, I dug around on the forums and found these guys: eConnect.  These guys offer 1gb of data for a flat 4100 yen (or about $40).  What you are doing is renting/buying a SIM to replace the one in your phone.  They also have phone/text plans, as well as separate WIFI hubs for those with bigger needs/more devices.  I opted for the $40 data only SIM plan since I didn’t need to make phone calls and could send emails instead of texts.  The offered SIM and micro-SIM cards.  Since I had an iPhone 4S – standard SIM worked for me.

I took the gamble for $40 and bought the plan.  I opted to have it mailed to my hotel and imagine my joy that upon arrival at my hotel a package was waiting for me.  How cool to be handed an envelope and be told ‘A package arrived for you sir’ in front of others checking in.  🙂

But there’s a little work to do with the kit.  So here’s the procedure:

  1. Unlock your phone.  If you can’t unlock your phone, the SIM option is off the table for you.  My iPhone was just out of the 2 year contract period on my AT&T account, so I chatted with their support and they sent me to a link to submit an unlock request.  Wow – they use every excuse under the sun to avoid unlocking it.  I sent in the unlock request, and was told it might take them 1-3 days to respond.  Fortunately, it was more like 4 hours.  I got an email stating it had been processed for unlocking, but that I needed to wait 24 more hours before running the procedure.  I wait 24 hours, run the procedure (which requires resetting your iPhone to factory defaults for one), and then verify it is unlocked using the IMEI website (despite it’s completely scam-y appearance).  Long story short, give yourself 3-5 days to get your phone unlocked to be safe.  Don’t leave this till last minute in case their are difficulties.IMG_1632  IMG_1633
  2. Get your package.  The kit is just a small mailing envelope with instructions and the card.  eConnect lets you either pick up the package at their airport kiosk or have it delivered to your hotel.  If you opt for airport kiosk pickup, be sure that the kiosk will be open when you arrive!  Many are only open 8am-8pm and so forth.  Be sure to account for flight delays or you’ll find yourself going back out to the airport the next day.  I opted for the hotel route and it was waiting for me when I arrived.  It takes them about a week of lead-time to get it delivered via normal mail, so again, don’t do this the day you plan to leave.IMG_1618  IMG_1635
  3. Insert the new sim – I was a little surprised to find what looked like a credit card inside the package.  But you snap out the sim from the card mounting and it is in fact a normal SIM card size.  Popping out an iPhone 4S SIM is fairly easy and you can find youtube videos for just about every major phone if you look, but I did need a pointy tool for mine.  Turns out a paperclip works fine – but there wasn’t one to be found in my hotel room.  I actually brought my own paperclip pre-bent for this purpose. I highly recommend you make sure you can get your sim in/out before you leave.  The first time I tried to get my SIM card out, it was very stiff and I had to initially pop it free with a an actual tool.  You don’t want to arrive there and find you need a tool you don’t have.
    It’s at this point that you can convert a regular SIM card to a microSIM if you need to do the surgery.  eConnect actually offers microSIM’s, but not all carriers do.  I talked to one fellow on my trip who actually brought his own scissors and file and successfully managed it for his Android phone when his Australia-friendly plan only offered regular SIM’s.  I didn’t have to do this part since mine used a standard SIM card.
    IMG_1636
  4. Set up the network password – So, I put the old SIM into the included zip-lock bag for safekeeping (you are going to need it when you get back home!), and turned the phone on.  Success!  But you do have one final step.  You need to go to the carrier settings and set the APN username and password.  The instructions included were very straightforward and easy to follow.  I entered the data and waited.
    It did take a little bit for the phone to register itself with the network the first time.   Probably a good 5 minutes.  In fact, if I turned the phone to airplane mode during the day to avoid using up data, it usually took about 1-2 solid minutes before it would pop back onto the network.  But soon enough in the upper left corner I saw not my old AT&T logo but  NTT DOCOMO.  I never got any signal strength bars but it did work fine. Coverage was great all across the country where I traveled – even out in the remoter areas in the mountains around Takayama.
  5. Enjoy!  I was very conservative with my phone use at the beginning.  I would turn the phone to airplane mode when not using it.  I also only looked up train schedules and maps.  In this mode, I used only a few dozen megabytes per day – anywhere from 10-30mb.  Later, as I got closer to the end of my trip, I even did a little bit of facebooking, left it on more during the day, etc.  Those days I got closer to about 100mb/day.  In all, 1GB for a 14 day trip was just about right.  I ended up using about 700MB of my 1GB by the end.
  6. Shipping the SIM back (not required in my case).  Some companies require you to actually ship the SIM card back to them when you’re done.  eConnect didn’t and that’s one less hassle to deal with on your leaving day.

Overall, using eConnect was a great experience and I’d totally use them again.  If you’re going to use over 1GB of data, they actually recommend you buy multiple SIM cards and use them back-to-back.  eConnect SIM cards are only good for 30 days from first use.  So, they are use-it-or-lose-it deals.  Hence another good reason to just buy multiple cards and just insert more as you use them up.

Man, I really wish it were this easy and cheap in the US.  Just another example of the terrible phone companies we have here when you see how amazingly easy and cheap it is in other countries.

 

 

Code 19, missing CD drives, iTunes and you

Code 19, missing CD drives, iTunes and you

I recently rebooted my PC and noticed my CDRom drives had all disappeared.  Not only that, but the machine was acting strangely too.  I looked at the drives, and saw each of the devices was disabled with this message:

Code 19: Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or damaged

A quick Google turns up this article:

A registry problem was detected. This can occur when more than one service is defined for a device, if there is a failure opening the service registry entry, or if the driver name cannot be obtained from the service registry entry.

Try these options:

  • Click Uninstall, and then click Scan for hardware changes to load a usable driver.
  • If the device is a CD or DVD drive, follow the procedure in Article ID 929461 on the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkID=192798).
  • Restart the computer in Safe Mode, and then select Last Known Good Configuration. This rolls back to the most recent successful registry configuration.

When that didn’t work, I followed the link to article 929461 and tried this:

To resolve this problem, remove the affected filter drivers. To do this, follow these steps:

  1. Click Start, type regedit in the Start Search box, and then click regedit in the Programs list.
  2. If you are prompted for an administrator password or confirmation, type your password or click Continue.
  3. Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}
    There can be many instances of the registry subkey that is mentioned in step 3. You must make sure that you are in the appropriate registry subkey before you change the UpperFilters and the LowerFilters values.
  4. To verify that you are in the appropriate registry subkey, make sure that the Default value is DVD/CD-ROM and the Class value is CDROM.
  5. If you see UpperFilters in the pane on the right side, right-click UpperFilters, and then click Delete.
  6. Click Yes to confirm the removal of the UpperFilters registry entry.
  7. If you see LowerFilters in the pane on the right side, right-click LowerFilters, and then click Delete.
  8. Click Yes to confirm the removal of the LowerFilters registry entry.
  9. Exit Registry Editor, and then restart the computer.

When I did this, I found that Upperfilters pointed to GEARAspiWDM.sys.  The Lowerfilters pointed to a program I knew.  In searching for GEARAspiWDM.sys, Google reveals:
http://www.file.net/process/gearaspiwdm.sys.htm

Many of the comments imply this file and service comes with iTunes.  Sure enough, I had just un-installed of iTunes 11 and the done a fall-back install of iTunes 10.7 (due to the fact they broke drag-and-drop).  I removed the filter and then remove/added each drive in turn.  The drives returned like normal and the system returned to full performance.

Thanks again Apple – for your cr*ppy iTunes software.

 

Getting Intel’s HAXM hardware accelerated Android AVD running on your system

Getting Intel’s HAXM hardware accelerated Android AVD running on your system

One of the (frankly) terrible aspects of doing Android development is the horrendously slow Android emulator. This is especially true if you do OpenGL ES development.  Fear not!  Intel has come to the rescue.  They’ve released HAXM (Hardware Accelerated Execution Manager) that dramatically speeds up your Android development and emulation.  Best part is that it’s free. The amount of time you’ll save on app start up alone makes it worth every moment you’ll spend setting it up.

Setup:

  1. Install Eclipse as your normally would
  2. Open the Eclipse SDK Manager.
  3. Install one of the latest Android API packages with two important points:
    1. The API level MUST INCLUDE AN INTEL X86 ATOM SYSTEM IMAGE (API 17 at the time of this writing).
    2. Also select the HAXM support.  Found in: ‘Extras’->’Intel x86 Emulator Accelerator (HAXM)’
      Untitled
  4. After those packages are all installed, close the manager and open Eclipse.
  5. Open a workspace and get an app ready to test (use one of the samples if necessary)
  6. Go to: Run->Run Configurations
  7. Right-click ‘Android Application’ on the list on the left and select ‘New’
  8. I named mine Standard_Run_Configuration – but you can name yours whatever.
    Untitled2
  9. Put the project name in the Project box (mine was AndroidCubeStart)
  10. Select the ‘Target’ Tab.
  11. Select the ‘Automatically pick compatible device…” option, then select the ‘Manager’ button.
    Untitled3
  12. At the Manager pane, select ‘New…’
  13. Fill out the AVD with these notes:
    1. Target MUST be one of the API target levels that has the Atom system image (see step 3)
    2. CPU/ABI must be Intel Atom (x86)
    3. In the ‘Emulation Options’ list, select ‘Use Host GPU’
    4. Select OK to save
      Untitled5
  14. You should see your new AVD listed when you’re back at the Android Virtual Device Manager page.  To test it, select it from the list and then press the ‘Start…’ button.
  15. If all goes well, you should have your hardware accelerated AVD emulator.   You should notice that the emulator runs orders of magnitude faster than the standard emulator!

 

Common problems:

I had the problem where this message appeared when I tried to run the emulator.

emulator: Failed to open the HAX device!
HAX is not working and emulator runs in emulation mode
emulator: Open HAX device failed

To fix this, I tried a number of things that didn’t work, but manually installing HAXM fixed it:

  1. Close Eclipse and Eclipse SDK manager, but still make sure you’ve got the Extras->HAXM installed in the Eclipse SDK Manager (as you did in step 3 above).
  2. Go to the Intel HAXM download page:
    http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/
  3. Run the install package to the normal locations.
  4. Restart Eclipse and see if you can run the emulator via going to ‘Run’->’Run configurations’.  This time it worked for me.  You should see something like this from the message window if your HAXM is running in hardware accelerated mode.
Starting emulator for AVD 'ARM-HAXM'
emulator: device fd:756
HAX is working and emulator runs in fast virt mode
creating window 0 0 480 800
Programming a new remote entry key fob for a 2004 Mazda 6

Programming a new remote entry key fob for a 2004 Mazda 6

Had one of my key fobs die and had to replace it.  Question is – how do you program the car and key fob to work together?  Turns out the process is quite entertaining.  People wonder what the heck you’re doing when you’re following this procedure out in front of your house on a well-traveled street.

Makes one wonder what other secret codes are available for your car…

Step 1: Open drivers door and leave open.

Step 2: Lock and unlock the drivers door using the power door lock switch on the door.

Step 3: Insert key into the ignition.

Step 4: Turn key to on position and return to off position. (IMPORTANT – use ON position NOT ACC position). Do this 3 times within 10 seconds. Leave key in the ignition.

Step 5: Open and close the drivers door 3 times. (Door should be left open after this step).

Step 6: ECU should respond by locking and unlocking the doors.

Step 7: Press any button on remote #1. ECU responds by locking and unlocking the car doors.

Step 8: Press any button on remote #2 (etc.) Each time the ECU will respond by locking & unlocking the doors.

Step 9: Remove the key from the ignition and the ECU will respond a final time with a series of door locks and unlocks. You’re done!

http://forum.mazda6club.com/electrical/119494-keyless-remote-entry.html

 

DOSBox, bad \, /, ” keys and you

DOSBox, bad \, /, ” keys and you

I was fooling around with some old GWBasic programs and needed to use DOSBox the other day.  When using DOSBox, however, I was getting bad characters for \,/,” and various other keys.  This makes using DOSBox almost impossible since you cannot change directories or issue load/save commands since they need the filename in quotes.   Yet the solution to this problem isn’t what you think.  DOSBox provides an internal key re-mapper, but it wasn’t working right and I still couldn’t get the keys I needed mapped.  Often they would just enter blank or incorrect characters.

It turns out the real culprit is a badly selected default Windows keyboard driver. Open your Windows device manager and look for the keyboards.  Often you’ll see one listed as:

“MCIR 109 Keyboard”

Change this driver to “HID Compliant device”
Then restart DOSBox and it should all be working like a champ.

Here’s the thread with more detailed info
http://www.vogons.org/viewtopic.php?t=18465

Core Parking and You

Core Parking and You

So, Windows added a little feature a while back to help save power.  Unfortunately, it can have serious side effects for gaming and other high-performance computing.

Windows 7 / Server 2008  machines running on multi-core CPU’s have an obscure feature enabled by default called CPU core parking. While usually benign – some people have experienced serious issues that seem completely unrelated to this feature.  The symptoms are a decrease in performance with unstable and jittery in-game FPS, or noticeably laggy/jittery and unresponsive game play.  All this despite a high-end graphics card and CPU that should be more than capable of running the game. People have often seen this problem or described it as micro-stuttering – random fractional frame pauses that are hard to pin down precisely but are definitely noticeable and detrimental to game play.

Core parking comes in at this point.  Modern multi-threaded games often can leave a core idle for micro-portions of the frame after it has completed it’s processing and other cores are still finishing their work up.  Windows sees this idling, and decides to put the idle core in low-power mode.  Normally, threads go idle for long periods of time (often hundreds to thousands of milliseconds), so putting them to sleep is fine and can save power.  But in a game, the core goes idle only to be woken up only microseconds later for the next frame.  Unfortunately, parking and unparking has a time cost associated with the operation of a couple of micro/milliseconds – which when rendering 60+fps – actually creates noticeable tiny ‘hitches’.  It often appears randomly because it requires just the right set of conditions to cause the parking/wakeup to be visible.

So, what to do?  You can actually disable this ‘feature’ – which on a gaming rig – is probably the right action since it’s unlikely that power saving is your highest concern.  How do you do it?  Just like this:

  • Open Regedit
  • Find this key:  ” 0cc5b647-c1df-4637-891a-dec35c318583 “
  • Within this key, there is a value called:  ” ValueMax ” This value represents the % number of cores the system will park – the default is 64(hex) or 100%  ie:  all Cores are potentially park-able.
  • Change the value from 0x64 to 0 so the ” ValueMin ”  and  ” ValueMax ” are both zero
  • You will have to find the key a few times and repeat the process for each time it is found – the number of instances will depend on the number of power profiles in your system  [  for me, it was only found twice ]D
  • Do a full shutdown, power-off, and cold-re-start

Here’s a good description of the problem and how it manifests itself.

 

Adaptive Volumetric Shadow Maps

Adaptive Volumetric Shadow Maps

AVSM1

Many people ask me what sorts of things I work on.  Well, here’s one of them you can download and run on your own!  This is a graphics and code sample that co-developed to show off not only a novel new kind of volumetric effect, but also a new extension on some of Intel’s new CPU graphics hardware.

This technique is called adaptive volumetric shadow maps.  The base idea was developed by Marco Salvi who published a paper on it a little while back.  However, this version has been substantially improved by the use of a new feature of Intel processors called PixelSync which allows one to do the volumetric shadowing effect with a constant-sized buffer and no depth slicing.

The effect allows for self-shadowing on any kind of transmissive, volumetric media – such as smoke or hair simulations.

You can download the sample, run it your own, and read more about it here:
http://software.intel.com/en-us/blogs/2013/03/27/adaptive-volumetric-shadow-maps