Water body rendering method and device, electronic equipment and readable medium
By optimizing the water rendering method, generating a block tree, performing view frustum culling and LOD level calculation, and dynamically adjusting the model accuracy and rendering specifications, the problem of insufficient representation of large-scale water bodies in 3D games is solved, achieving efficient realism and performance balance.
Patent Information
- Application Number
- CN202211729150.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-12-30
AI Technical Summary
In existing 3D games, the representation of large-scale water bodies is limited by device performance and cannot meet the requirements for realism, especially in mobile games, where the limitation on the number of model points and faces results in insufficient representation of wave undulations.
By acquiring water body rendering instructions, performing spatial information processing and drawing submission, generating water body blocks, visibility and LOD levels, organizing and storing spatial information in a tree structure, performing view frustum culling and LOD level calculation, dynamically adjusting model accuracy and rendering specifications, dividing culling groups and rendering groups, and optimizing the rendering process.
Without sacrificing game performance, the game improved the realism of water, reduced the geometric complexity of spatial information processing, decreased redundant calculations, and improved the efficiency of the art production process.
Smart Images

Figure CN116271806B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, and in particular to a water rendering method and device, electronic equipment and readable medium. BACKGROUND
[0002] With the development of graphics technology and the increasing demand of players, the demand for realistic picture performance in 3D games is growing. The performance of large-scale water bodies in existing 3D games, especially mobile games, is often limited by device performance and is not satisfactory. For example, due to the limitation of model point and surface number, it is not possible to use a model to represent the undulating waves of water, and only a normal map can be used for approximation. Such performance cannot meet the current demand for realism of water bodies in 3D games. SUMMARY
[0003] The present application aims to at least solve one of the technical problems in the prior art, and provides a water rendering method, device, electronic equipment and readable medium, which improves the realistic performance of water bodies without sacrificing game performance.
[0004] The technical solution of the present application includes a water rendering method, characterized in that the method comprises: obtaining a water rendering instruction, executing a water rendering process, the water rendering process comprising space information processing and drawing submission; the space information processing comprises: generating water blocks, visibility and LOD levels according to the space state to be processed, obtaining space information, each water block corresponding to a water instance; the drawing submission comprises: obtaining the rendering configuration of each water instance according to the space information, and executing the rendering process according to the rendering configuration.
[0005] According to the water rendering method, the method further comprises: setting an LOD setting for each water instance, the LOD setting comprising a model and rendering specification corresponding to each LOD level, an applicable distance of the LOD level, and a transition configuration of the LOD level.
[0006] According to the water rendering method, the space information processing comprises: representing the space information of the water to be rendered by a plurality of fine-grained blocks, and storing the space information in a tree structure, and converting the space information into a block tree through the space information processing, the information stored in the block tree comprising block position, block size, sub-block table and water instance reference.
[0007] According to the water rendering method, the space information processing comprises: dividing all water instances in the scene into a plurality of culling groups, performing view frustum culling and LOD level calculation on the culling groups respectively, and dividing the culling groups according to the altitude of the water instance and the LOD setting.
[0008] According to the water body rendering method, wherein the space information processing further comprises that the pre-computation performed by the culling group comprises: calculating a plane equation of a camera view cone according to camera attributes; calculating an intersection line of each view cone plane and a current culling group horizontal plane; and calculating a visual center of the current culling group.
[0009] According to the water body rendering method, wherein the space information processing further comprises: during the space information processing process, preferentially processing parent nodes of the block tree, and determining whether to process child nodes according to a processing result; and detecting whether there are nodes that have been culled or nodes that have been confirmed as the lowest configuration LOD, and not performing processing on the nodes that have been culled or the nodes that have been confirmed as the lowest configuration LOD.
[0010] According to the water body rendering method, wherein the space information processing further comprises: during the space information processing process, calculating an LOD level of a block according to a distance of the water body block to a visual center and an LOD setting of an instance, the LOD level being higher when the distance of the block to the visual center is closer to the visual center, and dynamically adjusting corresponding model precision and rendering precision according to the LOD level.
[0011] According to the water body rendering method, wherein the draw submission further comprises: dividing all the water body instances in a scene into a plurality of rendering groups, performing rendering state setting and draw command submission on each rendering group respectively, the rendering state comprising material, a map and an LOD setting of the water body instance, and dividing the water body instances with the same material, map and LOD setting into the same rendering group.
[0012] According to the water body rendering method, wherein the draw submission further comprises: collecting material, a map and an LOD setting in a rendering group collection group to obtain the space information, applying corresponding model and rendering settings to each water body instance according to a corresponding LOD level, submitting a draw command, and completing water body drawing.
[0013] The technical scheme of the present application further comprises a water body rendering device, comprising: a space information processing module, configured to generate water body blocks, visibility and LOD levels according to a to-be-processed space state to obtain space information, each water body block corresponding to a water body instance; and a draw submission module, configured to obtain rendering configuration of each water body instance according to the space information, and perform rendering processing according to the rendering configuration.
[0014] The technical scheme of the present application further comprises an electronic device, characterized by comprising a processor and a memory; the memory is configured to store a program; and the processor is configured to execute the program to implement any one of the water body rendering methods.
[0015] The technical scheme of the present application also comprises a computer readable storage medium, characterized in that the storage medium stores a program, and the program is executed by a processor to realize the water body rendering method according to any one of the preceding aspects.
[0016] The present application has the advantages of efficient spatial information processing, judging the visual importance of water body blocks, applying different models and rendering specifications, thereby improving the realism of water bodies without sacrificing performance. At the same time, all water body instances in the scene are planned, and the culling group and the rendering group are divided, thereby avoiding repeated calculations at runtime and providing convenience for the art production process. The spatial information processing process calculates the intersection of the camera view plane and the culling group horizontal plane through pre-computation, thereby reducing the spatial problem to a plane problem in subsequent calculations, and reducing the geometric complexity of the spatial information processing process. Rendering resources are allocated according to the visual importance of the blocks, thereby improving the overall performance of the water body while balancing performance consumption. BRIEF DESCRIPTION OF DRAWINGS
[0017] The present application will be further described below in conjunction with the drawings and embodiments.
[0018] Figure 1 Fig. 1 shows a flowchart of a water body rendering method according to an embodiment of the present application.
[0019] Figure 2 Fig. 2 shows a schematic diagram of applying different rendering configurations according to an embodiment of the present application.
[0020] Figure 3 Fig. 3 shows a schematic diagram of overall processing of multiple overlapping water body instances according to an embodiment of the present application.
[0021] Figure 4 Fig. 4 shows a flowchart of a spatial information processing process according to an embodiment of the present application.
[0022] Figure 5 Fig. 5 shows a rendering submission flowchart according to an embodiment of the present application.
[0023] Figure 6 Fig. 6 shows a device schematic diagram according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] This part will describe the specific embodiments of the present application in detail, and the preferred embodiments of the present application are shown in the drawings. The drawings serve to supplement the description in the text part of the specification, enabling people to intuitively and visually understand each technical feature and the overall technical scheme of the present application, but it cannot be understood as a limitation on the protection scope of the present application.
[0025] In the description of the present application, the meaning of one or more is one or more, the meaning of multiple is more than two, greater than, less than, more than, etc. Understand as not including the number, above, below, within, etc. Understand as including the number.
[0026] In the description of the present application, the continuous number of method steps is for the convenience of examination and understanding, combined with the overall technical scheme of the present application and the logical relationship between each step, adjusting the implementation order between steps will not affect the technical effect reached by the technical scheme of the present application.
[0027] In the description of the present application, unless otherwise explicitly limited, the setting and the like should be broadly understood, and the person skilled in the art can reasonably determine the specific meaning of the above words in the present application in combination with the specific content of the technical scheme.
[0028] Figure 1 The flow chart of the water body rendering method according to the embodiment of the present application is shown. The flow includes: first, the technical scheme of the present application needs to obtain water body rendering instructions, execute water body rendering processing, and the water body rendering processing includes space information processing and drawing submission;
[0029] S100, performing space information processing, including generating water body blocks, visibility and LOD levels according to the state of the space to be processed, obtaining space information, each of the water body blocks corresponding to a water body instance;
[0030] S200, performing drawing submission, including obtaining the rendering configuration of each water body instance according to the space information, and performing rendering processing according to the rendering configuration.
[0031] In some embodiments, it also includes: the space information generation process occurs offline, and its output result is a plurality of water body blocks organized in a tree structure. The space information processing process occurs at runtime, and its output result is the visibility and LOD level of each water body block. The drawing submission process occurs after the space information processing process, and its main content is to organize rendering information according to the result of the space information processing process and submit drawing.
[0032] Figure 2 The schematic diagram of applying different rendering configurations according to the embodiment of the present application is shown, Figure 2 In the present application, according to the angle of view of the (virtual) camera, the water body to be rendered is divided into a plurality of water body blocks, each block corresponding to an instance, each water body block is assigned corresponding material, map and LOD setting according to the distance between its center and the camera, and each block can be rendered according to the material, map and LOD setting. When close, water body model can be used, which has good performance, and when farther away from the camera, map and LOD level performance mode can be used to execute rendering.
[0033] Figure 3 Fig. 1 shows a schematic diagram of the process of rendering multiple overlapping water instances according to an embodiment of the present application. Referring to Fig. 1, the process of rendering multiple overlapping water instances according to an embodiment of the present application is shown. The embodiment divides all water instances in the scene into several culling groups by a spatial information processing procedure, and then performs view frustum culling and LOD level calculation for each culling group respectively. The criteria of dividing culling groups are the elevation and LOD setting of water instances. Water instances with the same elevation and LOD setting are divided into one culling group, so as to reduce unnecessary repeated calculation. Figure 3
[0034] Figure 4 Fig. 2 shows a flow chart of the spatial information processing procedure according to an embodiment of the present application. The flow of the embodiment is described in detail as follows:
[0035] The process of rendering large-scale water bodies by the present application is divided into spatial information generation procedure, spatial information processing procedure and rendering submission procedure.
[0036] For each water instance, the corresponding LOD setting is configured first. The LOD setting includes: 1. the model and rendering specification corresponding to each LOD level respectively 2. the applicable distance of each LOD level 3. the transition scheme of each LOD level.
[0037] The spatial information generation procedure occurs offline, and needs to provide the original spatial information of water bodies. The original shape of water bodies can be rectangular area or irregular area, but the elevation needs to be consistent, which is converted into block tree by the spatial information generation procedure. The information stored in the block includes: 1. block position 2. block size 3. sub-block table 4. water instance reference. The global information shared by the instance can be accessed through the water instance reference. The generation procedure fits the original area with several blocks, and then organizes these blocks into tree structure by quadtree algorithm.
[0038] The spatial information processing process occurs at runtime, and its output is the visibility and LOD level of each water block. First, all water instances in the scene are divided into several culling groups, and the view frustum culling and LOD level calculation are performed for each culling group. The standard for dividing the culling group is the altitude and LOD setting of the water instance, and the water instances with the same two attributes are divided into a culling group, thereby reducing unnecessary repeated calculation. Then, the precalculation is performed for each culling group. The precalculation includes the following steps: 1. Calculate the plane equation of the camera view frustum according to the camera attributes 2. Calculate the intersection line of each view frustum plane and the current culling group level 3. Calculate the visual center of the current culling group. Through precalculation, the view frustum culling can be reduced from a spatial problem to a plane problem, saving the geometric complexity of the subsequent spatial processing process. Finally, the block tree information of each water in the culling group is traversed, the parent node of the block tree is processed preferentially, and it is decided whether the child node needs to be processed according to the processing result. The node that has been culled and the node that has been confirmed as the lowest specification LOD will not be processed repeatedly.
[0039] The rendering submission process occurs after the spatial information processing process. First, all water instances in the scene are divided into several rendering groups, and the rendering state setting and rendering command submission are performed for each rendering group. The standard for dividing the rendering group is the material, map and LOD setting of the water instance, and the water instances with the same three attributes are divided into a rendering group, thereby reducing unnecessary rendering state switching. Then, each rendering group collects the spatial information processing result of the block in the group, applies the corresponding model and rendering setting to each LOD level, and submits the rendering command.
[0040] Figure 5 The rendering submission process occurs after the spatial information processing process. First, all water instances in the scene are divided into several rendering groups, and the rendering state setting and rendering command submission are performed for each rendering group. The standard for dividing the rendering group is the material, map and LOD setting of the water instance, and the water instances with the same three attributes are divided into a rendering group, thereby reducing unnecessary rendering state switching. Then, each rendering group collects the spatial information processing result of the block in the group, applies the corresponding model and rendering setting to each LOD level, and submits the rendering command.
[0041] S410, all water instances in the scene are divided into multiple rendering groups, and the rendering state setting and rendering command submission are performed for each rendering group. The rendering state includes the material, map and LOD setting of the water instance, and the water instances with the same material, map and LOD setting are divided into the same rendering group.
[0042] S420, all rendering groups collect the material, map and LOD setting in the group, obtain the spatial information, apply the corresponding model and rendering setting to each water instance according to the corresponding LOD level, submit the rendering command, and complete the water rendering.
[0043] Figure 6Fig. 1 shows a schematic diagram of an apparatus according to an embodiment of the present application. The apparatus comprises: a space information processing module configured to generate water body blocks, visibility and LOD levels according to a space state to be processed, to obtain space information, each water body block corresponding to a water body instance; and a rendering submission module configured to obtain a rendering configuration of each water body instance according to the space information, and to perform rendering processing according to the rendering configuration.
[0044] The embodiment of the present application further provides an electronic device, which comprises a processor and a memory;
[0045] The memory stores a program;
[0046] The processor executes the program to perform the water body rendering method described above. The electronic device has the function of carrying and running the software system for water body rendering provided by the embodiment of the present application, for example, a personal computer (PC), a mobile phone, a smart phone, a personal digital assistant (PDA), a wearable device, a pocket PC (PPC), a tablet computer, etc.
[0047] The embodiment of the present application further provides a computer readable storage medium, which stores a program, and the program is executed by a processor to implement the water body rendering method described above.
[0048] It should be appreciated that the method steps in the embodiment of the present application can be realized or implemented by computer hardware, a combination of hardware and software, or through computer instructions stored in a non-transitory computer readable storage medium. The method can use standard programming techniques. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if necessary, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. Furthermore, for this purpose, the program can run on a programmed special integrated circuit.
[0049] In addition, the operations of the processes described herein can be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) can be performed under the control of one or more computer systems configured with executable instructions (e.g., executable instructions, one or more computer programs or one or more applications), and can be implemented as code (e.g., executable instructions, one or more computer programs or one or more applications) executing collectively on one or more processors, by hardware or combinations thereof. The computer programs include a plurality of instructions executable by one or more processors.
[0050] Further, the methods can be implemented in any type of computing platform operably coupled to a suitable computing platform, including but not limited to a personal computer, a mini-computer, a mainframe, a workstation, a network or distributed computing environment, a stand-alone or integrated computer platform, or in communication with a charged particle tool or other imaging device, and the like. Aspects of the present application can be implemented in machine readable code stored on a non-transitory storage medium or device, whether removable or integrated to the computing platform, such as a hard disk, an optical read and / or write storage medium, RAM, ROM, and the like, such that it is readable by a programmable computer and, when the storage medium or device is read by the computer, is used to configure and operate the computer to perform the processes described herein. In addition, the machine readable code, or portions thereof, can be transmitted over a wired or wireless network. The present application described herein includes these and other different types of non-transitory computer readable storage media when such media include instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. The present application also includes the computer itself when programmed in accordance with the methods and techniques described herein.
[0051] The computer program can be applied to input data to perform the functions described herein, thereby transforming the input data to generate output data that is stored to non-volatile memory. The output information can also be applied to one or more output devices, such as a consumer. In a preferred embodiment of the present application, the transformed data represents a physical and tangible object, including a specific visual depiction of a physical and tangible object produced on the consumer.
[0052] The embodiments of the present application described above are merely exemplary and are not intended to limit the present application to the described embodiments. Various modifications of the described embodiments incorporating the spirit of the present application and departing from the literal form of the described embodiments are possible.
Claims
1. A water body rendering method, characterized in that, The method comprises: Obtaining water body rendering instructions, executing water body rendering processing, the water body rendering processing comprising spatial information processing and drawing submission; The spatial information processing comprises: generating water body blocks, visibility and LOD levels according to the space state to be processed, obtaining spatial information, each water body block corresponding to a water body instance; The drawing submission comprises: obtaining the rendering configuration of each water body instance according to the spatial information, and executing rendering processing according to the rendering configuration; Wherein, the spatial information processing comprises: The spatial information of the water body to be rendered is represented by multiple fine-grained blocks, and is stored in a tree structure, and is uniformly converted into a block tree through the spatial information processing, the information stored in the block tree includes block position, block size, sub-block table and water body instance reference; According to the altitude and LOD setting of the water body instance, all water body instances in the scene are divided into multiple culling groups; wherein, the altitude and LOD setting of the water body instances in the same culling group are the same; After precomputing each culling group, the culling group is subjected to frustum culling and LOD level calculation respectively; Wherein, the precomputation comprises: calculating the plane equation of the camera frustum according to the camera attribute; calculating the intersection line of each frustum plane and the horizontal plane of the current culling group; calculating the visual center of the current culling group.
2. The method of Claim 1, wherein, The method further comprises: Setting the LOD setting for each water body instance, the LOD setting comprising the model and rendering specification corresponding to the LOD level respectively, the applicable distance of the LOD level and the transition configuration of the LOD level.
3. The method of Claim 1, wherein, The spatial information processing further comprises: During the spatial information processing process, the parent node of the block tree is processed first, and whether the child node needs to be processed is determined according to the processing result; And, detecting whether there is a node that has been culled or a node that has been confirmed as the lowest configuration LOD in the block tree, if there is, the node that has been culled or the node that has been confirmed as the lowest configuration LOD is not processed.
4. The method of claim 1, wherein, The LOD level calculation in the spatial information processing further comprises: According to the distance of the water body block to the visual center and the LOD setting of the instance, the LOD level of the block is calculated, the closer the LOD level is to the visual center, the higher the LOD level is, and the model accuracy and rendering accuracy are dynamically adjusted according to the LOD level.
5. The method of Claim 1, wherein, The drawing submission further comprises: All water body instances in the scene are divided into multiple rendering groups, rendering state setting and drawing command submission are performed for each rendering group, the rendering state comprises the material, map and LOD setting of the water body instance, and the water body instances with the same material, map and LOD setting are divided into the same rendering group.
6. The method of claim 5, wherein, The drawing submission further comprises: Collecting the material, map and LOD setting in all rendering groups to obtain the spatial information, applying the corresponding model and rendering setting to each water body instance according to the corresponding LOD level, submitting the drawing command, and completing the water body drawing.
7. A water body rendering apparatus, comprising: Comprise: The spatial information processing module is configured to generate water body blocks, visibility, and LOD levels according to a to-be-processed spatial state, to obtain spatial information, and each water body block corresponds to a water body instance; The rendering submission module is configured to obtain rendering configuration of each water body instance according to the spatial information, and to perform rendering processing according to the rendering configuration; The spatial information processing includes: The spatial information of a to-be-rendered water body is represented by a plurality of fine-grained blocks, and is stored in a tree structure, and is uniformly converted into a block tree by the spatial information processing unit, and the information stored in the block tree includes block position, block size, sub-block table, and water body instance reference; All water body instances in a scene are divided into a plurality of culling groups according to the altitude and LOD setting of the water body instances, and the altitude and LOD setting of the water body instances in the same culling group are the same; After pre-computing each culling group, the culling group is subjected to frustum culling and LOD level calculation. The pre-computing includes: calculating a plane equation of a camera frustum according to camera attributes; calculating an intersection line of each frustum plane and a horizontal plane of a current culling group; and calculating a visual center of the current culling group.
8. An electronic device, comprising: The device includes a processor and a memory; The memory is configured to store a program; The processor executes the program to implement the water body rendering method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a program, and the program is executed by the processor to implement the water body rendering method according to any one of claims 1-6.
Citation Information
Patent Citations
Image rendering method and device and electronic equipment
CN112370777A