Rendering method of spray in virtual scene, storage medium and electronic equipment

By obtaining the normalized distance and intersection lines from the water surface model to the terrain model in a virtual three-dimensional scene, determining the texture map coordinates and mapping the wave map, the problem of poor wave display effect on mobile devices is solved, and high Quality wave simulation effect.

CN119295636APending Publication Date: 2025-01-10PERFECT WORLD INTERACTIVE ENTERTAINMENT (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311658229.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

In virtual three-dimensional scenes, the display effect of virtual waves on mobile devices is poor, especially because existing methods cannot maintain richness of details from a free perspective, resulting in a lack of realistic sense of wave effects and changes with the perspective.

Method used

By obtaining the normalization results on the distance and intersection lines of the water surface model to the terrain model in a virtual three-dimensional scene, we determine the texture map coordinates, and map the wave map to these coordinates, controlling them to scroll within a certain range to achieve a fixed orientation and the effect of scrolling within range.

Benefits of technology

It realizes the high-quality display of virtual waves on mobile devices, ensuring that they are fixed in a fixed direction and scroll within a certain range, solving the problem of poor wave display effect in the existing technology, and improving the richness of details and realistic sense.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295636A_ABST
    Figure CN119295636A_ABST
Patent Text Reader

Abstract

The invention relates to a method for rendering spindrift in a virtual scene, a storage medium and electronic equipment. The method comprises the steps that a first normalization result and a second normalization result are obtained, the first normalization result is a normalization result of the distance between each vertex on a water surface model in a virtual three-dimensional scene and a terrain model intersecting with the water surface model, and the second normalization result is a normalization result of the distance between each vertex on the water surface model and the terrain model intersecting with the water surface model; the second normalization result is a normalization result of the distance from each point on an intersection line of the water surface model and the terrain model to a standard point on the intersection line, and the standard point is a point determined from the intersection line; determining texture mapping coordinates of the water surface model according to the first normalization result and the second normalization result; and mapping the spindrift map to the texture map coordinate and controlling the spindrift map to roll within a certain range. The technical problem that the virtual spindrift display effect in the virtual scene of the mobile terminal is not good is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtual three-dimensional scenes, and in particular to a method for rendering waves in a virtual scene, a storage medium, and an electronic device. Background Art

[0002] In a virtual 3D scene, in order to improve the details of the lake surface, it is hoped that waves from the lake to the shore can be added at the junction of the lake surface and the shore. To meet this demand, the more common approach is to use the distance field method or the depth of the terrain under the lake surface to obtain the gradient area from the lake to the shore and then add waves.

[0003] However, if you want to use the distance field method, the mobile terminal does not support it. If you want to use the depth of the terrain under the lake to obtain the gradient area from the lake to the shore and then add waves, the gradient area calculated using the depth will change with the change of the perspective, which is not suitable for virtual scenes with free perspectives. In addition, the wave effect obtained using this method often lacks details and is more cartoon-like, which does not match the realistic style, resulting in a poor display effect of the waves. Summary of the invention

[0004] The present application provides a method, device, storage medium and electronic device for rendering waves in a virtual scene, so as to solve the technical problem of poor display effect of virtual waves in a virtual scene on a mobile terminal.

[0005] In a first aspect, the present application provides a method for rendering waves in a virtual scene, comprising: obtaining a first normalized result and a second normalized result, wherein the first normalized result is a normalized result of the distance from each vertex on a water surface model in the virtual three-dimensional scene to a terrain model intersecting with the water surface model, and the second normalized result is a normalized result of the distance from each point on the intersection line of the water surface model and the terrain model to a standard point on the intersection line, and the standard point is a point determined from the intersection line; determining the texture mapping coordinates of the water surface model based on the first normalized result and the second normalized result; mapping a wave map to the texture mapping coordinates and controlling the wave map to scroll within a certain range.

[0006] In a second aspect, the present application provides a device for rendering waves in a virtual scene, and when the device is running, the method for rendering waves in the virtual scene is implemented.

[0007] In a third aspect, the present application provides an electronic device comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor is configured to implement any one of the above-mentioned methods for rendering waves in a virtual scene when executing the computer program.

[0008] In a fourth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the method for rendering waves in a virtual scene of any one of the above items of the present application.

[0009] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application, by obtaining a first normalization result and a second normalization result, wherein the first normalization result is a normalization result of the distance from each vertex on the water surface model in the virtual three-dimensional scene to the terrain model intersecting with the water surface model, and the second normalization result is a normalization result of the distance from each point on the intersection line of the water surface model and the terrain model to a standard point on the intersection line, and the standard point is a point determined on the intersection line; according to the first normalization result, The texture map coordinates of the water surface model are determined by combining the normalization result and the second normalization result; the wave map is mapped to the texture map coordinates and the wave map is controlled to scroll within a certain range. When displaying virtual waves, the texture map coordinates of the water surface model can be determined through the water surface model and the terrain model, and the wave map is mapped on the texture map coordinates, and the wave map is controlled to scroll within a certain range, thereby ensuring that the direction of the wave map is fixed and it scrolls within a certain range, realizing the simulation of the waves, and solving the problem of poor display effect of the waves on the mobile terminal in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0011] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0012] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0013] Figure 1 A flowchart of a method for rendering waves in a virtual scene provided in an embodiment of the present application;

[0014] Figure 2 A schematic diagram of a terrain model and a water surface model of a method for rendering waves in a virtual scene provided in an embodiment of the present application;

[0015] Figure 3 A schematic diagram of a terrain model and a water surface model of another method for rendering waves in a virtual scene provided in an embodiment of the present application;

[0016] Figure 4 A schematic diagram of the distance from a vertex to a terrain model in a method for rendering waves in a virtual scene provided in an embodiment of the present application;

[0017] Figure 5 A schematic diagram of the distance from a vertex to a standard point on a boundary line of a method for rendering waves in a virtual scene provided in an embodiment of the present application;

[0018] Figure 6 A flowchart of a system for rendering waves in a virtual scene provided in an embodiment of the present application;

[0019] Figure 7 A schematic diagram of the structure of a device for rendering waves in a virtual scene provided in an embodiment of the present application;

[0020] Figure 8 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0022] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0023] In order to solve the technical problem of poor display effect of virtual waves in mobile virtual scenes in the prior art, the present application provides a method for rendering waves in a virtual scene, which can achieve the purpose of improving the display effect of virtual waves.

[0024] Figure 1 The present invention provides a flowchart of a method for rendering waves in a virtual scene. Figure 1 As shown, the rendering method of the waves in the above virtual scene includes:

[0025] S102, obtaining a first normalization result and a second normalization result, wherein the first normalization result is a normalized result of the distance from each vertex on the water surface model in the virtual three-dimensional scene to the terrain model intersecting with the water surface model, and the second normalization result is a normalized result of the distance from each point on the intersection line of the water surface model and the terrain model to a standard point on the intersection line, where the standard point is a point determined on the intersection line;

[0026] S104, determining the texture mapping coordinates of the water surface model according to the first normalization result and the second normalization result;

[0027] S106, mapping the wave spray map to the texture map coordinates and controlling the wave spray map to scroll within a certain range.

[0028] The virtual three-dimensional scene in this embodiment includes at least a water surface model and a terrain model. The terrain model may be a shore (or may include part of the land below the water surface or only the shore), and the water surface model is part of the water surface. Figure 2 It is an exemplary top view of the shore and water surface of a certain area, wherein part 202 is the shore, part 204 is the water surface, and the two intersect at an intersection line. Figure 3 is a schematic cross-sectional view (side view) of the two, wherein the shore portion 302 and the water surface model portion 304 intersect. In this embodiment, when performing data calculation, the horizontal surface portion 306 of the terrain model 302 and the horizontal surface portion 306 of the water surface model can be used for calculation to determine the wave map, without calculating the underground and underwater parts. The terrain model and water surface model mentioned in the text refer to Figure 3 The horizontal plane portion 306 in the.

[0029] The first normalized result is the normalized result of the distance from each vertex on the water surface model in the virtual three-dimensional scene to the intersection line where the water surface model and the terrain model intersect. The intersection of the water surface model and the terrain model on the horizontal plane forms a curve, which can be called the intersection line. Each vertex on the water surface model can be a vertex on the horizontal plane of the water surface model, or all vertices on the horizontal plane and the part below the horizontal plane. Calculate the distance from the vertex to the intersection line, normalize the distance, and obtain the first normalized result.

[0030] The above second normalization result is to select a point on the above intersection line as a standard point, the standard point is randomly selected, and then calculate the distance from each point on the intersection line to the standard point, and normalize the distance to obtain the second normalization result.

[0031] According to the first normalization result and the second normalization result, the texture map coordinates of the water surface model can be determined. The texture map coordinates are used to mark the position of the texture map, that is, where on the water surface model the texture map of the water surface model is pasted.

[0032] After the texture coordinates are determined, the wave map can be mapped to the texture coordinates. In addition, the wave map can be controlled to scroll within a certain range to achieve the effect of lake waves.

[0033] This embodiment obtains a first normalization result and a second normalization result, wherein the first normalization result is a normalized result of the distance from each vertex on the water surface model in the virtual three-dimensional scene to the terrain model intersecting with the water surface model, and the second normalization result is a normalized result of the distance from each point on the intersection line of the water surface model and the terrain model to a standard point on the intersection line, and the standard point is a point determined from the intersection line; determines the texture map coordinates of the water surface model according to the first normalization result and the second normalization result; and maps a wave map to the texture map coordinates and controls the wave map to scroll within a certain range. When displaying virtual waves, the texture map coordinates of the water surface model can be determined through the water surface model and the terrain model, and the wave map is mapped on the texture map coordinates, and the wave map is controlled to scroll within a certain range, thereby ensuring that the direction of the wave map is fixed and the effect of scrolling within a certain range is achieved, realizing the simulation of the waves, and solving the problem of poor display effect of the waves in the prior art.

[0034] As an optional example, obtaining the first normalized result includes: obtaining the distance from each vertex on the water surface model to the terrain model; and performing a normalization operation on the distance to obtain the first normalized result.

[0035] In this embodiment, the water surface model is a model surrounded by multiple model vertices. For the vertex on the horizontal plane, the distance from the vertex to the terrain model is calculated, and the distance is the minimum distance from the vertex to the terrain model. After calculating the distance, each vertex corresponds to a distance, and the distance is normalized to obtain a first normalized result. Normalizing the distance can be multiplying the distance by a coefficient to normalize the distance to a number between 0 and 1.

[0036] As an optional example, obtaining the distance from each vertex on the water surface model to the terrain model includes: obtaining the first coordinate of each vertex on the water surface model in the virtual three-dimensional scene; drawing a perpendicular line from the first coordinate to each face of the terrain model; and determining the smallest perpendicular line as the distance from the first coordinate to the first coordinate to the terrain model.

[0037] In this embodiment, when calculating the distance from each vertex on the water surface model to the terrain model, each vertex on the water surface model is used as the current vertex, and then a perpendicular line is drawn from the current vertex to the surface of the terrain model. There may be multiple perpendicular lines, and the perpendicular line with the shortest distance is selected from them, and the length of the perpendicular line is used as the distance from the current vertex to the terrain model.

[0038] For example, Figure 4 As shown, Figure 4 Point 402 is a vertex on the water surface model (the actual number and density of vertices are not limited and depend on the actual situation). Taking vertex 402 as an example, a perpendicular line is drawn from the vertex to the terrain model 202, and the shortest perpendicular line is the distance from the vertex to the terrain model.

[0039] As an optional example, obtaining the second normalized result includes: randomly determining a point on the intersection line as a standard point; obtaining the distance from each point on the intersection line to the standard point; and comparing each distance with the maximum distance among the distances to obtain the second normalized result.

[0040] In this embodiment, when calculating the second normalization result, after randomly determining a point on the intersection line as a standard point, the distances from other points on the intersection line to the standard point can be determined. Figure 5 As shown, Figure 5 In the example, if the vertex 502 on the intersection line is a standard point, the distances from other vertices on the intersection line, such as the vertex 504 to the standard point 502, are calculated, thereby obtaining the distances from each vertex on the intersection line to the standard point.

[0041] After calculating the distance from each point to the standard point, select the largest distance as the denominator and each distance as the numerator to calculate multiple numbers between 0 and 1, which are the second normalization results.

[0042] As an optional example, determining the texture mapping coordinates of the water surface model based on the first normalization result and the second normalization result includes: creating new texture mapping coordinates, where the texture mapping coordinates are a two-dimensional vector; using the first normalization result as the y channel in the texture mapping coordinates; and using the second normalization result as the x channel in the texture mapping coordinates.

[0043] In this embodiment, after obtaining the first normalization result and the second normalization result, a two-dimensional vector can be established as the texture mapping coordinate. The two-dimensional vector includes two channels, namely the x channel and the y channel, which represent the x-axis and y-axis values ​​of the texture mapping coordinate in the virtual three-dimensional scene. The above-mentioned first normalization result and the second normalization result are used as the values ​​of the x channel and the y channel in the two-dimensional vector. Specifically, the first normalization result is used as the value of the y channel, which represents the value of the y channel formed by the normalized result of the distance from the point on the water surface model to the intersection line, and the value of the x channel is the second normalization result, which represents the value of the x channel formed by the normalized result of the distance from the point on the intersection line to the standard point.

[0044] The above texture mapping coordinates are UV coordinates, which means that all image files are a two-dimensional plane. The horizontal direction is U and the vertical direction is V. Through this plane, the two-dimensional UV coordinate system can locate any pixel on the image. Create a new texture mapping coordinate, that is, create a UV coordinate with an empty value, the horizontal direction is the x channel, and the vertical direction is the y channel. Then, fill the value of the first normalization result and the value of the second normalization result into the texture mapping coordinate. For example (the following values ​​and quantities are only for example), the first normalization result is: 0.1, 0.3, 0.1, 0.2, 0.5, 0.6, 0.5, 0.2, and the second normalization result is 0.6, 0.3, 0.4, 0.6, 0.6, 0.5, 0.8, 0.5, then, you get the coordinate pairs of multiple pixel points: (0.1, 0.6), (0.3, 0.3), (0.1, 0.4), ... (0.2, 0.5).

[0045] As an optional example, mapping the spray map to the texture mapping coordinates includes: sampling the value on the y channel of the spray map to the y channel of the texture mapping coordinates, and sampling the value on the x channel of the spray map to the x channel of the texture mapping coordinates.

[0046] In this embodiment, after the texture mapping coordinates are determined, the spray map can be mapped to the texture mapping coordinates, specifically, the value on the y channel of the spray map is sampled to the y channel of the texture mapping coordinates, and the value on the x channel of the spray map is sampled to the x channel of the texture mapping coordinates. Since the y channel on the texture mapping coordinates is the first normalized result, and the x channel on the texture mapping coordinates is the second normalized result, and the first normalized result is the normalized result of the distance from the point on the water surface model to the terrain model, and the second normalized result is the normalized result from the point on the intersection line to the standard point, therefore, after the spray map is sampled to the texture mapping coordinates, the position and orientation of the spray map are consistent with the orientation of the water surface model.

[0047] For example, continuing with the above example, after the texture mapping coordinates are determined, the texture mapping coordinates contain a series of pixel coordinate pairs, such as (0.1, 0.6), (0.3, 0.3), (0.1, 0.4), ... (0.2, 0.5) in the above examples. According to the coordinates of each pixel point, the pixel point at the corresponding position is sampled from the wave map and sampled into the texture mapping coordinates, thereby saving a series of pixel points in the wave map in the texture mapping coordinates.

[0048] As an optional example, controlling the wave map to scroll within a certain range includes: obtaining a preset target interval; when controlling the wave map to scroll, determining that the maximum coordinate value in the wave map is less than the right endpoint of the target interval, and determining that the minimum coordinate value in the wave map is greater than the left endpoint of the target interval.

[0049] In this embodiment, when controlling the wave map to scroll within a certain range, a target interval needs to be determined, and the target interval is the scrolling range of the wave map. The target interval can be the interval of the coordinates corresponding to the y channel, and the coordinates corresponding to the x channel remain unchanged. That is, the wave map is controlled to scroll within a range away from or close to the shore, rather than horizontally scrolling flush with the shore.

[0050] In this embodiment, when controlling the wave map to scroll within a certain range, the coordinates corresponding to the y channel can be enlarged or reduced according to a certain ratio. For example, the coordinates of the y channels in the above examples (0.1, 0.6), (0.3, 0.3), (0.1, 0.4), ... (0.2, 0.5) are enlarged or reduced, and the original x channel coordinates remain unchanged. After the y channel coordinates change, the pixels sampled from the wave map will also change. For example, for a certain pixel point originally sampled, after the y channel coordinates change, the pixel point above or below the original pixel point is sampled. By expanding or reducing the coordinates of the y channel as a whole, the pixel points above or below the original pixel point are batch sampled to form a wave effect.

[0051] For example, after transforming the y channel coordinates of the pixel points of the wave crest of the originally collected wave map, the pixel points of the wave tail of the collected wave map can be transformed by transforming the y channel coordinates, thereby achieving the effect of successively collecting different wave positions of the wave map. In terms of external performance, it shows the effect of the waves moving within a certain range.

[0052] Figure 6 It is a system flow chart of this embodiment.

[0053] First, obtain all water surface models and terrain models that intersect with the water surface. When calculating, use the data of the horizontal plane, and do not use the data on the ground and below the horizontal plane. For the water surface model, traverse the lake surface model and perform the following operations on it: calculate the distance from each vertex on the water surface model to the terrain model, normalize the distance according to a distance range parameter, obtain the first normalized result, and store it in the vertex color of the model; calculate a second normalized result according to the boundary between the water surface and the shore; use the above normalized results to calculate a new set of texture mapping coordinates uv for the water surface model, specifically use the first normalized result as the y channel and the second normalized result as the x channel. Then perform the following calculations on the material: map the wave map (foam map) to the newly generated uv above, that is, use the x and y channels of uv to sample the foam map, and control the map to scroll at a certain speed; use the normalized distance, multiplied by a range parameter as the range of the wave to prevent the wave from moving beyond the range. Finally, save the model and material.

[0054] In this embodiment, information such as the distance field is baked into the water surface model itself. In this way, there is enough data information to generate detailed waves, and there is no need to store the distance field of the entire scene. The consumption is low and there is no problem in applying it to mobile terminals. At the same time, since the information of the model itself is used, it is irrelevant to the line of sight and the terrain under the lake. Therefore, the generated waves do not change with the viewing angle, nor do they fit the terrain behind the lake, and look more natural.

[0055] Figure 7 The present invention provides a schematic diagram of a structure of a device for rendering waves in a virtual scene. Figure 7 As shown, the rendering device of the waves in the above virtual scene includes:

[0056] The acquisition module 702 is used to acquire a first normalization result and a second normalization result, wherein the first normalization result is a normalization result of the distance from each vertex on the water surface model in the virtual three-dimensional scene to the terrain model intersecting with the water surface model, and the second normalization result is a normalization result of the distance from each point on the intersection line of the water surface model and the terrain model to a standard point on the intersection line, where the standard point is a point determined from the intersection line;

[0057] A determination module 704, configured to determine the texture mapping coordinates of the water surface model according to the first normalization result and the second normalization result;

[0058] The mapping module 706 is used to map the wave spray map to the texture map coordinates and control the wave spray map to scroll within a certain range.

[0059] The virtual three-dimensional scene in this embodiment includes at least a water surface model and a terrain model. The terrain model may be a shore (or may include part of the land below the water surface or only the shore), and the water surface model is part of the water surface. Figure 2 It is an exemplary top view of the shore and water surface of a certain area, wherein part 202 is the shore, part 204 is the water surface, and the two intersect at an intersection line. Figure 3 is a schematic cross-sectional view (side view) of the two, wherein the shore portion 302 and the water surface model portion 304 intersect. In this embodiment, when performing data calculation, the horizontal surface portion 306 of the terrain model 302 and the horizontal surface portion 306 of the water surface model can be used for calculation to determine the wave map, without calculating the underground and underwater parts. The terrain model and water surface model mentioned in the text refer to Figure 3 The horizontal plane portion 306 in the.

[0060] The first normalized result is the normalized result of the distance from each vertex on the water surface model in the virtual three-dimensional scene to the intersection line where the water surface model and the terrain model intersect. The intersection of the water surface model and the terrain model on the horizontal plane forms a curve, which can be called the intersection line. Each vertex on the water surface model can be a vertex on the horizontal plane of the water surface model, or all vertices on the horizontal plane and the part below the horizontal plane. Calculate the distance from the vertex to the intersection line, normalize the distance, and obtain the first normalized result.

[0061] The above second normalization result is to select a point on the above intersection line as a standard point, the standard point is randomly selected, and then calculate the distance from each point on the intersection line to the standard point, and normalize the distance to obtain the second normalization result.

[0062] According to the first normalization result and the second normalization result, the texture map coordinates of the water surface model can be determined. The texture map coordinates are used to mark the position of the texture map, that is, where on the water surface model the texture map of the water surface model is pasted.

[0063] After the texture coordinates are determined, the wave map can be mapped to the texture coordinates. In addition, the wave map can be controlled to scroll within a certain range to achieve the effect of lake waves.

[0064] This embodiment obtains a first normalization result and a second normalization result, wherein the first normalization result is a normalized result of the distance from each vertex on the water surface model in the virtual three-dimensional scene to the terrain model intersecting with the water surface model, and the second normalization result is a normalized result of the distance from each point on the intersection line of the water surface model and the terrain model to a standard point on the intersection line, and the standard point is a point determined from the intersection line; determines the texture map coordinates of the water surface model according to the first normalization result and the second normalization result; and maps a wave map to the texture map coordinates and controls the wave map to scroll within a certain range. When displaying virtual waves, the texture map coordinates of the water surface model can be determined through the water surface model and the terrain model, and the wave map is mapped on the texture map coordinates, and the wave map is controlled to scroll within a certain range, thereby ensuring that the direction of the wave map is fixed and the effect of scrolling within a certain range is achieved, realizing the simulation of the waves, and solving the problem of poor display effect of the waves in the prior art.

[0065] For other examples of this embodiment, please refer to the above examples and will not be described in detail here.

[0066] like Figure 8 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0067] Memory 113, used for storing computer programs;

[0068] In one embodiment of the present application, the processor 111 is used to implement the method for rendering waves in a virtual scene provided by any one of the aforementioned method embodiments when executing the program stored in the memory 113.

[0069] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of a method for rendering waves in a virtual scene provided in any of the aforementioned method embodiments are implemented.

[0070] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0071] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0072] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0073] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for rendering waves in a virtual scene, characterized in that: include: Obtaining a first normalization result and a second normalization result, wherein the first normalization result is a normalization result of the distance from each vertex on a water surface model in a virtual three-dimensional scene to a terrain model intersecting with the water surface model, and the second normalization result is a normalization result of the distance from each point on an intersection line between the water surface model and the terrain model to a standard point on the intersection line, wherein the standard point is a point determined from the intersection line; Determining texture mapping coordinates of the water surface model according to the first normalization result and the second normalization result; The wave map is mapped to the texture map coordinates and the wave map is controlled to scroll within a certain range.

2. The method according to claim 1, characterized in that Acquiring the first normalization result includes: Obtaining the distance from each vertex on the water surface model to the terrain model; A normalization operation is performed on the distance to obtain the first normalization result.

3. The method according to claim 2, characterized in that The obtaining of the distance from each vertex on the water surface model to the terrain model comprises: Obtaining a first coordinate of each vertex on the water surface model in the virtual three-dimensional scene; Draw a perpendicular line from the first coordinate to each surface of the terrain model; A minimum perpendicular line is determined as the distance from the first coordinate to the terrain model.

4. The method according to claim 1, characterized in that: Obtaining the second normalization result includes: Randomly determine a point on the intersection line as the standard point; Obtain the distance from each point on the intersection line to the standard point; Each of the distances is compared with the maximum distance among the distances to obtain the second normalized result.

5. The method according to claim 1, characterized in that: Determining the texture mapping coordinates of the water surface model according to the first normalization result and the second normalization result includes: Create the texture mapping coordinates, wherein the texture mapping coordinates are a two-dimensional vector; Using the first normalized result as the y channel in the texture map coordinates; The second normalized result is used as the x channel in the texture map coordinates.

6. The method according to claim 5, characterized in that Mapping the spray map to the texture map coordinates comprises: The value on the y channel of the spray map is sampled to the y channel of the texture mapping coordinates, and the value on the x channel of the spray map is sampled to the x channel of the texture mapping coordinates.

7. The method according to claim 1, characterized in that The controlling the wave map to scroll within a certain range comprises: Get the preset target interval; When controlling the scrolling of the spray map, it is determined that the maximum value of the coordinates in the spray map is smaller than the right endpoint of the target interval, and it is determined that the minimum value of the coordinates in the spray map is larger than the left endpoint of the target interval.

8. A device for rendering waves in a virtual scene, characterized in that: The device executes the method according to any one of claims 1 to 7 when running.

9. An electronic device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; At least one memory connected to the at least one bus, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method described in any one of claims 1 to 7 of the present application.