Method and device for estimating patch shielding rate in game scene, electronic equipment, storage medium and program product
By generating multi-layered circular virtual probe rays in the game scene and representing the area of local occlusion regions, the problem of high complexity in occlusion rate estimation is solved, achieving fast and accurate occlusion rate calculation, and improving rendering efficiency and frame rate stability.
Patent Information
- Application Number
- CN202511762875.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-06
AI Technical Summary
Existing occlusion estimation methods are computationally complex, leading to performance bottlenecks, especially in complex game scenes, and affecting frame time stability.
The method generates virtual probe rays that are distributed in multiple circular layers around the center of the target patch and are uniformly pointed at the virtual camera. The rays are traversed in both indexed order and reverse order to perform intersection detection, construct sectors, and calculate the occlusion rate.
It reduces computational complexity, enables fast and accurate occlusion estimation, and improves rendering efficiency and frame rate stability in game scenes.
Smart Images

Figure CN121616737A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game technology, and more specifically, to a method, apparatus, electronic device, storage medium, and program product for estimating the occlusion rate of facets in a game scene. Background Technology
[0002] In modern real-time rendering applications, especially in 3D game scenes, occlusion culling is one of the key technologies for improving graphics rendering efficiency. In these applications, calculating the occlusion rate of an object or geometric primitive (such as a facet), i.e., the degree to which it is occluded by other foreground objects, is crucial for achieving efficient dynamic detail control and power management. For example, in lighting effects, by calculating the occlusion rate of surrounding objects within the default effective range of a light source and adjusting the light brightness and actual effective range accordingly, GPU resources can be significantly saved and frame rate stability improved.
[0003] The commonly used method for estimating occlusion rate in existing technologies involves emitting a set of rays from the surface of the area to be tested towards the virtual camera, counting the number of rays that successfully reach the camera's field of view without being blocked by other objects in the scene, and taking the ratio of the number of unobstructed rays to the total number of rays as the occlusion rate of the area. However, this method leads to a linear increase in computational overhead with the number of rays. Moreover, in complex game scenes, when facing a large number of dynamic objects or densely polygonal regions, this ray-by-ray, full-scene traversal detection method can cause serious performance bottlenecks, affecting frame rate stability and even causing stuttering.
[0004] Therefore, a low-complexity, fast and accurate occlusion rate estimation scheme is urgently needed, which is a technical problem that needs to be solved. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a method, device, electronic device, storage medium and program product for estimating the occlusion rate of facets in a game scene, which can quickly and accurately estimate the occlusion rate of facets and reduce computational complexity.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows: In a first aspect, the present invention provides a method for estimating the occlusion rate of a surface in a game scene. The method includes: generating multiple layers of circularly distributed virtual probe rays around the center of a target surface; wherein each layer of virtual probe rays is uniformly distributed on the corresponding circle; each virtual probe ray points to a virtual camera; for each layer of virtual probe rays, traversing each virtual probe ray along the index sequence direction and the reverse direction respectively, and performing intersection detection with geometric objects in the scene on each virtual probe ray, recording the first occluded target virtual probe ray; constructing sectors based on the target virtual probe rays detected in each layer of virtual probe rays and determining the sector area; and using the ratio between the accumulated sum of all sector surfaces and the area corresponding to the largest radius circle as the occlusion rate of the target surface.
[0007] Secondly, the present invention provides a device for estimating the occlusion rate of a surface in a game scene, comprising: a generation module for generating multiple layers of circularly distributed virtual probe rays distributed around the center of a target surface; wherein each layer of virtual probe rays is uniformly distributed on the corresponding circle; each virtual probe ray points to a virtual camera; a detection module for traversing each virtual probe ray along the index sequence direction and the reverse direction for each layer of virtual probe rays, and performing intersection detection with geometric objects in the scene for each virtual probe ray, and recording the first occluded target virtual probe ray; an estimation module for constructing sectors based on the target virtual probe rays detected in each layer of virtual probe rays and determining the sector area; the estimation module is further configured to use the ratio between the accumulated sum of all sector surfaces and the area corresponding to the largest radius circle as the occlusion rate of the target surface.
[0008] Thirdly, the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the method for estimating the occlusion rate of a surface in a game scene as described in any of the foregoing embodiments.
[0009] Fourthly, the present invention provides a storage medium storing a computer program thereon, wherein the machine-executable instructions, when executed by a processor, implement the method for estimating the occlusion rate of a face in a game scene as described in any of the foregoing embodiments.
[0010] Fifthly, the present invention provides a program product on which machine-executable instructions are executed, and when the machine-executable instructions are executed by a processor, the method for estimating the occlusion rate of a surface in a game scene as described in any of the foregoing embodiments is implemented.
[0011] The present invention provides a method, apparatus, electronic device, storage medium, and program product for estimating the occlusion rate of a surface in a game scene. The method includes: generating multiple layers of circularly distributed virtual probe rays around the center of a target surface. Each layer of virtual probe rays is evenly distributed on its corresponding circle, ensuring the balance of the sampling direction. Each virtual probe ray points to a virtual camera, ensuring that the detection direction is consistent with the actual line of sight, thereby accurately reflecting the occlusion situation. For each layer of virtual probe rays, traverse along the index order and reverse order and perform intersection detection with geometric objects in the scene. This enables bidirectional and rapid location of the first occluded virtual probe ray, avoiding full detection and significantly reducing computational complexity. Based on the first occluded virtual probe ray detected in each layer, construct an occlusion sector and determine its corresponding sector area. Use the area of the layered local occlusion region to characterize the degree of local occlusion. Finally, sum the sector areas of all layers and compare them with the total area bounded by the circle with the largest radius to obtain the overall occlusion rate. This ratio comprehensively reflects the occlusion distribution characteristics under multi-layer sampling, achieving the technical effect of quickly and accurately estimating the surface occlusion rate while reducing computational load.
[0012] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0013] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 A schematic flowchart of the method for estimating the occlusion rate of facets in a game scene provided by an embodiment of the present invention is shown; Figure 2 A schematic diagram of a sector-shaped region provided in an embodiment of the present invention; Figure 3 This diagram illustrates the functional modules of the face occlusion rate estimation device in a game scene provided in an embodiment of the present invention. Figure 4 A structural block diagram of an electronic device provided in an embodiment of the present invention is shown. Detailed Implementation
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0016] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0017] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0018] First, let's introduce the relevant terminology used in the embodiments of this invention.
[0019] Patch: This mainly refers to the display of objects in the scene on the player's screen. Although the object displayed in the scene is a three-dimensional object, it is always displayed as a two-dimensional patch on the screen. Virtual camera: Used to display in-game footage on the player's screen in a manner similar to a camera shot.
[0020] During their research, the inventors discovered that conventional occlusion rate estimation methods use a plane as the starting point and the camera as the ending point, setting as many rays as possible. If the number of rays is n, and the number of objects that the rays first intersect with is the camera is m, then if the first object is the camera, it means there are no objects obstructing the path between the starting point of the current ray on the current plane and the camera. Therefore, the occlusion rate is m / n. In other words, the number of rays entering the camera represents the number of rays starting from multiple locations within the large area of the plane and ending in the direction of the camera, indicating that there are no objects obstructing the path. The accuracy of the occlusion rate is determined by the number of rays fired, and each ray must be calculated to determine whether it intersects with objects in the scene, resulting in significant computational overhead.
[0021] To address the aforementioned technical problems, this invention provides a method for estimating the occlusion rate of facets in a game scene. This method can uniformly divide facets using rays, determine the occlusion range by identifying the object where the rays first intersect, and then calculate the final occlusion rate. This reduces computational complexity and improves the efficiency of occlusion rate estimation.
[0022] Please see Figure 1 , Figure 1 A schematic flowchart of a method for estimating the occlusion rate of facets in a game scene provided by an embodiment of the present invention is shown. The execution subject of this method can be an electronic device, such as a PC. The method includes steps S101 to S104, as described below: S101: Generate a multi-layered circular distribution of virtual probe rays around the center of the target patch; wherein, each layer of virtual probe rays is uniformly distributed on the corresponding circle; each virtual probe ray points towards the virtual camera; S102: For each layer of virtual probe rays, traverse each virtual probe ray along the index order direction and the reverse direction respectively, and perform intersection detection with geometric objects in the scene for each virtual probe ray, and record the first occluded target virtual probe ray. S103: Construct sectors and determine sector areas based on the target virtual probe rays detected in each layer of virtual probe rays; S104: The ratio between the accumulated value of all sectors and the area corresponding to the circle with the largest radius is used as the occlusion rate of the target surface.
[0023] Unlike existing technologies, this invention first generates multiple layers of circularly distributed virtual probe rays around the center of the target patch. Each layer of virtual probe rays is evenly distributed on its corresponding circle, ensuring the uniformity of the sampling direction. Each virtual probe ray points towards the virtual camera, ensuring the detection direction aligns with the actual line of sight, thus accurately reflecting the occlusion situation. For each layer of virtual probe rays, it traverses along both the index sequence and reverse order, performing intersection detection with geometric objects in the scene. This enables bidirectional and rapid location of the first occluded virtual probe ray, avoiding full detection and significantly reducing computational complexity. Based on the first occluded virtual probe ray detected in each layer, an occlusion sector is constructed, and its corresponding sector area is determined. The area of the layered local occlusion region is used to characterize the degree of local occlusion. Finally, the sum of the sector areas of all layers is compared with the total area bounded by the circle with the largest radius to obtain the overall occlusion rate. This ratio comprehensively reflects the occlusion distribution characteristics under multi-layer sampling, achieving the technical effect of quickly and accurately estimating the patch occlusion rate while reducing computational load.
[0024] Next, the embodiments of the present invention will be described in conjunction with the relevant accompanying drawings. Figure 1 The occlusion rate estimation process shown in the image is explained and illustrated in detail.
[0025] In one embodiment of the present invention, step S101 aims to replace the traditional method of intersecting the entire patch, and instead adopt a layered, sparse but structured ray arrangement strategy to reduce the computational load of intersection detection.
[0026] In step S101 of this embodiment of the invention, the target patch can be the two-dimensional projection area on the screen of the object whose occlusion level needs to be calculated in the game. The center of the target patch refers to the geometric center (e.g., centroid or center point) of this two-dimensional patch. In this embodiment of the invention, this center point is used as the common center of all multi-layered circles.
[0027] In this embodiment of the invention, a series of concentric rings are constructed from the outside to the inside, with the center of the target surface as the center, forming a "ring"-shaped detection layout. Each layer corresponds to a specific radius, and the radii of each ring from the outside to the inside are denoted as L1, L2, L3, ..., L n And L1>L2>L3...>L n The virtual probe rays of each layer are evenly distributed on the corresponding circle, that is, on each circle with a radius of L. i A certain number (denoted as n) of rays are generated on the circle, numbered from 1 to n. These rays are not real physical rays, but mathematical rays used in the program to simulate line of sight or perform spatial queries; therefore, in this embodiment of the invention, they are called virtual probe rays. The starting points of these virtual probe rays are located on the circumference of the circle and are uniformly distributed, which means that the angular interval between the starting points of two adjacent rays is fixed.
[0028] In this embodiment of the invention, each virtual probe ray originates from its starting point on its corresponding circumference, and its endpoint (or direction) is the position of the virtual camera. The virtual camera is the camera that determines the player's current viewpoint and the position of the rendered image. Because it's necessary to determine whether the view from a point on the surface towards the camera is blocked by other objects, the function of the virtual probe ray is to detect whether there are obstacles, i.e., whether an intersection occurs, on the line connecting a point on the surface to the camera.
[0029] The step S101 provided in this embodiment of the invention adopts a differential sampling strategy, which is the basis for realizing the subsequent sector accumulation addition and is the key to the invention's ability to significantly reduce computational complexity and achieve controllable resource allocation.
[0030] In this embodiment of the invention, all concentric rings can use the same number of rays (e.g., 32 rays each); ray angle alignment (i.e., rays in the same direction are arranged radially in each layer) can construct a regular polar coordinate grid, facilitating subsequent surface accumulation. However, considering that the inner ring's circumference is very short and its spatial resolution is naturally higher, fewer rays are needed to represent the region; using too many rays would waste computational resources. Therefore, this embodiment of the invention can also proactively reduce the inner layer ray density to save costs without significantly affecting the final accuracy, i.e., using a high-density virtual probe ray distribution in the circular layers far from the center, and a low-density virtual probe ray distribution in the circular layers closer to the center.
[0031] In an optional implementation, to address the computational overhead caused by repeatedly generating multiple layers of circular probe rays, this embodiment of the invention also proposes an optimization scheme based on a pre-built template and coordinate scaling. Specifically, step S101 can be implemented according to steps a1 to a4 as follows: Step a1: Pre-establish a set of virtual probe light templates with different densities; In this embodiment of the invention, each virtual probe ray template corresponds to a set of emission directions evenly distributed on a circle, such as 8, 16, or 32 rays. These numbers determine the sampling density of the template on the circumference. These templates constitute a reusable template set, allowing the system to use them directly during operation.
[0032] Step a2: For each virtual probe ray template, calculate the starting position coordinates of each virtual probe ray in advance on a virtual ring of unit size.
[0033] In this embodiment of the invention, for each template (such as an 8-ray template), the standardized starting position coordinates of each virtual probe ray can be pre-calculated on a virtual annulus of unit radius (r=1). Since the rays are uniformly distributed on the circumference, these coordinates can be calculated at once using trigonometric functions and stored in memory or a resource file in the form of a data table. This achieves decoupling between calculation and use, avoiding repeated trigonometric calculations each time a new annulus is generated.
[0034] Step a3: When generating virtual probe rays of any radius, the starting position coordinates of the selected virtual probe ray template are scaled up proportionally based on the current radius to obtain the actual emission starting point coordinates of each virtual probe ray under the current radius; In this embodiment of the invention, when a virtual probe ray needs to be generated on a ring of arbitrary actual radius L, it is not necessary to recalculate its spatial coordinates. Instead, the standardized coordinates (x0, y0) per unit radius are directly retrieved from the pre-stored template, and the actual starting coordinates are obtained through simple scalar multiplication. This avoids repeatedly determining the starting coordinates, greatly reducing computational overhead.
[0035] For example, suppose we want to generate multiple uniformly distributed virtual probe rays on a circle with the center of the target patch as the center and a preset radius of L1. We can select a template (such as an 8-ray template) and then enlarge the starting position coordinates calculated under the template by the radius L1 to obtain multiple actual starting coordinates on the circle with a radius of L1.
[0036] Step a4: Using the actual launch point coordinates as the launch point of the virtual probe ray, generate a virtual probe ray with the current radius along the virtual camera position direction.
[0037] In this embodiment of the invention, after obtaining the actual emission starting point of each virtual probe ray, a direction vector pointing to the virtual camera position is constructed to form a complete virtual probe ray. Then, the subsequent process (such as S102) is performed to detect the intersection of the ray with scene objects and determine whether it is occluded.
[0038] Understandably, in step S101, a smaller uniform segmentation angle and a smaller radius result in more detailed division of the circular facets, leading to a more accurate occlusion rate calculation. Conversely, a larger segmentation angle and a larger radius result in fewer divisions, reducing the accuracy of the occlusion rate calculation. Since the ultimate goal of the game is performance, this design allows for dynamic adjustments to the segmentation design based on performance metrics, reducing the need for ray intersection detection with scene objects. Furthermore, the predictable performance of the segmentation design further improves algorithm efficiency, making it particularly suitable for dynamic scenes requiring frequent occlusion rate calculations.
[0039] Based on the above, the generation and detection of virtual detection rays in this embodiment of the invention can be implemented in two ways: The first implementation method: Pre-determine the center position of the target surface and the radii of the multiple rings (e.g., L1, L2, ..., L...). n Using a selected ray density template (e.g., 8, 16, or 32 rays evenly distributed per layer), the emission starting coordinates of all virtual probe rays on the circumference of each layer are calculated in one go. Then, using the determined starting coordinates of each layer as the starting point, the intersection detection operation in step S102 is performed sequentially on all rays in each layer. This method is suitable for scenarios with high real-time requirements but sufficient memory resources, and can reduce runtime computational overhead through advance preparation.
[0040] The second implementation method: First, a set of uniformly distributed virtual probe rays is generated on the circumference of an initial radius L1, and step S102 is executed based on the coordinates of their starting points to complete the occlusion detection for this layer. Then, the current annular radius is reduced to the next lower value L2, and the corresponding number of angularly aligned emission starting point coordinates are determined on the new concentric circumference, and step S102 is executed again. This process is repeated: the annular radius is reduced layer by layer, a new layer of probe rays is generated, detection is performed, and the results are recorded, until the termination condition is met.
[0041] Termination conditions include, but are not limited to, one of the following: on a certain ring, all virtual probe rays are not blocked (i.e., all reach the virtual camera directly), indicating that the fully visible area has been entered; or the current ring radius has shrunk to the preset minimum threshold; or the maximum number of iteration layers set by the system has been reached.
[0042] When any termination condition is met, the generation of new detection layers is stopped, and the process proceeds to the next step S103, where sector construction and area calculation are performed based on the acquired detection results.
[0043] Next, in step S102, for any layer of circular virtual probe rays (e.g., radius L) i (the ring), the specific execution of this step is as follows: Sequential Traversal: Virtual probe rays are emitted sequentially from 1 to n (e.g., clockwise). For each virtual probe ray, an intersection check is performed to determine if it can reach the virtual camera unobstructed. When the first ray that cannot reach the camera (i.e., blocked by other objects in the scene) is encountered, traversal in that direction is immediately stopped, and the ray's number or position is recorded as rb. i Find the earliest occlusion location on the ring layer, which is the left boundary of the occlusion interval.
[0044] Reverse traversal: Retrace the rays in the layer according to their numbers from n to 1 (e.g., counterclockwise), and perform intersection checks as before. When the first ray that cannot reach the camera is encountered, stop the traversal and record its position as re. i Find the last occlusion location on the ring layer, which is the right boundary of the occlusion area.
[0045] The above implementation method can quickly locate the "blocking start boundary" and "blocking end boundary" on each ring with a limited number of ray inspections, thereby avoiding comprehensive inspection of all rays in the entire ring and significantly reducing computational overhead.
[0046] To make it easier to understand, let's take an example: Suppose the radius of the circular ray is L1, and the number of rays is n (r1, r2, r3...r... nStarting from 1 to n, record the first occluded ray rb1, and from n to 1, record the first occluded ray re1. Reduce the radius L1 to obtain circular rays of radius L2 with the same number of rays. Repeat the above sequential and reverse traversal process, recording rb2 and re2. Repeat the above process until it is impossible to record rb and re or the set repetition limit is reached, that is, there are no objects occluding within a certain range of smaller radius with the same center (that is, all rays only intersect with the camera and do not intersect with other objects in the scene).
[0047] Based on all the detection results recorded in step S102, step S103 in this embodiment of the invention is executed to construct a sector and determine the sector area based on the target virtual detection rays detected in each layer of virtual detection rays.
[0048] In this embodiment of the invention, step S103 can be implemented as follows: Step b1: Determine the occlusion start boundary and occlusion end boundary of this layer based on the ray positions of the two target rays recorded in each layer. In this embodiment of the invention, the first ray rb blocked in the clockwise direction on the i-th layer has been recorded through forward and reverse traversal. i The first ray blocked in the counter-clockwise direction (re) i The starting and ending boundaries of occlusion on the circumference of this layer are defined by the angular positions corresponding to these two rays, and their positions are represented as follows: =angle(rb i ), =angle(re i This is the basic input for constructing the subsequent sector region. Step b2: Using the difference in radius between two adjacent circular layers as the radial range, construct a sector bounded by an outer circular arc, an inner circular arc, and two radial edges by occluding the arc span between the starting boundary and the ending boundary. In this embodiment of the invention, for the i-th layer (radius L) i ) and the (i+1)th layer (radius L) i+1 The sector-shaped region comprises the following components: an outer arc radius of L. i On the circle, from arrive An arc segment; inner arc: radius L i+1 On the circle, from arrive An arc; two radial sides: connecting (L) i , ) and (L i+1 , ), (L i , ) and (Li+1 , (a straight line segment).
[0049] For easier intuitive understanding, please refer to Figure 2 , Figure 2 This is a schematic diagram of a sector-shaped region provided in an embodiment of the present invention. Wherein, a region with radius L... n Taking the circumference of a circle as an example, the area enclosed by the dashed box is the sector. The sectors on the circumferences corresponding to other radii are similar, and will not be described in detail here.
[0050] Step b3: Calculate the area covered by each sector.
[0051] Understandably, once a sector is defined, its area can be calculated using standard geometric formulas. Continuing with the above example: this embodiment of the invention can calculate the area S1 of the sector formed by arcs rb1 to re1 and lengths L1 to L2; the area S2 of the sector formed by arcs rb2 to re2 and lengths L2 to L3; and repeat this operation until rb is obtained. n-1 to re n-1 L n-1 To L n The area S formed n-1 .
[0052] Unlike traditional methods that merely count how many rays are blocked, this invention constructs a physically meaningful spatial region (sector) by locating the angular and radial range where the blocking occurs, and uses its area as a quantitative indicator of the blocking effect, which is more stable and interpretable.
[0053] In one embodiment of the present invention, to simplify the calculation of the sector area, step b3 above can also be implemented in the following manner: Step 1: Obtain standardized area primitives; In this embodiment of the invention, the system pre-establishes a standardized area primitive. This primitive represents the area of the smallest sector enclosed by two adjacent virtual probe rays on an imaginary, fixed-size unit ring. Multiple ray emission starting positions can be pre-determined on the unit-size virtual ring based on a different number of uniformly distributed points. Then, based on the relationship between the arc span and unit radius between adjacent starting positions, the standardized area primitive is determined and pre-stored for use in subsequent processes. Specifically, the system pre-calculates the area value of the small region enclosed between two adjacent ray starting points based on several common ray distribution densities (e.g., 8, 16, or 32 rays per ring) and saves these values as the basic unit that can be directly called upon in subsequent calculations.
[0054] Step 2: Determine the effective angle range length covered by the arc span between the starting and ending positions of the shading on each layer, as well as the radius difference between adjacent layers. In this embodiment of the invention, when occlusion detection is actually performed, after the system determines the occlusion start position to the occlusion end position, it can determine how many ray intervals, i.e., the arc span, are spanned between these two positions. Simultaneously, it also needs to determine the distance difference between the current layer and the layer below it, i.e., the radial interval between two concentric circles, reflecting the width of the sector region. These two parameters together describe the spatial size of the sector to be calculated and serve as the basis for scaling up the standard primitive to the actual area for subsequent proportional conversion.
[0055] Step 3: Based on the determined effective angle interval length and radius difference, the standardized area primitive is proportionally expanded to obtain the spatial area of the sector.
[0056] Next, the system uses the two parameters obtained in the previous step—the arc span and the radius difference—to proportionally enlarge the pre-prepared standardized area primitives, thereby calculating the spatial area occupied by the corresponding complete sector. The entire process no longer relies on complex geometric formulas but is accomplished through simple proportional relationships, ensuring both rationality and significantly improving calculation speed.
[0057] Let's continue with the previous example: , By analogy, the sector areas S1 to S2 can be quickly obtained. n-1 .
[0058] Finally, in step S104 of this embodiment of the invention, the ratio between the accumulated sum of all sector surfaces and the area corresponding to the largest radius circle is used as the occlusion rate of the target surface. It can be understood that the rb and re identified on each layer essentially define a potential occlusion angle range, combined with the radial width (L... i -L i+1 This interval corresponds to a sector area, representing the space where the view is partially obstructed. The sum of all such sector areas is the area measure of the overall obstruction effect of the entire surface, which is also the estimated area of the unreachable area in the entire surface. Dividing this by the area of the largest circle, this ratio is essentially a geometric and continuous estimation model of the proportion of the area where the view is obstructed in the target surface to the overall area.
[0059] In order to perform the above Figure 1 The corresponding steps are described below, outlining an implementation method for a face occlusion estimation device 30 in a game scene. Please refer to [link / reference]. Figure 3 , Figure 3This diagram illustrates the functional block diagram of a surface occlusion rate estimation device in a game scene provided by an embodiment of the present invention. The surface occlusion rate estimation device 30 in the game scene includes: a generation module 301, a detection module 302, and an estimation module 303.
[0060] The generation module 301 is used to generate a multi-layered circular distribution of virtual probe rays around the center of the target surface; wherein, each layer of virtual probe rays is evenly distributed on the corresponding circle; and each virtual probe ray points to the virtual camera; The detection module 302 is used to traverse each virtual detection ray along the index order direction and the reverse direction for each layer of virtual detection ray, and perform intersection detection with geometric objects in the scene for each virtual detection ray, and record the first occluded target virtual detection ray. The estimation module 303 is used to construct sectors and determine sector areas based on the target virtual probe rays detected in each layer of virtual probe rays; The estimation module 303 is also used as the ratio between the accumulated value of all sectors and the area corresponding to the circle with the largest radius as the occlusion rate of the target surface.
[0061] It is understandable that the generation module 301, the detection module 302, and the estimation module 303 can execute collaboratively. Figure 1 Each step in the process is used to achieve the corresponding technical effect.
[0062] It should be noted that the surface occlusion rate estimation device 30 in the game scene provided in this embodiment of the invention can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this embodiment of the invention are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiments can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.
[0063] Optionally, the above modules can be stored in the form of software or firmware. Figure 4 The memory shown is either stored in or embedded in the operating system (OS) of the electronic device 4, and can be used by... Figure 4 The processor executes the commands. Meanwhile, the data and program code required to execute these modules can be stored in memory.
[0064] Please see Figure 4 , Figure 4The diagram illustrates the structure of an electronic device according to an embodiment of the present invention, including a memory 401, a processor 402, and a communication interface 403. The memory 401, processor 402, and communication interface 403 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0065] Optionally, the bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized into address buses, data buses, control buses, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0066] In this embodiment of the invention, the processor 402 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in this embodiment of the invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment of the invention can be directly manifested as execution by the hardware processor, or execution by a combination of hardware and software modules within the processor. The software modules may reside in the memory 401, and the processor 402 reads the program instructions from the memory 401 and, in conjunction with its hardware, completes the steps of the aforementioned methods.
[0067] In this embodiment of the invention, the memory 401 can be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as RAM. The memory can also be any other medium capable of carrying or storing desired executable program code having an instruction or data structure form and accessible by a computer, but is not limited thereto. The memory in this embodiment of the invention can also be a circuit or any other device capable of implementing a storage function for storing instructions and / or data.
[0068] The memory 401 can be used to store software programs and modules, such as the instructions / modules of the face occlusion rate estimation device 30 in the game scene provided in this embodiment of the invention. These can be stored in the memory 401 in the form of software or firmware, or embedded in the operating system (OS) of the electronic device 40. The processor 402 executes various functional applications and data processing by executing the software programs and modules stored in the memory 401. The communication interface 403 can be used to communicate with other node devices for signaling or data.
[0069] Understandable. Figure 4 The structure shown is for illustrative purposes only; the electronic device 4 may also include components that are more advanced than those shown. Figure 4 The more or fewer components shown, or having the same Figure 4 The different configurations shown. Figure 4 The components shown can be implemented using hardware, software, or a combination thereof.
[0070] Based on the above embodiments, the present invention also provides a storage medium storing a computer program. When the computer program is executed by a computer, it causes the computer to execute the method for estimating the occlusion rate of a surface in a game scene provided in the above embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0071] Based on the above embodiments, the present invention also provides a program product, which includes a computer program. The processor can execute the computer program to implement the method for estimating the occlusion rate of a surface in a game scene provided in the embodiments of the present invention. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0072] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0073] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the objectives of the embodiments of the present invention, depending on actual needs.
[0074] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0075] It should be noted that if the function is implemented as a software module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0076] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for estimating the occlusion rate of facets in a game scene, characterized in that, The method comprises: generating a plurality of layers of circularly distributed virtual probe light rays distributed around a target patch center; wherein each layer of virtual probe light rays is uniformly distributed on a corresponding circle; each virtual probe light ray is directed to a virtual camera; for each layer of virtual probe light rays, traversing each virtual probe light ray in a forward order and a reverse order of virtual probe light ray index, respectively, and performing intersection detection with geometric objects in a scene for each virtual probe light ray, and recording a first occluded target virtual probe light ray; constructing a sector based on the target virtual probe light ray detected in each layer of virtual probe light rays and determining a sector area; taking a ratio between an accumulated value of all sector areas and an area corresponding to a maximum radius circle as an occlusion rate of the target patch.
2. The method of claim 1, wherein, Generating a plurality of layers of circularly distributed virtual probe light rays distributed around a target patch center comprises: pre-establishing a plurality of virtual probe light ray template sets of different densities; wherein each virtual probe light ray template corresponds to a group of emission direction numbers uniformly distributed on a circle; for each virtual probe light ray template, pre-calculating the starting position coordinates of each virtual probe light ray on a unit size virtual ring; when generating virtual probe light rays under any radius, the starting position coordinates corresponding to the selected virtual probe light ray template are scaled up by the same proportion based on the current radius to obtain the actual emission starting point coordinates of each virtual probe light ray under the current radius; taking the actual emission starting point coordinates as the emission starting points of the virtual probe light rays, generating the virtual probe light rays under the current radius in the direction of the virtual camera position.
3. The method of claim 2, wherein, High-density virtual probe light ray distribution is adopted in the circular layers far from the center, and low-density virtual probe light ray distribution is adopted in the circular layers close to the center.
4. The method of claim 1, wherein, Constructing a sector based on the target virtual probe light ray detected in each layer of virtual probe light rays and determining a sector area comprises: determining the occlusion starting boundary and the occlusion ending boundary corresponding to the layer according to the ray positions of the two target rays recorded in each layer; taking the radius difference between the two adjacent circular layers as the radial range and the circular arc span between the occlusion starting boundary and the occlusion ending boundary to construct a sector surrounded by an outer circular arc, an inner circular arc and two radial edges; calculating the spatial area covered by each sector.
5. The method of claim 4, wherein, Calculating the spatial area covered by each sector comprises: obtaining a standardized area element; determining the effective angle interval length covered by the circular arc span between the occlusion starting position and the occlusion ending position on each layer and the radius difference corresponding to the adjacent two layers; scaling the standardized area element according to the determined effective angle interval length and the radius difference to obtain the spatial area of the sector.
6. The method of estimating the face sheet occlusion rate in a game scene according to claim 5, characterized in that, Obtaining a standardized area element comprises: pre-calculating a plurality of ray emission starting positions based on different numbers of uniformly distributed points on a unit size virtual ring; determining a standardized area element according to the relationship between the arc segment span between adjacent starting positions and the unit radius.
7. A device for estimating the occlusion rate of a surface in a game scene, characterized in that, It comprises: a generating module for generating a plurality of layers of circularly distributed virtual probe light rays distributed around a target patch center; wherein each layer of virtual probe light rays is uniformly distributed on a corresponding circle; each virtual probe light ray is directed to a virtual camera; The detection module is configured to, for each layer of virtual probe light, traverse each virtual probe light in a forward order and a reverse order of the virtual probe light index, respectively, and perform intersection detection with geometric objects in a scene for each virtual probe light, and record a first occluded target virtual probe light; The estimation module is configured to construct a sector and determine a sector area based on the target virtual probe light detected in each layer of virtual probe light. The estimation module is further configured to take a ratio between an accumulated value of all sector areas and an area corresponding to a maximum radius circle as an occlusion rate of the target patch.
8. An electronic device, comprising: A processor and a memory are included, the memory stores machine executable instructions which can be executed by the processor, and the processor can execute the machine executable instructions to implement the patch occlusion rate estimation method in a game scene according to any one of claims 1-6.
9. A storage medium having stored thereon machine executable instructions for causing an apparatus to perform a method comprising: The machine executable instructions are executed by the processor to implement the patch occlusion rate estimation method in a game scene according to any one of claims 1-6.
10. A program product, characterized by The program product has machine executable instructions running thereon, and the machine executable instructions are executed by the processor to implement the patch occlusion rate estimation method in a game scene according to any one of claims 1-6.