Method and device for generating wind farm effect diagram, storage medium, and computer equipment
By mapping texture map coordinates and adding wind directions to the world coordinates of vegetation model vertices, and determining the noise offset of wind field with noise map sampling, the problem of periodicity of vegetation wind field effect simulation in the existing technology is solved, and a more realistic Wind field effect.
Patent Information
- Application Number
- CN202210444768.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2042-04-26
AI Technical Summary
The simulation of vegetation wind farm effect in the prior art uses a periodic function, resulting in vegetation swing periodicity and the effect is not realistic enough.
By obtaining the world coordinates of the target sampling point, mapping it into texture map coordinates, and cumulating the wind direction based on the target wind speed of the wind field, obtaining the noise map to be sampled matching the wind speed for sampling, determining the noise offset of the wind field, and then rendering the wind field renderings.
This makes the swing effect of vegetation in the wind field more random, and improves the authenticity of the wind field renderings.
Smart Images

Figure CN114768251B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for generating a wind farm effect diagram, a storage medium, and a computer device. Background Art
[0002] Vegetation is a common game resource. In order to show the effect of vegetation being blown by the wind and improve the realism of the game, the effect of vegetation being blown by the wind is usually simulated and calculated. In the prior art, the simulation of the wind field effect of vegetation is usually based on periodic functions. For example, the Cryengine engine uses triangle waves to achieve the shaking of leaves and uses sine and cosine functions to make the grass swing. However, this method of using periodic functions makes the swing of vegetation periodic and the effect is not realistic enough. Summary of the invention
[0003] In view of this, the present application provides a method and device for generating a wind farm effect diagram, a storage medium, and a computer device.
[0004] According to one aspect of the present application, a method for generating a wind farm effect diagram is provided, the method comprising:
[0005] Acquire world coordinates of a plurality of target sampling points, and map the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of target objects located in the wind field;
[0006] Based on the target wind speed of the wind field, accumulating the wind direction of the texture map coordinates of each target sampling point;
[0007] Acquire a noise map to be sampled that matches the target wind speed of the wind farm, and sample the noise map to be sampled according to the texture map coordinates;
[0008] The wind field noise offset of each target sampling point is determined based on the sampling result, and a wind field effect diagram including the target object is rendered according to the wind field noise offset.
[0009] Optionally, the acquiring a noise map to be sampled that matches the target wind speed of the wind farm and sampling the noise map to be sampled according to the texture map coordinates specifically includes:
[0010] Calculate the sampling noise floating point level according to the target wind speed;
[0011] The sampling noise floating point level is passed into a preset sampling function, the noise map to be sampled corresponding to the sampling noise floating point level is determined by the preset sampling function, and the noise map to be sampled is sampled according to the texture map coordinates.
[0012] Optionally, determining the noise map to be sampled corresponding to the sampling noise floating point number level by the preset sampling function, and sampling the noise map to be sampled according to the texture map coordinates specifically includes:
[0013] If the sampling noise floating point number level matches the noise frequency corresponding to any sampled noise map sample, any matched sampled noise map sample is used as the noise map to be sampled, and the noise map to be sampled is sampled according to the texture map coordinates by the preset sampling function;
[0014] If the sampling noise floating-point number level does not match the noise frequency corresponding to each sampling noise map sample, then based on the sampling noise frequency corresponding to the sampling noise floating-point number level, a sampling noise map sample with a noise frequency greater than the sampling noise frequency and a sampling noise map sample with a noise frequency less than the sampling noise frequency are obtained from the sampling noise map samples as the noise map to be sampled, and the noise map to be sampled is interpolated and sampled according to the texture map coordinates through the preset sampling function.
[0015] Optionally, before acquiring the noise map to be sampled that matches the target wind speed of the wind farm, the method further includes:
[0016] A plurality of sampled noise map samples are acquired and stored, wherein each of the sampled noise map samples is obtained by performing four-way continuous processing on an initial sampled noise map, and the initial sampled noise map is generated based on a preset noise point frequency.
[0017] Optionally, the target object includes vegetation, and the target sampling point includes a vegetation model vertex; before obtaining the noise map to be sampled that matches the target wind speed of the wind farm, the method further includes:
[0018] Based on the wind field influence coefficient corresponding to each of the target sampling points, the texture map coordinates of each of the target sampling points are offset respectively, wherein the magnitude of the wind field influence coefficient increases from the root vertex of the vegetation model to the top vertex of the vegetation model.
[0019] Optionally, the step of offsetting the texture map coordinates of each target sampling point based on the wind field influence coefficient corresponding to each target sampling point specifically includes:
[0020] The offsetting of the texture map coordinates of each target sampling point based on the wind field influence coefficient corresponding to each target sampling point specifically includes:
[0021] Based on the wind field influence coefficient, the wind field direction and the preset material parameters, the texture map offset of each target sampling point is calculated respectively, and according to the texture map offset, the texture map coordinates of each target sampling point are offset respectively.
[0022] Optionally, determining the wind field noise offset of each target sampling point based on the sampling result, and rendering a wind field effect diagram including the target object according to the wind field noise offset, specifically includes:
[0023] The RGB three-channel sampling results of each target sampling point are respectively determined as the wind field noise offset of each target sampling point in three axial directions;
[0024] Based on the target wind speed and the wind field noise offset, the vertex displacement of each target sampling point is calculated respectively, and based on the vertex displacement of each target sampling point, a wind field effect diagram including the target object is rendered.
[0025] According to another aspect of the present application, a device for generating a wind field effect diagram is provided, the device comprising:
[0026] A coordinate mapping module is used to obtain the world coordinates of a plurality of target sampling points and map the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of the target objects located in the wind field; based on the wind field influence coefficient corresponding to each of the target sampling points, the texture mapping coordinates of each of the target sampling points are offset respectively;
[0027] A sampling module, used for acquiring a noise map to be sampled that matches the target wind speed of the wind farm, and sampling the noise map to be sampled according to the texture map coordinates;
[0028] A rendering module is used to determine the wind field noise offset of each target sampling point based on the sampling result, and render a wind field effect diagram containing the target object according to the wind field noise offset.
[0029] Optionally, the sampling module is specifically used to:
[0030] Calculate the sampling noise floating point level according to the target wind speed;
[0031] The sampling noise floating point level is passed into a preset sampling function, the noise map to be sampled corresponding to the sampling noise floating point level is determined by the preset sampling function, and the noise map to be sampled is sampled according to the texture map coordinates.
[0032] Optionally, the sampling module is specifically used to:
[0033] If the sampling noise floating point number level matches the noise frequency corresponding to any sampled noise map sample, any matched sampled noise map sample is used as the noise map to be sampled, and the noise map to be sampled is sampled according to the texture map coordinates by the preset sampling function;
[0034] If the sampling noise floating-point number level does not match the noise frequency corresponding to each sampling noise map sample, then based on the sampling noise frequency corresponding to the sampling noise floating-point number level, a sampling noise map sample with a noise frequency greater than the sampling noise frequency and a sampling noise map sample with a noise frequency less than the sampling noise frequency are obtained from the sampling noise map samples as the noise map to be sampled, and the noise map to be sampled is interpolated and sampled according to the texture map coordinates through the preset sampling function.
[0035] Optionally, the device further comprises:
[0036] A noise map storage module is used to obtain and store multiple sampled noise map samples before obtaining the sampled noise map that matches the target wind speed of the wind farm, wherein each of the sampled noise map samples is obtained by performing four-way continuous processing on an initial sampled noise map, and the initial sampled noise map is generated based on a preset noise point frequency.
[0037] Optionally, the target object includes vegetation, and the target sampling point includes a vegetation model vertex; the coordinate mapping module is also used to: before obtaining the noise map to be sampled that matches the target wind speed of the wind field, offset the texture map coordinates of each target sampling point based on the wind field influence coefficient corresponding to each target sampling point, wherein the size of the wind field influence coefficient increases from the root vertex of the vegetation model to the top vertex of the vegetation model.
[0038] Optionally, the coordinate mapping module is specifically used to: calculate the texture mapping offset of each target sampling point based on the wind field influence coefficient, wind field direction and preset material parameters, and offset the texture mapping coordinates of each target sampling point according to the texture mapping offset.
[0039] Optionally, the rendering module is specifically used to:
[0040] The RGB three-channel sampling results of each target sampling point are respectively determined as the wind field noise offset of each target sampling point in three axial directions;
[0041] Based on the target wind speed and the wind field noise offset, the vertex displacement of each target sampling point is calculated respectively, and based on the vertex displacement of each target sampling point, a wind field effect diagram including the target object is rendered.
[0042] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method for generating the wind field effect diagram is implemented.
[0043] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned method for generating a wind field effect diagram when executing the program.
[0044] By means of the above technical scheme, the present application provides a method and device for generating a wind field effect map, a storage medium, and a computer device. For a target object in a wind field, first, the world coordinates of the target sampling point on the target object model are obtained, mapped to a plane texture map coordinate, and the wind direction of each target sampling point is accumulated based on the target wind speed of the wind field. Then, a noise map to be sampled that matches the wind speed of the wind field is obtained, and the noise map is sampled according to the offset texture map coordinates. The wind field noise offset of each target sampling point is determined by the sampling result, and then the position of each target sampling point after the offset caused by the wind field is determined, and finally a wind field effect map containing the target object is rendered. Compared with the method of simulating wind field effects based on periodic functions in the prior art, the embodiment of the present application determines the offset data of resources in the game scene based on the noise sampling result by sampling the noise map, so that the effect of resources affected by the wind field is more random, thereby improving the authenticity of the wind field effect map.
[0045] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0047] Figure 1 A schematic diagram showing a flow chart of a method for generating a wind farm effect diagram provided in an embodiment of the present application is shown;
[0048] Figure 2 A schematic diagram of the structure of a device for generating a wind field effect diagram provided in an embodiment of the present application is shown;
[0049] Figure 3 A schematic flow chart of another method for generating a wind farm effect diagram provided in an embodiment of the present application is shown;
[0050] Figure 4 A schematic flow chart of another method for generating a wind farm effect diagram provided in an embodiment of the present application is shown;
[0051] Figure 5 A schematic structural diagram of another wind field effect diagram generating device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0052] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0053] In this embodiment, a method for generating a wind field effect diagram is provided, such as Figure 1 As shown, the method includes:
[0054] S1, obtaining world coordinates of a plurality of target sampling points, and mapping the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of target objects located in a wind field;
[0055] S2, based on the target wind speed of the wind field, accumulating the wind direction of the texture map coordinates of each target sampling point;
[0056] S3, obtaining a noise image to be sampled that matches the target wind speed of the wind farm, and sampling the noise image to be sampled according to the texture map coordinates;
[0057] S4, determining the wind field noise offset of each of the target sampling points based on the sampling results, and rendering a wind field effect diagram including the target object according to the wind field noise offset.
[0058] In an embodiment of the present application, by sampling a pre-generated noise map, the offset of each sampling point of the target object in the wind field is determined based on the sampling results, thereby calculating the displacement of the model vertices of the target object caused by the wind field, and further rendering the effect of the target object in the wind field after material lighting calculation.
[0059] In a specific application scenario, the target object may be a game resource affected by a wind field, such as vegetation, flags, and other resources in the game, and the target sampling point is a model vertex of the target object. First, the world coordinates of the target sampling point on the target object model in the game world are obtained, and based on the mapping relationship between the world coordinates and the plane UV, the world coordinates of the target sampling point are mapped to the texture map UV coordinates. Secondly, based on the target wind speed in the wind field, the UV coordinates of each target sampling point are accumulated in wind direction. Specifically, based on the target wind speed, the global texture map UV offset of each target sampling point is calculated, and the UV coordinates of each target sampling point are offset respectively according to the global UV offset. Then, according to the target wind speed corresponding to the wind field, a noise map to be sampled matching the target wind speed is obtained, wherein the faster the target wind speed, the higher the frequency of the noise map to be sampled. Specifically, the corresponding frequency level can be determined based on the target wind speed, and the noise map to be sampled of the corresponding frequency level can be obtained, and then the noise map to be sampled is sampled according to the UV coordinates of the above-mentioned target sampling point after offset. Finally, based on the sampling results of the noise map to be sampled, the displacement of each vertex of the target object model in the wind field is determined, that is, the wind field noise offset of the target sampling point. Furthermore, after obtaining the wind field noise offset of each vertex of the model, the offset position of each vertex can be calculated. After the offset position of the vertex affected by the wind field is written into the pixel shader, the next step of lighting calculation and rendering is performed through the pixel shader, and finally a wind field effect map containing the target object affected by the wind field is obtained.
[0060] By applying the technical solution of this embodiment, for the target object in the wind field, first, the world coordinates of the target sampling point on the target object model are obtained, mapped to the plane texture map coordinates, and the wind direction of each target sampling point is accumulated based on the target wind speed of the wind field. Then, the noise map to be sampled that matches the wind speed of the wind field is obtained, and the noise map is sampled according to the offset texture map coordinates. The wind field noise offset of each target sampling point is determined by the sampling results, and then the position of each target sampling point after the offset caused by the wind field is determined, and finally the wind field effect map containing the target object is rendered. Compared with the method of simulating wind field effects based on periodic functions in the prior art, the embodiment of the present application determines the offset data of resources in the game scene based on the noise sampling results by sampling the noise map, so that the effect of resources affected by the wind field is more random, thereby improving the authenticity of the wind field effect map.
[0061] In the embodiment of the present application, optionally, S3 specifically includes:
[0062] S3.1, calculating the sampling noise floating point level according to the target wind speed;
[0063] S3.2, passing the sampling noise floating point level into a preset sampling function, determining the noise map to be sampled corresponding to the sampling noise floating point level through the preset sampling function, and sampling the noise map to be sampled according to the texture map coordinates.
[0064] In this embodiment, before sampling the noise map, it is necessary to obtain a suitable noise map to be sampled. In this embodiment, the noise map to be sampled is determined based on the sampling noise floating point level by calculating the sampling noise floating point level, and the noise map is sampled. Specifically, the floating point level MipmapLevel is log2(MaxSpeed / max(WindSpeed, MinSpeed)), which is similar to the texture calculation MipmapLevel, where MaxSpeed and MinSpeed are material parameters for controlling the maximum and minimum swing frequencies, and WindSpeed is the target wind speed. The noise map is sampled through the SampleLevel function, and the floating point level is passed as MipmapLevel to the preset sampling function SampleLevel, and the noise map to be sampled is sampled through this function.
[0065] In an embodiment of the present application, optionally, S3.2 specifically includes: if the sampling noise floating-point number level matches the noise frequency corresponding to any sampling noise map sample, then any matching sampling noise map sample is used as the noise map to be sampled, and the noise map to be sampled is sampled according to the texture map coordinates through the preset sampling function; if the sampling noise floating-point number level does not match the noise frequency corresponding to each sampling noise map sample, then based on the sampling noise frequency corresponding to the sampling noise floating-point number level, a sampling noise map sample with a noise frequency greater than the sampling noise frequency and a sampling noise map sample with a noise frequency less than the sampling noise frequency are obtained from the sampling noise map samples respectively as the noise map to be sampled, and the noise map to be sampled is interpolated and sampled according to the texture map coordinates through the preset sampling function.
[0066] In this embodiment, if the sampling noise floating point level calculated based on the target wind speed matches the noise frequency corresponding to any sampled noise map sample, then the matched sampled noise map sample is directly used as the noise map to be sampled, and the noise map is sampled by a preset sampling function. If the sampling noise floating point level does not match the noise frequency of each sampled noise map sample, then two sampled noise map samples closest to the sampling noise floating point level can be obtained as the noise map to be sampled, including a sample with a noise frequency greater than the sampling noise floating point level and a sample with a noise frequency less than the sampling noise floating point level, and the two noise maps to be sampled are interpolated and sampled by a preset sampling function. So that the wind farm can support smooth transitions between any wind speed and each wind speed level (sampling noise floating point level). Specifically, if the MipmapLevel parameter passed into the SampleLevel function carries a decimal (non-integer), the system will automatically interpolate the adjacent Mip data of the noise map to be sampled, and the interpolated result can be obtained even in the vertex shader VertexShader calculation stage. By spanning at most two frequencies, the noise sampling results corresponding to the full range of wind speeds and wind fields can be obtained.
[0067] In an embodiment of the present application, optionally, it also includes: acquiring and storing multiple sampled noise map samples, wherein each of the sampled noise map samples is obtained by performing four-way continuous processing on an initial sampled noise map, and the initial sampled noise map is generated based on a preset noise point frequency.
[0068] In the above embodiment, the client can obtain and store multiple pre-generated sampled noise map samples, so that when generating a wind farm effect map, the pre-stored sampled noise map samples can be directly called locally for noise sampling, and then the wind farm effect map is rendered based on the noise map sampling results. Among them, the sampled noise map samples can be generated based on several specific noise frequencies. The lower the noise frequency, the lower the resolution required to store the noise. Correspondingly, the higher the noise frequency, the more a larger resolution picture is required to be saved, and the corresponding resolution can be determined according to the noise frequency. For example, noise maps with resolutions of 16, 32, 64, 128 and 256 can be generated as sampled noise map samples, which are stored in Mip4 to Mip0 respectively. The three RGB color channels and the alpha channel in the sample can be calculated by simplex noise SimplexNoise after a given resolution. In addition, in order to ensure that the noise sampling result will not jump, after the initial sampled noise map is generated based on the resolution corresponding to the preset noise frequency, the initial sampled noise map can be further processed to ensure that the processed noise Figure 4 The sampled noise graph samples with four-way continuity are obtained.
[0069] It should be noted that in order to ensure the quality of the wind field effect map, sampling noise map samples covering the entire optional wind speed range can be prepared in advance. For example, if the wind speed range is A to B, the corresponding noise frequency A and noise frequency B can be determined based on wind speed A and wind speed B respectively, and the resolution A and resolution B corresponding to the noise frequency A and noise frequency B can be determined respectively. The resolution range covering resolution A and resolution B is determined, and several specific values are selected within this resolution range to generate the corresponding initial sampling noise map. Finally, the initial sampling noise map is subjected to four-way continuous processing to obtain multiple sampling noise map samples.
[0070] In the embodiment of the present application, optionally, the target object includes vegetation, and the target sampling point includes a vegetation model vertex; and before S3, the following step is further included:
[0071] S5, based on the wind field influence coefficient corresponding to each of the target sampling points, offset the texture map coordinates of each of the target sampling points respectively, wherein the magnitude of the wind field influence coefficient increases from the root vertex of the vegetation model to the top vertex of the vegetation model.
[0072] In this embodiment, in order to show the real swinging law of each vertex of the target object affected by the wind field, the UV coordinates obtained by mapping each target sampling point are offset based on the wind field influence coefficient of each vertex determined in advance according to the real swinging law of the target object. The wind field influence coefficient is used to describe the degree of influence of the target sampling point by the wind field. Taking the target object as the vegetation in the game as an example, in order to show the wind field flow direction of the vegetation from the root to the leaf, that is, the root is least affected by the wind (it can also be regarded as the root will not be affected by the wind and produce swing), the top is most affected by the wind, or the wind field flow direction is expressed as flowing from the constrained side (root) to the unconstrained side (top), in the embodiment of the present application, the wind field influence coefficient of the root vertex can be set to 0, and the wind field influence coefficient of the top vertex can be set to 1, and the wind field influence coefficients of the model vertices between the two are successively increased, and the UV offset is performed to ensure that the UV position of the noise map where the root is located is in front of the top UV position when the noise map is sampled.
[0073] In an embodiment of the present application, optionally, S5 specifically includes: based on the wind field influence coefficient, the wind field direction and the preset material parameters, respectively calculating the texture map offset of each of the target sampling points, and offsetting the texture map coordinates of each of the target sampling points according to the texture map offset.
[0074] In this embodiment, taking the target object as the vegetation in the game as an example, the target sampling point includes the vertices of the vegetation model. Based on the objective law that the vegetation is affected by the wind field, the root of the vegetation is not affected by the wind, and the tip is most affected by the wind. From the root vertex of the vegetation model to the top vertex of the vegetation model, the wind field influence coefficient can be set to incremental data from 0 to 1. In addition, in a specific application scenario, the data can be stored in the alpha channel of the model vertex data for the convenience of storage. After the world coordinates of the target sampling point are mapped to UV coordinates, based on the wind field influence coefficient, the wind field direction and the preset material parameters, the UV offset of each target sampling point is calculated and the UV coordinates are offset, wherein the WindMask offset is equal to WindMask multiplied by the VariationMul parameter and then multiplied by the VariationScale (material parameter), and the VariationMul parameter can specifically be the opposite direction of the noise map UV, that is, the opposite direction of the wind field direction.
[0075] In the embodiment of the present application, optionally, S4 specifically includes:
[0076] S4.1, determining the RGB three-channel sampling results of each target sampling point as the wind field noise offset of each target sampling point in three axial directions;
[0077] S4.2, based on the target wind speed and the wind field noise offset, respectively calculate the vertex displacement of each of the target sampling points, and render a wind field effect diagram including the target object based on the vertex displacement of each of the target sampling points.
[0078] In the above embodiment, after sampling the noise image to be sampled to obtain the sampling results, the offset of each target sampling point in the three axial directions of XYZ, that is, the local wind field noise offset, can be determined based on the RGB three-channel sampling results. Further, the vertex displacement of each vertex of the target object model is determined. The vertex displacement may include the accumulation of the vertex swing amplitude determined based on the target wind speed and the wind field noise offset. After determining the offset of each vertex of the model, the final wind field effect map can be rendered after the material lighting calculation of the pixel shader.
[0079] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a device for generating a wind field effect diagram, such as Figure 2 As shown, the device comprises:
[0080] A coordinate mapping module is used to obtain the world coordinates of a plurality of target sampling points and map the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of the target objects located in the wind field; based on the wind field influence coefficient corresponding to each of the target sampling points, the texture mapping coordinates of each of the target sampling points are offset respectively;
[0081] A sampling module, used for acquiring a noise map to be sampled that matches the target wind speed of the wind farm, and sampling the noise map to be sampled according to the texture map coordinates;
[0082] A rendering module is used to determine the wind field noise offset of each target sampling point based on the sampling result, and render a wind field effect diagram containing the target object according to the wind field noise offset.
[0083] Optionally, the sampling module is specifically used to:
[0084] Calculate the sampling noise floating point level according to the target wind speed;
[0085] The sampling noise floating point level is passed into a preset sampling function, the noise map to be sampled corresponding to the sampling noise floating point level is determined by the preset sampling function, and the noise map to be sampled is sampled according to the texture map coordinates.
[0086] Optionally, the sampling module is specifically used to:
[0087] If the sampling noise floating point number level matches the noise frequency corresponding to any sampled noise map sample, any matched sampled noise map sample is used as the noise map to be sampled, and the noise map to be sampled is sampled according to the texture map coordinates by the preset sampling function;
[0088] If the sampling noise floating-point number level does not match the noise frequency corresponding to each sampling noise map sample, then based on the sampling noise frequency corresponding to the sampling noise floating-point number level, a sampling noise map sample with a noise frequency greater than the sampling noise frequency and a sampling noise map sample with a noise frequency less than the sampling noise frequency are obtained from the sampling noise map samples as the noise map to be sampled, and the noise map to be sampled is interpolated and sampled according to the texture map coordinates through the preset sampling function.
[0089] Optionally, the device further comprises:
[0090] A noise map storage module is used to obtain and store multiple sampled noise map samples before obtaining the sampled noise map that matches the target wind speed of the wind farm, wherein each of the sampled noise map samples is obtained by performing four-way continuous processing on an initial sampled noise map, and the initial sampled noise map is generated based on a preset noise point frequency.
[0091] Optionally, the target object includes vegetation, and the target sampling point includes a vegetation model vertex; the coordinate mapping module is also used to: before obtaining the noise map to be sampled that matches the target wind speed of the wind field, offset the texture map coordinates of each target sampling point based on the wind field influence coefficient corresponding to each target sampling point, wherein the size of the wind field influence coefficient increases from the root vertex of the vegetation model to the top vertex of the vegetation model.
[0092] Optionally, the coordinate mapping module is specifically used to: calculate the texture mapping offset of each target sampling point based on the wind field influence coefficient, wind field direction and preset material parameters, and offset the texture mapping coordinates of each target sampling point according to the texture mapping offset.
[0093] Optionally, the rendering module is specifically used to:
[0094] The RGB three-channel sampling results of each target sampling point are respectively determined as the wind field noise offset of each target sampling point in three axial directions;
[0095] Based on the target wind speed and the wind field noise offset, the vertex displacement of each target sampling point is calculated respectively, and based on the vertex displacement of each target sampling point, a wind field effect diagram including the target object is rendered.
[0096] It should be noted that for other corresponding descriptions of the functional units involved in the device for generating a wind field effect diagram provided in the embodiment of the present application, reference can be made to Figure 1 The corresponding description in the method will not be repeated here.
[0097] Based on the above Figure 1 The method shown in the embodiment of the present application is accordingly provided with a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned Figure 1 The method for generating the wind field effect diagram shown in FIG.
[0098] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0099] Based on the above Figure 1 The method shown, and Figure 2 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 The method for generating the wind field effect diagram shown in FIG.
[0100] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.
[0101] Those skilled in the art will appreciate that the computer device structure provided in this embodiment does not limit the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0102] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and saves the hardware and software resources of the computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the physical device.
[0103] Through the description of the above implementation methods, the technicians in this field can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware for the target object in the wind field. First, the world coordinates of the target sampling point on the target object model are obtained and mapped to the plane texture map coordinates. Secondly, the texture map coordinates of each point are offset based on the wind field influence coefficient of each target sampling point, and then the noise map to be sampled matching the wind speed of the wind field is obtained, and the noise map is sampled according to the offset texture map coordinates. The wind field noise offset of each target sampling point is determined by the sampling result, and then the position of each target sampling point after the offset caused by the wind field is determined, and finally the wind field effect map containing the target object is rendered. Compared with the method of simulating the wind field effect based on the periodic function in the prior art, the embodiment of the present application determines the offset data of the resources in the game scene based on the noise sampling result by sampling the noise map, so that the effect of the resources affected by the wind field is more random, and at the same time, the target sampling point is constrained based on the wind field influence coefficient, so as to ensure that the offset degree of each vertex of the target object is more in line with the objective law, and improve the authenticity of the wind field effect map.
[0104] In this embodiment, a method for generating a wind field effect diagram is provided, such as Figure 3 As shown, the method includes:
[0105] Step 101, obtaining world coordinates of a plurality of target sampling points, and mapping the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of target objects located in a local wind field;
[0106] Step 102, based on the wind field influence coefficient corresponding to each of the target sampling points, the texture map coordinates of each of the target sampling points are offset respectively;
[0107] Step 103, obtaining a noise image to be sampled that matches the target wind speed of the local wind field, and sampling the noise image to be sampled according to the texture map coordinates;
[0108] Step 104: determine the wind field noise offset of each target sampling point based on the sampling result, and render a wind field effect diagram including the target object according to the wind field noise offset.
[0109] In an embodiment of the present application, by sampling a pre-generated noise map, the offset of each sampling point of the target object in the wind field is determined based on the sampling results, thereby calculating the displacement of the model vertices of the target object caused by the wind field, and further rendering the effect of the target object in the wind field after material lighting calculation.
[0110] In a specific application scenario, the target object can be a game resource affected by a local wind field, such as vegetation, flags and other resources in the game, and the target sampling point is the model vertex of the target object. First, the world coordinates of the target sampling point on the target object model in the game world are obtained, and based on the mapping relationship between the world coordinates and the plane UV, the world coordinates of the target sampling point are mapped to the texture map UV coordinates. Secondly, in order to show the real swinging law of each vertex of the target object affected by the wind field, the UV coordinates of each target sampling point obtained by mapping are offset based on the wind field influence coefficient of each vertex determined in advance according to the real swinging law of the target object. The wind field influence coefficient is used to describe the degree of influence of the wind field on the target sampling point. Taking the target object as the vegetation in the game as an example, in order to show the wind field flow direction of the vegetation from the root to the leaf, that is, the root is least affected by the wind (it can also be regarded as the root will not be affected by the wind and swing), the top is most affected by the wind, or the wind field flow direction is expressed as flowing from the constrained side (root) to the unconstrained side (top), in the embodiment of the present application, the wind field influence coefficient of the root vertex can be set to 0, and the wind field influence coefficient of the top vertex can be set to 1, and the wind field influence coefficients of the model vertices between the two are increased in sequence, and the UV offset is performed to ensure that the UV position of the noise map where the root is located is in front of the top UV position when the noise map is sampled. Then, according to the target wind speed corresponding to the wind field, a noise map to be sampled matching the target wind speed is obtained, wherein the faster the target wind speed, the higher the frequency of the noise map to be sampled. Specifically, the corresponding frequency level can be determined based on the target wind speed, and the noise map to be sampled of the corresponding frequency level can be obtained, and then the noise map to be sampled is sampled according to the UV coordinates after the above-mentioned target sampling point offset. Finally, based on the sampling results of the noise map to be sampled, the displacement of each vertex of the target object model in the wind field is determined, that is, the wind field noise offset of the target sampling point. Furthermore, after obtaining the wind field noise offset of each vertex of the model, the offset position of each vertex can be calculated. After the offset position of the vertex affected by the wind field is written into the pixel shader, the next step of lighting calculation and rendering is performed through the pixel shader, and finally a wind field effect map containing the target object affected by the wind field is obtained.
[0111] By applying the technical solution of this embodiment, for the target object in the wind field, first, the world coordinates of the target sampling points on the target object model are obtained and mapped to plane texture map coordinates. Secondly, the texture map coordinates of each point are offset based on the wind field influence coefficient of each target sampling point. Then, the noise map to be sampled that matches the wind speed of the wind field is obtained, and the noise map is sampled according to the offset texture map coordinates. The wind field noise offset of each target sampling point is determined by the sampling result, and then the position of each target sampling point after the offset caused by the wind field is determined, and finally the wind field effect map containing the target object is rendered. Compared with the method of simulating wind field effects based on periodic functions in the prior art, the embodiment of the present application determines the offset data of resources in the game scene based on the noise sampling results by sampling the noise map, so that the effect of resources affected by the wind field is more random. At the same time, the target sampling points are constrained based on the wind field influence coefficient, which ensures that the offset degree of each vertex of the target object is more in line with objective laws and improves the authenticity of the wind field effect map.
[0112] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another method for generating a wind field effect diagram is provided, such as Figure 4 As shown, the method includes:
[0113] Step 201 : obtaining world coordinates of a plurality of target sampling points, and mapping the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of target objects located in a local wind field.
[0114] Step 202, based on the wind field influence coefficient, the wind field direction and the preset material parameters, respectively calculate the texture map offset of each of the target sampling points, and according to the texture map offset, respectively offset the texture map coordinates of each of the target sampling points.
[0115] In an embodiment of the present application, optionally, the target object includes vegetation, the target sampling point includes a vegetation model vertex, and the magnitude of the wind field influence coefficient increases from a root vertex of the vegetation model to a top vertex of the vegetation model.
[0116] In this embodiment, taking the target object as the vegetation in the game as an example, the target sampling point includes the vertices of the vegetation model. Based on the objective law that the vegetation is affected by the wind field, the root of the vegetation is not affected by the wind, and the tip is most affected by the wind. From the root vertex of the vegetation model to the top vertex of the vegetation model, the wind field influence coefficient can be set to incremental data from 0 to 1. In addition, in a specific application scenario, the data can be stored in the alpha channel of the model vertex data for the convenience of storage. After the world coordinates of the target sampling point are mapped to UV coordinates, based on the wind field influence coefficient, the wind field direction and the preset material parameters, the texture map UV offset of each target sampling point is calculated and the UV coordinates are offset, wherein the WindMask offset is equal to WindMask multiplied by the VariationMul parameter and then multiplied by the VariationScale (material parameter), and the VariationMul parameter can specifically be the opposite direction of the noise map UV, that is, the opposite direction of the wind field direction.
[0117] Step 203, determining the target wind speed of the local wind field, and calculating the sampling noise floating point level according to the target wind speed.
[0118] Step 204: pass the sampling noise floating point level into a preset sampling function, determine the noise map to be sampled corresponding to the sampling noise floating point level through the preset sampling function, and sample the noise map to be sampled according to the texture map coordinates.
[0119] In the embodiment of the present application, before sampling the noise map, it is necessary to obtain a suitable noise map to be sampled. In this embodiment, the noise map to be sampled is determined based on the sampling noise floating point level by calculating the sampling noise floating point level, and the noise map is sampled. Specifically, it can be: the floating point level MipmapLevel is log2(MaxSpeed / max(WindSpeed, MinSpeed)), which is similar to the texture calculation MipmapLevel, where MaxSpeed and MinSpeed are material parameters for controlling the maximum and minimum swing frequencies, and WindSpeed is the target wind speed. The noise map is sampled through the SampleLevel function, and the floating point level is passed as MipmapLevel to the preset sampling function SampleLevel, and the noise map to be sampled is sampled through this function.
[0120] In an embodiment of the present application, optionally, it may also include: acquiring and storing a plurality of sampled noise map samples, wherein each of the sampled noise map samples is obtained by performing four-way continuous processing on an initial sampled noise map, and the initial sampled noise map is generated based on a preset noise point frequency.
[0121] In the above embodiment, the client can obtain and store multiple pre-generated sampled noise map samples, so that when generating a wind farm effect map, the pre-stored sampled noise map samples can be directly called locally for noise sampling, and then the wind farm effect map is rendered based on the noise map sampling results. Among them, the sampled noise map samples can be generated based on several specific noise frequencies. The lower the noise frequency, the lower the resolution required to store the noise. Correspondingly, the higher the noise frequency, the more a larger resolution picture is required to be saved, and the corresponding resolution can be determined according to the noise frequency. For example, noise maps with resolutions of 16, 32, 64, 128 and 256 can be generated as sampled noise map samples, which are stored in Mip4 to Mip0 respectively. The three RGB color channels and the alpha channel in the sample can be calculated by simplex noise SimplexNoise after a given resolution. In addition, in order to ensure that the noise sampling result will not jump, after the initial sampled noise map is generated based on the resolution corresponding to the preset noise frequency, the initial sampled noise map can be further processed to ensure that the processed noise Figure 4 The sampled noise graph samples with four-way continuity are obtained.
[0122] It should be noted that in order to ensure the quality of the wind field effect map, sampling noise map samples covering the entire optional wind speed range can be prepared in advance. For example, if the wind speed range is A to B, the corresponding noise frequency A and noise frequency B can be determined based on wind speed A and wind speed B respectively, and the resolution A and resolution B corresponding to the noise frequency A and noise frequency B can be determined respectively. The resolution range covering resolution A and resolution B is determined, and several specific values are selected within this resolution range to generate the corresponding initial sampling noise map. Finally, the initial sampling noise map is subjected to four-way continuous processing to obtain multiple sampling noise map samples.
[0123] In the embodiment of the present application, optionally, step 204 specifically includes:
[0124] Step 204-1, if the sampling noise floating point level matches the noise frequency corresponding to any sampled noise image sample, any matched sampled noise image sample is used as the noise image to be sampled, and the noise image to be sampled is sampled according to the texture map coordinates by using the preset sampling function;
[0125] Step 204-2, if the sampling noise floating-point number level does not match the noise frequency corresponding to each sampling noise map sample, then based on the sampling noise frequency corresponding to the sampling noise floating-point number level, obtain a sampling noise map sample whose noise frequency is greater than the sampling noise frequency and a sampling noise map sample whose noise frequency is less than the sampling noise frequency from the sampling noise map samples, respectively, as the noise map to be sampled, and interpolate and sample the noise map to be sampled according to the texture map coordinates through the preset sampling function.
[0126] In this embodiment, if the sampling noise floating point level calculated based on the target wind speed matches the noise frequency corresponding to any sampled noise map sample, then the matched sampled noise map sample is directly used as the noise map to be sampled, and the noise map is sampled by a preset sampling function. If the sampling noise floating point level does not match the noise frequency of each sampled noise map sample, then two sampled noise map samples closest to the sampling noise floating point level can be obtained as the noise map to be sampled, including a sample with a noise frequency greater than the sampling noise floating point level and a sample with a noise frequency less than the sampling noise floating point level, and the two noise maps to be sampled are interpolated and sampled by a preset sampling function. Specifically, if the MipmapLevel parameter passed into the SampleLevel function carries a decimal (non-integer), the system will automatically interpolate the adjacent Mip data of the noise map to be sampled, and the interpolated result can be obtained even in the vertex shader VertexShader calculation stage. By spanning at most two frequencies, the noise sampling results corresponding to the full range of wind speeds and wind fields can be obtained.
[0127] Step 205 , determining the RGB three-channel sampling results of each target sampling point as the local wind field noise offset of each target sampling point in three axial directions, wherein the wind field noise offset includes the local wind field noise offset.
[0128] Step 206 , based on the target wind speed and the wind field noise offset, respectively calculate the vertex displacement of each of the target sampling points, and render a wind field effect diagram including the target object based on the vertex displacement of each of the target sampling points.
[0129] In the above embodiment, after sampling the noise image to be sampled to obtain the sampling results, the offset of each target sampling point in the three axial directions of XYZ, that is, the local wind field noise offset, can be determined based on the RGB three-channel sampling results. Further, the vertex displacement of each vertex of the target object model is determined. The vertex displacement may include the accumulation of the vertex swing amplitude determined based on the target wind speed and the wind field noise offset. After determining the offset of each vertex of the model, the final wind field effect map can be rendered after the material lighting calculation of the pixel shader.
[0130] In an embodiment of the present application, optionally, after mapping the world coordinates to texture mapping coordinates, the method further includes: calculating the global texture mapping offset of each of the target sampling points based on the global wind speed corresponding to the global wind field, and offsetting the texture mapping coordinates of each of the target sampling points according to the global texture mapping offset; accordingly, step 206 includes: determining the alpha channel sampling result of each of the target sampling points as the global wind field noise offset of each of the target sampling points, wherein the wind field noise offset includes the global wind field noise offset.
[0131] In this embodiment, the target object in the wind field effect map can be affected by the global wind field and the local wind field. In vegetation rendering, the reason why the flow of wind is felt is that the noise map is moved along the direction of the wind frame by frame to simulate the effect of vegetation shifting with the wind. In the global wind field, the forward direction of the noise map is the same as the direction of the wind field, so the UV wind direction accumulation of each individual is the same. In the local wind field, the wind direction of the vegetation is often different from the direction of the global wind field, and the wind direction of each individual is also different, which leads to different parameters for the accumulation of UV wind direction of each vegetation, so ComputeShader is needed to calculate the UV wind direction accumulation result for each individual. The additional data storage and ComputeShader calculation make the local wind field algorithm difficult to use on the mobile platform, and on the PC platform, more engine changes are also needed for the algorithm. In order to bypass the wind direction accumulation process and reduce the amount of calculation, the embodiment of the present application keeps the individual UV wind direction accumulation of each vegetation unchanged (all the same). For a single vegetation, the UV wind direction accumulation remains unchanged, and vegetation of the same material is the same (vegetation of different materials may be different from vegetation because their material parameters LevelNoisePannarSpeed may be different, for example, broad-leaved vegetation, grass, trees and other objects have different materials), and offsets the UV coordinates based on the wind field influence coefficient to ensure that the flow direction of the noise map is from the root to the leaves, bypassing the dependence on the wind direction in the local wind field based on the simulation in the wind direction accumulation. There is no need to recalculate the UV wind direction accumulation for each vegetation using ComputeShader, reducing the amount of calculation. Specifically, the global UV offset can be accumulated when calculating the UV coordinates, and the global wind field noise is determined based on the alpha channel sampling results. The global wind field noise offset is accumulated when determining the vertex displacement of the target object model.
[0132] It should be noted that, in the embodiment of the present application, noise sampling can be performed frame by frame using multiple pre-stored sampled noise map samples, and the wind field effect map can be rendered frame by frame based on the noise sampling results. The method of making the wind field effect map of each frame can refer to the above embodiment. The vertex position of the target object in the latter frame of the effect map is related to the vertex position of the target object in the previous frame of the effect map. After playing the wind field effect map frame by frame, a wind field effect animation can be obtained.
[0133] In addition, the vertex colors of each vertex of the target object model can be determined in the following way: select some vertices of the model as Pivot, for example, for each branch, select a vertex at the bottom of the branch as Pivot, and then calculate the maximum distance MaxDis from all vertices of the model to these Pivot points, and subtract the position Pos2 of the corresponding Pivot point of each branch from the position Pos1 of each vertex on each branch divided by the maximum distance MaxDis, and then get the Pivot information, that is, the color information of each vertex Vcolor = (Pos1-Pos2) / MaxDis. Finally, write this Vcolor into the vertex color information of the model.
[0134] Further, as Figure 3 The specific implementation of the method, the embodiment of the present application provides a device for generating a wind field effect diagram, such as Figure 5 As shown, the device comprises:
[0135] A coordinate mapping module is used to obtain the world coordinates of a plurality of target sampling points and map the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of the target object located in the local wind field; based on the wind field influence coefficient corresponding to each of the target sampling points, the texture mapping coordinates of each of the target sampling points are offset respectively;
[0136] A sampling module, used for acquiring a noise map to be sampled that matches the target wind speed of the local wind field, and sampling the noise map to be sampled according to the texture map coordinates;
[0137] A rendering module is used to determine the wind field noise offset of each target sampling point based on the sampling result, and render a wind field effect diagram containing the target object according to the wind field noise offset.
[0138] Optionally, the sampling module is specifically used to:
[0139] Calculate the sampling noise floating point level according to the target wind speed;
[0140] The sampling noise floating point level is passed into a preset sampling function, the noise map to be sampled corresponding to the sampling noise floating point level is determined by the preset sampling function, and the noise map to be sampled is sampled according to the texture map coordinates.
[0141] Optionally, the sampling module is specifically used to:
[0142] If the sampling noise floating point number level matches the noise frequency corresponding to any sampled noise map sample, any matched sampled noise map sample is used as the noise map to be sampled, and the noise map to be sampled is sampled according to the texture map coordinates by the preset sampling function;
[0143] If the sampling noise floating-point number level does not match the noise frequency corresponding to each sampling noise map sample, then based on the sampling noise frequency corresponding to the sampling noise floating-point number level, a sampling noise map sample with a noise frequency greater than the sampling noise frequency and a sampling noise map sample with a noise frequency less than the sampling noise frequency are obtained from the sampling noise map samples as the noise map to be sampled, and the noise map to be sampled is interpolated and sampled according to the texture map coordinates through the preset sampling function.
[0144] Optionally, the device further comprises:
[0145] A noise map storage module is used to obtain and store multiple sampled noise map samples before obtaining the sampled noise map that matches the target wind speed of the wind farm, wherein each of the sampled noise map samples is obtained by performing four-way continuous processing on an initial sampled noise map, and the initial sampled noise map is generated based on a preset noise point frequency.
[0146] Optionally, the target object includes vegetation, the target sampling point includes a vegetation model vertex, and the magnitude of the wind field influence coefficient increases from a root vertex of the vegetation model to a top vertex of the vegetation model;
[0147] The coordinate mapping module is specifically used to calculate the texture mapping offset of each target sampling point based on the wind field influence coefficient, wind field direction and preset material parameters, and offset the texture mapping coordinates of each target sampling point according to the texture mapping offset.
[0148] Optionally, the rendering module is specifically used to:
[0149] The RGB three-channel sampling results of each target sampling point are respectively determined as the local wind field noise offset of each target sampling point in three axial directions, wherein the wind field noise offset includes the local wind field noise offset;
[0150] Based on the target wind speed and the wind field noise offset, the vertex displacement of each target sampling point is calculated respectively, and based on the vertex displacement of each target sampling point, a wind field effect diagram including the target object is rendered.
[0151] Optionally, the coordinate mapping module is further used to: calculate the global texture map offset of each target sampling point based on the global wind speed corresponding to the global wind field, and offset the texture map coordinates of each target sampling point according to the global texture map offset;
[0152] Correspondingly, the rendering module is further used to: determine the alpha channel sampling result of each target sampling point as the global wind field noise offset of each target sampling point, wherein the wind field noise offset includes the global wind field noise offset.
[0153] It should be noted that for other corresponding descriptions of the functional units involved in the device for generating a wind field effect diagram provided in the embodiment of the present application, reference can be made to Figure 3 to Figure 4 The corresponding description in the method will not be repeated here.
[0154] Based on the above Figure 3 to Figure 4 The method shown in the embodiment of the present application is accordingly provided with a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned Figure 3 to Figure 4 The method for generating the wind field effect diagram shown in FIG.
[0155] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0156] Based on the above Figure 3 to Figure 4 The method shown, and Figure 5 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 3 to Figure 4 The method for generating the wind field effect diagram shown in FIG.
[0157] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.
[0158] Those skilled in the art will appreciate that the computer device structure provided in this embodiment does not limit the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0159] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and saves the hardware and software resources of the computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the physical device.
[0160] Through the description of the above implementation methods, the technicians in this field can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware for the target object in the wind field. First, the world coordinates of the target sampling point on the target object model are obtained and mapped to the plane texture map coordinates. Secondly, the texture map coordinates of each point are offset based on the wind field influence coefficient of each target sampling point, and then the noise map to be sampled matching the wind speed of the wind field is obtained, and the noise map is sampled according to the offset texture map coordinates. The wind field noise offset of each target sampling point is determined by the sampling result, and then the position of each target sampling point after the offset caused by the wind field is determined, and finally the wind field effect map containing the target object is rendered. Compared with the method of simulating the wind field effect based on the periodic function in the prior art, the embodiment of the present application determines the offset data of the resources in the game scene based on the noise sampling result by sampling the noise map, so that the effect of the resources affected by the wind field is more random, and at the same time, the target sampling point is constrained based on the wind field influence coefficient, so as to ensure that the offset degree of each vertex of the target object is more in line with the objective law, and improve the authenticity of the wind field effect map.
[0161] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0162] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A method for generating a wind field effect diagram, characterized in that: The method comprises: Acquire world coordinates of a plurality of target sampling points, and map the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of target objects located in the wind field; Based on the target wind speed of the wind field, accumulating the wind direction of the texture map coordinates of each target sampling point; Acquire a noise map to be sampled that matches the target wind speed of the wind farm, and sample the noise map to be sampled according to the texture map coordinates; The RGB three-channel sampling results of the noise image to be sampled corresponding to each of the target sampling points are respectively determined as the wind field noise offsets of each of the target sampling points in three axial directions; based on the target wind speed and the wind field noise offset, the vertex displacement of each of the target sampling points is respectively calculated, and based on the vertex displacement of each of the target sampling points, a wind field effect image containing the target object is rendered.
2. The method according to claim 1, characterized in that The acquiring of a noise map to be sampled that matches the target wind speed of the wind farm and sampling the noise map to be sampled according to the texture map coordinates specifically includes: Calculate the sampling noise floating point level according to the target wind speed; The sampling noise floating point level is passed into a preset sampling function, the noise map to be sampled corresponding to the sampling noise floating point level is determined by the preset sampling function, and the noise map to be sampled is sampled according to the texture map coordinates.
3. The method according to claim 2, characterized in that The step of determining the noise map to be sampled corresponding to the sampling noise floating point level by the preset sampling function, and sampling the noise map to be sampled according to the texture map coordinates, specifically includes: If the sampling noise floating point number level matches the noise frequency corresponding to any sampled noise map sample, any matched sampled noise map sample is used as the noise map to be sampled, and the noise map to be sampled is sampled according to the texture map coordinates by the preset sampling function; If the sampling noise floating-point number level does not match the noise frequency corresponding to each sampling noise map sample, then based on the sampling noise frequency corresponding to the sampling noise floating-point number level, a sampling noise map sample with a noise frequency greater than the sampling noise frequency and a sampling noise map sample with a noise frequency less than the sampling noise frequency are obtained from the sampling noise map samples as the noise map to be sampled, and the noise map to be sampled is interpolated and sampled according to the texture map coordinates through the preset sampling function.
4. The method according to claim 2, characterized in that: Before obtaining the noise map to be sampled that matches the target wind speed of the wind farm, the method further includes: A plurality of sampled noise map samples are acquired and stored, wherein each of the sampled noise map samples is obtained by performing four-way continuous processing on an initial sampled noise map, and the initial sampled noise map is generated based on a preset noise point frequency.
5. The method according to claim 1, characterized in that The target object includes vegetation, and the target sampling point includes a vegetation model vertex; before obtaining a noise map to be sampled that matches the target wind speed of the wind field, the method further includes: Based on the wind field influence coefficient corresponding to each of the target sampling points, the texture map coordinates of each of the target sampling points are offset respectively, wherein the magnitude of the wind field influence coefficient increases from the root vertex of the vegetation model to the top vertex of the vegetation model.
6. The method according to claim 5, characterized in that The offsetting of the texture map coordinates of each target sampling point based on the wind field influence coefficient corresponding to each target sampling point specifically includes: Based on the wind field influence coefficient, the wind field direction and the preset material parameters, the texture map offset of each target sampling point is calculated respectively, and according to the texture map offset, the texture map coordinates of each target sampling point are offset respectively.
7. A device for generating a wind field effect diagram, characterized in that: The device comprises: A coordinate mapping module is used to obtain the world coordinates of a plurality of target sampling points and map the world coordinates into texture mapping coordinates, wherein the target sampling points are model vertices of target objects located in the wind field; based on the target wind speed of the wind field, the texture mapping coordinates of each target sampling point are accumulated in wind direction; A sampling module, used for acquiring a noise map to be sampled that matches the target wind speed of the wind farm, and sampling the noise map to be sampled according to the texture map coordinates; A rendering module is used to determine the RGB three-channel sampling results of the noise image to be sampled corresponding to each target sampling point as the wind field noise offset of each target sampling point in three axial directions; based on the target wind speed and the wind field noise offset, respectively calculate the vertex displacement of each target sampling point, and render a wind field effect image containing the target object based on the vertex displacement of each target sampling point.
8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Model element deformation processing and picture rendering method and device, equipment and medium
CN112132935A
Picture rendering method and device, computer equipment and storage medium
CN112132936A
Model element deformation processing method and device, picture rendering method and device, equipment and medium
CN112132938A