How to prevent warping of softwood shelves?
The problem:
Welcome to the joys of working with a natural product!
Wood will move year in, year out. Some woods are more stable than others, but they all have cells in them that were designed to move and hold water when the tree was alive. Now that the tree is dead, they're still there, they're just not actively working, but they still work just great passively. The first couple of paragraphs of my answer here go into some detail about it.
The thickness of the board will have some impact on the amount of cupping you'll see, but you'll need to go significantly beyond 20mm (~3/4&quot;) before you'll notice a difference. Head back to the builder's merchant and look at a board like a 2x8&quot; (~50x200mm) - you'll see that even along the 200mm dimension the boards will curve (put the board on the 50mm edge, with the 200mm dimension vertical, then sight along the board, you're likely to find some that curve up or down - this is called &quot;crown&quot; and it's necessary to put the crown up when using this lumber in a floor or ceiling).
All lumber will dry out with age (roughly 1 year per inch/25mm to air dry when properly spaced). Kiln dried wood has been heated to speed up this process. It costs money to run the kiln, but it saves time - you pay extra for the process - but otherwise, it behaves essentially the same as air dried wood.
The Fix:
If you want to minimize the chances of your boards cupping, you need to purchase quarter sawn lumber. This will be significantly more expensive than the plainsawn lumber you show in your picture, and it will not guarantee that it won't cup on you, but it will significantly reduce the chances of cupping.
You can tell a quartersawn board by looking at the grain. The face grain will be very consistent along the length of the boards like this oak is:
Source: wiseGeek.com. No affiliation, just the first pic I found
You can also look a the end grain. Where the boards in your picture show the growth rings curving through the end, in a quartersawn board, they will run vertically (or near vertically) from one face to the other, like this:
Source: Bell Forest Products No affiliation, just the first end grain pic I found
It is possible to rummage through the piles of lumber at your local home center to find the boards that were plainsawn from the center of the log and exhibit these grain features. They will exhibit the same stability and resistance to cupping and expansion that quarter sawing will yield for the price of painsawn wood, but you're going to spend a lot of time looking for them.
You indicated that you clamped some pieces together and that the cupped one uncupped, at least a bit. Congrats! Give it 48 hours or so and it will, most likely, return to its curved shape.
A more permanent fix is to cut a series of grooves along the inside of the cupping to relieve the stresses. Unfortunately, this also weakens the board and it won't support as much weight when working as a shelf.
Painting is probably your best, simple, way of minimizing the cupping. Paint will slow the absorption and release of water by the wood, but it won't stop it completely. The same applies to a couple of layers of polyurethane or any other covering finish (stain will soak into the wood, not sit on top - it's only there to dress up the wood, not protect it). The key to minimizing the warping via coatings is to cover all 6 sides. Paint the top and bottom and edges and ends. If you cover only the visible sides, you'll actually accelerate the warping as you'll reduce the water absorption on one side while leaving it at &quot;full rate&quot; on the other side. The uncoated side will absorb more water and expand faster.
The best solution, one that is probably serious overkill for your fairly narrow shelves, is to rip the boards into narrower strips, arrange the strips so that the growth rings (viewed from the end) alternate up and down, then glue them back together into the width of board you need. This is the technique used to make wide planks for things like table tops out of boards wider than the ones you show in your picture. It'll work for your shelves, but it is serious overkill. If you want to find out more about this methodology, visit the Woodworking stack and look at the tabletop or table-making tags. You can also look at the wood-movement tag to see other thoughts on the topic.
To reduce the warping in a practical manner, place the boards on the shelves with the growth rings &quot;down&quot;. That is, arcing from the bottom of the board, up in the middle, then back down. This will use the weight of whatever is on the shelves to help resist the wood's desire to curve upward, but won't prevent it. Unless you're clamping your books and nick-nacks down.