Research on Digital Modeling and Optimization of Virtual Reality Scene

Publications

Share / Export Citation / Email / Print / Text size:

International Journal of Advanced Network, Monitoring and Controls

Xi'an Technological University

Subject: Computer Science, Software Engineering

GET ALERTS

eISSN: 2470-8038

DESCRIPTION

0
Reader(s)
0
Visit(s)
0
Comment(s)
0
Share(s)

SEARCH WITHIN CONTENT

FIND ARTICLE

Volume / Issue / page

Related articles

VOLUME 3 , ISSUE 4 (Oct 2018) > List of articles

Research on Digital Modeling and Optimization of Virtual Reality Scene

Wenjing Xu * / Pingping Liu * / Zhaopan Lu

Keywords : Opengl, Virtual Campus, Virtual Reality Technology, 3D Max, SQL Database

Citation Information : International Journal of Advanced Network, Monitoring and Controls. Volume 3, Issue 4, Pages 69-76, DOI: https://doi.org/10.21307/ijanmc-2019-023

License : (CC-BY-NC-ND 4.0)

Published Online: 14-October-2019

ARTICLE

ABSTRACT

The research about the modeling simulation and optimization in virtual campus roaming system is based on virtual reality technology, VC+ + platform and OpenGL and 3D Max modeling technology, which has achieved the roaming system of virtual campus with a good feeling of realism and real-time interactivity. Users can roam in 3D virtual campus scene, which achieves the interactive operation of campus reality and meets the requirements of digital education training.

Graphical ABSTRACT

I. INTRODUCTION

Virtual reality technology[1,2] can create an environment similar to the real society and enable people to interact with the virtual environment with multidimensional information. The campus roaming system on the basis of geography, virtual reality, multimedia, broadband and other technologies, combining the content of attributes and geospatial information, constructs a realistic virtual campus environment. Users can access the campus landscape through computer networks and use the terminal computer to expand roaming and corresponding search and query in the virtual campus environment. This paper creates a virtual campus roaming system with functions such as panorama display, fixed path roaming, interactive roaming, collision detection response, and roaming system interaction from the aspects of OpenGL basic graphics element creation, rendering, and perspective conversion. The Z buffer algorithm is used to optimize 3d scenes and improve the modeling efficiency.

II. INTRODUCTION OF VIRTUAL CAMPUS ROAMING SYSTEM AND RELATED TECHNOLOGIES

A. OpenGL technology

openGL(open Graphics Library) technology which is also known as graphic program interface technology is a set of three-dimensional graphics processing library, a cross-programming language and cross-platform programming interface. It is a powerful and convenient underlying graphics library. OpenGL is characterized by good quality, high performance, good stability, industrial standard, high reliability, flexibility, scalability, extensibility, and easy-to-use. It can be integrated into window system such as Unix, Windows. The function of OpenGL can be provided for interface in the form of C functions, which developers can use to easily render the entire 3D graphics. This system takes Visual C++ as the platform, uses OpenGL technology to establish 3d scene sand uses 3DS MAX to model the building model and realize virtual roaming[4].

B. Virtual reality

Virtual reality[5,6] combines the application of multiple aspects, with the characteristics of autonomy, interactivity and perceptivity. It is an advanced simulation technology, which can experience the virtual world after created. It mainly includes simulation environment, perception, natural skills and media equipment. The computer can simulate the environment and let the user be devoted to the corresponding process with special equipment, so that the interaction between the user and the environment can be realized.

C. Virtual reality technology based on OpenGL

Virtual reality technology based on OpenGL[7,8] realizes modeling with the theory of computer graphics. In this process, it aims to achieve campus virtual roaming and interaction. This subject mainly discusses the design and implementation of virtual campus roaming system based on VC++ development platform and OpenGL. The drawing of the sky is realized by the Background node technology of Skybox algorithm, and the terrain rendering is implemented by LOD algorithm. Finally, the virtual campus roaming system is realized. The system development process is shown in figure 1.

Figure 1.

System development process

10.21307_ijanmc-2019-023-f001.jpg

III. DESIGNOFROAMINGSYSTEM

The construction of the virtual scene can be divided into the following three steps. The first step is to establish a real virtual campus according to the distribution map and the specific plan of the buildings and environmental objects in the campus. In the second step, each individual entity object in the campus is modeled separately. On the basis of field, landscape objects such as topography and sky are continuously distributed in space. Topographic objects such as buildings, trees, and streetlights, which are characterized by discrete entities and exist independently. The third step is to construct individual physical scenes and then integrate them into a complete virtual campus scene.

In this design, OpenGL is used for modeling, 3D texture mapping is used to draw scenes. Discrete images collected and processed by cameras, Photoshop and other images are used to generate panoramic images after calculating and processing. At last, interactive control is carried out in VC++6.0 environment to realize virtual campus panoramic roaming system. The basic function module of the system is shown in figure 2.

Figure 2.

Basic function modules of the system

10.21307_ijanmc-2019-023-f002.jpg

A. Data collection and collation

In the process of realizing the virtual campus, the complete 3d spatial data and image data are indispensable data for constructing the virtual campus.In the process of building topographic model, digital photogrammetry is usually adopted. Based on the basic principle of photogrammetry, the simulation model and digital model are generated by image processing and image matching using photos as original data, then convert into DEM format to input the formed DEM and digital map to the corresponding database. The data processing process is shown in figure 3.

Figure 3.

Data processing flow

10.21307_ijanmc-2019-023-f003.jpg

Among the buildings, the height determination of different contents are usually carried out in accordance witharchitectural design drawings, which can be further extracted by using the architectural design drawings in the process of obtaining the three-dimensional model of the geometric features of the building. Scanning digitized vector data using existing maps should be a less demanding building for three-dimensional construction technology of the roof. If only for the two-dimensional vector data content, the height should be inferred according to the floor number.

For texture data, different reflection characteristics of scene surface can be represented by the texture image.The texture mapping represented in this process is to map part of the image that has been mapped to the texture mapping in the image fragment. This mapping is closely related to the image color to the image coordinate position, and further modification of the image segment RGBA color can be performed in this process.To use the current texture to draw pixels, we must make texture coordinates for each vertex before drawing it in which we just need call glTexCoord2d(s:Double; t:Double) function.In the function s and t are coordinates of s and t generated for 2D texture.For all textures, regardless of their size, the texture coordinates in the upper left corner (top) are (0,0) and in the lower right corner (1,1). In this process, the texture coordinate should be a number between 0 and 1.

The texture map implementation code is as follows:

namespace OGL

{classCCylinder

{floatm_Radia;// Cylindrical radius float m_Height;

int m_Slice;// A cylinder is divided by m Slice CGLTexture *m_pTexture;

Public;

CCylinder():m_pTexture(NULL)

{m_Radia= 1280-128;

m_Height=1024+1024;

m_Slice=12;

CharCylinderTex[255]=“Scene1.JPG”;

LoadCylinderTexture(CylinderTex);}

void LoadCylinderTexture(char*CylinderTex)

{If(m_pTexture!=NULL)delete m_pTexture;

m_pTexture=new CGLTexture(Cylinder Tex);}

~CCylinder()

{ deletem_pTexture;}}

B. Three-dimensional model construction and visualization

In the development of this system, the combination of 3d Max software and OpenGL can reduce the complexity of the system construction. The key to building the virtual campus model is to analyze the morphological characteristics of the scene. According to the state characteristics of the scene model, it can be divided into dynamic entity model and static entity model.

After obtaining the corresponding texture pictures and information data, the scene model is modeled according to the composition of the virtual campus system. The three-dimensional model of the system is shown in figure 4.

Figure 4.

System 3D model

10.21307_ijanmc-2019-023-f004.jpg
  • 1) Construction of static entity model of virtual campus

    Static entities on campus include teaching buildings, libraries, playground, roads, greening, etc. Static modeling is mainly composed of geometric model modeling of entity's own characteristics and physical model modeling caused by entity's external environment. The physical modeling of static solid model is mainly about different solid texture caused by external environment. The geometric model of static solid model is mainly the solid model of its own shape. In the geometric modeling process of static solid model, according to the complexity of collected solid model data, 3d Max can be used to build the model for regular static solid model. For irregular solid model, AutoCAD is first used to modify the model contour[9] and then 3d Max is used to build the model.

  • 2) Construction of dynamic physical model of virtual campus

    In the process of constructing campus system model, building motion part may change the internal structure of the original model organization. Therefore, the degree of freedom node linked to the motion part should be added in the model file formed by modeling and setting the corresponding position coordinates. The motion part of the model is analyzed on the basis of the degree of freedom so as to determine the motion relations.

    As an important part of the virtual campus system model, the modeling process of the dynamic physical model[10] is as follows.The first step is using the modeling tool 3d Max to build the static and dynamic two parts of the campus system model.In the process of building dynamic model, the degree of freedom is increased.The second is to enhance the animation display effect of dynamic entity model.The last step is displaying the flash effect of the dynamic model in the model of the virtual campus system.

  • 3) Design of sky scene

    The realization of the sky in this system uses the node called Background of the sky box algorithm[11].It can increase the effect of blue sky and white cloud for the virtual campus scene which can improve the authenticity of the three-dimensional virtual campus scene. In this node, skyColor and skyAngle field values are used to control the color of the sky. The skyColor field specifies the color of the sky of stereo space background, which values are a combination of red, green, and blue. The skyAngle field is the angle of the sky that specifies the position to be colored on the stereo space background. In this process, all the colors of the sky are set to produce a corresponding excessive and gradual action, which makes the sky look more realistic.

The realization of the sky box is to use the rectangular square box as the sky perspective map to generate the corresponding cube. First, create a large enough cube, then paste the different sky textures that represent the weather effect on different faces of the cube box to avoid too flat and rough, and use a light blue sky to further eliminate the background. In this way, the degree of fidelity of the simulation effect is expressed. The picture as the sky background should meet the conditions that the graphic format should be BMP, that is the bitmap. Set the image size according to the size parameter. The size has strict requirements and preferably a multiple of 2. Set the save path and name, render It must be ensured that the four sides should be connected to the position of the relevant image.

C. The optimization design of three-dimensional model

  • 1) Building geometry model optimization

    In the virtual campus system, the model is built based on the classification of the school buildings' appearance and structure.The same model is adopted for the buildings with the same appearance or structure and the relatively complex model is simplified through the splitting methodbefore modeling is carried out.

    In building modeling, the geometric model includes both the top and the wall. The wall can be realized by means of picture or line segment.The top contains all vertex coordinates.Because different buildings have different roof shapes during the modeling process which cannot take the general model to express the situation of the roof.It needs to push different information in accordance with the relevant rules of coordinate data and all buildings need to be classifiedin accordance with the shape characteristics of the top. The geometric model data for different buildings are also completely different.

  • 2) Texture mapping of 3d virtual campus buildings

    Line segment are usually used to model building windows. Describe and render the frame of the windows. Due to the large number of buildings on the campus, it takes too much time to model one by one and the system speed will be affected. So windows on the surface of different buildings can be modeled with texture mapping.The specific measure of implementation is making the data texture of all buildings in the school processed and converted to the corresponding format and expand the corresponding mapping for all faces.

  • 3) Blanking process

    In the realistic graphics generation, the scene model needs to be blanked to improve the loading efficiency of the model. The scene blanking is to give the point of view and sight, which further determines the visibility of the object surface in the scene as well as the invisible characteristics after being sheltered. Blanking can be regarded as a sorting problem and the efficiency of sorting can affect the efficiency of the blanking algorithm.

    At a certain point of view to observe the 3 d object.You can see the point, line and plane distributedon the surface of the object while other part may be keep out by these parts. If you want to make 3 d objects to display, you should eliminate points and lines that are not visible on the surface after determining the appropriate line of sight. This method is called blanking algorithm.

    The backside algorithm, Z buffer algorithm, painter algorithm and scan line algorithm are more common in the blanking algorithm we have studied by far.

    The Z buffer algorithm mainly compares the surface depth of each pixel on the projection plane. It does not need the geometric data of the whole scene. So it is the relatively simple blanking content of all the image space algorithm. Facing the same pixel, the Z buffer is usually saved on the surface. If the new surface depth is closer to the point of view than the buffer surface depth, then the new content is saved.

    The code of Z buffer algorithm implementation is as follows:

    {for (x=0; x<vmax; x++)

    For (y=0; y<vmax; y++)

    { The depth value of the (x, y) element of the Z cache is -1, the minimum depth value;

    The color of the (x, y) element of the Z cache is the background color;}

    for(each polygon plane)

    for(each pixel on the projection plane)

    {Calculates the depth d of the polygon at that pixel (x, y); If(d>Z cache the value at (x, y))

    {The depth value of the (x, y) element of the Z cache is d;

    The color value of the (x, y) element of the Z cache is the current polygon color value;}}}

  • 4) Use LOD algorithm to optimize polygon detail model in campus scene, library, etc. All the details of the space modelling is oftenreflected in the process of setting up distance in space. The LOD node can achieve this function. Different scenes depictdifferent level of details. Drawing detailed geometric details for the nearby geometry fully whilethe geometry in the distance is greatly simplified and draw coarse geometric details relatively. Close shot and distant view have fine and rough drawing respectively. Comparison of test results of the system before and after optimization is shown in table 1.

Table I.

COMPARISON OF TEST RESULTS BEFORE AND AFTER OPTIMIZATION

10.21307_ijanmc-2019-023-tbl1.jpg

IV. THE REALIZATION OF VIRTUAL CAMPUS ROAMING SYSTEM INTERACTIVITY

One of the most important features of virtual reality technology is real-time interactivity, which is the core of virtual campus construction. After the 3d scene has been built, it needs to be debugged interactively. The system can realize virtual campus roaming on the computer through real-time interactive control and external input devices such as mouse and keyboard.

A. Implementation of interactive roaming

The system is mainly controlled by the "NavigationInfo" node and the "Viewpoint" node in interactive roaming. Browse speed and way are set by the "NavigationInfo" node. When browsing the corresponding scene in the campus, its position and orientation are set through the "Viewpoint" node. The realization of the direct interaction function of the campus scene with the help of external devices such as keyboard and mouse. It is shown in figure 5.

Figure 5.

Direct interaction function diagram

10.21307_ijanmc-2019-023-f005.jpg

B. Control of interactive roaming

In the process of the realization of this system, the objects in the scene should be unfolded and painted again when the user standing angle changes. The specific methods include using the change of three-dimensional object in the scene or changing the interactive scene picture through visual transformation.

The "gluLookAt" function is the method of view transformation proposed in OpenGL, which encapsulates the command of rotation and translation. It changes the matrix through eye position, reference and vector, and maps the target point to the corresponding z-axis. The origin point belongs to its observation point. In the process of projection matrix, the scene is mapped to the center of the relevant visual area and the upward vector is mapped to the y-axis. But the upward vector is not necessarily balanced between the line of sight to the line of reference in the process.

The interactive roaming control model is as follows:

  • 1) Initial Model

    static t3DMode1 g_3DMode1[2];

    CLoad3DS* m_3DS=new CLoad3DS; m_3DS->Init(“neicum2 3DS”,0); gLoadName(0);

    m_3DS>show3DS(0,g_3DModel[0].Position x,g_3DModel[0].Position y,g_3DModel[0].Position z,0. 6,g_3DModel[0].bngitude,g_3DModel[0].latitude);

  • 2) Selection function

    hits=glRendeMode(GL_RENDER);

    if(hits<=0)

    return -1;

    return selectBuf[(hits-1)*4+3];

  • 3) Translation function

    g_3DModel[hits].Position x+=m_xTranslation; g_3DModel[hits].Position y+=m_yTranslation;

  • 4) Rotational function

    g_3DMode[hits].longitude-=theta; g_3DMode[hits]. latitude+=phi;

C. Realization of collision detection function

Collision detection technology[12] is mainly carried out to objects in the internal scene. As the global "Camera" moves in the internal scene, it is equivalent to the observer's roaming in the scene. When the observer moves inside some scenes, it will pass through the object directlyif there is no collision detection whichdoes not conform to the actual situation. So collision detection technology needs to be introduced.

The module mainly uses the packaging box algorithm[13] to judge the object region in the three-dimensional scene. Establish the packaging box and determine which objects should be carried out to collision detection in the scene. In the process of happening collision of packing box level, further judgment is made on whether the collision of triangular level occurs.The packaging box levelsare divided into regional levels. Finally, the detection is usually carried out in the process of triangular level. Compared with common detection algorithms, the accuracy is usually higher and the performance loss caused by collision detection is avoided. There are the following means in the process of specific implementation. Firstly, calculate according to the laws of motionof the object or the position of user input in each frame. At this point, the collision detection problem is not considered.Then make the triangular to loop detection in the scene. The operation in the process of the cycle is as follow.

  • 1) Find the plane of the current triangle, which is called plane S;

  • 2) Judge the position of the object in the previous and current frame. Estimate the relation between it and plane S. If the previous frame is before the plane and this frame has reached the plane, then do the calculation in step one.

  • 3) Because the movement of two objects in front and rear on both sides of the plane means that the object has passed through the plane. However, the plane has no boundary.At this point it cannot indicate the collision between the object and the triangle. It needs to judge the boundary within the limits of the three sides of a triangle. After passing the three edges, plane PS1, PS2, and PS3 are vertically set.Make the normal line point to the interior, and judge the position of the object.Judge whether it is in the corresponding plane. Yesturn to4 or not turn to 5.

  • 4) After the object collides with the triangle, correct its position so that it can move in accordance with S.

  • 5) Make the next triangle be the corresponding triangle and go back to step 1 when it is ensured that the object is not colliding.

V. CONCLUSION

Based on virtual reality technology, this paper introduces the development of OpenGL virtual campus roaming system and further studies the basic algorithm of developing virtual campus roaming system. And it introduces and realizes the modeling of scene model and interactive function of roaming. The design of 3d virtual campus roaming system has been completed.

Through the test, the optimized virtual campus roaming system runs smoothly. The virtual campus panoramic roaming system presents the 3d landscape in a real way. Users can Roam in the 3d virtual campus scene with the help of external devices such as mouse and keyboard so as to realize the interactive operation of campus reality.

ACKNOWLEDGMENT

The Research was supported by advanced network, monitoring and control project of national joint local engineering laboratory (nos. GSYSJ20170009) and Shaanxi provincial Department of Education special scientific research project (nos. 16JK1376).

References


  1. LI Jianrong,KONG Suzhen.Research on application of virtual reality technology in education [J]. LABORATORY SCIENCE, 2014, 17(3):98-103. (in Chinese)
  2. ZHAO Wei, DUAN Hong. Research of Virtual Reality Software [J]. COMPUTER TECHNOLOGY AND DEVELOPMENT, 2012, 22(2): 229-233. (in Chinese)
  3. WANG Wentao,XIE Yangqun,LI Li.Analyzing the Application of Virtual Realityin Libraries[J]. Library, 2016(5):10-14. (in Chinese)
  4. MA Liya.The research on the key technologies of walking-through system based on virtual reality[D].Harbin:Harbin Engineering University, 2010.(in Chinese)
  5. LIUXiaoying,ZHANG Jian.Design and Implementation of Virtual Reality Platform for 3D Campus[J].Hubei Agricultural Sciences. 2014, 53(12):2909-2912. (in Chinese)
  6. MA Ping.Design and Implementation of the Three-dimensional Virtual Campus Stereoscopic Scene[D]. Shandong: Shandong Normal University, 2013.(in Chinese)
  7. Li Qinyan, FU Zigang. Three-Dimensional Clock Design Based on OpenGL [J]. Computer and Information Technology, 2016, 24(3): 52-54. (in Chinese)
  8. Xiao Jian, WeiXiong, WangRenbo. Realization and Significance of 3D Scene Simulation in Large- scale Building Based on Open GL [J]. ELECTRONICS QUALITY, 2016, 11:88-92. (in Chinese)
  9. Lou Qiye,Cheng Xiaojun,Tan Kai.Three-dimensional modeling of buildings based on AutoCAD and 3DMax [D]. Geotechnical Investigation&Surveying, 2013, 11:71-74. (in Chinese)
  10. TIAN Wenbo.The research of virtual campus construction based on CDUT[D]. Chengdu:Chengdu University of Technology, 2013. (in Chinese)
  11. Zhou Z, Feng Y, Gang R, et al. Virtual Reality Based Process Integrated Simulation Platform in Refinery:Virtual Refinery and Its Application [J]. China Petroleum Processing & Petrochemical Technology, 2011, 13(3):74-84.
  12. Novakmarcincin J. Selected Applications of Virtual Reality in Manufacturing [J]. Journal for Technology of Plasticity, 2011, 36(1):25-34.
    [CROSSREF]
  13. Bamodu O, Ye X M. Virtual Reality and Virtual Reality System Components [J]. Advanced Materials Research, 2013, 765-767 (765-767): 1169-1172.
    [CROSSREF]
XML PDF Share

FIGURES & TABLES

Figure 1.

System development process

Full Size   |   Slide (.pptx)

Figure 2.

Basic function modules of the system

Full Size   |   Slide (.pptx)

Figure 3.

Data processing flow

Full Size   |   Slide (.pptx)

Figure 4.

System 3D model

Full Size   |   Slide (.pptx)

Figure 5.

Direct interaction function diagram

Full Size   |   Slide (.pptx)

REFERENCES

  1. LI Jianrong,KONG Suzhen.Research on application of virtual reality technology in education [J]. LABORATORY SCIENCE, 2014, 17(3):98-103. (in Chinese)
  2. ZHAO Wei, DUAN Hong. Research of Virtual Reality Software [J]. COMPUTER TECHNOLOGY AND DEVELOPMENT, 2012, 22(2): 229-233. (in Chinese)
  3. WANG Wentao,XIE Yangqun,LI Li.Analyzing the Application of Virtual Realityin Libraries[J]. Library, 2016(5):10-14. (in Chinese)
  4. MA Liya.The research on the key technologies of walking-through system based on virtual reality[D].Harbin:Harbin Engineering University, 2010.(in Chinese)
  5. LIUXiaoying,ZHANG Jian.Design and Implementation of Virtual Reality Platform for 3D Campus[J].Hubei Agricultural Sciences. 2014, 53(12):2909-2912. (in Chinese)
  6. MA Ping.Design and Implementation of the Three-dimensional Virtual Campus Stereoscopic Scene[D]. Shandong: Shandong Normal University, 2013.(in Chinese)
  7. Li Qinyan, FU Zigang. Three-Dimensional Clock Design Based on OpenGL [J]. Computer and Information Technology, 2016, 24(3): 52-54. (in Chinese)
  8. Xiao Jian, WeiXiong, WangRenbo. Realization and Significance of 3D Scene Simulation in Large- scale Building Based on Open GL [J]. ELECTRONICS QUALITY, 2016, 11:88-92. (in Chinese)
  9. Lou Qiye,Cheng Xiaojun,Tan Kai.Three-dimensional modeling of buildings based on AutoCAD and 3DMax [D]. Geotechnical Investigation&Surveying, 2013, 11:71-74. (in Chinese)
  10. TIAN Wenbo.The research of virtual campus construction based on CDUT[D]. Chengdu:Chengdu University of Technology, 2013. (in Chinese)
  11. Zhou Z, Feng Y, Gang R, et al. Virtual Reality Based Process Integrated Simulation Platform in Refinery:Virtual Refinery and Its Application [J]. China Petroleum Processing & Petrochemical Technology, 2011, 13(3):74-84.
  12. Novakmarcincin J. Selected Applications of Virtual Reality in Manufacturing [J]. Journal for Technology of Plasticity, 2011, 36(1):25-34.
    [CROSSREF]
  13. Bamodu O, Ye X M. Virtual Reality and Virtual Reality System Components [J]. Advanced Materials Research, 2013, 765-767 (765-767): 1169-1172.
    [CROSSREF]

EXTRA FILES

COMMENTS