Fluid dynamic effect rendering method and device, equipment and storage medium
By obtaining and solving the parameters of the target fluid video material, the fluid dynamic effects are rendered on the target model, which solves the problem of low rendering efficiency caused by excessive resource consumption in the prior art, and achieves efficient fluid dynamic effects rendering.
Patent Information
- Application Number
- CN202411709129.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-29
AI Technical Summary
The existing fluid dynamic effect rendering methods are too large to consume resources, resulting in low rendering efficiency, making it difficult to achieve high-precision fluid dynamic effects in the game.
By obtaining the target fluid video material corresponding to the frame rate of the target model rendering frame rate, the video material and the target model are solved respectively, the three-dimensional fluid parameters and non-fluid parameters are obtained, and the target fluid is rendered on the target model.
This method reduces resource usage, improves the frame rate and rendering efficiency of game running, and is suitable for mobile game development.
Smart Images

Figure CN119904558A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer graphics processing, and in particular to a method, device, equipment and storage medium for rendering fluid dynamic effects. Background Art
[0002] In the field of computer graphics, fluid dynamic effects often appear in the design of games and film and television, especially in game scenes. However, the performance of the terminal running the game is limited. If you want to obtain realistic fluid dynamic effects in the game scene, such as waves, you need to call more resources of the game terminal for rendering. In this regard, the existing fluid dynamic effect rendering methods mainly use the following two methods:
[0003] The first method is to use fluid simulation to calculate the water body of the waves, and then perform shading rendering. This solution has a large amount of calculation and low real-time operation efficiency, making it difficult to implement high-precision waves in the game.
[0004] The second method: After pre-rendering, save the animation data of the water body, such as the vertex animation map VAT, etc.; in real-time rendering, only play the animation data for the flow of water, and perform rendering and shading calculations in real time.
[0005] Regardless of the first or second method, it will take up most of the resources of the game terminal, which will greatly affect the rendering efficiency and also affect the user's gaming experience. Summary of the invention
[0006] The main purpose of the present invention is to solve the problem that the existing fluid dynamic effect rendering solution consumes too much resources on the terminal, resulting in low rendering efficiency.
[0007] A first aspect of the present invention provides a method for rendering a fluid dynamic effect, the rendering method comprising:
[0008] Determining a target environment, the target environment including a target fluid to be rendered and a target model adapted to the environment of the target fluid;
[0009] Acquire a video material corresponding to the target fluid, wherein a frame rate of the video material corresponds to a rendering frame rate of the target model;
[0010] Solving the video material and the target model respectively to obtain fluid three-dimensional parameters and non-fluid parameters;
[0011] The target fluid is rendered on the target model according to the fluid three-dimensional parameters and the non-fluid parameters.
[0012] A second aspect of the present invention provides a fluid dynamic effect rendering device, the fluid dynamic effect rendering device comprising:
[0013] an acquisition module, used to determine a target environment and acquire a video material corresponding to the target fluid, wherein the target environment includes a target fluid to be rendered and a target model adapted to the environment of the target fluid, and a frame rate of the video material corresponds to a rendering frame rate of the target model;
[0014] A solving module, used for solving the video material and the target model respectively to obtain fluid three-dimensional parameters and non-fluid parameters;
[0015] A rendering module is used to render the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters.
[0016] The third aspect of the present invention provides a rendering device for fluid dynamic effects, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the rendering device for fluid dynamic effects executes the above-mentioned rendering method for fluid dynamic effects.
[0017] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned method for rendering fluid dynamic effects.
[0018] In summary, this method obtains the video material of the target fluid corresponding to the frame rate and the rendering frame rate of the target model; solves the video material and the target model respectively to obtain the three-dimensional parameters of the fluid and the non-fluid parameters; renders the target fluid on the target model according to the three-dimensional parameters of the fluid and the non-fluid parameters. The target fluid is rendered by extracting the three-dimensional parameters of the target fluid and the parameters of the target model from the video material, and the video material here is only for the target fluid. Compared with existing materials, it takes up less space and does not require excessive performance overhead of the terminal when calling, thereby improving the frame rate of the game and rendering efficiency, providing a foundation for mobile game development.
[0019] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0020] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of a first embodiment of a method for rendering fluid dynamic effects in an embodiment of the present invention;
[0022] Figure 2 Schematic diagram of a second embodiment of a method for rendering fluid dynamic effects in an embodiment of the present invention;
[0023] Figure 3 is a schematic diagram of a video material of ocean waves in an embodiment of the present invention;
[0024] Figure 4 A schematic diagram of an embodiment of a device for rendering fluid dynamic effects in an embodiment of the present invention;
[0025] Figure 5 A schematic diagram of an embodiment of a device for rendering fluid dynamic effects in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The embodiments of the present invention provide a method, apparatus, device and storage medium for rendering fluid dynamic effects, which extracts a target fluid area from video frames of the target fluid in three stages, and constructs a vertex animation texture model based on the vertex color information in the target fluid area to record the animation changes of the vertex color information of the target fluid. Based on the model, the target fluid and non-target fluid textures are rendered in the target environment respectively, so as to solve the problem of difficulty in dynamic rendering of fluid and high performance consumption caused by storing a large amount of rendering image materials occupying resource space in conventional production solutions.
[0027] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , a first embodiment of a method for rendering fluid dynamic effects in an embodiment of the present invention includes:
[0029] 101. Determine a target environment, where the target environment includes a target fluid to be rendered and a target model adapted to the environment of the target fluid.
[0030] The target environment refers to a model that needs to render fluid dynamic effects. The model includes a rendering area for fluid dynamics and an area that does not render fluid dynamics. For example, a beach model at the seaside, the user needs to render a wave effect on the beach model, and a more realistic wave effect includes both the wave part and the beach part. For this, the beach model is used as the target environment, and a part of the area is selected in the target environment as the rendering area for the target fluid (i.e., the wave), and the remaining part of the area retains the beach effect. Of course, in addition to the seaside environment, the target environment can also be other environments, such as cliffs, volcanoes, rivers, etc., which are collectively referred to as non-fluids.
[0031] 102. Obtain video material corresponding to the target fluid, where a frame rate of the video material corresponds to a rendering frame rate of the target model.
[0032] In this embodiment, the video material should be understood as a video that only contains waves and does not contain non-fluid information such as the beach. It is actually a video of the area where the target fluid is located extracted from the complete target fluid video. Specifically, the existing target fluid videos are collected, and then the video corresponding to the target fluid is extracted from the target fluid video through video processing software. For example, for the wave video material, the video of the wave part is extracted from the material.
[0033] It is understandable that the video material of the waves can be simulated by using software according to the rendering frame rate of the target model, or it can be directly extracted from existing film and television videos. For example, a video frame with a wave part is intercepted from an existing film and television video, and then the non-fluid part such as the beach in the video frame is removed to obtain the video material of the wave part.
[0034] Specifically, a video of the target fluid is collected; non-target fluid areas in the video are removed, and a video material carrying only the target fluid is generated according to the rendering frame rate of the target model. The video of the target fluid is collected by simulating the target fluid through software, or by taking a video of the target fluid in real time using a collection device.
[0035] For example, when the target fluid is sea waves, a high-precision sea wave video is collected and non-sea wave areas (such as a beach) in the sea wave video are removed to obtain a video material of the sea waves;
[0036] In this embodiment, the target fluid video can be a real target fluid video or a simulated target fluid video. Then, video software such as (Houdini, Premiere Pro, After Effects, etc.) is used to remove non-target fluid areas in the real target fluid video or the simulated high-precision target fluid video to obtain the required target fluid area (that is, the texture video of the target fluid). For example, the beach area in the wave video is removed, leaving the area with the wave effect, and the dynamics in the remaining area are used as the video material of the target fluid.
[0037] 103. The video material and the target model are solved respectively to obtain the fluid three-dimensional parameters and the non-fluid parameters.
[0038] The three-dimensional fluid parameters include the animation change of the target fluid and the color and depth information of the target fluid in each frame. The depth information is calculated based on the color value of each pixel of the target fluid.
[0039] In this embodiment, different shading models are used to solve the video material and the target model respectively to obtain the corresponding fluid 3D parameters and non-fluid parameters. Specifically, the video material is first decoded to extract the texture of each video frame, and then the shading model of the fluid is used to solve each texture to obtain the fluid 3D parameters. Furthermore, the shading model of the non-fluid is used for solving, which actually extracts the basic color of the non-fluid in the target model for subsequent rendering.
[0040] Specifically, a decoder is used to decode each video frame in the video material to obtain a video map of the target fluid; the color of the target fluid in each video map is extracted, and the three-dimensional fluid parameters of the target fluid are calculated based on the color; the color of the non-fluid in the target model is extracted to obtain the non-fluid parameters.
[0041] In actual applications, after the video material is decoded by the device's CPU, the decoded texture is transferred to the GPU for caching. When rendering, the texture in the GPU is transferred to the shading model for solution rendering. The solution process specifically extracts the color in each frame texture, calculates the normal information, such as the normal direction, and extracts the color in the target model. Of course, after extracting the color of the target model, a non-fluid mask can be constructed based on the color, and the mask and the texture are superimposed to merge the target fluid.
[0042] In another embodiment, extracting the color of the target fluid in each of the video maps and calculating the three-dimensional fluid parameters of the target fluid based on the color includes:
[0043] Extracting the color of the target fluid in each of the video maps using a subsurface scattering shading model;
[0044] Convert the color into relative luminosity to generate a height map of the target fluid;
[0045] Based on the variation rule of relative luminosity in the height map, the normal direction of the target fluid is calculated.
[0046] 104. Render the target fluid on the target model according to the fluid 3D parameters and the non-fluid parameters.
[0047] In this embodiment, the target fluid is rendered by inputting the fluid three-dimensional parameters and the non-fluid parameters into the engine. For example, a prototype of the target model is first constructed based on the non-fluid parameters. The prototype is actually a surface model that reflects the inherent color of the non-fluid, such as the beach. Then, the color of the target fluid rendering area in the surface model is adjusted based on the fluid three-dimensional parameters. Specifically, the fluid three-dimensional parameters are superimposed on the model, thereby rendering the target fluid in the target model.
[0048] In some embodiments, the color of the target fluid is superimposed with the color of the non-fluid in the target model to obtain a two-dimensional effect of the target fluid; and the two-dimensional effect of the target fluid is adjusted based on the normal direction to obtain the target fluid.
[0049] The following takes the rendering of the sea wave effect as an example to illustrate that the color of the extracted sea waves is superimposed with the color of the beach on the beach model to achieve the rendering of the sea wave effect on the beach in the beach model. In actual application, the sea wave map can be directly superimposed on the beach model, and the sea wave part in the sea wave map will cover the rendering area of the sea wave on the beach model, while the beach area will not be affected because the beach part of the wave map has a transparent bottom.
[0050] In summary, the target fluid is rendered by extracting the three-dimensional parameters of the target fluid and the parameters of the target model from the video material. The video material here is only of the target fluid. Compared with the existing materials, it takes up less space and does not require too much performance overhead of the terminal when calling, thereby improving the frame rate of the game and improving rendering efficiency.
[0051] Reference Figure 2 , which is a second embodiment of the method for rendering fluid dynamic effects provided by the present invention. This embodiment takes the sea wave effect as an example to explain the rendering method provided by the present invention in detail. The method specifically includes the following steps:
[0052] 201. Determine a target environment, where the target environment includes waves to be rendered and a beach model adapted to the environment of the waves.
[0053] 202. Obtain video material corresponding to the waves, where the frame rate of the video material corresponds to the rendering frame rate of the beach model.
[0054] In this step, the video material is obtained by collecting a video of an existing wave effect or a video simulating a wave effect, then extracting the wave part in the video, and splicing the partial video of the wave extracted from each frame according to the rendering frame rate of the target model to obtain video material that meets the frame rate.
[0055] In this embodiment, the video material of the target fluid is obtained by the following two methods:
[0056] The first is by calling upon computer generated images (CGI).
[0057] Specifically, a video of the waves is obtained through software simulation, the beach area in the video is removed, and a video material containing only the waves is generated according to the rendering frame rate of the beach model.
[0058] This method of generating through software simulation can obtain videos with adjustable accuracy and accurate content. Specifically, Houdini and other software are used to simulate a high-precision wave. After the adjustment effect is satisfactory, it can be rendered using a bird's-eye view orthographic camera and a black background.
[0059] The second method is to extract from existing wave videos.
[0060] Specifically, a video with waves is shot in real time using a capture device, the beach area in the video is removed, and a video material containing only the waves is generated according to a rendering frame rate of a beach model.
[0061] This method uses real-life footage, which can be shot by yourself using a filming device or publicly available footage (such as Shutter Stock). This method is relatively simple to produce, but it may not be easy to get ideal footage, and the processing requires more tedious (simple) work.
[0062] It should be noted that, regardless of the first or second solution, after obtaining the video material of multiple frames of ocean waves, it is necessary to generate the video according to the target rendering frame rate to ensure synchronization in subsequent game use.
[0063] Try to shoot on a cloudy day or at noon (to avoid shadows), with the camera looking down, and after adjusting the camera position and parameters, keep the camera fixed and record. When using publicly available materials, try to choose similar materials.
[0064] Then you need to process the video and remove the beach part as black (RotoScope, a basic process in the film and television industry). At the same time, you can make some adjustments to the video color to achieve a more balanced state.
[0065] 203. The video material and the beach model are solved respectively to obtain the three-dimensional parameters of the waves and the parameters of the beach.
[0066] It is understandable that the resolution of the video material is achieved based on a video decoder and a rendering shader, and the resolution of the beach model is only achieved using a shader.
[0067] Specifically, a decoder is used to decode each video frame in the video material to obtain a video map of the target fluid; the color of the target fluid in each video map is extracted, and the three-dimensional fluid parameters of the target fluid are calculated based on the color; the color of the non-fluid in the target model is extracted to obtain the non-fluid parameters.
[0068] For example, the GPU's hardware decoder is used to decode the video material, and the decoded data is passed to the shader for calculation to obtain the three-dimensional parameters of the waves.
[0069] During the whole process, the CPU only needs to send the video data stream to the GPU cache, because the video decoder and shader unit are both on the GPU, reducing unnecessary CPU cache to GPU cache read and write operations. The video decoder writes the decoded image to the buffer in the GPU cache, and the shader unit can directly read the image in the buffer, with extremely high real-time efficiency.
[0070] In another embodiment, extracting the color of the target fluid in each of the video maps and calculating the three-dimensional fluid parameters of the target fluid based on the color includes:
[0071] Extracting the color of the target fluid in each of the video maps using a subsurface scattering shading model;
[0072] Convert the color into relative luminosity to generate a height map of the target fluid;
[0073] Based on the variation rule of relative luminosity in the height map, the normal direction of the target fluid is calculated.
[0074] It should be noted that the three-dimensional parameters of the fluid are the three-dimensional parameters of the waves, which include the color, height map and normal direction of the waves. The height map of the waves is calculated based on the size and distribution of the color of each pixel by extracting the color of each pixel in each frame of the wave map; and then the normal direction of each pixel of the waves is calculated based on the height map.
[0075] Here we use relative brightness as the basic height map, make some simple adjustments, such as adjusting the contrast, etc., and use it as a height map. Then we can calculate the normal direction based on the continuous change of the height map.
[0076] Relative brightness has such characteristics: the white foam that completely covers the beach has the highest relative brightness, the semi-transparent sea water has a slightly lower relative brightness, and the black non-wave part is 0. In fact, the white foam part of the waves is also higher, usually gathered above the sea water, so it is reasonable to use relative brightness as a height map.
[0077] 204. Render the waves on the beach model according to the three-dimensional parameters of the waves and the beach parameters.
[0078] Specifically, the color of the ocean wave is superimposed on the color of the beach in the beach model to obtain the two-dimensional effect of the ocean wave; and the two-dimensional effect of the ocean wave is adjusted based on the normal direction to obtain the ocean wave.
[0079] It is understandable that a video of waves looking down is obtained, and the areas not covered by the waves in each frame of the video texture in the wave video are kept black to obtain the video material of the waves. Then, while playing the video material using the GPU hardware decoder, each decoded frame is passed to the shader of the beach model as a texture resource, and the video texture is processed in the shader to obtain the color and height map, that is, the three-dimensional parameters of the waves. Finally, a layer of three-dimensional waves is drawn on the beach model based on the color and height map of the waves. Because there is correct physical information (color, normals and even model bumps), the waves can be rendered using the game's shader like regular resources, so they can interact normally with the lighting and environment in the game.
[0080] In another embodiment, when drawing waves on the beach model, it can be achieved by superimposing a video texture of the waves on the beach model. That is, since the video material of the waves has a black background, the color of the video texture of the waves can be directly superimposed on the inherent color of the beach.
[0081] In order to ensure the rendering effect of the waves in the subsequent shading model, after extracting the parameters of the beach model, the beach parameters are also adjusted to the preset value range to ensure the distinction between the beach area and the wave area. That is, the inherent color value in the beach model is limited to the range of 0 to 1. After such processing, the part without waves still retains the color of the beach because it is superimposed with black (the value is 0); the white foam part of the wave is white (the value is close to 1), and after superimposing the color of the beach, it will exceed the range and be limited to 1, and it will still be white; the seawater part of the wave will have an almost translucent effect after superimposing.
[0082] 205. Use the surface subdivision method to divide the surface of the beach model into multiple polygonal surfaces.
[0083] 206. Perform concave-convex processing on the surface of each polygon based on the height map in the three-dimensional parameters of the ocean wave, and use the parallax masking mapping method to offset the concave and convex pixels to obtain the final ocean wave.
[0084] In this embodiment, after rendering the target fluid such as waves on the beach model, the method further includes: optimizing the rendering of the target fluid by using parallax occlusion mapping and surface subdivision based on the height map in the three-dimensional parameters of the waves.
[0085] That is, the surface subdivision method is to subdivide the surface of the beach model into more polygons, and then make the polygons concave and convex to form a real concave and convex polygonal surface, which can produce correct occlusion, shadow and other effects.
[0086] The parallax occlusion mapping method uses the ray-stepping technique to calculate an offset value for each pixel to achieve a realistic bump effect, which can produce correct occlusion, shadow (with additional overhead for each light) and other effects.
[0087] Furthermore, based on the height map, some modifications can be made to the parallax occlusion mapping calculation of the grayscale (non-black 0 white 1) part to further improve the effect.
[0088] It should be noted that the grayscale part can actually be considered as seawater. When the parallax occlusion mapping step calculation finds the surface of the height map, if this surface is judged as seawater, then a refraction angle is calculated according to the direction of the surface normal and the direction of the step ray, and the ray continues to step along the refracted direction until the surface of the beach is found. The height difference is calculated to be the depth of the accumulated water. Based on this depth, the transparency can be adjusted to mix the seawater and the beach to form a real effect of a slightly higher layer of seawater on the beach.
[0089] In summary, by obtaining the video material of the target fluid corresponding to the rendering frame rate of the target model; respectively solving the video material and the target model to obtain the fluid 3D parameters and non-fluid parameters; and rendering the target fluid on the target model according to the fluid 3D parameters and non-fluid parameters. Using video material instead of texture is more flexible than playing video; and has higher length, accuracy and space utilization than sequential frame technology.
[0090] Furthermore, when rendering the target fluid, the color of the target fluid and the color on the target model are superimposed and mixed using the superposition method. Only a black-background video material is required, and no additional Alpha channel is required, ensuring the compatibility of the video format. The relative brightness of the video is also used as a height map, which can make the flat video show a three-dimensional effect. At the same time, because it is calculated in real time, some interactivity can also be retained. Furthermore, the height map can use a large number of existing game rendering techniques, retaining the possibility of improving the effect.
[0091] The above describes the method for rendering fluid dynamic effects in the embodiment of the present invention. The following describes the device for rendering fluid dynamic effects in the embodiment of the present invention. Figure 4 , an embodiment of a rendering device for fluid dynamic effects in an embodiment of the present invention includes:
[0092] An acquisition module 410 is used to determine a target environment and acquire a video material corresponding to the target fluid, wherein the target environment includes a target fluid to be rendered and a target model adapted to the environment of the target fluid, and a frame rate of the video material corresponds to a rendering frame rate of the target model;
[0093] A calculation module 420, used to calculate the video material and the target model respectively to obtain fluid three-dimensional parameters and non-fluid parameters;
[0094] The rendering module 430 is used to render the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters.
[0095] The acquisition module 410 is specifically used for:
[0096] collecting a video of the target fluid;
[0097] Non-target fluid areas in the video are removed, and video material carrying only the target fluid is generated according to the rendering frame rate of the target model.
[0098] The acquisition module 410 is specifically used for:
[0099] The video of the target fluid is obtained by software simulation, or the video containing the target fluid is captured in real time by using an acquisition device.
[0100] The above-mentioned solution module 420 is specifically used for:
[0101] Decoding each video frame in the video material using a decoder to obtain a video map of the target fluid;
[0102] Extracting the color of the target fluid in each of the video maps, and calculating the three-dimensional fluid parameters of the target fluid based on the color;
[0103] The color of the non-fluid in the target model is extracted to obtain the non-fluid parameter.
[0104] The above-mentioned solution module 420 is specifically used for:
[0105] Extracting the color of the target fluid in each of the video maps using a subsurface scattering shading model;
[0106] Convert the color into relative luminosity to generate a height map of the target fluid;
[0107] Based on the variation rule of relative luminosity in the height map, the normal direction of the target fluid is calculated.
[0108] The rendering module 430 is specifically used for:
[0109] Superimposing the color of the target fluid with the color of the non-fluid in the target model to obtain a two-dimensional effect of the target fluid;
[0110] The two-dimensional effect of the target fluid is adjusted based on the normal direction to obtain the target fluid.
[0111] The rendering module 430 is also specifically used for:
[0112] Based on the height map, the target fluid is optimized and rendered using parallax occlusion mapping and surface tessellation.
[0113] The rendering module 430 is specifically used for:
[0114] Dividing the surface of the target model into a plurality of polygonal surfaces by using a surface subdivision method;
[0115] The surfaces of the polygons are processed for concavity and convexity based on the height map, and the concavity and convexity pixels are offset using a parallax occlusion mapping method to obtain a final target fluid.
[0116] In an embodiment of the present invention, the rendering device for fluid dynamic effects runs the above-mentioned rendering method for fluid dynamic effects, by obtaining a video material of the target fluid corresponding to the frame rate of the rendering frame rate of the target model; respectively solving the video material and the target model to obtain the three-dimensional parameters of the fluid and the non-fluid parameters; and rendering the target fluid on the target model according to the three-dimensional parameters of the fluid and the non-fluid parameters. This method does not require the preparation of a large number of fluid images, greatly reduces the amount of sampling and calculation, reduces performance overhead, increases the frame rate of the game, improves rendering efficiency, and provides a foundation for mobile game development.
[0117] This embodiment also provides a fluid dynamic effect rendering device, including a processor and a memory, the memory storing machine executable instructions that can be executed by the processor, and the processor executing the machine executable instructions to implement the above fluid dynamic effect rendering method. The fluid dynamic effect rendering device can be a server or a terminal device.
[0118] See also Figure 5 As shown, the fluid dynamic effect rendering device includes a processor 500 and a memory 501. The memory 501 stores machine executable instructions that can be executed by the processor 500. The processor 500 executes the machine executable instructions to implement the above-mentioned fluid dynamic effect rendering method.
[0119] Further, Figure 5 The fluid dynamic effect rendering device shown also includes a bus 502 and a communication interface 503 , and the processor 500 , the communication interface 503 and the memory 501 are connected via the bus 502 .
[0120] The memory 501 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 503 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 502 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0121] The processor 500 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 500. The above processor 500 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 501, and the processor 500 reads the information in the memory 501 and completes the following steps in combination with its hardware:
[0122] Determining a target environment, the target environment including a target fluid to be rendered and a target model adapted to the environment of the target fluid;
[0123] Acquire a video material corresponding to the target fluid, wherein a frame rate of the video material corresponds to a rendering frame rate of the target model;
[0124] Solving the video material and the target model respectively to obtain fluid three-dimensional parameters and non-fluid parameters;
[0125] The target fluid is rendered on the target model according to the fluid three-dimensional parameters and the non-fluid parameters.
[0126] The above-mentioned obtaining of the video material corresponding to the target fluid includes:
[0127] collecting a video of the target fluid;
[0128] Non-target fluid areas in the video are removed, and video material carrying only the target fluid is generated according to the rendering frame rate of the target model.
[0129] The above-mentioned video of collecting the target fluid includes:
[0130] The video of the target fluid is obtained by software simulation, or the video containing the target fluid is captured in real time by using an acquisition device.
[0131] The above-mentioned video material and the target model are respectively solved to obtain the fluid three-dimensional parameters and non-fluid parameters, including:
[0132] Decoding each video frame in the video material using a decoder to obtain a video map of the target fluid;
[0133] Extracting the color of the target fluid in each of the video maps, and calculating the three-dimensional fluid parameters of the target fluid based on the color;
[0134] The color of the non-fluid in the target model is extracted to obtain the non-fluid parameter.
[0135] The above-mentioned step of extracting the color of the target fluid in each of the video maps and calculating the three-dimensional fluid parameters of the target fluid based on the color includes:
[0136] Extracting the color of the target fluid in each of the video maps using a subsurface scattering shading model;
[0137] Convert the color into relative luminosity to generate a height map of the target fluid;
[0138] Based on the variation rule of relative luminosity in the height map, the normal direction of the target fluid is calculated.
[0139] The above-mentioned rendering of the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters includes:
[0140] Superimposing the color of the target fluid with the color of the non-fluid in the target model to obtain a two-dimensional effect of the target fluid;
[0141] The two-dimensional effect of the target fluid is adjusted based on the normal direction to obtain the target fluid.
[0142] After rendering the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters, the method further includes:
[0143] Based on the height map, the target fluid is optimized and rendered using parallax occlusion mapping and surface tessellation.
[0144] The above-mentioned method of optimizing and rendering the target fluid based on the height map by using the parallax occlusion mapping method and the surface subdivision method includes:
[0145] Dividing the surface of the target model into a plurality of polygonal surfaces by using a surface subdivision method;
[0146] The surfaces of the polygons are processed for concavity and convexity based on the height map, and the concavity and convexity pixels are offset using a parallax occlusion mapping method to obtain a final target fluid.
[0147] In summary, by obtaining the video material of the target fluid corresponding to the rendering frame rate of the target model; respectively solving the video material and the target model to obtain the fluid 3D parameters and non-fluid parameters; and rendering the target fluid on the target model according to the fluid 3D parameters and non-fluid parameters, the problem of low rendering efficiency caused by excessive consumption of terminal resources in the existing fluid dynamic effect rendering solution is solved.
[0148] This embodiment further provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the following steps:
[0149] Determining a target environment, the target environment including a target fluid to be rendered and a target model adapted to the environment of the target fluid;
[0150] Acquire a video material corresponding to the target fluid, wherein a frame rate of the video material corresponds to a rendering frame rate of the target model;
[0151] Solving the video material and the target model respectively to obtain fluid three-dimensional parameters and non-fluid parameters;
[0152] The target fluid is rendered on the target model according to the fluid three-dimensional parameters and the non-fluid parameters.
[0153] The above-mentioned obtaining of the video material corresponding to the target fluid includes:
[0154] collecting a video of the target fluid;
[0155] Non-target fluid areas in the video are removed, and video material carrying only the target fluid is generated according to the rendering frame rate of the target model.
[0156] The above-mentioned video of collecting the target fluid includes:
[0157] The video of the target fluid is obtained by software simulation, or the video containing the target fluid is captured in real time by using an acquisition device.
[0158] The above-mentioned video material and the target model are respectively solved to obtain the fluid three-dimensional parameters and non-fluid parameters, including:
[0159] Decoding each video frame in the video material using a decoder to obtain a video map of the target fluid;
[0160] Extracting the color of the target fluid in each of the video maps, and calculating the three-dimensional fluid parameters of the target fluid based on the color;
[0161] The color of the non-fluid in the target model is extracted to obtain the non-fluid parameter.
[0162] The above-mentioned step of extracting the color of the target fluid in each of the video maps and calculating the three-dimensional fluid parameters of the target fluid based on the color includes:
[0163] Extracting the color of the target fluid in each of the video maps using a subsurface scattering shading model;
[0164] Convert the color into relative luminosity to generate a height map of the target fluid;
[0165] Based on the variation rule of relative luminosity in the height map, the normal direction of the target fluid is calculated.
[0166] The above-mentioned rendering of the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters includes:
[0167] Superimposing the color of the target fluid with the color of the non-fluid in the target model to obtain a two-dimensional effect of the target fluid;
[0168] The two-dimensional effect of the target fluid is adjusted based on the normal direction to obtain the target fluid.
[0169] After rendering the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters, the method further includes:
[0170] Based on the height map, the target fluid is optimized and rendered using parallax occlusion mapping and surface tessellation.
[0171] The above-mentioned method of optimizing and rendering the target fluid based on the height map by using the parallax occlusion mapping method and the surface subdivision method includes:
[0172] Dividing the surface of the target model into a plurality of polygonal surfaces by using a surface subdivision method;
[0173] The surfaces of the polygons are processed for concavity and convexity based on the height map, and the concavity and convexity pixels are offset using a parallax occlusion mapping method to obtain a final target fluid.
[0174] In summary, by obtaining the video material of the target fluid corresponding to the rendering frame rate of the target model; respectively solving the video material and the target model to obtain the fluid 3D parameters and non-fluid parameters; and rendering the target fluid on the target model according to the fluid 3D parameters and non-fluid parameters, the problem of low rendering efficiency caused by excessive consumption of terminal resources in the existing fluid dynamic effect rendering solution is solved.
[0175] The computer program product of the fluid dynamic effect rendering method and related equipment provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0176] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0177] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0178] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0179] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0180] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for rendering fluid dynamic effects, characterized in that: The rendering method comprises: Determining a target environment, the target environment including a target fluid to be rendered and a target model adapted to the environment of the target fluid; Acquire a video material corresponding to the target fluid, wherein a frame rate of the video material corresponds to a rendering frame rate of the target model; Solving the video material and the target model respectively to obtain fluid three-dimensional parameters and non-fluid parameters; The target fluid is rendered on the target model according to the fluid three-dimensional parameters and the non-fluid parameters.
2. The method for rendering fluid dynamic effects according to claim 1, characterized in that: The obtaining of the video material corresponding to the target fluid comprises: collecting a video of the target fluid; Non-target fluid areas in the video are removed, and video material carrying only the target fluid is generated according to the rendering frame rate of the target model.
3. The method for rendering fluid dynamic effects according to claim 2, characterized in that: The step of collecting the video of the target fluid comprises: The video of the target fluid is obtained by software simulation, or the video containing the target fluid is captured in real time by using an acquisition device.
4. The method for rendering fluid dynamic effects according to any one of claims 1 to 3, characterized in that: The video material and the target model are respectively solved to obtain the fluid three-dimensional parameters and the non-fluid parameters, including: Decoding each video frame in the video material using a decoder to obtain a video map of the target fluid; Extracting the color of the target fluid in each of the video maps, and calculating the three-dimensional fluid parameters of the target fluid based on the color; The color of the non-fluid in the target model is extracted to obtain the non-fluid parameter.
5. The method for rendering fluid dynamic effects according to claim 4, characterized in that: The step of extracting the color of the target fluid in each of the video maps and calculating the three-dimensional fluid parameters of the target fluid based on the color includes: Extracting the color of the target fluid in each of the video maps using a subsurface scattering shading model; Convert the color into relative luminosity to generate a height map of the target fluid; Based on the variation rule of relative luminosity in the height map, the normal direction of the target fluid is calculated.
6. The method for rendering fluid dynamic effects according to claim 5, characterized in that: The step of rendering the target fluid on the target model according to the fluid three-dimensional parameter and the non-fluid parameter comprises: Superimposing the color of the target fluid with the color of the non-fluid in the target model to obtain a two-dimensional effect of the target fluid; The two-dimensional effect of the target fluid is adjusted based on the normal direction to obtain the target fluid.
7. The method for rendering fluid dynamic effects according to claim 6, characterized in that: After rendering the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters, the method further includes: Based on the height map, the target fluid is optimized and rendered using parallax occlusion mapping and surface tessellation.
8. The method for rendering fluid dynamic effects according to claim 7, characterized in that: The method of optimizing and rendering the target fluid based on the height map by using a parallax occlusion mapping method and a surface subdivision method includes: Dividing the surface of the target model into a plurality of polygonal surfaces by using a surface subdivision method; The surfaces of the polygons are processed for concavity and convexity based on the height map, and the concavity and convexity pixels are offset using a parallax occlusion mapping method to obtain a final target fluid.
9. A rendering device for fluid dynamic effects, characterized in that: The rendering device for fluid dynamic effects comprises: an acquisition module, used to determine a target environment and acquire a video material corresponding to the target fluid, wherein the target environment includes a target fluid to be rendered and a target model adapted to the environment of the target fluid, and a frame rate of the video material corresponds to a rendering frame rate of the target model; A solving module, used for solving the video material and the target model respectively to obtain fluid three-dimensional parameters and non-fluid parameters; A rendering module is used to render the target fluid on the target model according to the fluid three-dimensional parameters and the non-fluid parameters.
10. A fluid dynamic effect rendering device, characterized in that: The fluid dynamic effect rendering device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory to enable the fluid dynamic effect rendering device to execute the fluid dynamic effect rendering method according to any one of claims 1-8.
11. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, a method for rendering fluid dynamic effects as described in any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Popularization method and system for ice powder marketing
CN120525616A
A promotion method and system for ice powder marketing
CN120525616B