How to use PCA to reconstruct 3D Mesh？
Given a matrix $D \in \mathbb{R}^{3N\times k}$ where each column is normalized $D_i$, You can get $W = D^TS_i$, and later it can be used to reconstruct the shape with $S_i = DW$ (With some error if you truncated some basis). The acquisition of weights is equivalent to calculating dot products between each PCA basis and $S_i$. What is done here is you project $S_i$ onto each orthogonal basis $D_i$, and calculate the length of the projected vector, so you are basically calculating the required contribution of each basis to construct the given $S_i$.

If you are using unnormalized PCA basis, you can decompose the unnormalized PCA basis matrix into a diagonal matrix an an orthonormal matrix (Say, $\Lambda D$), then use a similar approach to obtain the contribution of each basis. In this case, you'll have to use $\Lambda^{-1}D^T$ instead of $D^T$.