## 3 Three-Dimensional (3D) Shadow Modeling  
The proposed method implements the feature of crack shadows that are projected due to the height differences between cracks and pipeline surfaces. The identification of cracks is carried out through analysis of the shapes of the shadows. This method is developed under the following assumptions:  
1. The projected light source (in this work, the high intensity light torches) is infinite and projected light beams are parallel;
2. The diffusion, reflection and refraction of light are ignorable. According to these assumptions, both corrosion slops and corrosion cracks can generate shadow areas under the lighting of the projection light source, as shown in Figure 2. On the other hand, bidirectional light projection provides an effective way to capture shadows caused by corrosion cracks and prevents interference from corrosion slopes. Figure 3 shows the schematic plots of the induced shadow area under bidirectional projection. Since cracks consist of continuous partial grooves, we utilize bidirectional light projection to prepare the pipeline images for crack identification. Figure 2: Shadow under monodirectional projection. Under the bidirectional projection light, the size of the shadow area depends on the projection direction. Therefore, the projection angle (\(\theta\)) is an important parameter. When the angle is 90\({}^{\circ}\), the shadow areas will not be generated, but when the angle is 0\({}^{\circ}\), infinitely long shadow areas will be generated. By changing the angle of projection direction from 0\({}^{\circ}\) to 90\({}^{\circ}\), the 3D-SM can simulate a variety of shadow settings for the cracks on the pipeline's surface. Besides, if the selected projection angle satisfies the condition of generating the shadow areas of a small crack, it can also generate the shadow areas for other cracks. The main advantage of the 3D-SM simulation is that it can identify various cracks and even micro cracks by only adjusting a single variable for control (projection angle). Figure 4 presents the approach used to define the projection angle (\(\theta\)) using projection of two light beams. The optimal bidirectional projection direction should be perpendicular to the direction of the plane of the crack. However, actual cracks often have various directions, so the optimal bidirectional projection direction is not always the same. To reduce the calculation time, we use two representative pairs of bidirectional projection directions for the 3D-SM simulation, namely lateral projection (\(x\)-direction) and longitudinal projection (\(y\)-direction). The geometry settings of these two projections are shown in Figure 5. The lateral projection is used to identify the longitudinal cracks with the crack angle between approximately 45\({}^{\circ}\)and 90\({}^{\circ}\)and the longitudinal projection is used to identify the transverse cracks with the crack angle between approximately 0\({}^{\circ}\) and 45\({}^{\circ}\). Figure 3: Shadow under bidirectional projection. In the next step, the original 3D image will be converted into to a binary map to reflect the shadow pattern, where \"0\" indicates the shaded area, and \"1\" indicates the non-shaded area. A typical binary map is shown in Figure 6. Let S denote the light projection, P denote the 3D pixel of shadow formed upon a fall the light projection S and denote L denote the unit vector to indicate the direction of light The sample point along the light projection can be expressed as:  
\[S_{k}=P+\frac{k\cdot\Delta S}{\cos\theta}L, \tag{1}\]  
where \(S_{k}\) is the \(k\)th sample point along the light projection \(S\). The resolution of 3D pixel of shadow depends on the sampling interval \(\Delta S\) (\(mm\)). A smaller sampling interval provides a higher resolution but consumes more computational resources. In this paper, we choose \(\Delta S=0.5\) so that the resolution of 3D pixel of shadow is sufficient to consider all pixels in the light projection. Figure 4: Illustration of projection angle (\(\theta\)). Figure 5: \(Cont\).