Vegetation model wind field special effect rendering method and device, electronic equipment and storage medium

By using texture maps and wind field deflection angles in vegetation model rendering, the problem of high overhead of wind field rendering in the prior art is solved, and efficient wind field special effect rendering of vegetation model is achieved.

CN119417962APending Publication Date: 2025-02-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411455045.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

In the prior art, rendering of wind farm special effects of vegetation model cannot reduce the overhead of special effects while ensuring the rendering effect and accuracy.

Method used

By obtaining the target texture map, determining the unit time offset based on the preset wind field direction angle, determining the coordinate components perpendicular to the growth direction of the vertex of the vegetation model, performing texture sampling to obtain the sampled texture value, calculate the wind field deflection angle, and using Wind field special effect rendering is performed on the wind field deflection angle and the preset wind field direction angle.

Benefits of technology

The wind farm special effect of rendering the vegetation model through a texture map is realized, which reduces the calculation overhead of wind farm rendering and can efficiently express the shaking effect of vegetation when blown by wind. It is suitable for model grass and dough grass models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119417962A_ABST
    Figure CN119417962A_ABST
Patent Text Reader

Abstract

The invention provides a vegetation model wind field special effect rendering method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a target texture map, and determining the unit time offset sampled in the target texture map based on a preset wind field direction angle; two coordinate components, perpendicular to the growth direction of the target vegetation model, of the vertex of the target vegetation model are determined, sampling is carried out in the target texture map based on the unit time offset and the two coordinate components, and sampling texture values, corresponding to all sampling moments, of the vertex of the target vegetation model are obtained; determining a wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment according to the sampling texture value; and finally, performing wind field special effect rendering on the vegetation model according to the wind field deflection angle and the preset wind field direction angle, thereby realizing the wind field special effect rendering on the vegetation model through one texture map, and reducing the calculation overhead of wind field rendering while ensuring the rendering effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of rendering special effects of vegetation model wind field, and in particular to a rendering method, device, electronic device and storage medium for special effects of vegetation model wind field. Background Art

[0002] This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.

[0003] At present, the rendering of vegetation model wind field special effects is widely used in various scenes. For example, in many scenes, it is necessary to produce wind effects for flat grass, model grass and all low vegetation, and the effects need to cover all types of vegetation. However, the rendering of vegetation model wind field special effects in the current related technology cannot reduce the special effects calculation overhead while ensuring the rendering effect and accuracy. Summary of the invention

[0004] In view of this, the purpose of the present application is to propose a rendering method, device, electronic device and storage medium for vegetation model wind field special effects, so as to solve or partially solve the problems in the above-mentioned background technology.

[0005] Based on the above purpose, the present application provides a method for rendering wind field special effects of a vegetation model, comprising:

[0006] Acquire a target texture map, and determine a unit time offset for sampling in the target texture map based on a preset wind field direction angle;

[0007] Determine two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model;

[0008] Sampling is performed in the target texture map based on the unit time offset and the two coordinate components to obtain sampled texture values ​​corresponding to the vertices of the target vegetation model at each sampling time;

[0009] Determine the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment based on the sampled texture value;

[0010] The vegetation model is rendered with wind field special effects based on the wind field deflection angle and the preset wind field direction angle.

[0011] Based on the same inventive concept, the exemplary embodiment of the present application further provides a rendering device for wind field special effects of a vegetation model, comprising:

[0012] An acquisition module is used to acquire a target texture map and determine a unit time offset of sampling in the target texture map based on a preset wind field direction angle;

[0013] A first determination module determines two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model;

[0014] A sampling module, sampling the target texture map based on the unit time offset and the two coordinate components to obtain a sampled texture value corresponding to the vertex of the target vegetation model at each sampling time;

[0015] A second determination module determines the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment based on the sampled texture value;

[0016] A rendering module performs wind field special effects rendering on the vegetation model based on the wind field deflection angle and the preset wind field direction angle.

[0017] Based on the same inventive concept, an exemplary embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein when the processor executes the program, the rendering method of the vegetation model wind field special effects as described above is implemented.

[0018] Based on the same inventive concept, the exemplary embodiment of the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the rendering method of the vegetation model wind field special effects as described above.

[0019] Based on the same inventive concept, an exemplary embodiment of the present application further provides a computer program product, which includes a computer program, and the computer program is executed by one or more processors so that the processor executes the rendering method of the vegetation model wind field special effects as described above.

[0020] From the above, it can be seen that the rendering method, device, electronic device and storage medium of the wind field special effects of the vegetation model provided by the present application first obtain the target texture map, and determine the unit time offset sampled in the target texture map based on the preset wind field direction angle; then determine the two coordinate components of the vertex of the target vegetation model and the growth direction of the target vegetation model, and sample the target texture map based on the unit time offset and the two coordinate components to obtain the sampled texture value corresponding to the vertex of the target vegetation model at each sampling time; then according to the The sampled texture value determines the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment; finally, the vegetation model is rendered with wind field special effects according to the wind field deflection angle and the preset wind field direction angle, thereby realizing the rendering of the wind field special effects of the vegetation model through a texture map. The wind field special effects using the wind field deflection angle and the preset wind field direction angle can efficiently show the swaying effect of the vegetation when blown by the wind, and can be applied to model grass models and patch grass models. There is no need to calculate the rotation center and axis of the vegetation model, thereby reducing the computational overhead of wind field rendering. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0022] Figure 1 A schematic diagram of an application scenario of an embodiment of the present application;

[0023] Figure 2 A schematic diagram of a flow chart of a method for rendering wind field special effects of a vegetation model according to an embodiment of the present application;

[0024] Figure 3 This is the first texture map of the embodiment of the present application;

[0025] Figure 4 This is the second texture map of the embodiment of the present application;

[0026] Figure 5 The second texture map after rotation in the embodiment of the present application;

[0027] Figure 6 This is the third texture map in the embodiment of the present application;

[0028] Figure 7 It is the third texture map after rotation in the embodiment of the present application;

[0029] Figure 8 It is a schematic diagram of a process of performing wind field special effects rendering on a vegetation model based on a wind field deflection angle and a preset wind field direction angle in an embodiment of the present application;

[0030] Fig. 9 This is a rendering of a wind field special effect of a vegetation model in an embodiment of the present application;

[0031] Fig.10 This is a rendering effect diagram of another vegetation model wind field special effect in an embodiment of the present application;

[0032] Fig.11 This is a shadow effect diagram of a vegetation model in an embodiment of the present application;

[0033] Fig.12 This is a shadow effect diagram of another vegetation model in an embodiment of the present application;

[0034] Fig.13 A schematic diagram of the structure of a rendering device for wind field special effects of a vegetation model according to an embodiment of the present application;

[0035] Fig.14 A schematic diagram of the structure of a specific electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present application, and are not intended to limit the scope of the present application in any way. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0037] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. "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. In addition, in the description of this application, unless otherwise specified, the term "several" refers to two or more. The term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0038] According to the implementation manner of the present application, a rendering method, device, electronic device and storage medium for vegetation model wind field special effects are proposed.

[0039] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.

[0040] The principles and spirit of the present application are explained in detail below with reference to several representative implementations of the present application. SUMMARY OF THE INVENTION

[0042] In the current related technologies, the rendering of vegetation model wind field special effects cannot reduce the special effects calculation overhead while ensuring the rendering effect and accuracy. For example, the three most commonly used methods for rendering vegetation model wind field special effects in the current related technologies are: the method using PivotPainter (pivot point drawing tool), the method using normal texture wind field technology, and the method using flowmap (flow map).

[0043] Among them, Pivot Painter is a technology used in real-time rendering, mainly used to achieve complex animation effects in games and graphics applications, especially wind field effects. It was introduced by Epic Games and widely used in UnrealEngine. This technology mainly achieves complex animation effects efficiently by pre-calculating and storing the rotation axis and rotation center data of the object. The core idea of ​​Pivot Painter is to pre-process the rotation center (Pivot) and axis (Axis) of each mesh object and store this information in the texture. In the shader, by reading this texture data, the mesh can be efficiently transformed to achieve complex animation effects. However, the method using Pivot Painter has the following defects: 1. The pre-processing complexity of Pivot Painter is high. It is necessary to calculate and store the rotation center and axis of each object in the pre-processing stage, which increases the complexity of data preparation. 2. The texture storage overhead is large. Storing rotation data requires additional texture space, which may increase the usage of video memory for scenes with a large number of objects. 3. Since the data is pre-calculated and stored, there may be problems of insufficient precision in some cases, especially in scenes with high-frequency animation or complex transformations. 4. The scope of application is limited. It is mainly suitable for animation effects that require complex rotation transformations. It may not be as effective as other technologies for other types of animation effects.

[0044] The method of normal texture wind field technology samples a custom normal texture as a deformation texture for wind force offset, uses the RG two channels of the color value to store the direction of the wind in the X and Z components, and uses the rotation matrix to calculate the vertex offset. However, this solution has the following defects: 1. The control accuracy is limited. The normal texture can only provide local offset information for each vertex, and cannot accurately control the overall animation effect, especially in scenes that require complex animations. It may not be flexible enough. 2. The texture resolution is highly dependent. The details and quality of the wind field effect are highly dependent on the resolution of the normal texture. Low-resolution textures may cause rough and distorted effects. 3. It is difficult to simulate complex wind fields. This method is more suitable for simple wind blowing effects, but it is difficult to achieve complex wind field simulations (such as vortices, wind speed changes at different heights, etc.). 4. Due to the limitation of the number of vertices, since the wind field effect is achieved through vertex offset, models with high polygon counts may cause performance bottlenecks, especially in real-time rendering. 5. There is a problem of normal direction consistency. If the directionality of the normal texture is inconsistent, the wind field effect may be unnatural or even visually flawed. Therefore, this solution can only be applied to model grassland or other vegetation, and the effect on flat grass will be seriously wrong.

[0045] Using flow map texture sampling to achieve vegetation wind field effects is also a common technical solution. A flow map is a special texture in which the color value in each pixel (usually RGB or RG channels) represents flow vectors of different directions and intensities. In this way, the effect of wind blowing vegetation can be simulated more delicately and flexibly. However, this solution has the following defects: 1. Increased complexity. Compared with normal textures, the production and use of flow map textures are more complicated, and additional steps are required to generate and process flow vector data. 2. The computational overhead is large. Since more texture sampling and vector operations are required, the computational burden of the GPU may be increased, especially in large-scale scenes. 3. The texture resolution is highly dependent. The details and quality of the wind field effect are highly dependent on the resolution of the flow map texture. Low-resolution flow maps may cause rough and distorted effects. 4. Difficult to debug and control. The vector data of the flow map may be difficult to debug and control intuitively, especially in scenes where precise adjustment of the wind field effect is required. 5. There are consistency issues. If the vector data of the flow map is inconsistent or unreasonable, the wind field effect may be unnatural or even visually flawed.

[0046] In order to solve the above problems, the present application provides a method for rendering wind field special effects of a vegetation model, which specifically includes:

[0047] First, the target texture map is obtained, and the unit time offset sampled in the target texture map is determined based on the preset wind field direction angle; then, the two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model are determined, and based on the unit time offset and the two coordinate components, the target texture map is sampled to obtain the sampled texture values ​​corresponding to the vertices of the target vegetation model at each sampling time; then, the wind field deflection angle corresponding to the vertices of the target vegetation model at each sampling time is determined according to the sampled texture values; finally, the vegetation model is rendered with wind field special effects according to the wind field deflection angle and the preset wind field direction angle, thereby realizing the rendering of the wind field special effects of the vegetation model through one texture map, and the wind field special effects using the wind field deflection angle and the preset wind field direction angle can efficiently show the shaking effect of the vegetation when blown by the wind, and can be applied to model grass models and patch grass models, without the need to calculate the rotation center and axis of the vegetation model, thereby reducing the computational overhead of wind field rendering. In addition, the rendering method of the vegetation model wind field special effects of the present application does not require the calculation of high-cost methods such as flowmap or Pivot Painter, and can run at a high frame rate on mobile devices. The overall full-screen cost is about 23.5ms, which is no different from the cost of no wind field calculation. It only adds one more wind field texture storage and memory cost.

[0048] After introducing the basic principles of the present application, various non-limiting implementation methods of the present application are described in detail below.

[0049] Application Scenario Overview

[0050] In some specific application scenarios, the rendering method of the vegetation model wind field special effects of the present application can be applied to various rendering systems involving vegetation model wind field special effects. Optionally, the system can be a game system. As an example, refer to Figure 1 , the application scenario includes at least one server 102 and at least one terminal 101. Terminal devices include but are not limited to desktop computers, mobile phones, mobile computers, tablet computers, media players, smart wearable devices, personal digital assistants (PDA) or other electronic devices that can realize the above functions. The server can be an independent physical server, or a server cluster or distributed system composed of several physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (content distribution network), and big data and artificial intelligence platforms. The server and the terminal can communicate through the network to realize data transmission. Among them, the network can be a wired network or a wireless network, which is not specifically limited in this application.

[0051] The server may be a server that provides various services. Specifically, the server may be used to provide background services for applications running on the terminal. Optionally, in some implementations, the rendering method for the wind field special effects of the vegetation model provided in the embodiment of the present application may be executed by a terminal device or a server. When executed by the server, the target texture map is first obtained, and the unit time offset sampled in the target texture map is determined based on the preset wind field direction angle; then the two coordinate components of the vertex of the target vegetation model perpendicular to the growth direction of the target vegetation model are determined, and the target texture map is sampled based on the unit time offset and the two coordinate components to obtain the sampled texture values ​​corresponding to the vertices of the target vegetation model at each sampling time; then the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling time is determined according to the sampled texture value; finally, the vegetation model is rendered with wind field special effects according to the wind field deflection angle and the preset wind field direction angle. Optionally, the server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster consisting of several servers, or it may be implemented as a single server. When the server is software, it can be implemented as several software or software modules (for example, software or software modules for providing distributed services), or it can be implemented as a single software or software module. This embodiment of the application does not specifically limit this.

[0052] Optionally, the wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, the data exchanged through the network is represented by technologies and / or formats including hypertext mark-up language (HTML), extensible markup language (XML), etc. In addition, conventional encryption technologies such as secure socket layer (SSL), transport layer security (TLS), virtual private network (VPN), and Internet protocol security (IPsec) can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.

[0053] The following describes the rendering method of the vegetation model wind field special effects according to the exemplary embodiment of the present application in combination with a specific application scenario. It should be noted that the above application scenario is only shown to facilitate understanding of the spirit and principle of the present application, and the implementation of the present application is not limited in this regard. On the contrary, the implementation of the present application can be applied to any applicable scenario.

[0054] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include several sub-steps or several stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0055] Exemplary Methods

[0056] refer to Figure 2 The embodiment of the present application provides a method for rendering wind field special effects of a vegetation model, the method comprising the following steps:

[0057] S101, obtaining a target texture map, and determining a unit time offset for sampling in the target texture map based on a preset wind field direction angle.

[0058] In specific implementation, the target texture map of the present application is mainly used to output different sampling results (generally grayscale values) for different sampling positions during texture sampling. Therefore, the obtained target texture map can be a texture map drawn by the user in advance and uploaded to the rendering engine. Figure 3 , is a texture map drawn by the user in this embodiment. In some embodiments, a noise map may also be used as a target texture map, which is not limited. Figure 4 and Figure 6 These are two noise maps in the embodiment of the present application, and the user can select any one of the noise maps as the target texture map as needed.

[0059] After the target texture map is obtained, the unit time offset sampled in the target texture map can be determined according to the preset wind field direction angle. It should be noted that the preset wind field direction angle is a custom wind field direction angle parameter. The specific value of the preset wind field direction angle can be set as needed, and there is no limitation on this. In some specific real-time examples, the preset wind field direction angle can be determined by a user input value. The unit time offset is the offset of the sampling position per unit time interval when sampling the target texture map. In this embodiment, the size of the unit time offset can be controlled by the preset wind field direction angle. Optionally, in some embodiments, the unit time offset can be made proportional to the preset wind field direction angle, that is, the larger the preset wind field direction angle, the larger the corresponding unit time offset.

[0060] In order to accurately sample in the texture map by the unit time offset, in some embodiments, the unit time offset sampled in the target texture map is determined based on a preset wind field direction angle, specifically including:

[0061] Calculating a first cosine value and a first sine value of the preset wind field direction angle;

[0062] A unit time offset for sampling in the target texture map is determined based on the first cosine value and the first sine value.

[0063] When implementing it, consider the texture Figure 1 The UV coordinates, that is, the Cartesian coordinate system, are used. If an angle is used directly, the offset may not be accurately determined in the Cartesian coordinate system. Therefore, in an embodiment of the present application, the first cosine value and the first sine value of the preset wind field direction angle may be calculated first. The first cosine value and the first sine value are used to convert the preset wind field direction angle into a coordinate variable in the Cartesian coordinate system, and then the unit time offset sampled in the target texture map is determined according to the first cosine value and the first sine value. Optionally, when calculating the first cosine value and the first sine value, the preset wind field direction angle may be converted into radians first, that is, the preset wind field direction angle may be multiplied by π / 180. Optionally, in order to save GPU computing overhead, π / 180 may be approximated as a floating point number of 0.01745329252.

[0064] S102, determining two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model.

[0065] In the specific implementation, in order to accurately map the vertices of the target vegetation model to each position in the texture map, first determine the two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model. It should be noted that the vertices of the target vegetation model generally include three coordinate components (x, y, z), and the target vegetation model will grow along the direction of one of the coordinate components, generally the y-axis direction. Therefore, the two coordinate components perpendicular to the growth direction of the target vegetation model are x and z. Taking into account that the vegetation will not jump up and down from the ground in the wind field effect, therefore, in this embodiment, only the two coordinate components perpendicular to the growth direction of the target vegetation model are considered.

[0066] In order to accurately determine the two coordinate components of the target vegetation model, in some embodiments, determining the two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model specifically includes:

[0067] Converting the coordinates of the vertices of the target vegetation model into target coordinates in world space;

[0068] Two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model are determined based on the target coordinates.

[0069] In a specific implementation, in order to ensure that the vertices of the target vegetation model and the texture map and other objects in the virtual world use the same reference system, when determining the two coordinate components, the coordinates of the vertices of the target vegetation model can be transformed into the target coordinates of the world space through the world matrix. Then, based on the target coordinates transformed into the world space, the two coordinate components of the vertices of the target vegetation model and the growth direction of the target vegetation model are determined.

[0070] S103 , sampling is performed in the target texture map based on the unit time offset and the two coordinate components to obtain sampled texture values ​​corresponding to the vertices of the target vegetation model at each sampling time.

[0071] In specific implementation, after obtaining the unit time offset and the two coordinate components, the target texture map can be sampled using these parameters. During specific sampling, for each sampling moment, the sampling coordinates corresponding to the current sampling moment can be calculated based on the unit time offset and the two coordinate components, and then the target texture map can be sampled using the sampling coordinates. Finally, the sampling texture values ​​corresponding to the vertices of the target vegetation model at each sampling moment can be obtained, that is, each vertex of the target vegetation model obtains a set of texture values ​​that change over time.

[0072] In order to accurately control the interval distance used each time, in some embodiments, sampling is performed in the target texture map based on the unit time offset and the two coordinate components, specifically including:

[0073] Obtaining preset wind speed parameters and sampling start durations corresponding to each of the sampling moments;

[0074] Calculating the product of the preset wind speed parameter and the unit time offset;

[0075] Sampling is performed in the target texture map based on the result of the multiplication, the sampling start duration and the two coordinate components.

[0076] In specific implementation, under normal circumstances, after determining the unit time offset, the sampling position interval of the target texture map each time is a fixed value. However, considering the influence of wind speed on vegetation swaying in reality, this embodiment adds a custom variable, a preset wind speed parameter, through which the position interval can be better adjusted when the unit time offset is fixed. Optionally, in some embodiments, the sampling position each time can be determined by the following formula:

[0077] WT=(x,z)+TimeParameters*float2(-cosα,-sinα)*WindSpeed;

[0078] Among them, WT represents the sampling position coordinates of each time, TimeParameters represents the sampling start time, float2(-cosα,-sinα) represents the unit time offset, WindSpeed ​​represents the preset wind speed parameters, and (x, z) represents two coordinate components.

[0079] Optionally, in some embodiments, in order to better control the sampling density of the target texture map, the sampling position each time may be determined by the following formula:

[0080] WT=(x,z) / WindTextureUV+TimeParameters*float2(-cosα,-sinα)*WindSpeed;

[0081] Among them, WT represents the coordinates of each sampling position, TimeParameters represents the sampling start time, float2(-cosα,-sinα) represents the unit time offset, WindSpeed ​​represents the preset wind speed parameters, (x, z) represents two coordinate components, and WindTextureUV is a custom variable that controls the sampling density.

[0082] S104: Determine the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment based on the sampled texture value.

[0083] In specific implementation, after obtaining the sampling texture values ​​corresponding to the vertices of the target vegetation model at each sampling moment, in order to better simulate the effect of the vegetation being bent toward the ground by the wind, in this embodiment, the wind field deflection angle corresponding to the vertices of the target vegetation model at each sampling moment is determined by the sampling texture values, and the wind field deflection angle determines the degree to which the vegetation model bends toward the ground at different moments in the wind field. Optionally, when determining the wind field deflection angle, the mapping relationship between the sampling texture value and the wind field deflection angle can be pre-set, and then the wind field deflection angle corresponding to each of the different sampling texture values ​​can be determined by the mapping relationship. Optionally, in some embodiments, the wind field deflection angle can also be directly proportional to the sampling texture value.

[0084] In order to better describe the size of the wind field deflection angle, in some embodiments, determining the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling time based on the sampled texture value specifically includes:

[0085] Get wind strength parameters;

[0086] The wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment is determined based on the wind intensity parameter and the sampled texture value.

[0087] In specific implementation, in order to better control the size of the wind field deflection angle, in this embodiment, a wind strength parameter is introduced, through which the size of the wind field deflection angle corresponding to each sampled texture value can be further adjusted on the basis of the sampled texture value. Optionally, the product of the wind strength parameter and the sampled texture value can be calculated first, and then the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment can be determined using the product result. Optionally, the wind strength parameter can be set as needed. In some embodiments, the wind strength parameter can be the product of a preset wind strength parameter and a preset vegetation model wind field special effect scale.

[0088] In order to accurately determine the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling time, in some embodiments, the wind field deflection angle can be determined by the following formula:

[0089] θ==WindStrength×(π÷180)×WindTexture;

[0090] Wherein, θ represents the wind field deflection angle, WindStrength represents the wind strength parameter, and WindTexture represents the sampled texture value. Optionally, in some embodiments, for the convenience of calculation, π÷180 can be directly equal to 0.01745329252.

[0091] S105: Perform wind field special effects rendering on the vegetation model based on the wind field deflection angle and the preset wind field direction angle.

[0092] During specific implementation, after determining the wind field deflection angle and the preset wind field direction angle, it is equivalent to obtaining all coordinate parameters in the spherical coordinate system. By using all coordinate parameters in the spherical coordinate system, the offset control of the vegetation model can be realized, thereby achieving the effect of the vegetation model swaying with the wind, that is, completing the wind field special effects rendering of the vegetation model. It should be noted that in this embodiment, the wind field deflection angle can be equivalent to the elevation angle in the spherical coordinate system, which is mainly used to control the degree of bending of the vegetation model toward the ground. The range of the wind field deflection angle is [0, π]. The preset wind field direction angle can be equivalent to the azimuth angle in the spherical coordinate system, which is mainly used to control the rotation angle of the vegetation model along a plane parallel to the ground. The range of the preset wind field direction angle is [0, 2π]. Reference Fig. 9 and Fig.10 , which are rendering effect diagrams of two vegetation model wind field special effects in the embodiments of the present application. It can be seen that the rendering method of the vegetation model wind field special effects in the embodiments of the present application improves the rendering efficiency while ensuring the rendering effect of the vegetation model wind field special effects.

[0093] In order to make the wind force in the wind farm have a transition effect from bottom to top, in some embodiments, reference Figure 8 , performing wind field special effects rendering on the vegetation model based on the wind field deflection angle and the preset wind field direction angle, specifically comprising the following steps:

[0094] S201, obtaining target coordinate components of vertices of the target vegetation model along a growth direction of the target vegetation model.

[0095] S202: Determine the offset of the vertex of the target vegetation model at each sampling moment based on the target coordinate component, the wind field deflection angle and the preset wind field direction angle.

[0096] S203: Perform wind field special effects rendering on the vegetation model based on the offsets of the vertices of the target vegetation model at each sampling moment.

[0097] It should be noted that, in this embodiment, the target coordinate component of the vertices of the target vegetation model along the growth direction of the target vegetation model can control the offset of the vertices of the target vegetation model to change with the change of vegetation height, thereby simulating the effect in reality that the higher the vegetation, the greater the impact of wind.

[0098] In order to accurately determine the offset of the vertices of the target vegetation model at each sampling time, in some embodiments, the offset of the vertices of the target vegetation model at each sampling time is determined by the following formula:

[0099] wd x =y×sinα×cosθ;

[0100] wd y =y×(cosθ-1);

[0101] wd x =y×sinα×sinθ;

[0102] Among them, wd x Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd y Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd z represents the offset of the vertex of the target vegetation model in the x-axis direction, y represents the coordinate component of the vertex of the target vegetation model in the y-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

[0103] In some embodiments, the offset of the vertices of the target vegetation model at each sampling time is determined by the following formula:

[0104] wd x =y 2 × sinα×cosθ;

[0105] wd y =y 2 ×(cosθ-1);

[0106] wd x =y 2 × sinα×sinθ;

[0107] Among them, wd x Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd y Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd z represents the offset of the vertex of the target vegetation model in the x-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

[0108] It should be noted that when using y 2 When determining the offset of the vertices of the target vegetation model at each sampling moment, the influence of the vegetation height on the offset can be made more obvious.

[0109] In order to add a self-offset effect to the vegetation model, in some embodiments, the vegetation model is rendered with wind field special effects based on the wind field deflection angle and the preset wind field direction angle, specifically including:

[0110] Calculating the self-rotation offset corresponding to the vertex of the vegetation model at each sampling moment based on a preset function;

[0111] The vegetation model is rendered with wind field special effects based on the self-rotation offset, the wind field deflection angle and the preset wind field direction angle.

[0112] In the specific implementation, considering that the vegetation model will sway in addition to being affected by the wind field, in order to ensure the display effect, a self-swaying effect is generally added to the vegetation. In the embodiment of the present application, the self-rotation offset corresponding to the vertex of the vegetation model at each sampling moment is first calculated according to the preset function, and then the self-rotation offset is used together with the wind field deflection angle and the preset wind field direction angle to render the vegetation model with wind field special effects, so that the vegetation model has the superposition of the two effects. It should be noted that the preset function can be set as needed, and generally a sine or cosine function can be selected.

[0113] In some embodiments, the self-rotation offset corresponding to the vertex of the vegetation model at each sampling time can be calculated by the following formula:

[0114] SinTime=(sin(TimeParameters.x)+1.0) / 2.0-0.2;

[0115] Among them, SinTime represents the self-rotation offset, TimeParameters.x represents the sampling start time corresponding to the sampling moment, and the calculation formula can make the range of SinTime become [-0.2, 0.8].

[0116] In order to restore the self-swaying of vegetation in reality, in some embodiments, the self-rotation offset corresponding to the vertex of the vegetation model at each sampling time is calculated based on a preset function, specifically including:

[0117] Determine the initial rotation amount of the vertex of the vegetation model at each sampling moment based on each sampling moment and the preset function;

[0118] Acquire target coordinate components of vertices of the target vegetation model along the growth direction;

[0119] The self-rotation offsets corresponding to the vertices of the vegetation model at each sampling time are calculated based on the target coordinate components and the initial self-rotation amount.

[0120] In the specific implementation, in this embodiment, considering that in reality, the higher the vegetation is, the greater the amplitude of the sway should be. Therefore, when calculating the self-rotation offset, the target coordinate component of the vertex of the target vegetation model along the growth direction is obtained. Through this target coordinate component, the self-rotation offset is proportional to the height of the vertex. The higher the vertex, the greater the offset.

[0121] In some embodiments, before sampling in the target texture map based on the unit time offset and the two coordinate components, the method further includes:

[0122] The target texture map is rotated based on the preset wind field direction angle.

[0123] In specific implementation, in order to better make the grayscale distribution of the texture map meet the needs of users, before sampling the target texture map based on the unit time offset and the two coordinate components, this embodiment rotates the target texture map based on the preset wind field direction angle, so that the grayscale or color change area of ​​the target texture map meets the needs of users. Figure 5 and Figure 7 ,in, Figure 5 exist Figure 4 It is rotated 20 degrees on the basis of, that is, the preset wind field direction angle at this time is 20 degrees. Figure 7 exist Figure 6 It is rotated 90 degrees on the basis of, that is, the preset wind field direction angle at this time is 90 degrees.

[0124] In some embodiments, the method further comprises:

[0125] Acquire the terrain color of the virtual world where the target vegetation model is located and the target color of the target vegetation model;

[0126] Acquire target coordinate components of vertices of the target vegetation model along the growth direction;

[0127] The colors of the vertices of the target vegetation model are re-determined based on the target coordinate components, the terrain color, and the target color.

[0128] In the specific implementation, considering that in real scenes, vegetation close to the ground is generally stained with the color of the soil, and the closer to the ground, the darker the color of the soil, in order to restore this scene and make the rendered vegetation model more realistic, in this embodiment, the color of the vertices of the target vegetation model is re-determined by the target coordinate component, the terrain color and the target color. Optionally, in some embodiments, the color of the vertices of the target vegetation model can be determined by lerp linear interpolation, wherein the interpolation parameter Alpha in the lerp linear interpolation can be determined by the target coordinate component of the vertices of the target vegetation model along the growth direction, the terrain color is used as the end value, the target color is used as the starting value, and the interpolation parameter Alpha is inversely proportional to the target coordinate component, so that the closer the vertices of the target vegetation model are to the ground, the closer the color is to the terrain color.

[0129] In some embodiments, the method further comprises:

[0130] Obtaining a shadow map, and determining a shadow depth of a shadow-bearing object based on the shadow map; the shadow-bearing object at least includes a partial area of ​​the target vegetation model;

[0131] Obtaining the shadow projection coordinates of the shadow casting object corresponding to the shadow receiving object, and determining the target distance between the shadow casting object and the shadow receiving object based on the shadow depth and the shadow projection coordinates;

[0132] In response to determining that the target distance is less than or equal to a preset threshold, deleting the shadow cast by the shadow-casting object on the shadow-receiving object;

[0133] In response to determining that the target distance is greater than the preset threshold, a size of a shadow cast by the projected shadow on the shadow-receiving object is determined based on a difference between the target distance and the preset threshold.

[0134] In specific implementation, in order to eliminate the shadow projection effect that is too close to the model and prevent the shadow clutter problem caused by the self-shadow, in this embodiment, a preset threshold is used to determine whether the distance between the object that casts the shadow and the object that receives the shadow (i.e., the object being cast the shadow) is too close. If the distance is less than the preset threshold, it means that the distance between the two is too close. In order to prevent shadow clutter, the projected shadow can be directly deleted. If the distance is greater than the preset threshold, the distance between the object that casts the shadow and the object that receives the shadow is first subtracted from the preset threshold, and then the difference is used to determine the size of the projected shadow. Therefore, the coverage of the shadow projection can be reduced by reducing the size of part of the projected shadow.

[0135] It should be noted that the shadow receiving object is the object on which the shadow is cast, and the shadow receiving object includes at least a partial area of ​​the target vegetation model, that is, the shadow receiving object can be a part of the target vegetation model, or the entire target vegetation model. There is no limitation on this. The shadow depth of the shadow receiving object is the distance from the shadow receiving object to the light source, and the shadow projection coordinates of the shadow projecting object are the distance from the shadow projecting object to the light source. The difference between the two is the distance from the shadow projecting object to the shadow receiving object. Fig.11 , which is a shadow effect of a vegetation model not using this embodiment, refer to Fig.12 , which is the shadow effect of the vegetation model of this embodiment, it can be seen Fig.12 and Fig.11 In comparison, a lot of self-shadows of the vegetation model are removed (the dotted box part in the figure).

[0136] In some embodiments, in order to ensure that the vegetation model has a more realistic color, the vegetation bottom color variable BaseColorDown can be set, and then the y component of the texture coordinate UV is used to transition the original vegetation color and the newly set vegetation bottom color to obtain a new color, so that the vegetation model has a certain color change along the height direction. Yes, the specific newly set vegetation bottom color can be set as needed, and there is no limitation on this. In some embodiments, the newly set vegetation bottom color can be determined according to the user's input value.

[0137] In some embodiments, in order to improve the display effect of the vegetation model in the virtual world, a noise map can be sampled through the world space position. The noise map can be customized and is mainly used to create various noise effects. The sampled result is used as the interpolation transition value Alpha. At the same time, a new custom noise color NoiseColor variable is set to perform linear interpolation with the color of the vegetation model to obtain a new vegetation model color, so that the vegetation model can be distinguished in color according to the different world spaces.

[0138] In some embodiments, in order to better achieve highlight rendering of the vegetation model, the highlight part of the illuminated surface can be obtained by first performing a dot product operation of the model normal of the vegetation model and the half-angle vector, and then using the y component of the texture UV coordinate to linearly transition the highlight so that the highlight can become stronger from the root of the vegetation upward. Then, the highlight value obtained above can be multiplied by the custom highlight color and the shadow part can be highlight culled, so that the highlight color of the vegetation model becomes stronger from the root of the vegetation upward while avoiding the appearance of highlights in the shadow part to produce visual conflicts. In addition, in some embodiments, the wind field intensity (i.e., the offset of the vertices of the target vegetation model in the above embodiment at each of the sampling moments) can be superimposed on the highlight effect of the vegetation model. The stronger the wind field, the brighter the highlight, thereby simulating the highlight effect of the vegetation after being moved by the wind field.

[0139] The present application provides a rendering method for wind field special effects of a vegetation model, which first obtains a target texture map, and determines a unit time offset for sampling in the target texture map based on a preset wind field direction angle; then determines two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model, and samples the target texture map based on the unit time offset and the two coordinate components to obtain sampling texture values ​​corresponding to the vertices of the target vegetation model at each sampling moment; then determines the wind field deflection angle corresponding to the vertices of the target vegetation model at each sampling moment based on the sampled texture values; finally, the vegetation model is rendered with wind field special effects based on the wind field deflection angle and the preset wind field direction angle, thereby realizing the rendering of the wind field special effects of the vegetation model through one texture map, and the wind field special effects using the wind field deflection angle and the preset wind field direction angle can efficiently show the shaking effect of the vegetation when blown by the wind, and can be applied to model grass models and patch grass models, without the need to calculate the rotation center and axis of the vegetation model, thereby reducing the computational overhead of wind field rendering. In addition, the rendering method of the vegetation model wind field special effects of the present application can run at a high frame rate on mobile devices. The overall full-screen cost is about 23.5ms, which is no different from the cost of no wind field calculation. It only adds one more wind field texture storage and memory cost.

[0140] 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 this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or several steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.

[0141] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that 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 or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0142] Exemplary Devices

[0143] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a rendering device for vegetation model wind field special effects.

[0144] refer to Fig.13 , the rendering device of the vegetation model wind field special effects includes:

[0145] An acquisition module 201 acquires a target texture map and determines a unit time offset of sampling in the target texture map based on a preset wind field direction angle;

[0146] A first determination module 202 determines two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model;

[0147] A sampling module 203 performs sampling in the target texture map based on the unit time offset and the two coordinate components to obtain a sampled texture value corresponding to the vertex of the target vegetation model at each sampling time;

[0148] A second determination module 204 determines the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment based on the sampled texture value;

[0149] The rendering module 205 performs wind field special effects rendering on the vegetation model based on the wind field deflection angle and the preset wind field direction angle.

[0150] In some embodiments, the acquisition module is specifically used to:

[0151] Calculating a first cosine value and a first sine value of the preset wind field direction angle;

[0152] A unit time offset for sampling in the target texture map is determined based on the first cosine value and the first sine value.

[0153] In some embodiments, the first determining module is specifically configured to:

[0154] Converting the coordinates of the vertices of the target vegetation model into target coordinates in world space;

[0155] Two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model are determined based on the target coordinates.

[0156] In some embodiments, the sampling module is specifically used to:

[0157] Obtaining preset wind speed parameters and sampling start durations corresponding to each of the sampling moments;

[0158] Calculating the product of the preset wind speed parameter and the unit time offset;

[0159] Sampling is performed in the target texture map based on the result of the multiplication, the sampling start duration and the two coordinate components.

[0160] In some embodiments, the second determining module is specifically configured to:

[0161] Get wind strength parameters;

[0162] The wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment is determined based on the wind intensity parameter and the sampled texture value.

[0163] In some embodiments, the rendering module is specifically used to:

[0164] Acquire target coordinate components of vertices of the target vegetation model along a growth direction of the target vegetation model;

[0165] Determining the offset of the vertex of the target vegetation model at each sampling moment based on the target coordinate component, the wind field deflection angle and the preset wind field direction angle;

[0166] The vegetation model is rendered with wind field special effects based on the offsets of the vertices of the target vegetation model at each sampling moment.

[0167] In some embodiments, the offset of the vertices of the target vegetation model at each sampling time is determined by the following formula:

[0168] wd x =y×sinα×cosθ;

[0169] wd y =y×(cosθ-1);

[0170] wd x =y×sinα×sinθ;

[0171] Among them, wd x Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wdy Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd z represents the offset of the vertex of the target vegetation model in the x-axis direction, y represents the coordinate component of the vertex of the target vegetation model in the y-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

[0172] In some embodiments, the offset of the vertices of the target vegetation model at each sampling time is determined by the following formula:

[0173] wd x =y 2 × sinα×cosθ;

[0174] wd y =y 2 ×(cosθ-1);

[0175] wd x =y 2 × sinα×sinθ;

[0176] Among them, wdx represents the offset of the vertices of the target vegetation model in the x-axis direction, wdy represents the offset of the vertices of the target vegetation model in the x-axis direction, wdz represents the offset of the vertices of the target vegetation model in the x-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

[0177] In some embodiments, the rendering module is specifically used to:

[0178] Calculating the self-rotation offset corresponding to the vertex of the vegetation model at each sampling moment based on a preset function;

[0179] The vegetation model is rendered with wind field special effects based on the self-rotation offset, the wind field deflection angle and the preset wind field direction angle.

[0180] In some embodiments, the rendering module is specifically used to:

[0181] Determine the initial rotation amount of the vertex of the vegetation model at each sampling moment based on each sampling moment and the preset function;

[0182] Acquire target coordinate components of vertices of the target vegetation model along the growth direction;

[0183] The self-rotation offsets corresponding to the vertices of the vegetation model at each sampling time are calculated based on the target coordinate components and the initial self-rotation amount.

[0184] In some embodiments, the device further comprises a rotation module, configured to:

[0185] The target texture map is rotated based on the preset wind field direction angle.

[0186] In some embodiments, the device further comprises a color adjustment module, configured to:

[0187] Acquire the terrain color of the virtual world where the target vegetation model is located and the target color of the target vegetation model;

[0188] Acquire target coordinate components of vertices of the target vegetation model along the growth direction;

[0189] The colors of the vertices of the target vegetation model are re-determined based on the target coordinate components, the terrain color, and the target color.

[0190] In some embodiments, the apparatus further comprises a shadow adjustment module, configured to:

[0191] Obtaining a shadow map, and determining a shadow depth of a shadow-bearing object based on the shadow map; the shadow-bearing object at least includes a partial area of ​​the target vegetation model;

[0192] Obtaining the shadow projection coordinates of the shadow casting object corresponding to the shadow receiving object, and determining the target distance between the shadow casting object and the shadow receiving object based on the shadow depth and the shadow projection coordinates;

[0193] In response to determining that the target distance is less than or equal to a preset threshold, deleting the shadow cast by the shadow-casting object on the shadow-receiving object;

[0194] In response to determining that the target distance is greater than the preset threshold, a size of a shadow cast by the projected shadow on the shadow-receiving object is determined based on a difference between the target distance and the preset threshold.

[0195] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0196] The rendering device for the vegetation model wind field special effects in the above-mentioned embodiment is used to implement the corresponding rendering method for the vegetation model wind field special effects in any of the above-mentioned embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0197] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, 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 when the processor executes the program, the rendering method of the vegetation model wind field special effects described in any of the above embodiments is implemented.

[0198] Fig.14 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and 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 connected to each other through the bus 1050 in the device.

[0199] The processor 1010 can be implemented by 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.

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

[0201] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0202] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0203] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).

[0204] 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 the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0205] The electronic device of the above embodiment is used to implement the rendering method of the corresponding vegetation model wind field special effects in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0206] The memory 1020 stores machine-readable instructions executable by the processor 1010. When the electronic device is running, the processor 1010 communicates with the memory 1020 through the bus 1050, so that the processor 1010 executes the following instructions when running: obtain the target texture map, and determine the unit time offset sampled in the target texture map based on the preset wind field direction angle; determine the two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model; sample the target texture map based on the unit time offset and the two coordinate components to obtain the sampled texture values ​​corresponding to the vertices of the target vegetation model at each sampling time; determine the wind field deflection angle corresponding to the vertices of the target vegetation model at each sampling time based on the sampled texture values; and render the vegetation model with wind field special effects based on the wind field deflection angle and the preset wind field direction angle.

[0207] In a possible implementation, in the instructions executed by the processor 1010, the unit time offset sampled in the target texture map is determined based on a preset wind field direction angle, specifically including: calculating a first cosine value and a first sine value of the preset wind field direction angle; and determining the unit time offset sampled in the target texture map based on the first cosine value and the first sine value.

[0208] In a possible implementation, in the instructions executed by the processor 1010, two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model are determined, specifically including: converting the coordinates of the vertices of the target vegetation model into target coordinates in the world space; and determining the two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model based on the target coordinates.

[0209] In a possible implementation, the instructions executed by the processor 1010 include: obtaining a preset wind speed parameter and a sampling start time corresponding to each sampling moment; calculating the product of the preset wind speed parameter and the unit time offset; and sampling in the target texture map based on a result of the product, the sampling start time and the two coordinate components.

[0210] In a possible implementation, in the instructions executed by the processor 1010, the wind field deflection angle corresponding to the vertices of the target vegetation model at each sampling moment is determined based on the sampled texture value, specifically including: obtaining wind intensity parameters; determining the wind field deflection angle corresponding to the vertices of the target vegetation model at each sampling moment based on the wind intensity parameters and the sampled texture value.

[0211] In a possible implementation, in the instructions executed by the processor 1010, the vegetation model is rendered with wind field special effects based on the wind field deflection angle and the preset wind field direction angle, specifically including: obtaining the target coordinate component of the vertices of the target vegetation model along the growth direction of the target vegetation model; determining the offset of the vertices of the target vegetation model at each sampling moment based on the target coordinate component, the wind field deflection angle and the preset wind field direction angle; and rendering the vegetation model with wind field special effects based on the offset of the vertices of the target vegetation model at each sampling moment.

[0212] In a possible implementation, in the instruction executed by the processor 1010, the offset of the vertex of the target vegetation model at each sampling time is determined by the following formula:

[0213] wd x =y×sinα×cosθ;

[0214] wd y =y×(cosθ-1);

[0215] wd x =y×sinα×sinθ;

[0216] Among them, wd x Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd y Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd zrepresents the offset of the vertex of the target vegetation model in the x-axis direction, y represents the coordinate component of the vertex of the target vegetation model in the y-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

[0217] In a possible implementation, in the instruction executed by the processor 1010, the offset of the vertex of the target vegetation model at each sampling time is determined by the following formula:

[0218] wd x =y 2 × sinα×cosθ;

[0219] wd y =y 2 ×(cosθ-1);

[0220] wd x =y 2 × sinα×sinθ;

[0221] Among them, wdx represents the offset of the vertices of the target vegetation model in the x-axis direction, wdy represents the offset of the vertices of the target vegetation model in the x-axis direction, wdz represents the offset of the vertices of the target vegetation model in the x-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

[0222] In a possible implementation, in the instructions executed by the processor 1010, the vegetation model is rendered with wind field special effects based on the wind field deflection angle and the preset wind field direction angle, specifically including: calculating the self-rotation offset corresponding to the vertices of the vegetation model at each sampling moment based on a preset function; and rendering the vegetation model with wind field special effects based on the self-rotation offset, the wind field deflection angle and the preset wind field direction angle.

[0223] In a possible implementation, the instructions executed by the processor 1010 include calculating the self-rotation offset corresponding to the vertices of the vegetation model at each sampling time based on a preset function, specifically including:

[0224] Based on each of the sampling moments and the preset function, the initial rotation amount corresponding to the vertices of the vegetation model at each of the sampling moments is determined; the target coordinate components of the vertices of the target vegetation model along the growth direction are obtained; and the rotation offset amount corresponding to the vertices of the vegetation model at each of the sampling moments is calculated based on the target coordinate components and the initial rotation amount.

[0225] In a possible implementation, in the instructions executed by the processor 1010, before sampling the target texture map based on the unit time offset and the two coordinate components, the method further includes: rotating the target texture map based on the preset wind field direction angle.

[0226] In a possible embodiment, in the instructions executed by the processor 1010, the method also includes: obtaining the terrain color of the virtual world where the target vegetation model is located and the target color of the target vegetation model; obtaining the target coordinate components of the vertices of the target vegetation model along the growth direction; and redetermining the colors of the vertices of the target vegetation model based on the target coordinate components, the terrain color and the target color.

[0227] In a possible embodiment, in the instructions executed by processor 1010, the method also includes: obtaining a shadow map, and determining a shadow depth of a receiving shadow object based on the shadow map; the receiving shadow object includes at least a partial area of ​​the target vegetation model; obtaining shadow projection coordinates of a projected shadow object corresponding to the receiving shadow object, and determining a target distance between the projected shadow object and the receiving shadow object based on the shadow depth and the shadow projection coordinates; in response to determining that the target distance is less than or equal to a preset threshold, deleting the shadow cast by the projected shadow object on the receiving shadow object; in response to determining that the target distance is greater than the preset threshold, determining the size of the shadow cast by the projected shadow on the receiving shadow object based on the difference between the target distance and the preset threshold.

[0228] Through the above method, when the electronic device is running, the target texture map is first obtained, and the unit time offset sampled in the target texture map is determined based on the preset wind field direction angle; then the two coordinate components of the vertex of the target vegetation model and the growth direction of the target vegetation model are determined, and the target texture map is sampled based on the unit time offset and the two coordinate components to obtain the sampled texture values ​​corresponding to the vertices of the target vegetation model at each sampling time; then the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling time is determined according to the sampled texture values; finally, the vegetation model is rendered with wind field special effects according to the wind field deflection angle and the preset wind field direction angle, so that the rendering of the wind field special effects of the vegetation model is realized through a texture map, and the wind field special effects using the wind field deflection angle and the preset wind field direction angle can efficiently show the shaking effect of the vegetation when it is blown by the wind, and can be universally applied to model grass models and patch grass models, without the need to calculate the rotation center and axis of the vegetation model, thereby reducing the computational overhead of wind field rendering.

[0229] Exemplary Program Products

[0230] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the rendering method of the vegetation model wind field special effects as described in any of the above embodiments.

[0231] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0232] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the rendering method of the vegetation model wind field special effects as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0233] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present application also provides a computer program product, which includes a computer program. In some embodiments, the computer program instructions can be executed by one or more processors of a computer so that the computer and / or the processor execute the rendering method of the vegetation model wind field special effects described in the above-mentioned embodiment. Corresponding to the execution subject corresponding to each step in each embodiment of the scene editing method, the processor that executes the corresponding step may belong to the corresponding execution subject.

[0234] The computer program product of the above embodiment is used to enable the computer and / or the processor to execute the rendering method of the vegetation model wind field special effects as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0235] It is understandable that before using the technical solutions of each embodiment of the present application, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.

[0236] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to the electronic device, application, server, storage medium or other software or hardware that performs the operation of the technical solution of the present application according to the prompt message.

[0237] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0238] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation method of this application. Other methods that meet relevant laws and regulations may also be applied to the implementation method of this application.

[0239] It should be understood by those skilled in the art that the embodiments of the present application can be implemented as a system, method or computer program product. Therefore, the present application can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as "circuit", "module" or "system". In addition, in some embodiments, the present application can also be implemented in the form of a computer program product in one or more computer-readable media, which contains computer-readable program code.

[0240] Any combination of one or more computer-readable media can be used. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive examples) of computer-readable storage media can include, for example: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0241] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0242] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0243] Computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).

[0244] It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine, and these computer program instructions are executed by a computer or other programmable data processing device to produce a device that implements the functions / operations specified in the boxes in the flowchart and / or block diagram.

[0245] These computer program instructions may also be stored in a computer-readable medium that enables a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable medium produce a product that includes an instruction device that implements the functions / operations specified in the blocks in the flowchart and / or block diagram.

[0246] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby enabling the instructions executed on the computer or other programmable device to provide a process for implementing the functions / operations specified in the blocks in the flowchart and / or block diagram.

[0247] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0248] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into several modules or units to be embodied.

[0249] 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; based on the concept 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 adjustments to the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0250] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are adjusted. Therefore, these descriptions should be considered to be illustrative rather than restrictive.

[0251] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.

[0252] 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 the present application.

Claims

1. A method for rendering wind field special effects of a vegetation model, characterized in that: include: Acquire a target texture map, and determine a unit time offset for sampling in the target texture map based on a preset wind field direction angle; Determine two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model; Sampling is performed in the target texture map based on the unit time offset and the two coordinate components to obtain sampled texture values ​​corresponding to the vertices of the target vegetation model at each sampling time; Determine the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment based on the sampled texture value; The vegetation model is rendered with wind field special effects based on the wind field deflection angle and the preset wind field direction angle.

2. The method according to claim 1, characterized in that Determining the unit time offset sampled in the target texture map based on a preset wind field direction angle specifically includes: Calculating a first cosine value and a first sine value of the preset wind field direction angle; A unit time offset for sampling in the target texture map is determined based on the first cosine value and the first sine value.

3. The method according to claim 1, characterized in that Determining two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model specifically includes: Converting the coordinates of the vertices of the target vegetation model into target coordinates in world space; Two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model are determined based on the target coordinates.

4. The method according to claim 1, characterized in that: Sampling in the target texture map based on the unit time offset and the two coordinate components specifically includes: Obtaining preset wind speed parameters and the sampling start time corresponding to each of the sampling moments; Calculating the product of the preset wind speed parameter and the unit time offset; Sampling is performed in the target texture map based on the result of the multiplication, the sampling start duration and the two coordinate components.

5. The method according to claim 1, characterized in that Determining the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling time based on the sampled texture value specifically includes: Get wind strength parameters; The wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment is determined based on the wind intensity parameter and the sampled texture value.

6. The method according to claim 1, characterized in that Performing wind field special effects rendering on the vegetation model based on the wind field deflection angle and the preset wind field direction angle specifically includes: Acquire target coordinate components of vertices of the target vegetation model along a growth direction of the target vegetation model; Determining the offset of the vertex of the target vegetation model at each sampling moment based on the target coordinate component, the wind field deflection angle and the preset wind field direction angle; The vegetation model is rendered with wind field special effects based on the offsets of the vertices of the target vegetation model at each sampling moment.

7. The method according to claim 6, characterized in that The offset of the vertices of the target vegetation model at each sampling time is determined by the following formula: wd x =y×sinα×cosθ; wd y =y×(cosθ-1); wd x =y×sinα×sinθ; Among them, wd x Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd y Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd z represents the offset of the vertex of the target vegetation model in the x-axis direction, y represents the coordinate component of the vertex of the target vegetation model in the y-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

8. The method according to claim 6, characterized in that The offset of the vertices of the target vegetation model at each sampling time is determined by the following formula: wd x =and 2 ×sinα×cosθ; wd y =y 2 ×(cosθ-1); wd x =and 2 ×sinα×sinθ; Among them, wd x Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd y Indicates the offset of the vertex of the target vegetation model in the x-axis direction, wd z represents the offset of the vertex of the target vegetation model in the x-axis direction, α represents the preset wind field direction angle, and θ represents the wind field deflection angle.

9. The method according to claim 1, characterized in that: Performing wind field special effects rendering on the vegetation model based on the wind field deflection angle and the preset wind field direction angle specifically includes: Calculating the self-rotation offset corresponding to the vertex of the vegetation model at each sampling moment based on a preset function; The vegetation model is rendered with wind field special effects based on the self-rotation offset, the wind field deflection angle and the preset wind field direction angle.

10. The method according to claim 9, characterized in that Calculating the self-rotation offset corresponding to the vertex of the vegetation model at each sampling time based on a preset function specifically includes: Determine the initial rotation amount of the vertex of the vegetation model at each sampling moment based on each sampling moment and the preset function; Acquire target coordinate components of vertices of the target vegetation model along the growth direction; The self-rotation offsets corresponding to the vertices of the vegetation model at each sampling time are calculated based on the target coordinate components and the initial self-rotation amount.

11. The method according to claim 1, characterized in that: Before sampling in the target texture map based on the unit time offset and the two coordinate components, the method further includes: The target texture map is rotated based on the preset wind field direction angle.

12. The method according to claim 1, characterized in that The method further comprises: Acquire the terrain color of the virtual world where the target vegetation model is located and the target color of the target vegetation model; Acquire target coordinate components of vertices of the target vegetation model along the growth direction; The colors of the vertices of the target vegetation model are re-determined based on the target coordinate components, the terrain color, and the target color.

13. The method according to claim 1, characterized in that The method further comprises: Obtaining a shadow map, and determining a shadow depth of a shadow-bearing object based on the shadow map; the shadow-bearing object at least includes a partial area of ​​the target vegetation model; Obtaining the shadow projection coordinates of the shadow casting object corresponding to the shadow receiving object, and determining the target distance between the shadow casting object and the shadow receiving object based on the shadow depth and the shadow projection coordinates; In response to determining that the target distance is less than or equal to a preset threshold, deleting the shadow cast by the shadow-casting object on the shadow-receiving object; In response to determining that the target distance is greater than the preset threshold, a size of a shadow cast by the projected shadow on the shadow-receiving object is determined based on a difference between the target distance and the preset threshold.

14. A rendering device for wind field special effects of vegetation model, characterized in that: include: An acquisition module is used to acquire a target texture map and determine a unit time offset of sampling in the target texture map based on a preset wind field direction angle; A first determination module determines two coordinate components of the vertices of the target vegetation model that are perpendicular to the growth direction of the target vegetation model; A sampling module, sampling the target texture map based on the unit time offset and the two coordinate components to obtain a sampled texture value corresponding to the vertex of the target vegetation model at each sampling time; A second determination module determines the wind field deflection angle corresponding to the vertex of the target vegetation model at each sampling moment based on the sampled texture value; A rendering module performs wind field special effects rendering on the vegetation model based on the wind field deflection angle and the preset wind field direction angle.

15. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method according to any one of claims 1 to 13 when executing the program.

16. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the method according to any one of claims 1 to 13.