Rendering method and device for eliminating shielded transparent elements, storage medium and equipment

By drawing the depth map comparison between transparent elements and opaque elements, the occlusion situation is determined, which solves the problem of large calculation overhead when rendering transparent elements and the cumbersome art production, and achieves more efficient game development.

CN119295620APending Publication Date: 2025-01-10BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311735765.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-15
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

When rendering transparent elements, especially large-scale design elements such as water bodies, the calculation overhead is high, and the art production process is cumbersome, which affects the efficiency of game development.

Method used

By drawing the depth map of transparent elements and the depth map of opaque elements, determine the occlusion situation. If the culling conditions are met, the transparent element rendering will be ignored, and the scene will be rendered directly using opaque elements to render data to reduce calculation overhead.

Benefits of technology

Reduces rendering calculation overhead, simplifies the art production process, improves game development efficiency, and avoids pre-production of huge art assets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295620A_ABST
    Figure CN119295620A_ABST
Patent Text Reader

Abstract

The invention discloses a rendering method and device for eliminating shielded transparent elements, a storage medium and computer equipment, and the method comprises the steps: drawing a first depth map corresponding to transparent elements in a shooting range of a virtual camera in a process of rendering a virtual scene; based on the first depth map and a second depth map corresponding to the opaque elements in the shooting range, determining transparent element information which is not shielded by the opaque elements; and if the transparent element information meets the transparent element removal condition, rendering the virtual scene based on the opaque element rendering data. According to the method, the transparent element depth map is drawn and compared with the opaque element depth map, the transparent elements meeting the elimination condition in the shooting range are determined, calculation overhead can be reduced during scene rendering, artists do not need to make huge art assets in advance, and game development is more efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of rendering technology, and in particular to a rendering method and device, storage medium, and computer equipment for removing obstructed transparent elements. Background Art

[0002] Currently, many applications in electronic devices use image rendering technology, such as games and other applications that use virtual reality technology. Usually, in order to reduce the rendering workload of the graphics engine and improve rendering efficiency to ensure smooth operation of the application, before rendering the image, objects that are invisible due to occlusion in the image to be rendered are often eliminated, and only currently visible objects are rendered.

[0003] As a common design element in MMO games, transparent elements usually appear in a large range of scenes, such as rivers, lakes and other water bodies in the game. The pursuit of realistic water rendering and simulation will bring corresponding computing overhead. The common occlusion culling solution in the game engine is the occlusion culling solution based on pre-calculated visibility. Pre-calculated visibility requires the scene to be divided into connected cells in advance, and then the information of all objects that may be observed by the camera in each area is pre-calculated and saved. When the game is running, the visible information of static objects can be obtained by directly looking up the table to achieve the occlusion culling effect. This solution requires baking a large number of assets, and the setting of the occluder and occluded object properties of the assets before baking has a huge impact on the reliability of the occlusion culling results, which brings a certain burden to the consistency and speed of the art production process. The production process is cumbersome and affects the efficiency of game development. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a rendering method and apparatus, a storage medium, and a computer device for culling obstructed transparent elements. The scheme determines the transparent elements that meet the culling conditions within the shooting range by drawing a depth map of transparent elements and comparing it with the depth map of opaque elements. This scheme can reduce computing overhead when rendering scenes, and does not require artists to pre-produce huge art assets, making game development more efficient.

[0005] According to one aspect of the present application, a rendering method for removing obstructed transparent elements is provided, the method comprising:

[0006] In the process of rendering the virtual scene, a first depth map corresponding to transparent elements within the shooting range of the virtual camera is drawn;

[0007] Determining, based on the first depth map and the second depth map corresponding to the opaque elements within the shooting range, information of transparent elements within the shooting range that are not blocked by the opaque elements;

[0008] If the transparent element information meets the transparent element elimination condition, the virtual scene within the shooting range is rendered based on the opaque element rendering data within the shooting range.

[0009] Optionally, after drawing the first depth map corresponding to the transparent elements within the shooting range of the virtual camera, the method further includes:

[0010] Identify whether there is a pixel point in the first depth map whose depth value is greater than a preset depth value, wherein the preset depth value is determined according to a preset visible distance corresponding to the visible transparent element;

[0011] If so, determining that there is a visible transparent element within the shooting range, and obtaining a second depth map corresponding to the opaque element within the shooting range;

[0012] If not, it is determined that there is no visible transparent element in the shooting range, and the virtual scene in the shooting range is rendered based on the opaque element rendering data in the shooting range.

[0013] Optionally, the determining, based on the first depth map and the second depth map corresponding to the opaque elements in the shooting range, information of transparent elements in the shooting range that are not blocked by the opaque elements includes:

[0014] For each pixel point in the first depth map, if the depth value of the pixel point is greater than the depth value of the pixel point at the corresponding position in the second depth map, the pixel point is determined to be a transparent element pixel point that is not blocked by the opaque element within the shooting range, and the information of the transparent element pixel point is extracted from the first depth map as the transparent element information.

[0015] Optionally, drawing a first depth map corresponding to transparent elements within a shooting range of the virtual camera includes:

[0016] Determine current viewpoint parameters of the virtual camera, and determine a first depth map matching the current viewpoint parameters based on a preset placeholder grid map corresponding to the transparent element;

[0017] The obtaining of a second depth map corresponding to the opaque elements within the shooting range includes:

[0018] A second depth map obtained by performing an opaque element rendering process is obtained.

[0019] Optionally, the method further comprises:

[0020] Drawing the first depth map, determining the transparent element information, and generating a result of whether the transparent element information meets the transparent element culling condition by means of a graphics processor;

[0021] The result generated by the image processor is read through the central processing unit, and the virtual scene rendering process is controlled based on the result, wherein when the result is that the transparent element information meets the transparent element culling condition, the transparent element rendering process is skipped to perform other rendering processes.

[0022] Optionally, the method further comprises:

[0023] When it is determined that the transparent information meets the transparent element culling condition, presenting the rendered virtual scene at a first preset frame rate;

[0024] When it is determined that the transparent information does not meet the transparent element elimination condition, the rendered virtual scene is presented at a second preset frame rate, wherein the first preset frame rate is greater than the second preset frame rate.

[0025] Optionally, the transparent element culling conditions include: the transparent element is completely blocked by the opaque element; the transparent element not blocked by the opaque element is smaller than a first preset size; the transparent element not blocked by the opaque element is smaller than a second preset size, and the transparent element not blocked by the opaque element is located in a non-core area of ​​the screen space.

[0026] According to another aspect of the present application, a rendering device for removing obstructed transparent elements is provided, the device comprising:

[0027] A depth map acquisition module is used to draw a first depth map corresponding to transparent elements within the shooting range of the virtual camera during the process of rendering the virtual scene;

[0028] A determination module, configured to determine information of transparent elements within the shooting range that are not blocked by the opaque elements based on the first depth map and a second depth map corresponding to the opaque elements within the shooting range;

[0029] A rendering module is used to render the virtual scene within the shooting range based on the opaque element rendering data within the shooting range if the transparent element information meets the transparent element elimination condition.

[0030] Optionally, the determination module is further used to: identify whether there is a pixel point in the first depth map whose depth value is greater than a preset depth value, wherein the preset depth value is determined according to a preset visible distance corresponding to the visible transparent element;

[0031] The depth map acquisition module is further used to: if there is a visible transparent element in the shooting range, determine that there is a visible transparent element in the shooting range, and acquire a second depth map corresponding to the opaque element in the shooting range;

[0032] The rendering module is further used to: if not, determine that there is no visible transparent element in the shooting range, render the virtual scene in the shooting range based on the opaque element rendering data in the shooting range.

[0033] Optionally, the determination module is also used to: for each pixel point in the first depth map, if the depth value of the pixel point is greater than the depth value of the pixel point at the corresponding position in the second depth map, determine that the pixel point is a transparent element pixel point that is not blocked by the opaque element within the shooting range, and extract the information of the transparent element pixel point in the first depth map as the transparent element information.

[0034] Optionally, the depth map acquisition module is further used to:

[0035] Determine current viewpoint parameters of the virtual camera, and determine a first depth map matching the current viewpoint parameters based on a preset placeholder grid map corresponding to the transparent element;

[0036] A second depth map obtained by performing an opaque element rendering process is obtained.

[0037] Optionally, the depth map acquisition module is further used to: draw the first depth map through a graphics processor;

[0038] The determination module is further used to: determine the transparent element information through a graphics processor, and generate a result of whether the transparent element information meets the transparent element elimination condition;

[0039] The rendering module is also used to: read the result generated by the image processor through the central processing unit, and control the virtual scene rendering process based on the result, wherein when the result is that the transparent element information meets the transparent element culling condition, skip the transparent element rendering process and perform other rendering processes.

[0040] Optionally, the rendering module is further configured to: present the rendered virtual scene at a first preset frame rate when it is determined that the transparent information meets the transparent element culling condition;

[0041] When it is determined that the transparent information does not meet the transparent element elimination condition, the rendered virtual scene is presented at a second preset frame rate, wherein the first preset frame rate is greater than the second preset frame rate.

[0042] Optionally, the transparent element culling conditions include: the transparent element is completely blocked by the opaque element; the transparent element not blocked by the opaque element is smaller than a first preset size; the transparent element not blocked by the opaque element is smaller than a second preset size, and the transparent element not blocked by the opaque element is located in a non-core area of ​​the screen space.

[0043] 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 rendering method for removing obstructed transparent elements is implemented.

[0044] 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 rendering method for removing obstructed transparent elements when executing the program.

[0045] By means of the above technical scheme, the embodiments of the present application provide a rendering method and device, storage medium, and computer equipment for removing obstructed transparent elements. In the process of rendering a virtual scene, a first depth map corresponding to transparent elements within the shooting range of the virtual camera is drawn frame by frame. Based on the first depth map and the second depth map corresponding to opaque elements within the shooting range, the transparent element information that is not obscured by the opaque elements within the shooting range is determined, so that when the transparent element information meets the transparent element elimination conditions, the transparent elements are ignored and the opaque element rendering data within the shooting range is directly used to render the virtual scene within the shooting range. The present application determines the transparent elements within the shooting range that meet the elimination conditions by drawing a transparent element depth map and comparing it with the opaque element depth map. This can reduce the computing overhead when rendering the scene, and does not require artists to pre-produce huge art assets, making game development more efficient.

[0046] 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

[0047] 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:

[0048] Figure 1 A schematic flow chart of a rendering method for removing obscured transparent elements provided in an embodiment of the present application is shown;

[0049] Figure 2 A schematic flow chart of another rendering method for removing obscured transparent elements provided in an embodiment of the present application is shown;

[0050] Figure 3 A schematic flow chart of another rendering method for removing obscured transparent elements provided in an embodiment of the present application is shown;

[0051] Figure 4 A schematic diagram of the execution process of a water depth calculation process provided by an embodiment of the present application is shown;

[0052] Figure 5 A schematic structural diagram of a rendering device for removing obstructed transparent elements provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0053] 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 the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0054] In this embodiment, a rendering method for removing obstructed transparent elements is provided, such as Figure 1 As shown, the method includes:

[0055] Step 101 : in the process of rendering a virtual scene, a first depth map corresponding to transparent elements within a shooting range of a virtual camera is drawn.

[0056] In the embodiment of the present application, during the game, a depth map of transparent elements within the shooting range is drawn frame by frame based on the shooting range of the virtual camera, that is, a first depth map. The first depth map includes depth information of each pixel of the transparent element within the shooting range, and the depth information of each pixel of the transparent element within the shooting range of each frame can be determined based on the first depth map of each frame.

[0057] Step 102: Determine information of transparent elements within the shooting range that are not blocked by the opaque elements based on the first depth map and the second depth map corresponding to the opaque elements within the shooting range.

[0058] In an embodiment of the present application, when rendering a picture in a game engine, the opaque element rendering process will be executed first to obtain the opaque element rendering data, and then the transparent element rendering process will be executed to obtain the transparent element rendering data. The second depth map corresponding to the opaque element can be obtained directly from the opaque element rendering process without additional drawing. Before executing the transparent element rendering process, a comparison between the first depth map and the second depth map is performed so that the transparent element rendering process can be ignored when it is determined that the transparent element information meets the transparent element rejection conditions, saving device performance overhead. The second depth map includes the depth information of each pixel of the opaque element within the shooting range. According to the transparent element depth information indicated by the first depth map and the opaque element depth information indicated by the second depth map, the front-back relationship of each point of the transparent element relative to the opaque element can be determined frame by frame, thereby determining the information of the transparent elements that are not blocked by the opaque elements within the shooting range.

[0059] Step 103: If the transparent element information meets the transparent element elimination condition, the virtual scene within the shooting range is rendered based on the opaque element rendering data within the shooting range.

[0060] In an embodiment of the present application, it is determined whether the transparent element elimination conditions are met at present based on the transparent element information. If the transparent element elimination conditions are met, it means that there are no transparent elements that need to be displayed within the shooting range, then the transparent element rendering process is directly skipped, and the virtual scene rendering of the current frame is directly performed based on the opaque element rendering data. Optionally, if the transparent element information does not meet the transparent element elimination conditions, the virtual scene within the shooting range is rendered based on the opaque element rendering data and the transparent element rendering data within the shooting range. Among them, if the transparent element information of the current frame does not meet the transparent element elimination conditions, then it means that there are transparent elements within the shooting range that cannot be eliminated and need to be displayed. At this time, the virtual scene rendering of the current frame is performed based on the opaque element rendering data and the transparent element rendering data.

[0061] Among them, the transparent elements executing the method of this embodiment can be water elements with a large area in the game, such as rivers, lakes, and moors. In some scenes, for example, transparent elements in a game scene containing an ice and snow world can also be ice elements, and transparent elements in a game scene containing a glass plank road can also be glass elements. In the case where there are multiple transparent elements, a first depth map of each transparent element can be drawn separately, and then the first depth map and the second depth map are compared one by one to determine the transparent element information of the transparent elements in each first depth map that are not blocked by opaque elements, and to determine whether each transparent element meets the corresponding transparent element rejection condition, so that when it is determined that each transparent element meets the corresponding transparent element rejection condition, the opaque element rendering data is directly used to render the virtual scene, and if one or more transparent elements do not meet the corresponding transparent element rejection condition, the opaque element rendering data and the rendering data of the transparent elements that do not meet the transparent element rejection condition are used to render the virtual scene.

[0062] Optionally, the transparent element culling condition at least includes: the transparent element is completely blocked by the opaque element; it may also include: the transparent element not blocked by the opaque element is smaller than a first preset size; and / or the transparent element not blocked by the opaque element is smaller than a second preset size, and the transparent element not blocked by the opaque element is located in a non-core area of ​​the screen space. Among them, the transparent element culling condition may be that the transparent element is completely invisible within the shooting range, that is, the transparent element is completely blocked by the opaque element or there is no transparent element within the shooting range; it may also be that there are fewer transparent elements visible within the shooting range, that is, the transparent element not blocked by the opaque element is smaller than the first preset size; it may also be that there are fewer transparent elements visible within the shooting range and they are in an area that is visually easily ignored, such as a peripheral position of the shooting range, that is, the transparent element not blocked by the opaque element is smaller than the second preset size, and the transparent element not blocked by the opaque element is located in a non-core area of ​​the screen space. In practical applications, in order to ensure the complete accuracy of the game screen and avoid sudden changes in transparent elements in the screen caused by the fast movement of the virtual camera lens, transparent elements can be completely blocked by opaque elements or there are no transparent elements at all in the shooting range, and transparent elements will not be rendered.

[0063] By applying the technical solution of this embodiment, in the process of rendering a virtual scene, a first depth map corresponding to transparent elements within the shooting range of the virtual camera is drawn frame by frame, and based on the first depth map and the second depth map corresponding to opaque elements within the shooting range, the transparent element information that is not blocked by the opaque elements within the shooting range is determined, so that when the transparent element information meets the transparent element culling conditions, the transparent elements are ignored and the opaque element rendering data within the shooting range is directly used to render the virtual scene within the shooting range. This application determines the transparent elements within the shooting range that meet the culling conditions by drawing a transparent element depth map and comparing it with the opaque element depth map, which can reduce the computing overhead when rendering the scene, and does not require artists to pre-produce huge art assets, making game development more efficient.

[0064] Further, 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 rendering method for removing obstructed transparent elements is provided, such as Figure 2 As shown, the method includes:

[0065] Step 201 : in the process of rendering a virtual scene, determining the current viewpoint parameters of the virtual camera, and determining a first depth map matching the current viewpoint parameters based on a preset placeholder grid map corresponding to the transparent elements.

[0066] In an embodiment of the present application, in order to determine the need to remove transparent elements, this embodiment takes the transparent element as a water element as an example, and pre-draws a preset placeholder grid map of the water element, and the preset placeholder grid map is used to represent the water placeholder in the game scene. Thus, during the game, according to the current viewpoint parameters of each frame of the virtual camera, a first depth map corresponding to the current viewpoint parameters is obtained in the preset placeholder grid map, and the first depth map of each frame represents the depth information of the water elements contained in the shooting range of each frame of the virtual camera. Specifically, a depth map drawing process can be added to the game engine. This process uses the depth map drawing process to draw a first depth map of the water elements existing in the shooting range of the virtual camera before the water element rendering process, wherein the first depth map has the same resolution as the second depth map of the opaque elements obtained by the opaque element rendering process in the game engine.

[0067] Step 202 : Identify whether there are pixels in the first depth map whose depth values ​​are greater than a preset depth value, wherein the preset depth value is determined according to a preset visible distance corresponding to a visible transparent element.

[0068] In the embodiment of the present application, the first depth map is first used to determine whether there are visible water elements within the shooting range, and then the transparent element information within the shooting range that is not blocked by opaque elements is determined based on the first depth map and the second depth map when it is determined that there are visible water elements. Among them, the size of the pixel depth value represents the distance between the pixel and the virtual camera, and the larger the depth value, the closer to the virtual camera. When determining whether there are visible water elements within the shooting range, the depth value of each pixel in the first depth map can be compared with the preset depth value one by one. If there are pixels in the first depth map with a depth value greater than the preset depth value, it means that there are visible water elements within the shooting range. Conversely, if the depth values ​​of each pixel in the first depth map are not greater than the preset depth value, it means that there are no visible water elements within the shooting range. It should be noted that the size of the preset depth value is determined according to the preset visible distance corresponding to the visible water element. If it is believed that the water element can be seen as long as it exists within the shooting range, then the preset depth value can be set to 0. If it is believed that the water element within the shooting range is invisible when the distance between it and the virtual camera exceeds a certain distance, then the preset depth value can be determined based on this distance. That is, the water body farther away from the virtual camera can be ignored and directly not participate in subsequent rendering. For example, the preset depth value can be calculated by the near and far clipping distance of the virtual camera and the perspective division to determine the water body that is visually ignored. Generally, this value is less than 0.1.

[0069] In addition, in practice, it is found that if water bodies that are too far away are ignored, mutations (sudden appearance or sudden disappearance) may occur when the distance between the virtual camera and the water body changes rapidly. Therefore, in game scenes where the virtual camera may move faster than the preset value, the preset depth value can be set to 0, and in game scenes where the virtual camera does not move faster than the preset value, the preset depth value can be set to a positive number less than 0.1.

[0070] Step 203: If not, determine that there is no visible transparent element in the shooting range, render the virtual scene in the shooting range based on the opaque element rendering data in the shooting range.

[0071] In the embodiment of the present application, if there is no visible water element within the shooting range, that is, there is no visible water in all pixels ultimately displayed on the current screen, then the water element rendering process is skipped and the subsequent rendering process is continued.

[0072] Step 204: if so, determine that there is a visible transparent element within the shooting range, and obtain a second depth map obtained by executing the opaque element rendering process; for each pixel in the first depth map, if the depth value of the pixel is greater than the depth value of the pixel at the corresponding position in the second depth map, determine that the pixel is a transparent element pixel that is not blocked by the opaque element within the shooting range, and extract the information of the transparent element pixel in the first depth map as the transparent element information.

[0073] In an embodiment of the present application, if there are visible water elements within the shooting range, and there are visible water bodies in the pixels finally displayed on the current screen, it is necessary to further determine whether the visible water elements are blocked by opaque elements. Specifically, the pixels at the same position on the first depth map and the second depth map are compared pair by pair to determine whether the depth value of each pixel in the first depth map is greater than the depth value of the pixel at the same position in the second depth map, wherein the size of the pixel depth value represents the distance between the pixel and the virtual camera, and the larger the depth value, the closer to the virtual camera. Therefore, if the depth value of a pixel in the first depth map is greater than the depth value of the pixel at that position in the second depth map, it means that the pixel in the first depth map is closer to the virtual camera, and the water element pixel in the first depth map is a water element that can be seen within the shooting range. Specifically, the depth values ​​of each pixel between the first depth map and the second depth map can be compared and calculated by the compute shader in the game engine to determine the transparent element information.

[0074] Step 205: If the transparent element information meets the transparent element elimination condition, the virtual scene within the shooting range is rendered based on the opaque element rendering data within the shooting range.

[0075] In the embodiment of the present application, if the transparent element information meets the transparent element elimination condition, then the transparent element rendering process is skipped, and the subsequent rendering process is continued to perform virtual scene rendering using opaque element rendering data.

[0076] In an embodiment of the present application, optionally, a graphics processing unit (GPU) is used to draw the first depth map, determine the transparent element information, and generate a result of whether the transparent element information meets the transparent element culling condition; a central processing unit (CPU) is used to read the result generated by the image processor, and based on the result, the virtual scene rendering process is controlled, wherein, when the result is that the transparent element information meets the transparent element culling condition, the transparent element rendering process is skipped and other rendering processes are performed.

[0077] In this embodiment, the virtual scene rendering is performed frame by frame during the game, such as Figure 3 As shown, taking any frame as an example, add the water depth calculation process WaterDepthTest Pass (including the depth map drawing process recorded as Depth-Only Pass, the water depth initialization calculation shader recorded as WaterDepthClear, and the water depth comparison calculation shader recorded as WaterDepthCompare) and the water rendering process after the opaque element rendering process ForwardOpaque Pass of the game engine. Figure 4As shown, the following steps are performed by the graphics processor GPU: the first depth map WaterDepth of the water element is drawn using the depth map drawing process Depth-OnlyPass; the water depth initialization calculation shader Water DepthClear initializes the water depth comparison result WaterDepthTestBuffer=0; the water depth comparison calculation shader WaterDepthCompare determines whether there are visible water elements within the shooting range (i.e., identifies whether there are pixels with depth values ​​greater than the preset depth value in the first depth map WaterDepth), and directly generates a water depth comparison result WaterDepthTestBuffer that meets the transparent element removal condition when there are no visible water elements, and compares the pixels at the same position on the first depth map WaterDepth and the second depth map OpaqueDepth one by one when there are visible water elements, and generates a result WaterDepthTestBuffer based on the comparison result whether it meets the transparent element removal condition. For example, if WaterDepthTestBuffer is 1, it means that the transparent element removal condition is not met, and if WaterDepthTestBuffer is 0, it means that the transparent element removal condition is met. The GPU has one frame of time to perform the above calculations to ensure that the device runs smoothly, and a one-frame display delay will not cause visual differences, which can ensure that the visual effect is not affected while ensuring that the device runs smoothly and the picture is smooth. The central processing unit CPU asynchronously reads the result WaterOpenFlag generated by the graphics processing unit GPU, that is, reads the result of the previous frame, saves the result as WaterOpenFlag, and determines whether to start the water body rendering process based on the result. For example, if WaterOpenFlag is 1, the water body rendering process is started, and if WaterOpenFlag is 0, the water body rendering process is skipped and other rendering processes in the game engine continue to be executed (such as the rendering process of other transparent elements except water bodies or other rendering processes other than the non-transparent element rendering process).

[0078] It should be noted that the other rendering passes in the figure are the original rendering passes in the game engine, which are executed according to the actual rendering pass situation in the game engine. If there is one, it will be executed, otherwise it will be ignored. The embodiment of the present application adds a water depth calculation process WaterDepthTest Pass and a water body rendering process after the opaque element rendering process ForwardOpaque Pass of the game engine and before the final presentation of the virtual scene effect. The other rendering processes in the game engine remain unchanged.

[0079] In an embodiment of the present application, optionally, when it is determined that the transparent information meets the transparent element culling condition, the rendered virtual scene is presented at a first preset frame rate; when it is determined that the transparent information does not meet the transparent element culling condition, the rendered virtual scene is presented at a second preset frame rate, wherein the first preset frame rate is greater than the second preset frame rate.

[0080] In this embodiment, in order to further ensure the smoothness of the game screen and avoid the calculation of transparent elements and the rendering of transparent elements causing the processing time to exceed the display time of a frame, the frame rate of the picture can be appropriately increased when it is determined that the transparent element removal conditions are met, and the frame rate of the picture can be appropriately reduced when it is determined that the transparent element rendering is required to ensure that the picture is smooth and not stuck. For example, the frame rate can be adjusted to 45 frames / second when there are water elements that are not blocked by opaque elements within the shooting range, and the frame rate can be adjusted to 55 frames / second when there are no water elements that are not blocked by opaque elements within the shooting range. It should be understood by those skilled in the art that the adjustment of the above frame rate can be achieved by manual setting or automatic adjustment. In addition, the above-mentioned calculation overhead saved by eliminating transparent elements can also be used to compensate for the additional overhead caused by dynamic loading when the game is running, such as the player's skill special effects, which will increase the rendering overhead in a short time when the skill is released. If the rendering of transparent elements is skipped when the conditions are met at this time, the saved time can be used for these additional expenses, avoiding the sudden reduction of the frame rate causing the picture to jump.

[0081] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a rendering device for removing obstructed transparent elements, such as Figure 5 As shown, the device comprises:

[0082] A depth map acquisition module is used to draw a first depth map corresponding to transparent elements within the shooting range of the virtual camera during the process of rendering the virtual scene;

[0083] A determination module, configured to determine information of transparent elements within the shooting range that are not blocked by the opaque elements based on the first depth map and a second depth map corresponding to the opaque elements within the shooting range;

[0084] A rendering module is used to render the virtual scene within the shooting range based on the opaque element rendering data within the shooting range if the transparent element information meets the transparent element elimination condition.

[0085] Optionally, the determination module is further used to: identify whether there is a pixel point in the first depth map whose depth value is greater than a preset depth value, wherein the preset depth value is determined according to a preset visible distance corresponding to the visible transparent element;

[0086] The depth map acquisition module is further used to: if there is a visible transparent element in the shooting range, determine that there is a visible transparent element in the shooting range, and acquire a second depth map corresponding to the opaque element in the shooting range;

[0087] The rendering module is further used to: if not, determine that there is no visible transparent element in the shooting range, render the virtual scene in the shooting range based on the opaque element rendering data in the shooting range.

[0088] Optionally, the determination module is also used to: for each pixel point in the first depth map, if the depth value of the pixel point is greater than the depth value of the pixel point at the corresponding position in the second depth map, determine that the pixel point is a transparent element pixel point that is not blocked by the opaque element within the shooting range, and extract the information of the transparent element pixel point in the first depth map as the transparent element information.

[0089] Optionally, the depth map acquisition module is further used to:

[0090] Determine current viewpoint parameters of the virtual camera, and determine a first depth map matching the current viewpoint parameters based on a preset placeholder grid map corresponding to the transparent element;

[0091] A second depth map obtained by performing an opaque element rendering process is obtained.

[0092] Optionally, the depth map acquisition module is further used to: draw the first depth map through a graphics processor;

[0093] The determination module is further used to: determine the transparent element information through a graphics processor, and generate a result of whether the transparent element information meets the transparent element elimination condition;

[0094] The rendering module is also used to: read the result generated by the image processor through the central processing unit, and control the virtual scene rendering process based on the result, wherein when the result is that the transparent element information meets the transparent element culling condition, skip the transparent element rendering process and perform other rendering processes.

[0095] Optionally, the rendering module is further configured to: present the rendered virtual scene at a first preset frame rate when it is determined that the transparent information meets the transparent element culling condition;

[0096] When it is determined that the transparent information does not meet the transparent element elimination condition, the rendered virtual scene is presented at a second preset frame rate, wherein the first preset frame rate is greater than the second preset frame rate.

[0097] Optionally, the transparent element culling conditions include: the transparent element is completely blocked by the opaque element; the transparent element not blocked by the opaque element is smaller than a first preset size; the transparent element not blocked by the opaque element is smaller than a second preset size, and the transparent element not blocked by the opaque element is located in a non-core area of ​​the screen space.

[0098] It should be noted that for other corresponding descriptions of the functional units involved in the rendering device for removing obstructed transparent elements provided in the embodiment of the present application, reference can be made to Figure 1 to Figure 2 The corresponding description in the method will not be repeated here.

[0099] The embodiment of the present application also provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. Among them, 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 the 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 through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.

[0100] Those skilled in the art will appreciate 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 arrangement of components.

[0101] 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.

[0102] 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.

[0103] 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.

[0104] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed 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 the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an 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 each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided in this application may be a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited thereto.

[0105] The technical features of the above embodiments may 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.

[0106] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A rendering method for removing obstructed transparent elements, characterized in that: The method comprises: In the process of rendering the virtual scene, a first depth map corresponding to transparent elements within the shooting range of the virtual camera is drawn; Determining, based on the first depth map and the second depth map corresponding to the opaque elements within the shooting range, information of transparent elements within the shooting range that are not blocked by the opaque elements; If the transparent element information meets the transparent element elimination condition, the virtual scene within the shooting range is rendered based on the opaque element rendering data within the shooting range.

2. The method according to claim 1, characterized in that: After drawing the first depth map corresponding to the transparent elements within the shooting range of the virtual camera, the method further includes: Identify whether there is a pixel point in the first depth map whose depth value is greater than a preset depth value, wherein the preset depth value is determined according to a preset visible distance corresponding to the visible transparent element; If so, determining that there is a visible transparent element within the shooting range, and obtaining a second depth map corresponding to the opaque element within the shooting range; If not, it is determined that there is no visible transparent element in the shooting range, and the virtual scene in the shooting range is rendered based on the opaque element rendering data in the shooting range.

3. The method according to claim 1 or 2, characterized in that: The determining, based on the first depth map and the second depth map corresponding to the opaque elements within the shooting range, information of transparent elements within the shooting range that are not blocked by the opaque elements includes: For each pixel point in the first depth map, if the depth value of the pixel point is greater than the depth value of the pixel point at the corresponding position in the second depth map, the pixel point is determined to be a transparent element pixel point that is not blocked by the opaque element within the shooting range, and the information of the transparent element pixel point is extracted from the first depth map as the transparent element information.

4. The method according to claim 1 or 2, characterized in that: The drawing of a first depth map corresponding to transparent elements within the shooting range of the virtual camera includes: Determine current viewpoint parameters of the virtual camera, and determine a first depth map matching the current viewpoint parameters based on a preset placeholder grid map corresponding to the transparent element; The method further comprises: A second depth map obtained by performing an opaque element rendering process is obtained.

5. The method according to claim 1 or 2, characterized in that: The method further comprises: Drawing the first depth map, determining the transparent element information, and generating a result of whether the transparent element information meets the transparent element culling condition by means of a graphics processor; The result generated by the image processor is read through the central processing unit, and the virtual scene rendering process is controlled based on the result, wherein when the result is that the transparent element information meets the transparent element culling condition, the transparent element rendering process is skipped to perform other rendering processes.

6. The method according to claim 1 or 2, characterized in that: The method further comprises: When it is determined that the transparent information meets the transparent element culling condition, presenting the rendered virtual scene at a first preset frame rate; When it is determined that the transparent information does not meet the transparent element elimination condition, the rendered virtual scene is presented at a second preset frame rate, wherein the first preset frame rate is greater than the second preset frame rate.

7. The method according to claim 1 or 2, characterized in that: The transparent element culling conditions include: the transparent element is completely blocked by the opaque element; the transparent element not blocked by the opaque element is smaller than a first preset size; the transparent element not blocked by the opaque element is smaller than a second preset size, and the transparent element not blocked by the opaque element is located in a non-core area of ​​the screen space.

8. A rendering device for removing obstructed transparent elements, characterized in that: The device comprises: A depth map acquisition module is used to draw a first depth map corresponding to transparent elements within the shooting range of the virtual camera during the process of rendering the virtual scene; A determination module, configured to determine information of transparent elements within the shooting range that are not blocked by the opaque elements based on the first depth map and a second depth map corresponding to the opaque elements within the shooting range; A rendering module is used to render the virtual scene within the shooting range based on the opaque element rendering data within the shooting range if the transparent element information meets the transparent element elimination condition.

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, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Method and system for realizing three-dimensional visibility analysis

    CN120931805A