Screen space environment light shielding calculation method and device for roles, medium and equipment

By identifying character pixels in screen space and dynamically adjusting the occlusion value of the sampling points using the camera space offset vector length and the target character culling distance, the problem of dark areas around the character model's legs is resolved, improving the realism and detail of character rendering.

CN120689441APending Publication Date: 2025-09-23SUZHOU HUANTA NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510653448.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-20
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

Existing screen-space ambient occlusion (SSAO) technology often produces unnatural dark areas when processing character models, especially around the legs of character models, resulting in artifacts and loss of details.

Method used

By identifying character pixels in screen space and using the camera space offset vector length and target character culling distance, the occlusion value of the sampling point is dynamically adjusted to distinguish the occlusion contribution of character pixels from scene pixels, thereby reducing the misjudgment of occlusion caused by the character's own geometric structure.

Benefits of technology

It improves the realism and edge detail performance of character rendering, solves the problems of artifacts and detail loss at the junction of characters and scenes in traditional SSAO, and maintains the real-time performance and computational efficiency of SSAO.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120689441A_ABST
    Figure CN120689441A_ABST
Patent Text Reader

Abstract

The invention discloses a screen space environment light shielding calculation method and device for a role, a medium and equipment. The method comprises the steps that at least one sampling point corresponding to a target calculation point is determined in a screen space; determining an initial shielding value corresponding to the sampling point, and updating the initial shielding value according to a camera space offset vector length corresponding to the sampling point and a target role elimination distance under the condition that the sampling point belongs to a target role pixel point; and determining the shielding value of the target calculation point according to the updated initial shielding value corresponding to each sampling point so as to render the screen space based on the shielding value of the target calculation point. According to the invention, while the real-time performance of the SSAO is maintained, the problem that artifacts and details are easy to lose at the junction of the role and the scene in the traditional SSAO is solved, and the sense of reality of role rendering and the performance of edge details are improved by processing the shielding contribution of the role pixels and the scene pixels in a differentiated manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, medium, and equipment for calculating screen space ambient occlusion of a character. Background Art

[0002] In computer graphics, Screen Space Ambient Occlusion (SSAO) is a technique used to enhance scene realism. It calculates the degree of occlusion of each pixel in screen space relative to its surroundings, thereby adding shadows to the edges and recesses of objects, simulating more detailed lighting effects. SSAO primarily relies on screen-space depth and normal information, determining occlusion by comparing the depth differences between adjacent pixels.

[0003] However, existing SSAO technology often produces unnatural dark areas when processing character models, especially around their legs. This problem is often caused by the interaction between the character model and the ground or other objects. In screen space, the character model's legs may experience changes in depth relative to the ground or other objects due to changes in viewing angle, perspective, or animation state. This depth change causes the SSAO algorithm to produce errors when calculating occlusion values, causing the area around the character's legs to be mistakenly identified as an occluded area, thereby adding excessive dark shadows.

[0004] Specifically, when calculating the occlusion value, the SSAO algorithm usually compares the depth difference between the current pixel and multiple sampling points around it. If the depth of the sampling point is less than the depth of the current pixel, it is considered that the sampling point has an occlusion effect on the current pixel. However, around the character model's legs, due to the change in depth, this simple depth comparison method often leads to incorrect occlusion judgments. Especially in the area where the character's legs are in contact with the ground, since the ground usually has a larger depth value and the character's legs have a smaller depth value, the SSAO algorithm will mistakenly believe that the ground has an occlusion effect on the character's legs, resulting in unnatural dark areas around the legs. Summary of the Invention

[0005] In view of this, the embodiments of the present application provide a screen space ambient occlusion calculation method and device, medium, and equipment for characters, which solves the problem that traditional SSAO is prone to artifacts and detail loss at the junction of characters and scenes. By differentially processing the occlusion contribution of character pixels and scene pixels, the realism and edge detail performance of character rendering are improved.

[0006] According to one aspect of the present application, a method for calculating screen space ambient occlusion for a character is provided, the method comprising:

[0007] Determine at least one sampling point corresponding to the target calculation point in the screen space;

[0008] Determine an initial occlusion value corresponding to the sampling point, and if the sampling point belongs to a target character pixel, update the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance;

[0009] The shading value of the target calculation point is determined according to the updated initial shading value corresponding to each of the sampling points, so as to render the screen space based on the shading value of the target calculation point.

[0010] According to another aspect of the present application, a device for calculating screen space ambient occlusion for a character is provided, the device comprising:

[0011] A sampling point determination module, configured to determine at least one sampling point corresponding to a target calculation point in screen space;

[0012] an occlusion value updating module, configured to determine an initial occlusion value corresponding to the sampling point, and, if the sampling point belongs to a target character pixel, update the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance;

[0013] The occlusion value determination module is configured to determine the occlusion value of the target calculation point according to the updated initial occlusion value corresponding to each sampling point, so as to render the screen space based on the occlusion value of the target calculation point.

[0014] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the above-mentioned screen space ambient occlusion calculation method for a character is implemented.

[0015] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned screen space ambient occlusion calculation method for a character when executing the program.

[0016] By means of the above technical solution, the embodiment of the present application provides a method and apparatus, medium, and device for calculating screen space ambient occlusion for a character. When sampling in screen space, the character mask layer is used to identify the attributes of the sampling point. If the sampling point belongs to a character pixel, the initial occlusion value is attenuated and updated in combination with the length of the camera space offset vector and the target character culling distance. Finally, the updated occlusion values ​​of all sampling points are integrated to determine the ambient occlusion effect of the target point. The embodiment of the present application solves the problem of dark areas around the character's legs caused by the character's own geometric structure and the difference in ground depth by identifying the character pixels and dynamically adjusting the occlusion contribution of their sampling points. By combining camera space information and distance constraints, the character's own details are distinguished from external occlusions. Thus, while maintaining the real-time performance of SSAO, the problem of traditional SSAO easily generating artifacts and loss of details at the junction of the character and the scene is solved. By differentially processing the occlusion contribution of character pixels and scene pixels, the realism and edge detail performance of the character rendering are improved.

[0017] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0019] Figure 1 A schematic diagram of a flow chart of a method for calculating screen space ambient occlusion for a character provided in an embodiment of the present application is shown;

[0020] Figure 2 A schematic flow chart of another method for calculating screen space ambient occlusion for a character provided by an embodiment of the present application is shown;

[0021] Figure 3 A schematic diagram of a rendering effect based on a traditional screen space ambient occlusion calculation method provided by an embodiment of the present application is shown;

[0022] Figure 4 A schematic diagram of a rendering effect based on the technical solution of an embodiment of the present application is shown;

[0023] Figure 5 A schematic structural diagram of a screen space ambient occlusion calculation device for a character provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0024] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of the present application can be combined with each other.

[0025] In this embodiment, a method for calculating screen space ambient occlusion for a character is provided, such as Figure 1 As shown, the method includes:

[0026] Step 101: Determine at least one sampling point corresponding to a target calculation point in screen space.

[0027] Step 102: Determine an initial occlusion value corresponding to the sampling point, and if the sampling point is a target character pixel, update the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance.

[0028] Step 103: Determine the shading value of the target calculation point according to the updated initial shading value corresponding to each sampling point, so as to render the screen space based on the shading value of the target calculation point.

[0029] In an embodiment of the present application, in SSAO calculation, the target calculation point (such as a pixel in screen space) needs to perform depth comparison with multiple sampling points around it to determine the degree of occlusion. When the sampling point belongs to the target character pixel (for example, determined by the character ID or depth / normal threshold), the initial occlusion value is adjusted according to the length of the camera space offset vector and the preset target character culling distance. Among them, the adjustment is triggered only when the sampling point belongs to the character to avoid interference with the occlusion calculation of the ground or other objects. The length of the camera space offset vector refers to the position offset of the sampling point relative to the camera. The smaller the value, the closer the sampling point is to the camera, and it may belong to the detailed part of the character model (such as the surface of the leg) rather than the background object. The target character culling distance is used to determine whether the sampling point belongs to the "neighboring area" of the character model. If the position offset of the sampling point relative to the camera exceeds the threshold, it may belong to an external object (such as the ground) and its occlusion contribution needs to be retained; otherwise, it may belong to the character's own geometric structure and its occlusion contribution needs to be weakened. Traditional methods usually select sampling points based on a fixed radius or randomly distributed sampling pattern (such as spiral sampling, hemispherical sampling). In complex areas such as the character's legs, due to sudden changes in geometric shapes (such as the concave-convex structure where the legs contact the ground), the fixed sampling pattern may lead to unreasonable distribution of sampling points and fail to accurately reflect the actual occlusion relationship. Assuming that the character's legs are in contact with the ground, when traditional SSAO selects sampling points at the edge of the legs, some sampling points are located on the ground (with a greater depth) and others are located on the legs (with a smaller depth). Since the depth of the ground sampling points is greater than that of the legs, the algorithm will mistakenly judge that the ground is occluding the legs, resulting in dark stripes on the edges of the legs. In the embodiment of the present application, the ground sampling points do not belong to the character pixels, and their occlusion values ​​remain in the original calculation method. The leg sampling points themselves belong to the target character pixels. If their offset vector is small (close to the camera) and the distance to the target point does not exceed the culling distance, their occlusion values ​​are reduced. Ultimately, the occlusion value of the target point is determined by the combined contribution of the ground and the leg sampling points themselves, but the misjudged occlusion of the legs themselves is weakened, thereby eliminating dark areas. Finally, the updated occlusion values ​​of all sampling points are combined, and the final occlusion value of the target point is calculated through weighted averaging or other fusion strategies. Because the occlusion values ​​of the sampling points corresponding to the character's pixels have been adjusted, false occlusion caused by the leg's inherent geometry is reduced. Consider a target calculation point at the edge of a character's leg, with surrounding sampling points including the ground and the character's leg itself.

[0030] By applying the technical solution of this embodiment, when sampling in screen space, the character mask layer is used to identify the attributes of the sampling point; if the sampling point belongs to a character pixel, the initial occlusion value is attenuated and updated in combination with the length of the camera space offset vector and the target character culling distance; finally, the updated occlusion values ​​of all sampling points are integrated to determine the ambient light occlusion effect of the target point. The embodiment of the present application solves the problem of dark areas around the character's legs caused by its own geometric structure and the difference in ground depth by identifying character pixels and dynamically adjusting the occlusion contribution of its sampling points. It distinguishes the character's own details from external occlusion by combining camera space information and distance constraints, thereby maintaining the real-time performance of SSAO while solving the problem of traditional SSAO easily generating artifacts and loss of details at the junction of the character and the scene. By differentially processing the occlusion contribution of character pixels and scene pixels, the realism of character rendering and the performance of edge details are improved, thereby improving the realism of character rendering.

[0031] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another screen space ambient occlusion calculation method for the character is provided, such as Figure 2 As shown, the method includes:

[0032] Step 201: Determine at least one sampling point corresponding to a target calculation point in screen space.

[0033] In the embodiment of the present application, a set of sampling points is selected for each target calculation point in screen space. These sampling points are generally distributed in a spherical or hemispherical area around the target calculation point to simulate the effect of light being blocked by surrounding geometric objects.

[0034] Step 202: Determine the vertical distance from the sampling point to the tangent plane where the target calculation point is located, and calculate the ratio of the vertical distance to the length of the camera space offset vector as the initial masking value corresponding to the sampling point.

[0035] In an embodiment of the present application, for each sampling point, the vertical distance from the sampling point to the tangent plane where the target calculation point is located is calculated, and the ratio of this distance to the length of the camera space offset vector is used as the initial shielding value. The vertical distance reflects the degree of deviation between the sampling point and the target calculation point in the normal direction. The length of the camera space offset vector represents the actual distance between the sampling point and the target calculation point in 3D space. Through this ratio, a preliminary estimate of the shielding contribution of the sampling point to the target calculation point can be made. The larger the ratio, the closer the sampling point is to the target surface and the farther it is from the camera, and the stronger the shielding effect.

[0036] Step 203: Obtain the identifier corresponding to the sampling point according to the target character mask layer, wherein the target character mask layer includes target character pixels marked with specific identifiers and other pixels marked with non-specific identifiers; and determine whether the sampling point belongs to the target character pixel according to the identifier corresponding to the sampling point.

[0037] In an embodiment of the present application, the target character mask layer is an image layer marked with a specific identifier, which is used to distinguish target character pixels from other pixels (such as the ground, background). By querying the identifier of the sampling point, it can be determined whether the sampling point belongs to the target character pixel. Specifically, through the pre-rendered target character mask layer, the screen pixels are divided into two categories: target character pixels and other pixels. For example, the target character pixel is marked as 0 and the other pixels are marked as 1 in the target character mask layer. If the sampling point belongs to the target character pixel, its mask value needs to be further processed. If the sampling point does not belong to the target character pixel, no special processing is required.

[0038] In an embodiment of the present application, optionally, before obtaining the identifier corresponding to the sampling point based on the target character mask layer, the method also includes: obtaining a material shading model of the target character; and generating a target character mask layer corresponding to the material shading model in an application scenario of rendering material.

[0039] In this embodiment, a material shading model Toon specific to the target character can be added to the rendering engine, so that when rendering the material, if the material belongs to the material shading model Toon, a target character mask layer Toon StencilMask dedicated to the target character is output. This mask layer is an image layer marked with a specific identifier, which is used to distinguish target character pixels from other pixels. Through this mask layer, it is possible to accurately identify which pixels belong to the target character. When further rendering the screen space ambient occlusion (process), the character-specific mask Toon StencilMask is input on the CPU side, and the target character culling distance is passed to the Shader (shader).

[0040] Step 204: When the sampling point belongs to the target character pixel point, if the length of the camera space offset vector corresponding to the sampling point is less than the target character culling distance, the initial occlusion value is attenuated according to the ratio of the length of the camera space offset vector to the target character culling distance to update the initial occlusion value; if the length of the camera space offset vector corresponding to the sampling point is greater than or equal to the target character culling distance, the initial occlusion value is kept unchanged.

[0041] In an embodiment of the present application, when the sampling point belongs to the target character pixel point, it is further determined whether the length of the camera space offset vector corresponding to the sampling point is less than the target character culling distance, and the subsequent process is performed. Among them, if the camera space offset vector of the sampling point is less than the target character culling distance, it means that the distance between the sampling point and the background pixel is small, for example, the sampling point is a leg pixel point close to the ground, and the initial occlusion value can be attenuated. Specifically, the ratio of the camera space offset vector length to the target character culling distance can be calculated, and the ratio can be multiplied by the initial occlusion value to update the initial occlusion value, so as to reduce the occlusion of the area close to the character and avoid white edges. On the contrary, if the camera space offset vector of the sampling point is greater than or equal to the target character culling distance, it means that the distance between the sampling point and the background pixel is large, for example, the sampling point is an upper body pixel point, and the initial occlusion value can be kept unchanged to retain the interaction details of the distant scene. In an alternative implementation, the following process is added to the shader: The Toon StencilMask is sampled using the UV sampling point. If it is a character pixel, the occlusion value is attenuated using the ratio of the camera space offset vector between the target calculation point and the sampling point and the target character's culling distance. If the offset vector length exceeds the target character's culling distance, the occlusion value is not attenuated. This prevents the target character from excessively affecting ambient occlusion while preserving the occlusion effect of other objects on the target character.

[0042] In an embodiment of the present application, optionally, before determining at least one sampling point corresponding to the target calculation point in the screen space, the method further includes: setting a respective preset character culling distance for each game character based on the size of each game character; accordingly, before updating the initial occlusion value based on the length of the camera space offset vector corresponding to the sampling point and the target character culling distance, the method further includes: determining the target character culling distance based on the preset character culling distance corresponding to the target character to which the sampling point belongs.

[0043] In this embodiment, by setting a preset character culling distance for each game character based on their size, the realism and accuracy of the ambient occlusion effect are improved, making the rendering results more reasonable and natural. Larger characters generally require a larger AO culling distance (preset character culling distance) to ensure a more natural AO effect on their edges. Conversely, smaller characters generally require a smaller AO culling distance to avoid unnecessary loss of detail. Specifically, a variation curve between the character size and the preset character culling distance can be set, and the preset character culling distance for different game characters can be obtained from the variation curve based on the size of the game character. This provides personalized occlusion processing for characters of different sizes, ensuring that the appropriate occlusion effect is achieved regardless of the size of the character, thereby enhancing visual consistency and rationality. Specifically, a shorter culling distance is used for smaller characters to reduce the computational burden and improve the overall efficiency of the algorithm; for larger characters, the culling distance is appropriately increased to ensure the quality of the occlusion effect.

[0044] In an embodiment of the present application, optionally, determining the target character culling distance based on the preset character culling distance corresponding to the target character to which the sampling point belongs includes: taking the preset character culling distance corresponding to the target character to which the sampling point belongs as the basic culling distance; determining a culling distance adjustment coefficient based on at least one of the distance of the target character's position in the screen space, the number of light sources in the scene where the target character is located, and the complexity of the scene where the target character is located, and adjusting the basic culling distance based on the culling distance adjustment coefficient to obtain the target character culling distance.

[0045] In this embodiment, to further enhance the realism and accuracy of ambient occlusion, the preset character culling distance can be adjusted by comprehensively considering factors such as the target character's position in screen space, the number of scene light sources, and scene complexity, thereby obtaining a more accurate target character culling distance. First, a preset character culling distance, set based on the size of each game character, serves as the base culling distance. Next, to more accurately reflect the actual conditions in different game scenarios, a culling distance adjustment coefficient can be determined based on factors such as the target character's position in screen space, the number of light sources in the scene where the target character resides, and the complexity of the scene where the target character resides. On the one hand, if the character is in the near-foreground of the scene, a more refined AO effect is required, thus requiring a smaller culling distance. On the other hand, if the character is in the distant part of the scene, a larger culling distance can be considered to reduce computational complexity and improve rendering efficiency. Specifically, a relationship can be established between the character's position in screen space and a first adjustment coefficient. The corresponding first culling distance adjustment coefficient is determined based on the character's position in screen space, so that the preset character culling distance can be adjusted based on the first culling distance adjustment coefficient. On the other hand, the more light sources there are in a scene, the more complex the light interactions are, and more sophisticated shading processing is required to ensure the authenticity of the light and shadow effects. In this case, the culling distance can be reduced to capture more details. Specifically, the relationship between the number of scene light sources and the second adjustment coefficient can be set. The corresponding second culling distance adjustment coefficient is determined based on the number of light sources in the scene where the target character is located, so that the preset character culling distance can be adjusted according to the second culling distance adjustment coefficient. On the other hand, the more complex the scene (such as containing a large amount of geometry or high-detail textures), the more likely it is that the culling distance needs to be adjusted to maintain visual consistency. For example, in a highly complex environment, a smaller culling distance helps capture more subtle shadow changes. Specifically, the complexity value of different game scenes can be set, and the relationship between the scene complexity value and the third adjustment coefficient can be set. The corresponding third culling distance adjustment coefficient is determined based on the complexity value of the scene where the target character is located, so that the preset character culling distance can be adjusted according to the third culling distance adjustment coefficient. Finally, the basic culling distance is adjusted using the culling distance adjustment coefficient determined by one or more of the above factors to obtain the final target character culling distance. For example, multiple culling distance adjustment coefficients are multiplied to determine the final culling distance adjustment coefficient. This adjustment mechanism allows the algorithm to dynamically adapt to different game scenarios, providing both efficient and high-quality rendering results.

[0046] Step 205 : Determine the occlusion value of the target calculation point according to the updated initial occlusion value corresponding to each sampling point, so as to render the screen space based on the occlusion value of the target calculation point.

[0047] In the embodiment of the present application, finally, the updated occlusion values ​​of all sampling points are fused (such as weighted average) to obtain the final occlusion value of the target calculation point. The final occlusion value is used to adjust the illumination intensity of the target calculation point, thereby achieving a more realistic ambient light occlusion effect. Finally, the embodiment of the present application achieves a more realistic soft and hard surface lighting effect through a lightweight character mask and a distance-driven occlusion attenuation mechanism, which is particularly suitable for character-driven games and film and television rendering scenes. Figure 3 For the rendering effect using the traditional SSAO method, there are dark areas around the character's legs, such as Figure 4 This is a rendering effect diagram using the technical solution of an embodiment of the present application, in which the dark area around the character's legs is repaired.

[0048] By applying the technical solution of this embodiment, the calculation of screen space ambient occlusion (SSAO) is optimized by introducing a character-specific mask, so that the mask is used to distinguish between character pixels and scene pixels, and the occlusion value of the character pixels is dynamically attenuated. Specifically, when calculating the occlusion value of a sampling point, if the sampling point belongs to a character pixel and the length of its offset vector is less than the preset culling distance, the occlusion value is proportionally attenuated; otherwise, the original value is maintained. This technical solution solves the problem that traditional SSAO is prone to white edges, artifacts, and loss of details at the junction of the character and the scene. It not only retains the natural occlusion relationship between the interaction between the character edge and the scene, but also avoids excessive occlusion of the character's own geometric structure by dynamically adjusting the occlusion intensity, significantly improving the realism and detail performance of the rendering, while maintaining computational efficiency and compatibility with existing rendering pipelines.

[0049] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a screen space ambient light occlusion calculation device for a character, such as Figure 5 As shown, the device includes:

[0050] A sampling point determination module, configured to determine at least one sampling point corresponding to a target calculation point in screen space;

[0051] an occlusion value updating module, configured to determine an initial occlusion value corresponding to the sampling point, and, if the sampling point belongs to a target character pixel, update the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance;

[0052] The occlusion value determination module is configured to determine the occlusion value of the target calculation point according to the updated initial occlusion value corresponding to each sampling point, so as to render the screen space based on the occlusion value of the target calculation point.

[0053] In the embodiment of the present application, optionally, the shielding value updating module is further configured to:

[0054] According to the target character mask layer, obtaining the identifier corresponding to the sampling point, wherein the target character mask layer includes target character pixels marked with a specific identifier and other pixels marked with a non-specific identifier;

[0055] According to the identifier corresponding to the sampling point, it is determined whether the sampling point belongs to the target character pixel point.

[0056] In the embodiment of the present application, optionally, the shielding value updating module is further configured to:

[0057] Get the material shading model of the target character;

[0058] In an application scenario of rendering materials, a target character mask layer corresponding to the material shading model is generated.

[0059] In the embodiment of the present application, optionally, the shielding value updating module is further configured to:

[0060] Determine a vertical distance from the sampling point to the tangent plane where the target calculation point is located, and calculate a ratio of the vertical distance to the length of the camera space offset vector as an initial masking value corresponding to the sampling point.

[0061] In the embodiment of the present application, optionally, the shielding value updating module is further configured to:

[0062] When the length of the camera space offset vector corresponding to the sampling point is less than the target character culling distance, attenuating the initial occlusion value according to a ratio of the length of the camera space offset vector to the target character culling distance to update the initial occlusion value;

[0063] When the length of the camera space offset vector corresponding to the sampling point is greater than or equal to the target character culling distance, the initial occlusion value is kept unchanged.

[0064] In the embodiment of the present application, optionally, the shielding value updating module is further configured to:

[0065] Setting a preset character culling distance for each game character based on the size of each game character; and

[0066] The target character culling distance is determined according to a preset character culling distance corresponding to the target character to which the sampling point belongs.

[0067] In the embodiment of the present application, optionally, the shielding value updating module is further configured to:

[0068] Taking the preset character culling distance corresponding to the target character to which the sampling point belongs as the basic culling distance;

[0069] A culling distance adjustment coefficient is determined based on at least one of the distance of the target character in the screen space, the number of light sources in the scene where the target character is located, and the complexity of the scene where the target character is located, and the basic culling distance is adjusted based on the culling distance adjustment coefficient to obtain the target character culling distance.

[0070] It should be noted that for other corresponding descriptions of the functional units involved in the screen space ambient light occlusion calculation device for a character provided in the embodiment of the present application, reference can be made to Figures 1 to 2 The corresponding description in the method will not be repeated here.

[0071] The embodiment of the present application also provides a computer device, which can be specifically a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory and a communication interface, and may also include an input and output interface and a display device. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.

[0072] Those skilled in the art will understand that the structure of the above-mentioned computer device is only a partial structure related to the solution of the present application and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components, or combine certain components, or have a different component arrangement.

[0073] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0074] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0075] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0076] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, and the like.

[0077] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0078] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A method for calculating screen space ambient occlusion for a character, characterized in that: The method comprises: Determine at least one sampling point corresponding to the target calculation point in the screen space; Determine an initial occlusion value corresponding to the sampling point, and if the sampling point belongs to a target character pixel, update the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance; The shading value of the target calculation point is determined according to the updated initial shading value corresponding to each of the sampling points, so as to render the screen space based on the shading value of the target calculation point.

2. The method according to claim 1, characterized in that When the sampling point belongs to a target character pixel, before updating the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance, the method further includes: According to the target character mask layer, obtaining the identifier corresponding to the sampling point, wherein the target character mask layer includes target character pixels marked with a specific identifier and other pixels marked with a non-specific identifier; According to the identifier corresponding to the sampling point, it is determined whether the sampling point belongs to the target character pixel point.

3. The method according to claim 2, characterized in that Before obtaining the identifier corresponding to the sampling point according to the target character mask layer, the method further includes: Get the material shading model of the target character; In an application scenario of rendering materials, a target character mask layer corresponding to the material shading model is generated.

4. The method according to claim 1, wherein The determining of the initial masking value corresponding to the sampling point includes: Determine a vertical distance from the sampling point to the tangent plane where the target calculation point is located, and calculate a ratio of the vertical distance to the length of the camera space offset vector as an initial masking value corresponding to the sampling point.

5. The method according to claim 1, wherein The updating of the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance includes: When the length of the camera space offset vector corresponding to the sampling point is less than the target character culling distance, attenuating the initial occlusion value according to a ratio of the length of the camera space offset vector to the target character culling distance to update the initial occlusion value; When the length of the camera space offset vector corresponding to the sampling point is greater than or equal to the target character culling distance, the initial occlusion value is kept unchanged.

6. The method according to any one of claims 1 to 5, characterized in that Before determining at least one sampling point corresponding to the target calculation point in the screen space, the method further includes: Set a preset character culling distance for each game character based on their size; Accordingly, before updating the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance, the method further includes: The target character culling distance is determined according to a preset character culling distance corresponding to the target character to which the sampling point belongs.

7. The method according to claim 6, characterized in that The determining the target character culling distance according to a preset character culling distance corresponding to the target character to which the sampling point belongs includes: Taking the preset character culling distance corresponding to the target character to which the sampling point belongs as the basic culling distance; A culling distance adjustment coefficient is determined based on at least one of the distance of the target character in the screen space, the number of light sources in the scene where the target character is located, and the complexity of the scene where the target character is located, and the basic culling distance is adjusted based on the culling distance adjustment coefficient to obtain the target character culling distance.

8. A screen space ambient occlusion calculation device for a character, characterized in that: The device comprises: A sampling point determination module, configured to determine at least one sampling point corresponding to a target calculation point in screen space; an occlusion value updating module, configured to determine an initial occlusion value corresponding to the sampling point, and, if the sampling point belongs to a target character pixel, update the initial occlusion value according to the length of the camera space offset vector corresponding to the sampling point and the target character culling distance; The occlusion value determination module is configured to determine the occlusion value of the target calculation point according to the updated initial occlusion value corresponding to each sampling point, so as to render the screen space based on the occlusion value of the target calculation point.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.