Below: top and bottom shelves have pin connectors, middle shelf does not. If I got the alignment close enough, I did not use the pins. They pass the 3 foot rule (everyone is looking at the trains anyway). The pins are a PITA to insert. I opened them with a screwdriver and hammer first. I used the pins on the center rail only. They are all hidden by the trains.
I didn't like the look of the plastic end caps, so I made sides from 1x3s and drilled and attached them with connector pins. I lightly tapped the wood side against the pins with a hammer to mark where to drill.
I used a Kreig jig to make pocket holes and mounted them to the wall with anchors.
Shelf spacing is 5 3/8". This allowed for 1/2" to 3/4" clearance for pantographs (down position) and hi-level or dome passenger cars, 1" to 1 1/4" for scale steam, and 1 1/4" for diesels.
Each shelf is two 6-foot sections
The bottom shelf is within toddler reach, so it gets emptied when the grandchildren visit. 😬
Of course there are always more trains than shelves. I guess I'll add a couple more when the grandchildren are older.
Bob