Sky animation processing method, device, electronic device and storage medium

The texture offset is calculated through the flow map algorithm, combined with the geometric information of the sky ball model, and continuously sky animation frames are generated, solving the problem of sky rendering distortion and misunderstanding on mobile devices, real dynamic sky effects are achieved.

CN114723861BActive Publication Date: 2025-08-08NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210220083.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-08
Publication Date
2025-08-08
Estimated Expiration
2042-03-08

AI Technical Summary

Technical Problem

In the prior art, the sky processing scheme on mobile devices lacks dynamic factors, resulting in distortion of sky rendering effects, and problems of mismatch and incoherence in vertical viewing angles are prone to occur.

Method used

The flow direction map algorithm is used to calculate the texture offset, combine the wind direction, tangent vector and sub-normal vector of the sky ball model to generate an animation frame of the sky animation, and achieve continuous changes in the sky through loop periods and replacement nodes.

Benefits of technology

Improves the problem of mismatch and map inconsistency in vertical viewing, providing a more realistic dynamic sky effect while taking into account both equipment performance and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114723861B_ABST
    Figure CN114723861B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for processing sky animation, including: obtaining a sky texture map; calculating the texture offset of the sky texture map according to a flow mapping algorithm, and adjusting the sky texture map according to the texture offset; generating corresponding animation frames of the sky animation according to the adjusted sky texture map, determining the cycle of the sky animation, determining the replacement node of the animation frame corresponding to the replaced sky texture map according to the cycle, and replacing the animation frame at the replacement node. The present application improves the traditional method of calculating the texture offset by utilizing the design ideas of the flow mapping algorithm, thereby improving the problems of goofs and discontinuous mapping in the vertical perspective, and then determines the animation change cycle and the replacement node of the replaced animation frame, thereby achieving the effect of continuous change of the sky by alternating visibility, thereby providing a more realistic dynamic sky processing solution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of animation processing technology, and in particular to a sky animation processing method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of production technology in fields such as gaming and 3D animation, scenes are becoming increasingly realistic. The sky is an essential element in most games and animations. Excellent sky rendering not only enhances the game's visuals but also increases players' immersion.

[0003] Traditional sky processing solutions on mobile devices typically use a realistic sky sphere texture overlaid on a sky sphere model. However, such skies are completely static or can only rotate briefly. Furthermore, current sky sphere texture solutions lack the inherent dynamics of the sky. Although the rotating sky sphere texture adds a dynamic effect after applying a texture offset, the overall effect is still distorted. Summary of the Invention

[0004] In view of this, the present application proposes a sky animation processing method, device, electronic device and storage medium, so as to provide a more realistic dynamic sky processing solution for the game and animation production fields.

[0005] Based on the above objectives, this application provides a method for processing sky animation, including:

[0006] Get the sky texture map;

[0007] Calculating a texture offset of the sky texture map according to a flow mapping algorithm, and adjusting the sky texture map according to the texture offset;

[0008] Generate corresponding sky animation frames according to the adjusted sky texture map, determine the cycle period of the sky animation, determine the replacement nodes of the animation frames corresponding to the replaced sky texture map according to the cycle period, and replace the animation frames at the replacement nodes to generate continuous sky animation.

[0009] In some embodiments, the sky texture map is a sky sphere model texture map;

[0010] The calculating the texture offset of the sky texture map according to the flow mapping algorithm includes:

[0011] Determining a wind direction vector, a tangent vector of a model vertex, and a binormal vector of a model vertex of the sky sphere model texture map;

[0012] The wind direction vector, the tangent vector, and the binormal vector are normalized, so that the normalized wind direction vector is dot-multiplied by the normalized tangent vector and the binormal vector to obtain the texture offset.

[0013] In some embodiments, the sky sphere model texture map is a two-dimensional texture map;

[0014] The texture offset is obtained by:

[0015]

[0016] in, and Two-dimensional texture maps The texture offset of the coordinate axis is Texture offset for the coordinate axis, is the wind direction vector, is the tangent vector, is the binormal vector.

[0017] In some implementations, determining the replacement node of the animation frame corresponding to the sky texture map to be replaced according to the cycle period is specifically:

[0018] When half of the cycle is determined, the corresponding animation frame of the sky animation is the replacement node.

[0019] In some embodiments, generating a continuous sky animation includes:

[0020] According to the replacement node, weighted processing is performed on the texture offsets of the adjusted sky texture map and the adjusted replacement sky texture map respectively to determine a texture offset value of a sky animation and generate the sky animation.

[0021] In some implementations, determining the texture offset value of the sky animation is specifically as follows:

[0022]

[0023] in, and They are the texture offset value of the adjusted sky texture map and the texture offset value of the adjusted replacement sky texture map, and The sky texture map The texture offset of the coordinate axis is Texture offset for the coordinate axis, and are the weighting factors of the adjusted sky texture map and the adjusted replacement sky texture map, respectively. , , is the frequency parameter.

[0024] In some embodiments, before performing weighted processing on the texture offsets of the adjusted sky texture map and the adjusted replacement sky texture map, the method further includes:

[0025] Obtain cloud flow velocity parameters, and adjust the weighting factor according to the cloud flow velocity parameters.

[0026]

[0027] in, is the cloud flow velocity parameter.

[0028] In some embodiments, generating a continuous sky animation further includes:

[0029] Obtaining a camera direction vector, and performing normalization processing on the camera direction vector;

[0030] The normalized camera direction vector is used to perform weighted processing on the texture offset value of the sky animation.

[0031] In some implementations, the weighted processing of the texture offset value of the sky animation using the normalized camera direction vector is specifically as follows:

[0032]

[0033] in, is the texture offset value of the sky animation, is the camera direction vector, Indicates the selection of the camera direction vector Components are calculated.

[0034] In some implementations, determining the cycle period of the sky animation includes:

[0035] The cycle period is determined according to a cosine function.

[0036] Based on the same concept, the present application also provides a sky animation processing device, including:

[0037] Acquisition module, used to obtain sky texture map;

[0038] an adjustment module, configured to calculate a texture offset of the sky texture map according to a flow mapping algorithm, and adjust the sky texture map according to the texture offset;

[0039] A generation module is used to generate animation frames of the corresponding sky animation based on the adjusted sky texture map, determine the cycle period of the sky animation, determine the replacement node of the animation frame corresponding to the replaced sky texture map based on the cycle period, and replace the animation frame at the replacement node to generate a continuous sky animation.

[0040] Based on the same concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above methods when executing the program.

[0041] Based on the same concept, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to implement any of the methods described above.

[0042] As can be seen from the above, the present application provides a method, device, electronic device and storage medium for processing sky animation, including: obtaining a sky texture map; calculating the texture offset of the sky texture map according to a flow mapping algorithm, and adjusting the sky texture map according to the texture offset; generating corresponding animation frames of the sky animation according to the adjusted sky texture map, determining the cycle of the sky animation, determining the replacement nodes of the animation frames corresponding to the replaced sky texture map according to the cycle, and replacing the animation frames at the replacement nodes to generate continuous sky animation. The present application improves the traditional method of calculating the texture offset by utilizing the design ideas of the flow mapping algorithm, thereby improving the problems of goofs and discontinuous mapping in the vertical perspective, and then determines the animation change cycle and the replacement nodes of the replaced animation frames, thereby achieving the effect of continuous change of the sky in an alternating manner, thereby providing a more realistic dynamic sky processing solution in a relatively cheap manner that takes into account both effect and performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0044] Figure 1 A schematic diagram of a material texture proposed in an embodiment of the present application;

[0045] Figure 2 A schematic diagram of a texture offset effect in a sky ball mapping solution proposed in an embodiment of the present application;

[0046] Figure 3 A flowchart of a method for processing sky animation proposed in an embodiment of the present application;

[0047] Figure 4 A schematic diagram of the offset effect of the longitudinal texture offset in the texture map proposed in an embodiment of the present application;

[0048] Figure 5 A schematic diagram comparing the calculation effects of the traditional texture offset proposed in an embodiment of the present application and the texture offset of the present application;

[0049] Figure 6 A schematic diagram comparing the mapping boundary effects of the traditional texture offset proposed in an embodiment of the present application and the texture offset of the present application;

[0050] Figure 7 This is a schematic diagram of the effect of the sky animation rolling along the wind direction proposed in an embodiment of the present application;

[0051] Figure 8 This is a schematic diagram of the effect of the improved sky animation rolling along the wind direction proposed in an embodiment of the present application;

[0052] Figure 9 A schematic diagram of the structure of a sky animation processing device proposed in an embodiment of the present application;

[0053] Figure 10 This is a schematic diagram of the electronic device structure proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of this specification more clear, this specification is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0055] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the usual meanings understood by people with ordinary skills in the field to which this application belongs. The "first", "second" and similar words used in the embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements, objects or method steps that appear before the word cover the elements, objects or method steps listed after the word and their equivalents, without excluding other elements, objects or method steps. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0056] As mentioned in the background technology section, in realistic games or animations on consoles or terminals, sky rendering generally uses a comprehensive solution based on physical scattering calculations. This includes calculating the sky derived from atmospheric scattering and volumetric clouds derived from scattering by dense water droplets at high altitudes. To further enhance the overall physical realism, many games or animations also incorporate effects such as volumetric fog, atmospheric fog, and localized fog. While these effects are very impressive, they are not cheap and the performance overhead they incur is also significant. Even the console and terminal platforms may make some compromises in the effects to balance performance, making this approach even more difficult to utilize on mobile devices with more limited functionality.

[0057] Traditional realistic games or animations on mobile devices, if there is no need for day and night changes, generally use a realistic sky ball map to cover the sky ball model. This rendering solution is extremely cheap and the effect is quite good, but it has a serious distortion problem, that is, there is no dynamic factor and the sky is completely still. Based on this solution, the iterative version that emerged is to use texture animation on the sky ball map sampling to give a feeling that the sky is rotating, but the real sky does not rotate, but flows in one direction. Specifically, the traditional sky ball mapping solution is to wrap the map on the model according to the sky ball model texture, such as Figure 1 As shown, the sticker here Figure 1 It is usually a very high-resolution HDR map, and is usually a real-world scene material. Using this method to render the sky, the static effect presented is more realistic. This implementation method is extremely cheap. Each pixel does not require special lighting calculations when rendering. It only needs to sample the map once. If there are atmospheric fog and height fog effect requirements, some scattering analysis calculations may be added. However, this sky rendering solution does not have any dynamic effects. If the scene in the game adds some wind factors, such as branches and leaves blown by the wind, but the sky is still, there will be goofs. Generally, in order to alleviate this problem, such as Figure 2 As shown in , a texture offset effect that accumulates over time will be added when the texture is sampled. Figure 2 As shown in a, add a texture offset to the right (as shown by the arrow in the figure) to the map, so as to obtain a Figure 2The offset texture map shown in Figure b. However, because the texture is wrapped around the sky sphere model, this simple texture offset animation will cause the sky to rotate, but only slightly. This shows that, given the limited performance of current mobile devices, neither atmospheric scattering combined with volumetric clouds nor other cloud rendering methods based on various noise algorithms are desirable. However, as mentioned above, a single sky sphere mapping solution lacks the inherent dynamics of the sky. Although the rotating sky sphere texture adds a dynamic effect to the sky after the texture offset is added, it is still distorted. In the real world, the movement of the sky is the result of clouds high in the sky slowly moving along a specific wind direction, rather than rotating along an axis perpendicular to the viewer's perspective. Therefore, the challenge facing current mobile sky processing solutions is how to improve the dynamic effects of the sky sphere mapping solution, allowing the entire sky to move continuously in a single direction while minimizing artifacts.

[0058] In view of the above actual situation, the embodiment of the present application proposes a sky animation processing solution, which improves the traditional texture offset calculation method by utilizing the design idea of the flow mapping algorithm, thereby improving the problems of blobs and mapping incoherence in the vertical perspective. Then, by determining the animation change cycle, the replacement node for the replacement animation frame is determined, thereby achieving the effect of continuous change of the sky in an alternating manner. In this way, a more realistic dynamic sky processing solution is provided in a relatively cheap way that takes into account both effect and performance.

[0059] like Figure 3 FIG. 1 is a flow chart of a method for processing sky animation proposed in this application, which specifically includes:

[0060] Step 101: Get the sky texture map.

[0061] In this step, the sky texture Figure 1 Generally, it can be a spherical texture map or a flat texture map of the sky, etc., which can be directly obtained through the sky model. In a specific embodiment, due to the overall performance overhead of the mobile device application, the performance share that can be allocated to the sky rendering part is extremely limited. In order to ensure both the effect performance and the performance issue, the mobile device generally adopts the traditional sky spherical mapping solution, and then considers how to make the sky move without parallax. Of course, in some specific application scenarios or on some specific mobile devices, it is also possible to use a flat texture map or a sky rendering method similar to that of the host or terminal.

[0062] Step 102: Calculate the texture offset of the sky texture map according to a flow mapping algorithm, and adjust the sky texture map according to the texture offset.

[0063] In this step, the flow mapping algorithm is called the FlowMap algorithm. A FlowMap is essentially a texture that records 2D vector information. The colors on the FlowMap (usually the red and green channels, or RG channels) record the direction of the vector field at that location, giving a point on the model the appearance of quantitative flow. Flow effects are simulated by offsetting the UV values in the shader before sampling the texture. Currently, all image files can be two-dimensional planes. The horizontal direction in a plane is U, and the vertical direction is V. Using this flat, two-dimensional UV coordinate system, we can locate any pixel in the image. UV mapping, or UV, stands for UV texture coordinates (similar to the x, y, and z axes of a spatial model), and defines the position of each point in the image. These points are linked to the 3D image model to determine the placement of the surface texture. UV mapping precisely maps each point in the image to the surface of the model object. Software performs smooth interpolation of the gaps between points. This is what is known as UV mapping.

[0064] After that, the texture offset is the value of the texture offset (UV Offset). UV Offset (that is, texture offset) is a technical means widely used in graphics development. By using texture offset, texture animation can be achieved, that is, the dynamic effect of animated map scrolling. In a specific embodiment, the texture animation on the traditional sky sphere model is simply to apply a continuously cumulative offset to the horizontal texture. The performance of this texture animation is not realistic. Considering the flow of clouds, there is a certain parallax, that is, clouds at the horizon will move slower, and clouds above the vertical perspective will move faster along the wind direction. Moreover, although the carrier of the sky is a sky sphere geometric model, the real sky should appear like an approximate plane, and the clouds will naturally move approximately horizontally in the direction of the wind. In summary, relying on the sky sphere model as a carrier, in order to achieve realistic texture animation, the offset value of each vertex on the model should generally not be the same. Each offset value generally depends on the spherical position of the point. In this solution, the texture animation of the sky clouds is represented by using the flow mapping algorithm, such as Figure 4 As shown in the figure, the arrows represent the movement in the longitudinal direction of the grain, and the closer to the horizon, the slower the movement should be (e.g. Figure 4 The closer to the horizon, the fewer arrows there are and the larger the distance between them. The closer to the vertical angle, the faster the speed (e.g. Figure 4The closer the arrows are to the vertical position, the smaller the distance between them. Similarly, in the horizontal direction of the texture, the wind is slowest at the ends and fastest on the sides. By using the flow mapping algorithm, the range of glitches above the vertical perspective can be effectively reduced, and glitches are basically eliminated in games and animations. At the same time, the boundaries of the UV map are smoother. Figure 5 As shown, Figure 5 a is the texture offset calculated by the traditional method. It can be seen that Figure 5 There are obvious goofs in the center and upper part of the texture in a; Figure 5 b is the texture offset map obtained after adjusting the texture offset algorithm using the design idea of FlowMap. It can be seen that the traces of goofs are significantly improved.

[0065] In a specific embodiment, a traditional sky sphere mapping solution can be used as a foundation, incorporating the design principles of FlowMap. The wind direction vector is converted to the tangent space of the sky sphere model's vertices. The U and V channels of the converted vector are then used as texture offsets for the sky sphere texture map. Ultimately, the sky texture map is adjusted using the texture offsets to achieve a parallax effect where the sky sphere texture map smoothly moves along the wind direction.

[0066] Step 103: Generate animation frames of the corresponding sky animation based on the adjusted sky texture map, determine the cycle period of the sky animation, determine the replacement nodes of the animation frames corresponding to the replaced sky texture map based on the cycle period, and replace the animation frames at the replacement nodes to generate a continuous sky animation.

[0067] After completing step 102, although the parallax effect of continuously moving the sky ball texture map smoothly along the wind direction is achieved, since the sky texture map itself is a bounded map file, the sky animation generated by the sky texture map will inevitably move to the boundary position of the map after moving in a certain direction, thereby causing a problem. In other words, even if the sky ball texture map can move toward the wind direction, it cannot move continuously, and it is even more impossible to directly and forcibly pull it back to the initial position after moving to a certain extent. In order to pursue more realistic scenes in game and animation production, the sky is generally changed completely and continuously. In order to make this change continuous, in this solution, a smooth cloud effect can be achieved by sampling the sky ball texture map twice and having the corresponding sky animation be replaced based on a cycle period, making it alternately visible and invisible. Specifically, based on the cycle of the sky animation generated by the current sky texture map, after determining the entire cycle of the sky image movement in the sky animation, the sky animation frame corresponding to the appropriate time point within this cycle can be selected based on the specific application scenario. This frame is used as the replacement node. Starting from this frame, the frames following the sky animation are replaced with the animation frames of the replacement sky texture map, and so on. The replacement sky texture map is the same texture map as the current one. The only difference between the two is the starting texture offset. The specific offset is determined by the position of the replacement node in the cycle. This method achieves the effect of continuous sky changes, ultimately generating a continuous sky animation. A frame is the smallest unit of image animation, equivalent to a single frame on a film. A frame is a still image, and consecutive frames form an animation. Simply put, the frame rate is the number of images transmitted in one second. It can also be understood as the number of refreshes per second that a graphics processor can perform, usually expressed in fps (Frames Per Second). Each frame is a still image, and displaying frames in rapid succession creates the illusion of motion. A high frame rate results in smoother, more realistic animation. The more frames per second (fps), the smoother the displayed motion.

[0068] In a specific embodiment, the animation frame is replaced by replacing the node for half the cycle of the current sky animation cycle, and then, it can be set , ,in, is the frequency parameter, is the frequency parameter of the current sky texture map, is the frequency parameter of the alternating sky texture map, To get the decimal point value of a floating point number of x. When it is 0, is 0.5; when When is 0.5, is 0. Among them, This can be determined by combining real-time time parameters such as the current game or animation runtime with pre-set adjustment parameters for the cloud or sky visibility frequency. This allows the texture offset of the two sky texture maps to be calculated, and similarly, a continuous sky animation can be generated using these sky texture maps.

[0069] Finally, the sky animation can be output for storage, display, use or further processing. According to different application scenarios and implementation needs, the specific output method of the sky animation can be flexibly selected.

[0070] For example, for an application scenario in which the method of this embodiment is executed on a single device, the sky animation can be directly output in a displayed manner on the display component (display, projector, etc.) of the current device, so that the operator of the current device can directly see the content of the sky animation from the display component.

[0071] For another example, in an application scenario where the method of this embodiment is executed on a system consisting of multiple devices, the sky animation can be sent to other preset receiving devices within the system, i.e., synchronization terminals, via any data communication method (wired connection, NFC, Bluetooth, Wi-Fi, cellular mobile network, etc.), so that the synchronization terminals can perform subsequent processing. Optionally, the synchronization terminal can be a preset server, which is generally located in the cloud and serves as a data processing and storage center, capable of storing and distributing the sky animation. The recipients of the distribution are terminal devices, and the holders or operators of these terminal devices can be current users, downstream game and animation production personnel, game and animation quality control personnel, etc.

[0072] For another example, in an application scenario where the method of this embodiment is executed on a system composed of multiple devices, the sky animation can be sent directly to a preset terminal device through any data communication method, and the terminal device can be one or more of the ones listed in the preceding paragraphs.

[0073] From the above description, it can be seen that a method for processing sky animation in an embodiment of the present application includes: obtaining a sky texture map; calculating the texture offset of the sky texture map according to a flow mapping algorithm, and adjusting the sky texture map according to the texture offset; generating corresponding animation frames of the sky animation according to the adjusted sky texture map, determining the cycle of the sky animation, determining the replacement nodes of the animation frames corresponding to the replaced sky texture map according to the cycle, and replacing the animation frames at the replacement nodes to generate a continuous sky animation. The present application improves the traditional method of calculating the texture offset by utilizing the design ideas of the flow mapping algorithm, thereby improving the problems of goofs and discontinuous mapping in the vertical perspective, and then determines the change cycle of the animation and determines the replacement nodes of the replaced animation frames, thereby achieving the effect of continuous change of the sky in an alternating manner, thereby providing a more realistic dynamic sky processing solution in a relatively cheap manner that takes into account both effect and performance.

[0074] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of the embodiment of the present application can also be applied in a distributed scenario and completed by multiple devices working together. In the case of such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the method described.

[0075] It should be noted that the above description is of specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0076] In an optional exemplary embodiment, the sky texture map is a sky sphere model texture map; calculating the texture offset of the sky texture map using a flow mapping algorithm includes: determining a wind direction vector, a tangent vector of a model vertex, and a binormal vector of the model vertex of the sky sphere model texture map; and normalizing the wind direction vector, the tangent vector, and the binormal vector, thereby performing a dot multiplication of the normalized wind direction vector with the normalized tangent vector and the binormal vector to obtain the texture offset. In this manner, utilizing the concept of FlowMap, the texture offset is obtained by combining the wind direction vector with the tangent vector and the binormal vector, thereby accurately achieving a parallax effect that allows the sky sphere texture map to smoothly move along the wind direction.

[0077] In this embodiment, the normalized wind direction vector is dot-multiplied by the normalized tangent vector and the binormal vector to obtain the texture offset value of the two-dimensional UV texture map of the sky sphere model map, or the texture offset value of the three-dimensional UVW texture map. Taking the two-dimensional UV texture map, i.e., the two-dimensional texture map, as an example, the specific value can be:

[0078]

[0079] in, and Two-dimensional texture maps The texture offset of the coordinate axis is Texture offset for the coordinate axis, is the wind direction vector, is the tangent vector, is the binormal vector. Represents the dot product of two vectors x and y, Normalizes the x vector. Vector normalization has two forms: converting numbers to decimals between (0, 1) and converting dimensional expressions to dimensionless ones. This technique was developed primarily to facilitate data processing. Mapping data to the range of 0 to 1 is more efficient and convenient, and should be considered within the scope of digital signal processing.

[0080] Finally, this is equivalent to (i.e. the direction vector of the wind direction) is converted to the tangent space of the current model vertex, and the R and G (red and green) channels are taken as UV Offset (i.e. texture offset). At the same time, after UV Offset rendering using this embodiment, the boundaries of the texture map will also become smoother. Figure 6 As shown, Figure 6 a is the boundary effect after UV Offset rendering using the traditional method; Figure 6 b shows the boundary effect after UV Offset rendering using the solution of this embodiment. It can be seen that the smoothness and blurriness of the boundary are greatly improved.

[0081] In an optional exemplary embodiment, determining the replacement node for the animation frame corresponding to the sky texture map to be replaced based on the cycle period specifically involves determining the replacement node at the animation frame of the sky animation corresponding to half the cycle period. This allows full utilization of each sky texture map, and ensures that, within a certain range of sky texture change speeds, no artifacts are caused by the texture animation moving to the texture boundary.

[0082] In this embodiment, since the sizes of different sky texture maps and the movement speeds of the textures in the corresponding animations are generally different in different application scenarios, in order to adapt to more scenarios, the replacement node is usually set at the halfway point of the cycle, that is, the animation frame corresponding to the replacement sky texture map is inserted after the sky animation corresponding to the current sky texture map moves half a cycle, so as to adapt to sky animations of different sizes and different movement speeds as much as possible.

[0083] In an optional exemplary embodiment, the step of generating a continuous sky animation includes:

[0084] According to the replacement node, weighted processing is performed on the texture offsets of the adjusted sky texture map and the adjusted replacement sky texture map respectively to determine a texture offset value of a sky animation and generate the sky animation.

[0085] In a specific embodiment, different texture offsets can be used to sample two sky sphere texture maps with the same flow frequency but staggered by half a cycle, and the sampling results can be interpolated to obtain sky animation. In a specific embodiment, the periodic flow of the sky texture map can use the change period of an algorithm such as the cosine function to determine the specific cycle period, and thereby affect the value of the UV Offset to ultimately achieve alternating display and hiding. In a specific application scenario, the interpolation weights of the two samples can be calculated first,

[0086]

[0087] in, is the interpolation weight, is the frequency parameter of the sky texture map after replacement. The interpolation weight of the other current adjusted sky texture map is similar to this formula, only Replace with Among them, the frequency parameter It can be obtained by combining the time variable of the current real-time game or animation and the adjustment parameters of the cloud visibility frequency input in advance, that is,

[0088]

[0089] in, That is the current real-time time variable, It is the adjustment parameter of the frequency of cloud or sky visibility. After that, the two sampling cycles should be separated by one (i.e. half a cycle), so the two adjusted sky texture maps The values should differ by 0.5, i.e.

[0090]

[0091] in, is the frequency parameter of the current sky texture map, is the frequency parameter of the sky texture map that changes next time. To get the decimal point value of a floating point number of x. When it is 0, is 0.5, when When is 0.5, is 0.

[0092] Afterwards, cooperate , and then calculate the weighting factor of UV Offset. In specific application scenarios, the range of the weighting factor is preferably [-0.5, 0.5], that is,

[0093]

[0094] in, and They are respectively the weighting factors of the current adjusted sky texture map and the adjusted weighting factors of the replacement sky texture map.

[0095] Finally, we get the texture offset values of the two images before and after. The sky animation is generated by analogy calculation based on the texture offset values of the two images before and after. The texture offset value of the sky animation is:

[0096]

[0097] in, and They are the texture offset value of the currently adjusted sky texture map and the texture offset value of the adjusted replacement sky texture map, and The sky texture map The texture offset of the coordinate axis is Texture offset for the coordinate axis, and are the weighting factors of the currently adjusted sky texture map and the adjusted replacement sky texture map, respectively. , , is the frequency parameter.

[0098] In addition, in some other embodiments, if the user specifies a velocity amplitude parameter of the cloud or sky flow, the velocity amplitude parameter of the cloud or sky flow can be applied to the weighting factor based on the above formula, that is, before performing weighting processing on the texture offset of the adjusted sky texture map and the adjusted replacement sky texture map, the following further comprises:

[0099] Obtain cloud flow velocity parameters, and adjust the weighting factor according to the cloud flow velocity parameters.

[0100]

[0101] in, is the cloud flow velocity parameter, which is used in the calculation equation in the computer field. That is , which is an iterative calculation and assignment method.

[0102] In an optional exemplary embodiment, the method of generating a continuous sky animation further includes: obtaining a camera direction vector, and normalizing the camera direction vector; and weighting a texture offset value of the sky animation using the normalized camera direction vector.

[0103] In this embodiment, in some specific scenes, such as relatively open areas, the movement speed of the clouds or sky at the far end of the sky animation (i.e., the skyline or horizon) may still be too fast, and may give the user the feeling that the sky ball map is rolling along the wind direction without the sense of translation parallax. Figure 7 As shown, Figure 7 a is the start screen, Figure 7 b is the picture after the sky animation moves for a certain period. Figure 7 The sky sphere texture in b rolls along the wind direction, with no apparent translational parallax. The problem is most noticeable at the horizon, where distant clouds are severely tilted. To address this, we can use the y component of the normalized ViewDir (camera direction vector) to further weight the UV Offset, making the clouds at the horizon move more slowly.

[0104]

[0105] in, is the texture offset value of the sky animation, is the camera direction vector, Indicates the selection of the camera direction vector Components are calculated.

[0106] Then, in a specific embodiment, when the distant clouds move slowly, another problem will arise, that is, the alternating ghosting will be serious. In this solution, the effect can be further optimized by remapping sampleWeight. Among them, when a certain weight is too low, it is directly truncated to 0, that is, the transition time of alternating appearance and disappearance becomes shorter and faster. However, this will also make the effect slightly stiff. Considering that the clouds at the skyline (that is, the horizon) move slower, the ghosting problem may be more serious, while the ghosting problem directly above the vertical perspective is much smaller. We can still use the y component of ViewDirection (camera direction vector) to weight it, and the new interpolation weight is

[0107]

[0108] in, is the new interpolation weight, To control a floating point number between 0 and 1, when x is less than or equal to 0, it returns 0; when x is greater than or equal to 1, it returns 1; when x is between 0 and 1, it returns the value of x itself.

[0109] Finally, we get Figure 8 The animation effect of the sky animation shown in the figure. Figure 8 a is the start screen, Figure 8 b is the picture after the sky animation moves for a certain period. Figure 8 The sky ball texture map in b rolls along the wind direction, and its time difference problem has been effectively improved. The texture has also become more harmonious, making the sky animation more realistic.

[0110] In an optional exemplary embodiment, determining the cycle period of the sky animation includes: determining the cycle period according to a cosine function.

[0111] In this embodiment, the cycle of sky animation or cloud flow period can be determined by the change period of the cosine function, and this can be used to affect the value of UV Offset to ultimately achieve alternating display and hiding. In specific application scenarios, the cycle of sky animation generally corresponds to the change period of trigonometric functions and can be determined by the input parameters of the cosine function. The period of is 2π. Therefore, the specific value of the corresponding cycle period can be 1. And half a period is 0.5.

[0112] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a sky animation processing device.

[0113] refer to Figure 9 , the sky animation processing device includes:

[0114] The acquisition module 210 is used to acquire a sky texture map.

[0115] The adjustment module 220 is configured to calculate a texture offset of the sky texture map according to a flow mapping algorithm, and adjust the sky texture map according to the texture offset.

[0116] The generation module 230 is used to generate animation frames of the corresponding sky animation based on the adjusted sky texture map, determine the cycle period of the sky animation, determine the replacement node of the animation frame corresponding to the replaced sky texture map based on the cycle period, and replace the animation frame at the replacement node to generate a continuous sky animation.

[0117] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0118] The device of the above embodiment is used to implement the corresponding sky animation processing method in the above embodiment, and has the beneficial effects of the corresponding sky animation processing method embodiment, which will not be repeated here.

[0119] In an optional exemplary embodiment, the sky texture map is a sky sphere model texture map;

[0120] The adjustment module 220 is further configured to:

[0121] Determining a wind direction vector, a tangent vector of a model vertex, and a binormal vector of a model vertex of the sky sphere model texture map;

[0122] The wind direction vector, the tangent vector, and the binormal vector are normalized, so that the normalized wind direction vector is dot-multiplied by the normalized tangent vector and the binormal vector to obtain the texture offset.

[0123] In an optional exemplary embodiment, the sky sphere model texture map is a two-dimensional texture map;

[0124] The adjustment module 220 obtains the texture offset, specifically:

[0125]

[0126] in, and Two-dimensional texture maps The texture offset of the coordinate axis is Texture offset for the coordinate axis, is the wind direction vector, is the tangent vector, is the binormal vector.

[0127] In an optional exemplary embodiment, the generating module 230 is specifically configured to:

[0128] When half of the cycle is determined, the corresponding animation frame of the sky animation is the replacement node.

[0129] In an optional exemplary embodiment, the generating module 230 is further configured to:

[0130] According to the replacement node, weighted processing is performed on the texture offsets of the adjusted sky texture map and the adjusted replacement sky texture map respectively to determine a texture offset value of a sky animation and generate the sky animation.

[0131] In an optional exemplary embodiment, the generating module 230 determines the texture offset value of the sky animation by:

[0132]

[0133] in, and They are the texture offset value of the adjusted sky texture map and the texture offset value of the adjusted replacement sky texture map, and The sky texture map The texture offset of the coordinate axis is Texture offset for the coordinate axis, and are the weighting factors of the adjusted sky texture map and the adjusted replacement sky texture map, respectively. , , is the frequency parameter.

[0134] In an optional exemplary embodiment, the generating module 230 is further configured to:

[0135] Obtain cloud flow velocity parameters, and adjust the weighting factor according to the cloud flow velocity parameters.

[0136]

[0137] in, is the cloud flow velocity parameter.

[0138] In an optional exemplary embodiment, the generating module 230 is further configured to:

[0139] Obtaining a camera direction vector, and performing normalization processing on the camera direction vector;

[0140] The normalized camera direction vector is used to perform weighted processing on the texture offset value of the sky animation.

[0141] In an optional exemplary embodiment, the generating module 230 performs weighted processing on the texture offset value of the sky animation using the normalized camera direction vector, specifically:

[0142]

[0143] in, is the texture offset value of the sky animation, is the camera direction vector, Indicates the selection of the camera direction vector Components are calculated.

[0144] In an optional exemplary embodiment, the generating module 230 is further configured to:

[0145] The cycle period is determined according to a cosine function.

[0146] Based on the same concept, corresponding to any of the above-mentioned embodiments, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the program, the sky animation processing method described in any of the above embodiments is implemented.

[0147] Figure 10 10 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.

[0148] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0149] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0150] The input / output interface 1030 is used to connect to input / output modules to enable information input and output. The input / output modules can be configured as components within the device (not shown) or externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, and various sensors. Output devices may include a display, speaker, vibrator, indicator light, and the like.

[0151] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, Wi-Fi, Bluetooth, etc.).

[0152] The bus 1050 comprises a pathway for transmitting information between various components of the device, such as the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 .

[0153] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.

[0154] The electronic device of the above embodiment is used to implement the corresponding sky animation processing method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.

[0155] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the sky animation processing method described in any of the above embodiments.

[0156] The computer-readable media of this embodiment includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0157] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the sky animation processing method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0158] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. Within the scope of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0159] In addition, to simplify the description and discussion, and to avoid obscuring the understanding of the embodiments of the present application, well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. Furthermore, devices may be shown in block diagram form to avoid obscuring the understanding of the embodiments of the present application, and this also takes into account the fact that the implementation details of these block diagram devices are highly dependent on the platform on which the embodiments of the present application will be implemented (i.e., these details should be fully understood by those skilled in the art). Where specific details (e.g., circuits) are set forth to describe the exemplary embodiments of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be implemented without these specific details or with variations therefrom. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0160] Although the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may utilize the discussed embodiments.

[0161] The embodiments of the present application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of this application.

Claims

1. A method for processing sky animation, characterized in that: include: Get the sky texture map; Calculating a texture offset of the sky texture map according to a flow mapping algorithm, and adjusting the sky texture map according to the texture offset; generating animation frames of a corresponding sky animation according to the adjusted sky texture map, determining a cycle period of the sky animation, determining a replacement node of an animation frame corresponding to a replacement sky texture map according to the cycle period, and replacing the animation frame at the replacement node to generate a continuous sky animation; The sky texture map is a sky sphere model texture map; The calculating the texture offset of the sky texture map according to the flow mapping algorithm includes: Determining a wind direction vector, a tangent vector of a model vertex, and a binormal vector of a model vertex of the sky sphere model texture map; The wind direction vector, the tangent vector, and the binormal vector are normalized, so that the normalized wind direction vector is dot-multiplied by the normalized tangent vector and the binormal vector to obtain the texture offset.

2. The method according to claim 1, characterized in that The sky ball model texture map is a two-dimensional texture map; The texture offset is obtained as follows: in, and Two-dimensional texture maps The texture offset of the coordinate axis is Texture offset for the coordinate axis, is the wind direction vector, is the tangent vector, is the binormal vector.

3. The method according to claim 1, characterized in that The replacement node of the animation frame corresponding to the sky texture map to be replaced according to the cycle period is specifically: When half of the cycle is determined, the corresponding animation frame of the sky animation is the replacement node.

4. The method according to claim 3, characterized in that The method described above generates a continuous sky animation, including: According to the replacement node, weighted processing is performed on the texture offsets of the adjusted sky texture map and the adjusted replacement sky texture map respectively to determine a texture offset value of a sky animation and generate the sky animation.

5. The method according to claim 4, characterized in that To determine the texture offset value of the sky animation, specifically: in, and They are the texture offset value of the adjusted sky texture map and the texture offset value of the adjusted replacement sky texture map, and The sky texture map The texture offset of the coordinate axis is Texture offset for the coordinate axis, and are the weighting factors of the adjusted sky texture map and the adjusted replacement sky texture map, respectively. , , is the frequency parameter, To get the decimal point value of a floating point number x.

6. The method according to claim 5, characterized in that Before performing weighted processing on the texture offsets of the adjusted sky texture map and the adjusted replacement sky texture map, the method further includes: Obtain cloud flow velocity parameters, and adjust the weighting factor according to the cloud flow velocity parameters. in, is the cloud flow velocity parameter.

7. The method according to claim 1, characterized in that The method for generating a continuous sky animation further includes: Obtaining a camera direction vector, and performing normalization processing on the camera direction vector; The normalized camera direction vector is used to perform weighted processing on the texture offset value of the sky animation.

8. The method according to claim 7, characterized in that The weighted processing of the texture offset value of the sky animation using the normalized camera direction vector is specifically as follows: in, is the texture offset value of the sky animation, is the camera direction vector, Indicates the selection of the camera direction vector Components are calculated.

9. The method according to claim 1, characterized in that Determining the cycle period of the sky animation includes: The cycle period is determined according to a cosine function.

10. A sky animation processing device, characterized in that: include: Acquisition module, used to obtain sky texture map; an adjustment module, configured to calculate a texture offset of the sky texture map according to a flow mapping algorithm, and adjust the sky texture map according to the texture offset; a generation module for generating animation frames of a corresponding sky animation based on the adjusted sky texture map, determining a cycle period of the sky animation, determining a replacement node of an animation frame corresponding to an alternate sky texture map based on the cycle period, and replacing the animation frame at the replacement node to generate a continuous sky animation; The sky texture map is a sky sphere model texture map; The calculating the texture offset of the sky texture map according to the flow mapping algorithm includes: Determining a wind direction vector, a tangent vector of a model vertex, and a binormal vector of a model vertex of the sky sphere model texture map; The wind direction vector, the tangent vector, and the binormal vector are normalized, so that the normalized wind direction vector is dot-multiplied by the normalized tangent vector and the binormal vector to obtain the texture offset.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 9 is implemented.

12. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • GPU-based large-scale natural river channel water body rendering method, device and equipment

    CN113674437A