Liquid surface-based rendering method, device, equipment, medium, and program product
Through the coordinated processing of GPU and CPU, the vertex and raster fluctuation data of the liquid surface are solved, the rendering performance fluctuation problem is solved, stable rendering of the liquid surface and interactive objects is achieved, and the rendering performance is improved.
Patent Information
- Application Number
- CN202111419447.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2041-11-26
AI Technical Summary
In the prior art, when rendering liquid surfaces and virtual objects interacting with liquid surfaces, there is a problem of performance fluctuation in reading back GPU data, resulting in unstable rendering performance.
The vertex fluctuation data of the liquid surface is solved by the graphics processor, and divided into grids by the central processor for further calculation. Combined with the parallel processing of the GPU and the CPU, the liquid surface and interactive virtual objects are rendered respectively.
Improve the stability and resource utilization of rendering performance, and realize efficient parallel rendering of liquid surfaces and interactive objects.
Smart Images

Figure CN114092621B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to rendering technology in the field of computer applications, and in particular to a liquid surface-based rendering method, apparatus, device, medium, and program product. Background Art
[0002] In virtual scenes, it is often necessary to render liquid surfaces such as ocean and water surfaces, as well as virtual objects that interact with liquid surfaces. Generally speaking, in order to render liquid surfaces and virtual objects that interact with liquid surfaces, the Graphics Processing Unit (GPU) is usually used to calculate the liquid surface's fluctuation data to render a high-confidence liquid surface, and then read back the fluctuation data from the GPU to render virtual objects that interact with the liquid surface. However, the above rendering process involves reading back GPU data, and reading back GPU data has performance fluctuation issues, resulting in low rendering performance stability. Summary of the Invention
[0003] Embodiments of the present application provide a liquid surface-based rendering method, apparatus, device, computer-readable storage medium, and computer program product, which can improve the stability of rendering performance.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present application provides a liquid surface-based rendering method, including:
[0006] Calculating vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered by a graphics processor to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered;
[0007] In the process of obtaining the vertex fluctuation data set by the graphics processor, the liquid surface to be rendered is divided into a plurality of grids to be rendered by the central processing unit, and grid fluctuation data corresponding to each grid to be rendered is calculated to obtain grid fluctuation data sets corresponding to the plurality of grids to be rendered;
[0008] In a virtual scene, the graphics processor renders the liquid surface to be rendered based on the vertex fluctuation data set, and the central processing unit renders a virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set.
[0009] The present invention provides a liquid surface-based rendering device, comprising:
[0010] A first solving module is used to solve the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered by a graphics processor to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered;
[0011] a second solving module configured to, during the process of obtaining the vertex fluctuation data set by the graphics processor, divide the liquid surface to be rendered into a plurality of grids to be rendered by the central processing unit, and solve the grid fluctuation data corresponding to each grid to be rendered to obtain grid fluctuation data sets corresponding to the plurality of grids to be rendered;
[0012] The data rendering module is used to render the liquid surface to be rendered based on the vertex fluctuation data set by the graphics processor in the virtual scene, and to render the virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set by the central processing unit.
[0013] In an embodiment of the present application, the second solving module is further used to create a first fluctuation data solving task for each grid to be rendered, and obtain multiple first fluctuation data solving tasks corresponding to multiple grids to be rendered, wherein the first fluctuation data solving task is used to solve the grid fluctuation data corresponding to each grid to be rendered; divide the multiple first fluctuation data solving tasks into at least one fluctuation data solving thread; execute at least one fluctuation data solving thread to obtain the grid fluctuation data set.
[0014] In an embodiment of the present application, the first solving module is further used to traverse the set of vertices to be rendered corresponding to the liquid surface to be rendered; solve the vertex fluctuation data corresponding to each traversed vertex to be rendered, and obtain the vertex fluctuation data set corresponding to the liquid surface to be rendered.
[0015] In an embodiment of the present application, the first solving module is further used to divide the set of vertices to be rendered corresponding to the liquid surface to be rendered based on a specified number of vertices to be rendered to obtain multiple meshes to be rendered; create a second fluctuation data solving task for each vertex to be rendered in each mesh to be rendered to obtain a second fluctuation data solving task group corresponding to the mesh to be rendered, thereby obtaining multiple second fluctuation data solving task groups corresponding to multiple meshes to be rendered, wherein the second fluctuation data solving task is used to solve the vertex fluctuation data corresponding to each vertex to be rendered; execute multiple second fluctuation data solving task groups to obtain the vertex fluctuation data set corresponding to the liquid surface to be rendered.
[0016] In an embodiment of the present application, the rendering device further includes a shading rendering module, which is configured to determine, through the graphics processor, shading rendering data corresponding to the vertex fluctuation data set.
[0017] In an embodiment of the present application, the data rendering module is further configured to combine the shading rendering data and the vertex fluctuation data set to render the liquid surface to be rendered.
[0018] In an embodiment of the present application, the shading rendering module is also used to perform the following processing through the central processing unit: collecting lighting environment data, wherein the lighting environment data includes at least one of scene environment data, lighting intensity, lighting color, lighting angle and lighting behavior data; converting the lighting environment data into light rendering parameters; and sending the light rendering parameters to the graphics processor.
[0019] In an embodiment of the present application, the shading rendering module is further configured to determine the shading rendering data corresponding to the vertex fluctuation data set based on the light rendering parameters.
[0020] In an embodiment of the present application, the shading rendering module is also used to traverse the vertex fluctuation data set; perform lighting processing on each traversed vertex fluctuation data to obtain the shading rendering data corresponding to the vertex fluctuation data set, wherein the lighting processing includes at least one of subsurface scattering processing, subsurface scattering processing and surface reflection processing.
[0021] In an embodiment of the present application, the rendering device also includes a parameter acquisition module for responding to the i-th frame rendering request of the water surface to be rendered in the virtual scene, and performing the following processing through the central processing unit, wherein i is a monotonically increasing positive integer variable: obtaining fluctuation environment data, wherein the fluctuation environment data includes at least one of wind direction, wind force, wave height, wavelength and fluctuation behavior data; converting the fluctuation environment data into fluctuation environment parameters; and sending the fluctuation environment parameters to the graphics processor.
[0022] In an embodiment of the present application, the first solving module is further used to solve the vertex fluctuation data corresponding to each of the to-be-rendered vertices in the to-be-rendered liquid surface based on the fluctuation environment parameters.
[0023] In an embodiment of the present application, the second solving module is further used to solve the grid fluctuation data corresponding to each grid to be rendered based on the fluctuation environment parameters.
[0024] In an embodiment of the present application, the second solving module is further used to determine the grid division unit based on the thread processing scale and the liquid surface to be rendered, wherein the thread processing scale is the maximum number of threads processed by the central processing unit; based on the grid division unit, the liquid surface to be rendered is divided into multiple grids to be rendered.
[0025] In an embodiment of the present application, the data rendering module is further used to determine the buoyancy parameters based on the grid fluctuation data set; determine the buoyancy information corresponding to the liquid surface to be rendered based on the buoyancy parameters; determine the motion information of the virtual object interacting with the liquid surface to be rendered based on the buoyancy information by the physical engine, wherein the physical engine is called by the central processing unit; and render the virtual object based on the motion information.
[0026] An embodiment of the present application provides a liquid surface-based rendering device, comprising:
[0027] a memory for storing executable instructions;
[0028] The processor is configured to implement the liquid surface-based rendering method provided in the embodiment of the present application when executing the executable instructions stored in the memory.
[0029] An embodiment of the present application provides a computer-readable storage medium storing executable instructions, which are used to implement the liquid surface-based rendering method provided in the embodiment of the present application when executed by a processor.
[0030] An embodiment of the present application provides a computer program product, including a computer program or instructions. When the computer program or instructions are executed by a processor, the liquid surface-based rendering method provided in the embodiment of the present application is implemented.
[0031] The embodiments of the present application have at least the following beneficial effects: while the GPU is solving the fluctuation data of the liquid surface to be rendered (called the vertex fluctuation data set), the CPU is simultaneously performing a coarse-grained solution on the fluctuation data of the liquid surface to be rendered; thereby, while the GPU is achieving high-confidence rendering of the liquid surface to be rendered, the CPU can render virtual objects that interact with the liquid surface to be rendered based on the coarse-grained fluctuation data (called the grid fluctuation data set) solved by the CPU; in this way, since the rendering of the liquid surface to be rendered by the GPU is based on the data solved by the GPU, the rendering of the virtual objects that interact with the liquid surface to be rendered by the CPU is based on the data solved by the CPU; that is, the CPU and GPU can achieve rendering based only on the data solved by themselves, thereby improving the stability of the rendering performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is an exemplary waveform diagram of Gerstner waves;
[0033] Figure 2 is a schematic rendering of an exemplary Gerstner wave;
[0034] Figure 3 Schematic diagram of the architecture of a liquid surface-based rendering system provided in an embodiment of the present application;
[0035] Figure 4 This embodiment of the present application provides Figure 3 A schematic diagram of the composition structure of a terminal;
[0036] Figure 5 1 is a flow chart of a liquid surface-based rendering method provided in an embodiment of the present application;
[0037] Figure 6 This is a schematic diagram of a process for obtaining a grid fluctuation data set provided by an embodiment of the present application;
[0038] Figure 7 This is an exemplary liquid surface rendering flow chart provided in an embodiment of the present application;
[0039] Figure 8 This is a functional implementation diagram of an exemplary water wave simulation module provided in an embodiment of the present application;
[0040] Figure 9 This is a schematic diagram of an exemplary implementation flow of a submodule running on a CPU provided in an embodiment of the present application;
[0041] Figure 10 This is a schematic diagram of an exemplary implementation flow of a submodule running on a GPU provided in an embodiment of the present application;
[0042] Figure 11 Schematic diagram of an exemplary coloring simulation module for implementing water coloring provided in an embodiment of the present application;
[0043] Figure 12 This is a schematic diagram of an exemplary implementation flow of a shading rendering module provided in an embodiment of the present application;
[0044] Figure 13 This is a schematic diagram of an exemplary simulation of water fluctuations provided in an embodiment of the present application;
[0045] Figure 14 is another exemplary simulation schematic diagram of water body fluctuations provided in an embodiment of the present application;
[0046] Figure 15 This is another exemplary schematic diagram of water body fluctuation simulation provided in an embodiment of the present application;
[0047] Figure 16 This is a schematic diagram of an exemplary interaction between water waves and virtual objects provided in an embodiment of the present application;
[0048] Figure 17 This is a schematic diagram of an exemplary water surface lighting rendering effect provided by an embodiment of the present application;
[0049] Figure 18 This is another exemplary schematic diagram of water surface lighting rendering effect provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0051] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0052] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0053] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in the embodiments of this application are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0054] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0055] 1) Fluid dynamics is a branch of fluid mechanics that studies the motion of a fluid as a continuous medium under the action of forces and its interaction with boundaries, as well as the interaction between the fluid and other forms of motion. The difference between fluid dynamics and fluid statics is that fluid dynamics studies the fluid in motion; the difference between fluid dynamics and fluid kinematics is that fluid dynamics is used to study the forces acting on the fluid. In addition, fluid dynamics includes two major parts: liquid dynamics and gas dynamics. The embodiments of this application involve liquid dynamics, which describes the ripples on the liquid surface caused by liquid dynamics.
[0056] 2) Ripples refer to the fluid dynamics effects of environmental forces such as wind on the water surface, including Gerstner waves (also known as trochoidal waves). Gerstner waves are essentially the exact solution of the Euler equations for periodic gravity waves on the liquid surface. Gravity waves, in fluid mechanics, are waves that occur within a liquid medium or at the interface between two media (for example, between the atmosphere and the ocean). When a small liquid mass leaves the liquid surface (interface type) or reaches a region of different liquid density (inside liquid type), gravity causes the liquid mass to oscillate between equilibrium states in the form of waves, forming gravity waves. The Euler equations, also known as the differential equations of motion, are among the most important fundamental equations in inviscid fluid dynamics. They are the differential equations of motion derived by applying Newton's second law to a small mass of inviscid fluid. In fluid dynamics, the Euler equations are a set of equations governing the motion of inviscid fluids. In the embodiments of this application, the various wave data involved are used to render ripples on the liquid surface.
[0057] 3) CPU hyperthreading refers to the use of special hardware instructions to simulate multiple logical cores into physical chips, enabling a single processor to perform thread-level parallel computing, thereby enabling compatibility with multi-threaded parallel computing, and thus with multi-threaded operating systems and software, improving operational performance. In the present embodiment, the CPU can perform the fluctuation data processing using CPU hyperthreading.
[0058] 4) A physics engine, which is used to calculate motion, rotation, and collision responses by assigning real physical properties to rigid objects. In an embodiment of the present application, the motion information of a virtual object interacting with a liquid surface may be determined by the physics engine.
[0059] 5) Shaders are editable programs that replace fixed rendering pipelines to achieve image rendering. They are editable, so they can achieve a variety of image rendering effects without being restricted by the fixed rendering pipeline of the graphics card. In the embodiment of the present application, shaders include compute shaders and fragment shaders (also known as pixel shaders). Among them, compute shaders mainly use shader resources to handle some computing tasks that are not related to rendering. In the embodiment of the present application, compute shaders are used to process a large amount of vertex data in parallel; fragment shaders are used to perform lighting calculations for diffuse reflection and / or specular reflection.
[0060] 6) Rendering pipeline, which is used to define the calculation methods and processes on the GPU, such as the geometry pipeline.
[0061] 7) Rasterization engine, used to implement rasterization; among them, rasterization is the process of converting vertex data into fragments, each element in the fragment can correspond to a pixel in the frame buffer, so rasterization is the process of converting geometric primitives into a two-dimensional image.
[0062] 8) Virtual scenes: scenes that are different from the real world and that are output by devices can form visual perception of virtual scenes with the naked eye or with the assistance of devices; for example, two-dimensional images output by display screens, three-dimensional images output by stereoscopic display technologies such as stereo projection, virtual reality, and augmented reality; in addition, various possible hardware can also be used to form various perceptions that simulate the real world, such as auditory perception, tactile perception, olfactory perception, and motion perception.
[0063] It should also be noted that the virtual scene displayed (or provided) when the application is running on the terminal device can be a simulation of the real world, a semi-simulation and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiments of this application do not limit the dimensions of the virtual scene. For example, the virtual scene can include the sky, land, ocean, etc., and the land can include environmental elements such as deserts, cities, and buildings. Virtual objects can move or perform other operations (such as attack operations) in the virtual scene under the control of the user or AI.
[0064] 9) Virtual objects: images of various people and objects that can interact in a virtual scene, or movable objects in a virtual scene. These movable objects can be virtual people, virtual animals, and cartoon characters, for example, people, animals, plants, oil drums, walls, stones, and buildings displayed in a virtual scene. These virtual objects can be a virtual image in the virtual scene that represents the user. A virtual scene can include multiple virtual objects, each of which has its own shape and volume and occupies a portion of the space in the virtual scene. In the embodiments of the present application, the virtual objects involved are, for example, virtual objects that interact with the liquid surface to be rendered.
[0065] Generally speaking, in order to achieve the rendering of ripples on the liquid surface, it is usually achieved by rendering Gerstner waves, see Figure 1 , Figure 1 is an exemplary waveform diagram of the Gerstner wave; Figure 1As shown in the figure, the rendering shows Gerstner waves 1-2 under the influence of wind direction 1-1. Since the rendering process of Gerstner waves occupies scalable computing resources, the rendering performance and real-time performance are good, so it is widely used. However, since the rendering of Gerstner waves is achieved by scheduling a large number of threads, it is usually rendered on the GPU. See Figure 2 , Figure 2 is a rendering diagram of an exemplary Gerstner wave; Figure 2 As shown, the water surface 2-2 is rendered by rendering Gerstner waves based on the parameters set in area 2-1.
[0066] However, when rendering ripples such as Gerstner waves, Fast Fourier Transform (FFT) waves, and wave-particle simulated waves through GPU rendering to achieve the rendering of the liquid surface, if the motion effects of virtual objects interacting with the liquid surface need to be rendered, the wave data on the GPU chip needs to be transferred to the memory via the GPU BUS for CPU processing. This is because the functional modules used to render the motion effects of virtual objects interacting with the liquid surface (such as the buoyancy settlement module, the physics engine, etc.) are implemented by the CPU; this is a read-back process, and the data read-back for each frame will result in millisecond-level (for example, 5 milliseconds) performance fluctuations; therefore, the stability of rendering the liquid surface and virtual objects interacting with the liquid surface through GPU rendering of ripples such as Gerstner waves is poor.
[0067] In addition, when the GPU is used to render ripples such as Gerstner waves to achieve the rendering of the liquid surface, the CPU is often in an idle state to wait for GPU processing, thus resulting in a waste of CPU resources.
[0068] Based on this, the embodiments of the present application provide a liquid surface-based rendering method, apparatus, device, computer-readable storage medium, and computer program product, which can improve rendering stability and resource utilization. The following describes an exemplary application of the liquid surface-based rendering device provided by the embodiments of the present application. The rendering device provided by the embodiments of the present application can be implemented as various types of terminals such as smart phones, smart watches, laptops, tablet computers, desktop computers, smart TVs, set-top boxes, smart car devices, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices, and smart speakers, and can also be implemented as a server. Below, an exemplary application of the rendering device when it is implemented as a terminal will be described.
[0069] See also Figure 3 , Figure 3 Schematic diagram of the liquid surface rendering system provided by the embodiment of the present application; Figure 3 As shown, to support a liquid surface-based rendering application, in a liquid surface-based rendering system 100, a terminal 400 (referred to as a rendering device, with terminal 400-1 and terminal 400-2 shown as examples) is connected to a server 200 via a network 300. The network 300 can be a wide area network or a local area network, or a combination of the two. The server 200 is used to provide computing services to the terminal 400. In addition, the liquid surface-based rendering system 100 also includes a database 500 for providing data support to the server 200; and Figure 3 , which shows a case where the database 500 is independent of the server 200. In addition, the database 500 may also be integrated into the server 200, which is not limited in the embodiment of the present application.
[0070] Terminal 400 is used to solve the vertex fluctuation data corresponding to each to-be-rendered vertex in the to-be-rendered liquid surface through a graphics processor, and obtain a vertex fluctuation data set corresponding to the to-be-rendered liquid surface; in the process of obtaining the vertex fluctuation data set through the graphics processor, the to-be-rendered liquid surface is divided into a plurality of to-be-rendered grids through the central processing unit, and the grid fluctuation data corresponding to each to-be-rendered grid is solved to obtain a grid fluctuation data set corresponding to the plurality of to-be-rendered grids; in a virtual scene, the to-be-rendered liquid surface is rendered by the graphics processor based on the vertex fluctuation data set, and the virtual object interacting with the to-be-rendered liquid surface is rendered by the central processing unit based on the grid fluctuation data set (see the water surface shown in terminal 400-1 and the box floating on the water surface, and see the sea surface and the ship floating on the sea surface shown in terminal 400-2).
[0071] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal 400 can be a smart phone, smart watch, laptop computer, tablet computer, desktop computer, smart TV, set-top box, smart car device, portable music player, personal digital assistant, dedicated messaging device, portable gaming device and smart speaker, etc., but is not limited to these. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0072] It should be noted that when the server 200 is a cloud game server, the server 200 can render the liquid surface to be rendered and the virtual objects that interact with the liquid surface to be rendered, and send the audio and video information representing the rendered liquid surface to be rendered and the virtual objects that interact with the liquid surface to be rendered to the terminal 400 for playback.
[0073] See also Figure 4 , Figure 4 This embodiment of the present application provides Figure 3 A schematic diagram of the composition structure of a terminal in FIG. Figure 4 The terminal 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 4 Various buses are labeled as bus system 440 .
[0074] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0075] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0076] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0077] Memory 450 includes volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. Nonvolatile memory may be read-only memory (ROM), and volatile memory may be random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0078] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0079] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;
[0080] A network communication module 452 for reaching other computer devices via one or more (wired or wireless) network interfaces 420 . Exemplary network interfaces 420 include Bluetooth, Wi-Fi, and Universal Serial Bus (USB).
[0081] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripheral devices and displaying content and information);
[0082] The input processing module 454 is configured to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.
[0083] In some embodiments, the liquid surface rendering device provided in the embodiments of the present application can be implemented in a software manner. Figure 4 A rendering device 455 stored in memory 450 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a first solving module 4551, a second solving module 4552, a data rendering module 4553, a shader rendering module 4554, and a parameter acquisition module 4555. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0084] In some embodiments, the rendering device provided in the embodiments of the present application can be implemented in hardware. As an example, the rendering device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the liquid surface-based rendering method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0085] In some embodiments, the terminal or server can implement the liquid surface-based rendering method provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a video playback APP or a game application APP (including a local game application APP and a cloud game application APP); it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.
[0086] Below, the liquid surface-based rendering method provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the rendering device provided in the embodiment of the present application; wherein, the liquid surface-based rendering method is executed by the liquid surface-based rendering device, and the rendering device includes a central processing unit and a graphics processing unit.
[0087] See also Figure 5 , Figure 5 This is a flow chart of the liquid surface rendering method provided by the embodiment of the present application, which will be combined with Figure 5 The steps shown are explained.
[0088] S501 : Calculate vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered by a graphics processor to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered.
[0089] In an embodiment of the present application, a rendering device renders a liquid surface and virtual objects interacting with the liquid surface through parallel processing by the CPU and GPU. During this parallel processing, the GPU calculates fine-grained fluctuation data corresponding to the liquid surface, referred to herein as a vertex fluctuation data set. This vertex fluctuation data set is used to render the ripples on the liquid surface.
[0090] Here, when rendering the liquid surface to be rendered and the virtual objects interacting with the liquid surface to be rendered, the rendering device calls the GPU so that the GPU solves the fluctuation data of the liquid surface to be rendered based on the vertex to be rendered; when the rendering device solves the fluctuation data corresponding to each vertex to be rendered (called vertex fluctuation data), the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered is combined to obtain a set of vertex fluctuation data corresponding to the liquid surface to be rendered.
[0091] It should be noted that the liquid surface to be rendered is a surface of a liquid to be rendered, such as the surface of a water body (the surface of the ocean, the surface of a lake), the surface of other solutions, and so on. The virtual objects that interact with the liquid surface to be rendered can be virtual objects carried by the liquid surface to be rendered, such as ships, floating people or objects, and so on. In addition, the liquid surface to be rendered is composed of a mesh, and the mesh is composed of polygons. The vertices of the polygons are the vertices to be rendered, and thus, the liquid surface to be rendered includes multiple vertices to be rendered. In addition, the vertex fluctuation data is the fluctuation data of the vertices to be rendered; the vertex fluctuation data set is the fine-grained (vertex granularity to be rendered) fluctuation data of the liquid surface to be rendered, and the vertex fluctuation data set is a set composed of multiple vertex fluctuation data corresponding one-to-one to multiple vertices to be rendered.
[0092] S502 , dividing the liquid surface to be rendered into a plurality of grids to be rendered by a central processing unit, and calculating grid fluctuation data corresponding to each grid to be rendered to obtain a grid fluctuation data set corresponding to the plurality of grids to be rendered.
[0093] In an embodiment of the present application, during the parallel processing of the CPU and GPU of the rendering device, the CPU is used to solve the coarse-grained fluctuation data corresponding to the liquid surface to be rendered, which is referred to here as a grid fluctuation data set; the grid fluctuation data set is used to determine the motion information of the virtual object interacting with the liquid to be rendered, and then render the virtual object interacting with the liquid surface to be rendered based on the motion information.
[0094] Here, when rendering the liquid surface to be rendered and the virtual objects interacting with the liquid surface to be rendered, the rendering device calls the GPU to enable the GPU to solve the fluctuation data of the liquid surface to be rendered in units of vertices to be rendered, and also calls the CPU to enable the CPU to divide the liquid surface to be rendered into multiple grids to be rendered, and then solve the fluctuation data of the liquid surface to be rendered in units of grids to be rendered; when the rendering device solves the fluctuation data corresponding to each grid to be rendered (called grid fluctuation data), the grid fluctuation data corresponding to each grid to be rendered in the liquid surface to be rendered is combined to obtain a set of grid fluctuation data corresponding to the liquid surface to be rendered.
[0095] It should be noted that the grid to be rendered is obtained by dividing the liquid surface to be rendered into regions of a specified size. The grid to be rendered is coarser than the vertex to be rendered; for example, the grid to be rendered includes at least two vertices to be rendered. Furthermore, the grid fluctuation data is the fluctuation data of the grid to be rendered. The grid fluctuation data set is the fluctuation data of the coarse-grained liquid surface to be rendered (the granularity of the grid to be rendered), and the grid fluctuation data set consists of multiple grid fluctuation data sets corresponding one-to-one to multiple grids to be rendered.
[0096] It should also be noted that S501 and S502 are executed in parallel. That is, S501 is executed during the execution of S502, that is, during the process of the CPU acquiring the raster fluctuation data set; S502 is executed during the execution of S501, that is, during the process of the GPU acquiring the vertex fluctuation data set.
[0097] S503 . In the virtual scene, the graphics processor renders the liquid surface to be rendered based on the vertex fluctuation data set, and the central processing unit renders a virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set.
[0098] In an embodiment of the present application, after the GPU of the rendering device obtains a vertex fluctuation data set for rendering ripples on the liquid surface to be rendered, the GPU renders the ripples on the liquid surface to be rendered based on the vertex fluctuation data set, thereby achieving the rendering of the liquid surface to be rendered in the virtual scene. Furthermore, after the CPU of the rendering device obtains a grid fluctuation data set for rendering the posture of a virtual object interacting with the liquid surface to be rendered, the CPU renders the posture of the virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set, thereby achieving the rendering of the virtual object interacting with the liquid surface to be rendered in the virtual scene.
[0099] It should be noted that the rendering of the liquid surface to be rendered is performed by the GPU, and the rendering of the virtual objects interacting with the liquid surface to be rendered is performed by the CPU.
[0100] It can be understood that while the GPU is calculating the wave data for the liquid surface to be rendered (called a vertex wave data set), the CPU is simultaneously performing a coarse-grained calculation of the wave data for the liquid surface to be rendered. Thus, while the GPU is rendering the liquid surface with high confidence, the CPU is able to render virtual objects that interact with the liquid surface based on the coarse-grained wave data calculated by the CPU (called a grid wave data set). Thus, since the rendering of the liquid surface to be rendered by the GPU is based on the data calculated by the GPU, the rendering of the virtual objects that interact with the liquid surface to be rendered by the CPU is based on the data calculated by the CPU. In other words, the CPU and GPU can achieve rendering based solely on the data they have calculated, thereby improving the stability of rendering performance. Furthermore, while the GPU is calculating the wave data used to render the ripples of the liquid surface to be rendered, the CPU is calculating the wave data used to render the posture of the virtual objects that interact with the liquid surface to be rendered. This enables parallel rendering of the liquid surface to be rendered and the virtual objects that interact with the liquid surface to be rendered, thereby improving resource utilization.
[0101] See also Figure 6 , Figure 6 This is a flow chart of obtaining a grid fluctuation data set provided by an embodiment of the present application; Figure 6 As shown, in an embodiment of the present application, the CPU in the rendering device in S502 solves the grid fluctuation data corresponding to each grid to be rendered, and obtains a set of grid fluctuation data corresponding to multiple grids to be rendered, including S5021 to S5023. Each step is explained below.
[0102] S5021: Create a first fluctuation data solving task for each grid to be rendered, and obtain multiple first fluctuation data solving tasks corresponding to the multiple grids to be rendered.
[0103] In the embodiment of the present application, the CPU can solve the grid fluctuation data corresponding to each grid to be rendered discretely or in parallel. Here, when the CPU is multi-core, hyperthreading can be implemented. In this case, the CPU can obtain the grid fluctuation data set through parallel processing.
[0104] It should be noted that the CPU creates a task for calculating the corresponding grid fluctuation data for each grid to be rendered, thus creating a first fluctuation data calculation task. Consequently, for multiple grids to be rendered, multiple first fluctuation data calculation tasks are created. The first fluctuation data calculation task is used to calculate the grid fluctuation data corresponding to each grid to be rendered, and multiple grids to be rendered correspond to multiple first fluctuation data calculation tasks.
[0105] S5022. Divide the plurality of first fluctuation data solving tasks into at least one fluctuation data solving thread.
[0106] In an embodiment of the present application, the CPU assigns the constructed multiple first fluctuation data solving tasks to at least one thread (referred to as at least one fluctuation data solving thread). Here, one thread corresponds to one task queue, and a fluctuation data solving thread is one thread, and the fluctuation data solving thread corresponds to a task queue consisting of at least one first fluctuation data solving task among the multiple first fluctuation data solving tasks. The number of first fluctuation data solving tasks in the multiple first fluctuation data solving tasks is greater than or equal to the number of fluctuation data solving threads in the at least one fluctuation data solving thread.
[0107] S5023. Execute at least one fluctuation data solution thread to obtain a grid fluctuation data set.
[0108] In an embodiment of the present application, the CPU can execute at least one fluctuation data solution thread in parallel, or can execute at least one fluctuation data solution thread in serial, or can be a combination of parallel and serial, etc., which is not limited in the embodiment of the present application.
[0109] It should be noted that the process of the CPU executing at least one fluctuation data solution thread is the process of executing each first fluctuation data solution task to solve the grid fluctuation data corresponding to each grid to be rendered; therefore, when the CPU completes the execution of at least one fluctuation data solution thread, the grid fluctuation data corresponding to each grid to be rendered in the liquid surface to be rendered is obtained, thereby obtaining a grid fluctuation data set composed of the grid fluctuation data corresponding to each grid to be rendered in the liquid surface to be rendered.
[0110] It can be understood that by utilizing the multi-core and hyperthreading processing of the CPU, the process of solving the coarse-grained fluctuation data of the liquid surface to be rendered on the CPU is realized, thereby improving the stability and resource utilization of the liquid surface-based rendering.
[0111] In an embodiment of the present application, the GPU of the rendering device in S501 solves the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered, and obtains a set of vertex fluctuation data corresponding to the liquid surface to be rendered, including S5011 and S5012 (not shown in the figure). Each step is explained below.
[0112] S5011. Traverse the set of vertices to be rendered corresponding to the liquid surface to be rendered.
[0113] It should be noted that the multiple vertices to be rendered included in the liquid surface to be rendered are the vertex set to be rendered. Here, the GPU traverses the multiple vertices to be rendered in the vertex set to be rendered to calculate the vertex fluctuation data of the vertices to be rendered one by one.
[0114] S5012: Calculate the vertex fluctuation data corresponding to each traversed vertex to be rendered, and obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered.
[0115] It should be noted that the GPU solves the fluctuation data for each vertex to be rendered that is traversed, and thus solves the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered. Therefore, by combining the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered, a vertex fluctuation data set is obtained.
[0116] In the embodiment of the present application, S5011 and S5012 can be implemented through the geometry pipeline in the GPU (ie, a fragment shader or a vertex shader).
[0117] In an embodiment of the present application, the GPU of the rendering device in S501 solves the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered, and obtains a set of vertex fluctuation data corresponding to the liquid surface to be rendered, including S5013 and S5015 (not shown in the figure). Each step is explained below.
[0118] S5013 : Based on the specified number of vertices to be rendered, divide the set of vertices to be rendered corresponding to the liquid surface to be rendered to obtain multiple meshes to be rendered.
[0119] In an embodiment of the present application, the GPU can divide the liquid surface to be rendered into multiple grids to be rendered, where each grid to be rendered includes a specified number of vertices to be rendered. The difference between the grids to be rendered and the grids to be rendered is that the grids to be rendered are divided based on the number of vertices to be rendered, while the grids to be rendered are divided based on the area; and the specified number is the number of threads in the thread warp, such as 32*32, 64*64, etc.
[0120] S5014. Create a second fluctuation data solving task for each vertex to be rendered in each mesh to be rendered, obtain a second fluctuation data solving task group corresponding to the mesh to be rendered, and thereby obtain multiple second fluctuation data solving task groups corresponding to multiple meshes to be rendered.
[0121] In an embodiment of the present application, the GPU creates a task for solving the corresponding vertex fluctuation data for each vertex to be rendered, thereby creating a second fluctuation data solving task; thus, for a specified number of vertices to be rendered included in a mesh to be rendered, a specified number of second fluctuation data solving tasks are created; here, the specified number of second fluctuation data solving tasks are grouped into a second fluctuation data solving task group. Thus, for multiple meshes to be rendered, multiple second fluctuation data solving task groups are created. The second fluctuation data solving task is used to solve the vertex fluctuation data corresponding to each vertex to be rendered, and multiple meshes to be rendered correspond one-to-one to multiple second fluctuation data solving task groups.
[0122] S5015. Execute multiple second fluctuation data solving task groups to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered.
[0123] In the embodiment of the present application, the GPU can execute multiple second fluctuation data resolution task groups in parallel, in series, or in a combination of parallel and series execution, etc., which is not limited in the embodiment of the present application. Here, the GPU can associate each second fluctuation data resolution task group with a thread warp, and execute each second fluctuation data resolution task group by executing a thread warp.
[0124] It should be noted that the process of the GPU executing multiple second fluctuation data solving task groups is the process of executing each second fluctuation data solving task to solve the vertex fluctuation data corresponding to each vertex to be rendered; thus, when the GPU completes the execution of multiple second fluctuation data solving task groups, the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered is obtained, thereby obtaining a vertex fluctuation data set composed of the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered.
[0125] In the embodiment of the present application, S5013 and S5015 can be implemented by a compute shader in a GPU. In addition, when the GPU of the rendering device cannot obtain the vertex fluctuation data set through S5013 and S5015, it can obtain the vertex fluctuation data set through S5011 and S5012.
[0126] It can be understood that by utilizing the GPU's thread bundle processing, the thread bundle is mapped to a certain scale (a specified number of vertices to be rendered) of the to-be-rendered mesh, batch calculation is achieved, and then lightweight thread scheduling is achieved, which can improve the efficiency of solving the fine-grained fluctuation data of the liquid surface to be rendered.
[0127] In the embodiment of the present application, S501 also includes S504 (not shown in the figure); that is, after the GPU in the rendering device solves the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered, and obtains the vertex fluctuation data set corresponding to the liquid surface to be rendered, the liquid surface-based rendering method also includes S504, which is explained below.
[0128] S504 : Determine, through a graphics processor, shading rendering data corresponding to the vertex fluctuation data set.
[0129] It should be noted that, in addition to rendering the ripples on the liquid surface to be rendered, the rendering device also renders the shading effect of the liquid surface to be rendered. Therefore, the rendering device's GPU is also used to determine the shading rendering data corresponding to the vertex ripple data set, where the shading rendering data is used to render the shading effect of the liquid surface to be rendered.
[0130] Accordingly, in this embodiment of the present application, the GPU rendering the liquid surface to be rendered based on the vertex fluctuation data set in S503 includes the following: the GPU combines the shading rendering data and the vertex fluctuation data set to render the liquid surface to be rendered. In other words, the GPU renders the shading effect of the liquid surface to be rendered based on the shading rendering data, and renders the ripples of the liquid surface to be rendered based on the vertex fluctuation data set, thereby completing the rendering of the liquid surface to be rendered.
[0131] It can be understood that the GPU renders the color of the liquid ripples with high confidence by rendering the process of light propagation in the liquid; and because the rendering of the ripples on the liquid surface to be rendered and the rendering of the posture of the virtual objects interacting with the liquid surface to be rendered are achieved through parallel processing of the GPU and CPU, high-confidence rendering based on the liquid surface to be rendered can be achieved while maintaining stable performance.
[0132] In the embodiment of the present application, S505 to S507 (not shown in the figure) are also included before S504; that is, before the rendering device determines the shading rendering data corresponding to the vertex fluctuation data set through the graphics processor, the liquid surface-based rendering method also includes S505 to S507, and each step is explained below.
[0133] S505: The CPU collects lighting environment data.
[0134] It should be noted that the rendering module collects shading-related data through the CPU, thereby also collecting lighting environment data. Here, lighting environment data includes at least one of scene environment data, lighting intensity, lighting color, lighting angle, and lighting behavior data. Scene environment data can include, for example, sky environment data or indoor environment data of a virtual scene; lighting behavior data can include, for example, the state of virtual objects in the virtual scene.
[0135] S506: The CPU converts the lighting environment data into light rendering parameters.
[0136] It should be noted that the CPU pre-processes and pre-calculates the collected lighting environment data to convert the lighting environment data into data for implementing lighting rendering, thereby obtaining light rendering parameters.
[0137] S507 : The CPU sends the light rendering parameters to the graphics processor.
[0138] In the embodiment of the present application, the CPU uploads the converted light rendering parameters to the GPU through the parameter uploader, thereby completing the process of sending the light rendering parameters to the GPU.
[0139] Accordingly, in the embodiment of the present application, the GPU determining the shading rendering data corresponding to the vertex fluctuation data set in S504 includes: the GPU determining the shading rendering data corresponding to the vertex fluctuation data set based on the light rendering parameters. That is, when the CPU sends the light rendering parameters to the GPU, the GPU also receives the light rendering parameters. The GPU then determines, based on the received light rendering parameters, data used to render the shading of the liquid surface to be rendered, thereby obtaining the shading rendering data.
[0140] In an embodiment of the present application, S504 can be implemented through S5041 and S5042 (not shown in the figure); that is, the GPU determines the shading rendering data corresponding to the vertex fluctuation data set, including S5041 and S5042, and each step is explained below.
[0141] S5041. Traverse the vertex fluctuation data set.
[0142] In an embodiment of the present application, the GPU traverses the solved vertex fluctuation data set in units of vertex fluctuation data corresponding to the vertex to be rendered.
[0143] S5042: Perform illumination processing on each traversed vertex fluctuation data to obtain shading rendering data corresponding to the vertex fluctuation data set.
[0144] In an embodiment of the present application, when the GPU performs lighting processing on each vertex fluctuation data traversed, it can be implemented based on the light rendering parameters received from the CPU; here, after the GPU completes lighting processing on each vertex fluctuation data in the vertex fluctuation data set, it also obtains the shading rendering data corresponding to the vertex fluctuation data set. Here, the lighting processing includes at least one of subsurface scattering processing, subsurface scattering processing, and surface reflection processing; wherein, subsurface light scattering processing refers to light scattering processing under the surface of the liquid to be rendered, and reflection processing refers to light reflection processing on the surface of the liquid to be rendered.
[0145] It can be understood that the rendering device performs illumination processing on the vertex fluctuation data of each vertex to be rendered through at least one of subsurface scattering processing, subsurface scattering processing and surface reflection processing, thereby realizing the ripple color of the surface of the liquid to be rendered from the perspective of energy conservation and geometric optics, improving the realism of the liquid surface to be rendered, and thus improving the rendering effect of the liquid surface to be rendered.
[0146] In the embodiment of the present application, S508 to S510 (not shown in the figure) are also included before S501; that is, before the GPU of the rendering device solves the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered, the rendering method of the liquid surface also includes S508 to S510, and each step is explained below.
[0147] S508. The CPU obtains the fluctuation environment data.
[0148] It should be noted that the fluctuation environment data refers to data that affects the ripples on the liquid surface to be rendered, including at least one of wind direction, wind force, wave height, wavelength and fluctuation behavior data; among which, the fluctuation behavior data is the behavior of the virtual object in the virtual scene associated with the fluctuation of the liquid surface to be rendered.
[0149] S509 : The CPU converts the fluctuation environment data into fluctuation environment parameters.
[0150] It should be noted that the CPU pre-processes and pre-calculates the collected wave environment data to convert the wave environment data into data for implementing ripple rendering, thereby obtaining the wave environment parameters.
[0151] S510: The CPU sends the fluctuation environment parameters to the graphics processor.
[0152] In the embodiment of the present application, the CPU uploads the converted fluctuation environment parameters to the GPU through the parameter uploader, thus completing the process of sending the fluctuation environment parameters to the GPU. Here, when the CPU sends the fluctuation environment parameters to the GPU, the GPU also receives the fluctuation environment parameters.
[0153] In this embodiment of the present application, in response to a rendering request for the i-th frame of a water surface to be rendered in a virtual scene, the CPU executes steps S508 to S510, where i is a monotonically increasing positive integer variable. In other words, the liquid surface-based rendering method provided in this embodiment of the present application renders the liquid surface to be rendered, as well as virtual objects interacting with the liquid surface, frame by frame, and can feed back rendering parameters obtained in real time into the rendering result.
[0154] Accordingly, in the embodiment of the present application, the GPU of the rendering device calculates vertex fluctuation data corresponding to each to-be-rendered vertex in the to-be-rendered liquid surface in S501, including: the GPU calculating the vertex fluctuation data corresponding to each to-be-rendered vertex in the to-be-rendered liquid surface based on the fluctuation environment parameters. Furthermore, the CPU of the rendering device calculates grid fluctuation data corresponding to each to-be-rendered grid in S502, including: the CPU calculating the grid fluctuation data corresponding to each to-be-rendered grid based on the fluctuation environment parameters.
[0155] It can be understood that during the rendering process of the liquid surface to be rendered and the virtual objects interacting with the liquid surface to be rendered, the CPU responds to the rendering request of each frame in real time, renders the liquid surface to be rendered in the virtual scene, and the virtual objects interacting with the liquid surface to be rendered, thereby achieving low latency and high performance rendering effects.
[0156] In the embodiment of the present application, the CPU of the rendering device in S502 divides the liquid surface to be rendered into multiple grids to be rendered, including S5024 and S5025 (not shown in the figure). Each step is described below.
[0157] S5024. Determine the grid division unit based on the thread processing scale and the liquid surface to be rendered.
[0158] It should be noted that the thread processing scale is the maximum number of threads processed by the central processing unit, and the grid division unit is negatively correlated with the field processing scale and positively correlated with the scale of the liquid surface to be rendered; here, the grid division unit determined by the CPU is the scale of each grid to be rendered.
[0159] S5025. Divide the liquid surface to be rendered into a plurality of grids to be rendered based on the grid division unit.
[0160] It should be noted that the number of grids to be rendered in the plurality of grids to be rendered divided by the CPU is positively correlated with the thread processing scale.
[0161] It can be understood that the CPU in the rendering device can maximize the use of CPU processing resources by determining the grid division units used to divide the liquid surface to be rendered based on its own thread processing scale, improve the efficiency of obtaining grid fluctuation data sets, and thus improve rendering efficiency.
[0162] In an embodiment of the present application, the CPU of the rendering device in S503 renders a virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set, including S5031 to S5034 (not shown in the figure), and each step is described below.
[0163] S5031. Determine buoyancy parameters based on the grid fluctuation data set.
[0164] It should be noted that the buoyancy parameters determined by the CPU include parameters such as displacement, etc., which are used to determine the buoyancy of the liquid surface to be rendered.
[0165] S5032: Determine buoyancy information corresponding to the liquid surface to be rendered based on the buoyancy parameters.
[0166] S5033: The physical engine determines motion information of a virtual object interacting with the liquid surface to be rendered based on the buoyancy information.
[0167] S5034: Render a virtual object based on the motion information.
[0168] In this embodiment of the present application, the CPU uses its own calculated coarse-grained grid wave data set to determine the forces (e.g., buoyancy information) interacting with the rendered liquid surface and other virtual objects. Based on these forces, the CPU then renders the state or posture of the virtual objects interacting with the rendered liquid surface. The physics engine is invoked by the central processing unit.
[0169] The following describes an exemplary application of an embodiment of the present application in a practical application scenario. This exemplary application describes a method for rendering a water surface (referred to as the liquid surface to be rendered) in the field of water body rendering. For example, this method involves rendering a water surface using a three-dimensional (3D) rendering module within a gaming application running on a client or cloud server.
[0170] It's important to note that water surface rendering includes both ripple simulation and ripple illumination shading. Ripple simulation simulates the ripples that appear on the water surface due to fluid dynamics effects caused by environmental forces such as wind direction, wind force, wave height, and wavelength. The CPU and GPU simultaneously calculate the corresponding water surface fluctuation data for these ripples. As a complex medium, water exhibits unique optical shading properties. Ripple illumination shading simulates the propagation of light through water to render the color of water ripples with high confidence.
[0171] See also Figure 7 , Figure 7 This is an exemplary liquid surface rendering flow chart provided in an embodiment of the present application; Figure 7As shown, first, environmental parameters 7-3 are collected from the state of the virtual object (corresponding to the virtual object's behavior in the virtual environment 7-2, such as the movement of a virtual ship) 7-1 and the virtual environment 7-2. Then, based on environmental parameters 7-3, the water wave simulation module 7-41 and the shading simulation module 7-42 in the water surface rendering system 7-4 jointly render the water surface 7-5. The water surface rendering system 7-4 is the functional module that implements the water surface rendering. The water wave simulation module 7-41 is used to simulate the ripples on the water surface by simulating the fluctuations of the water surface, and the shading simulation module 7-42 is used to simulate the shading effect of the ripples under the lighting environment to achieve ripple lighting shading. Furthermore, in addition to being affected by environmental forces such as wind direction, wind force, wave height, and wavelength, the behavior of the virtual object in the virtual environment can also affect the water ripple simulation. This is because the virtual object's behavior in the virtual environment changes the environmental forces, which in turn affects the rendering of the water surface. Therefore, the virtual object's behavior in the virtual environment can affect the water surface simulation.
[0172] In the embodiments of this application, Figure 7 The water wave simulation module 7-41 in includes submodules running on the GPU and submodules running on the CPU. Figure 8 , Figure 8 : is a functional implementation diagram of an exemplary water wave simulation module provided in an embodiment of the present application; Figure 8 As shown, submodule 8-1 running on the CPU within water wave simulation module 7-41 is used, on the one hand, to implement grid division of the water surface area, obtaining grid division results 8-11 (referred to as multiple grids to be rendered); and on the other hand, to solve wave data at the grid level, obtaining coarse-grained wave calculation results 8-12 (referred to as a grid wave data set). Submodule 8-2 running on the GPU within water wave simulation module 7-41 is used, on the one hand, to read water surface vertices 8-21 (referred to as a set of vertices to be rendered); and on the other hand, to traverse water surface vertices 8-21, solving wave data for each vertex (referred to as a set of vertices to be rendered), obtaining fine-grained wave calculation results 8-22 (referred to as a set of vertex wave data sets). Here, the coarse-grained fluctuation settlement result 8-21 is used to calculate parameters such as displacement (called buoyancy parameters) through the buoyancy module 8-3 running on the CPU to obtain buoyancy 8-4 (called buoyancy information). Then, the physics engine 8-5 running on the CPU determines the motion information 8-6 of the virtual object interacting with the water surface based on the buoyancy 8-4; the fine-grained fluctuation solution result 8-22 is used to render the water body fluctuation effect through the water surface rendering module of the GPU, that is, to render the water surface ripples 8-7.
[0173] It is understandable that Figure 7The Water Wave Simulation Module 7-41 ensures the accuracy of wave geometry in water surface rendering and parameters such as displacement during physical calculations. This module enables realistic simulation of water surface ripples based on parameters such as wind direction, force, wave height, and wavelength. These ripples are then accurately reflected in the physical forces and motion of rendered animations and interactive objects (virtual objects interacting with the rendered liquid surface).
[0174] Below Figure 8 The implementation process of submodule 8-1 running on the CPU is described in detail. Figure 9 , Figure 9 This is a schematic diagram of an exemplary implementation flow of a submodule running on a CPU provided in an embodiment of the present application; Figure 9 As shown, the exemplary implementation process of the submodule running on the CPU includes S901 to S907, and each step is described below.
[0175] S901. The terminal (referred to as a liquid surface-based rendering device) starts a water surface rendering system.
[0176] At the beginning, the water surface rendering system 7-4 is started to start the process of rendering the water surface.
[0177] S902: The CPU determines whether the frame iteration of the water surface rendering is completed. If so, the CPU executes S907. If not, the CPU executes S903.
[0178] It should be noted that the writing and the virtual objects interacting with the water surface are rendered frame by frame.
[0179] S903: The CPU divides the water surface into grids.
[0180] Here, grid division is a voxelization process.
[0181] S904: The CPU creates a Gerstner wave solving task (called the first wave data solving task) for each grid.
[0182] S905 , the CPU divides the multiple end tasks corresponding to the multiple grids into different solution threads for execution, to obtain coarse-grained wave solution data.
[0183] S906: The CPU sends the coarse-grained wave solution data to the buoyancy module. Execute S902.
[0184] It should be noted that the buoyancy module is a module running on the CPU that calculates buoyancy. Here, the buoyancy module calculates buoyancy based on coarse-grained wave solution data and sends the buoyancy to the physics engine, which then determines the motion data of virtual objects on the water surface based on the buoyancy. The physics engine is also a module running on the CPU that determines the motion information of interactive objects.
[0185] S907: The terminal shuts down the water surface rendering system and ends the water surface rendering process.
[0186] Below Figure 8 The implementation process of submodule 8-2 running on GPU is described in the following. Figure 10 , Figure 10 This is a schematic diagram of an exemplary implementation flow of a submodule running on a GPU provided in an embodiment of the present application; Figure 10 As shown, the exemplary implementation process of the submodule running on the GPU includes S901, S902 and S907, and S1001 to S1008. Each step is described below.
[0187] S1001. The GPU receives the fluctuating environment parameters (including environmental forces and behaviors of virtual objects in the virtual environment) uploaded by the CPU.
[0188] Here, when the result of the determination in S902 is NO, S1001 is executed.
[0189] S1002: The GPU determines whether the compute shader is available. If yes, the process proceeds to S1003. If not, the process proceeds to S1006.
[0190] S1003. The GPU reads the mesh of the water surface (referred to as the mesh to be rendered) through a calculation shader.
[0191] S1004: The GPU fixes the thread bundle on the grid.
[0192] S1005: The GPU batch-solves the fluctuation data of each vertex on a mesh of a certain size (referred to as a specified number of vertices to be rendered) through the thread bundles, and then executes S1008.
[0193] S1006. The GPU traverses each vertex through the geometry pipeline.
[0194] S1007. The GPU calculates the fluctuation data of each vertex.
[0195] S1008: The GPU submits the wave data corresponding to all vertices to the water surface rendering module through the geometry pipeline to render the water surface ripples. Execute S902. The water surface rendering module is the module in the water wave simulation module 7-41 that runs on the GPU.
[0196] It should be noted that S903 to S906 and S1001 to S1008 are processed in parallel.
[0197] In the embodiments of this application, Figure 7 The shading simulation module 7-42 in the example includes a GPU function module (such as a GPU program), a parameter uploader, and a parameter collector; wherein the GPU function module runs on the GPU, and the parameter uploader and parameter collector run on the CPU. Figure 11 , Figure 11 Schematic diagram of an exemplary coloring simulation module for realizing water coloring provided in an embodiment of the present application; Figure 11 As shown, parameter collector 11-1 in shading simulation module 7-42 is used to collect shading data 11-2 (referred to as lighting environment data) for rendering and simulation through a user-facing interface. Parameter uploader 11-3 in shading simulation module 7-42 is used to preprocess and precalculate the collected shading data 11-2 to obtain shading parameters 11-4 (referred to as light rendering parameters), and also to upload shading parameters 11-4 to shading rendering module 11-5 in shading simulation module 7-42. Shading rendering module 11-5 in shading simulation module 7-42 runs on the GPU and is used to perform lighting processing (including underwater scattering processing, water subsurface scattering processing, and water surface reflection processing) on fine-grained wave solution data read from the geometry pipeline based on shading parameters 11-4, to obtain shading rendering data 11-6. It is also used to render the color of water surface ripples 11-7 based on the shading rendering data.
[0198] Below Figure 11 The implementation process of the shader rendering module 11-5 running on the GPU is described in detail. Figure 12 , Figure 12 This is a schematic diagram of an exemplary implementation flow of a shading rendering module provided in an embodiment of the present application; Figure 12 As shown, the exemplary implementation process of the shading rendering module running on the GPU includes S901, S902 and S907, and S1201 to S1205. Each step is described below.
[0199] S1201. Read the shading parameters uploaded by the CPU.
[0200] Here, when the result of the determination in S902 is NO, S1201 is executed.
[0201] S1202: Perform water surface reflection processing based on shading parameters and fine-grained wave solution data.
[0202] S1203: Perform water surface scattering processing on the water surface reflection processing result.
[0203] S1204: Perform subsurface scattering processing on the water surface scattering processing result.
[0204] S1205: Rendering water surface ripples based on the subsurface scattering processing result.
[0205] It should be noted that performance-intensive parts such as rendering are processed using the rasterization engine and geometry pipeline on the GPU, while the user-facing part actively collects environmental data and then uploads it to the GPU via the parameter uploader for reading and access by the shader program.
[0206] Below through Figures 13 to 16 right Figure 7 The water wave simulation module 7-41 in the water wave simulation module 7-41 is used to illustrate the water wave. Figure 13 , Figure 13 is a schematic diagram of an exemplary simulation of water fluctuations provided in an embodiment of the present application; Figure 13 As shown, the water surface 13-1 is the rendering result when the wind direction 13-21 is forward (-6), the wind force 13-22 is level 1, and the water surface wave intensity coefficient 13-23 is 0.238. Figure 7 Environmental parameters in 7-3.
[0207] See also Figure 14 , Figure 14 is another exemplary simulation diagram of water body fluctuations provided in the embodiment of the present application; Figure 14 As shown, the water surface 14-1 is the rendering result when the wind direction 14-21 is to the right (80), the wind force 14-22 is level 5, and the water surface wave intensity coefficient 14-23 is 0.456.
[0208] It should be noted that Figure 13 and Figure 14 It is the manifestation of water fluctuation driven by environmental parameters, that is, different fluctuation manifestations can be generated according to the wind force, wind direction and water surface fluctuation intensity coefficient in the virtual environment.
[0209] See also Figure 15 , Figure 15 This is another exemplary schematic diagram of water body fluctuation simulation provided by the embodiment of the present application; Figure 15 As shown, the water surface 15-1 is a simulated shore wave when the wind conditions change.
[0210] It is understandable that through Figure 7 The water wave simulation module 7-41 in the game can respond to rapid changes in the environment and generate various water surface ripples.
[0211] See also Figure 16 , Figure 16is a schematic diagram of an exemplary interaction between water waves and virtual objects provided in an embodiment of the present application; Figure 16 As shown, a ship 16-2 is shown on the water surface 16-1, which is tilted by a side wave.
[0212] It can be understood that the water surface rendering method based on parallel solution of wave data by GPU and CPU provided in the embodiment of the present application can achieve low-latency physical simulation and can respond to the physical engine in real time, producing a very low-latency and realistic buoyancy effect.
[0213] Below through Figures 17 and 18 right Figure 7 The shading effect of water body fluctuations under lighting environment achieved by the shading simulation module 7-42 is explained.
[0214] See also Figure 17 , Figure 17 : is a schematic diagram of an exemplary water surface lighting rendering effect provided in an embodiment of the present application; Figure 17 As shown, the water surface 17-1 is the result of illumination and coloring simulation under a clear midday environment.
[0215] See also Figure 18 , Figure 18 is another exemplary schematic diagram of water surface lighting rendering effect provided by an embodiment of the present application; Figure 18 As shown, the water surface 18-1 is the result of illumination shading simulation in a stormy dusk environment.
[0216] It can be understood that the shading simulation module provided by the embodiment of the present application can render rendering effects under various lighting environments based on changes in the scene sky environment, main light intensity, color, angle and user settings.
[0217] It is also understood that the method for simulating water surface ripples and ripple colors provided in the embodiments of this application can combine geometric and optical properties to render a highly confident water surface, improving the rendering effect of the water surface. In addition, by performing wave data calculations in parallel on the CPU and GPU, it is possible to quickly obtain the posture used to determine virtual objects interacting with the water surface, thereby improving the rendering efficiency of virtual objects interacting with the water surface.
[0218] The following continues to describe the exemplary structure of the liquid surface rendering device 455 provided in the embodiment of the present application as a software module. In some embodiments, such as Figure 4 As shown, the software modules stored in the rendering device 455 of the memory 450 may include:
[0219] The first solving module 4551 is used to solve the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered by the graphics processor to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered;
[0220] A second solving module 4552 is configured to, during the process of obtaining the vertex fluctuation data set via the graphics processor, divide the liquid surface to be rendered into a plurality of grids to be rendered via the central processing unit, and solve the grid fluctuation data corresponding to each grid to be rendered to obtain grid fluctuation data sets corresponding to the plurality of grids to be rendered;
[0221] The data rendering module 4553 is used to render the liquid surface to be rendered in the virtual scene by the graphics processor based on the vertex fluctuation data set, and to render the virtual object interacting with the liquid surface to be rendered by the central processing unit based on the grid fluctuation data set.
[0222] In an embodiment of the present application, the second solving module 4552 is also used to create a first fluctuation data solving task for each grid to be rendered, and obtain multiple first fluctuation data solving tasks corresponding to multiple grids to be rendered, wherein the first fluctuation data solving task is used to solve the grid fluctuation data corresponding to each grid to be rendered; divide the multiple first fluctuation data solving tasks into at least one fluctuation data solving thread; execute at least one fluctuation data solving thread to obtain the grid fluctuation data set.
[0223] In an embodiment of the present application, the first solving module 4551 is further used to traverse the set of vertices to be rendered corresponding to the liquid surface to be rendered; solve the vertex fluctuation data corresponding to each traversed vertex to be rendered, and obtain the vertex fluctuation data set corresponding to the liquid surface to be rendered.
[0224] In an embodiment of the present application, the first solving module 4551 is further used to divide the set of vertices to be rendered corresponding to the liquid surface to be rendered based on a specified number of vertices to be rendered to obtain multiple meshes to be rendered; create a second fluctuation data solving task for each vertex to be rendered in each mesh to be rendered to obtain a second fluctuation data solving task group corresponding to the mesh to be rendered, thereby obtaining multiple second fluctuation data solving task groups corresponding to multiple meshes to be rendered, wherein the second fluctuation data solving task is used to solve the vertex fluctuation data corresponding to each vertex to be rendered; execute multiple second fluctuation data solving task groups to obtain the vertex fluctuation data set corresponding to the liquid surface to be rendered.
[0225] In the embodiment of the present application, the rendering device 455 further includes a shading rendering module 4554 for determining, through the graphics processor, shading rendering data corresponding to the vertex fluctuation data set.
[0226] In the embodiment of the present application, the data rendering module 4553 is further configured to combine the shading rendering data and the vertex fluctuation data set to render the liquid surface to be rendered.
[0227] In an embodiment of the present application, the shading rendering module 4554 is also used to perform the following processing through the central processing unit: collecting lighting environment data, wherein the lighting environment data includes at least one of scene environment data, lighting intensity, lighting color, lighting angle and lighting behavior data; converting the lighting environment data into light rendering parameters; and sending the light rendering parameters to the graphics processor.
[0228] In the embodiment of the present application, the shading rendering module 4554 is further used to determine the shading rendering data corresponding to the vertex fluctuation data set based on the light rendering parameters.
[0229] In an embodiment of the present application, the shading rendering module 4554 is also used to traverse the vertex fluctuation data set; perform lighting processing on each traversed vertex fluctuation data to obtain the shading rendering data corresponding to the vertex fluctuation data set, wherein the lighting processing includes at least one of subsurface scattering processing, subsurface scattering processing and surface reflection processing.
[0230] In an embodiment of the present application, the rendering device 455 also includes a parameter acquisition module 4555, which is used to respond to the i-th frame rendering request of the water surface to be rendered in the virtual scene, and perform the following processing through the central processing unit, where i is a monotonically increasing positive integer variable: obtaining fluctuation environment data, where the fluctuation environment data includes at least one of wind direction, wind force, wave height, wavelength and fluctuation behavior data; converting the fluctuation environment data into fluctuation environment parameters; and sending the fluctuation environment parameters to the graphics processor.
[0231] In the embodiment of the present application, the first solving module 4551 is further used to solve the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered based on the fluctuation environment parameters.
[0232] In the embodiment of the present application, the second solving module 4552 is further used to solve the grid fluctuation data corresponding to each grid to be rendered based on the fluctuation environment parameters.
[0233] In an embodiment of the present application, the second solving module 4552 is further used to determine the grid division unit based on the thread processing scale and the liquid surface to be rendered, wherein the thread processing scale is the maximum number of threads processed by the central processing unit; based on the grid division unit, the liquid surface to be rendered is divided into multiple grids to be rendered.
[0234] In an embodiment of the present application, the data rendering module 4553 is also used to determine the buoyancy parameters based on the grid fluctuation data set; determine the buoyancy information corresponding to the liquid surface to be rendered based on the buoyancy parameters; determine the motion information of the virtual object interacting with the liquid surface to be rendered based on the buoyancy information by the physical engine, wherein the physical engine is called by the central processing unit; and render the virtual object based on the motion information.
[0235] The present embodiment provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device (referred to as a rendering device) reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the liquid surface-based rendering method described in the embodiment of the present application.
[0236] The embodiment of the present application provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the liquid surface rendering method provided in the embodiment of the present application, for example Figure 5 A liquid surface-based rendering method is shown.
[0237] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or various devices including one or any combination of the above memories.
[0238] In some embodiments, executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0239] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0240] As an example, executable instructions may be deployed to be executed on one computer device (in which case, the one computer device is the rendering device), or on multiple computer devices located at one site (in which case, the multiple computer devices located at one site are the rendering devices), or on multiple computer devices distributed at multiple sites and interconnected by a communication network (in which case, the multiple computer devices distributed at multiple sites and interconnected by a communication network are the rendering devices).
[0241] In summary, in the embodiment of the present application, while the GPU is solving the wave data (referred to as the vertex wave data set) of the liquid surface to be rendered, the CPU is simultaneously performing a coarse-grained solution of the wave data of the liquid surface to be rendered. Thus, while the GPU is performing high-confidence rendering of the liquid surface to be rendered, the CPU is able to render virtual objects that interact with the liquid surface to be rendered based on the coarse-grained wave data (referred to as the grid wave data set) solved by the CPU. Thus, since the rendering of the liquid surface to be rendered by the GPU is based on the data solved by the GPU, the rendering of the virtual objects that interact with the liquid surface to be rendered by the CPU is based on the data solved by the CPU. In other words, the CPU and GPU can achieve rendering based only on the data they solve, thereby improving the stability of rendering performance. In addition, while the GPU is solving the wave data used to render the ripples of the liquid surface to be rendered, the CPU is solving the wave data used to render the posture of the virtual objects that interact with the liquid surface to be rendered, thereby achieving parallel rendering of the liquid surface to be rendered and the virtual objects that interact with the liquid surface to be rendered, thereby improving resource utilization.
[0242] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A liquid surface-based rendering method, characterized in that: The method comprises: Calculating vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered by a graphics processor to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered; In the process of acquiring the vertex fluctuation data set by the graphics processor, determining, by the central processing unit, a grid division unit based on a thread processing scale and the liquid surface to be rendered, wherein the thread processing scale is a maximum number of threads processed by the central processing unit, and the grid division unit is negatively correlated with the thread processing scale and positively correlated with the scale of the liquid surface to be rendered; Based on the grid division unit, dividing the liquid surface to be rendered into a plurality of grids to be rendered; Calculating the grid fluctuation data corresponding to each grid to be rendered to obtain a grid fluctuation data set corresponding to the plurality of grids to be rendered; In a virtual scene, the graphics processor renders the liquid surface to be rendered based on the vertex fluctuation data set, and the central processing unit renders a virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set.
2. The method according to claim 1, characterized in that The step of calculating the grid fluctuation data corresponding to each grid to be rendered to obtain a grid fluctuation data set corresponding to the plurality of grids to be rendered includes: Creating a first fluctuation data solving task for each grid to be rendered, obtaining a plurality of first fluctuation data solving tasks corresponding to the plurality of grids to be rendered, wherein the first fluctuation data solving task is used to solve the grid fluctuation data corresponding to each grid to be rendered; dividing the plurality of first fluctuation data solving tasks into at least one fluctuation data solving thread; At least one of the fluctuation data solving threads is executed to obtain the grid fluctuation data set.
3. The method according to claim 1 or 2, characterized in that The step of calculating vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered includes: Traversing the set of vertices to be rendered corresponding to the liquid surface to be rendered; The vertex fluctuation data corresponding to each traversed vertex to be rendered is solved to obtain the vertex fluctuation data set corresponding to the liquid surface to be rendered.
4. The method according to claim 1 or 2, characterized in that The step of calculating vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered includes: Based on a specified number of the vertices to be rendered, dividing the set of vertices to be rendered corresponding to the liquid surface to be rendered to obtain a plurality of meshes to be rendered; Creating a second fluctuation data solving task for each vertex to be rendered in each mesh to be rendered, obtaining a second fluctuation data solving task group corresponding to the mesh to be rendered, thereby obtaining a plurality of second fluctuation data solving task groups corresponding to the plurality of meshes to be rendered, wherein the second fluctuation data solving task is used to solve the vertex fluctuation data corresponding to each vertex to be rendered; Execute a plurality of the second wave data solving task groups to obtain the vertex wave data set corresponding to the liquid surface to be rendered.
5. The method according to claim 1 or 2, characterized in that After calculating the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered, the method further includes: Determining, by the graphics processor, shading rendering data corresponding to the vertex fluctuation data set; The rendering of the liquid surface to be rendered based on the vertex fluctuation data set includes: The liquid surface to be rendered is rendered by combining the shading rendering data and the vertex fluctuation data set.
6. The method according to claim 5, characterized in that Before determining, by the graphics processor, the shading rendering data corresponding to the vertex fluctuation data set, the method further includes: The following processing is performed by the central processing unit: Collecting lighting environment data, wherein the lighting environment data includes at least one of scene environment data, lighting intensity, lighting color, lighting angle, and lighting behavior data; Converting the lighting environment data into light rendering parameters; sending the light rendering parameters to the graphics processor; The determining of the shading rendering data corresponding to the vertex fluctuation data set includes: The shading rendering data corresponding to the vertex fluctuation data set is determined based on the light rendering parameters.
7. The method according to claim 5, characterized in that The determining of the shading rendering data corresponding to the vertex fluctuation data set includes: Traversing the vertex fluctuation data set; Perform illumination processing on each of the traversed vertex fluctuation data to obtain the shading rendering data corresponding to the vertex fluctuation data set, wherein the illumination processing includes at least one of subsurface scattering processing, subsurface scattering processing, and surface reflection processing.
8. The method according to claim 1 or 2, characterized in that Before calculating vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered, the method further includes: In response to the i-th frame rendering request of the water surface to be rendered in the virtual scene, the central processing unit performs the following processing, where i is a monotonically increasing positive integer variable: Acquiring wave environment data, wherein the wave environment data includes at least one of wind direction, wind force, wave height, wavelength, and wave behavior data; converting the fluctuation environment data into fluctuation environment parameters; sending the fluctuating environmental parameters to the graphics processor; The step of calculating vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered includes: Calculating the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered based on the fluctuation environment parameters; The calculating grid fluctuation data corresponding to each grid to be rendered includes: Based on the fluctuation environment parameters, the grid fluctuation data corresponding to each grid to be rendered is calculated.
9. The method according to claim 1 or 2, characterized in that The rendering of a virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set includes: determining a buoyancy parameter based on the grid fluctuation data set; Determining buoyancy information corresponding to the liquid surface to be rendered based on the buoyancy parameter; Determining, by a physics engine based on the buoyancy information, motion information of the virtual object interacting with the liquid surface to be rendered, wherein the physics engine is called by the central processing unit; The virtual object is rendered based on the motion information.
10. A liquid surface-based rendering device, characterized in that: The rendering device includes: A first solving module is used to solve the vertex fluctuation data corresponding to each vertex to be rendered in the liquid surface to be rendered by a graphics processor to obtain a vertex fluctuation data set corresponding to the liquid surface to be rendered; A second solving module is configured to, during the process of obtaining the vertex fluctuation data set through the graphics processor, determine, via a central processing unit, a grid division unit based on a thread processing scale and the liquid surface to be rendered, wherein the thread processing scale is the maximum number of threads processed by the central processing unit, and the grid division unit is negatively correlated with the thread processing scale and positively correlated with the scale of the liquid surface to be rendered; divide the liquid surface to be rendered into a plurality of grids to be rendered based on the grid division unit; solve grid fluctuation data corresponding to each grid to be rendered to obtain a grid fluctuation data set corresponding to the plurality of grids to be rendered; The data rendering module is used to render the liquid surface to be rendered based on the vertex fluctuation data set by the graphics processor in the virtual scene, and to render the virtual object interacting with the liquid surface to be rendered based on the grid fluctuation data set by the central processing unit.
11. A liquid surface-based rendering device, characterized in that: The rendering device includes: a memory for storing executable instructions; The processor is configured to implement the liquid surface-based rendering method according to any one of claims 1 to 9 when executing the executable instructions stored in the memory.
12. A computer-readable storage medium storing executable instructions, characterized in that: The executable instructions are used to implement the liquid surface-based rendering method described in any one of claims 1 to 9 when executed by a processor.
13. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the liquid surface-based rendering method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
GPGPU-rendering-based simulation method and simulation system for 3D sea water
CN106530411A
Distributed cooperative rendering method and terminal
CN106534667A
Water surface rendering method, device and readable storage medium
CN107886562A
Water body rendering implementation system and method based on Unity 3D
CN112734891A