# Digital Design of Chinese Classic Literary Works Based on Virtual Reality Technology

Authors: Yanna Jiao
Journal: Mobile Information Systems
 (2022)

---

## Abstract

In order to improve the digital communication effect of Chinese classic literary works, this paper combines virtual reality technology to carry out the digital system design of Chinese classic literary works, improve the digital design effect of Chinese classic literary works, and develop an augmented reality interaction method based on the HoloLens platform. Moreover, this paper analyzes the lighting model in computer graphics and the rendering process of three-dimensional objects in combination with the digitization requirements of literary works and realizes the rendering of special effects by customizing the lighting model in the shader. The research shows that the digital design system of Chinese classic literary works based on virtual reality technology proposed in this paper has a good effect on the digital protection of Chinese classic literary works.


---

## Body

## 1. Introduction

By giving full play to the relevant role of digital technology in integrating resources, unified and comprehensive application processing of data reflected by various media such as text content, image content, audio content, and video content quoted in electronic equipment is carried out. This makes them build an organic whole and finally can provide users with a good platform to share and exchange information freely. Digital technology, as a modern application method for communicating and transmitting information, has been widely recognized by the majority of front-line teachers. Digital technology itself has the unique advantage of transmitting information and plays an important role in storing knowledge, exchanging knowledge, and disseminating knowledge. Moreover, only by making full use of digital technology and organically integrating it with humanistic knowledge, it is possible to present textual knowledge to readers in a clearer and more intuitive form. The relevant information involved in the use of digital technology is usually converted and output by means of media from different types of information sources. Sometimes, the obtained data information can also be used for postanalysis and processing of information, resource sharing, and other related work through the popular terminal equipment such as “Jingyeda,” so as to continuously improve the application processing ability of information. In the past, literary creation was often the expression of the author’s inner feelings, or the grand record of an era, and the elite position was often synonymous with literature. Moreover, even the once-popular migrant literature and low-level literature inevitably bear the imprint of an elite position. In today’s omni-media era, the communication channels have suddenly diversified. With the promotion and popularization of mobile phone reading, audiobooks, short videos, holographic projection, and other technologies, the communication methods have subtly affected the creative logic of literary creators. These changes in creative logic are manifested in many aspects such as creative perspective, creative method, creative content, creative theme, creative thinking, narrative logic, and communication methods. In addition, many grass-roots writers, civilian writers, and online writers who have followed the trend of online literature are using their unique methods and writing practices to subvert and change the creative logic in the field of literature. In the past, traditional literary creation was usually the creator’s personal or one-way behavior. However, in today’s omni-media era, readers have transformed from mere recipients of information to critics and even coauthors of literary works.Some online literature works will even refer to the wishes of most readers and change the plot and creative direction of their own works. This change in the role of readers is inseparable from the changes in the creation and dissemination of literature in the all-media era. In the digital virtual world, the “fragmented” creation method of daily serialization of literary works, the “fragmented” reading habits of a large number of readers, and the efficient, immediate, and convenient communication between creators and readers enable readers and authors to participate in literature together. The creation of works has become not only a possibility but also an inevitable trend. In the past, traditional literature was mainly circulated and disseminated through paper prints. In today’s all-media era, the efficiency of communication has been greatly improved, and the communication methods have become more diverse. A network cable, a mobile phone, a tablet computer, and a kindle can often transmit or store massive literary works in an instant. Pictures, even audio, video, and various immersive experiences are presented in front of readers, making people overwhelmed. These dazzling communication methods not only bring new audio-visual experience and spiritual enjoyment but also inevitably predict the arrival of the era of shallow reading.This paper combines virtual reality technology to carry out the digital system design of Chinese classic literary works, improve the digital design effect of Chinese classic literary works, and provide important support for the retention and teaching of subsequent Chinese classic literary works.


## 2. Related Work

Literature [1] proposed the use of histogram filtering, line templates, and isolated point templates for digitization. Although it cannot separate the literature signal well, it provides a pioneering idea for future generations to extract literature signals from paper reports. Literature [2] proposes the idea of thinning signal lines and low-pass filtering, which further lays a foundation for the development of digitization of literature characteristic signals. Reference [3] uses the background grid color grayscale and other information combined with thinning and smoothing and then passes through high-pass filtering and low-pass filtering to obtain signal lines. Literature [4] proposed the processing methods of optical waveform recognition, waveform segment connection, and filtering, which added a new method for the digitization of paper reports of literature characteristics. Literature [5] made further optimizations in grid detection, skew correction, etc., which greatly improved the accuracy of digitizing paper reports of literature features. Reference [6] designed a portable graphic format file and scanned the paper report of literary characteristics through a scanner to obtain a digital image of the report, which was then digitized. Literature [7] has made great contributions to the digitization of paper-based literature feature reports in the aspects of waveform detection, signal contour extraction, column-by-column pixel scanning, and optical character recognition. Reference [8] uses a scanner to obtain digital images from paper literature feature reports and uses the threshold method and morphological method to obtain digital literature feature signals from the image. The method achieves 95% accuracy and also proves that this method has strong robustness. Reference [9] proposes to perform threshold processing after scanning by a scanner to convert paper-based input data into digital format. Reference [10] uses Hough transform to digitally restore paper reports of literary features of binary images. Through digitizing experiments on paper reports of binary literature features, the results show that the method is able to automatically recover literature signals from noisy images. This opens up one more way to digitize paper signals. Reference [11] uses the difference between the background grid line color and the signal line color of the paper literature feature report and extracts the signal line by using the method of color filtering. Reference [12] proposed the use of morphological techniques to extract signals from paper reports of binary literature features, which reduced the average error to 7.5%. Reference [13] designed a MATLAB-based tool for digitizing literature feature paper reports, by using grayscale thresholds to detect literature feature graphs, using column pixels to scan signal lines, then digitizing literature feature signals according to their contours, and finally using a template-based steps, such as optical character recognition extracting patient demographic information from paper literature feature reports yielded a digital signal of literary features. Reference [14] designed a method based on color segmentation to process literature feature paper reports through a set of effective iterative digital image processing techniques, converting the data in literature feature paper reports into time-series digital signals. Reference [15] performs image enhancement and digitization on degraded literature feature images to extract continuous literature feature signals and proposes an entropy-based bit-plane slicing (EBPS) algorithm, which uses color rendering detection and local bit-plane slicing for preprocessing. Processing then adaptive bit-plane selection based on maximum entropy is applied to the preprocessed image, followed by discontinuous literary feature correction (D literary feature C) to produce a continuous literary feature signal.Reference [16] proposed three ways to identify background grids: precise mode, range mode, and manual mode. For background grid elimination, literature [17] proposed to eliminate grid lines by setting the distance threshold between two query points. Reference [18] utilizes morphological operations to remove background grids from literature features. Reference [19] established a snake model for curve tracking, which is aimed at minimizing the curve energy function for curve extraction. Reference [20] proposed the use of the threshold method for curve generation. Reference [21] proposed space-oriented and frequency-oriented methods for curve extraction. Detection of background grids includes the precise mode, manual mode, and range mode. The premise of the realization of the three modes is to accurately identify the position of the grid lines, but the background grid lines of literary work papers may have problems such as uneven color or broken lines, which will have a certain impact on the accurate identification of the grid lines.


## 3. Digital Augmentation Technology Based on Virtual Reality

Rendering of 3D models in computers is an imitation of images of objects in the real world. The color of an object seen by the human eye depends on the light source illuminating the surface of the object and the absorption and scattering properties of the object itself. The scattering to the inside of the object is called refraction, the scattering to the outside of the object is called reflection, and the reflection is divided into specular reflection and diffuse reflection.Commonly used in computer graphics is the standard illumination model, which divides the observed surface color of the object into four parts: emissive lightCemissive, ambient light Cambient, diffuse reflection Cdiffuse, and specular reflection Cspecular, as shown in
(1)C=Cemissive+Cambient+Cdiffuse+Cspecular.


### 3.1. Emissive Light

Emissive lightCemissive indicates the color of the light emitted by the object itself, which is related to the material of the object itself. For example, the light emitted by fluorescent tubes is considered white. In the Unity3D development software, for the object as a light source, it is necessary to set the light source type (such as parallel light, point light source, and spot light), illumination angle, light intensity, light source color, and other attributes according to its characteristics.


### 3.2. Ambient Light

The surface of the object is illuminated not only by the light source of the emissive light but also by the light reflected from the surface of other objects. Theoretically, all the light reflected from the surface of the object will affect each other, but due to the limitation of computing performance, it is difficult to calculate all the reflected light in real time, so set the ambient lightCambient to directly simulate the color of this part of the light to simplify the calculation. The Unity3D program estimates the ambient light based on the scene. In the shader code, the ambient light color is obtained through UNITY_LIGHTMODEL_AMBIENT.


### 3.3. Diffuse Reflection

Diffuse reflectionCdiffuse represents the color of the light emitted from the light source and diffusely reflected from the surface of the object. Since the diffuse reflection of light is randomly scattered in all directions, it can be considered that the light intensity distribution in any reflection direction is uniform, so the intensity of diffuse reflection has nothing to do with the viewing angle of observation but is related to the angle of incident light. Diffuse reflection obeys Lambert’s law, as shown in formula (2), and the intensity of the reflected light is proportional to the cosine of the angle between the surface normal and the direction of the light source:
(2)Cdiffuse=Clight⋅mdiffuse⋅max0,n⋅I.Among them,Clight is the color of the light source, mdiffuse is the color of the diffuse reflection of the material, n is the surface normal vector, and I is the unit vector pointing in the direction of the light source. When the angle between the surface normal n and the direction I pointing to the light source is greater than 90 degrees, the light cannot irradiate the surface, so the diffuse reflection Cdiffuse should be 0:
(3)Cdiffuse=Clight⋅mdiffuse⋅Saturateα⋅n⋅I+β.The saturate function means to truncate the value to the range0,1. By setting the α and β values, n·I is linearly mapped to the new interval, so as to adjust the light and shade of the diffuse reflection, so that the surface facing away from the light source can also be clearly displayed. Figure 1 is a comparison diagram of the effects of the two diffuse reflection models.Figure 1
Comparison of diffuse reflection effects.
(a)
Surface texture(b)
Lambert model(c)
Semi-Lambert model


### 3.4. Specular Reflection

The calculation of the specular reflectionCspecular is based on an empirical model, which is not completely consistent with the real specular reflection phenomenon. Specular reflections are specular reflections used to represent smooth surfaces such as metals and glass, making objects appear shiny. In the real world, highlights are seen when the viewer is near the path of the reflected light. There are two ways to calculate the specular reflection, as shown in Figure 2.Figure 2
Two models for calculating specular reflections.The process of using the Phong model to calculate the specular reflection is shown in(4)Cspecular=Clight⋅mspecular⋅max0,v⋅rmglass,r=2n⋅I⋅n−I.Among them,mspecular is the color of the material’s specular reflection, v is the direction of light incident from the surface of the object to the observer’s eye, r is the direction of the reflected light, n is the surface normal vector, and I is the unit vector pointing in the direction of the light source. mglass is the glossiness of the material, also known as shininess, which is used to indicate the size and brightness of the highlight area. The larger the mglass, the smaller the highlight area and the lower the brightness.The specular reflection is calculated using the Blinn-Phong model, as shown in formula (5) and formula (6).
(5)Cspecular=Clight⋅mspecular⋅max0,n⋅hmglass,(6)h=v+Iv+I.Among them,h represents the angle bisector of the surface point pointing to the observation point and the direction of the light source. In the actual calculation, when the observer and the light source are far enough away from the surface of the object, h can be considered a fixed value, so the calculation speed of the Blinn-Phong model will be faster. The transition of the highlight region in the Blinn-Phong model is smoother and larger than that in the Phong model, as shown in Figure 3.Figure 3
Comparison of highlight reflection effects.
(a)
Object surface texture(b)
Phong model(c)
Blinn-Phong modelIn Unity3D, the program obtains the shape, color, and other information of the three-dimensional object from the model file. After arranging the light source in the scene and setting the material of each object, all display-related information is submitted to the graphics card. After the rendering pipeline of the graphics card, the object image is output to the screen. Shaders are the most important part of the rendering pipeline, and the lighting model is implemented in shaders.


#### 3.4.1. 3D Horizontal File Format

Models in Unity3D are stored and called in OBJ model format. The 3D model is precisely defined, and the edges and faces are represented by mathematical expressions. The OBJ format model is a discretized representation of the exact model, and a large number of triangular patches are used to construct the surface of the model.The OBJ model first defines the vertices of all triangular patches, represented by the coordinates of each vertex in model space. Then, it records the texture uv coordinates corresponding to each vertex, the vertex normal direction in the model space, and then records the vertex numbers of the triangular patches in counterclockwise order.


#### 3.4.2. Rendering Pipeline

The rendering process of the model is done by the GPU in the graphics card. After the model, texture map and lighting model to be rendered are set by the program; the GPU will render the 3D object model within the camera’s line of sight.Figure4 shows the process of rendering a 3D model image on the GPU. The program provides the model’s vertices, textures, and other information to the GPU rendering pipeline, transforms the model’s vertex coordinates from the model space coordinate system to the world coordinate system, calculates the lighting model, and then transforms it to the screen space coordinate system. According to the visible range of the camera, the model is clipped, and the vertex information of the model outside the visible range is discarded, as shown in Figure 5.Figure 4
GPU rendering pipeline.Figure 5
Screen space clipping.Then, the triangular patches in the visible range are rasterized into fragments, and the attribute values (such as depth and color) of each fragment are calculated by interpolation, as shown in Figure6. Then, it calculates each fragment and outputs the color value of each pixel on the screen.Figure 6
Triangle rasterization, interpolation calculation of fragment attribute values.The tessellation shader and geometry shader can be controlled by commands, while the vertex shader and fragment shader can be completely customized by the program.


#### 3.4.3. Shader Writing

The rendering of the model needs to specify the material for the model. The essence of the material is the realization of the lighting model, which is defined in the shader. If no shader is written to implement the material effect, Unity3D will provide a default material. At the same time, various special effects require custom lighting models in shaders.(1) Highlight Flickering Effect. The highlight flickering effect can highlight virtual objects to attract the user’s attention. The special effect is realized by superimposing fluorescence at the edge of the object, and the surface of the object with an angle between the normal and the line of sight close to 90 degrees is regarded as the edge of the object, as shown in Figure 7.Figure 7
Judging the edge by the angle between the line of sight and the surface normal of the object.It modifies the specular part in the standard lighting model, and its calculation process is shown in formula (7). The closer to the edge, the brighter the highlight. Among them, r is the time parameter, and it increases as the program runs, and sint makes the highlights light and dark:
(7)Cspecular=mspecular⋅1−max0,v⋅nmglasssint.(2) Growth Display Special Effects. In an augmented reality scene, virtual objects appearing out of thin air can feel awkward to the user, and implementing transition animations in shaders can make it natural.In the fragment shader, the rendering of the fragment can be controlled by the clip(x) method. When x<0, the fragment will not be displayed. The object appearance rate is k, and the height of a fragment on the surface of the object is h, and t is the time parameter, then clip (k,t‐h) means that the object gradually appears over time.For better visual effects, add two highlights to the transition animation. The first beam of highlight is displayed at the fault of the object, representing the appearance process of the object. The calculation process is formula (8): the second beam of highlight scans the surface of the object from bottom to top after the object completely appears, and the calculation process is formula (9). K1andk2 are the appearance rates of the two highlights, respectively, b2 is the time offset of the second highlight, and H1andH2 are the width of the highlight:
(8)Cspecular1=mspecular⋅max0,H1−k1t−hH1,(9)Cspecular2=mspecular⋅max0,H2−k2t−t2−hH2.This paper uses the augmented reality device HoloLens as the research platform. The operation method in the augmented reality scene is different from the traditional handle, keyboard, and other operation methods. HoloLens supports simple gesture recognition, English speech recognition, and other user-friendly interactive development interfaces. Based on the HoloLens platform, this section develops gaze target detection and gesture recognition modules to obtain user intent and achieve a more natural and friendly human-computer interaction.The gaze target detection function is used to obtain the virtual object the user is looking at and determine the holographic object to be operated. It is difficult to directly detect the movement of the eyeball to obtain the user’s attention point of sight. When people look at an object, they first adjust the direction of their head and then turn their eyeballs. Therefore, in most cases, the angle between the line of sight of the person and the front of the head is within a small angle range, and the front of the head can be used as the line of sight of the person. As shown in Figure8, when the user wears the HoloLens, the posture angle of the HoloLens is detected, and the front of it is used as the user’s line of sight. The rays are emitted in this direction, and the ray collision detection with the virtual object in front is performed to obtain the object the user is paying attention to.Figure 8
The principle of line-of-sight detection.When obtaining the pose of the HoloLens, the shaking of the user’s head will cause errors in the calculation process of the gaze object. Therefore, it is necessary to filter the pose data of the HoloLens in real time. The process is shown in(10)Posn=PosRealn⋅αn+Posn−l⋅1−αn,αn=α0⋅αk,nPosRealα0⋅αk,nPosReal+l,αk,nPosReal=K⋅∑i=n−K+lnPosReali2−∑i=n−K+lnPosReali2K.Posn represents the position data obtained by filtering the nth frame, PosRealn represents the position data obtained by direct measurement of the nth frame, and the smoothed data is obtained through interpolation processing. αn is used to control the degree of smoothness, determined by α0 and αk,nPosReal. α0 is a smoothing factor. When α0 is relatively large, the calculation result is close to the original measurement data. αk,nPosReal is the mean square error of the previous K frames at the nth frame. When the value is large, the user’s head is moving, and the calculation result is close to the original measurement data. When its value is small, the user is staring at an object, and the calculation result stabilizes near the previous frame of data. Similarly, the head pose data is filtered to make the final calculated ray collision object more in line with the user’s intention.


## 3.1. Emissive Light

Emissive lightCemissive indicates the color of the light emitted by the object itself, which is related to the material of the object itself. For example, the light emitted by fluorescent tubes is considered white. In the Unity3D development software, for the object as a light source, it is necessary to set the light source type (such as parallel light, point light source, and spot light), illumination angle, light intensity, light source color, and other attributes according to its characteristics.


## 3.2. Ambient Light

The surface of the object is illuminated not only by the light source of the emissive light but also by the light reflected from the surface of other objects. Theoretically, all the light reflected from the surface of the object will affect each other, but due to the limitation of computing performance, it is difficult to calculate all the reflected light in real time, so set the ambient lightCambient to directly simulate the color of this part of the light to simplify the calculation. The Unity3D program estimates the ambient light based on the scene. In the shader code, the ambient light color is obtained through UNITY_LIGHTMODEL_AMBIENT.


## 3.3. Diffuse Reflection

Diffuse reflectionCdiffuse represents the color of the light emitted from the light source and diffusely reflected from the surface of the object. Since the diffuse reflection of light is randomly scattered in all directions, it can be considered that the light intensity distribution in any reflection direction is uniform, so the intensity of diffuse reflection has nothing to do with the viewing angle of observation but is related to the angle of incident light. Diffuse reflection obeys Lambert’s law, as shown in formula (2), and the intensity of the reflected light is proportional to the cosine of the angle between the surface normal and the direction of the light source:
(2)Cdiffuse=Clight⋅mdiffuse⋅max0,n⋅I.Among them,Clight is the color of the light source, mdiffuse is the color of the diffuse reflection of the material, n is the surface normal vector, and I is the unit vector pointing in the direction of the light source. When the angle between the surface normal n and the direction I pointing to the light source is greater than 90 degrees, the light cannot irradiate the surface, so the diffuse reflection Cdiffuse should be 0:
(3)Cdiffuse=Clight⋅mdiffuse⋅Saturateα⋅n⋅I+β.The saturate function means to truncate the value to the range0,1. By setting the α and β values, n·I is linearly mapped to the new interval, so as to adjust the light and shade of the diffuse reflection, so that the surface facing away from the light source can also be clearly displayed. Figure 1 is a comparison diagram of the effects of the two diffuse reflection models.Figure 1
Comparison of diffuse reflection effects.
(a)
Surface texture(b)
Lambert model(c)
Semi-Lambert model


## 3.4. Specular Reflection

The calculation of the specular reflectionCspecular is based on an empirical model, which is not completely consistent with the real specular reflection phenomenon. Specular reflections are specular reflections used to represent smooth surfaces such as metals and glass, making objects appear shiny. In the real world, highlights are seen when the viewer is near the path of the reflected light. There are two ways to calculate the specular reflection, as shown in Figure 2.Figure 2
Two models for calculating specular reflections.The process of using the Phong model to calculate the specular reflection is shown in(4)Cspecular=Clight⋅mspecular⋅max0,v⋅rmglass,r=2n⋅I⋅n−I.Among them,mspecular is the color of the material’s specular reflection, v is the direction of light incident from the surface of the object to the observer’s eye, r is the direction of the reflected light, n is the surface normal vector, and I is the unit vector pointing in the direction of the light source. mglass is the glossiness of the material, also known as shininess, which is used to indicate the size and brightness of the highlight area. The larger the mglass, the smaller the highlight area and the lower the brightness.The specular reflection is calculated using the Blinn-Phong model, as shown in formula (5) and formula (6).
(5)Cspecular=Clight⋅mspecular⋅max0,n⋅hmglass,(6)h=v+Iv+I.Among them,h represents the angle bisector of the surface point pointing to the observation point and the direction of the light source. In the actual calculation, when the observer and the light source are far enough away from the surface of the object, h can be considered a fixed value, so the calculation speed of the Blinn-Phong model will be faster. The transition of the highlight region in the Blinn-Phong model is smoother and larger than that in the Phong model, as shown in Figure 3.Figure 3
Comparison of highlight reflection effects.
(a)
Object surface texture(b)
Phong model(c)
Blinn-Phong modelIn Unity3D, the program obtains the shape, color, and other information of the three-dimensional object from the model file. After arranging the light source in the scene and setting the material of each object, all display-related information is submitted to the graphics card. After the rendering pipeline of the graphics card, the object image is output to the screen. Shaders are the most important part of the rendering pipeline, and the lighting model is implemented in shaders.


### 3.4.1. 3D Horizontal File Format

Models in Unity3D are stored and called in OBJ model format. The 3D model is precisely defined, and the edges and faces are represented by mathematical expressions. The OBJ format model is a discretized representation of the exact model, and a large number of triangular patches are used to construct the surface of the model.The OBJ model first defines the vertices of all triangular patches, represented by the coordinates of each vertex in model space. Then, it records the texture uv coordinates corresponding to each vertex, the vertex normal direction in the model space, and then records the vertex numbers of the triangular patches in counterclockwise order.


### 3.4.2. Rendering Pipeline

The rendering process of the model is done by the GPU in the graphics card. After the model, texture map and lighting model to be rendered are set by the program; the GPU will render the 3D object model within the camera’s line of sight.Figure4 shows the process of rendering a 3D model image on the GPU. The program provides the model’s vertices, textures, and other information to the GPU rendering pipeline, transforms the model’s vertex coordinates from the model space coordinate system to the world coordinate system, calculates the lighting model, and then transforms it to the screen space coordinate system. According to the visible range of the camera, the model is clipped, and the vertex information of the model outside the visible range is discarded, as shown in Figure 5.Figure 4
GPU rendering pipeline.Figure 5
Screen space clipping.Then, the triangular patches in the visible range are rasterized into fragments, and the attribute values (such as depth and color) of each fragment are calculated by interpolation, as shown in Figure6. Then, it calculates each fragment and outputs the color value of each pixel on the screen.Figure 6
Triangle rasterization, interpolation calculation of fragment attribute values.The tessellation shader and geometry shader can be controlled by commands, while the vertex shader and fragment shader can be completely customized by the program.


### 3.4.3. Shader Writing

The rendering of the model needs to specify the material for the model. The essence of the material is the realization of the lighting model, which is defined in the shader. If no shader is written to implement the material effect, Unity3D will provide a default material. At the same time, various special effects require custom lighting models in shaders.(1) Highlight Flickering Effect. The highlight flickering effect can highlight virtual objects to attract the user’s attention. The special effect is realized by superimposing fluorescence at the edge of the object, and the surface of the object with an angle between the normal and the line of sight close to 90 degrees is regarded as the edge of the object, as shown in Figure 7.Figure 7
Judging the edge by the angle between the line of sight and the surface normal of the object.It modifies the specular part in the standard lighting model, and its calculation process is shown in formula (7). The closer to the edge, the brighter the highlight. Among them, r is the time parameter, and it increases as the program runs, and sint makes the highlights light and dark:
(7)Cspecular=mspecular⋅1−max0,v⋅nmglasssint.(2) Growth Display Special Effects. In an augmented reality scene, virtual objects appearing out of thin air can feel awkward to the user, and implementing transition animations in shaders can make it natural.In the fragment shader, the rendering of the fragment can be controlled by the clip(x) method. When x<0, the fragment will not be displayed. The object appearance rate is k, and the height of a fragment on the surface of the object is h, and t is the time parameter, then clip (k,t‐h) means that the object gradually appears over time.For better visual effects, add two highlights to the transition animation. The first beam of highlight is displayed at the fault of the object, representing the appearance process of the object. The calculation process is formula (8): the second beam of highlight scans the surface of the object from bottom to top after the object completely appears, and the calculation process is formula (9). K1andk2 are the appearance rates of the two highlights, respectively, b2 is the time offset of the second highlight, and H1andH2 are the width of the highlight:
(8)Cspecular1=mspecular⋅max0,H1−k1t−hH1,(9)Cspecular2=mspecular⋅max0,H2−k2t−t2−hH2.This paper uses the augmented reality device HoloLens as the research platform. The operation method in the augmented reality scene is different from the traditional handle, keyboard, and other operation methods. HoloLens supports simple gesture recognition, English speech recognition, and other user-friendly interactive development interfaces. Based on the HoloLens platform, this section develops gaze target detection and gesture recognition modules to obtain user intent and achieve a more natural and friendly human-computer interaction.The gaze target detection function is used to obtain the virtual object the user is looking at and determine the holographic object to be operated. It is difficult to directly detect the movement of the eyeball to obtain the user’s attention point of sight. When people look at an object, they first adjust the direction of their head and then turn their eyeballs. Therefore, in most cases, the angle between the line of sight of the person and the front of the head is within a small angle range, and the front of the head can be used as the line of sight of the person. As shown in Figure8, when the user wears the HoloLens, the posture angle of the HoloLens is detected, and the front of it is used as the user’s line of sight. The rays are emitted in this direction, and the ray collision detection with the virtual object in front is performed to obtain the object the user is paying attention to.Figure 8
The principle of line-of-sight detection.When obtaining the pose of the HoloLens, the shaking of the user’s head will cause errors in the calculation process of the gaze object. Therefore, it is necessary to filter the pose data of the HoloLens in real time. The process is shown in(10)Posn=PosRealn⋅αn+Posn−l⋅1−αn,αn=α0⋅αk,nPosRealα0⋅αk,nPosReal+l,αk,nPosReal=K⋅∑i=n−K+lnPosReali2−∑i=n−K+lnPosReali2K.Posn represents the position data obtained by filtering the nth frame, PosRealn represents the position data obtained by direct measurement of the nth frame, and the smoothed data is obtained through interpolation processing. αn is used to control the degree of smoothness, determined by α0 and αk,nPosReal. α0 is a smoothing factor. When α0 is relatively large, the calculation result is close to the original measurement data. αk,nPosReal is the mean square error of the previous K frames at the nth frame. When the value is large, the user’s head is moving, and the calculation result is close to the original measurement data. When its value is small, the user is staring at an object, and the calculation result stabilizes near the previous frame of data. Similarly, the head pose data is filtered to make the final calculated ray collision object more in line with the user’s intention.


## 3.4.1. 3D Horizontal File Format

Models in Unity3D are stored and called in OBJ model format. The 3D model is precisely defined, and the edges and faces are represented by mathematical expressions. The OBJ format model is a discretized representation of the exact model, and a large number of triangular patches are used to construct the surface of the model.The OBJ model first defines the vertices of all triangular patches, represented by the coordinates of each vertex in model space. Then, it records the texture uv coordinates corresponding to each vertex, the vertex normal direction in the model space, and then records the vertex numbers of the triangular patches in counterclockwise order.


## 3.4.2. Rendering Pipeline

The rendering process of the model is done by the GPU in the graphics card. After the model, texture map and lighting model to be rendered are set by the program; the GPU will render the 3D object model within the camera’s line of sight.Figure4 shows the process of rendering a 3D model image on the GPU. The program provides the model’s vertices, textures, and other information to the GPU rendering pipeline, transforms the model’s vertex coordinates from the model space coordinate system to the world coordinate system, calculates the lighting model, and then transforms it to the screen space coordinate system. According to the visible range of the camera, the model is clipped, and the vertex information of the model outside the visible range is discarded, as shown in Figure 5.Figure 4
GPU rendering pipeline.Figure 5
Screen space clipping.Then, the triangular patches in the visible range are rasterized into fragments, and the attribute values (such as depth and color) of each fragment are calculated by interpolation, as shown in Figure6. Then, it calculates each fragment and outputs the color value of each pixel on the screen.Figure 6
Triangle rasterization, interpolation calculation of fragment attribute values.The tessellation shader and geometry shader can be controlled by commands, while the vertex shader and fragment shader can be completely customized by the program.


## 3.4.3. Shader Writing

The rendering of the model needs to specify the material for the model. The essence of the material is the realization of the lighting model, which is defined in the shader. If no shader is written to implement the material effect, Unity3D will provide a default material. At the same time, various special effects require custom lighting models in shaders.(1) Highlight Flickering Effect. The highlight flickering effect can highlight virtual objects to attract the user’s attention. The special effect is realized by superimposing fluorescence at the edge of the object, and the surface of the object with an angle between the normal and the line of sight close to 90 degrees is regarded as the edge of the object, as shown in Figure 7.Figure 7
Judging the edge by the angle between the line of sight and the surface normal of the object.It modifies the specular part in the standard lighting model, and its calculation process is shown in formula (7). The closer to the edge, the brighter the highlight. Among them, r is the time parameter, and it increases as the program runs, and sint makes the highlights light and dark:
(7)Cspecular=mspecular⋅1−max0,v⋅nmglasssint.(2) Growth Display Special Effects. In an augmented reality scene, virtual objects appearing out of thin air can feel awkward to the user, and implementing transition animations in shaders can make it natural.In the fragment shader, the rendering of the fragment can be controlled by the clip(x) method. When x<0, the fragment will not be displayed. The object appearance rate is k, and the height of a fragment on the surface of the object is h, and t is the time parameter, then clip (k,t‐h) means that the object gradually appears over time.For better visual effects, add two highlights to the transition animation. The first beam of highlight is displayed at the fault of the object, representing the appearance process of the object. The calculation process is formula (8): the second beam of highlight scans the surface of the object from bottom to top after the object completely appears, and the calculation process is formula (9). K1andk2 are the appearance rates of the two highlights, respectively, b2 is the time offset of the second highlight, and H1andH2 are the width of the highlight:
(8)Cspecular1=mspecular⋅max0,H1−k1t−hH1,(9)Cspecular2=mspecular⋅max0,H2−k2t−t2−hH2.This paper uses the augmented reality device HoloLens as the research platform. The operation method in the augmented reality scene is different from the traditional handle, keyboard, and other operation methods. HoloLens supports simple gesture recognition, English speech recognition, and other user-friendly interactive development interfaces. Based on the HoloLens platform, this section develops gaze target detection and gesture recognition modules to obtain user intent and achieve a more natural and friendly human-computer interaction.The gaze target detection function is used to obtain the virtual object the user is looking at and determine the holographic object to be operated. It is difficult to directly detect the movement of the eyeball to obtain the user’s attention point of sight. When people look at an object, they first adjust the direction of their head and then turn their eyeballs. Therefore, in most cases, the angle between the line of sight of the person and the front of the head is within a small angle range, and the front of the head can be used as the line of sight of the person. As shown in Figure8, when the user wears the HoloLens, the posture angle of the HoloLens is detected, and the front of it is used as the user’s line of sight. The rays are emitted in this direction, and the ray collision detection with the virtual object in front is performed to obtain the object the user is paying attention to.Figure 8
The principle of line-of-sight detection.When obtaining the pose of the HoloLens, the shaking of the user’s head will cause errors in the calculation process of the gaze object. Therefore, it is necessary to filter the pose data of the HoloLens in real time. The process is shown in(10)Posn=PosRealn⋅αn+Posn−l⋅1−αn,αn=α0⋅αk,nPosRealα0⋅αk,nPosReal+l,αk,nPosReal=K⋅∑i=n−K+lnPosReali2−∑i=n−K+lnPosReali2K.Posn represents the position data obtained by filtering the nth frame, PosRealn represents the position data obtained by direct measurement of the nth frame, and the smoothed data is obtained through interpolation processing. αn is used to control the degree of smoothness, determined by α0 and αk,nPosReal. α0 is a smoothing factor. When α0 is relatively large, the calculation result is close to the original measurement data. αk,nPosReal is the mean square error of the previous K frames at the nth frame. When the value is large, the user’s head is moving, and the calculation result is close to the original measurement data. When its value is small, the user is staring at an object, and the calculation result stabilizes near the previous frame of data. Similarly, the head pose data is filtered to make the final calculated ray collision object more in line with the user’s intention.


## 4. Digital Design of Chinese Classic Literary Works Based on Virtual Reality Technology

The digital processing module of Chinese classic literary works is the key to the whole system. The processing of Chinese classic literary works is the process of digitizing Chinese classic literary works, which will pave the way for the realization of other functions.The scanning module of Chinese classic literature works is a key step to transforming paper Chinese classic literature works into electronic Chinese classic literature works. After logging in, the staff enters the corresponding scanning clip number, and after verification by the workflow detection module, they enter the scanning module for Chinese classic literary works. First, the system detects whether the user installs the scanning service software. If the user does not have it installed, the user is prompted to install it. If the user has installed it, the browser will prompt the user to open the scanning service software. After the scanning service software is activated, the scanned electronic image obtained by scanning with the scanner is presented on the browser and stored in the server. During the scanning process, there are no strict requirements on the order of the page numbers of the scanned images, but the quality of the scanned images cannot be too poor to ensure that the characters can be easily recognized by the naked eye. Figure9 shows the flow chart of scanning Chinese classic literary works. The materials of Chinese classic literary works are scanned into virtual reality digital files by scanners and scanning software and stored on the server.Figure 9
The digitization process of Chinese classic literary works.On the basis of the above analysis, the effect of the digital design system of Chinese classic literary works based on virtual reality technology is verified, and the effect of the digitalization process of the literary works written in this paper is evaluated. The statistical results are shown in Table1 and Figure 10.Table 1
System assessment of digital design of Chinese classic literary works based on virtual reality technology.
NumberSystem assessmentNumberSystem assessmentNumberSystem assessment185.433088.945986.19292.313186.886089.47386.453292.746186.75487.073388.116286.99585.923493.056388.86686.053593.026492.30788.713685.536586.47889.413786.276686.30987.953889.696788.631085.283986.506884.941186.144091.106985.811287.834191.637089.791385.214293.447188.781493.344388.347289.471588.704492.777394.481688.184587.117492.571784.334687.797592.531894.664785.287686.301990.024888.627791.892085.944992.147894.512187.155086.797989.762288.065190.788084.362385.505285.298192.242488.015386.218293.112593.915492.878391.332684.365594.418485.872789.825693.488584.572893.955789.418685.532985.015886.218785.60Figure 10
Statistical chart of the system assessment of digital design of Chinese classic literary works based on virtual reality technology.It can be seen from the above research that the digital design system of Chinese classic literary works based on virtual reality technology proposed in this paper has a good effect on the digital protection of Chinese classic literary works.


## 5. Conclusion

In the new era, how to use ancient literary books to tell Chinese stories well, help the international dissemination of Chinese excellent traditional culture, and enhance my country’s comprehensive national strength and world influence is still an arduous task. At present, the digital development of ancient book resources in my country is facing huge challenges, and the digitization of most ancient books is still at the level of content transplantation, and content replacement has not really been realized, resulting in low efficiency of digital development and dissemination of ancient book resources. The “comprehensive image” of literary language image is not only a positive response strategy for literature to face the squeeze of the image world but also a new development opportunity for literature in the digital age. This paper combines virtual reality technology to design the digital system of Chinese classic literary works, so as to improve the digital design effect of Chinese classic literary works. The research results show that the digital design system of Chinese classic literary works based on virtual reality technology proposed in this paper has a good effect on the digital protection of Chinese classic literary works.



---

*Source: 5505724-2022-04-09.xml*