I attempted making a 3D background a while back. Polystyrene is your best option. My first attempt I tried it with a different, cheaper alternative. It worked alright but when it came to painting the paint dissolved it, so I recommend just going for the actual product.
Once you get your polystyrene cut out (By the way if you want it cheap go to a hardware store - or a Walmart or some other bigger store and ask if they have any extra in the back. I work at a Canadian Tire and so I got all the Polystyrene I used in my second attempt for free.) Anyways once you have all your pieces cut out you can glue them together, I used an aquarium specific glue, in Canada at least there is one available which I found and used. Then I used Great Stuff (Which is an expanding crack and gap sealant) it expands to about 5X it's sprayed volume to get into all the areas where holes were present. It can be cut down to give more shape (I found sanding it worked better, but was far more messy)
I also noted that many sites said to use cement to cover the entire product to give it a rock like appearance. I found this is the part that discouraged me the most from actually finishing my attempt, I couldn't get the mixture right between the aggregate and water, (I also found that it was rough and I didn't really trust to put it in my tank because I thought my fish would scratch themselves on parts of it)
On one site I read that the person choose to just paint their background without using cement and they used Krylon brand paint, and I liked this idea more.
(I still have my last attempt, I got as far as adding the Great Stuff and then stopped because after this point I always had troubles)
All the ingredients I used were:
-Polystyrene
-Cement Mix (Optional)
-Gap Sealant (Optional, helps give shape)
-Silicone Adhesive (If you want to glue it to the back of the tank
-Paint
-Sand Paper (Optional to use to sand down the gap sealant to get a good shape)
-Various Brushes to use with the paint
-Toothpicks (Help hold the cut Polystyrene together while the glue dries
I'm trying to remember the rest, I'm at school but on my Desktop I happen to have made a document on my attempts which include a list of ingredients....