Water body rendering method and device, medium, electronic equipment and program product

By using runtime virtual texture and virtual height field texture in the water body rendering system, combining the water body color to render the water body in the opaque object treatment stage, the problems of high water body rendering performance and poor rendering effect in the prior art are solved, and efficient water body rendering effect is achieved.

CN120022590APending Publication Date: 2025-05-23BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510155268.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

Existing water body rendering systems consume high performance when dealing with mixed water bodies and terrain scenes, especially on equipment with low performance configurations, resulting in a decrease in rendering effect, such as the transition between water bodies and shores as hard edge cutting.

Method used

Runtime virtual textures are obtained by mixing the multi-layer terrain textures of the target terrain, and virtual height field textures are generated based on the height field data. During the opaque object processing stage of the rendering pipeline, the water body color is rendered to avoid repeated drawing of terrain pixels covered by the water body.

Benefits of technology

It effectively reduces the performance consumption of water body rendering, avoids over-drawing, and improves the rendering effect of water body, especially on equipment with low performance configuration, which can achieve smooth water body and shore transitions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120022590A_ABST
    Figure CN120022590A_ABST
Patent Text Reader

Abstract

The invention provides a water body rendering method and device, a medium, electronic equipment and a program product, and relates to the technical field of computers, and the method comprises the steps: mixing multiple layers of terrain textures of a target terrain, obtaining the runtime virtual texture of the target terrain, generating the virtual height field texture of the target terrain based on the height field data of the target terrain, and obtaining the virtual height field texture of the target terrain. And in the stage that the rendering pipeline is used for processing the opaque object, a rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and after the rendered water body is obtained, a target terrain is drawn based on the runtime virtual texture. As the semitransparent water body is moved to the stage for processing the opaque object to be drawn, pixels of the terrain covered by the water body cannot be repeatedly drawn, so that excessive drawing cannot be generated in the water body rendering process, the performance consumption of water body rendering is greatly reduced, and the water body rendering efficiency is improved. And a better water body rendering effect can be realized on equipment with different performance configurations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular, to a water body rendering method, device, medium, electronic device and program product. Background Art

[0002] The water rendering system is a common rendering system in game scene rendering. However, scenes involving a mixture of water and terrain (such as the shore) often have relatively high performance consumption. Since water is a semi-transparent object, related technologies generally draw opaque objects such as terrain first, and then draw water on the terrain, using mixing to achieve the semi-transparent effect of water. However, for terrain areas covered by water, it is actually equivalent to an OverDraw (overdrawing, which means that the same pixel is drawn multiple times during the rendering process) on the corresponding pixels, resulting in higher performance consumption.

[0003] Moreover, in devices with lower performance configurations, the rendering pipeline will not make additional copies of the scene depth map for efficiency reasons, which will greatly reduce the rendering effect of the water body. For example, the transition between the water body and the shore will appear as a hard cut edge effect. Summary of the invention

[0004] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0005] In a first aspect, the present disclosure provides a water body rendering method, comprising: Mixing multiple layers of terrain textures of a target terrain to obtain a runtime virtual texture of the target terrain; Based on the height field data of the target terrain, a virtual height field texture of the target terrain is generated; In the stage of the rendering pipeline for processing opaque objects, a rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and after obtaining the rendered water body, the target terrain is drawn based on the runtime virtual texture.

[0006] In a second aspect, the present disclosure provides a water body rendering device, comprising: An acquisition module configured to mix multiple layers of terrain textures of a target terrain to obtain a runtime virtual texture of the target terrain; A generating module, configured to generate a virtual height field texture of the target terrain based on the height field data of the target terrain; The rendering module is configured to obtain a rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body at a stage in the rendering pipeline for processing opaque objects, and after obtaining the rendered water body, draw the target terrain based on the runtime virtual texture.

[0007] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.

[0008] In a fourth aspect, the present disclosure provides an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect.

[0009] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which implements the steps of the method described in the first aspect when executed by a processor.

[0010] Based on the above technical solution, the runtime virtual texture of the target terrain is obtained by mixing the multiple layers of terrain textures of the target terrain, and the virtual heightfield texture of the target terrain is generated based on the heightfield data of the target terrain. Then, in the stage of the rendering pipeline for processing opaque objects, the rendered water body is obtained based on the runtime virtual texture, the virtual heightfield texture and the color of the water body. After obtaining the rendered water body, the target terrain is drawn based on the runtime virtual texture. Since the translucent water body is moved to the stage for processing opaque objects for drawing, not only can the pixels of the terrain covered by the water body not be drawn repeatedly, thereby preventing over-drawing in the water rendering process, greatly reducing the performance consumption of water rendering, but also achieving better water rendering effects on devices with different performance configurations.

[0011] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 It is a schematic diagram of a water rendering pipeline in the related art.

[0013] Figure 2The figure is a flow chart of a method for rendering a water body according to an exemplary embodiment.

[0014] Figure 3 is a schematic diagram of a runtime virtual texture according to an exemplary embodiment.

[0015] Figure 4 is a schematic diagram of a rendering pipeline according to an exemplary embodiment.

[0016] Figure 5 yes Figure 2 A detailed flow chart of step 230 is shown.

[0017] Figure 6 is a schematic diagram showing a first water body area and a second water body area according to an exemplary embodiment.

[0018] Figure 7 The figure is a rendering of a water body according to an exemplary embodiment.

[0019] Figure 8 The figure is a flow chart of a method for rendering a water body according to another exemplary embodiment.

[0020] Fig. 9 is a schematic diagram showing a body of water obstructing an object according to an exemplary embodiment.

[0021] Fig.10 is a schematic diagram of a hollow body according to an exemplary embodiment.

[0022] Fig.11 is a schematic diagram of a rendering pipeline according to another exemplary embodiment.

[0023] Fig.12 The figure is a schematic structural diagram of a water body rendering device according to an exemplary embodiment.

[0024] Fig.13 It is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0025] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0026] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0027] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0028] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0029] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0030] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0031] Figure 1 Schematic diagram of water rendering pipeline in related technology. Figure 1 As shown, in the water body rendering system of the related art, since the water body is a semi-transparent object, the rendering pipeline will include a shadow CSM (Cascaded ShadowMap) Pass, an opaque object Pass, a copy depth texture Pass, a semi-transparent object Pass, a post-processing Pass and a UI (User Interface) Pass in sequence.

[0032] Among them, Shadow CSM Pass is the stage (Pass) in the rendering pipeline used to render shadow effects. CSM achieves higher quality and more accurate shadow projection by dividing the scene into multiple cascaded cones and generating corresponding shadow maps for each cone. Opaque Object Pass is the stage in the rendering pipeline used to process opaque objects. Translucent Object Pass is the stage in the rendering pipeline used to process translucent objects. Copy Depth Pass is the stage in the rendering pipeline used to copy depth textures. Post-processing Pass is the stage in the rendering pipeline that performs subsequent processing on the rendered image. UI Pass is the stage in the rendering pipeline used to render the user interface.

[0033] The water rendering system of the related technology will first draw opaque objects such as terrain in the opaque object Pass of the rendering pipeline. In the copy depth texture Pass of the rendering pipeline, the depth texture is copied. Among them, in devices with lower performance configurations, due to the large bandwidth consumption caused by the copy depth texture Pass, the rendering pipeline will not include the copy depth texture Pass for efficiency considerations, which will greatly reduce the rendering effect of the water body. For example, the transition at the boundary between the water body and the shore will appear as a hard edge cutting effect. In the translucent object Pass of the rendering pipeline, the depth texture is sampled to draw the water body.

[0034] It can be seen that the water body rendering system of the related art not only has OverDraw, but also the rendering effect of the water body will be worse in devices with low performance configuration.

[0035] In view of the above technical problems, the embodiments of the present disclosure provide a water body rendering method, which not only can prevent the pixels of the terrain covered by the water body from being drawn repeatedly, thereby preventing any OverDraw from being generated during the water body rendering process, but also can achieve a good water body rendering effect on devices with different performance configurations. For example, the water body and the shore can be smoothly blended without any hard edges. The water body rendering method proposed in the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings.

[0036] Figure 2 FIG. 1 is a flow chart of a method for rendering a water body according to an exemplary embodiment. Figure 2 As shown, the embodiment of the present disclosure provides a water body rendering method, which can be specifically performed by a water body rendering device, which can be implemented by software and / or hardware and configured in an electronic device. Figure 2 As shown, the method may include the following steps.

[0037] In step 210 , multiple layers of terrain textures of the target terrain are mixed to obtain a runtime virtual texture of the target terrain.

[0038] Here, the target terrain may refer to the terrain that needs to be drawn in the game scene. The multi-layer terrain texture of the target terrain refers to the multi-layer terrain material that constitutes the target terrain. By mixing the multi-layer terrain textures of the target terrain in sequence, the runtime virtual texture (RVT) of the target terrain can be obtained.

[0039] RVT is a texture management system that allows dynamic loading, updating, and management of texture data at runtime. RVT optimizes memory usage and rendering performance by storing texture data in virtual memory and dynamically loading it into video memory as needed.

[0040] Figure 3 FIG. 1 is a schematic diagram of a runtime virtual texture according to an exemplary embodiment. Figure 3 As shown, the terrain texture used to generate the runtime virtual texture may include material information related to terrain rendering, such as color, normal, and roughness of the target terrain.

[0041] It is worth noting that in the RVT pre-mixing stage (Pass) of the rendering pipeline, the multiple layers of terrain textures of the target terrain can be mixed to obtain the runtime virtual texture of the target terrain. Among them, the RVT pre-mixing Pass is usually the first rendering stage of the rendering pipeline.

[0042] In step 220 , a virtual height field texture of the target terrain is generated based on the height field data of the target terrain.

[0043] Here, Virtual HeightField Texture (VHT) is a function of game engines (such as Unreal Engine) to provide higher-precision terrain bump details. Virtual HeightField Texture defines the shape of the terrain through heightfield data, which is a set of arrays, each of which represents the height of a point on the terrain. In the virtual heightfield texture, the height information of the target terrain is included, so that it can be rendered based on the height information in the subsequent rendering stage.

[0044] It is worth noting that in the RVT pre-mixing pass of the rendering pipeline, a virtual heightfield texture of the target terrain can be generated based on the heightfield data of the target terrain. In other words, in the RVT pre-mixing pass of the rendering pipeline, a runtime virtual texture and a virtual heightfield texture of the target terrain will be generated.

[0045] In step 230, at the stage of the rendering pipeline for processing opaque objects, a rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and after obtaining the rendered water body, the target terrain is drawn based on the runtime virtual texture.

[0046] Here, the water body may refer to a lake, a river, an ocean, etc. In the process of drawing the water body, the color of the water body and the texture data corresponding to the water body in the sampled runtime virtual texture may be sampled, and then based on the height information included in the virtual height field texture, the sampled color and texture data of the water body are mixed to obtain the rendered water body.

[0047] After the water is drawn, the target terrain that does not contain the water is drawn based on the runtime virtual texture. In other words, in the stage of the rendering pipeline used to process opaque objects, the water part is drawn first, and then the terrain part is drawn.

[0048] The stage of the rendering pipeline used to process opaque objects (opaque object pass) refers to the rendering stage specifically used to process opaque objects during the rendering process.

[0049] Generally speaking, in the stage of the rendering pipeline used to process opaque objects, opaque objects such as target terrain are usually drawn. Translucent objects such as water bodies are generally drawn in the stage of the rendering pipeline used to process translucent objects. Since the stage used to process opaque objects is after the stage used to process opaque objects, this will cause OverDraw to appear in the area covered by the water body.

[0050] In the disclosed embodiment, in the stage where the rendering pipeline is used to process opaque objects, water bodies are drawn first, and after the water bodies are drawn, the target terrain is drawn. Since the water body itself will cover the terrain, based on the characteristics of Pre-Z (pre-depth test), the pixels of the terrain covered by the water body will not be drawn repeatedly, so that no OverDraw will be generated during the water body rendering process. Excluding the influence of other rendering systems (such as special effects, UI), every pixel in the entire game scene (including pixels covered by water bodies) will only be drawn once. Among them, Pre-Z is a depth test step performed before formal rendering. The purpose of Pre-Z is to determine in advance which pixels are visible and which pixels are occluded, so as to avoid unnecessary color and texture processing of the occluded pixels.

[0051] Figure 4 FIG. 1 is a schematic diagram of a rendering pipeline according to an exemplary embodiment. Figure 4 As shown, the rendering pipeline includes RVT pre-mixing Pass, shadow CSM (Cascaded Shadow Map) Pass, opaque object Pass, translucent object Pass, post-processing Pass and UI Pass in sequence.

[0052] like Figure 4As shown, in the RVT pre-mixing Pass of the rendering pipeline, the runtime virtual texture and virtual height field texture of the target terrain are generated. Then, in the opaque object Pass of the rendering pipeline, the water body is first drawn based on the runtime virtual texture, the virtual height field texture and the color of the water body to obtain the rendered water body, and then the target terrain is drawn based on the runtime virtual texture.

[0053] It should be understood that since the rendering of water no longer relies on the depth texture for blending, Figure 4 In the rendering pipeline shown, there is no need to execute the copy depth texture Pass, which not only saves bandwidth consumption, but also supports the soft edge effect of water on devices with lower performance configuration.

[0054] Of course, it should be noted that when the water body includes other water effects, the rendered water body can also be obtained based on the runtime virtual texture, the virtual height field texture, the color of the water body and other water effects, where the other water effects may be foam effects.

[0055] Thus, by mixing the multiple layers of terrain textures of the target terrain, the runtime virtual texture of the target terrain is obtained, and based on the height field data of the target terrain, the virtual height field texture of the target terrain is generated, and then in the stage of the rendering pipeline for processing opaque objects, the rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and after obtaining the rendered water body, the target terrain is drawn based on the runtime virtual texture. Since the semi-transparent water body is moved to the stage for processing opaque objects for drawing, not only can the pixels of the terrain covered by the water body not be drawn repeatedly, so that over-drawing will not occur during the water body rendering process, which greatly reduces the performance consumption of water body rendering, but also can achieve better water body rendering effects on devices with different performance configurations. Compared with the water body effect on the device with higher performance configuration, the water body effect on the device with lower performance configuration can achieve a smooth mixing effect with the shore. For the device with lower performance configuration, the water body effect is only the lack of some highlights and material performance.

[0056] Figure 5 yes Figure 2 Detailed flow chart of step 230 is shown. Figure 5 As shown, in some possible implementations, step 230 may include the following steps.

[0057] In step 231, texture data covering the water body is obtained from the runtime virtual texture.

[0058] Here, when drawing a water body, the texture data covering the water body is sampled in the runtime virtual texture. The texture data covering the water body refers to the texture data of the terrain covered with the water body in the runtime virtual texture. The texture data can be understood as the pixel material of the terrain area covered with the water body sampled from the runtime virtual texture.

[0059] For example, according to the position information of the water body in the target terrain, texture data covering the water body corresponding to the position information may be sampled in the runtime virtual texture.

[0060] In step 232, terrain height data covering the water body is obtained from the virtual height field texture.

[0061] Here, when drawing a water body, the terrain height data covering the water body is sampled in the virtual height field texture, wherein the terrain height data covering the water body refers to the height data of the terrain covered by the water body in the virtual height field texture.

[0062] Exemplarily, according to the position information of the water body in the target terrain, the terrain height data covering the water body corresponding to the position information may be sampled in the virtual height field texture.

[0063] It is worth noting that in this embodiment, step 231 and step 232 can be performed synchronously. That is, the texture data covering the water body can be sampled from the runtime virtual texture and the terrain height data covering the water body can be sampled from the virtual height field texture at the same time.

[0064] In step 233, the depth information of the water body is determined according to the terrain height data and the viewing angle of the virtual camera.

[0065] Here, the virtual camera is a virtual camera object that defines the player's perspective in the game world. The virtual camera determines what the player sees in the game scene, including the position, direction, and field of view of the view. The virtual camera can be moved, rotated, and scaled to provide different perspectives and visual effects. The perspective of the virtual camera is determined by the position, direction, and field of view (FOV) of the virtual camera.

[0066] Exemplarily, the terrain height data may be converted according to the viewing angle of the virtual camera to obtain the depth information of the water body from the viewing angle of the virtual camera.

[0067] The depth information of the water body can be understood as the vertical distance from the surface of the water body to the surface of the terrain from the perspective of the virtual camera. The depth information of the water body is obtained from the perspective of the virtual camera. The depth information of the water body can actually be understood as the depth of the water body seen under terrains of different heights from the perspective of the player.

[0068] In step 234, the texture data and the color of the water body are mixed according to the depth information to obtain a rendered water body.

[0069] Here, the texture data and the color of the water body can be interpolated and mixed through the depth information, so that the rendered water body can present a realistic water body effect. For example, a realistic effect of the water body and the shore being integrated can be obtained.

[0070] Through the depth information, the color of the water body and the texture data of the target terrain can be dynamically adjusted, so that the water body can present different depth effects. In the shallow water area of ​​the water body, the water body looks more transparent, and even the terrain texture of the target terrain can be seen. In the deep water area of ​​the water body, the color of the water body is darker.

[0071] In some embodiments, for a first water body region whose depth information is less than a preset depth threshold, the texture data and the color of the water body are mixed based on the depth information to obtain the water body after rendering the first water body region.

[0072] Among them, the first water body area whose depth information is less than the preset depth threshold can be understood as a shallow water area of ​​the water body. For the shallow water area, the player can see the terrain under the water through the water. Therefore, for the first water body area whose depth information is less than the preset depth threshold, the texture data and the color of the water body can be mixed based on the depth information to obtain the water body after rendering of the first water body area.

[0073] It should be noted that since the texture data of the target terrain is used in the process of drawing the water body, not only can the water body rendered in the first water area achieve a translucent effect, but each water pixel in the shallow water area is actually only drawn once, and there will be no OverDraw performance consumption.

[0074] In some embodiments, for a second water body region whose depth information is greater than or equal to a preset depth threshold, a rendered water body of the second water body region is obtained based on the color of the water body.

[0075] Among them, the second water body area whose depth information is greater than or equal to the preset depth threshold can be understood as the deep water area of ​​the water body. For the deep water area, the player cannot see the terrain under the water body through the water body. Therefore, for the second water body area whose depth information is greater than or equal to the preset depth threshold, the color of the water body can be drawn to obtain the water body after the second water body area is rendered.

[0076] It should be understood that in the second water body area, by only drawing the color of the water body, the performance consumption of the electronic device can be saved. It is worth noting that the preset depth threshold can be set according to actual needs, and the size of the preset depth threshold can distinguish the deep water area and the shallow water area of ​​the water body.

[0077] Figure 6 FIG. 1 is a schematic diagram showing a first water body region and a second water body region according to an exemplary embodiment. Figure 6 As shown, the red area is the first water area (shallow water area) of the water body, and the green area is the second water area (deep water area) of the water body.

[0078] Therefore, through the above implementation, not only can the rendered water body achieve a semi-transparent effect, but also the performance consumption of OverDraw will not occur.

[0079] In some feasible implementations, in step 230, a rendered water body may be obtained based on the runtime virtual texture, the virtual height field texture, the color of the water body, and the water flow map corresponding to the water body.

[0080] Here, the water flow map (FlowMap) corresponding to the water body is a texture used to record the two-dimensional vector information of the water body. The flow effect of water or other objects can be achieved through FlowMap. The color on the FlowMap records the direction of the vector field. This direction information allows a certain point on the water body to show the characteristics of quantitative flow.

[0081] According to the position information of the water body in the target terrain, the first texture data covering the water body corresponding to the position information can be sampled in the virtual texture at runtime, according to the position information of the water body in the target terrain, the terrain height data covering the water body corresponding to the position information can be sampled in the virtual height field texture, according to the position information of the water body, the second texture data corresponding to the position can be sampled in the water flow map, and then the depth information of the water body can be determined according to the terrain height data, and then the first texture data, the second texture data and the color of the water body can be interpolated and mixed according to the depth information to obtain the rendered water body. Therefore, the effect of the rendered water body is no different from that of a translucent water body.

[0082] Figure 7 FIG. 1 is a rendering of a water body according to an exemplary embodiment. Figure 7 As shown, the rendered water body is no different from the translucent water body, presenting a realistic water effect. Moreover, the water body and the shore can also achieve a smooth blending effect.

[0083] Therefore, through the above implementation, the rendered water body can be made to have the same effect as a translucent water body, presenting a realistic water body effect.

[0084] Figure 8 FIG. 1 is a flow chart of a method for rendering a water body according to another exemplary embodiment. Figure 8 As shown, in some practicable implementations, the water body rendering method may include the following steps.

[0085] In step 810 , multiple layers of terrain textures of the target terrain are mixed to obtain a runtime virtual texture of the target terrain.

[0086] Here, the detailed description of step 810 can refer to the relevant description of the above embodiment, which will not be repeated here.

[0087] In step 820 , a virtual height field texture of the target terrain is generated based on the height field data of the target terrain.

[0088] Here, the detailed description of step 820 can refer to the relevant description of the above embodiment, which will not be repeated here.

[0089] In step 830, for the dynamic objects included in the water body, a hollow body covering the dynamic objects is bound to the dynamic objects.

[0090] Here, the dynamic objects included in the water body may refer to fish swimming in the water, underwater parts of floating objects in the water body, and the like.

[0091] Following the above implementation, the water body is drawn at the stage of the rendering pipeline for processing opaque objects, so the water body itself is equivalent to an opaque mesh. Although the rendered water body obtained at the stage of the rendering pipeline for processing opaque objects has excellent performance and can achieve the soft edge effect of the water body without relying on the scene depth texture, when the water body includes dynamic objects, since the depth of the water body has been written to the Depth Buffer during the water body drawing process, the rendered water body is equivalent to an opaque mesh, and all objects under the water body will be blocked by the water surface.

[0092] Fig. 9 FIG. 1 is a schematic diagram showing a water body blocking an object according to an exemplary embodiment. Fig. 9 As shown, the rendered water surface will block the underwater parts of floating objects and underwater dynamic objects.

[0093] Based on this, you can bind a dynamic mask to a dynamic object. A dynamic mask is a technique used in the rendering pipeline that allows the state or properties of the mask to be changed dynamically during the rendering process. In the rendering pipeline, a dynamic mask is often used to block or selectively render a specific part of the scene. The size of the dynamic mask can be larger than the bounding box area of ​​the dynamic object so that the dynamic object is completely covered by the dynamic mask. Fig.10 FIG. 1 is a schematic diagram of a hollow body according to an exemplary embodiment. Fig.10 As shown, the hollow body 1002 completely wraps the dynamic object 1001 .

[0094] Exemplarily, a hollow body may be bound to a dynamic object after a stage of the rendering pipeline for processing opaque objects and before other rendering stages of the rendering pipeline.

[0095] Fig.11 FIG. 1 is a schematic diagram of a rendering pipeline according to another exemplary embodiment. Fig.11 As shown, the rendering pipeline includes RVT pre-mixing Pass, hollow body Pass, shadow CSM Pass, opaque object Pass, semi-transparent object Pass, post-processing Pass and UI Pass in sequence. In the hollow body Pass, a hollow body is bound to a dynamic object.

[0096] In step 840, at the stage where the rendering pipeline is used to process opaque objects, a rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and a rendered dynamic object is obtained based on the texture data of the dynamic object, wherein, in the rendered water body, the water area where the hollow body is located appears to be hollow.

[0097] Here, when drawing water bodies, the hollow body will not affect the color buffer of the current rendering screen, but will act on the stencil buffer of the current rendering screen to mark the range covered by dynamic objects. All pixels marked as hollow areas by the hollow body will not pass the stencil test, so the pixels and depth in the hollow area will not be covered by the water body drawn in the stage used to process opaque objects. For the rendered water body, the water area where the hollow body is located appears to be hollow, that is, the water area where the hollow body is located will appear as a hole.

[0098] In the stage of the rendering pipeline used to process opaque objects, continue to draw opaque objects such as dynamic objects, so that dynamic objects will not be covered by water drawn in the opaque object Pass.

[0099] Therefore, through the above implementation, when the water body contains dynamic objects, the dynamic objects in the water body will not be blocked by the drawn water body, and over-drawing will not occur during the water body rendering process, which greatly reduces the performance consumption of water body rendering.

[0100] In some practicable implementations, at the stage where the rendering pipeline is used to process translucent objects, the hollowed-out areas in the rendered water body are drawn based on the translucent water body patches.

[0101] Here, following the above implementation, the water area where the hollow body is located will appear to be hollow. In this regard, in the stage where the rendering pipeline is used to process translucent objects, translucent water patches can be used to draw the hollow area to fill the hollow area to ensure that there will be no holes in the water body after rendering.

[0102] It should be noted that the translucent water patch is actually used to simulate the water surface. Through the translucent water patch, a layer of water surface will be drawn in the hollowed-out area. The water surface is set to a certain transparency so that light can partially penetrate it, while dynamic objects or terrain under the water surface can be seen.

[0103] In some embodiments, for a target area in a hollowed-out area in a rendered water body, texture data of the hollowed-out area is obtained from a runtime virtual texture, and terrain height data of the hollowed-out area is obtained from a virtual height field texture. Then, the target area is drawn based on the translucent water body patch, texture data, and terrain height data.

[0104] The target area is an area that does not contain dynamic objects. Fig.10 As shown, the target area is the gray area in the hollow body 1002. That is, since the hollow body needs to completely cover the dynamic object, the range of the hollow body will be slightly larger than the range of the dynamic object, so the area in the hollow state will have the above target area.

[0105] For the target area, since the target area will not be blocked by dynamic objects, the terrain under the water can be seen through the water in the target area. Therefore, based on the semi-transparent water body patch, texture data and terrain height data, the target area is drawn so that the rendered target area can present the effect of seeing the terrain through the water.

[0106] It should be understood that drawing the target area is actually converting the terrain height data into depth information, and then interpolating and mixing the semi-transparent water body patches and texture data through the depth information. For detailed description, please refer to the relevant description of the above embodiment.

[0107] It should be noted that, when the depth information of the target area is less than the preset depth threshold, the target area can be drawn based on the translucent water body patch, texture data and terrain height data. That is to say, when the target area is a shallow water area, since the terrain texture under the target area can be seen through the water surface in the shallow water area, the target area can be drawn based on the translucent water body patch, texture data and terrain height data. When the depth information of the target area is greater than or equal to the preset depth threshold, the target area can be drawn based on the translucent water body patch. That is to say, when the target area is a deep water area, since the terrain texture under the target area cannot be seen through the water surface in the deep water area, the target area can be drawn directly using the translucent water body patch.

[0108] For the area other than the target area in the hollowed-out area of ​​the rendered water body (equivalent to the area containing dynamic objects), a semi-transparent water body patch can be directly used for drawing. Accordingly, for the area containing dynamic objects, the effect of seeing the dynamic objects under the water surface through the water surface can be presented.

[0109] It is worth noting that, in the stage where the rendering pipeline is used to process opaque objects, the rendered dynamic objects are drawn based on the texture data of the dynamic objects, and in the stage where the rendering pipeline is used to process translucent objects, a layer of water is drawn on top of the dynamic objects, so OverDraw will appear in the area where the dynamic objects are located. Fig.10 As shown, OverDraw will appear in the area of ​​dynamic object 1001. However, since the number of dynamic objects is generally small, the OverDraw that appears is usually small. Therefore, even if the water body includes dynamic objects, an excellent water body rendering effect can be achieved at a very low OverDraw cost, so that the semi-transparent water body and the underwater dynamic objects can be perfectly integrated.

[0110] Fig.12 FIG. 1 is a schematic diagram showing a water body rendering device according to an exemplary embodiment. Fig.12 As shown, the embodiment of the present disclosure provides a water body rendering device 1200, and the water body rendering device 1200 includes: The obtaining module 1201 is configured to mix the multiple layers of terrain textures of the target terrain to obtain the runtime virtual texture of the target terrain; A generating module 1202 is configured to generate a virtual height field texture of the target terrain based on the height field data of the target terrain; The rendering module 1203 is configured to obtain a rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body at the stage of the rendering pipeline for processing opaque objects, and after obtaining the rendered water body, draw the target terrain based on the runtime virtual texture.

[0111] Optionally, the rendering module 1203 is specifically configured as follows: Obtaining texture data covering a water body from the runtime virtual texture; Acquire terrain height data covering the water body from the virtual height field texture; Determining the depth information of the water body according to the terrain height data and the viewing angle of the virtual camera; The texture data and the color of the water body are mixed according to the depth information to obtain a rendered water body.

[0112] Optionally, the rendering module 1203 is specifically configured as follows: For the first water body region whose depth information is less than a preset depth threshold, the texture data and the color of the water body are mixed based on the depth information to obtain a rendered water body of the first water body region; For the second water body region whose depth information is greater than or equal to the preset depth threshold, a water body after rendering of the second water body region is obtained based on the color of the water body.

[0113] Optionally, the rendering module 1203 is specifically configured as follows: A rendered water body is obtained based on the runtime virtual texture, the virtual height field texture, the color of the water body, and a water flow map corresponding to the water body.

[0114] Optionally, the water body rendering device 1200 further includes: A binding module is configured to bind a hollow body covering the dynamic object to the dynamic object included in the water body; The rendering module 1203 is specifically configured as follows: In the stage where the rendering pipeline is used to process opaque objects, a rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and a rendered dynamic object is obtained based on the texture data of the dynamic object, wherein, in the rendered water body, the water area where the hollow body is located appears to be hollow.

[0115] Optionally, the water body rendering device 1200 further includes: The drawing module is configured to draw the area in the hollowed-out state in the rendered water body based on the translucent water body patch at the stage of the rendering pipeline for processing translucent objects.

[0116] Optionally, the drawing module is specifically configured as follows: For a target area in the hollowed-out area in the rendered water body, acquiring texture data of the hollowed-out area from the runtime virtual texture, wherein the target area is an area that does not include the dynamic object; Acquire terrain height data of the area in the hollowed-out state from the virtual height field texture; The target area is rendered based on the semi-transparent water body patch, the texture data and the terrain height data.

[0117] Regarding the water body rendering device 1200 in the above embodiment, the method logic executed by each functional module has been described in detail in the part about the method, which will not be repeated here.

[0118] Reference below Fig.13 , which shows a schematic diagram of the structure of an electronic device (e.g., terminal device) 1300 suitable for implementing the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.13 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0119] like Fig.13 As shown, the electronic device 1300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1302 or a program loaded from a storage device 1308 to a random access memory (RAM) 1303. In the RAM 1303, various programs and data required for the operation of the electronic device 1300 are also stored. The processing device 1301, the ROM 1302, and the RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.

[0120] Typically, the following devices may be connected to the I / O interface 1305: an input device 1306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1309. The communication device 1309 may allow the electronic device 1300 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.13 The electronic device 1300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0121] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1309, or installed from the storage device 1308, or installed from the ROM 1302. When the computer program is executed by the processing device 1301, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0122] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0123] In some embodiments, the electronic devices may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0124] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0125] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: mixes the multiple layers of terrain textures of the target terrain to obtain the runtime virtual texture of the target terrain; generates a virtual height field texture of the target terrain based on the height field data of the target terrain; obtains a rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body in the stage where the rendering pipeline is used to process opaque objects, and after obtaining the rendered water body, draws the target terrain based on the runtime virtual texture.

[0126] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0127] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0128] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, limit the module itself.

[0129] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0130] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0131] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0132] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0133] Although the subject matter has been described in language specific to structural features and / or method logic actions, 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. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims

1. A water body rendering method, characterized in that: include: Mixing multiple layers of terrain textures of a target terrain to obtain a runtime virtual texture of the target terrain; Based on the height field data of the target terrain, a virtual height field texture of the target terrain is generated; In the stage of the rendering pipeline for processing opaque objects, a rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and after obtaining the rendered water body, the target terrain is drawn based on the runtime virtual texture.

2. The method according to claim 1, characterized in that The step of obtaining a rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body comprises: Obtaining texture data covering a water body from the runtime virtual texture; Acquire terrain height data covering the water body from the virtual height field texture; Determining the depth information of the water body according to the terrain height data and the viewing angle of the virtual camera; The texture data and the color of the water body are mixed according to the depth information to obtain a rendered water body.

3. The method according to claim 2, characterized in that The step of mixing the texture data and the color of the water body according to the depth information to obtain a rendered water body includes: For the first water body region whose depth information is less than a preset depth threshold, the texture data and the color of the water body are mixed based on the depth information to obtain a rendered water body of the first water body region; For the second water body region whose depth information is greater than or equal to the preset depth threshold, a water body after rendering of the second water body region is obtained based on the color of the water body.

4. The method according to any one of claims 1 to 3, characterized in that The step of obtaining a rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body comprises: A rendered water body is obtained based on the runtime virtual texture, the virtual height field texture, the color of the water body, and a water flow map corresponding to the water body.

5. The method according to any one of claims 1 to 3, characterized in that Before obtaining the rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body, the method further includes: For the dynamic objects included in the water body, binding the dynamic objects with a hollow body covering the dynamic objects; The method of obtaining a rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body in a stage of the rendering pipeline for processing opaque objects comprises: In the stage where the rendering pipeline is used to process opaque objects, a rendered water body is obtained based on the runtime virtual texture, the virtual height field texture and the color of the water body, and a rendered dynamic object is obtained based on the texture data of the dynamic object, wherein, in the rendered water body, the water area where the hollow body is located appears to be hollow.

6. The method according to claim 5, characterized in that The method further comprises: In the stage where the rendering pipeline is used to process translucent objects, the area in the hollowed-out state in the rendered water body is drawn based on the translucent water body patch.

7. The method according to claim 6, characterized in that The step of drawing the hollowed-out area of ​​the rendered water body based on the semi-transparent water body patch includes: For a target area in the hollowed-out area in the rendered water body, acquiring texture data of the hollowed-out area from the runtime virtual texture, wherein the target area is an area that does not include the dynamic object; Acquire terrain height data of the area in the hollowed-out state from the virtual height field texture; The target area is rendered based on the semi-transparent water body patch, the texture data and the terrain height data.

8. A water body rendering device, characterized in that: include: An acquisition module configured to mix multiple layers of terrain textures of a target terrain to obtain a runtime virtual texture of the target terrain; A generating module, configured to generate a virtual height field texture of the target terrain based on the height field data of the target terrain; The rendering module is configured to obtain a rendered water body based on the runtime virtual texture, the virtual height field texture and the color of the water body at a stage in the rendering pipeline for processing opaque objects, and after obtaining the rendered water body, draw the target terrain based on the runtime virtual texture.

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

10. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to 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 a processor, the steps of the method according to any one of claims 1 to 7 are implemented.