Method, device and equipment for generating sea wave effect and storage medium
By generating wave animation textures that only contain the coordinates of the wave edges, the problem of excessive resource consumption in existing technologies is solved, achieving efficient wave effect rendering and reducing device performance overhead.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2024-12-04
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies consume excessive device and storage resources when rendering dynamic wave effects, leading to increased performance overhead.
By extracting the wave edge position curves from multiple frames of wave footage, an animated wave texture is generated, containing only the coordinate information of the wave edges to reduce resource consumption. Based on this texture, pixels on the beach model are rendered to match the wave effect.
It reduces the amount of device resources used, improves rendering efficiency, and reduces the resource requirements of subsequent applications.
Smart Images

Figure CN122156403A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer graphics processing technology, and in particular to a method, apparatus, device, and storage medium for generating ocean wave effects. Background Technology
[0002] In the field of computer graphics, fluid dynamic effects often appear in the design of games and movies, especially for the dynamic rendering of waves on beaches and coastlines. Currently, the main methods used to achieve rendering are transition animations and pre-calculated cached animations.
[0003] While the aforementioned existing technologies can achieve dynamic rendering of ocean waves, this requires significant computing resources on the device, as well as substantial storage resources to store pre-made texture information. Summary of the Invention
[0004] The main objective of this invention is to solve the problem of excessive resource consumption of devices in the prior art for rendering dynamic wave effects.
[0005] The first aspect of this invention provides a method for generating ocean wave effects, the method comprising:
[0006] The wave animation material in the game is determined, wherein the wave animation material includes multiple frames of wave images, and each frame of wave image includes the edge of the wave between the wave and the beach model;
[0007] Based on the position points on the edge of the waves, determine the position curves of the wave edges in the multi-frame wave images;
[0008] Based on the position curves, a wave animation texture corresponding to the wave animation material is generated, wherein the time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material;
[0009] Based on the wave animation texture, the position change process of each pixel on the beach model relative to the edge of the wave is determined during the playback of the wave animation material, and the parameter change process of the corresponding performance parameters of each pixel during the position change process is determined.
[0010] The model renders each pixel on the beach according to the parameter change process, so that the effect of the beach model matches the effect of the wave animation material.
[0011] A second aspect of the present invention provides an apparatus for generating ocean wave effects, the apparatus comprising:
[0012] An extraction module is used to determine wave animation materials in the game, wherein the wave animation materials include multiple frames of wave images, each frame of wave image includes the edge of the wave between the wave and the beach model; and based on the position points on the wave edge, a position curve is determined to represent the wave edge in the multiple frames of wave images;
[0013] The generation module is used to generate a wave animation texture corresponding to the wave animation material based on the position curves, wherein the time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material;
[0014] The calculation module is used to determine, based on the wave animation texture, the positional change process of each pixel on the beach model relative to the edge of the wave during the playback of the wave animation material, and to determine the parameter change process of the performance parameters corresponding to each pixel during the positional change process;
[0015] The rendering module is used to render each pixel on the beach model according to the parameter change process, so that the effect of the beach model matches the effect of the wave animation material.
[0016] A third aspect of the present invention provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a circuit; the at least one processor invokes the instructions in the memory to cause the electronic device to perform the above-described method for generating wave effects.
[0017] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described method for generating wave effects.
[0018] In summary, this method extracts the position curves of the wave edges from multiple frames of wave footage; generates corresponding wave animation textures based on the extracted position curves; determines the performance parameters for playing the wave animation based on the wave animation textures; and renders each pixel on the beach model to obtain the corresponding wave effect. The resulting wave animation textures actually only contain the coordinate information of the wave edges from multiple frames of animation. Compared to existing textures, this significantly reduces the amount of device resources required, thereby reducing performance overhead and improving operational efficiency when applications access resources subsequently.
[0019] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the first embodiment of the method for generating wave effects according to the present invention;
[0022] Figure 2 This is a schematic diagram of a second embodiment of the method for generating wave effects according to the present invention;
[0023] Figure 3 This is a schematic diagram illustrating the extraction of each frame of ocean wave image in an embodiment of the present invention;
[0024] Figure 4 This is a schematic diagram of one embodiment of the wave effect generation device in this invention;
[0025] Figure 5 This is a schematic diagram of one embodiment of the electronic device in this invention. Detailed Implementation
[0026] This invention provides a method, apparatus, device, and storage medium for generating ocean wave effects. By extracting the position points of the ocean wave edges in each frame of an ocean wave animation material over a period of time, corresponding position curves are constructed. Then, the curves obtained from each frame are added to a texture map to obtain an ocean wave animation texture map. Such a texture map only contains the edge lines of the ocean waves and does not contain other dynamic information, thereby reducing the resource consumption of the texture map, providing a simplified basis for subsequent rendering, calculation, and other processes, and also improving the operating efficiency of the device.
[0027] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1The first embodiment of the method for generating wave effects in this invention includes:
[0029] 101. Determine the wave animation assets in the game. These wave animation assets include multiple frames of wave images, with each frame including the edge of the wave between the wave and the beach model.
[0030] 102. Based on the position points on the edge of the waves, determine the position curves of the wave edges in multiple frames of wave images.
[0031] It should be noted that the shape of the wave edges in each frame of the wave image can be the same or different, but the wave edges between frames satisfy the dynamic change over time, that is, the positions of the wave edges in two adjacent frames of the animation are not the same.
[0032] Specifically, based on sampling points pre-set on the beach model, the position points of the wave edges in each frame of wave image are determined, and position curves for referring to the wave edges in the multiple frames of wave images are constructed according to the time sequence of each frame of wave image.
[0033] The animation footage of ocean waves is cut using an image recognition tool to obtain static textures of multiple frames of ocean waves. These static textures are then sorted chronologically to form a set. Next, the wave regions in each static texture are identified based on wave features, and the boundary lines of these regions are extracted and used as wave edges. Furthermore, a pixel coordinate system is constructed based on the image boundaries of the static textures, and the coordinates of each pixel at the wave edge are extracted using this coordinate system to obtain the position curve of the wave edge.
[0034] In practical applications, when extracting the coordinates of the pixels at the edge of the waves in each static texture, a discrete sampling method can be used. That is, based on the identified wave edge, sampling points are set in the texture using the discrete sampling method. Here, the sampling points refer to the sampling points on the wave edge. The coordinates of each sampling point are extracted to obtain the position points of the wave edge. Then, they are connected in sequence, and the connected curve is processed using curve transition processing to obtain the position curve of the wave edge.
[0035] 103. Generate wave animation textures corresponding to wave animation materials based on position curves. The time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material.
[0036] In this embodiment, the extracted position curves are sorted in chronological order to obtain wave animation textures. After obtaining the position curves of the wave edges in each static texture, the position curves are superimposed in a coordinate system in chronological order to obtain wave animation textures corresponding to the wave animation materials.
[0037] Understandably, the texture corresponding to one frame of the wave image is used as a base, and then the position curves of the wave edges from other frames are superimposed onto this base to obtain a complete wave animation texture. Specifically, a base texture is created using the texture of the first frame in the video, and the position curves of the wave edges in each frame are extracted sequentially and added to the corresponding time positions in the base texture until the position curves from all frames are superimposed, resulting in the output wave animation texture.
[0038] 104. Based on the wave animation texture, determine the positional change of each pixel on the beach model relative to the edge of the wave during the playback of the wave animation material, and determine the parameter change process of the corresponding performance parameters of each pixel during the positional change process.
[0039] 105. Render each pixel on the beach model according to the parameter change process so that the effect of the beach model matches the effect of the wave animation material.
[0040] In this embodiment, the performance parameters of each pixel are actually the humidity of the beach. Specifically, by determining the time point of playing the wave animation material and the position of the waves, the closest position curve is matched from the wave animation texture. Then, based on the time point and the time of the position curve, combined with the humidity change law, the humidity of each pixel in the beach model is calculated. That is, the parameter change process of the performance parameters corresponding to each pixel during the position change process, so as to render waves with the same effect as in the material.
[0041] In summary, by extracting the edges of the waves from each frame of the wave animation material and generating position curves, and then compositing the position curves of all frames into a single texture, this texture requires less resources and is easier to call in subsequent applications, using pre-calculated resources to reduce computation.
[0042] Reference Figure 2 This is a second embodiment of the method for generating wave effects provided by the present invention. This embodiment uses a wave effect texture as an example to describe in detail the method for generating wave effects provided by the present invention. The method specifically includes the following steps:
[0043] 201. Determine the edges of the waves in each frame of the wave animation material in the game.
[0044] 202. Based on the sampling points pre-set on the beach model, determine the position points of the wave edges in each frame of wave image, and construct position curves to refer to the wave edges in the multiple frames of wave images according to the time sequence of each frame of wave images.
[0045] The sampling points refer to information sampling points evenly distributed within the beach and wave areas of the wave animation footage. These points can be set at equal intervals or using a uniform distribution algorithm. Based on the predetermined number of sampling points, sampling points are evenly distributed on the beach, and it is determined whether these sampling points are covered by the waves.
[0046] It should be noted that the positions of the set sampling points are mapped to the textures of each frame in the wave animation material. Then, the image features on each sampling point are scanned in a preset order, and each sampling point is identified as a wave point. If it is, it is further identified as a wave edge.
[0047] In this embodiment, based on sampling points pre-set on the beach model, it is identified whether the sampling points in each frame of wave image are covered by waves, and a wave coverage map of each frame of wave image is obtained; the position points of the edges covered by waves in each wave coverage map are extracted, and position curves for referring to the wave edges in the multiple frames of wave images are generated.
[0048] Understandably, by scanning and extracting the image features of each sampling point, and matching the extracted image features of each sampling point with the preset wave features, sampling points belonging to the waves are filtered out. Then, it is identified whether the adjacent sampling points of the wave sampling points are sampling points of the waves and the beach. If so, the sampling point is determined to be the location point of the wave edge. Finally, the sampling points belonging to the wave edge are connected to obtain the position curve of the wave edge.
[0049] In practical applications, in order to facilitate the extraction of the position curve of the wave edge, this application sets a fixed extraction direction, such as scanning and identifying the information of each sampling point sequentially from left to right or from bottom to top.
[0050] That is, extracting the position information of pixels covered by waves in each of the wave coverage images and generating the position curve of the wave edge includes:
[0051] Query the target pixels covered by waves in each of the wave coverage maps according to the first preset direction to obtain the position points of the wave edge;
[0052] By sequentially connecting the location information of each location point in the same wave coverage map according to spatial position order, a position curve is obtained to represent the edge of the waves in the multi-frame wave images.
[0053] It should be noted that the first preset direction is determined based on the direction of wave extension in the wave animation material, that is, it can be the same as the forward or backward direction of the wave. By sampling points one by one along the first preset direction, it is identified whether they are pixels of the wave or whether the sampling point is covered by the wave. Based on the identification results, each frame of wave texture is converted into a wave overlay map. In the wave overlay map, the sampling points of the wave are marked, such as by setting them to 1. By identifying the information of the markings in the wave overlay map, the edge of the wave is determined, and the position of each pixel in the edge of the wave is extracted to obtain the corresponding position curve.
[0054] like Figure 3 As shown, to obtain a specific frame of wave animation footage, a coordinate system is constructed based on this frame. For example, the length and width of the image are used as the vertical and horizontal axes, as shown by the U and V axes in the figure. This coordinate system formed by the two axes can be considered as the UV coordinate system of the beach model. The position of the wave edge can be expressed as v = f(u). That is, for a certain point on the beach, based on the UV coordinates of that point, the v coordinate of the wave can be found through f(u). Then, by comparing the size of the V coordinate of the beach and the v coordinate of the wave, it can be determined whether the point is covered by the wave.
[0055] Due to the irregular nature of ocean waves, f() may not be expressible mathematically. However, we can record the v value at intervals along the u-axis (discrete sampling) to obtain a set of (Un, Vn) data. Arranging this data in ascending order of Un, we extract the corresponding Vn, resulting in an array of V1, V2…Vn. This array can effectively describe the edge of the ocean wave and can also be considered as data from a specific row of a texture.
[0056] 203. Sort the curves at each position in chronological order in the second preset direction to obtain the wave animation texture corresponding to the wave animation material. The second preset direction is perpendicular to the first preset direction.
[0057] The first preset direction and the second preset direction are the horizontal resolution and vertical resolution of the texture, respectively.
[0058] according to Figure 3 After extracting the position curves corresponding to the wave edges in each frame using the method described in the previous section, the Vn array at different times is discretely sampled, and the texture is filled row by row from top to bottom according to the time sequence to obtain a wave animation texture that saves the position of the wave edges in the entire animation. That is, the vertical axis of this wave animation texture represents the progress of the animation (time), and the horizontal axis represents the height of the wave edges.
[0059] Specifically, the process involves scanning upwards from the bottom of the wave overlay map until the first pixel marked as 1 is found, and then drawing the edge of the wave. This process continues until all pixels marked as 1 are identified, at which point the position curve of the wave edge in the current frame is obtained.
[0060] Furthermore, based on the current animation time point, the obtained position curves are filled into the wave animation texture until the position curves of all frames of the entire wave animation are extracted and superimposed onto the corresponding positions in the texture, thus obtaining the final wave animation texture.
[0061] 204. Determine the rendering position of the waves and the target time for the wave images during the playback of the wave animation footage.
[0062] Based on the inference model of wave animation in the system, the real-time time of the video scene and the position where the edge of the wave effect should be located are determined, and this real-time realization and position are used as the target time and rendering position of the wave animation.
[0063] Understandably, the overall game scene runs in real time after the game starts. That is, the entire game scene data runs in the background of the game. The terminal's display screen determines the currently displayed scene animation based on the character's position and display range. When there is a wave effect in the displayed scene animation, the time of the wave effect is retrieved from the game's background as the target time, as well as the position of the wave edge corresponding to the target time. The rendering position here is an array, which includes multiple position coordinates.
[0064] 205. Based on the rendering location and target time, match the position information of the wave edges that meet the preset conditions from the wave animation texture.
[0065] It should be noted that the wave animation texture is obtained based on the wave animation texture generation method provided in the above embodiments, and will not be repeated here.
[0066] Using the target time and rendering location as indexes, the corresponding wave edge position curves are matched from the wave animation texture. Then, the position curves are compared with the rendering location. Based on the comparison results, the position curve of the wave edge with the most recent time is selected from the wave animation texture as the position information.
[0067] Specifically, based on the rendering location and the target time, the corresponding position curve is matched from the wave animation texture, and it is determined whether the position curve is covered by the waves; based on the determination result, the position curve closest to the target time is selected from the wave animation texture, and the corresponding position information is extracted.
[0068] Understandably, the corresponding position curve is first matched from the wave animation texture based on the target time, and then the position curve is matched with the rendering position to determine whether the rendering position is covered by the waves. If it is covered, the beach humidity of the target model is determined to be 1.
[0069] If no coverage is required, then below the position curve, select a position curve as the target position curve. The time of this target position curve is closest to the target time, and extract the coordinate information corresponding to this target position curve as the position information.
[0070] 206. Calculate the humidity corresponding to each pixel on the beach model based on location information and target time.
[0071] In this embodiment, after determining the target location curve, the dynamic change stage of the waves at the target time is also included, such as the receding wave stage and the surfing stage. The humidity calculation method is determined according to the corresponding dynamic change stage, and the humidity at the rendering location is calculated using the location information and the target time.
[0072] Specifically, based on the difference between the time in the location information and the target time, the humidity of the beach in the target model is calculated. This can be understood as follows: based on the UV coordinates of the beach model and the current wave animation time, the generated texture is sampled to determine if the beach is under the waves. If not, according to the set precision, previous points are gradually sampled to find the most recent point covered by waves, and the time difference is calculated, which represents how long the beach has been drying. This difference is then divided by the set time required for complete drying to obtain the degree of dryness, i.e., 1 - humidity.
[0073] In practical applications, if the target time is during the ebb tide phase, the humidity is calculated based on the difference between the target time and the time in the location information, taking into account the humidity reduction pattern during ebb tide. If the target time is during the surfing phase, the calculated humidity is subtracted from the full humidity value of 1.
[0074] 207. Render each pixel on the beach model according to the parameter change process so that the effect of the beach model matches the effect of the wave animation material.
[0075] The method provided in this embodiment identifies the position of the wave edge in each frame of the wave animation material, generates a position curve, and then superimposes the position curves of each frame onto a coordinate system in chronological order, i.e., onto a single texture map, to obtain the wave animation texture map of the wave animation material. Texture maps obtained in this way have a small footprint and can be used directly in subsequent applications without requiring secondary processing of the information in the texture map, reducing resource usage and improving operational efficiency.
[0076] Furthermore, humidity is calculated using a texture that extracts only the position curves of the wave edges. Since the texture used here is a pre-calculated resource image and only carries the position curves, the space occupied by the texture is greatly reduced. During runtime, the computation is reduced by using pre-calculated resources.
[0077] The method for generating wave effects in embodiments of the present invention has been described above. The apparatus for generating wave effects in embodiments of the present invention will be described below. Please refer to [link / reference]. Figure 4 One embodiment of the wave effect generation device in this invention includes:
[0078] Extraction module 410 is used to determine wave animation material in the game, wherein the wave animation material includes multiple frames of wave images, each frame of wave image includes the edge of the wave between the wave and the beach model; and based on the position points on the wave edge, determine the position curve used to represent the edge of the wave in the multiple frames of wave images;
[0079] The generation module 420 is used to generate a wave animation texture corresponding to the wave animation material based on the position curves, wherein the time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material;
[0080] The calculation module 430 is used to determine, based on the wave animation texture, the position change process of each pixel on the beach model relative to the edge of the wave during the playback of the wave animation material, and to determine the parameter change process of the performance parameters corresponding to each pixel during the position change process;
[0081] The rendering module 440 is used to render each pixel on the beach model according to the parameter change process, so that the effect of the beach model matches the effect of the wave animation material.
[0082] The extraction module 410 described above is specifically used for:
[0083] Based on the sampling points pre-set on the beach model, the position points of the wave edges in each frame of wave image are determined, and position curves for referring to the wave edges in the multiple frames of wave images are constructed according to the time sequence of each frame of wave image.
[0084] The extraction module 410 mentioned above includes:
[0085] The identification unit 411 is used to identify whether the sampling points in each frame of the wave image are covered by the waves based on the sampling points pre-set on the beach model, and to obtain the wave coverage map of each frame of the wave image.
[0086] Extraction unit 412 is used to extract the position points of the edges covered by waves in each of the wave coverage images and generate position curves for referring to the edges of the waves in the multi-frame wave images.
[0087] The extraction unit 412 described above is specifically used for:
[0088] Query the target pixels covered by waves in each of the wave coverage maps according to the first preset direction to obtain the position points of the wave edge;
[0089] By sequentially connecting the location information of each location point in the same wave coverage map according to spatial position order, a position curve is obtained to represent the edge of the waves in the multi-frame wave images.
[0090] The aforementioned generation module 420 is specifically used for:
[0091] The position curves are sorted in chronological order along a second preset direction to obtain the wave animation texture corresponding to the wave animation material. The second preset direction is perpendicular to the first preset direction.
[0092] The first preset direction and the second preset direction mentioned above are the horizontal resolution and vertical resolution of the texture, respectively.
[0093] The aforementioned calculation module 430 includes:
[0094] The determining unit 431 is used to determine the rendering position of the waves and the target time of the wave image during the playback of the wave animation material;
[0095] Matching unit 432 is used to match the position information of the wave edge that meets preset conditions from the wave animation texture based on the rendering position and the target time;
[0096] The calculation unit 433 is used to calculate the humidity corresponding to each pixel on the beach model based on the location information and the target time.
[0097] The matching unit 432 mentioned above is specifically used for:
[0098] Based on the rendering location and the target time, the corresponding position curve is matched from the wave animation texture, and it is determined whether the position curve is covered by the waves.
[0099] Based on the judgment result, the position curve closest to the target time is selected from the wave animation texture, and the corresponding position information is extracted.
[0100] The aforementioned calculation unit 433 is specifically used for:
[0101] Based on the difference between the time in the location information and the target time, the humidity of the beach in the target model is calculated.
[0102] In this embodiment of the invention, the position of the wave edge in each frame of the wave animation material is identified, a position curve is generated, and then the position curves of each frame are superimposed onto a coordinate system in chronological order, i.e., superimposed onto a texture map, to obtain the wave animation texture map of the wave animation material. The texture map obtained in this way has a small space occupation, and can be used in subsequent applications without secondary processing of the information in the texture map, reducing the resources called up during application and improving running efficiency.
[0103] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the methods provided in any of the above embodiments. This electronic device can be a server or a terminal device.
[0104] See Figure 5 As shown, the electronic 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 method for generating wave effects.
[0105] Furthermore, Figure 5 The electronic device shown also includes a bus 502 and a communication interface 503. The processor 500, the communication interface 503 and the memory 501 are connected via the bus 502.
[0106] The memory 501 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 503 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 502 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0107] The processor 500 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 500 or by instructions in software form. The processor 500 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may 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 gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 501. The processor 500 reads the information from memory 501 and, in conjunction with its hardware, completes the steps of the wave effect generation method.
[0108] The wave animation material in the game is determined, wherein the wave animation material includes multiple frames of wave images, and each frame of wave image includes the edge of the wave between the wave and the beach model;
[0109] Based on the position points on the edge of the waves, determine the position curves of the wave edges in the multi-frame wave images;
[0110] Based on the position curves, a wave animation texture corresponding to the wave animation material is generated, wherein the time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material;
[0111] Based on the wave animation texture, the position change process of each pixel on the beach model relative to the edge of the wave is determined during the playback of the wave animation material, and the parameter change process of the corresponding performance parameters of each pixel during the position change process is determined.
[0112] The model renders each pixel on the beach according to the parameter change process, so that the effect of the beach model matches the effect of the wave animation material.
[0113] The above-mentioned determination of the position curve representing the edge of the waves in the multi-frame wave image based on the position points on the edge of the waves includes:
[0114] Based on the sampling points pre-set on the beach model, the position points of the wave edges in each frame of wave image are determined, and position curves for referring to the wave edges in the multiple frames of wave images are constructed according to the time sequence of each frame of wave image.
[0115] The above method, based on sampling points pre-set on a beach model, determines the position points of the wave edges in each frame of wave image, and constructs position curves representing the wave edges in the multiple frames of wave images according to the temporal sequence of each frame, including:
[0116] Based on the sampling points pre-set on the beach model, it is determined whether the sampling points in each frame of the wave image are covered by the waves, thus obtaining the wave coverage map of each frame of the wave image.
[0117] Extract the location points of the edges covered by waves in each of the wave coverage images, and generate position curves to represent the wave edges in the multi-frame wave images.
[0118] The above-mentioned extraction of the position points of the edges covered by waves in each of the wave coverage images, and the generation of position curves to represent the wave edges in the multi-frame wave images, includes:
[0119] Query the target pixels covered by waves in each of the wave coverage maps according to the first preset direction to obtain the position points of the wave edge;
[0120] By sequentially connecting the location information of each location point in the same wave coverage map according to spatial position order, a position curve is obtained to represent the edge of the waves in the multi-frame wave images.
[0121] The above-mentioned generation of wave animation textures corresponding to the wave animation material based on the position curve includes:
[0122] The position curves are sorted in chronological order along a second preset direction to obtain the wave animation texture corresponding to the wave animation material. The second preset direction is perpendicular to the first preset direction.
[0123] The first preset direction and the second preset direction mentioned above are the horizontal resolution and vertical resolution of the texture, respectively.
[0124] Based on the aforementioned wave animation texture, the method determines the positional change of each pixel on the beach model relative to the edge of the waves during the playback of the wave animation material, and determines the parameter change process of the corresponding performance parameters of each pixel during the positional change process, including:
[0125] Determine the rendering position of the waves and the target time for the wave images during the playback of the wave animation material;
[0126] Based on the rendering location and the target time, the position information of the wave edge that meets the preset conditions is matched from the wave animation texture;
[0127] The humidity corresponding to each pixel on the beach model is calculated based on the location information and the target time.
[0128] The above-mentioned method of matching the position information of wave edges that meet preset conditions from the wave animation texture based on the rendering position and the target time includes:
[0129] Based on the rendering location and the target time, the corresponding position curve is matched from the wave animation texture, and it is determined whether the position curve is covered by the waves.
[0130] Based on the judgment result, the position curve closest to the target time is selected from the wave animation texture, and the corresponding position information is extracted.
[0131] The above calculation of the humidity corresponding to each pixel on the beach model based on the location information and the target time includes:
[0132] Based on the difference between the time in the location information and the target time, the humidity of the beach in the target model is calculated.
[0133] In summary, by extracting the position curves of the wave edges from each frame of the wave animation footage, and sorting the extracted position curves in chronological order, a wave animation texture is obtained. This wave animation texture actually only contains the coordinate information of the wave edges from multiple frames of animation. Compared to existing textures, this significantly reduces the amount of device resources required, thereby reducing performance overhead and improving operational efficiency when applications access resources subsequently.
[0134] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the steps of a method for generating wave effects.
[0135] The wave animation material in the game is determined, wherein the wave animation material includes multiple frames of wave images, and each frame of wave image includes the edge of the wave between the wave and the beach model;
[0136] Based on the position points on the edge of the waves, determine the position curves of the wave edges in the multi-frame wave images;
[0137] Based on the position curves, a wave animation texture corresponding to the wave animation material is generated, wherein the time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material;
[0138] Based on the wave animation texture, the position change process of each pixel on the beach model relative to the edge of the wave is determined during the playback of the wave animation material, and the parameter change process of the corresponding performance parameters of each pixel during the position change process is determined.
[0139] The model renders each pixel on the beach according to the parameter change process, so that the effect of the beach model matches the effect of the wave animation material.
[0140] The above-mentioned determination of the position curve representing the edge of the waves in the multi-frame wave image based on the position points on the edge of the waves includes:
[0141] Based on the sampling points pre-set on the beach model, the position points of the wave edges in each frame of wave image are determined, and position curves for referring to the wave edges in the multiple frames of wave images are constructed according to the time sequence of each frame of wave image.
[0142] The above method, based on sampling points pre-set on a beach model, determines the position points of the wave edges in each frame of wave image, and constructs position curves representing the wave edges in the multiple frames of wave images according to the temporal sequence of each frame, including:
[0143] Based on the sampling points pre-set on the beach model, it is determined whether the sampling points in each frame of the wave image are covered by the waves, thus obtaining the wave coverage map of each frame of the wave image.
[0144] Extract the location points of the edges covered by waves in each of the wave coverage images, and generate position curves to represent the wave edges in the multi-frame wave images.
[0145] The above-mentioned extraction of the position points of the edges covered by waves in each of the wave coverage images, and the generation of position curves to represent the wave edges in the multi-frame wave images, includes:
[0146] Query the target pixels covered by waves in each of the wave coverage maps according to the first preset direction to obtain the position points of the wave edge;
[0147] By sequentially connecting the location information of each location point in the same wave coverage map according to spatial position order, a position curve is obtained to represent the edge of the waves in the multi-frame wave images.
[0148] The above-mentioned generation of wave animation textures corresponding to the wave animation material based on the position curve includes:
[0149] The position curves are sorted in chronological order along a second preset direction to obtain the wave animation texture corresponding to the wave animation material. The second preset direction is perpendicular to the first preset direction.
[0150] The first preset direction and the second preset direction mentioned above are the horizontal resolution and vertical resolution of the texture, respectively.
[0151] Based on the aforementioned wave animation texture, the method determines the positional change of each pixel on the beach model relative to the edge of the waves during the playback of the wave animation material, and determines the parameter change process of the corresponding performance parameters of each pixel during the positional change process, including:
[0152] Determine the rendering position of the waves and the target time for the wave images during the playback of the wave animation material;
[0153] Based on the rendering location and the target time, the position information of the wave edge that meets the preset conditions is matched from the wave animation texture;
[0154] The humidity corresponding to each pixel on the beach model is calculated based on the location information and the target time.
[0155] The above-mentioned method of matching the position information of wave edges that meet preset conditions from the wave animation texture based on the rendering position and the target time includes:
[0156] Based on the rendering location and the target time, the corresponding position curve is matched from the wave animation texture, and it is determined whether the position curve is covered by the waves.
[0157] Based on the judgment result, the position curve closest to the target time is selected from the wave animation texture, and the corresponding position information is extracted.
[0158] The above calculation of the humidity corresponding to each pixel on the beach model based on the location information and the target time includes:
[0159] Based on the difference between the time in the location information and the target time, the humidity of the beach in the target model is calculated.
[0160] In summary, by extracting the position curves of the wave edges from each frame of the wave animation footage, and sorting the extracted position curves in chronological order, a wave animation texture is obtained. This wave animation texture actually only contains the coordinate information of the wave edges from multiple frames of animation. Compared to existing textures, this significantly reduces the amount of device resources required, thereby reducing performance overhead and improving operational efficiency when applications access resources subsequently.
[0161] The computer program product of the wave effect generation method, apparatus, device and storage medium 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 methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0162] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0163] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0164] If the aforementioned functions are implemented as 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 this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0165] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0166] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for generating ocean wave effects, characterized in that, The method includes: The wave animation material in the game is determined, wherein the wave animation material includes multiple frames of wave images, and each frame of wave image includes the edge of the wave between the wave and the beach model; Based on the position points on the edge of the waves, determine the position curves of the wave edges in the multi-frame wave images; Based on the position curves, a wave animation texture corresponding to the wave animation material is generated, wherein the time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material; Based on the wave animation texture, the position change process of each pixel on the beach model relative to the edge of the wave is determined during the playback of the wave animation material, and the parameter change process of the corresponding performance parameters of each pixel during the position change process is determined. The model renders each pixel on the beach according to the parameter change process, so that the effect of the beach model matches the effect of the wave animation material.
2. The method for generating wave effects according to claim 1, characterized in that, The step of determining the position curve of the wave edge in the multi-frame wave image based on the position points on the wave edge includes: Based on the sampling points pre-set on the beach model, the position points of the wave edges in each frame of wave image are determined, and position curves for referring to the wave edges in the multiple frames of wave images are constructed according to the time sequence of each frame of wave image.
3. The method for generating wave effects according to claim 2, characterized in that, The process involves determining the position points of the wave edges in each frame of the wave image based on pre-set sampling points on the beach model, and constructing position curves representing the wave edges in the multiple frames of the wave image according to the temporal sequence of each frame. This includes: Based on the sampling points pre-set on the beach model, it is determined whether the sampling points in each frame of the wave image are covered by the waves, thus obtaining the wave coverage map of each frame of the wave image. Extract the location points of the edges covered by waves in each of the wave coverage images, and generate position curves to represent the wave edges in the multi-frame wave images.
4. The method for generating wave effects according to claim 3, characterized in that, The step of extracting the position points of the edges covered by waves in each of the wave coverage images and generating position curves to represent the wave edges in the multi-frame wave images includes: Query the target pixels covered by waves in each of the wave coverage maps according to the first preset direction to obtain the position points of the wave edge; By sequentially connecting the location information of each location point in the same wave coverage map according to spatial position order, a position curve is obtained to represent the edge of the waves in the multi-frame wave images.
5. The method for generating wave effects according to any one of claims 1-4, characterized in that, The step of generating the wave animation texture corresponding to the wave animation material based on the position curve includes: The position curves are sorted in chronological order along a second preset direction to obtain the wave animation texture corresponding to the wave animation material. The second preset direction is perpendicular to the first preset direction.
6. The method for generating wave effects according to claim 5, characterized in that, The first preset direction and the second preset direction are the horizontal resolution and vertical resolution of the texture, respectively.
7. The method for generating wave effects according to claim 6, characterized in that, The step of determining the positional change of each pixel on the beach model relative to the edge of the waves during the playback of the wave animation material, based on the wave animation texture, and determining the parameter change process of the corresponding performance parameters of each pixel during the positional change process, includes: Determine the rendering position of the waves and the target time for the wave images during the playback of the wave animation material; Based on the rendering location and the target time, the position information of the wave edge that meets the preset conditions is matched from the wave animation texture; The humidity corresponding to each pixel on the beach model is calculated based on the location information and the target time.
8. The method for generating wave effects according to claim 7, characterized in that, The step of matching the position information of the wave edges that meet preset conditions from the wave animation texture based on the rendering position and the target time includes: Based on the rendering location and the target time, the corresponding position curve is matched from the wave animation texture, and it is determined whether the position curve is covered by the waves. Based on the judgment result, the position curve closest to the target time is selected from the wave animation texture, and the corresponding position information is extracted.
9. The method for generating wave effects according to claim 7, characterized in that, The step of calculating the humidity corresponding to each pixel on the beach model based on the location information and the target time includes: Based on the difference between the time in the location information and the target time, the humidity of the beach in the target model is calculated.
10. A device for generating ocean wave effects, characterized in that, The device includes: An extraction module is used to determine wave animation materials in the game, wherein the wave animation materials include multiple frames of wave images, each frame of wave image includes the edge of the wave between the wave and the beach model; and based on the position points on the wave edge, a position curve is determined to represent the wave edge in the multiple frames of wave images; The generation module is used to generate a wave animation texture corresponding to the wave animation material based on the position curves, wherein the time order of each position curve in the wave animation texture is consistent with the time order of each frame of wave images in the wave animation material; The calculation module is used to determine, based on the wave animation texture, the positional change process of each pixel on the beach model relative to the edge of the wave during the playback of the wave animation material, and to determine the parameter change process of the performance parameters corresponding to each pixel during the positional change process; The rendering module is used to render each pixel on the beach model according to the parameter change process, so that the effect of the beach model matches the effect of the wave animation material.
11. An electronic device, characterized in that, The electronic device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the electronic device to execute the method for generating the wave effect as described in any one of claims 1-9.
12. A computer-readable storage medium storing instructions thereon, characterized in that, When the instruction is executed by the processor, it implements the method for generating the wave effect as described in any one of claims 1-9.