# Real-Time Interaction for 3D Pixel Human in Virtual Environment
## 3 Pixel-Style Avatar Generation Method
### Pixel Human Visualization
#### 3.3.3 Interactive Arm Generation
We then expand from the skeleton pixels to both sides and set the z-axis coordinates for the pixels based on the scaling parameter \(z_{scale}\) to realize a 3D arm. We define an adaptive parameter \(P_{w}\) for the expanded width of the arms and hands of users with different body sizes and distances from the webcam. First, we calculate a positively correlated arm width \(Width_{min}\) based on the 2D distance between the two shoulders in the video frame and set \(Width_{min}\) as a minimum threshold to prevent the 2D relative distance between the two shoulders from approaching zero when the person is sideways relative to the webcam. For the adaptive arm width \(Width_{arm}\), the width begins to increase from the threshold of the minimum arm width \(Width_{min}\) obtained previously and determines whether the alpha values of the pixel at the arm width position on both sides of the center pixel are zero. The alpha values of the pixels on the left and right sides of the skeleton are identified as \(a_{left}\) and \(a_{right}\), respectively. If either of them is not zero, then we continue to increase the arm width \(Width_{arm}\) based on the parameter \(P_{w}\), which has a value of one pixel, until both the values of \(a_{left}\) and \(a_{right}\) are zero. We specify that the arm width \(Width_{arm}\) that achieves this condition is the width of the arm corresponding to the originating pixel on the skeleton:  
\[Width_{arm}=Width_{min}+P_{w},\;\;Width_{arm}<Width_{max} \tag{4}\] \[P_{w}=P_{w}+1,\;\;\;if\;\alpha_{left}>0\;\;or\;\;\alpha_{right}>0\]  
Simultaneously, we set an upper limit \(Width_{max}\) for the width of the arm to prevent the arm width from becoming too large, such as when the arm is in front of the body. By using this adaptive arm width method, we can obtain different widths for each position along the arm in real time according to the shape of the arm so that the thickness of each part of the pixel avatar arm varies to mimic the shape of a real person. Because the 33 joints in a MediaPipe pose do not include the finger joints and only contain three joints on the palm, it is difficult to use the same method of start and end points used for the upper and lower arms to determine the range of the hands. For the hands, when generating a one-pixel-wide skeleton, we begin from the wrist joint and extend it in the direction of the index joint until reaching the first pixel with an alpha value of zero. We use the distance from the wrist joint to this pixel as the length of the hand. The hand is then extended adaptively to both sides of the skeleton pixel in the same manner as the arm to obtain the hand area to be converted into three dimensions. After the widths of arms and hands are determined, the extended particles are retracted to approximate the curvature of an ellipse, which is a circle stretched 1.5 times in the front-to-rear direction, resulting in a three-dimensional effect similar to an arm cylinder. To solve the particle discontinuity problem caused by elliptical curvature, we set the size of the extended particles to increase linearly, meaning the particles on both sides are larger. In Figure 7, the yellow center pixel represents the skeleton pixel. Additionally, the elbow region requires a natural transition to solve the connection issue when the upper and lower arms fold together. After converting the upper arm into three dimensions, we draw a point cloud in the shape of a quadrangular pyramid extending backward from the 3D position of the elbow joint point. We then convert the lower arm into 3D. We follow the order of the upper arm, elbow, lower arm, and hand when generating the avatar's 3D arm to prevent the loss of parts of the arm. After applying the basic framework of pixel avatar generation, we conduct an additional process to address the issue of missing 3D arm information. When some joints of the user's arms do not appear in the frame because of the webcam's field of view, the pose estimation of the joints outside the frame sometimes becomes inaccurate.