This was already posted in the freshwater tank journals section, but with the new forum I thought I should bring it over here too. So without further adew, here's my DIY sprayfoam background, I did this in a 10g tank...
From the start, here is the sprayfoam as it came out of the can. I used an old broken tank as the mold for it, but after doing that, I would recommend using something breathable like a cardboard box, so that the foam dries faster. It will take approximately 3-5 days for it to completely dry in against glass. The black that you see under the foam is a UGF, and the tubes you see will go from under the UGF to a HOB filter and an air pump.

Next I painted the back glass of the real aquarium with a blue background.

Over the blue background and over the bottom I painted it with flat black, this is so that from the back it appears black, or if the gravel is thin, you won't be able to see through the bottom. This picture was taken from the outside bottom view of the tank. When I get done building the new stand, it will be housed in a flat black cabinet, so the flat black back pannel won't reflect any light inside the cabinet.

After the foam dried, I hollowed out the back of it into a cave, this provides the fish a safe place, as well as reducing the upward force exerted by the foam. It's important to let the foam dry completely, otherwise it will collapse somewhat after hollowing out the back. I painted it, and glued the UGF down to the bottom of the aquarium with GE silicone. I tried first with the foam because it seemed to adhere so well, but found out quickly that it doesn't adhere well after about 12 hours underwater. So make sure you adhere it with the GE silicone to the UGF, the foam will stick well to the UGF as it will have seeped through the holes in the UGF. Let this dry for a VERY long time, as silicone doesn't dry very quickly against the glass. Finally I used some more spray foam that I had worked well into a sticky paste to stick the plastic plants down to the front side of the UGF. When you do this, the foam will expand a little bit, so make sure you put weight on the plants, or the foam will lift them up... but by putting weight down on them, the foam will expand through the cracks in the UGF to hold the plants very securely. Finally I added the gravel back on top, and here is the dry picture.

Here's a picture of the tube routing for the HOB filter, which supplies all of the UGF suction...

Finally, here's the complete picture with fish. This project is fairly easy for beginners, as long as you follow the EXACT directions on glueing it down. Believe me, there's nothing more frustrating than having it glued down and ready to go, then waking up the next morning to find the whole thing floated to the surface overnight.

This spray foam is great for making lava rock, as it just naturally looks like that. However, for granite or other rock backgrounds, I would recommend using styrofoam, as cutting the sprayfoam will look anything but natural.