Distance detection methods and devices, electronic equipment, storage media

By determining the model outline and positional geometry data of the spherical surface model, the target distance between the spherical surface model and the virtual object model is calculated, solving the problem of low detection efficiency in existing technologies and achieving high-efficiency detection results.

CN116531762BActive Publication Date: 2026-04-03NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-15
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, the detection efficiency is low when detecting virtual objects on a spherical surface model.

Method used

By providing a distance detection method, the model outline of a spherical surface model is determined, and the positional geometry data is determined based on the detection ray and the model outline, including the grid information in the height map plane of the spherical surface model and the step distance of the terrain surface, and then the target distance between the spherical surface model and the virtual object model is calculated.

Benefits of technology

It improves the detection efficiency of spherical surface models, saves detection costs, and enables real-time calculation of target distance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116531762B_ABST
    Figure CN116531762B_ABST
Patent Text Reader

Abstract

This disclosure provides a distance detection method, apparatus, electronic device, and storage medium, relating to the field of game simulation technology. The distance detection method includes: determining the model outline of a spherical surface model; determining positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical surface model and the step distance of the terrain surface of the spherical surface model; and determining the target distance between the spherical surface model and a virtual object model based on the positional geometric data. The technical solution of this disclosure can solve the problem of low detection efficiency when detecting virtual objects on a spherical surface model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of game simulation technology, and more specifically, to a distance detection method, a distance detection device, an electronic device, and a computer-readable storage medium. Background Technology

[0002] As games evolve, players demand more realistic terrain and gameplay. Since the Earth is an oblate spheroid, the need for spherical terrain provides players with more realistic environments and gameplay options. Collision detection between objects or characters on the sphere and the terrain is a fundamental requirement, such as when a character walks on the sphere.

[0003] Currently, various physics libraries offer a triangle facet type that can meet the most basic requirements for spherical terrain. However, this triangle facet type has drawbacks such as the need to store arrays of vertices and indices in real time, as well as a tree structure, leading to low detection efficiency.

[0004] There is currently no solution to the problem of low detection efficiency when detecting virtual objects on spherical surface models in related technologies.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] The purpose of this disclosure is to provide a distance detection method, a distance detection device, an electronic device, and a computer-readable storage medium, thereby overcoming, to at least some extent, the problem of low detection efficiency when detecting virtual objects on a spherical surface model.

[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part by practice of this disclosure.

[0008] According to a first aspect of the present disclosure, a distance detection method is provided, comprising: providing a spherical surface model and a virtual object model in a virtual scene, and a detection ray emitted by the virtual object model; determining the model outline of the spherical surface model; determining positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical surface model and the step distance of the terrain surface of the spherical surface model; and determining the target distance between the spherical surface model and the virtual object model based on the positional geometric data.

[0009] In some example embodiments of this disclosure, based on the foregoing scheme, the model outline includes bounding box information. Determining positional geometry data based on the detection ray and the model outline includes: obtaining the center position of the spherical surface model; determining grid information in the height map plane of the spherical surface model based on the bounding box information and the center position, wherein the grid vertex values ​​in the grid information are used to identify the height of the spherical surface model; determining the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information; and determining positional geometry data based on the grid information and the step distance.

[0010] In some example embodiments of this disclosure, before determining the grid information in the height map plane of the spherical surface model based on the bounding box information and the sphere center position according to the foregoing scheme, the method further includes: determining the bounding box intersection point of the detection ray with the bounding box information in the ray direction, wherein the bounding box intersection point includes: a first intersection point and a second intersection point, and respectively determining a first line segment between the first intersection point and the sphere center position, and a second line segment between the second intersection point and the sphere center position.

[0011] In some example embodiments of this disclosure, based on the foregoing scheme, determining the grid information in the heightmap plane of the spherical surface model according to the bounding box information and the sphere center position includes: determining the intersection points of the first line segment and the second line segment with the heightmap on the heightmap plane, wherein the heightmap intersection points include: the third intersection point and the fourth intersection point; determining the planar range of the heightmap plane according to the heightmap intersection points; calculating the slope of the line segment between the third intersection point and the fourth intersection point; and traversing the grid information in the heightmap plane according to the line segment slope and the planar range.

[0012] In some example embodiments of this disclosure, based on the foregoing scheme, determining the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model according to the grid information includes: determining the grid step point in the grid information; determining the ray step point according to the grid step point, the sphere center position, the first intersection point, and the second intersection point; determining the line segment length between the ray step point and the sphere center position; and determining the step distance according to the line segment length and the sphere radius of the spherical surface model.

[0013] In some example embodiments of this disclosure, based on the aforementioned scheme, determining the ray stepping point according to the grid stepping point, the sphere center position, the first intersection point, and the second intersection point includes: connecting the grid stepping point and the sphere center position to obtain a grid stepping line segment; connecting the first intersection point and the second intersection point to obtain a planar line segment; and determining the ray stepping point according to the grid stepping line segment and the planar line segment.

[0014] In some example embodiments of this disclosure, based on the foregoing scheme, determining the target distance between the spherical surface model and the virtual object model based on location geometry data includes: obtaining grid vertex values; if a data intersection is detected between the step distance and the grid vertex values, converting the grid vertex values ​​into ground distance values ​​of the terrain surface; and determining the target distance between the detection ray and the terrain surface based on the ground distance values.

[0015] In some example embodiments of this disclosure, based on the foregoing scheme, determining the target distance between the detection ray and the terrain surface according to the ground distance value includes: determining the sphere vertex information on the terrain surface based on the ground distance value; determining the target triangle based on the sphere vertex information; and determining the target distance through the target triangle and the detection ray.

[0016] According to a second aspect of the present disclosure, a distance detection device is provided, comprising: providing a spherical surface model and a virtual object model in a virtual scene, and a detection ray emitted by the virtual object model; a first determining unit for determining the model outline of the spherical surface model; a second determining unit for determining positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical surface model and the step distance of the terrain surface of the spherical surface model; and a third determining unit for determining a target distance between the spherical surface model and the virtual object model based on the positional geometric data.

[0017] According to a third aspect of the present disclosure, an electronic device is provided, including: a processor; and a memory storing computer-readable instructions, which, when executed by the processor, implement the distance detection method described above.

[0018] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements a distance detection method according to any one of the above.

[0019] The technical solutions provided in this disclosure can include the following beneficial effects:

[0020] The distance detection method in the example embodiments of this disclosure includes: determining the model outline of a spherical terrain model; determining positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical terrain model and the step distance of the terrain surface of the spherical terrain model; and determining the target distance between the spherical terrain model and the virtual object model based on the positional geometric data. On the one hand, determining the positional geometric data based on the detection ray and the model outline can obtain physical simulation data between the virtual object model and the model outline; on the other hand, the target distance can be calculated in real time based on the physical simulation data, saving the detection cost of spherical terrain while improving detection efficiency.

[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0023] Figure 1 A schematic diagram of an exemplary system architecture for applying the present disclosure of a distance detection method and apparatus is shown in an exemplary embodiment;

[0024] Figure 2 A schematic diagram of a distance detection method according to some embodiments of the present disclosure is shown;

[0025] Figure 3 A schematic diagram of a spherical profile model according to some embodiments of the present disclosure is shown;

[0026] Figure 4 A schematic diagram illustrating ray detection according to some embodiments of the present disclosure is shown.

[0027] Figure 5 A schematic diagram of a distance detection device according to some embodiments of the present disclosure is shown;

[0028] Figure 6 The schematic diagram illustrates the structural schematic of a computer system of an electronic device according to some embodiments of the present disclosure.

[0029] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation

[0030] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented 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 more thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art.

[0031] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0032] Furthermore, the accompanying drawings are for illustrative purposes only and are not necessarily drawn to scale. The block diagrams shown in the drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0033] Figure 1 A schematic diagram of an exemplary system architecture for a distance detection method and apparatus to which embodiments of the present disclosure can be applied is shown.

[0034] like Figure 1 As shown, system architecture 100 may include one or more of terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables. Terminal devices 101, 102, and 103 may be various electronic devices with displays, including but not limited to desktop computers, laptops, smartphones, and tablets. It should be understood that... Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, there can be any number of terminal devices, networks, and servers. For example, server 105 could be a server cluster composed of multiple servers.

[0035] The distance detection method provided in this embodiment can be executed by terminal devices 101, 102, and 103, and correspondingly, the distance detection device can also be disposed in terminal devices 101, 102, and 103. The distance detection method provided in this embodiment can also be executed jointly by terminal devices 101, 102, and 103 and server 105, and correspondingly, the distance detection device can be disposed in terminal devices 101, 102, and 103 and server 105. Furthermore, the distance detection method provided in this embodiment can also be executed by server 105, and correspondingly, the distance detection device can be disposed in server 105; this exemplary embodiment does not impose any special limitations on this.

[0036] For example, in this example implementation, the model outline of the spherical surface model can be obtained from the server 105 deployed on the game platform; then, positional geometry data is determined based on the detection ray and the model outline, and the target distance between the spherical surface model and the virtual object model is determined based on the positional geometry data.

[0037] However, those skilled in the art will readily understand that the above operations are merely illustrative and are not intended to limit the scope of this exemplary embodiment.

[0038] In one embodiment of this disclosure, the distance detection method can run on a terminal device or a server. The following description uses the execution of the distance detection method in this disclosure on a server as an example. Figure 2 A schematic diagram of a distance detection method according to some embodiments of the present disclosure is shown.

[0039] refer to Figure 2 As shown, the distance detection method may include the following steps:

[0040] Step S210 provides a spherical surface model and a virtual object model in the virtual scene, as well as a detection ray emitted by the virtual object model, specifically including: determining the model outline of the spherical surface model.

[0041] Among them, the spherical surface model can be as follows: Figure 3 The terrain model shown can be a virtual object model, such as a character model, vegetation model, or object model built on top of the terrain model. During the development phase of the virtual environment, detection rays typically emanate from the bottom of the virtual object model and strike the spherical terrain model. The outline of the spherical terrain model can be obtained through mathematical calculations, specifically including regular outline information and irregular outline information. Regular outline information can be, for example,... Figure 4 The bounding box information shown is, but not limited to, as indicated. Figure 4 The bounding box information is shown below. This disclosure is further described in detail with reference to the bounding box information illustrated in Example 4.

[0042] Step S220: Determine the positional geometry data based on the detection ray and the model outline. The positional geometry data includes: grid information in the height map plane of the spherical surface model and the step distance of the terrain surface of the spherical surface model.

[0043] The location geometry data can be obtained from the intersection line when the relative positions of surfaces intersect, or from the intersection point when the relative positions of lines intersect, or it can be determined by the spatial geometric relationship between points, lines, and surfaces. Specifically, the location geometry data can be the height data value of each point on the surface of the spherical terrain model, that is, the grid information in the height map plane of this disclosure. The grid information can be composed of 4*4 grids or 8*8 grids, and this disclosure does not limit it. In addition, the step distance in the location geometry data is the distance further determined by detecting the spatial geometric relationship between the ray emission point and the surface of the spherical terrain model. In other words, the step distance refers to the distance between the detection ray and the terrain surface of the spherical terrain model.

[0044] Specifically, the steps for determining the positional geometry data based on the detection rays and model contours can be represented as follows: Obtain the center position of the spherical surface model; determine the grid information in the height map plane of the spherical surface model based on the bounding box information and the center position, wherein the grid vertex values ​​in the grid information are used to identify the height of the spherical surface model; determine the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information; determine the positional geometry data based on the grid information and the step distance.

[0045] For example, the center of the ball could be Figure 4 The center O of the sphere is represented in the bounding box. Based on the geometric relationship between the point, line, and surface information of the bounding box and the center O, the grid information in the height map plane is obtained. The grid information contains the height of the spherical surface model. The ray stepping points on the detection rays can be obtained as follows: Figure 4 As shown by point B in the diagram, the step distance can be the distance from point B. Figure 4 The distance to the terrain surface of the medium spherical surface model, where the ray step point represents the point of the ray calculated based on the spatial geometric relationship of the grid point when the grid point closest to the grid vertex in the current grid information exists.

[0046] Specifically, before determining the grid information in the height map plane of the spherical surface model based on the bounding box information and the sphere center position, the following steps are required to obtain the first intersection point, the second intersection point, the first line segment, and the second line segment: determine the bounding box intersection point of the detection ray with the bounding box information in the ray direction, wherein the bounding box intersection point includes: the first intersection point and the second intersection point; determine the first line segment between the first intersection point and the sphere center position, and the second line segment between the second intersection point and the sphere center position, respectively.

[0047] For example, such as Figure 4 As shown, a detection ray is emitted, and the intersection of the detection ray with the bounding box yields points A (corresponding to the first intersection) and C (corresponding to the second intersection). Connecting the center point O of the sphere with point A yields line segment OA as the first line segment, and connecting the center point O of the sphere with point C yields line segment OC as the second line segment.

[0048] Specifically, the above-mentioned determination of the grid information in the heightmap plane of the spherical surface model based on the bounding box information and the sphere center position can be achieved through the following steps: determining the intersection points of the first and second line segments with the heightmap on the heightmap plane, wherein the heightmap intersection points include: the third intersection point and the fourth intersection point; determining the planar range of the heightmap plane based on the heightmap intersection points; calculating the slope of the line segment between the third and fourth intersection points; and traversing the grid information in the heightmap plane based on the line segment slope and the planar range.

[0049] For example, Figure 4 The OA and OC line segments are intersected with the height map plane. If the height map plane is located on the bottom surface of the bounding box, the intersection points of the plane are point C (corresponding to the third intersection point) and point D (corresponding to the fourth intersection point). Connecting point C and point D yields line segment CD. The horizontal and vertical values ​​of line segment CD are determined, thereby obtaining the aforementioned plane range. Based on the plane range and the slope of line segment CD, the grid cells where line segment CD intersects with the height map are traversed to further obtain the grid information in this disclosure.

[0050] Specifically, the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model, as determined by the grid information, can be obtained through the following steps: determine the grid step point in the grid information; determine the ray step point based on the grid step point, the sphere center position, the first intersection point, and the second intersection point; determine the line segment length between the ray step point and the sphere center position; and determine the step distance based on the line segment length and the sphere radius of the spherical surface model.

[0051] For example, a grid step point refers to the grid point that is closest to a grid vertex in the current grid information, such as... Figure 4 As shown, assuming the current grid step point is E, the ray step point B is obtained based on points E, C, A, and O. The ray step point B is connected to the center point O of the sphere to obtain the line segment OB. The length of the line segment OB is calculated, and the radius of the sphere is subtracted from the length of the line segment OB to obtain the height of the step point B on the sphere (corresponding to the step distance).

[0052] The specific process for solving the ray stepping point includes the following steps: connecting the grid stepping point with the center of the sphere to obtain the grid stepping line segment; connecting the first intersection point with the second intersection point to obtain the planar line segment; and determining the ray stepping point based on the grid stepping line segment and the planar line segment.

[0053] For example, such as Figure 4 As shown, assuming the current cell's step point is E, the intersection point B is obtained from CA (planar line segment) and OE (grid step line segment). The position of B is the step point on the ray.

[0054] Step S230: Determine the target distance between the spherical surface model and the virtual object model based on the location geometry data.

[0055] For example, the target distance can be the distance between a virtual character object and the terrain surface of a spherical landform model, or it can be the distance between other virtual object models and the terrain surface of a spherical landform model. This disclosure and this embodiment do not limit the distance.

[0056] Specifically, determining the target distance between the spherical surface model and the virtual object model based on location geometry data is achieved through the following steps: obtaining grid vertex values; if an intersection between the step distance and the grid vertex values ​​is detected, converting the grid vertex values ​​into ground distance values ​​of the terrain surface; and determining the target distance between the detection ray and the terrain surface based on the ground distance values.

[0057] For example, such as Figure 4 As shown, if the height values ​​of the four vertices corresponding to the current point E are (0m, 10m, 50m, 100m) and the step distance is 30m, then it is determined that there is a data intersection between the step distance and the grid vertex values. Then, the height values ​​of the four vertices corresponding to the current point E (0m, 10m, 50m, 100m) are respectively added to the sphere radius and converted into ground distance values ​​of the terrain surface.

[0058] Next, the target distance between the detection ray and the terrain surface is determined based on the ground distance value. The specific steps include: determining the vertex information of the sphere on the terrain surface based on the ground distance value; determining the target triangle based on the vertex information of the sphere; and determining the target distance by comparing the target triangle with the detection ray.

[0059] For example, the four vertices mentioned above are converted into four spherical vertex values ​​of the terrain surface based on the ground distance value. Two triangular faces are determined based on the four spherical vertices. The intersection point of the detection ray and the two triangular faces formed by the four vertices is determined. Based on the distance between the intersection points, the target distance in this disclosure is further obtained. This disclosure greatly improves the detection efficiency of spherical terrain by storing the four vertices of the grid and using them for ray detection of target distance.

[0060] In summary, the distance detection method in the example embodiments of this disclosure includes: determining the model outline of a spherical terrain model; determining positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical terrain model and the step distance of the terrain surface of the spherical terrain model; and determining the target distance between the spherical terrain model and the virtual object model based on the positional geometric data. On the one hand, determining the positional geometric data based on the detection ray and the model outline can obtain the physical simulation data between the virtual object model and the model outline; on the other hand, the target distance can be calculated in real time based on the physical simulation data, saving the detection cost of spherical terrain while improving detection efficiency.

[0061] It should be noted that although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0062] Furthermore, in this example embodiment, a distance detection device is provided. (Refer to...) Figure 5 As shown, the distance detection device 500 includes: a first determining unit 510, a second determining unit 520, and a third determining unit 530.

[0063] Specifically, the first determining unit 510 is used to determine the model outline of the spherical surface model;

[0064] The first determining unit 520 is used to determine positional geometric data based on the detection ray and the model outline. The positional geometric data includes: grid information in the height map plane of the spherical surface model and the step distance of the terrain surface of the spherical surface model.

[0065] The third determining unit 530 is used to determine the target distance between the spherical surface model and the virtual object model based on the location geometry data.

[0066] In summary, this example embodiment also provides a distance detection device. A first determining unit 510 determines the model outline of a spherical surface model; a second determining unit 520 determines positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical surface model and the step distance of the terrain surface of the spherical surface model; and a third determining unit 530 determines the target distance between the spherical surface model and the virtual object model based on the positional geometric data. On the one hand, determining the positional geometric data based on the detection ray and the model outline allows for the acquisition of physical simulation data between the virtual object model and the model outline; on the other hand, the target distance can be calculated in real time based on the physical simulation data, saving the detection cost of spherical terrain while improving detection efficiency.

[0067] In some example embodiments of this disclosure, based on the foregoing scheme, the model outline includes bounding box information, and the second determining unit 520 includes: a first acquisition subunit, used to acquire the center position of the spherical surface model, and determine the grid information in the height map plane of the spherical surface model based on the bounding box information and the center position, wherein the grid vertex values ​​in the grid information are used to identify the height of the spherical surface model; a first determining subunit, used to determine the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information; and a second determining subunit, used to determine the positional geometry data based on the grid information and the step distance.

[0068] In some example embodiments of this disclosure, based on the foregoing scheme, the apparatus further includes: a fourth determining unit, configured to determine the bounding box intersection point of the detection ray with the bounding box information in the ray direction before determining the grid information in the height map plane of the spherical surface model based on the bounding box information and the center position of the sphere, wherein the bounding box intersection point includes: a first intersection point and a second intersection point; the fourth determining unit is configured to determine the first line segment between the first intersection point and the center position of the sphere, and the second line segment between the second intersection point and the center position of the sphere, respectively.

[0069] In some example embodiments of this disclosure, based on the foregoing scheme, the first acquisition subunit includes: a first determining module, used to determine the intersection points of the first line segment and the second line segment with the height map on the height map plane, wherein the height map intersection points include: a third intersection point and a fourth intersection point; a second determining module, used to determine the planar range of the height map plane based on the height map intersection points; and a calculation module, used to calculate the slope of the line segment between the third intersection point and the fourth intersection point, and traverse the grid information in the height map plane based on the line segment slope and the planar range.

[0070] In some example embodiments of this disclosure, based on the foregoing scheme, the first determining subunit includes: a third determining module for determining the grid step point in the grid information; a fourth determining module for determining the ray step point based on the grid step point, the sphere center position, the first intersection point, and the second intersection point; a fifth determining module for determining the line segment length between the ray step point and the sphere center position; and a sixth determining module for determining the step distance based on the line segment length and the sphere radius of the spherical surface model.

[0071] In some example embodiments of this disclosure, based on the foregoing scheme, the fourth determining module includes: a first connecting submodule, used to connect the grid stepping point with the center position of the sphere to obtain a grid stepping line segment; a second connecting submodule, used to connect the first intersection point with the second intersection point to obtain a planar line segment; and a determining submodule, used to determine the ray stepping point based on the grid stepping line segment and the planar line segment.

[0072] In some example embodiments of this disclosure, based on the foregoing scheme, the third determining unit 530 includes: a second acquiring subunit for acquiring grid vertex values; a conversion subunit for converting grid vertex values ​​into ground distance values ​​of the terrain surface if a data intersection is detected between the step distance and the grid vertex values; and a third determining subunit for determining the target distance between the detection ray and the terrain surface based on the ground distance values.

[0073] In some example embodiments of this disclosure, based on the foregoing scheme, the third determining subunit includes: a seventh determining module, used to determine the sphere vertex information on the terrain surface based on the ground distance value; an eighth determining module, used to determine the target triangle based on the sphere vertex information; and a ninth determining module, used to determine the target distance through the target triangle and the detection ray.

[0074] The specific details of each module of the aforementioned medium-distance detection device have been described in detail in the corresponding distance detection methods, so they will not be repeated here.

[0075] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0076] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0077] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0078] In exemplary embodiments of this disclosure, a computer storage medium capable of implementing the above-described methods is also provided. It stores a program product capable of implementing the methods described in this specification. In some possible embodiments, various aspects of this disclosure can also be implemented as a program product comprising program code. When the program product is run on a terminal device, the program code causes the terminal device to execute the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the following steps can be performed: providing a spherical surface model and a virtual object model in a virtual scene, and a detection ray emitted by the virtual object model; determining the model outline of the spherical surface model; determining positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical surface model, and the step distance of the terrain surface of the spherical surface model; determining the target distance between the spherical surface model and the virtual object model based on the positional geometric data.

[0079] In one optional implementation, the model outline includes bounding box information. Determining positional geometry based on the detection ray and the model outline includes: obtaining the center position of the spherical surface model; determining grid information in the height map plane of the spherical surface model based on the bounding box information and the center position, wherein the grid vertex values ​​in the grid information are used to identify the height of the spherical surface model; determining the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information; and determining positional geometry based on the grid information and the step distance.

[0080] In one optional implementation, before determining the grid information in the heightmap plane of the spherical surface model based on the bounding box information and the sphere center position, the method further includes: determining the bounding box intersection point of the detection ray with the bounding box information in the ray direction, wherein the bounding box intersection point includes: a first intersection point and a second intersection point, and respectively determining a first line segment between the first intersection point and the sphere center position, and a second line segment between the second intersection point and the sphere center position.

[0081] In one optional implementation, determining the grid information in the heightmap plane of the spherical surface model based on the bounding box information and the sphere center position includes: determining the intersection points of a first line segment and a second line segment with the heightmap on the heightmap plane, wherein the heightmap intersection points include a third intersection point and a fourth intersection point; determining the planar range of the heightmap plane based on the heightmap intersection points; calculating the slope of the line segment between the third intersection point and the fourth intersection point; and traversing the grid information in the heightmap plane based on the line segment slope and the planar range.

[0082] In one optional implementation, determining the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information includes: determining the grid step point in the grid information; determining the ray step point based on the grid step point, the sphere center position, the first intersection point, and the second intersection point; determining the line segment length between the ray step point and the sphere center position; and determining the step distance based on the line segment length and the sphere radius of the spherical surface model.

[0083] In one optional implementation, determining the ray stepping point based on the grid stepping point, the sphere center position, the first intersection point, and the second intersection point includes: connecting the grid stepping point with the sphere center position to obtain a grid stepping line segment; connecting the first intersection point with the second intersection point to obtain a planar line segment; and determining the ray stepping point based on the grid stepping line segment and the planar line segment.

[0084] In one alternative implementation, determining the target distance between the spherical surface model and the virtual object model based on location geometry data includes: acquiring grid vertex values; if a data intersection is detected between the step distance and the grid vertex values, converting the grid vertex values ​​into ground distance values ​​of the terrain surface; and determining the target distance between the detection ray and the terrain surface based on the ground distance values.

[0085] In one optional implementation, determining the target distance between the detection ray and the terrain surface based on the ground distance value includes: determining sphere vertex information on the terrain surface based on the ground distance value; determining a target triangular facet based on the sphere vertex information; and determining the target distance between the target triangular facet and the detection ray.

[0086] In an optional embodiment, the present disclosure may further include a program product for implementing the above-described methods. This program product may be a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0087] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, 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), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0088] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0089] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0090] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0091] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.

[0092] Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”

[0093] The following reference Figure 6 To describe an electronic device 600 according to such an embodiment of the present disclosure. Figure 6 The electronic device 600 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0094] like Figure 6 As shown, the electronic device 600 is manifested in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including storage unit 620 and processing unit 610), and a display unit 640.

[0095] The storage unit stores program code, which can be executed by the processing unit 610 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 610 can perform the following steps: providing a spherical surface model and a virtual object model in a virtual scene, as well as a detection ray emitted by the virtual object model; determining the model outline of the spherical surface model; determining positional geometric data based on the detection ray and the model outline, wherein the positional geometric data includes: grid information in the heightmap plane of the spherical surface model, and the step distance of the terrain surface of the spherical surface model; and determining the target distance between the spherical surface model and the virtual object model based on the positional geometric data.

[0096] In one optional implementation, the model outline includes bounding box information. Determining positional geometry based on the detection ray and the model outline includes: obtaining the center position of the spherical surface model; determining grid information in the height map plane of the spherical surface model based on the bounding box information and the center position, wherein the grid vertex values ​​in the grid information are used to identify the height of the spherical surface model; determining the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information; and determining positional geometry based on the grid information and the step distance.

[0097] In one optional implementation, before determining the grid information in the heightmap plane of the spherical surface model based on the bounding box information and the sphere center position, the method further includes: determining the bounding box intersection point of the detection ray with the bounding box information in the ray direction, wherein the bounding box intersection point includes: a first intersection point and a second intersection point, and respectively determining a first line segment between the first intersection point and the sphere center position, and a second line segment between the second intersection point and the sphere center position.

[0098] In one optional implementation, determining the grid information in the heightmap plane of the spherical surface model based on the bounding box information and the sphere center position includes: determining the intersection points of a first line segment and a second line segment with the heightmap on the heightmap plane, wherein the heightmap intersection points include a third intersection point and a fourth intersection point; determining the planar range of the heightmap plane based on the heightmap intersection points; calculating the slope of the line segment between the third intersection point and the fourth intersection point; and traversing the grid information in the heightmap plane based on the line segment slope and the planar range.

[0099] In one optional implementation, determining the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information includes: determining the grid step point in the grid information; determining the ray step point based on the grid step point, the sphere center position, the first intersection point, and the second intersection point; determining the line segment length between the ray step point and the sphere center position; and determining the step distance based on the line segment length and the sphere radius of the spherical surface model.

[0100] In one optional implementation, determining the ray stepping point based on the grid stepping point, the sphere center position, the first intersection point, and the second intersection point includes: connecting the grid stepping point with the sphere center position to obtain a grid stepping line segment; connecting the first intersection point with the second intersection point to obtain a planar line segment; and determining the ray stepping point based on the grid stepping line segment and the planar line segment.

[0101] In one alternative implementation, determining the target distance between the spherical surface model and the virtual object model based on location geometry data includes: acquiring grid vertex values; if a data intersection is detected between the step distance and the grid vertex values, converting the grid vertex values ​​into ground distance values ​​of the terrain surface; and determining the target distance between the detection ray and the terrain surface based on the ground distance values.

[0102] In one optional implementation, determining the target distance between the detection ray and the terrain surface based on the ground distance value includes: determining sphere vertex information on the terrain surface based on the ground distance value; determining a target triangular facet based on the sphere vertex information; and determining the target distance between the target triangular facet and the detection ray.

[0103] Storage unit 620 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include a read-only memory (ROM) 6203.

[0104] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0105] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0106] Electronic device 600 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. As shown, network adapter 660 communicates with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0107] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0108] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0109] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

Claims

1. A distance detection method, characterized in that, The method includes providing a spherical surface model and a virtual object model in a virtual scene, as well as a detection ray emitted by the virtual object model, the method comprising: Determine the model outline of the spherical surface model; The positional geometry data is determined based on the detection ray and the model contour, wherein the positional geometry data includes: grid information in the height map plane of the spherical surface model, and the step distance of the terrain surface of the spherical surface model; the step distance is the distance between the detection ray and the terrain surface of the spherical surface model; The target distance between the spherical surface model and the virtual object model is determined based on the location geometry data.

2. The method according to claim 1, characterized in that, The model contour includes bounding box information, and positional geometry data is determined based on the detection ray and the model contour, including: Obtain the center position of the spherical surface model, and determine the grid information in the height map plane of the spherical surface model based on the bounding box information and the center position, wherein the grid vertex values ​​in the grid information are used to identify the height of the spherical surface model; The step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model is determined based on the grid information. The positional geometry data is determined based on the grid information and the step distance.

3. The method according to claim 2, characterized in that, Before determining the grid information in the heightmap plane of the spherical surface model based on the bounding box information and the sphere center position, the method further includes: The intersection points of the detection ray with the bounding box information in the ray direction are determined, wherein the bounding box intersection points include: a first intersection point and a second intersection point. Determine the first line segment between the first intersection point and the center of the sphere, and the second line segment between the second intersection point and the center of the sphere.

4. The method according to claim 3, characterized in that, Determining the grid information in the heightmap plane of the spherical surface model based on the bounding box information and the sphere center position includes: The intersection points of the first line segment and the second line segment with the height map on the height map plane are determined respectively, wherein the height map intersection points include: a third intersection point and a fourth intersection point; The planar range of the height map plane is determined based on the intersection points of the height maps; Calculate the slope of the line segment between the third intersection point and the fourth intersection point, and traverse the grid information in the height map plane based on the slope of the line segment and the plane range.

5. The method according to claim 3, characterized in that, Determining the step distance between the ray step point on the detection ray and the terrain surface of the spherical surface model based on the grid information includes: Determine the grid step points in the grid information; The ray stepping point is determined based on the grid stepping point, the sphere center position, the first intersection point, and the second intersection point; Determine the length of the line segment between the ray stepping point and the center of the sphere; The step distance is determined based on the length of the line segment and the radius of the sphere of the spherical surface model.

6. The method according to claim 5, characterized in that, The ray stepping point is determined based on the grid stepping point, the sphere center position, the first intersection point, and the second intersection point, including: Connect the grid step point to the center of the sphere to obtain the grid step line segment; Connect the first intersection point and the second intersection point to obtain the line segment in the plan view; The ray stepping point is determined based on the grid stepping line segment and the planar line segment.

7. The method according to claim 2, characterized in that, Determining the target distance between the spherical surface model and the virtual object model based on the location geometry data includes: Obtain the grid vertex values; If a data intersection is detected between the step distance and the grid vertex value, the grid vertex value is converted into a ground distance value of the terrain surface; The target distance between the detection ray and the terrain surface is determined based on the ground distance value.

8. The method according to claim 7, characterized in that, Determining the target distance between the detection ray and the terrain surface based on the ground distance value includes: The sphere vertex information on the terrain surface is determined based on the ground distance value; The target triangular face is determined based on the sphere vertex information; The target distance is determined by the target triangle and the detection ray.

9. A distance detection device, characterized in that, The device provides a spherical surface model and a virtual object model in a virtual scene, as well as a detection ray emitted by the virtual object model. The device includes: The first determining unit is used to determine the model outline of the spherical surface model, wherein the model outline includes bounding box information; The second determining unit is used to determine positional geometric data based on the detection ray and the model contour, wherein the positional geometric data includes: grid information in the height map plane of the spherical surface model and the step distance of the terrain surface of the spherical surface model; the step distance is the distance between the detection ray and the terrain surface of the spherical surface model; The third determining unit is used to determine the target distance between the spherical surface model and the virtual object model based on the location geometry data.

10. An electronic device, characterized in that, include: processor; as well as A memory storing computer-readable instructions that, when executed by the processor, implement the distance detection method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the distance detection method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Distance measurement method and device, electronic equipment and storage medium

    CN113899333A

  • Method and device for determining light source information of virtual light source

    CN114332203A