CN117205554A - Terrain loading method and device for spherical virtual scene, medium and electronic equipment - Google Patents

Terrain loading method and device for spherical virtual scene, medium and electronic equipment Download PDF

Info

Publication number
CN117205554A
CN117205554A CN202311172078.7A CN202311172078A CN117205554A CN 117205554 A CN117205554 A CN 117205554A CN 202311172078 A CN202311172078 A CN 202311172078A CN 117205554 A CN117205554 A CN 117205554A
Authority
CN
China
Prior art keywords
model
terrain
lod
target
virtual scene
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311172078.7A
Other languages
Chinese (zh)
Inventor
王少标
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202311172078.7A priority Critical patent/CN117205554A/en
Publication of CN117205554A publication Critical patent/CN117205554A/en
Pending legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The disclosure provides a terrain loading method and device for a spherical virtual scene, a computer-readable storage medium and electronic equipment, and relates to the technical field of computers. The method comprises the following steps: acquiring a first LOD model with the lowest model precision in a multi-level LOD model of a plurality of terrain areas; generating a target large model matched with the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model comprises a model patch for describing the terrain characteristics of the plurality of terrain areas; rendering the target large model to keep the target large model displayed in the spherical virtual scene, and keeping the target large model displayed on the top layer when the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold. The present disclosure improves terrain loading efficiency in spherical virtual scenes.

Description

Terrain loading method and device for spherical virtual scene, medium and electronic equipment
Technical Field
The disclosure relates to the field of computer technology, and in particular relates to a terrain loading method of a spherical virtual scene, a terrain loading device of the spherical virtual scene, a computer readable storage medium and electronic equipment.
Background
The virtual topography is often applied to an indispensable part of a movie, a game and an animation scene, and by loading the virtual topography, a real and beautiful virtual scene can be created.
In the related art, a staff is usually required to manually manufacture a terrain block, and when loading the terrain in the virtual scene, the terrain block is spliced into the virtual terrain for display, however, the method is not suitable for loading the terrain of the spherical virtual scene, and meanwhile, the method is slow in terrain loading speed, high in labor cost and time cost are required, so that the efficiency of the terrain loading process of the spherical virtual scene is low.
Disclosure of Invention
The disclosure provides a terrain loading method of a spherical virtual scene, a terrain loading device of the spherical virtual scene, a computer-readable storage medium and electronic equipment, so that the terrain loading efficiency in the spherical virtual scene is improved at least to a certain extent.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a terrain loading method for a spherical virtual scene, the spherical virtual scene including a plurality of terrain areas, each terrain area including a corresponding multi-level LOD model, each level LOD model corresponding to a model precision, comprising: acquiring a first LOD model with the lowest model precision of the multi-level LOD model of the plurality of terrain areas; generating a target large model matched with the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model comprises a model patch for describing the terrain features of the plurality of terrain areas; rendering the target large model to keep the target large model displayed in the spherical virtual scene, and keeping the target large model displayed on the top layer when the distance between a camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold.
According to a second aspect of the present disclosure, there is provided a terrain loading device for a spherical virtual scene, the spherical virtual scene including a plurality of terrain areas, each terrain area including a corresponding multi-level LOD model, each level LOD model corresponding to a model precision, comprising: a first LOD model acquisition module configured to acquire a first LOD model with a lowest model accuracy of the multistage LOD models of the plurality of terrain areas; a target large model acquisition module configured to generate a target large model that matches the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model includes a model patch for describing terrain features of the plurality of terrain areas; and the target large model rendering module is configured to render the target large model so as to keep the target large model displayed in the spherical virtual scene, and keep the target large model displayed on the top layer when the distance between a camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold.
According to a third aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the terrain loading method of the spherical virtual scene of the first aspect described above and possible implementations thereof.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: a processor; and the memory is used for storing executable instructions of the processor. Wherein the processor is configured to perform the terrain loading method of the spherical virtual scene of the first aspect described above and possible implementations thereof via execution of the executable instructions.
The technical scheme of the present disclosure has the following beneficial effects:
on one hand, a target large model of the spherical virtual scene is generated through a first LOD model with the lowest precision in the LOD models of all terrain areas, and the target large model is rendered. On the other hand, the labor cost and the time cost consumed by the terrain loading in the spherical virtual scene are reduced, and the terrain loading efficiency of the spherical virtual scene is further improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort.
Fig. 1 shows a system operation architecture of the present exemplary embodiment;
fig. 2 shows a flowchart of a terrain loading method for a spherical virtual scene in the present exemplary embodiment;
FIG. 3 illustrates a flow chart of a method of loading a target terrain area to be loaded in a spherical virtual scene in the present exemplary embodiment;
FIG. 4 shows a schematic diagram of a split-joint terrain using a terrain block model obtained by direct subtractive surface processing of an original terrain block model;
FIG. 5 illustrates a flowchart of a face-subtracting process for an original terrain block model in the present exemplary embodiment;
Fig. 6A, 6B and 6C sequentially illustrate a topographic schematic diagram of a spherical virtual scene of the present exemplary embodiment when the distance between the camera and the spherical virtual scene is from near to far;
fig. 7 is a schematic diagram showing a case where a terrain to be displayed is displayed on the upper layer of a large target model when a camera of a spherical virtual scene is far from the spherical virtual scene in the present exemplary embodiment;
FIG. 8 shows a schematic diagram of a terrain in which depth conflicts occur in the present exemplary embodiment;
fig. 9 is a schematic diagram showing a configuration of a terrain loading apparatus of a spherical virtual scene in the present exemplary embodiment;
fig. 10 shows a schematic structural diagram of an electronic device in the present exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the present disclosure. However, those skilled in the art will recognize that the aspects of the present disclosure may be practiced with one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
In the related art, a staff usually adopts manual manufacturing to manufacture a terrain block, and when loading the terrain in the virtual scene, the terrain block is spliced into the virtual terrain for display, however, the method is not suitable for loading the terrain of the spherical virtual scene, and meanwhile, the method is slow in terrain loading speed, high in labor cost and time cost are required, so that the efficiency of the terrain loading process of the spherical virtual scene is low.
In view of one or more of the above problems, exemplary embodiments of the present disclosure first provide a terrain loading method of a spherical virtual scene. The system architecture of the operating environment of the present exemplary embodiment is described below in conjunction with fig. 1.
Referring to fig. 1, a system architecture 100 may include a terminal device 110 and a server 120. The terminal device 110 may be an electronic device such as a smart phone, a tablet computer, or a desktop computer, and the terminal device 110 may be configured to obtain a target LOD model. The server 120 generally refers to a background system that provides the object tracking related service in the present exemplary embodiment, and may be, for example, a server that implements a terrain loading method of a spherical virtual scene. Server 120 may be a server or a cluster of servers, which is not limited by this disclosure. The terminal device 110 and the server 120 may form a connection through a wired or wireless communication link for data interaction.
The terrain loading method of the spherical virtual scene of the present exemplary embodiment may be performed by the terminal device 110. For example, the virtual scene may include a spherical game scene, the terminal device 110 may be an electronic device used by a worker to make the game scene, if loading of topography in the game scene is required, the terminal device 110 may obtain first LOD models corresponding to a plurality of topography areas included in the spherical game scene by executing a topography loading method of the spherical virtual scene, and obtain a target large model according to the first LOD models corresponding to the plurality of topography areas, so as to keep displaying the target large model when a distance between a camera in the virtual scene and the game scene exceeds a specified threshold value, thereby loading the spherical game scene.
In one embodiment, the terminal device 110 may determine a plurality of terrain areas in the spherical virtual scene, send information of the plurality of terrain areas to the server 120, after receiving the information of the plurality of terrain areas, the server 120 obtains a first LOD model with the lowest model precision in the multi-level LOD model of the plurality of terrain areas, generates a target large model matched with the spherical virtual scene based on the first LOD model corresponding to the plurality of terrain areas, and sends rendering information of the target large model to the terminal device 110, so that the terminal device 110 renders the target large model, and when the distance between a camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold value, the target large model is kept displayed.
As can be seen from the above, the terrain loading method of the spherical virtual scene in the present exemplary embodiment may be performed by the terminal device 110 or the server 120 described above.
The method for loading the topography of the spherical virtual scene is described below with reference to fig. 2, where the spherical virtual scene includes a plurality of topography areas, each topography area includes a corresponding multi-level LOD model, and each level LOD model corresponds to a model precision. Fig. 2 shows an exemplary flow of a terrain loading method of a spherical virtual scene, including the following steps S210 to S230:
Step S210, a first LOD model with the lowest model precision in a multi-level LOD model of a plurality of terrain areas is obtained;
step S220, generating a target large model matched with the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model comprises a model patch for describing the terrain characteristics of the plurality of terrain areas;
in step S230, the large target model is rendered to keep the large target model displayed in the spherical virtual scene, and the large target model is kept displayed on the top layer when the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold.
Based on the method, on one hand, a target large model of the spherical virtual scene is generated through a first LOD model with the lowest precision in the LOD models of all terrain areas, and the target large model is rendered. On the other hand, the labor cost and the time cost consumed by the terrain loading in the spherical virtual scene are reduced, and the terrain loading efficiency of the spherical virtual scene is further improved.
In step S210, a first LOD model with the lowest model accuracy in the multi-level LOD models of a plurality of terrain areas is acquired.
Wherein the terrain area may be a portion of the terrain of the spherical virtual scene. The LOD (level of Detail) model may include models of land plots of different accuracies, i.e., different numbers of faces, corresponding to the terrain areas.
The loading speed of the target large model can be effectively improved by acquiring the first LOD model with the lowest model precision in the multi-stage LOD model and generating the target large model according to the first LOD model in the subsequent steps.
With continued reference to fig. 2, in step S220, a target large model is generated that matches the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model includes model patches for describing the terrain features of the plurality of terrain areas.
In one embodiment, generating a target large model that matches a spherical virtual scene based on a first LOD model corresponding to a plurality of terrain areas may include the steps of:
and splicing the first LOD models according to the position information of the first LOD models, removing repeated vertexes and repeated faces in the first LOD models, and cutting or merging the intersected parts between the first LOD models to generate the target large model.
By generating the target large model with low precision, the problem of insufficient terrain display when the camera of the spherical virtual scene is zoomed out is effectively solved, meanwhile, because the target large model has low precision and fewer surface numbers, excessive performance consumption can not be increased even if the target large model is always displayed, and meanwhile, the target large model can roughly display the terrain profile of the spherical virtual scene, so that the sense of reality of the terrain of the spherical virtual scene is ensured when the camera of the spherical virtual scene is zoomed out, and the terrain loading efficiency of the spherical virtual scene is effectively improved.
With continued reference to fig. 2, in step S230, the target large model is rendered to keep the target large model displayed in the spherical virtual scene and to keep the target large model displayed on the top layer when the distance of the camera in the spherical virtual scene from the spherical virtual scene exceeds a specified threshold.
The large target model is kept to be displayed in the spherical virtual scene, so that the problem that the terrain of the spherical virtual scene is not fully displayed when the distance between a camera in the virtual scene and the spherical virtual scene exceeds a specified threshold value can be effectively avoided, and the loading speed is high due to low precision of the large target model, so that the terrain loading efficiency of the spherical virtual scene is effectively improved.
In one embodiment, referring to fig. 3, the method may further include steps S310 to S340:
step S310, determining a target terrain area to be loaded in a plurality of terrain areas;
step S320, obtaining a corresponding target LOD model of a target to-be-loaded terrain area, and determining the to-be-displayed terrain based on all target LOD models of the target to-be-loaded terrain area;
step S330, stacking the target large model and the terrain to be displayed in sequence to load the terrain of the target terrain area to be loaded, wherein the terrain to be displayed is displayed on the top layer;
step S340, hiding the terrain to be displayed and keeping the target large model displayed on the top layer under the condition that the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold value and/or the spherical virtual scene rotates.
Each step in fig. 3 is specifically described below.
Referring to fig. 3, in step S310, a target terrain area to be loaded is determined among a plurality of terrain areas.
The target terrain area to be loaded may include a shooting area of a camera of the virtual scene.
With continued reference to fig. 3, in step S320, a corresponding target LOD model of the target terrain area to be loaded is acquired, and the terrain to be displayed is determined based on all the target LOD models of the target terrain area to be loaded.
The target LOD model may be a LOD model selected from LOD models and used for forming a certain level of the terrain to be displayed, and it should be noted that the number of surfaces of the target LOD model in the target terrain area to be loaded may be the same or different. The terrain to be displayed can be used for displaying the terrain when the virtual camera is closer to the virtual scene so as to display more detail information of the terrain.
In order to acquire the target LOD model, first, a plurality of levels of LOD models corresponding to the terrain area, that is, LOD models with a plurality of surface numbers, are required to be acquired, so in one embodiment, the original terrain block model corresponding to the terrain area is subjected to surface subtraction processing to obtain the LOD model with a preset surface number corresponding to the original terrain block model.
The original terrain block model can comprise a high-precision original terrain block model with more surfaces than the LOD model, and the original terrain block model manufactured by an artist can be subjected to bending processing to be attached to the surface of a sphere scene under the condition that the virtual scene is the sphere scene. The preset surface numbers are used for determining the level of the LOD model, and LOD models with various levels, namely LOD models with various accuracies, can be obtained by setting different preset surface numbers.
The LOD models with various surface numbers are obtained by carrying out surface subtracting processing on the original terrain block model, so that the LOD models with various precision are obtained, and the LOD models with different precision can be loaded according to the distance between the camera of the virtual scene and the original terrain block model when the terrain to be displayed is determined, so that the LOD model with higher loading precision is realized when the terrain area is closer to the camera, and the LOD model with lower loading precision is loaded when the terrain area is farther from the virtual camera, thereby effectively improving the terrain loading speed and further reducing the performance consumption of the system.
Because the edge of the original terrain block model is easily changed, so that the problem that the original terrain block models shown in fig. 4 cannot be perfectly spliced occurs, in one embodiment, the above-mentioned surface subtraction process is performed on the original terrain block model corresponding to the terrain area to obtain the LOD model with the preset number of surfaces corresponding to the original terrain block model, as shown in fig. 5, the following steps S510 to S550 may be included:
step S510, obtaining a normal vector of each surface in the original terrain block model;
step S520, determining a target model surface farthest from a preset terrain block boundary in the original terrain block model;
Step S530, calculating an included angle between the target die surface and the adjacent surface to be combined according to the normal vector of the target die surface and the normal vector of the adjacent surface to be combined corresponding to the normal vector;
step S540, merging adjacent faces to be merged corresponding to the minimum included angle in the included angles to obtain an intermediate LOD model;
step S550, the target model surface and the adjacent surfaces to be combined are redetermined for the middle LOD model until the number of the surfaces of the middle LOD model is the same as the number of the preset surfaces.
Based on the method of fig. 5, the surface of the original terrain block model, which is farthest from the boundary of the preset terrain block, is determined as the target molding surface, so that the surface of the original terrain block model is subtracted, the problem that the LOD model obtained by using the surface subtraction in fig. 4 is cracked when the terrain is spliced can be improved to a certain extent, the edge of the model is unchanged after the surface subtraction treatment, and the acquisition efficiency of the LOD model is further improved.
It should be noted that, since many game engines integrate the model face-reducing method in fig. 5, for example, the Simplygon LOD plug-in the illusion Engine4 (UE 4) can implement the model face-reducing method that keeps the edge unchanged. Therefore, in practical application, the insert can be directly used for carrying out face reduction treatment on the model.
Two ways of acquiring the corresponding target LOD model of the target terrain area to be loaded are described below.
After obtaining LOD models of a plurality of preset surface numbers, that is, LOD models of a plurality of levels, in one embodiment, each of the above-mentioned terrain areas corresponds to an LOD model of M levels, where M is a positive integer, obtaining a corresponding target LOD model of the terrain area to be loaded includes:
determining the jth level LOD model as a target LOD model under the condition that an intersection point exists between the shooting range of the camera corresponding to the jth level LOD model and a bounding box corresponding to a terrain area, wherein j is an integer which is greater than or equal to 0 and less than M;
and hiding the terrain area under the condition that the shooting ranges corresponding to the M-level LOD model are separated from the bounding box.
The number of faces of different j-level LOD models is different, so that the precision is also different. The photographing range may be a radiation area of a camera of the virtual scene when photographing the j-th level LOD model, and, illustratively, the photographing range may be a virtual sphere. Since the shapes of the terrain areas are different, the terrain block models can be wrapped by using bounding boxes, the bounding boxes can be virtual basic cubes and used for wrapping the terrain block models with different shapes, the shape of the bounding boxes is not particularly limited, and the bounding boxes can be spheres, cuboid and the like.
The bounding box is used for replacing the terrain area with the complex shape so as to determine whether the LOD model has an intersection point with the corresponding shooting range, so that the calculation amount when the intersection point is judged can be effectively reduced, and the terrain loading speed is further improved.
In one embodiment, the bounding box has N vertices, and when the bounding box corresponding to the terrain area has an intersection in the imaging range of the camera corresponding to the jth LOD model, determining the jth LOD model as the target LOD model may include:
under the condition that j is 0, taking the position of a camera of the spherical virtual scene as a first sphere center, taking the distance between the camera and the 0 th-level LOD model as a first radius to construct a first shooting range, and under the condition that an intersection point exists between the first shooting range and the bounding box, determining the 0 th-level LOD model as a target LOD model;
and under the condition that j is larger than 0, acquiring N second sphere centers corresponding to the N vertexes, constructing N second shooting ranges based on any second sphere center and a second radius j obtained by the distance between the virtual camera and the jth LOD model, and determining the jth LOD model as a target LOD model under the condition that any second shooting range is intersected with the bounding box, wherein N is a positive integer.
The first shooting range is a radiation range of the view port of the camera corresponding to the 0 th-level LOD model, the second shooting range includes a radiation range of the view port of the camera corresponding to the j-th-level LOD model when j >0, and the second shooting range needs to be determined according to the vertexes of the bounding box of the j-th-level LOD model when j >0, so that if the bounding box has N vertexes, the j-th-level LOD model has N second shooting ranges.
For example, a certain topographic region corresponds to a j-level LOD model, and if a first LOD model corresponding to the topographic region needs to be determined, each level LOD model and its corresponding bounding box of the topographic region need to be traversed in sequence. When j=0, the level 0 LOD model, that is, the original terrain block model made by the staff has the highest number of surfaces and the highest precision; in determining whether the 0 th level LOD model is the target LOD model, the position C of the camera of the virtual scene can be taken as the first sphere center, and the distance d between the camera and the 0 th level LOD model 0 As a first radius, the virtual sphere S is obtained 0 Determined as a first shooting range, if a virtual sphere S 0 The original terrain block model, namely a 0 th-level LOD model, is directly displayed when the intersection point exists between the original terrain block model and the bounding box; otherwise, let j=j+1, continue to judge whether the jth LOD model is the target LOD model, j >At 0, N vertexes P of the bounding box of the terrain area can be acquired first i (0<=i<N) corresponding N second sphere centers Q i Then constructing N virtual spheres S according to a second radius j obtained by the distance between the camera and the jth LOD model ij For example, if i=1, j=2, S 12 Is represented by bounding box vertex P 2 Corresponding second sphere center Q 2 Is the sphere center, and the distance d between the 2 nd level LOD model and the camera 2 For radius, a virtual sphere is constructed in a second shooting range S ij In the case of intersection with the bounding box, S will be ij The corresponding j-th level LOD model is determined to be a target LOD model; if the second shooting range S ij If there is no intersection with the bounding box, let i=i+1 and continue to judge S ij Whether there is an intersection with the bounding box; at N secondAnd if any one of the second shooting ranges has an intersection point with the bounding box in the shooting ranges, determining that the jth LOD model is visible, namely the jth LOD model is the target LOD model.
By traversing each level of LOD model to determine whether the target LOD model is intersected with the bounding box according to the shooting range of the virtual camera corresponding to each level of LOD model, the distance between the virtual camera and the jth level of LOD model can be evaluated more accurately, so that the LOD model suitable for display at present is determined, when the distances between the camera of the virtual scene and the virtual scene are sequentially from near to far, the accuracy of the target LOD model in the terrain area to be loaded by the target is lower and lower, the number of faces is lower, and the loading of LOD models with different accuracies according to the distance between the terrain block model and the virtual camera is realized, namely, the virtual camera is closer to the terrain block model, and the LOD model with higher accuracy is loaded; if the virtual camera is far away from the terrain block model, a low-precision LOD model is loaded, so that the total number of target LOD models of the terrain area to be loaded is ensured not to be too large, the performance consumption of the system is effectively reduced, and the terrain loading speed is further improved.
In one embodiment, the acquiring N second centers of spheres corresponding to the N vertices may include the following steps:
and determining N second sphere centers according to the distance between any one of N vertexes of the bounding box and the center point of the spherical virtual scene and the position of the virtual camera.
For example, in a spherical virtual scene, the bounding box of the terrain area may have 8 vertices P i (0<=i<8) The distance between each vertex Pi and the center of sphere of the spherical virtual scene can be obtainedAnd then the normalized vector corresponding to the position C of the camera relative to the sphere center (0, 0) of the spherical virtual scene>And->Q obtained by multiplication i Is determined as the vertex P i And a corresponding second sphere center.
And determining a second sphere center based on the vertex of the bounding box so as to generate a second shooting range, so that whether the j-th level LOD model intersects with the bounding box can be more comprehensively judged, and the acquisition accuracy of the target LOD model is further improved.
In an embodiment, when j is greater than 0, the method further includes obtaining N second centers corresponding to the N vertices, constructing N second shooting ranges based on any one of the second centers and a second radius obtained by a distance between the camera and the jth LOD model, and determining the jth LOD model as the target LOD model when any one of the second shooting ranges intersects the bounding box, and further includes:
And under the condition that the N second shooting ranges are separated from the bounding box, determining that the jth level LOD model is hidden, and continuously determining whether the jth+1th level LOD model is a target LOD model.
For example, when j >0, the bounding box of the terrain area has N vertices, if none of the N second shooting ranges of the jth level LOD model and the bounding box intersect, the jth level LOD model is set to be invisible, and whether the jth+1th level LOD model corresponding to the terrain area is the target LOD model is continuously determined, if none of the shooting ranges of all LOD models corresponding to the terrain area and the bounding box intersect, it is determined that the terrain area is invisible, and the display state of the terrain area needs to be set to be hidden.
Under the condition that the N second shooting ranges have no intersection points with the bounding box, the j-th level LOD model is determined to be hidden, and the accuracy of judging whether the j-th level LOD model is hidden can be effectively improved.
In one embodiment, the position of the camera of the virtual scene and the center position of the topographic region and the center position of the LOD model corresponding thereto may be projected onto a two-dimensional plane, the distance between the camera and the topographic region and the LOD model corresponding thereto may be calculated in the two-dimensional plane, and the target LOD model may be determined from the LOD model corresponding to the topographic region based on the distance. Therefore, the effect of loading the high-precision terrain block when the terrain block model is close to the virtual camera and loading the low-precision terrain block when the terrain block model is far from the virtual camera is achieved.
In one embodiment, the LOD model determined to be hidden can be unloaded from the memory, so that the performance consumption of the system when loading the terrain is further reduced, and the system operation efficiency is improved.
With continued reference to fig. 3, in step S330, the target large model and the terrain to be displayed are stacked in order to load the terrain of the target terrain area to be loaded, wherein the terrain to be displayed is displayed on the top layer.
For example, a pre-set terrain baseplate, which may be spherical in shape, a target large model, and the terrain to be displayed may be stacked to load the terrain of the spherical virtual field, where the pre-set terrain baseplate is located at the bottom of the target large model.
In step S340, in the case where the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold and/or the spherical virtual scene rotates, the terrain to be displayed is hidden, and the target large model is kept displayed on the top layer.
In order to improve the reality of the terrain display of the virtual scene, the target large model and the terrain to be displayed are sequentially stacked and displayed, so that the terrain to be displayed with the terrain detail information can be displayed when the camera of the spherical virtual scene is close to the spherical virtual scene, the terrain display effect shown in fig. 7 is obtained when the virtual camera is far from the virtual scene, and the integrity of the terrain display is ensured when the distance is far; and when the distance is farther, the terrain to be displayed is hidden, so that a user can see a target large model positioned on the upper layer of the preset terrain base plate, various terrain display effects caused by different distances between the camera in the spherical virtual scene and the spherical virtual scene are obtained, and the reality of terrain display in the virtual scene is improved.
Since the target large model is always displayed in the terrain loading process, the problem of depth conflict (Z-alignment) caused by overlapping the colors of the terrain to be displayed and the target large model at the same position is easily caused, and referring to the framed area in fig. 8, in order to avoid the Z-alignment problem to a certain extent, in an embodiment, when the target large model and the terrain to be displayed are stacked in sequence, the method further includes the following steps:
and adjusting the rendering depth of the target large model and the preset terrain base plate of the spherical virtual scene by using the depth offset value.
The depth offset value can be used for keeping a distance between the terrain to be displayed, the target large model and a preset terrain base plate, so that Z-finishing problems are avoided to a certain extent, the terrain to be displayed is ensured to be displayed on the upper layer of the target large model, the target large model is displayed on the upper layer of the preset base plate, and the display effect of each layer is not interfered with each other.
Based on the method, the terrain loading speed in the spherical virtual scene is effectively improved, and the reality of the terrain in the spherical virtual scene is improved, so that the terrain loading efficiency in the spherical virtual scene is improved, and the user experience is improved.
The exemplary embodiment of the disclosure also provides a terrain loading device for the spherical virtual scene. As shown in fig. 9, the spherical virtual scene includes a plurality of terrain areas, each terrain area includes a corresponding multi-level LOD model, each level LOD model corresponds to a model precision, and the terrain loading device 900 of the spherical virtual scene may include:
a first LOD model acquisition module 910 configured to acquire a first LOD model with a lowest model accuracy in a multi-level LOD model of a plurality of terrain areas;
a target large model acquisition module 920 configured to generate a target large model that matches the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model includes a model patch for describing the terrain features of the plurality of terrain areas;
the target big model rendering module 930 is configured to render the target big model to keep the target big model displayed in the spherical virtual scene and to keep the target big model displayed on the top layer when the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold.
In one embodiment, the apparatus may further include:
determining a target terrain area to be loaded in a plurality of terrain areas;
Acquiring a corresponding target LOD model of a target to-be-loaded terrain area, and determining the to-be-displayed terrain based on all target LOD models of the target to-be-loaded terrain area;
stacking the target large model and the terrain to be displayed in sequence to load the terrain of the target terrain area to be loaded, wherein the terrain to be displayed is displayed on the top layer;
and hiding the terrain to be displayed under the condition that the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold value and/or the spherical virtual scene rotates, and keeping the target large model displayed on the top layer.
In one embodiment, each of the above-mentioned terrain areas corresponds to an M-level LOD model, M is a positive integer, and obtaining a corresponding target LOD model of the target terrain area to be loaded includes:
determining the jth level LOD model as a target LOD model under the condition that an intersection point exists between the shooting range of the camera corresponding to the jth level LOD model and a bounding box corresponding to a terrain area, wherein j is an integer which is greater than or equal to 0 and less than M;
and hiding the terrain area under the condition that the shooting ranges corresponding to the M-level LOD model are separated from the bounding box.
In one embodiment, the bounding box has N vertices, and determining the j-th level LOD model as the target LOD model when the capturing range of the camera corresponding to the j-th level LOD model has an intersection with the bounding box corresponding to the terrain area may include:
Under the condition that j is 0, taking the position of a camera in the spherical virtual scene as a first spherical center, taking the distance between the camera and the 0 th-level LOD model as a first radius, constructing a first shooting range, and under the condition that an intersection point exists between the first shooting range and the bounding box, determining the 0 th-level LOD model as a target LOD model;
and under the condition that j is larger than 0, acquiring N second sphere centers corresponding to the N vertexes, constructing N second shooting ranges based on any second sphere center and a second radius obtained by the distance between the camera and the jth LOD model, and determining the jth LOD model as a target LOD model under the condition that any second shooting range is intersected with the bounding box, wherein N is a positive integer.
In one embodiment, the acquiring N second centers corresponding to the N vertices may include:
and determining N second sphere centers according to the distance between any one of N vertexes of the bounding box and the center point of the spherical virtual scene and the position of the camera.
In an embodiment, when j is greater than 0, the method may further include obtaining N second centers corresponding to the N vertices, constructing N second shooting ranges based on any one of the second centers and a second radius obtained by a distance between the camera and the jth LOD model, and determining the jth LOD model as the target LOD model when any one of the second shooting ranges intersects the bounding box, where the method includes:
And under the condition that the N second shooting ranges are separated from the bounding box, determining that the jth level LOD model is hidden, and continuously determining whether the jth+1th level LOD model is a target LOD model.
In one embodiment, when stacking the target large model and the terrain to be displayed in sequence, the apparatus may further include:
and adjusting the rendering depth of the target large model and the preset terrain base plate of the spherical virtual scene by using the depth offset value.
In an embodiment, the generating the target large model matched with the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas may include:
and splicing the first LOD models according to the position information of the first LOD models, removing repeated vertexes and repeated faces in the first LOD models, and cutting or merging the intersected parts between the first LOD models to generate the target large model.
The specific details of each part in the above apparatus are already described in the method part embodiments, and thus will not be repeated.
Exemplary embodiments of the present disclosure also provide a computer readable storage medium, which may be implemented in the form of a program product comprising program code for causing an electronic device to carry out the steps according to the various exemplary embodiments of the disclosure as described in the above section of the "exemplary method" when the program product is run on the electronic device. In an alternative embodiment, the program product may be implemented as a portable compact disc read only memory (CD-ROM) and comprises program code and may run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
Exemplary embodiments of the present disclosure also provide an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as program code. The processor performs the method of the present exemplary embodiment by executing the executable instructions.
An electronic device is illustrated in the form of a general purpose computing device with reference to fig. 10. It should be understood that the electronic device 1000 shown in fig. 10 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 10, the electronic device 1000 may include: processor 1010, memory 1020, bus 1030, I/O (input/output) interface 1040, and network adapter 1050.
The processor 1010 may include one or more processing units, such as: the processor 1010 may include a central processor (Central Processing Unit, CPU), an AP (Application Processor ), a modem processor, a display processor (Display Process Unit, DPU), a GPU (Graphics Processing Unit, graphics processor), an ISP (Image Signal Processor ), a controller, an encoder, a decoder, a DSP (Digital Signal Processor ), a baseband processor, an artificial intelligence processor, and the like. In one embodiment, a first LOD model with the lowest model accuracy in a multi-level LOD model of a plurality of terrain areas may be acquired by an artificial intelligence processor; generating a target large model matched with the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model comprises a model surface piece for describing the terrain characteristics of the plurality of terrain areas; and finally, rendering the target large model to keep displaying the target large model in the spherical virtual scene, and keeping the target large model to be displayed on the top layer when the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold value.
Memory 1020 may include volatile memory such as RAM 1021, cache unit 1022, and may also include nonvolatile memory such as ROM 1023. Memory 1020 may also include one or more program modules 1024, such program modules 1024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. For example, program modules 1024 may include modules of apparatus 900 described above.
The bus 1030 is used to enable connections between the various components of the electronic device 1000 and may include a data bus, an address bus, and a control bus.
The electronic device 1000 can communicate with one or more external devices 1100 (e.g., keyboard, mouse, external controller, etc.) through the I/O interface 1040.
Electronic device 1000 can communicate with one or more networks through network adapter 1050, e.g., network adapter 1050 can provide a mobile communication solution such as 3G/4G/5G, or a wireless communication solution such as wireless local area network, bluetooth, near field communication, etc. Network adapter 1050 can communicate with other modules of electronic device 1000 via bus 1030.
Although not shown in fig. 10, other hardware and/or software modules may also be provided in the electronic device 1000, including, but not limited to: displays, microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Those skilled in the art will appreciate that the various aspects of the present disclosure may be implemented as a system, method, or program product. Accordingly, various aspects of the disclosure may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (11)

1. A terrain loading method for a spherical virtual scene, wherein the spherical virtual scene comprises a plurality of terrain areas, each terrain area comprises a corresponding multi-level LOD model, and each level LOD model corresponds to a model precision, the method comprising:
acquiring a first LOD model with the lowest model precision of the multi-level LOD model of the plurality of terrain areas;
generating a target large model matched with the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model comprises a model patch for describing the terrain features of the plurality of terrain areas;
rendering the target large model to keep the target large model displayed in the spherical virtual scene, and keeping the target large model displayed on the top layer when the distance between a camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold.
2. The method according to claim 1, wherein the method further comprises:
determining a target terrain area to be loaded in the plurality of terrain areas;
acquiring a corresponding target LOD model of the target to-be-loaded terrain area, and determining the to-be-displayed terrain based on all target LOD models of the target to-be-loaded terrain area;
stacking the target large model and the terrain to be displayed in sequence to load the terrain of the target terrain area to be loaded, wherein the terrain to be displayed is displayed on the top layer;
and hiding the terrain to be displayed under the condition that the distance between the camera in the spherical virtual scene and the spherical virtual scene exceeds the specified threshold value and/or the spherical virtual scene rotates, and keeping the target large model displayed on the top layer.
3. The method of claim 2, wherein each terrain region corresponds to an M-level LOD model, M being a positive integer, the obtaining a corresponding target LOD model of the target terrain region to be loaded comprising:
determining the jth level LOD model as the target LOD model under the condition that an intersection exists between the shooting range of the camera corresponding to the jth level LOD model and a bounding box corresponding to the terrain area, wherein j is an integer which is greater than or equal to 0 and less than M;
And hiding the terrain area under the condition that the shooting ranges corresponding to the M-level LOD model are separated from the bounding box.
4. The method of claim 3, wherein the bounding box has N vertices, and wherein determining the j-th level LOD model as the target LOD model if the shooting range of the camera corresponding to the j-th level LOD model has an intersection with the bounding box corresponding to the terrain region comprises:
taking the position of a camera in the spherical virtual scene as a first sphere center, taking the distance between the camera and a 0 th-level LOD model as a first radius to construct a first shooting range, and determining the 0 th-level LOD model as the target LOD model under the condition that the first shooting range has an intersection point with the bounding box;
and under the condition that j is larger than 0, acquiring N second sphere centers corresponding to the N vertexes, constructing N second shooting ranges based on any second sphere center and a second radius obtained by the distance between the camera and a j-th LOD model, and determining the j-th LOD model as the target LOD model under the condition that any second shooting range intersects the bounding box, wherein N is a positive integer.
5. The method of claim 4, wherein the obtaining N second centers of spheres corresponding to the N vertices comprises:
and determining the N second sphere centers according to the distance between any one of the N vertexes of the bounding box and the center point of the spherical virtual scene and the position of the camera.
6. The method of claim 4, wherein the obtaining N second centers of spheres corresponding to the N vertices and constructing N second shooting ranges based on any one of the second centers of spheres and a second radius obtained from a distance between the camera and a jth LOD model, and determining the jth LOD model as the target LOD model if any one of the second shooting ranges intersects the bounding box, if j is greater than 0, further comprises:
and under the condition that the N second shooting ranges are separated from the bounding box, determining that the jth LOD model is hidden, and continuously determining whether the (j+1) th LOD model is the target LOD model or not.
7. The method of claim 2, wherein when stacking the target large model and the terrain to be displayed in sequence, the method further comprises:
And adjusting the rendering depth of the target large model and the preset terrain base plate of the spherical virtual scene by using the depth offset value.
8. The method of claim 1, wherein the generating a target large model that matches the spherical virtual scene based on the first LOD models for the plurality of terrain areas comprises:
and splicing the first LOD models according to the position information of the first LOD models, removing repeated vertexes and repeated faces in the first LOD models, and cutting or merging intersecting parts between the first LOD models to generate the target large model.
9. A terrain loading device for a spherical virtual scene, the spherical virtual scene comprising a plurality of terrain areas, each terrain area comprising a corresponding multi-level LOD model, each level LOD model corresponding to a model precision, the device comprising:
a first LOD model acquisition module configured to acquire a first LOD model with a lowest model accuracy of the multistage LOD models of the plurality of terrain areas;
a target large model acquisition module configured to generate a target large model that matches the spherical virtual scene based on the first LOD models corresponding to the plurality of terrain areas, wherein the target large model includes a model patch for describing terrain features of the plurality of terrain areas;
And the target large model rendering module is configured to render the target large model so as to keep the target large model displayed in the spherical virtual scene, and keep the target large model displayed on the top layer when the distance between a camera in the spherical virtual scene and the spherical virtual scene exceeds a specified threshold.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any one of claims 1 to 8.
11. An electronic device, comprising:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any one of claims 1 to 8 via execution of the executable instructions.
CN202311172078.7A 2023-09-12 2023-09-12 Terrain loading method and device for spherical virtual scene, medium and electronic equipment Pending CN117205554A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311172078.7A CN117205554A (en) 2023-09-12 2023-09-12 Terrain loading method and device for spherical virtual scene, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311172078.7A CN117205554A (en) 2023-09-12 2023-09-12 Terrain loading method and device for spherical virtual scene, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117205554A true CN117205554A (en) 2023-12-12

Family

ID=89034705

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311172078.7A Pending CN117205554A (en) 2023-09-12 2023-09-12 Terrain loading method and device for spherical virtual scene, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117205554A (en)

Similar Documents

Publication Publication Date Title
US9767598B2 (en) Smoothing and robust normal estimation for 3D point clouds
US8917270B2 (en) Video generation using three-dimensional hulls
CN109771951B (en) Game map generation method, device, storage medium and electronic equipment
CN111815755A (en) Method and device for determining shielded area of virtual object and terminal equipment
CN111773709B (en) Scene map generation method and device, computer storage medium and electronic equipment
US20150187130A1 (en) Automatic Generation of 2.5D Extruded Polygons from Full 3D Models
CN110930497B (en) Global illumination intersection acceleration method and device and computer storage medium
CN111598986B (en) Virtual fluid surface rendering method, device, equipment and storage medium
US20170024930A1 (en) Consistent tessellation via topology-aware surface tracking
US11049288B2 (en) Cross-device supervisory computer vision system
CN111210497B (en) Model rendering method and device, computer readable medium and electronic equipment
JP2023029984A (en) Method, device, electronic apparatus, and readable storage medium for generating virtual image
US20160049001A1 (en) Curvature-Driven Normal Interpolation for Shading Applications
CN109697748B (en) Model compression processing method, model mapping processing method, model compression processing device, and storage medium
WO2023024441A1 (en) Model reconstruction method and related apparatus, and electronic device and storage medium
CN114998433A (en) Pose calculation method and device, storage medium and electronic equipment
JP2013097782A (en) Image warp method and computer program product of the same
CN115965735B (en) Texture map generation method and device
CN114723894B (en) Three-dimensional coordinate acquisition method and device and electronic equipment
US20200183566A1 (en) Hybrid image rendering system
CN117205554A (en) Terrain loading method and device for spherical virtual scene, medium and electronic equipment
CN114119831A (en) Snow accumulation model rendering method and device, electronic equipment and readable medium
CN112907741B (en) Terrain scene generation method and device, electronic equipment and storage medium
US20130194263A1 (en) Three-dimensional image display device and three-dimensional image display program
CN113706543A (en) Three-dimensional pose construction method and equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination