Here we go.
- Download BA Shaders for 3D Max.
- Copy .dll files here -> "3ds Max 2010\mentalray\shaders_3rdparty\shaders"
- Copy .mi files here -> "3ds Max 2010\mentalray\shaders_3rdparty\include"
- Edit "3rdparty.mi" located here -> 3ds Max 2010\mentalray\shaders_3rdparty
- Your "3rdparty.mi" must be something like this.
- Create a matte/shadow shader and uncheck "receive shadows" and "use ambient occlusion".
- In the "camera mapped background" input, connect a "BA_color_raylength" shader.
- Play with the "spread" to control the behaviour of the occlusion.
- Once rendered you'll have something similar to this.