Rendering Method, Device, Computer Device and Readable Storage Medium for Occlusion Effect

By determining and drawing the occlusion area during the rendering process, combining preset occlusion textures and rendering models, the problem of inability to effectively judge and reflect the translucent occlusion area in the prior art is solved, and a more realistic and rich rendering effect is achieved.

CN114332333BActive Publication Date: 2025-05-27SHANGHAI PERFECT WORLD SOFTWARE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111620996.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2025-05-27
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

The prior art cannot effectively judge and reflect the area where the character is blocked by a translucent object, resulting in a lack of realism in the rendering effect and cannot meet the detection and stylized performance of the translucent occlusion area.

Method used

By determining the occlusion to be rendered and writing it to the temporary rendering texture, obtaining the model to be rendered and writing it in the temporary rendering texture, determining the occlusion area and drawing it with the preset occlusion texture, obtaining the occlusion effect map, and integrating it with the model to be rendered to obtain the occlusion effect.

Benefits of technology

It realizes accurate identification and stylized drawing of translucent object occlusion areas, improves the authenticity and richness of the rendering effect, and meets the needs of detection and stylized expression of translucent object occlusion areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114332333B_ABST
    Figure CN114332333B_ABST
Patent Text Reader

Abstract

The present application discloses a rendering method, device, computer device and readable storage medium for occlusion effect, which relates to the field of computer technology. By using a temporary rendering texture, it can accurately identify the occluded area of semi-transparent objects and reflect the occlusion effect, meeting the detection of semi-transparent occluded areas and stylized presentations. The method includes: determining the occluder to be rendered and writing the occluder to be rendered into the created temporary rendering texture; obtaining the model to be rendered and writing the model to be rendered into the temporary rendering texture with the occluder to be rendered written therein to obtain an intermediate rendering texture; determining the occluded area on the intermediate rendering texture and using a preset occlusion texture to draw the occluded area on the intermediate rendering texture to obtain an occlusion effect map, where the occluded area is the area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture; integrating the occlusion effect map with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In recent years, rendering technology has been developing continuously, and both users and developers have higher and higher requirements for image rendering. In many large models, there may be occlusion relationships between models and between models and special effects in the scene. For example, in some game battle scenes, characters are occluded by bright fire effects, and the rendering of occlusion effects will directly affect the player's judgment of the character's position. Therefore, how to render occlusion effects in a stylized manner has become a key point in the field of graphics processing.

[0003] In the related art, when rendering occlusion effects, a post-stroke method is usually used to stroke the character occluded by a translucent object, showing the outline of the entire character without showing the details of the character. However, the post-stroke method cannot determine the area of ​​the character that is occluded by the semi-transparent object. It only shows the outline of the entire character, and cannot reflect the effect of partial occlusion of the character. It also cannot detect the area occluded by the translucent object. The rendering effect is single, resulting in a lack of realism in the rendering effect, and it is difficult to meet the detection of the translucent occlusion area and the stylized expression. Summary of the invention

[0004] In view of this, the present application provides a rendering method, device, computer equipment and readable storage medium for occlusion effects. The main purpose is to solve the problem that the current post-stroke method cannot determine the area of ​​the character that is semi-transparently occluded, cannot reflect the effect of partial occlusion of the character, and the rendering effect is single, resulting in a lack of realism in the rendering effect.

[0005] According to a first aspect of the present application, a method for rendering an occlusion effect is provided, the method comprising:

[0006] Determine an occluder to be rendered, and write the occluder to be rendered into the created temporary rendering texture;

[0007] Acquire a model to be rendered, write the model to be rendered into the temporary rendering texture in which the occluder to be rendered is written, and obtain an intermediate rendering texture;

[0008] Determine an occlusion area on the intermediate rendering texture, and use a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map, wherein the occlusion area is an area formed by the intersection of the occlusion object to be rendered and the model to be rendered on the intermediate rendering texture;

[0009] The occlusion effect map is integrated with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered.

[0010] Optionally, writing the to-be-rendered occluder into the created temporary rendering texture comprises:

[0011] Creating a temporary single-channel map, and using the single-channel map as the temporary rendering texture;

[0012] Rendering the to-be-rendered occluder into the temporary rendering texture, and determining a plurality of designated pixels covered by the to-be-rendered occluder in the temporary rendering texture;

[0013] Writing a preset value for each of the plurality of designated pixels in a template buffer of the temporary rendering texture;

[0014] Determine multiple mapping positions of the multiple specified pixels on the occluder to be rendered, write a first pixel depth value corresponding to each of the multiple mapping positions on the occluder to be rendered into a depth buffer of the temporary rendering texture, and obtain the temporary rendering texture with the occluder to be rendered written therein.

[0015] Optionally, determining an occluder to be rendered includes:

[0016] Determine the special effect to be rendered, and query the special effect node corresponding to the special effect to be rendered;

[0017] Perform special effect demonstration based on the special effect node to form a special effect area;

[0018] Extracting the area outline of the special effect area, drawing a semi-transparent geometric body according to the area outline, and using the semi-transparent geometric body as the occluder to be rendered.

[0019] Optionally, writing the model to be rendered into the temporary rendering texture in which the occluder to be rendered is written to obtain an intermediate rendering texture comprises:

[0020] Rendering the model to be rendered to the temporary rendering texture in which the occluder to be rendered is written;

[0021] Determine, on the occluder to be rendered written in the temporary rendering texture, a plurality of designated positions covered by the model to be rendered;

[0022] Determine a second pixel depth value corresponding to each designated position in the plurality of designated positions on the model to be rendered, and obtain the intermediate rendering texture.

[0023] Optionally, after determining the pixel depth value corresponding to each of the multiple specified positions on the model to be rendered and obtaining the intermediate rendering texture, the method further includes:

[0024] For each designated position of the multiple designated positions, obtaining a target first pixel value corresponding to the designated position in the depth buffer, and determining a target second pixel value corresponding to the designated position;

[0025] When the target second pixel value is greater than the target first pixel value, a depth tag is added to the designated position.

[0026] Optionally, determining the occlusion area on the intermediate rendering texture includes:

[0027] Detecting the template buffer of the intermediate rendering texture, and extracting an initial mapping area in which a preset value is written in the template buffer;

[0028] Detecting a depth buffer of the initial mapping area, and determining a plurality of target positions to which depth tags are added in the depth buffer;

[0029] The multiple target positions are extracted, and an area formed by the multiple target positions is used as the occlusion area.

[0030] Optionally, the integrating the occlusion effect map with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered includes:

[0031] Rendering the virtual scene loaded with the model to be rendered to generate an original scene picture;

[0032] Sampling the occlusion effect map to obtain map pixels of the occlusion effect map;

[0033] A preset mixing method is adopted to mix the map pixels sampled in the occlusion effect map with the picture pixels of the original scene picture to obtain the occlusion effect of the occluder to be rendered on the model to be rendered.

[0034] According to a second aspect of the present application, a rendering device for an occlusion effect is provided, the device comprising:

[0035] A writing module, used for determining an occluder to be rendered, and writing the occluder to be rendered into the created temporary rendering texture;

[0036] The writing module is further used to obtain a model to be rendered, write the model to be rendered into the temporary rendering texture in which the occluder to be rendered is written, and obtain an intermediate rendering texture;

[0037] A drawing module, used to determine an occlusion area on the intermediate rendering texture, and use a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map, wherein the occlusion area is an area formed by the intersection of the occlusion object to be rendered and the model to be rendered on the intermediate rendering texture;

[0038] An integration module is used to integrate the occlusion effect map with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered.

[0039] Optionally, the writing module is used to create a temporary single-channel map and use the single-channel map as the temporary rendering texture; render the occluder to be rendered into the temporary rendering texture, and determine a plurality of designated pixels covered by the occluder to be rendered in the temporary rendering texture; write a preset value for each of the plurality of designated pixels in the template buffer of the temporary rendering texture; determine a plurality of mapping positions of the plurality of designated pixels on the occluder to be rendered, and write a first pixel depth value corresponding to each of the plurality of mapping positions on the occluder to be rendered into the depth buffer of the temporary rendering texture to obtain the temporary rendering texture with the occluder to be rendered written therein.

[0040] Optionally, the writing module is used to determine the special effect to be rendered, query the special effect node corresponding to the special effect to be rendered; perform special effect demonstration based on the special effect node to form a special effect area; extract the area outline of the special effect area, draw a translucent geometric body according to the area outline, and use the translucent geometric body as the occluder to be rendered.

[0041] Optionally, the writing module is used to render the model to be rendered to the temporary rendering texture in which the occluder to be rendered is written; determine a plurality of designated positions covered by the model to be rendered on the occluder to be rendered written in the temporary rendering texture; determine a second pixel depth value corresponding to each of the plurality of designated positions on the model to be rendered, and obtain the intermediate rendering texture.

[0042] Optionally, the device further comprises:

[0043] A determination module, configured to obtain, for each of the plurality of designated positions, a target first pixel value corresponding to the designated position in the depth buffer, and determine a target second pixel value corresponding to the designated position;

[0044] An adding module is used to add a depth tag to the designated position when the target second pixel value is greater than the target first pixel value.

[0045] Optionally, the drawing module is used to detect the template buffer of the intermediate rendering texture, extract an initial mapping area with a preset value written in the template buffer; detect the depth buffer of the initial mapping area, determine a plurality of target positions with depth tags added in the depth buffer; extract the plurality of target positions, and use the area formed by the plurality of target positions as the occlusion area.

[0046] Optionally, the integration module is used to render the virtual scene loaded with the model to be rendered to generate an original scene picture; sample the occlusion effect map to obtain the map pixels of the occlusion effect map; and use a preset mixing method to mix the map pixels sampled in the occlusion effect map with the picture pixels of the original scene picture to obtain the occlusion effect of the occlusion object to be rendered on the model to be rendered.

[0047] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.

[0048] According to a fourth aspect of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the methods described in the first aspect are implemented.

[0049] By means of the above technical scheme, the present application provides a rendering method, device, computer equipment and readable storage medium for occlusion effect, the present application determines the occluder to be rendered, writes the occluder to be rendered into a created temporary rendering texture, obtains the model to be rendered, writes the model to be rendered into the temporary rendering texture in which the occluder to be rendered is written, obtains the intermediate rendering texture, determines the occlusion area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture on the intermediate rendering texture, uses the preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain the occlusion effect map, integrates the occlusion effect map with the model to be rendered, obtains the occlusion effect of the occluder to be rendered on the model to be rendered, uses a temporary rendering texture to more accurately identify the area occluded by the translucent object and reflects the effect of the partial area of ​​the character being occluded, and by stylizing the occlusion area, the obtained rendering effect is rich and realistic, satisfying the detection and stylized expression of the translucent occlusion area.

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

[0051] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0052] Figure 1 A schematic diagram of a rendering method for an occlusion effect provided in an embodiment of the present application is shown;

[0053] Figure 2A A schematic diagram of a rendering method for an occlusion effect provided in an embodiment of the present application is shown;

[0054] Figure 2B A schematic diagram of a rendering method for an occlusion effect provided in an embodiment of the present application is shown;

[0055] Figure 2C A schematic diagram of a rendering method for an occlusion effect provided in an embodiment of the present application is shown;

[0056] Figure 2D A schematic diagram of a rendering method for an occlusion effect provided in an embodiment of the present application is shown;

[0057] Figure 2E A schematic diagram of a rendering method for an occlusion effect provided in an embodiment of the present application is shown;

[0058] Figure 2F A schematic diagram of a rendering method for an occlusion effect provided in an embodiment of the present application is shown;

[0059] Figure 3 A schematic diagram of the structure of a rendering device for an occlusion effect provided in an embodiment of the present application is shown;

[0060] Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0061] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0062] The present application embodiment provides a rendering method for occlusion effect, such as Figure 1 As shown, the method includes:

[0063] 101. Determine the occluder to be rendered, and write the occluder to be rendered into the created temporary rendering texture.

[0064] 102. Obtain a model to be rendered, write the model to be rendered into a temporary rendering texture in which an occluder to be rendered is written, and obtain an intermediate rendering texture.

[0065] 103. Determine an occlusion area on the intermediate rendering texture, and use a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map. The occlusion area is an area formed by the intersection of the occlusion object to be rendered and the model to be rendered on the intermediate rendering texture.

[0066] 104. Integrate the occlusion effect map with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered.

[0067] The method provided in the embodiment of the present application determines the occluder to be rendered, writes the occluder to be rendered into the created temporary rendering texture, obtains the model to be rendered, writes the model to be rendered into the temporary rendering texture with the occluder to be rendered, obtains the intermediate rendering texture, determines the occlusion area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture, uses a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map, integrates the occlusion effect map with the model to be rendered, and obtains the occlusion effect of the occluder to be rendered on the model to be rendered. A temporary rendering texture can be used to more accurately identify the area occluded by the semi-transparent object and reflect the effect of the partial area of ​​the character being occluded, and by stylizing the occlusion area, the obtained rendering effect is rich and realistic, which meets the detection and stylized expression of the semi-transparent occlusion area.

[0068] The present application embodiment provides a rendering method for occlusion effect, such as Figure 2A As shown, the method includes:

[0069] 201. Determine the occluder to be rendered, and write the occluder to be rendered into the created temporary rendering texture.

[0070] At present, in many large models, there may be occlusion relationships between models and between models and special effects in the scene. There are many cases in the scene where characters are occluded by highlight translucent special effects or patches. For example, in battle, characters are occluded by highlight flame special effects. When rendering occlusion effects, a post-stroke method is usually used to stroke the occluded characters, display the character's outline, and not display the character's details, thereby reflecting the effect that part of the character's area is occluded. However, the applicant recognizes that the post-stroke character method cannot determine the area that is semi-transparently occluded. It is the outline display of the entire character, and only the outline is displayed. The effect is single and cannot meet the detection and stylized expression of the semi-transparent occluded area. Therefore, the present application proposes a rendering method for occlusion effect, which determines the occluder to be rendered, writes the occluder to be rendered into a created temporary rendering texture, obtains the model to be rendered, writes the model to be rendered into the temporary rendering texture with the occluder to be rendered, obtains an intermediate rendering texture, determines on the intermediate rendering texture an occlusion area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture, uses a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map, integrates the occlusion effect map with the model to be rendered, and obtains the occlusion effect of the occluder to be rendered on the model to be rendered. A temporary rendering texture can be used to more accurately identify the area occluded by the translucent object and reflect the effect of the partial area of ​​the character being occluded, and by stylizing the occlusion area, the resulting rendering effect is rich and realistic, satisfying the detection and stylized expression of the translucent occlusion area.

[0071] In order to achieve the rendering of the occlusion effect, it is necessary to first determine the occlusion to be rendered. In an optional embodiment, the rendering process of the occlusion effect can be performed by a rendering tool with graphics processing functions such as a game development engine, an image rendering engine, etc. The process of the rendering tool determining the occlusion to be rendered is as follows: First, determine the special effect to be rendered, query the special effect node corresponding to the special effect to be rendered, and demonstrate the special effect based on the special effect node to form a special effect area. Subsequently, the area outline of the special effect area is extracted, and a translucent geometric body is drawn according to the area outline, and the translucent geometric body is used as the occlusion to be rendered. In a specific application scenario, a translucent geometric body consistent with the outline of the special effect to be rendered can be drawn as the occlusion to be rendered.

[0072] After determining the occluder to be rendered, when drawing the translucent special effect, the rendering tool will create a temporary single-channel map and use the single-channel map as a temporary rendering texture so that the occluder to be rendered can be written into the created temporary rendering texture. It should be noted that the temporary rendering texture can be a rendering texture (RT, RenderTexure) temporarily generated in the rendering pipeline, which is used to draw the special effect node, and a patch or mesh can be placed in the special effect node. When writing the occluder to be rendered into the created temporary rendering texture, an optional implementation method is that the rendering tool can build a grid on the occluder to be rendered in advance to obtain a gridded occluder to be rendered, such as placing a patch or mesh under the occluder to be rendered, so that the rendering tool can render the occluder to be rendered. In this way, the rendering tool renders the occluder to be rendered into the temporary rendering texture, and determines a plurality of specified pixels covered by the occluder to be rendered in the temporary rendering texture. Subsequently, the rendering tool writes a preset value for each of the multiple specified pixels in the template buffer of the temporary rendering texture. Among them, the preset value can be 1, and StencilBuffer=1 can be written in the template buffer for each specified pixel. Next, the rendering tool determines multiple mapping positions of multiple specified pixels on the occluder to be rendered, and writes the first pixel depth value corresponding to each of the multiple mapping positions on the occluder to be rendered into the depth buffer (i.e., DepthBuffer) of the temporary rendering texture to obtain a temporary rendering texture with the occluder to be rendered written into it.

[0073] In this way, through the above process, the occluded object to be rendered is written into the temporary rendering texture, so that the Shader of the temporary rendering texture writes the Stencil information as a mark. After writing the model to be rendered, it is determined whether the Stencil mark of the drawing pixel position is the special effect part of the previous mark. If it is, another coloring method is used to perform various stylized expressions on the intersecting area.

[0074] 202. Obtain a model to be rendered, write the model to be rendered into a temporary rendering texture in which an occluder to be rendered is written, and obtain an intermediate rendering texture.

[0075] In an embodiment of the present application, after the semi-transparent geometric body is drawn, the rendering tool will obtain the model to be rendered, write the model to be rendered in the temporary rendering texture written with the occluder to be rendered, and obtain the intermediate rendering texture. In an optional implementation scheme, the process of generating the intermediate rendering texture is as follows: First, the rendering tool covers the model to be rendered with the temporary rendering texture written with the occluder to be rendered. Among them, since the relative position between the occluder to be rendered and the model to be rendered has been set in the actual scene, for example, the occluder to be rendered may be on the right hand, head or feet of the model to be rendered, etc., therefore, in an optional implementation scheme, the rendering tool can determine the preset relative position between the occluder to be rendered and the model to be rendered, and cover the model to be rendered with the temporary rendering texture written with the occluder to be rendered according to the preset relative position. Subsequently, the rendering tool determines a plurality of designated positions covered by the model to be rendered on the occluder to be rendered written in the temporary rendering texture, and determines the second pixel depth value corresponding to each designated position in the plurality of designated positions on the model to be rendered, and obtains the intermediate rendering texture.

[0076] It should be noted that, since the portion of the occluder to be rendered written into the buffer template is drawn first, in the actual screen, only the intersecting portion of the model to be rendered behind the occluder to be rendered, such as the character portion behind the flame, needs to be drawn. Therefore, in the occluded area determined subsequently, the pixel depth value of the model to be rendered should be greater than the pixel depth value of the portion written into the occluder to be rendered previously. Therefore, in order to facilitate the subsequent extraction of the area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture, in an optional embodiment, for each of the multiple specified positions, the rendering tool can obtain the target first pixel value corresponding to the specified position in the depth buffer, determine the target second pixel value corresponding to the specified position, and when the target second pixel value is greater than the target first pixel value, add a depth tag to the specified position, and the specified position with the depth tag is the part where the depth of the model is greater than the depth of the occluder. Among them, the depth tag can be "Depth>=".

[0077] 203. Determine the occluded area on the intermediate rendering texture.

[0078] In an embodiment of the present application, after writing both the occluder to be rendered and the model to be rendered into the temporary rendering texture to obtain the intermediate rendering texture, the rendering tool will determine the area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture, use the area as the occluded area, and subsequently perform stylized drawing on the occluded area.

[0079] In an optional implementation scheme, the rendering tool can determine the occlusion area by performing a buffer detection and a depth detection on the intermediate rendering texture. The specific process is as follows: First, the rendering tool detects the template buffer of the intermediate rendering texture, and extracts the initial mapping area with a preset value written in the template buffer. In the actual application process, the area where Stencil=1 is detected is used as the initial mapping area. Subsequently, the rendering tool detects the depth buffer of the initial mapping area, and determines multiple target positions with depth tags added in the depth buffer. In the actual application process, the "Depth>=" area is detected in the initial mapping area. In this way, through the above process, multiple target positions of (Stencil=1) and (Depth>=) can be determined, multiple target positions can be extracted, and the area formed by the multiple target positions can be used as the occlusion area, and then the parts that meet the occlusion area can be stylized in the subsequent drawing.

[0080] 204. Use a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map.

[0081] In the embodiment of the present application, after the occlusion area is determined, the rendering tool will obtain a preset occlusion texture, and use the preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map. The preset occlusion texture can be a texture of stylized drawing, that is, a texture with a stylized effect. The stylized drawing can be in various forms, which can be expressed by the rendering tool by default or by an artist through a texture.

[0082] 205. Integrate the occlusion effect map with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered.

[0083] In the embodiment of the present application, after the occlusion effect map is generated, the rendering tool will integrate the occlusion effect map with the model to be rendered in the post-production special effects to obtain the occlusion effect of the occluded object to be rendered on the model to be rendered. In an optional implementation scheme, the process of integrating the occlusion effect map with the model to be rendered is as follows:

[0084] First, the rendering tool renders the virtual scene loaded with the model to be rendered to generate the original scene screen. Subsequently, the rendering tool samples the occlusion effect map to obtain the map pixels of the occlusion effect map, and uses a preset mixing method to mix the map pixels sampled in the occlusion effect map with the screen pixels of the original scene screen to obtain the occlusion effect of the occluded object to be rendered on the model to be rendered. Among them, the preset mixing method is any one of superposition mixing, replacement mixing, and subtraction mixing, so that the rendering tool samples the pixels on the occlusion effect map and the current screen pixels for superposition, replacement, subtraction, etc., and superimposes this occlusion effect map on the normally drawn model to be rendered to form the final effect to meet the stylized expression.

[0085] In summary, the logical process of the rendering method for occlusion effect proposed in this application is as follows:

[0086] See also Figure 2B First, draw the semi-transparent geometry according to the effect to be rendered to obtain the occluder to be rendered. Then, create a temporary rendering texture, draw the occluder to be rendered on the temporary rendering texture, and also draw the model to be rendered on the temporary rendering texture on which the occluder to be rendered is drawn. Next, perform StencilTest (template detection) and DepthTest (depth detection) on the temporary rendering texture to determine the occluded area, and use the preset occlusion texture to draw the occluded area in the intermediate rendering texture to obtain the occlusion effect map. Finally, integrate the occlusion effect map with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered. Specifically, the model to be rendered can be Figure 2C The character model added in the current scene, the occluder to be rendered can be Figure 2D The fire effect added to the character model in Figure 2E As shown in the figure, the character model is blocked to a certain extent, and then the rendering method of the present application can be used to obtain Figure 2F The rendering effect shown makes the blocked part of the character model appear through lines and other textures, helping players understand the specific position of the character model behind the fire effect. The rendering method proposed in this application can achieve a more accurate judgment of the semi-transparent blocked area and express it in a flat stylized way during the drawing process. The use of the rendering method of the occlusion effect proposed in this application in the game can help players identify the specific position of the combat character, improve the game experience and enrich the stylized expression.

[0087] The method provided in the embodiment of the present application determines the occluder to be rendered, writes the occluder to be rendered into the created temporary rendering texture, obtains the model to be rendered, writes the model to be rendered into the temporary rendering texture with the occluder to be rendered, obtains the intermediate rendering texture, determines the occlusion area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture, uses a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map, integrates the occlusion effect map with the model to be rendered, and obtains the occlusion effect of the occluder to be rendered on the model to be rendered. A temporary rendering texture can be used to more accurately identify the area occluded by the semi-transparent object and reflect the effect of the partial area of ​​the character being occluded, and by stylizing the occlusion area, the obtained rendering effect is rich and realistic, which meets the detection and stylized expression of the semi-transparent occlusion area.

[0088] Further, as Figure 1 In a specific implementation of the method, the present application provides a rendering device for an occlusion effect, such as Figure 3 As shown, the device includes: a writing module 301, a drawing module 302 and an integration module 303.

[0089] The writing module 301 is used to determine the occluder to be rendered, and write the occluder to be rendered into the created temporary rendering texture;

[0090] The writing module 301 is further used to obtain a model to be rendered, write the model to be rendered into the temporary rendering texture in which the occluder to be rendered is written, and obtain an intermediate rendering texture;

[0091] The drawing module 302 is used to determine an occlusion area on the intermediate rendering texture, and use a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map, wherein the occlusion area is an area formed by the intersection of the occlusion object to be rendered and the model to be rendered on the intermediate rendering texture;

[0092] The integration module 303 is used to integrate the occlusion effect map with the model to be rendered to obtain the occlusion effect of the occluder to be rendered on the model to be rendered.

[0093] In a specific application scenario, the writing module 301 is used to create a temporary single-channel map and use the single-channel map as the temporary rendering texture; render the occluder to be rendered into the temporary rendering texture, and determine multiple specified pixels covered by the occluder to be rendered in the temporary rendering texture; write a preset value for each of the multiple specified pixels in the template buffer of the temporary rendering texture; determine multiple mapping positions of the multiple specified pixels on the occluder to be rendered, and write the first pixel depth value corresponding to each of the multiple mapping positions on the occluder to be rendered into the depth buffer of the temporary rendering texture to obtain the temporary rendering texture with the occluder to be rendered written in it.

[0094] In a specific application scenario, the writing module 301 is used to determine the special effect to be rendered, query the special effect node corresponding to the special effect to be rendered; perform special effect demonstration based on the special effect node to form a special effect area; extract the area outline of the special effect area, draw a translucent geometric body according to the area outline, and use the translucent geometric body as the occluder to be rendered.

[0095] In a specific application scenario, the writing module 301 is used to render the model to be rendered to the temporary rendering texture in which the occluder to be rendered is written; determine multiple specified positions covered by the model to be rendered on the occluder to be rendered written in the temporary rendering texture; determine the second pixel depth value corresponding to each of the multiple specified positions on the model to be rendered, and obtain the intermediate rendering texture.

[0096] In a specific application scenario, the device also includes:

[0097] A determination module, configured to obtain, for each of the plurality of designated positions, a target first pixel value corresponding to the designated position in the depth buffer, and determine a target second pixel value corresponding to the designated position;

[0098] An adding module is used to add a depth tag to the designated position when the target second pixel value is greater than the target first pixel value.

[0099] In a specific application scenario, the drawing module 302 is used to detect the template buffer of the intermediate rendering texture, extract the initial mapping area with a preset value written in the template buffer; detect the depth buffer of the initial mapping area, determine multiple target positions with depth tags added in the depth buffer; extract the multiple target positions, and use the area formed by the multiple target positions as the occlusion area.

[0100] In a specific application scenario, the integration module 303 is used to render a virtual scene loaded with the model to be rendered to generate an original scene picture; sample the occlusion effect map to obtain the map pixels of the occlusion effect map; and use a preset mixing method to mix the map pixels sampled in the occlusion effect map with the picture pixels of the original scene picture to obtain the occlusion effect of the occlusion object to be rendered on the model to be rendered.

[0101] The device provided by the embodiment of the present application determines the occluder to be rendered, writes the occluder to be rendered into the created temporary rendering texture, obtains the model to be rendered, writes the model to be rendered into the temporary rendering texture in which the occluder to be rendered is written, obtains the intermediate rendering texture, determines the occlusion area formed by the intersection of the occluder to be rendered and the model to be rendered on the intermediate rendering texture on the intermediate rendering texture, uses a preset occlusion texture to draw the occlusion area in the intermediate rendering texture to obtain an occlusion effect map, integrates the occlusion effect map with the model to be rendered, and obtains the occlusion effect of the occluder to be rendered on the model to be rendered. A temporary rendering texture can be used to more accurately identify the area occluded by the semi-transparent object and reflect the effect of the partial area of ​​the character being occluded, and by stylizing the occlusion area, the obtained rendering effect is rich and realistic, which meets the detection and stylized expression of the semi-transparent occlusion area.

[0102] It should be noted that for other corresponding descriptions of the functional units involved in the rendering device for an occlusion effect provided in the embodiment of the present application, reference can be made to Figure 1 and FIG. 2A to FIG. 2B The corresponding description in will not be repeated here.

[0103] In an exemplary embodiment, see Figure 4 , and also provides a computer device, which includes a bus, a processor, a memory and a communication interface, and may also include an input and output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the rendering method of the occlusion effect in the above embodiment.

[0104] A computer-readable storage medium stores a computer program, which implements the steps of the rendering method for the occlusion effect when executed by a processor.

[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by hardware, or by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0106] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required for implementing the present application.

[0107] Those skilled in the art will appreciate that the modules in the device in the implementation scenario can be distributed in the device in the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple sub-modules.

[0108] The above application serial numbers are for description only and do not represent the advantages or disadvantages of the implementation scenarios.

[0109] The above disclosure only discloses several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be conceived by technicians in this field should fall within the scope of protection of the present application.

Claims

1. A rendering method for occlusion effect, characterized in that, it includes: Determine the occlusion object to be rendered, and write the occlusion object to be rendered into a created temporary rendering texture. Among them, writing the occlusion object to be rendered into the created temporary rendering texture includes: creating a temporary single-channel texture map, and using the single-channel texture map as the temporary rendering texture; rendering the occlusion object to be rendered into the temporary rendering texture, and determining multiple specified pixels covered by the occlusion object to be rendered in the temporary rendering texture; writing a preset value for each specified pixel among the multiple specified pixels in the stencil buffer of the temporary rendering texture; determining multiple mapping positions of the multiple specified pixels on the occlusion object to be rendered, and writing the first pixel depth value corresponding to each mapping position on the occlusion object to be rendered into the depth buffer of the temporary rendering texture, so as to obtain the temporary rendering texture written with the occlusion object to be rendered; Obtain the model to be rendered, and write the model to be rendered into the temporary rendering texture written with the occlusion object to be rendered to obtain an intermediate rendering texture; Determine an occlusion area on the intermediate rendering texture, and draw the occlusion area on the intermediate rendering texture with a preset occlusion texture to obtain an occlusion effect texture map. The occlusion area is an area formed by the intersection of the occlusion object to be rendered and the model to be rendered on the intermediate rendering texture; Integrate the occlusion effect texture map with the model to be rendered to obtain the occlusion effect of the occlusion object to be rendered on the model to be rendered.

2. The method according to claim 1, characterized in that, the determining the occlusion object to be rendered includes: determining the special effect to be rendered, and querying the special effect node corresponding to the special effect to be rendered; performing a special effect demonstration based on the special effect node to form a special effect area; extracting the area contour of the special effect area, and drawing a semi-transparent geometric body according to the area contour, and using the semi-transparent geometric body as the occlusion object to be rendered.

3. The method according to claim 1, characterized in that, the writing the model to be rendered into the temporary rendering texture written with the occlusion object to be rendered to obtain an intermediate rendering texture includes: rendering the model to be rendered into the temporary rendering texture written with the occlusion object to be rendered; determining multiple specified positions covered by the model to be rendered on the occlusion object written in the temporary rendering texture; determining the second pixel depth value corresponding to each specified position among the multiple specified positions on the model to be rendered to obtain the intermediate rendering texture.

4. The method according to claim 3, characterized in that, after determining the second pixel depth value corresponding to each specified position among the multiple specified positions on the model to be rendered to obtain the intermediate rendering texture, the method further includes: for each specified position among the multiple specified positions, obtaining the target first pixel value corresponding to the specified position in the depth buffer, and determining the target second pixel value corresponding to the specified position on the model to be rendered; When the target second pixel value is greater than the target first pixel value, add a depth label to the specified position.

5. The method according to claim 1, wherein, the determining the occlusion area on the intermediate rendering texture includes: detecting the stencil buffer of the intermediate rendering texture, and extracting an initial texture area in which a preset value is written in the stencil buffer; detecting the depth buffer of the initial texture area, and determining a plurality of target positions to which depth labels are added in the depth buffer; extracting the plurality of target positions, and using the area formed by the plurality of target positions as the occlusion area.

6. The method according to claim 1, wherein, the integrating the occlusion effect texture with the model to be rendered to obtain the occlusion effect of the occlusion object to be rendered on the model to be rendered includes: rendering a virtual scene loaded with the model to be rendered to generate an original scene image; sampling the occlusion effect texture to obtain the texture pixels of the occlusion effect texture; using a preset blending method to blend the texture pixels sampled from the occlusion effect texture with the image pixels of the original scene image to obtain the occlusion effect of the occlusion object to be rendered on the model to be rendered.

7. A rendering device for occlusion effect, wherein, it includes: a writing module, configured to determine an occlusion object to be rendered, and write the occlusion object to be rendered into a created temporary rendering texture. Wherein, the writing module is configured to create a temporary single-channel texture, and use the single-channel texture as the temporary rendering texture; render the occlusion object to be rendered into the temporary rendering texture, and determine a plurality of specified pixels covered by the occlusion object to be rendered in the temporary rendering texture; write a preset value to each specified pixel in the plurality of specified pixels in the stencil buffer of the temporary rendering texture; determine a plurality of mapping positions of the plurality of specified pixels on the occlusion object to be rendered, and write the first pixel depth value corresponding to each mapping position on the occlusion object to be rendered into the depth buffer of the temporary rendering texture to obtain the temporary rendering texture written with the occlusion object to be rendered; the writing module is further configured to obtain a model to be rendered, and write the model to be rendered into the temporary rendering texture written with the occlusion object to be rendered to obtain an intermediate rendering texture; a drawing module, configured to determine an occlusion area on the intermediate rendering texture, and draw the occlusion area in the intermediate rendering texture with a preset occlusion texture to obtain an occlusion effect texture, where the occlusion area is an area formed by the intersection of the occlusion object to be rendered and the model to be rendered on the intermediate rendering texture; an integration module, configured to integrate the occlusion effect texture with the model to be rendered to obtain the occlusion effect of the occlusion object to be rendered on the model to be rendered.

8. A computer device, including a memory and a processor, the memory stores a computer program, wherein, when the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method for displaying animated image in masking way

    CN102147923A

  • Game scene construction method and device

    CN108159693A

  • Scene rendering method and device, computer equipment and storage medium

    CN112837402A