Scene rendering method and device
Patent Information
- Application Number
- CN202111512143.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2041-12-07
AI Technical Summary
[0003]本公开实施例提供一种场景渲染方法及设备,以解决现有的渲染方法渲染复杂的半透明物体效果差的问题
[0014]本公开实施例提供的场景渲染方法及设备,该方法包括:响应于检测到进行场景渲染的触发条件,获取场景中的半透明物体,半透明物体包括多层半透明网格,不同层半透明网格的半透明深度信息不同;按照半透明深度信息的预设顺序,渲染不同层的半透明网格,得到半透明网格的半透明渲染结果,其中,不同的半透明渲染结果中的半透明像素在深度方向不重合;根据各半透明渲染结果,确定场景对应的目标渲染图像。本公开通过对半透明物体的各层半透明网格一层一层渲染,进而能够提高复杂半透明物体的渲染效果。并且对不同半透明网格中相同的像素在深度方向不会重复渲染,进而能够提高对半透明物体的渲染效率。
Smart Images

Figure CN116246004B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a scene rendering method and device. Background Technology
[0002] In scene rendering, it's necessary to render opaque and / or semi-transparent objects, including multi-layered objects like veils or hair. Currently, object rendering is done at the object level, meaning each object is rendered separately: one for the entire opaque object and another for the entire semi-transparent object. However, for complex semi-transparent objects, object-level rendering fails to produce satisfactory results. For example, a semi-transparent glass typically has two surfaces, an inner and an outer one, which object-level rendering cannot capture. Furthermore, the rendering quality of multi-layered semi-transparent objects like veils and hair is also poor. Summary of the Invention
[0003] This disclosure provides a scene rendering method and device to solve the problem of poor rendering effect of complex semi-transparent objects by existing rendering methods.
[0004] In a first aspect, embodiments of this disclosure provide a scene rendering method, which includes: in response to detecting a trigger condition for scene rendering, acquiring a semi-transparent object in the scene, the semi-transparent object including multiple layers of semi-transparent mesh, the semi-transparent depth information of different layers of semi-transparent mesh being different; rendering the semi-transparent mesh of different layers according to a preset order of the semi-transparent depth information to obtain a semi-transparent rendering result of the semi-transparent mesh, wherein the semi-transparent pixels in different semi-transparent rendering results do not overlap in the depth direction; and determining a target rendering image corresponding to the scene based on each semi-transparent rendering result.
[0005] Secondly, embodiments of this disclosure provide a scene rendering device, the scene rendering device comprising:
[0006] The acquisition module is used to acquire semi-transparent objects in the scene in response to the detection of the trigger condition for scene rendering. The semi-transparent objects include multiple layers of semi-transparent meshes, and the semi-transparent depth information of different layers of semi-transparent meshes is different.
[0007] The rendering module is used to render different layers of semi-transparent meshes according to a preset order of semi-transparent depth information, so as to obtain the semi-transparent rendering result of the semi-transparent mesh. The semi-transparent pixels in different semi-transparent rendering results do not overlap in the depth direction.
[0008] The determination module is used to determine the target rendering image corresponding to the scene based on the rendering results of each semi-transparent element.
[0009] Thirdly, embodiments of this disclosure provide an electronic device, including: a processor and a memory;
[0010] The memory stores the instructions that the computer executes;
[0011] The processor executes computer execution instructions stored in memory, causing at least one processor to execute the scene rendering method described in the first aspect above and various possible designs of the first aspect.
[0012] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the scene rendering method of various possible designs as described in the first aspect above.
[0013] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements a scene rendering method as described in the first aspect above, for various possible designs.
[0014] The scene rendering method and apparatus provided in this disclosure include: in response to detecting a trigger condition for scene rendering, acquiring a semi-transparent object in the scene, the semi-transparent object comprising multiple layers of semi-transparent meshes, the semi-transparent depth information of different layers of semi-transparent meshes being different; rendering different layers of semi-transparent meshes according to a preset order of the semi-transparent depth information to obtain semi-transparent rendering results of the semi-transparent meshes, wherein the semi-transparent pixels in different semi-transparent rendering results do not overlap in the depth direction; and determining a target rendering image corresponding to the scene based on each semi-transparent rendering result. This disclosure improves the rendering effect of complex semi-transparent objects by rendering each layer of semi-transparent meshes of the semi-transparent object layer by layer. Furthermore, the same pixels in different semi-transparent meshes are not rendered repeatedly in the depth direction, thereby improving the rendering efficiency of semi-transparent objects. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is an application scenario diagram of the scene rendering method provided in the embodiments of this disclosure;
[0017] Figure 2 This is a schematic diagram illustrating the rendering effect using existing technologies;
[0018] Figure 3Flowchart of the scene rendering method provided in the embodiments of this disclosure Figure 1 ;
[0019] Figure 4 Example illustration of the scene rendering method provided in the embodiments of this disclosure Figure 1 ;
[0020] Figure 5 This is a schematic diagram illustrating the rendering effect provided in the embodiments of this disclosure;
[0021] Figure 6 Flowchart of the scene rendering method provided in the embodiments of this disclosure Figure 2 ;
[0022] Figure 7 A flowchart illustrating the semi-transparent mesh rendering method provided in this embodiment of the disclosure;
[0023] Figure 8 Example illustration of the scene rendering method provided in the embodiments of this disclosure Figure 2 ;
[0024] Figure 9 Example illustration of the scene rendering method provided in the embodiments of this disclosure Figure 3 ;
[0025] Figure 10 A schematic diagram of the rendering process of the renderer provided in the embodiments of this disclosure;
[0026] Figure 11 This is a structural block diagram of a scene rendering device provided in an embodiment of the present disclosure;
[0027] Figure 12 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0029] refer to Figure 1 This diagram illustrates an application scenario of the scene rendering method provided in this embodiment of the present disclosure. Figure 1The system includes a terminal 10. The display interface of the terminal 10 includes an image display area 11 and a sticker element display area 12. Users can select a corresponding sticker, which is then rendered and composited with the corresponding image in the image display area 11. For example, in a short video scenario, a user obtains their face image through a selfie, and then selects a corresponding sticker, such as hair (a semi-transparent object), a hat (an opaque object), or other accessories. The face image and the selected sticker are then rendered and composited, displayed in the image display area 11.
[0030] Based on the above Figure 1 The application scenarios for this technique are complex semi-transparent objects, such as those with multi-faceted or multi-layered structures. Examples include glass cups requiring rendering of both inner and outer surfaces, and special semi-transparent objects like hair and veils requiring rendering of multiple layers with complex, intersecting arrangements. Existing object-level rendering methods are insufficient for rendering multi-faceted or complexly arranged semi-transparent objects. Furthermore, while Order Independent Transparency (OIT) is currently used for rendering semi-transparent objects, it can only render regular semi-transparent objects, such as glass cups or ice cubes with only one outer surface. It fails to achieve satisfactory rendering results for multi-faceted semi-transparent objects like glass cups requiring both inner and outer surfaces, as well as complexly arranged semi-transparent objects like hair and veils.
[0031] For example, refer to Figure 2 When using current object-level rendering or semi-transparent blending techniques, the rendered hair image is displayed in the image display area 21. The ends of the hair in this hair image tend to appear semi-transparent, which affects the rendering effect of the hair.
[0032] To address the aforementioned technical problems, this disclosure provides a scene rendering method and apparatus. By rendering complex semi-transparent objects such as hair and veils layer by layer, the rendering effect of complex semi-transparent objects can be improved. Furthermore, identical pixels in different semi-transparent meshes are not rendered repeatedly, thereby improving the rendering efficiency of semi-transparent objects.
[0033] refer to Figure 3 , Figure 3 Flowchart of the scene rendering method provided in the embodiments of this disclosure Figure 1 The method described in this embodiment can be applied to a terminal. The scene rendering method specifically includes the following steps:
[0034] S301, in response to the detection of a trigger condition for scene rendering, acquires a semi-transparent object in the scene.
[0035] The execution subject of the scene rendering method provided in this disclosure is generally an electronic device with a certain computing power, wherein the electronic device includes a terminal and a server.
[0036] In this disclosure, scene rendering can be short video scene rendering, game scene rendering, or image processing scene rendering, etc.
[0037] Furthermore, in game scene rendering, the trigger condition refers to the user instructing the game scene to change by triggering relevant operations. In short video or image processing scene rendering, it could be the user selecting certain textures, triggering the rendering processing of the short video or image.
[0038] Furthermore, before rendering the scene, it is necessary to obtain the semi-transparent objects in the scene to be rendered, i.e., the semi-transparent objects to be rendered. Obtaining the semi-transparent objects includes: obtaining the description file corresponding to the semi-transparent object; parsing the description file to obtain the name of the semi-transparent object in the rendering scene and its rendering information, including the object's organizational structure, position, shape, material, texture information, and semi-transparency.
[0039] In a rendered scene, a semi-transparent object refers to an object that is defined as semi-transparent. Examples include objects composed of multiple layers of filaments, such as hair; mesh objects, such as a veiled hat; and objects with inner and outer surfaces, such as a glass.
[0040] Specifically, the semi-transparent object consists of multiple layers of semi-transparent meshes, with different layers having different semi-transparent depth information. Furthermore, the semi-transparent mesh is composed of multiple semi-transparent pixels, and the depth information of each semi-transparent pixel within the same semi-transparent mesh is identical.
[0041] For example, when the semi-transparent object is hair, the hair has multiple layers from front to back, with each layer having the same depth information. The individual hairs are interwoven and randomly arranged, and each hair can have different depth information, appearing segmented on different semi-transparent grids. When the semi-transparent object is a mesh cap, multiple mesh strands are interwoven and arranged, and each mesh strand also has different depth information, appearing segmented on different semi-transparent grids. When the semi-transparent object is a glass with inner and outer surfaces, since the inner and outer surfaces of the glass are curved, both the inner and outer surfaces have different depth information, and their areas are evenly distributed and appear on different semi-transparent grids.
[0042] In this disclosure, the semi-transparent object can be a custom semi-transparent object. Specifically, various objects are pre-classified into semi-transparent and opaque objects. The semi-transparent object can be glass, plastic, mesh, hair, etc. This disclosure mainly focuses on rendering complex semi-transparent objects with multiple intersecting layers, such as hair and mesh, as well as multi-faceted semi-transparent objects.
[0043] S302, according to the preset order of semi-transparent depth information, renders semi-transparent meshes of different layers to obtain the semi-transparent rendering result of the semi-transparent mesh.
[0044] The preset order can be from smallest to largest. The semi-transparent pixels in different semi-transparent rendering results do not overlap in the depth direction.
[0045] In this disclosure, during the rendering process, semi-transparent meshes with smaller semi-transparent depth information are rendered first.
[0046] Specifically, the semi-transparent object comprises N layers of semi-transparent meshes. The layer and depth information of the semi-transparent meshes are positively correlated. According to the preset order of the semi-transparent depth information, different layers of semi-transparent meshes are rendered to obtain the semi-transparent rendering result of the semi-transparent meshes, including: rendering the first layer of semi-transparent meshes to obtain the first semi-transparent rendering result; determining the i-th semi-transparent pixel in the first layer of semi-transparent meshes, wherein the i-th semi-transparent pixel does not overlap with the pixels in the first to (i-1)-th semi-transparent rendering results in the depth direction, and i is taken as an integer from 2 to N in ascending order; rendering the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent meshes.
[0047] Each semi-transparent rendering result includes a semi-transparent color texture and a semi-transparent depth texture. Each semi-transparent rendering result corresponds to a depth buffer and a color buffer. The corresponding semi-transparent depth texture is stored in the depth buffer, and the corresponding semi-transparent color texture is stored in the color buffer. The semi-transparent color texture refers to the set of colors for each pixel in the semi-transparent rendering result. The semi-transparent depth texture refers to the set of depths for each pixel in the semi-transparent rendering result. In addition, the semi-transparent rendering result also includes the alpha value of each pixel, where the alpha value represents the semi-transparency of the pixel, ranging from 0 to 1, with smaller values indicating greater semi-transparency.
[0048] For example, refer to Figure 4The semi-transparent object comprises three layers of semi-transparent meshes, 41(a), 42(a), and 43(a). The semi-transparent depth information of mesh 43(a) is greater than that of mesh 42(a), and the semi-transparent depth information of mesh 42(a) is greater than that of mesh 41(a). Specifically, the first semi-transparent mesh 41(a) is rendered to obtain a first semi-transparent rendering result 41(b). The second semi-transparent mesh 42(a) is rendered to obtain a second semi-transparent rendering result 42(b). When rendering the second semi-transparent mesh 42(a), since its semi-transparent depth information is greater than that of the first semi-transparent mesh, it is necessary to render pixels in the second semi-transparent mesh 42(a) that do not overlap with those in the first semi-transparent rendering result 41(b). The third semi-transparent mesh 43(a) is rendered to obtain the third semi-transparent rendering result 43(b). When rendering the third semi-transparent mesh 43(a), since the semi-transparent depth information of the second semi-transparent mesh 42(a) is greater than that of the first and second semi-transparent meshes, it is necessary to render pixels in the third semi-transparent mesh 42(a) that do not overlap with either the first or second semi-transparent rendering result 41(b) or the second semi-transparent rendering result 42(b).
[0049] Furthermore, rendering the i-th semi-transparent pixel includes: if i is greater than the layer threshold, then determining the target pixel among the i-th semi-transparent pixels whose transparency value is less than the transparency threshold; and rendering the target pixel.
[0050] Specifically, the layer threshold can be set to the default value or by the user. The transparency threshold can also be set to the default value or by the user. When rendering hair or veils, discarding target pixels with transparency values greater than the transparency threshold in later layers avoids a semi-transparent effect at the ends of the hair, thus improving the rendering quality of the hair.
[0051] The transparency threshold can be determined by setting an Alpha threshold. Since the Alpha value and the semi-transparency are inversely related, the target pixel determined by this disclosure is essentially a target pixel with an Alpha value greater than the Alpha threshold.
[0052] S303: Determine the target rendering image corresponding to the scene based on the semi-transparent rendering results.
[0053] In this disclosure, the various semi-transparent rendering results obtained in S302 are blended to obtain the target rendering image.
[0054] For example, refer to Figure 4The first semi-transparent rendering result 41(b), the second semi-transparent rendering result 42(b), and the third semi-transparent rendering result 43(b) are blended to obtain the target rendering image 44.
[0055] In addition, you can refer to Figure 5 According to the scene rendering method provided in this disclosure, the hair is rendered and the resulting target rendering image 51 does not have the problem of unclear rendering at the end of the hair, and a better rendering effect can be obtained.
[0056] By rendering semi-transparent meshes with different depth information layer by layer, the rendering effect of complex semi-transparent objects can be improved. Furthermore, identical pixels in different semi-transparent meshes are not rendered repeatedly, thus improving the rendering efficiency of semi-transparent objects.
[0057] refer to Figure 6 , Figure 6 Flowchart of the scene rendering method provided in the embodiments of this disclosure Figure 2 The scene rendering method includes:
[0058] S601 renders opaque objects, obtaining the opaque rendering result of the opaque objects.
[0059] The opaque rendering result includes: opaque depth texture, which includes the opaque depth information of each opaque pixel.
[0060] In this disclosure, the rendered scene includes opaque and semi-transparent objects. First, a rendering camera is created, which performs multi-layer rendering, rendering opaque objects in one layer and semi-transparent objects in other layers.
[0061] Specifically, the target rendered image needs to contain opaque objects (such as...) Figure 1 The image of a face (such as a hat) also needs to have a semi-transparent object (such as a mesh hat or...). Figure 1 (The hair in the image). Furthermore, the rendered result of the target image is an interweaving of opaque and semi-transparent objects. For example, in... Figure 1 When hair is rendered on a face image, the hair will cover part of the face.
[0062] In this disclosure, opaque objects are rendered first, followed by rendering of the semi-transparent meshes of each layer of a semi-transparent object. The resulting opaque rendering results include opaque color textures and opaque depth textures. The opaque color texture is cached in its corresponding color buffer, and the opaque depth texture is cached in its corresponding depth buffer. Furthermore, the opaque depth information of each opaque pixel can be the same or different, and this is not limited here.
[0063] In this disclosure, by rendering an opaque object, it is possible to render a semi-transparent object subsequently, so that both opaque and semi-transparent objects exist in the rendering scene.
[0064] S602, based on the opaque depth information and the semi-transparent depth information, renders the semi-transparent meshes of different layers according to the preset order of the semi-transparent depth information, and obtains the semi-transparent rendering result of the semi-transparent meshes.
[0065] In this disclosure, pre-rendered opaque rendering results and opacity depth information of the opaque results can be obtained.
[0066] If the semi-transparent depth information is greater than the opaque depth information, then the depth directions of the semi-transparent pixels and opaque pixels in the semi-transparent rendering result will not coincide.
[0067] In this disclosure, when the semi-transparent depth information is greater than the opaque depth information, it is determined that the part of the semi-transparent pixel and the opaque pixel in the semi-transparent mesh that overlaps in the depth direction is displayed behind the opaque pixel. Therefore, the semi-transparent pixels that overlap in the depth direction are not rendered. In the final semi-transparent rendering result, the semi-transparent pixels and the opaque pixels do not overlap in the depth direction.
[0068] Specifically, refer to Figure 7 S602 specifically includes the following steps:
[0069] S701, obtain the opacity depth information of the opacity rendering result corresponding to the opacity object, and the first semi-transparent depth information of the first layer of semi-transparent mesh.
[0070] Reference Figure 8 After rendering, the opaque object 81(a) yields an opaque rendering result 81(b). Then, the first semi-transparent depth information of the first layer of semi-transparent mesh 82(a) is obtained.
[0071] S702, determine whether the first semi-transparent depth information of the first semi-transparent mesh is greater than or equal to the opaque depth information.
[0072] If yes, then execute S703; otherwise, execute S707. Since the layer of the semi-transparent mesh is positively correlated with its semi-transparent depth information, the semi-transparent depth information of the semi-transparent mesh increases with the increase of its layer. Therefore, if the first semi-transparent depth information of the first layer of the semi-transparent mesh is greater than or equal to the opaque depth information, the semi-transparent depth information of other layers of the semi-transparent mesh must be greater than the opaque depth information.
[0073] S703, determine the first semi-transparent pixel in the first layer of semi-transparent mesh that does not coincide with the opaque rendering result in the depth direction.
[0074] In this disclosure, if the first semi-transparent depth information of the first semi-transparent mesh is greater than or equal to the opaque depth information, the first semi-transparent rendering result obtained by the first semi-transparent mesh should be displayed after the opaque rendering result in the final displayed target rendering image. Therefore, if pixels in the first semi-transparent mesh that coincide with the opaque rendering result in the depth direction are rendered, they will also be blocked by the opaque rendering result during the display process. Therefore, here only the first semi-transparent pixels in the first semi-transparent mesh that do not coincide with the opaque rendering result in the depth direction are rendered, and it is not necessary to repeatedly render the pixels that coincide with the depth direction, thereby increasing the rendering efficiency.
[0075] S704, render the first semi-transparent pixel to obtain the first semi-transparent rendering result corresponding to the first layer of semi-transparent mesh.
[0076] Reference Figure 8 Render a portion of the pixels (first semi-transparent pixels) in the first semi-transparent mesh 82(a) to obtain the first semi-transparent rendering result 82(b).
[0077] S705, determine the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh.
[0078] In this context, the i-th semi-transparent pixel does not overlap with the opaque rendering result or the pixels in the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result in the depth direction, and i takes integers from two to N in ascending order.
[0079] S706, render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0080] S705 and S706 are steps that are executed cyclically, as exemplified by [reference needed]. Figure 8 The process begins by identifying a second semi-transparent pixel in the second layer of semi-transparent mesh 83(a). This second semi-transparent pixel does not overlap with any pixels in the opaque rendering result 81(b) or the first semi-transparent rendering result 82(b) in the depth direction. This second semi-transparent pixel is then rendered to obtain the second semi-transparent rendering result 83(b) of the second layer of semi-transparent mesh. The process continues by identifying a third semi-transparent pixel in the third layer of semi-transparent mesh 84(a). This third semi-transparent pixel does not overlap with any pixels in the opaque rendering result 81(b) or any pixels in the first to second semi-transparent rendering results 82(b). This third semi-transparent pixel is then rendered to obtain the third semi-transparent rendering result 84(b) of the third layer of semi-transparent mesh.
[0081] As can be seen, by employing S701 to S706 of this disclosure, scene rendering can be performed on both opaque and semi-transparent objects in the rendering scene, with the opaque object positioned in front of the semi-transparent object. Furthermore, since the semi-transparent object is rendered layer by layer, the rendering effect of the semi-transparent object can be enhanced. Moreover, since pixels that overlap in the depth direction do not need to be rendered repeatedly, rendering efficiency can be improved.
[0082] S707 renders each pixel of the first layer of semi-transparent mesh to obtain the first semi-transparent rendering result of the first layer of semi-transparent mesh.
[0083] Among them, reference Figure 9 After rendering the opaque object 91(a), an opaque rendering result 91(b) is obtained. If the first semi-transparent depth information of the first layer of semi-transparent mesh is less than the opaque depth information, it means that the first semi-transparent rendering result needs to be displayed in front of the opaque rendering result 91(b) in the target rendering image. The opaque rendering result 91(b) will not block the first semi-transparent rendering result. Therefore, all pixels of the first layer of semi-transparent mesh 92(a) are rendered to obtain the first semi-transparent rendering result 92(b).
[0084] S708, obtain the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh.
[0085] S709, determine whether the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh is less than the opaque depth information.
[0086] If yes, execute S710; otherwise, execute S712.
[0087] S710, determine the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh.
[0088] Among them, the i-th semi-transparent pixel does not overlap with the pixels in the first to the (i-1)-th semi-transparent rendering results in the depth direction.
[0089] S711, render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0090] The S710 and S711 disclosed herein are capable of rendering a scene when a semi-transparent object is in front of an opaque object.
[0091] In this disclosure, if all pixels in the i-th layer of the semi-transparent mesh coincide with pixels in the first semi-transparent rendering result or the (i-1)-th layer of the semi-transparent rendering result in the depth direction, then there are no pixels to be rendered in the i-th layer of the semi-transparent mesh, and therefore, rendering of that layer of the semi-transparent mesh is unnecessary. It is evident that this disclosure renders only a portion of the semi-transparent mesh layers selectively, thus reducing the number of rendering operations and improving rendering efficiency.
[0092] S712, determine the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh.
[0093] Among them, the i-th semi-transparent pixel does not overlap with the opaque rendering result and the pixels in the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result in the depth direction;
[0094] S713, render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0095] S708 to S713 are cyclic execution steps, where i is taken from 2 to N in ascending order, and then S708 to S713 are executed accordingly.
[0096] In this disclosure, S712 and S713 can perform scene rendering for cases where an opaque object is in the middle of a semi-transparent object.
[0097] For example, refer to Figure 9 First, the second semi-transparent depth information in the second semi-transparent mesh 93(a) is obtained. If the second semi-transparent depth information is less than the opaque depth information, the rendered second semi-transparent rendering result 93(b) will also be displayed in front of the opaque rendering result 91(b) in the target rendering image 95. Therefore, it is only necessary to determine that the second semi-transparent pixels in the second semi-transparent mesh and the pixels in the first semi-transparent rendering result do not overlap in the depth direction. The second semi-transparent pixels are then rendered to obtain the second semi-transparent rendering result 93(b). Then, the third semi-transparent depth information in the third semi-transparent mesh 94(a) is obtained. If the third semi-transparent depth information is greater than or equal to the opaque depth information, the rendered third semi-transparent rendering result 94(b) will be displayed behind the opaque rendering result 91(b) in the target rendered image 95. Therefore, it is necessary to determine that the second semi-transparent pixel in the second semi-transparent mesh does not overlap with the pixels in the opaque rendering result 91(b) and the pixels in the first semi-transparent rendering result 92(b) to the second semi-transparent rendering result 93(b) in the depth direction. The third semi-transparent pixel is then rendered to obtain the third semi-transparent rendering result 94(b).
[0098] In this disclosure, rendering the i-th semi-transparent pixel includes: if i is greater than a layer threshold, determining a target pixel among the i-th semi-transparent pixels whose transparency value is less than a transparency threshold; and rendering the target pixel.
[0099] Specifically, when i is greater than the layer threshold, pixels with a transparency value greater than or equal to the transparency threshold in the i-th semi-transparent pixel are discarded. This can prevent the tail of semi-transparent objects such as hair from becoming transparent due to excessively high pixel transparency values in the semi-transparent rendering results of subsequent layers. Therefore, discarding these pixels can improve the rendering effect of semi-transparent objects.
[0100] In this disclosure, the opaque rendering result further includes: an opaque color texture; the semi-transparent rendering result includes a semi-transparent depth texture and a semi-transparent color texture; in the rendering process of opaque objects and semi-transparent objects, the scene rendering method further includes: caching the opaque depth texture and the semi-transparent depth texture in the corresponding depth buffer; and caching the opaque color texture and the semi-transparent color texture in the corresponding color buffer.
[0101] Furthermore, this disclosure involves comparing the depths of each layer of semi-transparent and opaque meshes in the shader, and then performing the corresponding rendering.
[0102] For example, refer to Figure 10 The renderer first executes the rendering process 101 for opaque objects, obtaining an opaque rendering result 102. The opaque rendering result 102 includes an opaque depth texture and an opaque color texture. The opaque depth texture is cached in the depth buffer A, and the opaque color texture is cached in the color buffer A.
[0103] Then, the rendering process 103 for the semi-transparent object is executed. Specifically, the rendering process for the semi-transparent object includes multiple passes, each pass rendering a semi-transparent mesh of a semi-transparent object. Pass 1 obtains the opaque depth texture and the first layer of semi-transparent mesh, and after rendering, obtains the first semi-transparent rendering result 104. The first semi-transparent rendering result 104 includes a first semi-transparent color texture and a first semi-transparent depth texture. The first semi-transparent color texture is cached in color buffer B, and the first semi-transparent depth texture is cached in depth buffer B. Then, pass 2 is executed, specifically obtaining the opaque depth texture and the first layer of semi-transparent depth texture, and rendering the second semi-transparent mesh of the semi-transparent object, obtaining the second semi-transparent rendering result 105. The second semi-transparent rendering result 105 includes a second semi-transparent color texture and a second semi-transparent depth texture. The second semi-transparent color texture is cached in color buffer C, and the second semi-transparent depth texture is cached in depth buffer C. Then, pass3 is executed, specifically to acquire the opaque depth texture, the first semi-transparent depth texture, and the second semi-transparent depth texture, and to render the third semi-transparent mesh of the semi-transparent object, resulting in the third semi-transparent rendering result 106. The second semi-transparent rendering result 106 includes the third semi-transparent color texture and the third semi-transparent depth texture. The third semi-transparent color texture is cached in the color buffer D, and the third semi-transparent depth texture is cached in the depth buffer D. Finally, the color textures from each color buffer and the depth textures from each depth buffer are blended and overlaid to obtain the target rendered image 107. In this disclosure, the depth texture is a collection of depth information from multiple pixels.
[0104] S603, synthesize the semi-transparent and opaque rendering results to obtain the target rendering image.
[0105] Among them, reference Figure 9 The target rendered image 95 is obtained. This target rendered image is the result of mixing and overlaying the opaque rendering results and the semi-transparent rendering results.
[0106] In this disclosure, by rendering semi-transparent meshes with different depth information of semi-transparent objects layer by layer, the rendering effect of complex semi-transparent objects can be improved. For example, it can render the parts of a veil hat where the layers do not obstruct each other, and it can also render the parts of hair where the layers do not obstruct each other, resulting in an opaque object that is closer to a realistic effect. Furthermore, the same pixels in different semi-transparent meshes are not rendered repeatedly, thereby improving the rendering efficiency of semi-transparent objects.
[0107] In this disclosure, semi-transparent meshes that do not meet the conditions do not need to be rendered. For example, if the semi-transparent depth information of a semi-transparent mesh is greater than its opaque depth information, and all pixels of the semi-transparent mesh coincide with the pixels of the opaque rendering result in the depth direction, then the semi-transparent mesh does not need to be rendered. This reduces the number of semi-transparent meshes to be rendered and improves the rendering efficiency of semi-transparent objects. In addition, by discarding pixels with low alpha values in the later layers of semi-transparent meshes, the rendering effect of complex semi-transparent objects can be improved.
[0108] Corresponding to the scene rendering method in the above embodiments, Figure 11 This is a structural block diagram of a scene rendering device 110 provided in an embodiment of this disclosure. For ease of explanation, only the parts relevant to the embodiments of this disclosure are shown. (Refer to...) Figure 11 The scene rendering device 110 includes: an acquisition module 111, a rendering module 112, and a determination module 113. Wherein:
[0109] The acquisition module 111 is used to acquire semi-transparent objects in the scene in response to the detection of the trigger condition for scene rendering. The semi-transparent objects include multiple layers of semi-transparent meshes, and the semi-transparent depth information of different layers of semi-transparent meshes is different.
[0110] The rendering module 112 is used to render the semi-transparent meshes of different layers according to the preset order of the semi-transparent depth information, so as to obtain the semi-transparent rendering result of the semi-transparent meshes, wherein the semi-transparent pixels in the different semi-transparent rendering results do not overlap in the depth direction;
[0111] The determination module 113 is used to determine the target rendering image corresponding to the scene based on the semi-transparent rendering results.
[0112] In one embodiment of this disclosure, the semi-transparent object includes N layers of semi-transparent meshes. The layer and depth information of the semi-transparent meshes are positively correlated. The rendering module 112 is specifically used to: obtain the opaque depth information of the opaque rendering result corresponding to the opaque object, and the first semi-transparent depth information of the first layer of semi-transparent meshes; if the first semi-transparent depth information of the first layer of semi-transparent meshes is greater than or equal to the opaque depth information, then determine the first semi-transparent pixel in the first layer of semi-transparent meshes that does not coincide with the opaque rendering result in the depth direction; render the first semi-transparent pixel to obtain the first semi-transparent rendering result corresponding to the first layer of semi-transparent meshes; determine the i-th semi-transparent pixel in the i-th layer of semi-transparent meshes, wherein the i-th semi-transparent pixel does not coincide with the opaque rendering result or the pixels in the first to (i-1)-th semi-transparent rendering results in the depth direction, and i is taken as an integer from two to N in ascending order; render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent meshes.
[0113] In one embodiment of this disclosure, the rendering module 112 is further configured to: if the first semi-transparent depth information of the first layer of semi-transparent mesh is less than the opaque depth information, render each pixel of the first layer of semi-transparent mesh to obtain the first semi-transparent rendering result of the first layer of semi-transparent mesh; obtain the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh; if the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh is less than the opaque depth information; determine the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh, wherein the i-th semi-transparent pixel does not overlap with any pixel in the depth direction from the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result; render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0114] In one embodiment of this disclosure, the rendering module 112 is further configured to: if the i-th semi-transparent depth information in the i-th layer of the semi-transparent mesh is greater than or equal to the opaque depth information, determine the i-th semi-transparent pixel in the i-th layer of the semi-transparent mesh, wherein the i-th semi-transparent pixel does not overlap with the pixels in the opaque rendering result and the pixels in the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result; render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of the semi-transparent mesh.
[0115] In one embodiment of this disclosure, the semi-transparent object includes N layers of semi-transparent meshes. The layer and depth information of the semi-transparent meshes are positively correlated. The rendering module 112 is specifically used to: render the first layer of semi-transparent meshes to obtain a first semi-transparent rendering result; determine the i-th semi-transparent pixel in the first layer of semi-transparent meshes, wherein the i-th semi-transparent pixel does not overlap with any pixel in the depth direction in the first to (i-1)-th semi-transparent rendering results; and render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent meshes, where i is an integer from two to N.
[0116] In one embodiment of this disclosure, when the rendering module 112 renders the i-th semi-transparent pixel, it specifically determines, if i is greater than the layer threshold, the target pixel whose transparency value is less than the transparency threshold among the i-th semi-transparent pixels; and renders the target pixel.
[0117] In one embodiment of this disclosure, the scene also includes an opaque object, and the rendering module 112 is specifically used to: render the opaque object to obtain an opaque rendering result of the opaque object, the opaque rendering result including: an opaque depth texture, the opaque depth texture including the opaque depth information of each opaque pixel;
[0118] The determination module 113 is specifically used to: synthesize the semi-transparent rendering results and the opaque rendering results to obtain the target rendering image.
[0119] In one embodiment of this disclosure, the opaque rendering result further includes: an opaque color texture; the semi-transparent rendering result includes a semi-transparent depth texture and a semi-transparent color texture; the scene rendering apparatus is further configured to: cache the opaque depth texture and the semi-transparent depth texture in a corresponding depth buffer; and cache the opaque color texture and the semi-transparent color texture in a corresponding color buffer.
[0120] The device provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be repeated here. It should be further noted that in this disclosure, the business logic corresponding to the fetching module 111, the rendering module 112, and the determining module 113 is encapsulated into components. This enables business logic that does not intrude on the page, allowing for plug-and-play functionality, achieving decoupling, and facilitating rapid reuse with other business scenarios and rapid expansion of other functions.
[0121] To implement the above embodiments, this disclosure also provides an electronic device. The system used in this electronic device can be iOS (Apple) or Android (Android).
[0122] refer to Figure 12 The diagram illustrates a structural schematic of an electronic device 120 suitable for implementing embodiments of the present disclosure. The electronic device 120 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 12 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0123] like Figure 12As shown, the electronic device 120 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 121, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 122 or a program loaded from storage device 128 into random access memory (RAM) 123. The RAM 73 also stores various programs and data required for the operation of the electronic device 120. The processing unit 121, ROM 122, and RAM 123 are interconnected via a bus 124. An input / output (I / O) interface 125 is also connected to the bus 124.
[0124] Typically, the following devices can be connected to I / O interface 125: input devices 126 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 127 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 128 including, for example, magnetic tapes, hard disks, etc.; and communication devices 129. Communication device 129 allows electronic device 120 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 12 An electronic device 120 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0125] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 129, or installed from a storage device 128, or installed from a ROM 122. When the computer program is executed by the processing device 121, it performs the functions defined in the methods of embodiments of this disclosure.
[0126] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0127] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0128] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
[0129] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0130] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0131] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".
[0132] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0133] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0134] In a first aspect, according to one or more embodiments of the present disclosure, a scene rendering method is provided, the scene rendering method comprising:
[0135] In response to the detection of a trigger condition for scene rendering, the semi-transparent objects in the scene are obtained. The semi-transparent objects include multiple layers of semi-transparent meshes, and the semi-transparent depth information of different layers of semi-transparent meshes is different.
[0136] According to the preset order of the semi-transparent depth information, the semi-transparent meshes of different layers are rendered to obtain the semi-transparent rendering results of the semi-transparent meshes. Among them, the semi-transparent pixels in different semi-transparent rendering results do not overlap in the depth direction.
[0137] Based on the rendering results of each semi-transparent element, determine the target rendering image corresponding to the scene.
[0138] According to one or more embodiments of this disclosure, the scene also includes opaque objects, and the semi-transparent objects include N layers of semi-transparent meshes. The layer level of the semi-transparent meshes is positively correlated with the depth information of the semi-transparent meshes. Different layers of semi-transparent meshes are rendered according to a preset order of the semi-transparent depth information to obtain a semi-transparent rendering result of the semi-transparent meshes, including:
[0139] Obtain the opacity depth information of the opacity rendering result corresponding to the opacity object, and the first semi-transparent depth information of the first layer of semi-transparent mesh;
[0140] If the first semi-transparent depth information of the first semi-transparent mesh is greater than or equal to the opaque depth information, then the first semi-transparent pixel in the first semi-transparent mesh that does not coincide with the opaque rendering result in the depth direction is determined.
[0141] Render the first semi-transparent pixel to obtain the first semi-transparent rendering result corresponding to the first layer of semi-transparent mesh;
[0142] Determine the i-th semi-transparent pixel in the i-th layer of the semi-transparent mesh. The i-th semi-transparent pixel does not overlap with the pixels in the opaque rendering result and the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result in the depth direction. i is taken as an integer from two to N in ascending order.
[0143] Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0144] According to one or more embodiments of this disclosure, the scene rendering method further includes:
[0145] If the first semi-transparent depth information of the first semi-transparent mesh is less than the opaque depth information, then render each pixel of the first semi-transparent mesh to obtain the first semi-transparent rendering result of the first semi-transparent mesh;
[0146] Obtain the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh;
[0147] If the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh is less than the opaque depth information;
[0148] Determine the i-th semi-transparent pixel in the i-th layer of the semi-transparent mesh. The i-th semi-transparent pixel does not overlap with any pixel in the first to the (i-1)-th semi-transparent rendering results in the depth direction.
[0149] Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0150] According to one or more embodiments of this disclosure, it further includes: if the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh is greater than or equal to the opaque depth information, determining the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh, wherein the i-th semi-transparent pixel does not overlap with the pixels in the opaque rendering result and the pixels in the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result in the depth direction.
[0151] Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0152] According to one or more embodiments of this disclosure, a semi-transparent object includes N layers of semi-transparent meshes, where the layer level of the semi-transparent meshes is positively correlated with the depth information of the semi-transparent meshes. Different layers of semi-transparent meshes are rendered in ascending order of their semi-transparent depth information to obtain a semi-transparent rendering result of the semi-transparent meshes, including:
[0153] Render the first layer of semi-transparent mesh to obtain the first semi-transparent rendering result;
[0154] Determine the i-th semi-transparent pixel in the first layer of semi-transparent mesh. The i-th semi-transparent pixel does not overlap with any pixel in the first to the (i-1)-th semi-transparent rendering results in the depth direction.
[0155] Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh, where i takes integer values from 2 to N.
[0156] According to one or more embodiments of this disclosure, rendering the i-th semi-transparent pixel includes: if i is greater than a layer threshold, determining a target pixel among the i-th semi-transparent pixels whose transparency value is less than a transparency threshold; and rendering the target pixel.
[0157] According to one or more embodiments of this disclosure, the scene also includes opaque objects, and further includes:
[0158] Render an opaque object to obtain the opaque rendering result of the opaque object. The opaque rendering result includes: opaque depth texture, which includes the opaque depth information of each opaque pixel;
[0159] Based on the rendering results of each semi-transparent element, determine the target rendering image corresponding to the scene, including:
[0160] The semi-transparent and opaque rendering results are combined to obtain the target rendered image.
[0161] According to one or more embodiments of this disclosure, the opaque rendering result further includes: an opaque color texture; the semi-transparent rendering result includes a semi-transparent depth texture and a semi-transparent color texture; the scene rendering method further includes: caching the opaque depth texture and the semi-transparent depth texture in a corresponding depth buffer; and caching the opaque color texture and the semi-transparent color texture in a corresponding color buffer.
[0162] Secondly, according to one or more embodiments of this disclosure, a scene rendering device is provided, the scene rendering device comprising:
[0163] The acquisition module is used to acquire semi-transparent objects in the scene in response to the detection of the trigger condition for scene rendering. The semi-transparent objects include multiple layers of semi-transparent meshes, and the semi-transparent depth information of different layers of semi-transparent meshes is different.
[0164] The rendering module is used to render different layers of semi-transparent meshes according to a preset order of semi-transparent depth information, so as to obtain the semi-transparent rendering result of the semi-transparent mesh. The semi-transparent pixels in different semi-transparent rendering results do not overlap in the depth direction.
[0165] The determination module is used to determine the target rendering image corresponding to the scene based on the rendering results of each semi-transparent element.
[0166] In one embodiment of this disclosure, the semi-transparent object includes N layers of semi-transparent meshes. The layer and depth information of the semi-transparent meshes are positively correlated. The rendering module is specifically used to: obtain the opaque depth information of the opaque rendering result corresponding to the opaque object, and the first semi-transparent depth information of the first layer of semi-transparent meshes; if the first semi-transparent depth information of the first layer of semi-transparent meshes is greater than or equal to the opaque depth information, then determine the first semi-transparent pixel in the first layer of semi-transparent meshes that does not coincide with the opaque rendering result in the depth direction; render the first semi-transparent pixel to obtain the first semi-transparent rendering result corresponding to the first layer of semi-transparent meshes; determine the i-th semi-transparent pixel in the i-th layer of semi-transparent meshes, wherein the i-th semi-transparent pixel does not coincide with the opaque rendering result or the pixels in the first to (i-1)-th semi-transparent rendering results in the depth direction, and i is taken as an integer from two to N in ascending order; render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent meshes.
[0167] In one embodiment of this disclosure, the rendering module is further configured to: if the first semi-transparent depth information of the first layer of semi-transparent mesh is less than the opaque depth information, render each pixel of the first layer of semi-transparent mesh to obtain the first semi-transparent rendering result of the first layer of semi-transparent mesh; obtain the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh; if the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh is less than the opaque depth information; determine the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh, wherein the i-th semi-transparent pixel does not overlap with any pixel in the depth direction from the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result; render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
[0168] In one embodiment of this disclosure, the rendering module is further configured to: if the i-th semi-transparent depth information in the i-th layer of the semi-transparent mesh is greater than or equal to the opaque depth information, determine the i-th semi-transparent pixel in the i-th layer of the semi-transparent mesh, wherein the i-th semi-transparent pixel does not overlap with the pixels in the opaque rendering result and the pixels in the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result; render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of the semi-transparent mesh.
[0169] In one embodiment of this disclosure, the semi-transparent object includes N layers of semi-transparent meshes. The layer and depth information of the semi-transparent meshes are positively correlated. The rendering module 112 is specifically used to: render the first layer of semi-transparent meshes to obtain a first semi-transparent rendering result; determine the i-th semi-transparent pixel in the first layer of semi-transparent meshes, wherein the i-th semi-transparent pixel does not overlap with any pixel in the depth direction in the first to (i-1)-th semi-transparent rendering results; and render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent meshes, where i is an integer from two to N.
[0170] In one embodiment of this disclosure, when the rendering module renders the i-th semi-transparent pixel, it specifically determines, if i is greater than the layer threshold, the target pixel whose transparency value is less than the transparency threshold among the i-th semi-transparent pixels; and renders the target pixel.
[0171] In one embodiment of this disclosure, the scene also includes an opaque object, and the rendering module is specifically used to: render the opaque object to obtain an opaque rendering result of the opaque object, the opaque rendering result including: an opaque depth texture, the opaque depth texture including the opaque depth information of each opaque pixel;
[0172] The module is specifically used to synthesize the semi-transparent and opaque rendering results to obtain the target rendered image.
[0173] In one embodiment of this disclosure, the opaque rendering result further includes: an opaque color texture; the semi-transparent rendering result includes a semi-transparent depth texture and a semi-transparent color texture; the scene rendering apparatus is further configured to: cache the opaque depth texture and the semi-transparent depth texture in a corresponding depth buffer; and cache the opaque color texture and the semi-transparent color texture in a corresponding color buffer.
[0174] Thirdly, according to one or more embodiments of the present disclosure, an electronic device is provided, comprising: at least one processor and a memory;
[0175] The memory stores the instructions that the computer executes;
[0176] At least one processor executes computer execution instructions stored in memory, causing at least one processor to execute the scene rendering method described in the first aspect above and various possible designs of the first aspect.
[0177] Fourthly, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, which stores computer-executable instructions that, when executed by a processor, implement the scene rendering method described in the first aspect and various possible designs of the first aspect.
[0178] Fifthly, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the scene rendering method described in the first aspect above and various possible designs of the first aspect.
[0179] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0180] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0181] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A scene rendering method, characterized in that, include: In response to the detection of a trigger condition for scene rendering, a semi-transparent object in the scene is obtained. The semi-transparent object includes N layers of semi-transparent meshes. The semi-transparent depth information of different layers of semi-transparent meshes is different. The layer of the semi-transparent mesh is positively correlated with the depth information of the semi-transparent mesh. According to the preset order of the semi-transparent depth information, the semi-transparent meshes of different layers are rendered to obtain the semi-transparent rendering results of the semi-transparent meshes, wherein the semi-transparent pixels in different semi-transparent rendering results do not overlap in the depth direction; Based on the semi-transparent rendering results, determine the target rendering image corresponding to the scene; The step of rendering the semi-transparent meshes of different layers according to a preset order of the semi-transparent depth information to obtain the semi-transparent rendering result of the semi-transparent meshes includes: Render the first layer of semi-transparent mesh to obtain the first semi-transparent rendering result; Determine the i-th semi-transparent pixel in the i-th layer of the semi-transparent mesh. The i-th semi-transparent pixel does not overlap with any pixel in the first to the (i-1)-th semi-transparent rendering results in the depth direction. The i is taken as an integer from two to N in ascending order. Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
2. The scene rendering method according to claim 1, characterized in that, The step of rendering the semi-transparent meshes of different layers according to a preset order of the semi-transparent depth information to obtain the semi-transparent rendering result of the semi-transparent meshes includes: Obtain the opacity depth information of the opacity rendering result corresponding to the opacity object, and the first semi-transparent depth information of the first layer of semi-transparent mesh; If the first semi-transparent depth information of the first semi-transparent mesh is greater than or equal to the opaque depth information, then the first semi-transparent pixel in the first semi-transparent mesh that does not overlap with the opaque rendering result in depth is determined; Render the first semi-transparent pixel to obtain the first semi-transparent rendering result corresponding to the first layer of semi-transparent mesh; Determine the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh. The i-th semi-transparent pixel does not overlap with the pixels in the opaque rendering result and the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result in the depth direction. The i is taken as an integer from two to N in ascending order. Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
3. The scene rendering method according to claim 2, characterized in that, Also includes: If the first semi-transparent depth information of the first semi-transparent mesh is less than the opaque depth information, then each pixel of the first semi-transparent mesh is rendered to obtain the first semi-transparent rendering result of the first semi-transparent mesh. Obtain the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh; If the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh is less than the opaque depth information; Determine the i-th semi-transparent pixel in the i-th layer of the semi-transparent mesh, wherein the i-th semi-transparent pixel does not overlap with any pixel in the first to the (i-1)-th semi-transparent rendering results in the depth direction; Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
4. The scene rendering method according to claim 3, characterized in that, Also includes: If the i-th semi-transparent depth information in the i-th layer of semi-transparent mesh is greater than or equal to the opaque depth information, the i-th semi-transparent pixel in the i-th layer of semi-transparent mesh is determined. The i-th semi-transparent pixel does not overlap with the opaque rendering result and the pixels in the first semi-transparent rendering result to the (i-1)-th semi-transparent rendering result in the depth direction. Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
5. The scene rendering method according to any one of claims 2 to 4, characterized in that, The rendering of the i-th semi-transparent pixel includes: If i is greater than the layer threshold, then among the i-th semi-transparent pixels, the target pixel whose transparency value is less than the transparency threshold is determined; Render the target pixel.
6. The scene rendering method according to any one of claims 2 to 4, characterized in that, Also includes: Render the opaque object to obtain the opaque rendering result of the opaque object. The opaque rendering result includes: opaque depth texture, which includes the opaque depth information of each opaque pixel. The step of determining the target rendering image corresponding to the scene based on each of the semi-transparent rendering results includes: The semi-transparent rendering result and the opaque rendering result are combined to obtain the target rendering image.
7. The scene rendering method according to claim 6, characterized in that, The opaque rendering result further includes: an opaque color texture; the semi-transparent rendering result includes a semi-transparent depth texture and a semi-transparent color texture; the scene rendering method further includes: The opaque depth texture and the semi-transparent depth texture are cached in the corresponding depth buffer; The opaque color texture and the semi-transparent color texture are cached in their respective color buffers.
8. A scene rendering device, characterized in that, The scene rendering device includes: The acquisition module is used to acquire a semi-transparent object in the scene in response to the detection of a trigger condition for scene rendering. The semi-transparent object includes N layers of semi-transparent meshes. The semi-transparent depth information of different layers of semi-transparent meshes is different. The layer of the semi-transparent mesh is positively correlated with the depth information of the semi-transparent mesh. The rendering module is used to render the semi-transparent meshes of different layers according to the preset order of the semi-transparent depth information, so as to obtain the semi-transparent rendering result of the semi-transparent meshes, wherein the semi-transparent pixels in the different semi-transparent rendering results do not overlap in the depth direction; The determining module is used to determine the target rendering image corresponding to the scene based on each of the semi-transparent rendering results; The rendering module is specifically used to render the first layer of semi-transparent mesh to obtain the first semi-transparent rendering result; Determine the i-th semi-transparent pixel in the i-th layer of the semi-transparent mesh. The i-th semi-transparent pixel does not overlap with any pixel in the first to the (i-1)-th semi-transparent rendering results in the depth direction. The i is taken as an integer from two to N in ascending order. Render the i-th semi-transparent pixel to obtain the i-th semi-transparent rendering result of the i-th layer of semi-transparent mesh.
9. An electronic device, characterized in that, include: Processor and memory; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the scene rendering method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the scene rendering method as described in any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the scene rendering method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Image object selection method and apparatus
CN104978739A
Particle special effect processing method and apparatus
CN108053464A
Object rendering processing method and device, computer device and storage medium
CN113052951A
