Terrain rendering method and device in game, electronic equipment and storage medium

By calculating the height difference of the terrain and adjusting the normal direction, dynamically adjusting the UV coordinates of RVT samples, the problem of Z-direction texture stretching in terrain rendering is solved, and the rendering effect and applicability are improved.

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

Patent Information

Application Number
CN202411985673.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In existing terrain rendering technology in the existing game, texture stretching occurs in the Z direction, affecting visual effects and rendering performance.

Method used

By calculating the height difference of an object relative to the terrain surface and adjusting the height difference using the normal direction, the height offset value is obtained. Dynamically adjust the UV coordinates of RVT samples based on the height offset value to correct texture stretching.

Benefits of technology

The transition effect between the terrain and the intersection area between objects is achieved more realistic, the rendering effect is improved, and it is suitable for different terrain and object rendering, with stronger applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119524402A_ABST
    Figure CN119524402A_ABST
Patent Text Reader

Abstract

The invention provides a terrain rendering method and device in a game, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: acquiring height data of a target terrain and original position information of each vertex in a target object; determining height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object and the normal direction information of each vertex; determining target position information of each vertex according to the height offset information and the original position information of each vertex; and rendering and displaying an intersection area of the target terrain and the target object according to the target position information of each vertex. According to the scheme, the UV coordinates of the RVT sampling are dynamically adjusted based on the height offset information to correct the texture stretching phenomenon during the RVT sampling, so that the transition effect of the object and terrain intersection area is more real, and the rendering effect of the terrain and object intersection area is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for rendering terrain in a game. Background Art

[0002] In the field of game development, seamless connection between terrain and 3D models is one of the key factors to improve visual quality and enhance immersion. RVT (Runtime Virtual Texturing) is an emerging and efficient terrain rendering technology that is gradually being widely used in game development. The sampling process of RVT is mainly carried out on the XY plane, which works well on the horizontal plane, but will cause serious texture stretching when sampling in the Z direction.

[0003] Currently, the method based on the viewing angle and the normal direction of the terrain surface is often used to remove or adjust areas that may cause severe texture stretching. This method calculates the angle between the normal and the line of sight of each terrain fragment. When the angle exceeds a certain threshold, the fragment is removed or specially processed.

[0004] However, the above method will cause visual discontinuity, affect the overall visual effect, and increase additional overhead, affecting rendering performance. Summary of the invention

[0005] The purpose of this application is to provide a terrain rendering method, device, electronic device and storage medium in a game, so as to overcome the texture stretching problem during terrain rendering and improve the authenticity of the terrain rendering results.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a terrain rendering method in a game, comprising:

[0008] Acquire height data of a target terrain and original position information of each vertex in a target object, wherein the target object is an object intersecting with the target terrain;

[0009] Determine, according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex, the height offset information of each vertex in the target object, wherein the height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain;

[0010] Determining target position information of each vertex according to the height offset information of each vertex and the original position information;

[0011] According to the target position information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0012] In a second aspect, an embodiment of the present application further provides a terrain rendering device in a game, comprising: an acquisition module, a determination module, and a rendering module;

[0013] The acquisition module is used to acquire the height data of the target terrain and the original position information of each vertex in the target object, wherein the target object is an object intersecting with the target terrain;

[0014] The determination module is used to determine the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object and the normal direction information of each vertex, wherein the height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain;

[0015] The determination module is used to determine the target position information of each vertex according to the height offset information of each vertex and the original position information;

[0016] The rendering module is used to render and display the intersection area of ​​the target terrain and the target object according to the target position information of each vertex.

[0017] In a third aspect, an embodiment of the present application provides an electronic device comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to execute the terrain rendering method in the game provided in the first aspect.

[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the terrain rendering method in the game provided in the first aspect is executed.

[0019] The beneficial effects of this application are:

[0020] The present application provides a terrain rendering method, device, electronic device and storage medium in a game, including: obtaining the height data of the target terrain and the original position information of each vertex in the target object; determining the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object and the normal direction information of each vertex; determining the target position information of each vertex according to the height offset information and the original position information of each vertex; rendering and displaying the intersection area of ​​the target terrain and the target object according to the target position information of each vertex. The method calculates the height difference of the object relative to the terrain surface and adjusts the height difference by the normal direction to obtain the height offset information of the terrain height and the object in the world coordinate system, so that the target position information of each vertex in the target object can be obtained according to the height offset information, and the target position information is used as the sampling position information of the RVT, thereby realizing the dynamic adjustment of the UV coordinates of the RVT sampling based on the height offset information, so as to correct the texture stretching phenomenon during the RVT sampling, so that the transition effect of the intersection area between the object and the terrain is more realistic, and the rendering effect of the intersection area between the terrain and the object is improved.

[0021] Secondly, since the texture sampling result can be dynamically adjusted by extracting the height offset information, the present solution can dynamically adapt to the rendering of different terrains and objects and has stronger applicability.

[0022] In addition, the implementation of this solution is relatively simple, will not significantly increase rendering time and performance burden, and the solution operates more efficiently. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0024] Figure 1 A flowchart of a terrain rendering method in a game provided by an embodiment of the present application;

[0025] Figure 2 A schematic diagram of a flow chart of another terrain rendering method in a game provided by an embodiment of the present application;

[0026] Figure 3 A schematic diagram of a plane division of an object provided in an embodiment of the present application;

[0027] Figure 4 A schematic diagram of a flow chart of another method for terrain rendering in a game provided in an embodiment of the present application;

[0028] Figure 5 A schematic diagram of a flow chart of another terrain rendering method in a game provided by an embodiment of the present application;

[0029] Figure 6 A schematic diagram of a flow chart of another method for terrain rendering in a game provided in an embodiment of the present application;

[0030] Figure 7 A schematic diagram of a flow chart of another terrain rendering method in a game provided by an embodiment of the present application;

[0031] Figure 8 A schematic diagram of a flow chart of another method for terrain rendering in a game provided in an embodiment of the present application;

[0032] Fig. 9 A schematic diagram of a flow chart of another terrain rendering method in a game provided by an embodiment of the present application;

[0033] Fig.10 A schematic diagram of a flow chart of another terrain rendering method in a game provided by an embodiment of the present application;

[0034] Fig.11 A schematic diagram of a flow chart of another method for terrain rendering in a game provided in an embodiment of the present application;

[0035] Fig.12 A schematic diagram of a rendering result provided in an embodiment of the present application;

[0036] Fig.13 A schematic diagram of a terrain rendering device in a game provided by an embodiment of the present application;

[0037] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0038] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme 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. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0039] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0040] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0041] First, some professional terms that may be involved in the following embodiments are briefly explained:

[0042] Shader: A program used to generate images in computer graphics, coloring objects on the screen.

[0043] Material: A collection of properties used to define the appearance of a 3D model surface. In a game engine, it is generally composed of a shader and a texture. It contains information describing the color, texture, reflectivity, transparency, gloss, and other information of the model surface, as well as properties that control how the model reflects, refracts, and scatters light.

[0044] UV coordinates: A coordinate system used to describe texture mapping. Texture mapping is a technique for applying a texture image to a flat or curved surface, which can make the appearance of a 3D model surface more realistic and detailed. When performing texture mapping, it is necessary to map the pixel coordinates in the texture image to the surface of the 3D model, which requires the use of texture coordinates. Texture coordinates are usually a two-dimensional coordinate system that describes the pixel position in the texture image. When performing texture mapping, the shader will look up the corresponding color value in the texture image according to the texture coordinates corresponding to each pixel, and apply it to the model surface to achieve the effect of texture mapping.

[0045] Sampling coordinates: A coordinate system used to sample texture images. When performing texture mapping, the shader needs to obtain the corresponding pixel color value from the texture image, which requires the use of sampling coordinates to specify the pixel position to be obtained.

[0046] Sampling coordinates are usually an extension of texture coordinates and can be two-dimensional, three-dimensional, or higher-dimensional coordinates. When sampling textures, the shader will look up the corresponding color value in the texture image based on the sampling coordinates corresponding to each pixel, and apply it to the model surface to achieve the effect of texture mapping.

[0047] World Space Coordinates: World space coordinates refer to positions in a global coordinate system. They are absolute coordinates relative to the entire scene, as opposed to local space coordinates (such as model local coordinates).

[0048] Normal: A normal is a vector perpendicular to a surface, used to describe the direction of the surface. In graphics rendering, normals are used to calculate lighting and reflection effects.

[0049] Seam: A seam is the boundary between different textures or planes. In triplanar mapping, discontinuities may appear in the seam area and need to be smoothed to avoid visual artifacts.

[0050] Linear interpolation (Lerp): Linear interpolation is a mathematical method for smooth transition between two values. In graphics rendering, it is often used to blend different texture sampling results.

[0051] Temporal Anti-Aliasing (TAA): Temporal anti-aliasing is a technique that reduces jagged edges by sampling and averaging in the temporal dimension. It uses information from multiple frames to smooth image edges.

[0052] Dither Temporal Anti-Aliasing (DitherTAA): DitherTAA combines dithering and temporal anti-aliasing techniques to achieve smoother texture effects and reduce visual artifacts and jagged effects by accumulating and averaging over time.

[0053] Next, the relevant background of this plan is explained:

[0054] In the field of game development, the seamless connection between terrain and 3D models is one of the key factors to improve visual quality and enhance immersion. With the continuous improvement of hardware performance and the increasing requirements of players for graphic details, traditional terrain rendering technology has been unable to meet the needs of complex and changing scenes. As an emerging and efficient terrain rendering technology, RVT has gradually been widely used in game development.

[0055] RVT greatly improves rendering efficiency and detail performance by storing terrain texture information in the form of virtual textures, sampling and rendering them at runtime. Specifically, the core principle of RVT is to preprocess the terrain's height map, normal map, and other related texture information into virtual textures, and then perform real-time sampling from these virtual textures to complete terrain rendering. However, the sampling process of RVT is mainly performed on the XY plane, which works well on the horizontal plane, but will cause severe texture stretching when sampling in the Z direction.

[0056] This texture stretching phenomenon is mainly due to the fact that RVT adopts a top-down perspective by default when capturing terrain data. There is a lack of effective correction mechanism for texture sampling on vertical surfaces, which causes the texture coordinates in the Z direction to fail to correctly reflect the real terrain details.

[0057] In order to overcome the above challenges, a new technical solution is urgently needed that can solve the problem of RVT texture stretching in the Z direction without significantly increasing the computational overhead, thereby improving the quality of seamless connection between terrain and model.

[0058] At present, the commonly used methods to solve the texture stretching of RVT in the Z direction are mainly the following:

[0059] 1. Angle elimination method:

[0060] Principle: Based on the viewing angle and the normal direction of the terrain surface, areas that may cause severe texture stretching are eliminated or adjusted. This method calculates the angle between the normal and the line of sight of each terrain fragment. When the angle exceeds a certain threshold, the fragment is eliminated or specially processed.

[0061] Advantages: Simple and easy to implement, and can effectively reduce severe texture stretching.

[0062] Disadvantages: Visual discontinuity: At certain viewing angles, visual discontinuity may occur due to the removal of fragments exceeding the threshold angle. This discontinuity is particularly obvious at the joints of complex terrain or models, affecting the overall visual effect and immersion.

[0063] Computational cost: Each time you render, you need to calculate the normal and view angle of each terrain fragment and decide whether to cull it, which adds additional computational cost. For large terrain or complex scenes, this calculation may significantly affect rendering performance.

[0064] Applicability limitations: Angle culling has limited effectiveness when dealing with completely vertical models, such as tree trunks. When basically all RVT parts are stretched, culling will simply cull it all and cannot solve the effect problem.

[0065] 2. Multi-layer texture mapping:

[0066] Principle: Use multiple layers of texture mapping at different angles to ensure that good texture details can be obtained at different viewing angles. Typical methods include triplanar mapping, which projects the texture onto the XY, XZ, and YZ planes respectively, and blends these projection results according to the normal direction.

[0067] Advantages: It can significantly reduce texture stretching in the Z direction and maintain consistent texture details under multiple viewing angles.

[0068] Disadvantages: Computational complexity: Triplanar mapping requires three texture sampling and blending operations for each fragment, which increases the computational complexity and workload of the shader. This has high performance requirements for real-time rendering and may affect frame rate and overall performance.

[0069] Based on this, this solution provides a terrain rendering method in the game, which calculates the height difference of the object relative to the terrain surface and adjusts the height difference in the normal direction to obtain the height offset value, and then dynamically adjusts the UV coordinates of the RVT sampling based on the height offset value to correct the texture stretching phenomenon during RVT sampling, making the transition effect of the intersection area of ​​the object and the terrain more realistic, thereby improving the rendering effect of the intersection area of ​​the terrain and the object.

[0070] Figure 1 A flowchart of a terrain rendering method in a game provided by an embodiment of the present application; the execution subject of this solution may be a computer device, such as Figure 1 As shown, the method may include:

[0071] S101, obtaining height data of target terrain and original position information of each vertex in the target object.

[0072] The target terrain may refer to the terrain to be rendered, and the target object may refer to the object that intersects with the target terrain. For example, if a tall building stands on the ground, the ground is the target terrain, and the tall building is the target object.

[0073] The height data of the target terrain may refer to the height of a point where the target terrain and the target object meet. The height data of the target terrain may be obtained by identifying a height map of the target terrain.

[0074] The original position information of each vertex in the target object may refer to the absolute position coordinates of each vertex in the world coordinate system.

[0075] S102: Determine height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex.

[0076] The height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain.

[0077] According to the height data of the target terrain and the original position information of each vertex in the target object, the height difference of each vertex relative to the terrain surface of the target terrain can be calculated first, and then the height difference is adjusted in combination with the normal direction information of each vertex to obtain the height offset information of each vertex in the target object.

[0078] S103: Determine target position information of each vertex according to the height offset information and original position information of each vertex.

[0079] In some embodiments, based on the height offset information of each vertex and the original position information of each vertex, the target position information of each vertex can be calculated respectively, and the target position information can be input to RTV as the new sampling position of each vertex in the target object for texture sampling.

[0080] By calculating the terrain height data of the target terrain and the height offset information of each vertex in the target object in the world coordinate system, the texture sampling coordinates of each vertex in the target object can be dynamically adjusted to correct the texture stretching phenomenon in the Z direction during RTV sampling, so that texture rendering is performed based on the calculated target position information of each vertex in the target object, making the joint between the target terrain and the target object more natural and smooth.

[0081] S104 , rendering and displaying the intersection area of ​​the target terrain and the target object according to the target position information of each vertex.

[0082] Optionally, the target position information of each vertex can be used as input data for RVT sampling, so that when the RVT is running, texture sampling can be performed from the virtual texture of the target terrain according to the target position information of each vertex, and the intersection area of ​​the target terrain and the target object can be rendered and displayed according to the sampling result. The intersection area here also refers to the seam area.

[0083] It is worth noting that the virtual texture of the target terrain can be generated in advance according to the set height map, normal map and other relevant texture information of the target terrain. Then, in the process of real-time rendering based on RVT, RVT can perform texture sampling from the virtual texture in real time to complete the rendering of the intersection area of ​​the target terrain and the target object in real time.

[0084] This solution samples the virtual texture of the target terrain onto the target object so that the texture of the intersection area between the target object and the target terrain can be integrated with the texture of the target terrain itself, thereby making the joint connection between the target terrain and the target object more natural.

[0085] In summary, the terrain rendering method in the game provided by this embodiment includes: obtaining the height data of the target terrain and the original position information of each vertex in the target object; determining the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object and the normal direction information of each vertex; determining the target position information of each vertex according to the height offset information and the original position information of each vertex; rendering and displaying the intersection area of ​​the target terrain and the target object according to the target position information of each vertex. This method calculates the height difference of the object relative to the terrain surface and adjusts the height difference by the normal direction to obtain the height offset information of the terrain height and the object in the world coordinate system, so that according to the height offset information, the target position information of each vertex in the target object can be obtained, and the target position information is used as the sampling position information of the RVT, thereby realizing the dynamic adjustment of the UV coordinates of the RVT sampling based on the height offset information, so as to correct the texture stretching phenomenon during RVT sampling, so that the transition effect of the intersection area between the object and the terrain is more realistic, and the rendering effect of the intersection area between the terrain and the object is improved.

[0086] Figure 2 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; optionally, in step S102, determining the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex may include:

[0087] S201 : Determine the height difference of each vertex relative to the terrain surface according to the height data of the target terrain and the original position information of each vertex in the target object.

[0088] The height difference of each vertex in the target object refers to the height difference of each vertex relative to the terrain surface of the target terrain, and each vertex corresponds to a designated point in the target terrain, and the designated point may be a point located on the same vertical line as the vertex.

[0089] For each vertex in the target object, the height difference of each vertex in the target object can be determined according to the original position information of each vertex and the height data of each vertex corresponding to a designated point in the target terrain.

[0090] S202 : Determine the height difference of each vertex in the first plane and the height difference of each vertex in the second plane according to the height difference of each vertex relative to the terrain surface.

[0091] Next, the height difference of each vertex relative to the terrain surface may be decomposed into a first plane and a second plane, where the first plane may be an x-plane and the second plane may be a y-plane.

[0092] Figure 3This is a schematic diagram of a plane division of an object provided in an embodiment of the present application. Figure 3 As shown, the x plane is the first plane, the y plane is the second plane, and the z plane is the third plane.

[0093] Since RVT sampling is done from top to bottom, when the sampled texture is projected to the z plane, it is the same as the sampling method, and there will be no texture stretching, so no additional processing calculation is required. However, when the texture is projected to the x and y planes, it is inconsistent with the sampling method, and texture stretching occurs, so the texture mapping method of the x and y planes needs to be adjusted, and the core of the adjustment is to be implemented based on the height offset information.

[0094] Optionally, the height difference of each vertex relative to the terrain surface can be multiplied by the vector (1, 0) to obtain the height difference of each vertex in the first plane; the height difference of each vertex relative to the terrain surface can be multiplied by the vector (0, 1) to obtain the height difference of each vertex in the second plane.

[0095] S203 , determining height offset information of each vertex on the first plane according to the height difference of each vertex on the first plane, normal direction information of each vertex, and original position information of each vertex.

[0096] Since the height difference of each vertex in the first plane and the height difference of each vertex in the second plane obtained by decomposition are both two-dimensional vectors, and the original position information of the vertex is three-dimensional coordinates, the height difference can also be adjusted by the normal direction information of each vertex to adjust the two-dimensional height difference to three-dimensional height offset information.

[0097] The normal direction information of each vertex is a three-dimensional vector. The height offset information of each vertex in the first plane can be obtained by multiplying the height difference of each vertex in the first plane by the normal direction information of each vertex and adding the original position information of each vertex.

[0098] S204: Determine height offset information of each vertex on the second plane according to the height difference of each vertex on the second plane, normal direction information of each vertex, and original position information of each vertex.

[0099] Similarly, the height offset information of each vertex in the second plane is obtained by multiplying the height difference of each vertex in the second plane by the normal direction information of each vertex and adding the original position information of each vertex.

[0100] Figure 4 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; Optionally, in step S203, determining the target position information of each vertex according to the height offset information and the original position information of each vertex may include:

[0101] S401, dividing the surface of the target object into multiple planes.

[0102] The multiple planes include at least a first plane and a second plane.

[0103] Based on the generated mask information of the target object on different planes, the surface of the target object can be divided into multiple planes, and the multiple planes at least include the above-mentioned x plane and y plane, and further, may include the z plane. However, this embodiment focuses on processing the x plane and the y plane.

[0104] S402: Determine vertices belonging to the first plane and vertices belonging to the second plane respectively.

[0105] Based on the divided planes, it is possible to determine which vertices on the target object belong to the x-plane and which vertices belong to the y-plane, that is, to determine the vertices contained in the x-plane and the vertices contained in the y-plane.

[0106] S403 , determining target position information of each vertex in the first plane according to original position information of each vertex in the first plane, height offset information of each vertex in the first plane in the first plane, and height offset information of each vertex in the first plane in the second plane.

[0107] Next, the target position information of each vertex can be obtained by interpolating each vertex in the x-plane, and the target position information of each vertex can be obtained by interpolating each vertex in the y-plane.

[0108] Optionally, for each vertex in the x-plane, an interpolation operation can be performed based on the original position information of each vertex and the height offset information of each vertex in the x-plane and the height offset information of each vertex in the y-plane to obtain the target position information of each vertex in the first plane.

[0109] S404: Determine target position information of each vertex in the second plane according to original position information of each vertex in the second plane, height offset information of each vertex in the second plane in the first plane, and height offset information of each vertex in the second plane in the second plane.

[0110] Similarly, for each vertex in the y plane, an interpolation operation can be performed based on the original position information of each vertex and the height offset information of each vertex in the y plane and the height offset information of each vertex in the x plane to obtain the target position information of each vertex in the second plane.

[0111] Figure 5A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; optionally, in step S403, determining the target position information of each vertex in the first plane according to the original position information of each vertex in the first plane, the height offset information of each vertex in the first plane, and the height offset information of each vertex in the first plane in the second plane may include:

[0112] S501 , performing a first interpolation according to original position information of a target vertex in a first plane and height offset information of the target vertex in the first plane to determine an intermediate interpolation result.

[0113] Taking the operation of any target vertex in the x-plane as an example, the height offset information of the target vertex in the x-plane and the original position information of the target vertex may be interpolated to obtain an intermediate interpolation result.

[0114] S502 , performing a second interpolation according to the intermediate interpolation result and the height offset information of the target vertex in the second plane to determine the target position information of the target vertex in the first plane.

[0115] The intermediate interpolation result is then interpolated again with the height offset information of the target vertex in the y plane, and the target position information of any target vertex in the x plane can be obtained.

[0116] If the operation of any target vertex in the y plane is taken as an example, the height offset information of the target vertex in the y plane and the original position information of the target vertex can be interpolated to obtain an intermediate interpolation result, and then the intermediate interpolation result and the height offset information of the target vertex in the x plane are interpolated again to obtain the target position information of any target vertex in the y plane.

[0117] For any vertex in the z plane, the original position information of the vertex can be used as the target position information of the vertex, that is, the position coordinates of the vertex in the z plane do not need to be additionally processed.

[0118] Figure 6 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; optionally, in step S104, rendering and displaying the intersection area of ​​the target terrain and the target object according to the target position information of each vertex may include:

[0119] S601. Determine sampling position information of each vertex in a target object according to target position information of each vertex.

[0120] In some embodiments, the target position information of each vertex may be used as the sampling position information of each vertex, and the sampling position information of each vertex may be input into the RVT for texture sampling.

[0121] S602: Sample the virtual texture of the target terrain according to the sampling position information of each vertex, and render and display the intersection area of ​​the target terrain and the target object.

[0122] Optionally, when running, the RVT can sample the texture data of each vertex from the virtual texture of the target terrain according to the sampling position information of each vertex, and render and display the intersection area of ​​the target terrain and the target object according to the texture data.

[0123] Figure 7 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; Optionally, in step S402, respectively determining the vertices belonging to the first plane and the vertices belonging to the second plane may include:

[0124] S701 . According to mask information of the target object, determine each vertex located in a first plane mask of the target object as a vertex belonging to the first plane.

[0125] The mask information of the target object can be generated according to the coordinate information of each vertex in the target object. Through the mask generation technology, the mask of the target object in the x plane, the mask of the y plane and the mask of the z plane can be generated. In other words, the surface of the target object is divided into three planes, the x plane corresponds to the mask of the x plane, the y plane corresponds to the mask of the y plane, and the z plane corresponds to the mask of the z plane.

[0126] Each vertex included in the x-plane mask may be regarded as a vertex belonging to the first plane.

[0127] S702: Determine each vertex located in the second plane mask of the target object as a vertex belonging to the second plane.

[0128] Similarly, each vertex included in the y-plane mask can be regarded as a vertex belonging to the second plane.

[0129] Figure 8 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; optionally, in step S701, before determining each vertex located in the first plane mask of the target object as a vertex belonging to the first plane according to the mask information of the target object, the method may further include:

[0130] S801 : Generate initial mask information of the target object according to original position information of each vertex in the target object.

[0131] The initial mask information at least includes: initial mask information of a first plane of the target object and initial mask information of a second plane of the target object.

[0132] In some embodiments, the coordinate information of each vertex in different planes can be extracted based on the original position coordinates of each vertex in the target object, so that based on the extracted coordinate information of different planes, the initial mask information of the x plane of the target object and the initial mask information of the y plane of the target object can be generated respectively by using mask generation technology. The mask information is also the data representation of the mask image. Generating the mask information can also be understood as generating the mask image. The mask information is usually composed of a data set, and the data set is composed of 0 or 1 pixel points. Based on the mask information, a corresponding mask image can be generated.

[0133] When the initial mask information of the x-plane and the initial mask information of the y-plane of the target object are known, the initial mask information of the z-plane can be directly calculated through mathematical calculation.

[0134] S802: Determine the mask seam information of each plane according to the set mask seam range parameters and the initial mask information.

[0135] There are seams between any two plane masks, and the mask seam range parameters may include a minimum range parameter min and a maximum range parameter max, which may be set according to the requirements of the seams.

[0136] The seam range parameters between different plane masks can be set to the same data.

[0137] The mask seam information of each plane can be determined respectively according to the set mask seam range parameters and the initial mask information.

[0138] For the x-plane, the mask seam information of the x-plane may include: the mask seam information of the x-plane and the y-plane and the mask seam information of the x-plane and the z-plane. The mask seam information of the x-plane and the y-plane is the same as the mask seam information of the y-plane and the x-plane.

[0139] S803 , performing dithering processing and temporal anti-aliasing processing on the mask seam information of each plane to obtain processed mask seam information of each plane.

[0140] DitherTAA (dithered temporal anti-aliasing and temporal anti-aliasing) can be used to perform noise reduction processing on the mask seam information of each plane to make a smooth transition on the seam, making the seam more natural and vivid, and obtaining the processed mask seam information of each plane.

[0141] S804 : Generate mask information of the target object according to the processed mask seam information of each plane and the initial mask information.

[0142] Afterwards, according to the processed mask seam information of each plane and the initial mask information of each plane, the mask information of each plane can be generated respectively.

[0143] Fig. 9 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; Optionally, in step S802, the mask seam information of each plane is determined according to the set mask seam range parameters and the initial mask information, which may include:

[0144] S901 . Generate smooth seam information corresponding to the first plane according to mask seam range parameters and initial mask information of the first plane.

[0145] The smooth seam information corresponding to the first plane includes: the smooth seam information between the first plane and the second plane and the smooth seam information between the first plane and the third plane.

[0146] Taking the calculation of the x-plane as an example, the SmoothStep function can be used to calculate the smooth seam information corresponding to the x-plane. The formula of the SmoothStep function is as follows:

[0147]

[0148] Among them, min refers to the minimum range parameter mentioned above, max refers to the maximum range parameter mentioned above, and value refers to the initial mask information. When calculating the smooth seam information of the x plane, value takes the initial mask information of the x plane. The value m returned by the function is the smooth seam information of the plane.

[0149] S902 , reversely process the smooth seam information corresponding to the first plane to obtain reversed smooth seam information corresponding to the first plane.

[0150] Assuming that the smooth seam information of the x-plane is SmoothStepx, then the smooth seam information after the inversion of the x-plane can be calculated by (1-SmoothStepx).

[0151] S903 . Determine mask seam information of the first plane according to the smooth seam information corresponding to the first plane and the inverted smooth seam information corresponding to the first plane.

[0152] Next, the mask seam information of the first plane may be calculated according to SmoothStepx*(1-SmoothStepx).

[0153] Fig.10 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; Optionally, in step S804, generating mask information of a target object according to processed mask seam information of each plane and initial mask information may include:

[0154] S1001. Add the processed mask seam information of the first plane to the initial mask information of the first plane to obtain an intermediate result.

[0155] Continuing with the x-plane as an example, the processed mask seam information of the x-plane may be added to the initial mask information of the x-plane to obtain an intermediate result.

[0156] S1002: Process the intermediate result to obtain mask information of the first plane of the target object.

[0157] Optionally, the intermediate result may be rounded off, that is, the intermediate result may be rounded off to an integer to obtain the mask information of the x-plane, which is also the final mask information of the x-plane.

[0158] In one implementable manner, in step S103, the target position information of each vertex is determined based on the height offset information and the original position information of each vertex, and it may also include: determining the target position information of each vertex based on the height offset information of each vertex, the original position information of each vertex and the mask information of each plane.

[0159] Optionally, the height offset information of the vertex in the x-plane may be interpolated with the original position information according to the mask information of the x-plane to obtain an intermediate result, and then the intermediate result may be interpolated with the height offset information in the y-plane according to the mask information of the y-plane to obtain the target position information of the vertex.

[0160] Fig.11 A flowchart of another terrain rendering method in a game provided by an embodiment of the present application; optionally, in step S602, sampling the virtual texture of the target terrain according to the sampling position information of each vertex, and rendering and displaying the intersection area of ​​the target terrain and the target object may include:

[0161] S1101 . Determine the texture position of each vertex in the virtual texture according to the sampling position information of each vertex.

[0162] The virtual texture is the virtual texture of the target terrain.

[0163] Since each vertex in the target object corresponds to a UV coordinate, the position of the texture information to be sampled can be determined from the virtual texture according to the UV coordinate corresponding to each vertex.

[0164] Therefore, according to the sampling position information of each vertex, the texture position corresponding to each vertex can be determined from the virtual texture through the UV coordinates corresponding to the sampling position information.

[0165] S1102: Determine texture information of each vertex according to the texture position corresponding to each vertex.

[0166] The texture information at the texture position corresponding to each vertex is obtained as the texture information of each vertex.

[0167] S1103 . Render and display the intersection area of ​​the target terrain and the target object according to the texture information of each vertex.

[0168] According to the texture information of each vertex, the intersection area of ​​the target object and the target terrain can be rendered and displayed.

[0169] Fig.12 A schematic diagram of a rendering result provided in an embodiment of the present application is shown in FIG. Fig.12 (a) in the figure shows the rendering result that is not processed by this solution. Obviously, there is texture stretching in the intersection area between the object and the terrain in the unprocessed rendering result. Fig.12 (b) in the figure shows the rendering result after being processed by this solution. It can be seen that the texture transition in the intersection area between the object and the terrain is more natural and realistic, and the texture stretching phenomenon is corrected.

[0170] In summary, the terrain rendering method in the game provided by this embodiment includes: obtaining the height data of the target terrain and the original position information of each vertex in the target object; determining the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object and the normal direction information of each vertex; determining the target position information of each vertex according to the height offset information and the original position information of each vertex; rendering and displaying the intersection area of ​​the target terrain and the target object according to the target position information of each vertex. This method calculates the height difference of the object relative to the terrain surface and adjusts the height difference by the normal direction to obtain the height offset information of the terrain height and the object in the world coordinate system, so that according to the height offset information, the target position information of each vertex in the target object can be obtained, and the target position information is used as the sampling position information of the RVT, thereby realizing the dynamic adjustment of the UV coordinates of the RVT sampling based on the height offset information, so as to correct the texture stretching phenomenon during RVT sampling, so that the transition effect of the intersection area between the object and the terrain is more realistic, and the rendering effect of the intersection area between the terrain and the object is improved.

[0171] Secondly, since the texture sampling result can be dynamically adjusted by extracting the height offset information, the present solution can dynamically adapt to the rendering of different terrains and objects and has stronger applicability.

[0172] In addition, the implementation of this solution is relatively simple, will not significantly increase rendering time and performance burden, and the solution operates more efficiently.

[0173] The following describes the apparatus, device, storage medium, etc. used to execute the terrain rendering method in the game provided by this application. The specific implementation process and technical effects are described above and will not be repeated below.

[0174] Fig.13 A schematic diagram of a terrain rendering device in a game provided by an embodiment of the present application, wherein the functions implemented by the terrain rendering device in the game correspond to the steps performed by the above method. The device can be understood as the above computer device, or can be a server, or a processor of a server, or can be understood as a component independent of the above server or processor that implements the functions of the present application under the control of the server, such as Fig.13 As shown, the device may include: an acquisition module 130, a determination module 131 and a rendering module 132;

[0175] An acquisition module 130 is used to acquire the height data of the target terrain and the original position information of each vertex in the target object, where the target object is an object that intersects with the target terrain;

[0176] A determination module 131 is used to determine the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex, wherein the height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain;

[0177] A determination module 131, used to determine target position information of each vertex according to the height offset information and original position information of each vertex;

[0178] The rendering module 132 is used to render and display the intersection area of ​​the target terrain and the target object according to the target position information of each vertex.

[0179] Optionally, the determination module 131 is specifically configured to determine the height difference of each vertex relative to the terrain surface according to the height data of the target terrain and the original position information of each vertex in the target object;

[0180] According to the height difference of each vertex relative to the terrain surface, respectively determine the height difference of each vertex in the first plane and the height difference of each vertex in the second plane;

[0181] Determine the height offset information of each vertex in the first plane according to the height difference of each vertex in the first plane, the normal direction information of each vertex and the original position information of each vertex;

[0182] Height offset information of each vertex on the second plane is determined according to the height difference of each vertex on the second plane, normal direction information of each vertex and original position information of each vertex.

[0183] Optionally, the determination module 131 is specifically configured to divide the surface of the target object into a plurality of planes, the plurality of planes at least comprising: a first plane and a second plane;

[0184] Determine the vertices belonging to the first plane and the vertices belonging to the second plane respectively;

[0185] Determine target position information of each vertex in the first plane according to original position information of each vertex in the first plane, height offset information of each vertex in the first plane in the first plane, and height offset information of each vertex in the first plane in the second plane;

[0186] Target position information of each vertex in the second plane is determined according to original position information of each vertex in the second plane, height offset information of each vertex in the second plane in the first plane, and height offset information of each vertex in the second plane in the second plane.

[0187] Optionally, the determination module 131 is specifically configured to perform a first interpolation according to the original position information of the target vertex in the first plane and the height offset information of the target vertex in the first plane to determine an intermediate interpolation result;

[0188] A second interpolation is performed according to the intermediate interpolation result and the height offset information of the target vertex in the second plane to determine the target position information of the target vertex in the first plane.

[0189] Optionally, the rendering module 132 is specifically configured to determine the sampling position information of each vertex in the target object according to the target position information of each vertex;

[0190] According to the sampling position information of each vertex, the virtual texture of the target terrain is sampled, and the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0191] Optionally, the determination module 131 is specifically configured to determine, according to the mask information of the target object, each vertex located in the first plane mask of the target object as a vertex belonging to the first plane;

[0192] Each vertex located in the second plane mask of the target object is determined as a vertex belonging to the second plane.

[0193] Optionally, it also includes: a generation module;

[0194] A generating module, used to generate initial mask information of the target object according to the original position information of each vertex in the target object; the initial mask information at least includes: initial mask information of the first plane of the target object and initial mask information of the second plane of the target object;

[0195] According to the set mask seam range parameters and the initial mask information, the mask seam information of each plane is determined respectively;

[0196] Performing jitter processing and temporal anti-aliasing processing on the mask seam information of each plane to obtain processed mask seam information of each plane;

[0197] The mask information of the target object is generated according to the processed mask seam information of each plane and the initial mask information.

[0198] Optionally, the determination module 131 is specifically configured to generate smooth seam information corresponding to the first plane according to the mask seam range parameter and the initial mask information of the first plane, wherein the smooth seam information corresponding to the first plane includes: smooth seam information between the first plane and the second plane and smooth seam information between the first plane and the third plane;

[0199] Reverse processing is performed on the smooth seam information corresponding to the first plane to obtain reversed smooth seam information corresponding to the first plane;

[0200] The mask seam information of the first plane is determined according to the smooth seam information corresponding to the first plane and the inverted smooth seam information corresponding to the first plane.

[0201] Optionally, a generating module is specifically configured to add the processed mask seam information of the first plane to the initial mask information of the first plane to obtain an intermediate result;

[0202] The intermediate result is processed to obtain mask information of the first plane of the target object.

[0203] Optionally, the rendering module 132 is specifically used to determine the texture position of each vertex in the virtual texture according to the sampling position information of each vertex; the virtual texture is a virtual texture of the target terrain;

[0204] Determine the texture information of each vertex according to the texture position corresponding to each vertex;

[0205] According to the texture information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0206] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0207] The above modules can be connected or communicated with each other via a wired connection or a wireless connection. The wired connection may include a metal cable, an optical cable, a hybrid cable, etc., or any combination thereof. The wireless connection may include a connection in the form of a LAN, a WAN, Bluetooth, a ZigBee, or NFC, or any combination thereof. Two or more modules may be combined into a single module, and any one module may be divided into two or more units. Those skilled in the art will clearly understand that for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application.

[0208] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application includes: a processor 801, a storage medium 802 and a bus 803, wherein the storage medium 802 stores machine-readable instructions executable by the processor 801. When the electronic device runs a terrain rendering method in a game in the embodiment, the processor 801 communicates with the storage medium 802 via the bus 803, and the processor 801 executes the machine-readable instructions to perform the following steps:

[0209] Acquire the height data of the target terrain and the original position information of each vertex in the target object, where the target object is an object that intersects with the target terrain;

[0210] Determine the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex, wherein the height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain;

[0211] Determine the target position information of each vertex according to the height offset information and the original position information of each vertex;

[0212] According to the target position information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0213] In a feasible implementation, when the processor 801 determines the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex, it is specifically used to: determine the height offset information of each vertex relative to the terrain surface according to the height data of the target terrain and the original position information of each vertex in the target object;

[0214] According to the height difference of each vertex relative to the terrain surface, respectively determine the height difference of each vertex in the first plane and the height difference of each vertex in the second plane;

[0215] Determine the height offset information of each vertex in the first plane according to the height difference of each vertex in the first plane, the normal direction information of each vertex and the original position information of each vertex;

[0216] Height offset information of each vertex on the second plane is determined according to the height difference of each vertex on the second plane, normal direction information of each vertex and original position information of each vertex.

[0217] In a feasible implementation, when the processor 801 determines the target position information of each vertex according to the height offset information and the original position information of each vertex, it is specifically used to: divide the surface of the target object into multiple planes, and the multiple planes include at least: a first plane and a second plane;

[0218] Determine the vertices belonging to the first plane and the vertices belonging to the second plane respectively;

[0219] Determine target position information of each vertex in the first plane according to original position information of each vertex in the first plane, height offset information of each vertex in the first plane in the first plane, and height offset information of each vertex in the first plane in the second plane;

[0220] Target position information of each vertex in the second plane is determined according to original position information of each vertex in the second plane, height offset information of each vertex in the second plane in the first plane, and height offset information of each vertex in the second plane in the second plane.

[0221] In a feasible implementation scheme, when the processor 801 determines the target position information of each vertex in the first plane according to the original position information of each vertex in the first plane, the height offset information of each vertex in the first plane in the first plane, and the height offset information of each vertex in the first plane in the second plane, it is specifically used to: perform a first interpolation according to the original position information of the target vertex in the first plane and the height offset information of the target vertex in the first plane to determine the intermediate interpolation result;

[0222] A second interpolation is performed according to the intermediate interpolation result and the height offset information of the target vertex in the second plane to determine the target position information of the target vertex in the first plane.

[0223] In a feasible implementation, when the processor 801 performs rendering and displaying the intersection area of ​​the target terrain and the target object according to the target position information of each vertex, it is specifically used to: determine the sampling position information of each vertex in the target object according to the target position information of each vertex;

[0224] According to the sampling position information of each vertex, the virtual texture of the target terrain is sampled, and the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0225] In a feasible implementation, when the processor 801 performs the process of respectively determining the vertices belonging to the first plane and the vertices belonging to the second plane, the processor 801 is specifically configured to: determine, according to the mask information of the target object, each vertex located in the first plane mask of the target object as a vertex belonging to the first plane;

[0226] Each vertex located in the second plane mask of the target object is determined as a vertex belonging to the second plane.

[0227] In a feasible implementation manner, before the processor 801 determines each vertex located in the first plane mask of the target object as a vertex belonging to the first plane according to the mask information of the target object, it is further used to: generate initial mask information of the target object according to the original position information of each vertex in the target object; the initial mask information at least includes: initial mask information of the first plane of the target object and initial mask information of the second plane of the target object;

[0228] According to the set mask seam range parameters and the initial mask information, the mask seam information of each plane is determined respectively;

[0229] Performing jitter processing and temporal anti-aliasing processing on the mask seam information of each plane to obtain processed mask seam information of each plane;

[0230] The mask information of the target object is generated according to the processed mask seam information of each plane and the initial mask information.

[0231] In a feasible implementation manner, when the processor 801 executes the mask seam information of each plane according to the set mask seam range parameter and the initial mask information, it is specifically used to generate smooth seam information corresponding to the first plane according to the mask seam range parameter and the initial mask information of the first plane, and the smooth seam information corresponding to the first plane includes: smooth seam information between the first plane and the second plane and smooth seam information between the first plane and the third plane;

[0232] Reverse processing is performed on the smooth seam information corresponding to the first plane to obtain reversed smooth seam information corresponding to the first plane;

[0233] The mask seam information of the first plane is determined according to the smooth seam information corresponding to the first plane and the inverted smooth seam information corresponding to the first plane.

[0234] In a feasible implementation manner, when the processor 801 generates the mask information of the target object according to the processed mask seam information of each plane and the initial mask information, it is specifically used to add the processed mask seam information of the first plane to the initial mask information of the first plane to obtain an intermediate result;

[0235] The intermediate result is processed to obtain mask information of the first plane of the target object.

[0236] In a feasible implementation, the processor 801 is specifically used to determine the texture position of each vertex in the virtual texture according to the sampling position information of each vertex when sampling the virtual texture of the target terrain according to the sampling position information of each vertex and rendering and displaying the intersection area of ​​the target terrain and the target object; the virtual texture is the virtual texture of the target terrain;

[0237] Determine the texture information of each vertex according to the texture position corresponding to each vertex;

[0238] According to the texture information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0239] Among them, the storage medium 802 stores program code, and when the program code is executed by the processor 801, the processor 801 executes various steps of the terrain rendering method in the game according to various exemplary embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0240] Processor 801 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.

[0241] Storage medium 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), programmable read-only memory (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic memory, disk, optical disk, etc. The memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The storage medium 802 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0242] Optionally, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor performs the following steps:

[0243] Acquire the height data of the target terrain and the original position information of each vertex in the target object, where the target object is an object that intersects with the target terrain;

[0244] Determine the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex, wherein the height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain;

[0245] Determine the target position information of each vertex according to the height offset information and the original position information of each vertex;

[0246] According to the target position information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0247] In a feasible implementation, when the processor 801 determines the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex, it is specifically used to: determine the height difference of each vertex relative to the terrain surface according to the height data of the target terrain and the original position information of each vertex in the target object;

[0248] According to the height difference of each vertex relative to the terrain surface, respectively determine the height difference of each vertex in the first plane and the height difference of each vertex in the second plane;

[0249] Determine the height offset information of each vertex in the first plane according to the height difference of each vertex in the first plane, the normal direction information of each vertex and the original position information of each vertex;

[0250] Height offset information of each vertex on the second plane is determined according to the height difference of each vertex on the second plane, normal direction information of each vertex and original position information of each vertex.

[0251] In a feasible implementation, when the processor 801 determines the target position information of each vertex according to the height offset information and the original position information of each vertex, it is specifically used to: divide the surface of the target object into multiple planes, and the multiple planes include at least: a first plane and a second plane;

[0252] Determine the vertices belonging to the first plane and the vertices belonging to the second plane respectively;

[0253] Determine target position information of each vertex in the first plane according to original position information of each vertex in the first plane, height offset information of each vertex in the first plane in the first plane, and height offset information of each vertex in the first plane in the second plane;

[0254] Target position information of each vertex in the second plane is determined according to original position information of each vertex in the second plane, height offset information of each vertex in the second plane in the first plane, and height offset information of each vertex in the second plane in the second plane.

[0255] In a feasible implementation scheme, when the processor 801 determines the target position information of each vertex in the first plane according to the original position information of each vertex in the first plane, the height offset information of each vertex in the first plane in the first plane, and the height offset information of each vertex in the first plane in the second plane, it is specifically used to: perform a first interpolation according to the original position information of the target vertex in the first plane and the height offset information of the target vertex in the first plane to determine the intermediate interpolation result;

[0256] A second interpolation is performed according to the intermediate interpolation result and the height offset information of the target vertex in the second plane to determine the target position information of the target vertex in the first plane.

[0257] In a feasible implementation, when the processor 801 performs rendering and displaying the intersection area of ​​the target terrain and the target object according to the target position information of each vertex, it is specifically used to: determine the sampling position information of each vertex in the target object according to the target position information of each vertex;

[0258] According to the sampling position information of each vertex, the virtual texture of the target terrain is sampled, and the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0259] In a feasible implementation, when the processor 801 performs the process of respectively determining the vertices belonging to the first plane and the vertices belonging to the second plane, the processor 801 is specifically configured to: determine, according to the mask information of the target object, each vertex located in the first plane mask of the target object as a vertex belonging to the first plane;

[0260] Each vertex located in the second plane mask of the target object is determined as a vertex belonging to the second plane.

[0261] In a feasible implementation manner, before the processor 801 determines each vertex located in the first plane mask of the target object as a vertex belonging to the first plane according to the mask information of the target object, it is further used to: generate initial mask information of the target object according to the original position information of each vertex in the target object; the initial mask information at least includes: initial mask information of the first plane of the target object and initial mask information of the second plane of the target object;

[0262] According to the set mask seam range parameters and the initial mask information, the mask seam information of each plane is determined respectively;

[0263] Performing jitter processing and temporal anti-aliasing processing on the mask seam information of each plane to obtain processed mask seam information of each plane;

[0264] The mask information of the target object is generated according to the processed mask seam information of each plane and the initial mask information.

[0265] In a feasible implementation manner, when the processor 801 executes the mask seam information of each plane according to the set mask seam range parameter and the initial mask information, it is specifically used to generate smooth seam information corresponding to the first plane according to the mask seam range parameter and the initial mask information of the first plane, and the smooth seam information corresponding to the first plane includes: smooth seam information between the first plane and the second plane and smooth seam information between the first plane and the third plane;

[0266] Reverse processing is performed on the smooth seam information corresponding to the first plane to obtain reversed smooth seam information corresponding to the first plane;

[0267] The mask seam information of the first plane is determined according to the smooth seam information corresponding to the first plane and the inverted smooth seam information corresponding to the first plane.

[0268] In a feasible implementation manner, when the processor 801 generates the mask information of the target object according to the processed mask seam information of each plane and the initial mask information, it is specifically used to add the processed mask seam information of the first plane to the initial mask information of the first plane to obtain an intermediate result;

[0269] The intermediate result is processed to obtain mask information of the first plane of the target object.

[0270] In a feasible implementation, the processor 801 is specifically used to determine the texture position of each vertex in the virtual texture according to the sampling position information of each vertex when sampling the virtual texture of the target terrain according to the sampling position information of each vertex and rendering and displaying the intersection area of ​​the target terrain and the target object; the virtual texture is the virtual texture of the target terrain;

[0271] Determine the texture information of each vertex according to the texture position corresponding to each vertex;

[0272] According to the texture information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

[0273] In the embodiment of the present application, the computer program can also execute other machine-readable instructions when run by the processor to execute other methods described in the embodiment. For the specific execution method steps and principles, please refer to the description of the embodiment, which will not be repeated here.

[0274] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0275] 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, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0276] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0277] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

Claims

1. A terrain rendering method in a game, characterized in that: include: Acquire height data of a target terrain and original position information of each vertex in a target object, wherein the target object is an object intersecting with the target terrain; Determine, according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex, the height offset information of each vertex in the target object, wherein the height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain; Determining target position information of each vertex according to the height offset information of each vertex and the original position information; According to the target position information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

2. The method according to claim 1, characterized in that Determining the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object, and the normal direction information of each vertex includes: Determine the height difference of each vertex relative to the terrain surface according to the height data of the target terrain and the original position information of each vertex in the target object; According to the height difference of each vertex relative to the terrain surface, respectively determine the height difference of each vertex in the first plane and the height difference of each vertex in the second plane; Determine the height offset information of each vertex in the first plane according to the height difference of each vertex in the first plane, the normal direction information of each vertex and the original position information of each vertex; Height offset information of each vertex on the second plane is determined according to the height difference of each vertex on the second plane, normal direction information of each vertex and original position information of each vertex.

3. The method according to claim 2, characterized in that The step of determining the target position information of each vertex according to the height offset information of each vertex and the original position information includes: Dividing the surface of the target object into a plurality of planes, the plurality of planes at least comprising: the first plane and the second plane; respectively determining vertices belonging to the first plane and vertices belonging to the second plane; Determine target position information of each vertex in the first plane according to original position information of each vertex in the first plane, height offset information of each vertex in the first plane in the first plane, and height offset information of each vertex in the first plane in the second plane; The target position information of each vertex in the second plane is determined according to the original position information of each vertex in the second plane, the height offset information of each vertex in the second plane in the first plane, and the height offset information of each vertex in the second plane in the second plane.

4. The method according to claim 3, characterized in that The determining target position information of each vertex in the first plane according to original position information of each vertex in the first plane, height offset information of each vertex in the first plane in the first plane, and height offset information of each vertex in the first plane in the second plane includes: Performing a first interpolation according to the original position information of the target vertex in the first plane and the height offset information of the target vertex in the first plane to determine an intermediate interpolation result; A second interpolation is performed according to the intermediate interpolation result and the height offset information of the target vertex in the second plane to determine the target position information of the target vertex in the first plane.

5. The method according to claim 1, characterized in that The rendering and displaying, according to the target position information of each vertex, the intersection area of ​​the target terrain and the target object includes: Determining sampling position information of each vertex in the target object according to the target position information of each vertex; The virtual texture of the target terrain is sampled according to the sampling position information of each vertex, and the intersection area of ​​the target terrain and the target object is rendered and displayed.

6. The method according to claim 3, characterized in that The separately determining the vertices belonging to the first plane and the vertices belonging to the second plane includes: According to the mask information of the target object, determining each vertex located in the first plane mask of the target object as a vertex belonging to the first plane; Each vertex located in the second plane mask of the target object is determined as a vertex belonging to the second plane.

7. The method according to claim 6, characterized in that Before determining each vertex located in the first plane mask of the target object as a vertex belonging to the first plane according to the mask information of the target object, the method further includes: Generate initial mask information of the target object according to original position information of each vertex in the target object; the initial mask information at least includes: initial mask information of the first plane of the target object and initial mask information of the second plane of the target object; Determining the mask seam information of each plane respectively according to the set mask seam range parameters and the initial mask information; Performing jitter processing and temporal anti-aliasing processing on the mask seam information of each plane to obtain processed mask seam information of each plane; The mask information of the target object is generated according to the processed mask seam information of each plane and the initial mask information.

8. The method according to claim 7, characterized in that The mask seam information of each plane according to the set mask seam range parameters and the initial mask information includes: Generate smooth seam information corresponding to the first plane according to the mask seam range parameter and the initial mask information of the first plane, wherein the smooth seam information corresponding to the first plane includes: smooth seam information between the first plane and the second plane and smooth seam information between the first plane and a third plane; Performing reverse processing on the smooth seam information corresponding to the first plane to obtain reversed smooth seam information corresponding to the first plane; The mask seam information of the first plane is determined according to the smooth seam information corresponding to the first plane and the inverted smooth seam information corresponding to the first plane.

9. The method according to claim 7, characterized in that: The step of generating the mask information of the target object according to the processed mask seam information of each plane and the initial mask information includes: Adding the processed mask seam information of the first plane to the initial mask information of the first plane to obtain an intermediate result; The intermediate result is processed to obtain mask information of the first plane of the target object.

10. The method according to claim 5, characterized in that The step of sampling the virtual texture of the target terrain according to the sampling position information of each vertex and rendering and displaying the intersection area between the target terrain and the target object includes: Determine, according to the sampling position information of each vertex, a texture position corresponding to each vertex in a virtual texture; the virtual texture is a virtual texture of the target terrain; Determining texture information of each vertex according to the texture position corresponding to each vertex; According to the texture information of each vertex, the intersection area of ​​the target terrain and the target object is rendered and displayed.

11. A terrain rendering device in a game, comprising: Get module, determine module and render module; The acquisition module is used to acquire the height data of the target terrain and the original position information of each vertex in the target object, wherein the target object is an object intersecting with the target terrain; The determination module is used to determine the height offset information of each vertex in the target object according to the height data of the target terrain, the original position information of each vertex in the target object and the normal direction information of each vertex, wherein the height offset information is used to represent the height offset value of the vertex relative to the terrain surface of the target terrain; The determination module is used to determine the target position information of each vertex according to the height offset information of each vertex and the original position information; The rendering module is used to render and display the intersection area of ​​the target terrain and the target object according to the target position information of each vertex.

12. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the program instructions to execute the terrain rendering method in the game as described in any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the terrain rendering method in the game as described in any one of claims 1 to 10 is executed.