Scene rendering method, device, electronic device and readable storage medium

By using different rendering resolutions to process opaque objects and transparent objects in scene rendering technology, the low rendering efficiency problem caused by frequent rendering of transparent objects is solved, and efficient rendering and a good visual experience is achieved.

CN113205583BActive Publication Date: 2024-11-12BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202110469807.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-28
Publication Date
2024-11-12
Estimated Expiration
2041-04-28

AI Technical Summary

Technical Problem

When handling transparent objects, existing scene rendering technologies require frequent overlapping transparent objects rendering, resulting in an increase in the number of renderings and a decrease in the rendering efficiency of electronic devices.

Method used

Different rendering resolutions are used to render opaque objects and transparent objects. The rendering resolution of transparent objects is lower than that of opaque objects, and the first rendering result is copied to the second color texture, and the transparent one is based on the copied texture. The objects are rendered to reduce the rendering pressure.

Benefits of technology

It improves the rendering efficiency of electronic devices, avoids blurring of transparent objects, improves rendering efficiency and visual experience, and ensures the rendering effect of transparent objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113205583B_ABST
    Figure CN113205583B_ABST
Patent Text Reader

Abstract

The present disclosure provides a scene rendering method, device, electronic device and storage medium, the scene rendering method comprising: obtaining opaque objects and transparent objects in a scene to be rendered; creating a first color texture of a first rendering resolution, and rendering the opaque objects based on the first color texture to obtain a first rendering result; creating a second color texture of a second rendering resolution, and copying the first rendering result to the second color texture; the second rendering resolution is less than the first rendering resolution; rendering the transparent object based on the second color texture with the first rendering result copied thereon to obtain a second rendering result; performing a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result; synthesizing the third rendering result and the first rendering result to obtain a rendered scene image. The embodiments of the present application can improve the rendering efficiency of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of scene rendering, and in particular to a scene rendering method, device, electronic device and storage medium. Background Art

[0002] In the technical field of scene rendering, a scene to be rendered may include opaque objects and semi-transparent objects to be rendered. The electronic device may first render the opaque objects to be rendered, and then render the semi-transparent objects to be rendered.

[0003] In the rendering process, in order to reduce repeated drawing, usually only the nearest opaque object is rendered. However, this rendering method is not applicable to transparent objects. Since transparent objects (such as glass, fire, etc.) have a semi-transparent effect, in the rendering process, all overlapping transparent objects need to be rendered and the colors need to be superimposed and mixed to ensure the visual effect. As a result, the more rendering times, the lower the rendering efficiency of the electronic device. Summary of the invention

[0004] The embodiments of the present disclosure at least provide a scene rendering method, device, electronic device and storage medium.

[0005] In a first aspect, an embodiment of the present disclosure provides a scene rendering method, comprising:

[0006] Get the opaque objects and transparent objects in the scene to be rendered;

[0007] Creating a first color texture of a first rendering resolution, and rendering the opaque object based on the first color texture to obtain a first rendering result;

[0008] Creating a second color texture of a second rendering resolution, and copying the first rendering result to the second color texture; the second rendering resolution is smaller than the first rendering resolution;

[0009] Rendering the transparent object based on the second color texture having the first rendering result copied thereto to obtain a second rendering result;

[0010] Performing a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result;

[0011] The third rendering result and the first rendering result are synthesized to obtain a rendered scene image.

[0012] In the disclosed embodiment, different rendering resolutions are used to render opaque objects and transparent objects respectively, and the rendering resolution of transparent objects is lower than that of opaque objects, thereby reducing rendering pressure and improving the rendering efficiency of electronic devices. In addition, the scene rendering method in the disclosed embodiment only reduces the rendering resolution of transparent objects, so that the originally high-definition opaque objects will not become blurred, thereby improving the rendering efficiency while ensuring the user's visual experience.

[0013] According to the first aspect, in a possible implementation manner, the second rendering resolution is determined by the transparency of the transparent object and / or the number of superimposed layers of the transparent object.

[0014] In the disclosed embodiment, since the second rendering resolution is determined by the transparency of the transparent object and / or the number of superimposed layers of the transparent object, the second rendering resolution can be determined according to the actual situation of the transparent object in the rendering scene, thereby further improving the rendering efficiency of the electronic device while ensuring the rendering effect of the transparent object.

[0015] According to the first aspect, in a possible implementation manner, copying the first rendering result to the second color texture includes:

[0016] Copying the color information and depth information in the first rendering result to the second color texture;

[0017] The rendering of the transparent object based on the second color texture having the first rendering result copied thereto includes:

[0018] The transparent object is rendered based on the second color texture to which the first rendering result is copied and the depth information of the transparent object.

[0019] In the disclosed embodiment, since the depth information in the first rendering result is also copied to the second color texture, when rendering transparent objects, the depth information of opaque objects can be referred to and the transparent objects can be rendered accordingly, thereby achieving a corresponding rendering effect.

[0020] According to the first aspect, in a possible implementation manner, rendering the transparent object based on the second color texture having the first rendering result copied thereto and the depth information of the transparent object includes:

[0021] Determine first target depth information of the transparent object and second target depth information in the first rendering result respectively corresponding to target pixel points; the target pixel point is a pixel point in the second color texture that needs to be rendered;

[0022] Comparing the first target depth information with the second target depth information;

[0023] If the first target depth information is greater than the second target depth information, the target pixel point is not rendered.

[0024] In the disclosed embodiment, by comparing the first target depth information and the second target depth information corresponding to the target pixel points respectively, and rendering the transparent object according to the comparison result, it is possible to avoid the transparent object blocked by the opaque object from being incorrectly rendered, thereby improving the reliability of rendering.

[0025] According to the first aspect, in a possible implementation manner, copying the first rendering result to the second color texture includes:

[0026] Creating a target map based on the second rendering resolution, wherein color information of the target map corresponds to color information in the first rendering result;

[0027] The target map is rendered based on the second color texture, and the color information in the first rendering result is copied to the second color texture.

[0028] In the disclosed embodiment, in this implementation, the purpose of copying the color information in the first rendering result to the second color texture is achieved by creating a target map and rendering the target map. Compared with the method of drawing the color information of each pixel one by one, the efficiency of copying is improved.

[0029] According to the first aspect, in a possible implementation manner, performing a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result includes:

[0030] Performing a second extraction on the color of the transparent object in the second rendering result to obtain color information of the transparent object;

[0031] Performing a first operation process on the color information so that the processing result of the color information conforms to a target storage format, thereby obtaining the third rendering result; the target storage format is a picture storage format;

[0032] The synthesizing the third rendering result and the first rendering result includes:

[0033] Performing a second operation on the color information in the third rendering result to obtain target color information, wherein the second operation is an inverse operation of the first operation;

[0034] The target color information is synthesized with the color information in the first rendering result.

[0035] In the disclosed embodiment, not only can the color information of the transparent object extracted from the second rendering result be stored in a picture format, but the synthesized target color information can also be made consistent with the color of the transparent object in the second rendering result, thereby improving the visual effect of the rendering.

[0036] According to the first aspect, in a possible implementation, synthesizing the third rendering result and the first rendering result to obtain a rendered scene image includes:

[0037] Processing the edge of the transparent object in the third rendering result by multi-sampling to obtain a fourth rendering result;

[0038] The fourth rendering result and the first rendering result are synthesized to obtain the rendered scene image.

[0039] In the disclosed embodiment, the edge of the transparent object in the third rendering result is processed by multi-sampling to optimize the third rendering result to obtain a fourth rendering result, and then the fourth rendering result and the first rendering result are synthesized, which can reduce the jagged feeling of the edge of the transparent object in the third rendering result and improve the rendering quality.

[0040] According to the first aspect, in a possible implementation manner, obtaining opaque objects and transparent objects in a scene to be rendered includes:

[0041] Obtaining a scene description file of a scene to be rendered, and parsing the scene description file to obtain objects to be rendered in the scene to be rendered and rendering information corresponding to the objects to be rendered;

[0042] The objects to be rendered are classified according to the rendering information, and the objects to be rendered are divided into opaque objects and transparent objects.

[0043] In a second aspect, an embodiment of the present disclosure provides a scene rendering device, including:

[0044] An acquisition module, used to acquire opaque objects and transparent objects in the scene to be rendered;

[0045] A first rendering module, used for creating a first color texture of a first rendering resolution, and rendering the opaque object based on the first color texture to obtain a first rendering result;

[0046] a copy module, used for creating a second color texture with a second rendering resolution, and copying the first rendering result to the second color texture; the second rendering resolution is smaller than the first rendering resolution;

[0047] A second rendering module, configured to render the transparent object based on the second color texture to which the first rendering result is copied, to obtain a second rendering result;

[0048] an extraction module, configured to perform a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result;

[0049] A synthesis module is used to synthesize the third rendering result and the first rendering result to obtain a rendered scene image.

[0050] According to the second aspect, in a possible implementation manner, the second rendering resolution is determined by the transparency of the transparent object and / or the number of superimposed layers of the transparent object.

[0051] According to the second aspect, in a possible implementation manner, the copy module is specifically used to:

[0052] Copying the color information and depth information in the first rendering result to the second color texture;

[0053] The second rendering module is specifically used for:

[0054] The transparent object is rendered based on the second color texture to which the first rendering result is copied and the depth information of the transparent object.

[0055] According to the second aspect, in a possible implementation manner, the second rendering module is specifically configured to:

[0056] Determine first target depth information of the transparent object and second target depth information in the first rendering result respectively corresponding to target pixel points; the target pixel point is a pixel point in the second color texture that needs to be rendered;

[0057] Comparing the first target depth information with the second target depth information;

[0058] If the first target depth information is greater than the second target depth information, the target pixel point is not rendered.

[0059] According to the second aspect, in a possible implementation manner, the second rendering module is specifically configured to:

[0060] Creating a target map based on the second rendering resolution, wherein color information of the target map corresponds to color information in the first rendering result;

[0061] The target map is rendered based on the second color texture, and the color information in the first rendering result is copied to the second color texture.

[0062] According to the second aspect, in a possible implementation manner, the extraction module is specifically used to:

[0063] Performing a second extraction on the color of the transparent object in the second rendering result to obtain color information of the transparent object;

[0064] Performing a first operation process on the color information so that the processing result of the color information conforms to a target storage format, thereby obtaining the third rendering result; the target storage format is a picture storage format;

[0065] The synthesis module is specifically used for:

[0066] Performing a second operation on the color information in the third rendering result to obtain target color information, wherein the second operation is an inverse operation of the first operation;

[0067] The target color information is synthesized with the color information in the first rendering result.

[0068] According to the second aspect, in a possible implementation manner, the synthesis module is specifically used for:

[0069] Processing the edge of the transparent object in the third rendering result by multi-sampling to obtain a fourth rendering result;

[0070] The fourth rendering result and the first rendering result are synthesized to obtain the rendered scene image.

[0071] According to the second aspect, in a possible implementation manner, the acquisition module is specifically configured to:

[0072] Obtaining a scene description file of a scene to be rendered, and parsing the scene description file to obtain objects to be rendered in the scene to be rendered and rendering information corresponding to the objects to be rendered;

[0073] The objects to be rendered are classified according to the rendering information, and the objects to be rendered are divided into opaque objects and transparent objects.

[0074] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the scene rendering method described in the first aspect is performed.

[0075] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the scene rendering method as described in the first aspect is executed.

[0076] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0078] Figure 1 A schematic diagram showing an execution subject of a scene rendering method provided by an embodiment of the present disclosure;

[0079] Figure 2 A flow chart of a scene rendering method provided by an embodiment of the present disclosure is shown;

[0080] Figure 3 A flow chart of a method for obtaining opaque objects and transparent objects in a scene to be rendered provided by an embodiment of the present disclosure is shown;

[0081] Figure 4 A schematic diagram showing a first rendering result obtained by rendering the opaque object provided by an embodiment of the present disclosure;

[0082] Figure 5 A flow chart of a method for copying a first rendering result to a second color texture provided by an embodiment of the present disclosure is shown;

[0083] Figure 6 A flow chart of a method for rendering a transparent object based on a second color texture provided by an embodiment of the present disclosure is shown;

[0084] Figure 7 A schematic diagram of rendering a transparent object to obtain a second rendering result provided by an embodiment of the present disclosure is shown;

[0085] Figure 8 A schematic diagram of performing a first extraction on the color of a transparent object in a second rendering result to obtain a third rendering result provided by an embodiment of the present disclosure is shown;

[0086] Fig. 9 A flow chart of a method for synthesizing a third rendering result and a first rendering result provided by an embodiment of the present disclosure is shown;

[0087] Fig.10 A schematic diagram of a rendered scene image provided in an embodiment of the present disclosure is shown;

[0088] Fig.11 A schematic diagram of the structure of a scene rendering device provided by an embodiment of the present disclosure is shown;

[0089] Fig.12 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0090] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0091] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0092] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.

[0093] In the technical field of scene rendering, a scene to be rendered may include opaque objects and semi-transparent objects to be rendered. The electronic device may first render the opaque objects to be rendered, and then render the semi-transparent objects to be rendered.

[0094] Research has found that in the rendering process, in order to reduce repeated drawing, usually only the nearest opaque object is rendered. However, this rendering method is not applicable to transparent objects. Since transparent objects (such as glass, fire, etc.) have a semi-transparent effect, in the rendering process, overlapping transparent objects need to be rendered and the colors need to be superimposed and mixed to ensure the visual effect. As a result, the more rendering times are performed, the lower the rendering efficiency of the electronic device.

[0095] The present disclosure provides a scene rendering method, including: obtaining opaque objects and transparent objects in a scene to be rendered; creating a first color texture of a first rendering resolution, and rendering the opaque objects based on the first color texture to obtain a first rendering result; creating a second color texture of a second rendering resolution, and copying the first rendering result to the second color texture; the second rendering resolution is smaller than the first rendering resolution; rendering the transparent objects based on the second color texture to which the first rendering result is copied to obtain a second rendering result; performing a first extraction on the color of the transparent objects in the second rendering result to obtain a third rendering result; and synthesizing the third rendering result with the first rendering result to obtain a rendered scene image.

[0096] In the disclosed embodiment, different rendering resolutions are used to render opaque objects and transparent objects respectively, and the rendering resolution of transparent objects is lower than that of opaque objects, thereby reducing rendering pressure and improving the rendering efficiency of electronic devices. In addition, the scene rendering method in the disclosed embodiment only reduces the rendering resolution of transparent objects, so that the originally high-definition opaque objects will not become blurred, thereby improving the rendering efficiency while ensuring the user's visual experience.

[0097] To facilitate understanding of this embodiment, a scene rendering method disclosed in the embodiment of the present disclosure is first described in detail. Figure 1 , which is a schematic diagram of the execution subject of the scene rendering method provided in the embodiment of the present disclosure. The execution subject of the scene rendering method provided in the embodiment of the present disclosure is generally an electronic device with certain computing capabilities, wherein the electronic device 100 may include a terminal and a server. For example, the method can be applied to a terminal, and the terminal may be Figure 1 The smart phone 10, desktop computer 20, notebook computer 30, etc. shown in FIG. Figure 1The method can also be applied to the server 40, or can be applied to the implementation environment composed of the terminal and the server 40. The server 40 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, big data and artificial intelligence platforms.

[0098] In other embodiments, the electronic device 100 may also include an AR (Augmented Reality) device, a VR (Virtual Reality) device, an MR (Mixed Reality) device, etc. For example, an AR device may be a mobile phone or tablet computer with AR function, or may be AR glasses, which are not limited here.

[0099] It should be noted that, in some embodiments, the server 40 can communicate with the smart phone 10, the desktop computer 20 and the laptop computer 30 respectively through the network 50. The network 50 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0100] In addition, the scene rendering method may also be software running in a terminal or server, such as an application program having a function of displaying description information of a task, etc. In some possible implementations, the scene rendering method may be implemented by a processor calling computer-readable instructions stored in a memory.

[0101] See also Figure 2 As shown, it is a flow chart of a scene rendering method provided by an embodiment of the present disclosure, and the scene rendering method includes the following S101 to S106:

[0102] S101, obtaining opaque objects and transparent objects in a scene to be rendered.

[0103] It can be understood that before rendering a scene, it is necessary to obtain opaque objects and transparent objects in the scene to be rendered to determine the rendering target. Figure 3 As shown, in some implementations, step S101 may include the following S1011 to S1012:

[0104] S1011, obtaining a scene description file of a scene to be rendered, and parsing the scene description file to obtain objects to be rendered in the scene to be rendered and rendering information corresponding to the rendering objects.

[0105] S1012: Classify the objects to be rendered according to the rendering information, and classify the objects to be rendered into opaque objects and transparent objects.

[0106] Exemplarily, a scene description file (such as an XML file) is first loaded, and the scene description file is parsed to obtain each rendering object in the scene and its rendering information. The rendering information includes the hierarchical organizational structure relationship of the rendering object, the position, geometry, material, texture information, rendering grouping information and material transparency of the rendering object, and then the objects to be rendered can be classified according to the transparency information in the rendering information, and the objects to be rendered can be divided into opaque objects and transparent objects. Among them, transparent objects can include semi-transparent objects and fully transparent objects.

[0107] In one implementation, the electronic device may traverse the scene to be rendered, and obtain traversal result information of the scene to be rendered, wherein the traversal result information may include: materials of all objects to be rendered in the scene to be rendered and rendering effects of each object to be rendered, and the rendering effects of each object to be rendered may include: color values ​​and transparency values ​​required for rendering of each object to be rendered, etc. The scene to be rendered is a scene to be rendered.

[0108] Among them, a transparent object may refer to an object whose corresponding material is a transparent material, and the transparent material may include glass material, plastic material, rubber material, etc. The range of the transparency value corresponding to the transparent object may be: [0, 255], or [0, 1]. The transparency value corresponding to the transparent object may determine the presentation effect of the transparency of the transparent object. The larger the transparency value corresponding to the transparent object, the more opaque the presentation effect of the transparent object is.

[0109] In one implementation, the scene to be rendered may be a game scene. When the user changes the angle and / or position of viewing the game scene, the game scene needs to be re-rendered. In one case, the user may change the angle and / or position of viewing the game scene by changing the position and / or viewing angle of the game character controlled by the user. It is understandable that the scene to be rendered may be a stereoscopic scene.

[0110] S102: Create a first color texture of a first rendering resolution, and render the opaque object based on the first color texture to obtain a first rendering result.

[0111] For example, see Figure 4As shown, a schematic diagram of a first rendering result obtained by rendering the opaque object A provided by an embodiment of the present disclosure can sort the opaque objects in order from small to large according to the coordinate values ​​of the opaque object A in the z-axis direction in the visual coordinate system, and render the opaque objects in order according to the sorting order, and only render the same pixel point corresponding to the opaque objects with different z-coordinate values ​​once.

[0112] Specifically, depth detection can be used to achieve rendering of the same pixel only once. Depth detection is used to determine the rendering of pixels at the same position, and the object closest to the eye is rendered first, so as to ensure that rendering of different depths at the same position is only performed once. The front layer is rendered first, and then the back layer is drawn. Because the front layer has been filled with pixels, the back layer does not perform pixel replacement operations in the area rendered by the front layer, that is, the area circled by the front layer, that is, the overlapping area, is no longer rendered, and only the area of ​​the back layer that does not overlap with the front layer is rendered, which reduces the number of pixel updates at the same position, thereby improving rendering efficiency.

[0113] S103: Create a second color texture with a second rendering resolution, and copy the first rendering result to the second color texture; the second rendering resolution is smaller than the first rendering resolution.

[0114] Exemplarily, in order to perform correct transparent overlay blending later and ensure that the color result after rendering the transparent object is correct, after rendering the opaque object, a second color texture can be created, and the color value of the original opaque object can be drawn into the color value of the second color texture, and the transparent object can be rendered based on this rendering, thereby ensuring the rendering effect of the transparent object.

[0115] In this implementation, the second rendering resolution is smaller than the first rendering resolution. For example, the second rendering resolution may be half of the first rendering resolution or lower. This can improve the rendering efficiency of the electronic device.

[0116] In some embodiments, the second rendering resolution is determined by the transparency of the transparent object and / or the number of superimposed layers of the transparent object. For example, if the transparency of the transparent object is higher, the second rendering resolution may be lower; or, if the number of superimposed layers of the transparent object is greater, the second rendering resolution may be lower. Specifically, the correlation between the second rendering resolution and the transparency of the transparent object, or the correlation between the second rendering resolution and the number of superimposed layers of the transparent object, is not limited herein.

[0117] In this embodiment, since the second rendering resolution is determined by the transparency of the transparent object and / or the number of superimposed layers of the transparent object, the second rendering resolution can be determined according to the actual situation of the transparent object in the rendering scene, thereby further improving the rendering efficiency of the electronic device while ensuring the rendering effect of the transparent object.

[0118] In some implementations, in order to improve the copying efficiency when copying the first rendering result to the second color texture, see Figure 5 As shown, for the above step S103, when copying the first rendering result to the second color texture, the following S1031 to S1032 may be included:

[0119] S1031: Create a target map based on the second rendering resolution, where color information of the target map corresponds to color information in the first rendering result.

[0120] S1032: Render the target map based on the second color texture, and then copy the color information in the first rendering result to the second color texture.

[0121] Exemplarily, creating a target map based on the second rendering resolution means rendering a full-screen square patch whose resolution is the second rendering resolution and whose color information is the same as the color information in the first rendering result. The square patch is then used as a rendering target and rendered onto the second color texture, thereby copying the color information in the first rendering result to the second color texture.

[0122] In this embodiment, the purpose of copying the color information in the first rendering result to the second color texture is achieved by creating a target map and rendering the target map. Compared with the method of drawing the color information of each pixel one by one, the efficiency of copying is improved.

[0123] The color information of the target map corresponds to the first rendering result, which means that the color value of each pixel in the target map is the average of the color values ​​of multiple pixels corresponding to the target ratio in the first rendering result, and the target ratio corresponds to the ratio between the first rendering resolution and the second rendering resolution. For example, if the second rendering resolution is half of the first rendering resolution, the color average of a 2X2 pixel block on the original first color texture is written into a pixel on the second color texture.

[0124] In some embodiments, in order for subsequent transparent objects to use the depth map of opaque objects, when the color information in the first rendering result is copied to the second color texture, the depth information in the first rendering result is also copied to the second color texture. Therefore, for the aforementioned target map, the depth value of each pixel in the target map is the average of the depth values ​​of multiple pixels corresponding to the target ratio in the first rendering result.

[0125] S104: Render the transparent object based on the second color texture to which the first rendering result is copied, to obtain a second rendering result.

[0126] In some embodiments, since in step S103, the color information and depth information in the first rendering result are copied to the second color texture, step S104 may include: rendering the transparent object based on the second color texture copied with the first rendering result and the depth information of the transparent object, specifically, rendering the transparent object accordingly according to a preset depth rendering rule, the depth rendering rule including a depth association rule between opaque objects and transparent objects. For example, the preset depth rendering rule may be that the transparent object is displayed as a layer behind the opaque object. The specific setting can be based on actual conditions and is not limited here.

[0127] In the disclosed embodiment, since the depth information in the first rendering result is also copied to the second color texture, when rendering transparent objects, the depth information of opaque objects can be referred to, and then the transparent objects can be rendered accordingly according to preset depth rendering rules, thereby achieving corresponding rendering effects, meeting different rendering requirements, and improving the applicability of the scene rendering method.

[0128] For example, see Figure 6 As shown, with respect to the above S104, when rendering the transparent object based on the second color texture having the first rendering result copied thereto and the depth information of the transparent object, the following S1041 to S1043 may be included:

[0129] S1041, determining first target depth information of the transparent object and second target depth information in the first rendering result respectively corresponding to target pixel points; the target pixel point is a pixel point that needs to be rendered in the second color texture.

[0130] S1042: Compare the first target depth information with the second target depth information.

[0131] S1043: If the first target depth information is greater than the second target depth information, do not render the target pixel point.

[0132] See also Figure 7 FIG. 1 is a schematic diagram of rendering a transparent object B to obtain a second rendering result provided by an embodiment of the present disclosure, from Figure 7 It can be seen that in the embodiment of the present disclosure, by comparing the first target depth information and the second target depth information respectively corresponding to the target pixel points, and rendering the transparent object B according to the comparison result, it is possible to avoid the transparent object B blocked by the opaque object A from being incorrectly rendered, thereby improving the reliability of rendering.

[0133] S105: Perform a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result.

[0134] It can be understood that if the second result is directly synthesized with the first result, the image of the opaque object in the first result will also be blurred in places where there is no transparent object or behind the transparent object. Therefore, it is necessary to perform a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result including only the color information of the transparent object, see Figure 8 As shown, it is a schematic diagram of performing a first extraction on the color of a transparent object B in a second rendering result to obtain a third rendering result provided by an embodiment of the present disclosure.

[0135] S106: Synthesize the third rendering result and the first rendering result to obtain a rendered scene image.

[0136] Please refer again Figure 8 , since the edge of the third rendering result will have the problem of jagged edges S. Therefore, in some implementations, in order to solve the edge jagged edges S problem caused by the third rendering result, see Fig. 9 As shown, for step S106, when the third rendering result and the first rendering result are synthesized, the following S1061 to S1062 may be included:

[0137] S1061 , processing the edge of the transparent object in the third rendering result through multi-sampling to obtain a fourth rendering result.

[0138] S1062: Synthesize the fourth rendering result and the first rendering result to obtain the rendered scene image.

[0139] See also Fig.10 FIG. 1 is a schematic diagram of a rendered scene image provided in an embodiment of the present disclosure, from Fig.10It can be seen that in this embodiment, the edge of the transparent object B in the third rendering result is processed by multi-sampling to optimize the third rendering result to obtain a fourth rendering result, and then the fourth rendering result and the first rendering result are synthesized, which can reduce the jagged feeling of the edge of the transparent object in the third rendering result and improve the rendering quality.

[0140] It can be understood that, since the three channels of color cannot store negative values ​​(negative colors do not exist), for some transparent objects (such as dark glass), the color in the second rendering result will be darker, that is, the color value may be less than 0. If not processed, it will be automatically processed to 0 after the second extraction, thereby causing errors in the color stripped from the second rendering result. Therefore, in some embodiments, for step S105, when performing the first extraction on the color of the transparent object in the second rendering result, the following (a) to (b) steps may be included:

[0141] (a) performing a second extraction on the color of the transparent object in the second rendering result to obtain color information of the transparent object;

[0142] (b) performing a first operation processing on the color information so that the processing result of the color information conforms to a target storage format, thereby obtaining the third rendering result; the target storage format is a picture storage format.

[0143] In this embodiment, after step (a), the color information is further subjected to a first operation process so that the processing result of the color information conforms to the target storage format to obtain the third rendering result. In some embodiments, the first operation process may include a color gamut remapping algorithm.

[0144] Exemplarily, the formula (1) of the first operation process is as follows:

[0145] deltColor = (deltColor + 1) / 2 (1)

[0146] Among them, deltColor represents the color value of each pixel.

[0147] Since the extracted color values ​​are processed in step S105 so that the color values ​​can be stored, in order to ensure the display effect of the color of the transparent object in the second rendering result, the synthesis in step S106 may include the following steps (c) to (d):

[0148] (c) performing a second operation on the color information in the third rendering result to obtain target color information, wherein the second operation is an inverse operation of the first operation;

[0149] (d) Synthesizing the target color information with the color information in the first rendering result.

[0150] In this way, the target color information to be synthesized can be made consistent with the color of the transparent object in the second rendering result, thereby improving the visual effect of the rendering.

[0151] Exemplarily, the formula (2) of the second operation is as follows:

[0152] finalColor = originColor + deltColor * 2 – 1 (2)

[0153] Among them, deltColor represents the extracted color value of each pixel, originColor represents the color value of each pixel in the first rendering result, and finalColor represents the color value of each pixel after synthesis.

[0154] In the embodiment of the present invention, different rendering resolutions are used to render opaque objects and transparent objects respectively, and the rendering resolution of transparent objects is lower than that of opaque objects, thereby reducing rendering pressure and improving rendering efficiency of electronic devices. Especially for shooting and brawl free-view games, when the battle is fierce, a large amount of transparent special effects such as light, fog, and magic will be generated, resulting in a sharp increase in rendering pressure. The effect of improving rendering efficiency by using this scene rendering method is more obvious, which can greatly improve game performance and maintain game fluency.

[0155] In addition, the scene rendering method in the embodiment of the present disclosure only reduces the rendering resolution of transparent objects and does not blur the originally high-definition opaque objects, thereby improving the rendering efficiency while ensuring the user's visual experience.

[0156] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0157] Based on the same technical concept, a scene rendering device corresponding to the scene rendering method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned scene rendering method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0158] Reference Fig.11 FIG. 5 is a schematic diagram of a scene rendering device 500 provided in an embodiment of the present disclosure, wherein the device comprises:

[0159] An acquisition module 501 is used to acquire opaque objects and transparent objects in a scene to be rendered;

[0160] A first rendering module 502, configured to create a first color texture of a first rendering resolution, and render the opaque object based on the first color texture to obtain a first rendering result;

[0161] A copy module 503, used to create a second color texture with a second rendering resolution, and copy the first rendering result to the second color texture; the second rendering resolution is smaller than the first rendering resolution;

[0162] A second rendering module 504, configured to render the transparent object based on the second color texture to which the first rendering result is copied, to obtain a second rendering result;

[0163] An extraction module 505, configured to perform a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result;

[0164] The synthesis module 506 is used to synthesize the third rendering result and the first rendering result to obtain a rendered scene image.

[0165] In a possible implementation, the second rendering resolution is determined by the transparency of the transparent object and / or the number of superimposed layers of the transparent object.

[0166] In a possible implementation manner, the copy module 503 is specifically configured to:

[0167] Copying the color information and depth information in the first rendering result to the second color texture;

[0168] The second rendering module 504 is specifically used for:

[0169] The transparent object is rendered based on the second color texture to which the first rendering result is copied and the depth information of the transparent object.

[0170] In a possible implementation manner, the second rendering module 504 is specifically configured to:

[0171] Determine first target depth information of the transparent object and second target depth information in the first rendering result respectively corresponding to target pixel points; the target pixel point is a pixel point in the second color texture that needs to be rendered;

[0172] Comparing the first target depth information with the second target depth information;

[0173] If the first target depth information is greater than the second target depth information, the target pixel point is not rendered.

[0174] In a possible implementation manner, the second rendering module 504 is specifically configured to:

[0175] Creating a target map based on the second rendering resolution, wherein color information of the target map corresponds to color information in the first rendering result;

[0176] The target map is rendered based on the second color texture, and the color information in the first rendering result is copied to the second color texture.

[0177] In a possible implementation, the extraction module 505 is specifically used to:

[0178] Performing a second extraction on the color of the transparent object in the second rendering result to obtain color information of the transparent object;

[0179] Performing a first operation process on the color information so that the processing result of the color information conforms to a target storage format, thereby obtaining the third rendering result; the target storage format is a picture storage format;

[0180] The synthesis module 506 is specifically used for:

[0181] Performing a second operation on the color information in the third rendering result to obtain target color information, wherein the second operation is an inverse operation of the first operation;

[0182] The target color information is synthesized with the color information in the first rendering result.

[0183] In a possible implementation, the synthesis module 506 is specifically used to:

[0184] Processing the edge of the transparent object in the third rendering result by multi-sampling to obtain a fourth rendering result;

[0185] The fourth rendering result and the first rendering result are synthesized to obtain the rendered scene image.

[0186] In a possible implementation manner, the acquisition module 501 is specifically used to:

[0187] Obtaining a scene description file of a scene to be rendered, and parsing the scene description file to obtain objects to be rendered in the scene to be rendered and rendering information corresponding to the objects to be rendered;

[0188] The objects to be rendered are classified according to the rendering information, and the objects to be rendered are divided into opaque objects and transparent objects.

[0189] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0190] Based on the same technical concept, the embodiment of the present disclosure also provides an electronic device. Fig.12 , which is a schematic diagram of the structure of an electronic device 700 provided in an embodiment of the present disclosure, including a processor 701, a memory 702, and a bus 703. The memory 702 is used to store execution instructions, including a memory 7021 and an external memory 7022; the memory 7021 is also called an internal memory, which is used to temporarily store the operation data in the processor 701 and the data exchanged with the external memory 7022 such as a hard disk. The processor 701 exchanges data with the external memory 7022 through the memory 7021.

[0191] In the embodiment of the present application, the memory 702 is specifically used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 701. That is, when the electronic device 700 is running, the processor 701 communicates with the memory 702 through the bus 703, so that the processor 701 executes the application code stored in the memory 702, and then executes the method described in any of the above embodiments.

[0192] Among them, the memory 702 can be, but is not limited to, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.

[0193] The processor 701 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0194] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 700. In other embodiments of the present application, the electronic device 700 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0195] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the scene rendering method in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0196] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the scene rendering method in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0197] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0198] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0199] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0200] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0201] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0202] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A scene rendering method, characterized in that: include: Get the opaque objects and transparent objects in the scene to be rendered; Creating a first color texture of a first rendering resolution, and rendering the opaque object based on the first color texture to obtain a first rendering result; Creating a second color texture of a second rendering resolution, and copying the first rendering result to the second color texture; The second rendering resolution is smaller than the first rendering resolution; Rendering the transparent object based on the second color texture having the first rendering result copied thereto to obtain a second rendering result; Performing a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result; The third rendering result is synthesized with the first rendering result to obtain a rendered scene image, The first step of extracting the color of the transparent object in the second rendering result to obtain a third rendering result includes: Performing a second extraction on the color of the transparent object in the second rendering result to obtain color information of the transparent object; A first operation process is performed on the color information so that a processing result of the color information conforms to a target storage format, thereby obtaining the third rendering result; the target storage format is a picture storage format.

2. The method according to claim 1, characterized in that: The second rendering resolution is determined by the transparency of the transparent object and / or the number of superimposed layers of the transparent object.

3. The method according to claim 1, characterized in that The step of copying the first rendering result to the second color texture comprises: Copying the color information and depth information in the first rendering result to the second color texture; The rendering of the transparent object based on the second color texture having the first rendering result copied thereto includes: The transparent object is rendered based on the second color texture to which the first rendering result is copied and the depth information of the transparent object.

4. The method according to claim 3, characterized in that The rendering of the transparent object based on the second color texture having the first rendering result copied thereto and the depth information of the transparent object comprises: Determine first target depth information of the transparent object and second target depth information in the first rendering result respectively corresponding to target pixel points; the target pixel point is a pixel point in the second color texture that needs to be rendered; Comparing the first target depth information with the second target depth information; If the first target depth information is greater than the second target depth information, the target pixel point is not rendered.

5. The method according to claim 1, characterized in that The step of copying the first rendering result to the second color texture comprises: Creating a target map based on the second rendering resolution, wherein color information of the target map corresponds to color information in the first rendering result; The target map is rendered based on the second color texture, and the color information in the first rendering result is copied to the second color texture.

6. The method according to claim 1, characterized in that The synthesizing the third rendering result and the first rendering result includes: Performing a second operation on the color information in the third rendering result to obtain target color information, wherein the second operation is an inverse operation of the first operation; The target color information is synthesized with the color information in the first rendering result.

7. The method according to claim 1, characterized in that The third rendering result and the first rendering result are synthesized to obtain a rendered scene image, comprising: Processing the edge of the transparent object in the third rendering result by multi-sampling to obtain a fourth rendering result; The fourth rendering result and the first rendering result are synthesized to obtain the rendered scene image.

8. The method according to claim 1, characterized in that The step of obtaining the opaque objects and transparent objects in the scene to be rendered includes: Obtaining a scene description file of a scene to be rendered, and parsing the scene description file to obtain objects to be rendered in the scene to be rendered and rendering information corresponding to the objects to be rendered; The objects to be rendered are classified according to the rendering information, and the objects to be rendered are divided into opaque objects and transparent objects.

9. A scene rendering device, characterized in that: include: An acquisition module, used to acquire opaque objects and transparent objects in the scene to be rendered; A first rendering module, used for creating a first color texture of a first rendering resolution, and rendering the opaque object based on the first color texture to obtain a first rendering result; a copy module, used for creating a second color texture of a second rendering resolution, and copying the first rendering result to the second color texture; The second rendering resolution is smaller than the first rendering resolution; A second rendering module, configured to render the transparent object based on the second color texture to which the first rendering result is copied, to obtain a second rendering result; an extraction module, configured to perform a first extraction on the color of the transparent object in the second rendering result to obtain a third rendering result; a synthesis module, used to synthesize the third rendering result and the first rendering result to obtain a rendered scene image, Wherein, the extraction module is specifically used for: Performing a second extraction on the color of the transparent object in the second rendering result to obtain color information of the transparent object; A first operation process is performed on the color information so that a processing result of the color information conforms to a target storage format, thereby obtaining the third rendering result; the target storage format is a picture storage format.

10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the scene rendering method as described in any one of claims 1-8 is performed.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the scene rendering method according to any one of claims 1 to 8 is executed.

Citation Information

Cited By

  • Scene rendering method, electronic device, and non-transitory readable storage medium

    US12682544B2