Method, device and electronic equipment for rendering a terrain model

CN116168135BActive Publication Date: 2026-09-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310087357.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-13
Publication Date
2026-09-25
Estimated Expiration
2043-01-13

AI Technical Summary

Technical Problem

相关技术中,可以通过笔刷设置不同地形效果之间的边缘,例如,直线边缘、曲线边缘等;在真实世界中,不同地形的边缘通常与地形的地表特征、地质特征、植被长势等因素相关,而笔刷设置的地形效果的边缘较为单调,难以逼真的模拟真实世界中地形边缘特征,导致地形效果较为生硬,真实度较低

Benefits of technology

[0009]上述地表模型的渲染方法,获取地表模型和目标材质贴图;其中,目标材质贴图用于:在地表模型上渲染目标地形;目标地形包括地形边缘区域和地形内部区域;目标材质贴图中包括:用于渲染地形边缘区域的地形边缘贴图、和用于渲染地形内部区域的地形内部贴图;地形边缘贴图包括多个边缘子贴图,不同的边缘子贴图中的地形边缘形状不同;基于地表模型的模型网格信息,从地形边缘贴图中确定目标边缘子贴图,基于目标边缘子贴图渲染地表模型中的第一模型网格,得到目标地形的地形边缘渲染效果;其中,第一模型网格与目标地形的地形边缘区域相对应;基于地形内部贴图渲染地表模型中的第二模型网格,得到目标地形的地形内部渲染效果;其中,第二模型网格与目标地形的地形内部区域相对应。该方式中,针对目标地形预先设置了地形边缘贴图,该地形边缘贴图中包括多种不同的边缘形状的贴图;通过不同边缘形状的贴图渲染得到目标地形的地形边缘,该方式可以较为逼真的模拟真实世界中地形边缘特征,地形边缘的渲染效果更加丰富多变,且更加自然,提高了地形效果的真实度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116168135B_ABST
    Figure CN116168135B_ABST
Patent Text Reader

Abstract

The application provides a rendering method and device of a ground model and electronic equipment, and the method comprises the following steps: obtaining a ground model and a target material map; the target material map is used for rendering a target terrain on the ground model; the target material map comprises a terrain edge map and a terrain internal map; the terrain edge map comprises a plurality of edge sub-maps, and the terrain edge shapes in different edge sub-maps are different; based on model grid information of the ground model, a target edge sub-map is determined from the terrain edge map, a first model grid in the ground model is rendered based on the target edge sub-map, and a terrain edge rendering effect of the target terrain is obtained; and a second model grid in the ground model is rendered based on the terrain internal map, and a terrain internal rendering effect of the target terrain is obtained. In this way, the edge characteristics of the terrain effect can be enriched, the edge effect of the terrain is more natural, and the authenticity of the terrain effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of terrain mapping technology, and in particular to a method, apparatus and electronic device for rendering terrain models. Background Technology

[0002] In virtual scenes, it is often necessary to represent various terrain effects, such as sand, grassland, and snow. Related technologies use brushes to set the edges between different terrain effects, such as straight edges and curved edges. However, in the real world, the edges of different terrains are usually related to factors such as surface features, geological features, and vegetation growth. Brush-based terrain effects tend to have monotonous edges, making it difficult to realistically simulate the edge features of real-world terrain, resulting in stiff terrain effects with low realism. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a method, apparatus and electronic device for rendering a terrain model, so as to increase the edge features of different terrain effects in a virtual scene and improve the realism of the terrain effect.

[0004] In a first aspect, embodiments of the present invention provide a method for rendering a surface model. The method includes: acquiring a surface model and a target material texture; wherein the target material texture is used to: render target terrain on the surface model; the target terrain includes a terrain edge region and a terrain interior region; the target material texture includes: a terrain edge texture for rendering the terrain edge region and a terrain interior texture for rendering the terrain interior region; the terrain edge texture includes multiple edge sub-textures, and the terrain edge shapes in different edge sub-textures are different; based on the model mesh information of the surface model, determining a target edge sub-texture from the terrain edge texture, rendering a first model mesh in the surface model based on the target edge sub-texture, and obtaining a terrain edge rendering effect of the target terrain; wherein the first model mesh corresponds to the terrain edge region of the target terrain; and rendering a second model mesh in the surface model based on the terrain interior texture, and obtaining a terrain interior rendering effect of the target terrain; wherein the second model mesh corresponds to the terrain interior region of the target terrain.

[0005] Secondly, embodiments of the present invention also provide a rendering apparatus for a surface model, the apparatus comprising: an acquisition module for acquiring a surface model and a target material texture; wherein the target material texture is used to: render target terrain on the surface model; the target terrain includes a terrain edge region and a terrain interior region; the target material texture includes: a terrain edge texture for rendering the terrain edge region and a terrain interior texture for rendering the terrain interior region; the terrain edge texture includes multiple edge sub-textures, and the terrain edge shapes in different edge sub-textures are different; a first rendering module for determining a target edge sub-texture from the terrain edge texture based on the model mesh information of the surface model, and rendering a first model mesh in the surface model based on the target edge sub-texture to obtain a terrain edge rendering effect of the target terrain; wherein the first model mesh corresponds to the terrain edge region of the target terrain; and a second rendering module for rendering a second model mesh in the surface model based on the terrain interior texture to obtain a terrain interior rendering effect of the target terrain; wherein the second model mesh corresponds to the terrain interior region of the target terrain.

[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described method for rendering the surface model.

[0007] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to implement the above-described method for rendering the surface model.

[0008] The embodiments of the present invention bring the following beneficial effects:

[0009] The above-described method for rendering the terrain model involves obtaining the terrain model and a target material texture. The target material texture is used to render the target terrain on the terrain model. The target terrain includes terrain edge regions and terrain interior regions. The target material texture includes a terrain edge texture for rendering the terrain edge regions and a terrain interior texture for rendering the terrain interior regions. The terrain edge texture includes multiple edge sub-textures, each with a different terrain edge shape. Based on the model mesh information of the terrain model, a target edge sub-texture is determined from the terrain edge texture. A first model mesh in the terrain model is rendered based on the target edge sub-texture to obtain the terrain edge rendering effect of the target terrain. The first model mesh corresponds to the terrain edge region of the target terrain. Finally, a second model mesh in the terrain model is rendered based on the terrain interior texture to obtain the terrain interior rendering effect of the target terrain. The second model mesh corresponds to the terrain interior region of the target terrain. In this method, a terrain edge map is pre-set for the target terrain, which includes a variety of different edge shapes. The terrain edge of the target terrain is obtained by rendering the textures of different edge shapes. This method can realistically simulate the terrain edge features in the real world. The rendering effect of the terrain edge is richer and more varied, and more natural, thus improving the realism of the terrain effect.

[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0013] Figure 1 This is a schematic diagram of the edge effect at the junction of the land surface provided in an embodiment of the present invention;

[0014] Figure 2 A flowchart of a method for rendering a surface model provided in an embodiment of the present invention;

[0015] Figure 3A schematic diagram of a surface model grid provided in an embodiment of the present invention;

[0016] Figure 4 This is a schematic diagram of the positioning points of an edge sub-map provided in an embodiment of the present invention;

[0017] Figure 5 This is a schematic diagram of an initial edge mapping provided in an embodiment of the present invention;

[0018] Figure 6 This is a schematic diagram of a composite texture area for grassland terrain provided in an embodiment of the present invention;

[0019] Figure 7 A schematic diagram of another composite texture area for grassland terrain provided in an embodiment of the present invention;

[0020] Figure 8 This is a schematic diagram illustrating the effect of adding noise attributes to a target texture area according to an embodiment of the present invention;

[0021] Figure 9 This is a schematic diagram illustrating the effect of distorting a target texture area according to an embodiment of the present invention;

[0022] Figure 10 This is a schematic diagram of an initial internal texture provided in an embodiment of the present invention;

[0023] Figure 11 This is a schematic diagram of a processed internal texture provided in an embodiment of the present invention;

[0024] Figure 12 This is a schematic diagram of a terrain edge texture for a marble terrain provided in an embodiment of the present invention;

[0025] Figure 13 This is a schematic diagram of a terrain edge texture for an icy terrain provided in an embodiment of the present invention;

[0026] Figure 14 This is a schematic diagram illustrating an unrendered area in a model mesh provided by an embodiment of the present invention;

[0027] Figure 15 This is a schematic diagram illustrating the rendering of the entire area in a model mesh, as provided in an embodiment of the present invention.

[0028] Figure 16 This is a schematic diagram illustrating the terrain edge effect where multiple terrains are interconnected in a terrain model rendering method provided by an embodiment of the present invention.

[0029] Figure 17 A schematic diagram of the structure of a rendering device for a surface model provided in an embodiment of the present invention;

[0030] Figure 18 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0032] In related technologies, textures are primarily used to record different color values ​​to represent different terrain textures, and then the blending of different terrain textures is adjusted by the hardness or softness of the brush. However, this method cannot effectively display the edge effects of the textures, nor can it achieve specific transformation patterns. Because the brush is a fixed circle, the transitions between different terrain surfaces lack special edge effects and instead exhibit linear transitions, such as... Figure 1 As shown in the example, regardless of the terrain, the transition is linear and cannot preserve surface features.

[0033] Based on this, embodiments of the present invention provide a method, apparatus, and electronic device for rendering a surface model. This technology can be applied to rendering scenarios of surface models, for example, rendering different terrains into the surface model to display different edge effects.

[0034] To facilitate understanding of this embodiment, a method for rendering a surface model disclosed in this invention will first be described in detail, such as... Figure 2 As shown, the method includes the following steps:

[0035] Step S202: Obtain the surface model and target material map; wherein, the target material map is used to: render the target terrain on the surface model; the target terrain includes terrain edge areas and terrain interior areas; the target material map includes: terrain edge map for rendering the terrain edge areas and terrain interior map for rendering the terrain interior areas; the terrain edge map includes multiple edge sub-maps, and the terrain edge shapes in different edge sub-maps are different;

[0036] In virtual environments, scene models provide users with crucial visual and interactive experiences, such as the terrain models in game scenes. By adding different texture maps to these models, different terrain effects can be represented in the virtual scene. For example, rendering a grass texture map onto the terrain model will display as grass terrain in the virtual scene. Similarly, rendering a sand and gravel texture map onto the terrain model will display as sand and gravel terrain. These target terrains can be sand and gravel terrain, grass terrain, or snow terrain in the virtual scene, etc.

[0037] In actual implementation, a surface model and a target material texture are acquired. This target material texture can be a grass surface texture, a sand and gravel surface texture, or other material textures corresponding to the target terrain. These are used to render the target terrain onto the surface model, thus representing the target terrain effect in the virtual scene. It should be noted that a virtual scene typically includes multiple terrain effects, each occupying a specific area. Each terrain type has an edge region and an interior region. Therefore, in this embodiment, the target terrain includes an edge region and an interior region; correspondingly, the target material texture can include an edge texture and an interior texture. The edge texture can be used to render the edge region of the target terrain, and the interior texture can be used to render the interior region. Furthermore, the edge texture can be divided into multiple sub-regions; that is, the edge texture can include multiple edge sub-textures. Since the edge region of the terrain can be irregularly shaped, the shape of the terrain edge in different edge sub-textures will also be different.

[0038] Step S204: Based on the model mesh information of the surface model, determine the target edge sub-map from the terrain edge map, and render the first model mesh in the surface model based on the target edge sub-map to obtain the terrain edge rendering effect of the target terrain; wherein, the first model mesh corresponds to the terrain edge region of the target terrain.

[0039] In practice, the terrain model can be divided into multiple model meshes. Since the target terrain is displayed on the surface of the terrain model, when the terrain model is divided into multiple model meshes, the target terrain will also be divided into multiple regions, distributed across multiple model meshes. For example, if a terrain model is divided into 4x4 model meshes, that is, into 16 model meshes, 4 of these model meshes will be located in the interior region of the terrain model, and the remaining 12 will be located in the edge region of the terrain model. For easier understanding, please refer to [reference needed]. Figure 3 , Figure 3The shaded area enclosed by the dashed line represents the target terrain, such as grassland. Within the model mesh located at the edge of the surface model, the target terrain may or may not exist; within the model mesh located inside the surface model, the target terrain may exist as well as its edge, depending on the size of the target terrain area and its position within the surface model. To facilitate describing the position of the model mesh within the surface model, model mesh numbers can be assigned.

[0040] The aforementioned model mesh information can include the location information of the model mesh and the texture information of the target terrain corresponding to each vertex of the model mesh, such as the texture information and edge information of the target terrain. Based on the model mesh information of the surface model, it can be determined which part of the target material texture map corresponding to the target terrain should be used in that model mesh. In one approach, for the edge region of the target terrain, an edge sub-texture map that matches the edge region of the target terrain can be selected from multiple edge sub-texture maps in the terrain edge map as the target edge sub-texture map. Since the edge region of the target terrain can be distributed in multiple model meshes, for example, Figure 3 The edge regions of the target terrain are distributed across 12 model meshes; therefore, the target edge sub-map can include multiple edge sub-maps. Each edge sub-map corresponds to a terrain edge region of the target terrain within the model mesh. Furthermore, by rendering the first model mesh in the corresponding surface model based on the aforementioned target edge sub-maps, the terrain edge rendering effect of the target terrain can be obtained.

[0041] Step S206: Render the second model mesh in the surface model based on the terrain interior texture to obtain the terrain interior rendering effect of the target terrain.

[0042] For the interior regions of the target terrain, the second model mesh in the corresponding surface model can be rendered based on the terrain interior texture, thus obtaining the interior rendering effect of the target terrain. It should be noted that the terrain interior texture can also include multiple interior sub-textures to provide multiple textures, thereby reducing the repetition of the target terrain.

[0043] It should be noted that the aforementioned first model mesh is located at the edge of the target terrain, while the second model mesh is located inside the target terrain. Typically, the first and second model meshes do not overlap, but they are usually adjacent. In this embodiment, the rendering order of the first and second model meshes is not specifically limited. Specifically, the first model mesh in the surface model can be rendered first based on the target edge sub-map, or the second model mesh in the surface model can be rendered first based on the terrain interior map.

[0044] The above-described method for rendering the terrain model involves obtaining the terrain model and a target material texture. The target material texture is used to render the target terrain on the terrain model. The target terrain includes terrain edge regions and terrain interior regions. The target material texture includes a terrain edge texture for rendering the terrain edge regions and a terrain interior texture for rendering the terrain interior regions. The terrain edge texture includes multiple edge sub-textures, each with a different terrain edge shape. Based on the model mesh information of the terrain model, a target edge sub-texture is determined from the terrain edge texture. A first model mesh in the terrain model is rendered based on the target edge sub-texture to obtain the terrain edge rendering effect of the target terrain. The first model mesh corresponds to the terrain edge region of the target terrain. Finally, a second model mesh in the terrain model is rendered based on the terrain interior texture to obtain the terrain interior rendering effect of the target terrain. The second model mesh corresponds to the terrain interior region of the target terrain. In this method, a terrain edge map is pre-set for the target terrain, which includes a variety of different edge shapes. The terrain edge of the target terrain is obtained by rendering the textures of different edge shapes. This method can realistically simulate the terrain edge features in the real world. The rendering effect of the terrain edge is richer and more varied, and more natural, thus improving the realism of the terrain effect.

[0045] In one specific implementation, the aforementioned edge sub-map has pre-set positioning points; the terrain edge lines in the edge sub-map pass through the positioning points; these positioning points are used to ensure that the terrain edge lines of different edge sub-maps are continuous during the rendering of terrain edge effects.

[0046] Specifically, within a terrain edge map, each of the multiple edge sub-maps can include a portion of the terrain edge lines. Connecting the edge lines from multiple edge sub-maps forms the terrain edge of the target terrain. In practice, positioning points can be pre-set on the edge sub-maps. The terrain edge lines in the edge sub-maps pass through these positioning points, thus allowing different edge sub-maps to be connected. When rendering the terrain edge effect, the terrain edge lines in different edge sub-maps are connected through these positioning points, making the terrain edge lines continuous and capable of closing.

[0047] In one approach, the aforementioned positioning point is located at the center of the edge of the edge sub-map's region. Specifically, to ensure that different edge sub-maps can be connected and that no gaps are generated when different edge sub-maps are superimposed, the pre-set positioning point of the edge sub-map can be located at the center of the edge of the edge sub-map's region.

[0048] Figure 4As an example, the largest square area in the image represents the terrain edge map. This edge map contains 16 smaller solid squares, each corresponding to a sub-edge map. To easily distinguish these sub-edge maps, a sub-map identifier can be assigned to each. This identifier can be implemented in various ways, such as using a number. The edge map may include partial terrain edge lines, represented by the curved lines within the smaller solid squares. These curved lines and the shaded areas represent the edge regions used to render the target terrain. The black dots in the image represent these positioning points, located at the midpoint of the edge map's region. Furthermore, the terrain edge lines within the edge maps pass through these positioning points, allowing for the connection of different edge maps and ensuring continuous terrain edge lines.

[0049] In one approach, the aforementioned terrain interior texture map includes multiple interior sub-texture maps, each with a different terrain texture distribution. Specifically, the model mesh of the terrain surface is rendered based on the terrain interior texture map, thereby obtaining the interior rendering effect of the target terrain. In actual implementation, the aforementioned terrain interior texture map can include multiple interior sub-texture maps, each with a different terrain texture distribution. Based on this, the redundancy of the target terrain can be reduced.

[0050] Furthermore, the texture edges of different internal sub-maps are continuous in all four directions; however, the textures of different internal sub-maps differ except for their edges. Specifically, the texture edges of different internal sub-maps are continuous in all four directions, meaning the texture edges can repeatedly extend continuously in all four directions (up, down, left, and right). When different internal sub-maps are rendered onto adjacent model meshes, the textures of these two internal sub-maps are guaranteed to be continuous, resulting in a smooth transition without noticeable texture breaks. Additionally, the middle portion of each internal sub-map can be varied to prevent repetition within the target terrain. Therefore, the textures of different internal regions, excluding the region edges, are different.

[0051] The following embodiments provide a specific implementation method for generating terrain edge maps.

[0052] Generate an initial edge map of the target terrain; wherein the initial edge map includes: a target terrain of a preset shape, wherein the shape edge of the preset shape is located within the texture edge of the initial edge map; obtain a target texture region from the initial edge map, and copy the target texture region to generate multiple target texture regions; wherein the multiple target texture regions have different orientations; perform a composite processing on at least some of the target texture regions to obtain multiple composite texture regions; generate a terrain edge map based on the multiple target texture regions and the multiple composite texture regions.

[0053] Specifically, first, an initial edge map of the target terrain is generated. This initial edge map can include a target terrain shape with a preset shape, which can be regular or irregular. It's important to note that the edges of the preset shape are located inside the edges of the initial edge map. Second, a target texture region is obtained from the initial edge map. This target texture region can be a portion of the initial texture region; for example, a specific area of ​​the initial texture region can be used as the target texture region. Then, the target texture region is copied to generate multiple target texture regions. After copying the target texture, the newly generated target texture can be horizontally or vertically flipped, resulting in different orientations for the multiple target texture regions.

[0054] Then, at least some of the target texture regions are composited, that is, parts of the target texture regions are stitched together to obtain multiple composite texture regions. The edge shapes of the composite texture regions are different from the edge shapes of the target texture regions, thereby increasing the variety of edge shapes. Finally, based on the multiple target texture regions and the multiple composite texture regions, a terrain edge map is generated.

[0055] Figure 5 As an example, the image uses a rounded rectangle as the preset shape for the target terrain. The shaded area represents the edge of the preset shape. In an optional method, the generated initial edge map of the target terrain can be a 3x3 grid, which is numbered for ease of description. From the initial edge map, a target texture area is selected. This target texture area can be 1, 2, 3, 4, 6, 7, 8, or 9—any area except 5, or multiple areas. Then, the target texture area is copied to generate multiple target texture areas. By flipping or rotating these areas, the orientation of the multiple target texture areas can be changed.

[0056] Figure 6 and Figure 7 As another example, Figure 6 Four target texture regions are generated from the initial edge map of the grassland terrain; then, a subset of these four target texture regions are composited to obtain multiple composite texture regions; such as... Figure 7 In the diagram, regions 1, 2, 4, and 8 are the target texture regions, while the other regions are composite texture regions. For example, region 3 is composited from regions 1 and 2; region 5 is composited from regions 4 and 1; region 6 is composited from regions 2 and 4. Then, processing is added to the transition parts, and so on, to obtain multiple composite texture regions.

[0057] Furthermore, in one approach, noise attributes are added to multiple target texture regions to obtain multiple target texture regions with noise attributes.

[0058] Noise can be understood as recording numerical values ​​using black and white information and then returning those values ​​to the corresponding attributes. In practical implementation, the randomness of texture edges can be increased by adjusting the black-and-white ratio and texture clarity, avoiding the appearance of regular edge lines. Specifically, noise attributes can be added to multiple target texture regions to obtain multiple target texture regions with noise attributes. In one example, to ensure that the top, bottom, left, and right sides of the target texture region can be stitched together, a quarter of the target texture region can be selected, a noise attribute added to it, and then flipped and stitched to obtain the target region with noise attributes. See [reference needed]. Figure 8 This is the effect of adding noise attributes to the target texture area.

[0059] In another approach, based on preset rotation and distortion parameters, the edges of multiple target texture regions are rotated and distorted to obtain multiple processed target texture regions.

[0060] Specifically, a rotation and distortion parameter can be preset to rotate and distort the edges of the target texture area, thus distorting the edges. In practice, different rotation and distortion parameters can be set to change the degree of distortion of the target texture area's edges. Multiple distortions can also be used to create a more distorted effect. See [reference needed]. Figure 9 This is an effect of rotating and distorting the edges of the target texture area.

[0061] The following embodiments provide a specific implementation method for generating terrain interior maps.

[0062] Generate an initial internal texture map of the target terrain; wherein the initial internal texture map includes multiple internal sub-texture maps, and the terrain textures in different internal sub-texture maps are the same; flip and / or rotate the multiple internal sub-texture maps in random directions to obtain multiple processed internal sub-texture maps, and combine the multiple processed internal sub-texture maps into a terrain internal texture map.

[0063] Specifically, first, an initial internal texture map of the target terrain is generated. This initial internal texture map can include multiple internal sub-texture maps, where the terrain texture is identical across different internal sub-texture maps. Then, several internal sub-texture maps are randomly selected from these maps and flipped in random directions, such as vertically or horizontally, or rotated. Alternatively, both flipping and rotation can be performed to obtain multiple processed internal sub-texture maps. It should be noted that the terrain texture distribution differs among the multiple internal sub-texture maps obtained after the above processing.

[0064] As an example, see Figure 10 and Figure 11 , Figure 10 The initial internal texture map contains identical textures in each internal sub-texture map, resulting in high repetition and consequently high repetition in the final rendered terrain texture. Figure 11 The internal sub-textures are processed by flipping and rotating. Each internal sub-texture has a different texture and low repetition. The final rendered terrain texture will also have low repetition.

[0065] This step allows for different terrain texture distributions in multiple sub-maps within a terrain texture map, reducing redundancy.

[0066] The following embodiments provide a specific implementation method for obtaining the final normal map of a target material texture.

[0067] Generate an initial normal map for the target material texture; wherein the initial normal map includes multiple normal components, each normal component corresponding to a dimensional direction; perform a fuzzy average on the multiple normal components to obtain the final normal map of the target material texture; wherein the normal directions in the final normal map are within a specified directional range.

[0068] The aforementioned normal map creates normals at every point on the model's uneven surface, using RGB color channels to indicate the direction of these normals. Specifically, the initial normal map used to generate the target material texture can include four channels: R, G, B, and A. This initial normal map contains multiple normal components, which can be r, g, and b, corresponding one-to-one with the X, Y, and Z axes of the normal. In practice, the R channel can represent the r component of the normal, the G channel can represent the g component, and the b component can be calculated from the r and g components. It should be noted that the B channel can store roughness and alpha maps, allowing the normal map, roughness map, and terrain edge map to be combined into a single texture.

[0069] Furthermore, a blurred average is applied to the multiple normal components in the initial normal map. That is, the values ​​of the R, G, and B channels in the initial normal map are blurred before the average is calculated to obtain the final normal map of the target material. In one specific implementation, this average value can be 128, 128, 255, which ensures that the normal direction in the final normal map is averaged upwards, i.e., within a specified directional range.

[0070] By using this step, incorrect lighting problems can be resolved.

[0071] The following embodiments provide a specific implementation method for obtaining a target material texture.

[0072] Obtain the surface model and its material identifier map; the surface model includes multiple model meshes, and the material identifier map stores the terrain identifiers of the target terrain to be rendered corresponding to the model meshes; obtain the target material texture map of the target terrain corresponding to the terrain identifier.

[0073] Specifically, the surface of a terrain model can be rendered with various target terrains, such as rocky terrain and grassland terrain. The surface of the terrain model is divided into multiple model meshes, and the terrain displayed in different model meshes can be different or the same. Multiple terrains can also be displayed within the same model mesh. Different terrains correspond to different material maps. To facilitate differentiation, terrain identifiers can be set for each terrain. These identifiers can be implemented in various ways, such as terrain numbers, terrain maps, etc. Furthermore, the terrain identifiers and their corresponding material maps can be stored in the terrain model's material identifier map; that is, the material identifier map stores the terrain identifiers of the target terrains to be rendered for each model mesh. Based on this, when rendering the terrain model, the correspondence between terrain identifiers and material maps can be used to determine which material map to use in each model mesh of the terrain model.

[0074] In other words, after obtaining the surface model and its material identifier map, the terrain identifier of the target terrain to be rendered and the target material texture map of the target terrain corresponding to the terrain identifier can be obtained from the material identifier map.

[0075] As an example, Figure 12 Map the edges of the marble terrain. Figure 13 By mapping the edges of icy terrain, it can be seen that the edges of different terrains have different characteristics, which can realistically simulate the geological features of the terrain.

[0076] The following embodiment provides a specific implementation method for obtaining a target edge sub-map.

[0077] Obtain the region identifier map of the terrain model; wherein, the terrain model includes multiple model meshes, and the region identifier map stores: sub-map identifiers used to render the edge sub-maps of the model meshes; obtain the target edge sub-map corresponding to the sub-map identifier from the terrain edge map.

[0078] Specifically, the surface of the terrain model can include multiple model meshes, each of which can display different regions of the target terrain, such as the interior and edge regions. The aforementioned region identifier map can be used to represent different regions of the terrain model and the target terrain. The region identifier map can store sub-map identifiers for rendering edge sub-maps of the model meshes. These sub-map identifiers can be used to distinguish between multiple edge sub-maps within the terrain model. These sub-map identifiers can be implemented in various ways, such as using numerical identifiers.

[0079] In practice, after obtaining the region identifier map of the surface model, the sub-map identifiers for the edge sub-maps used to render the model mesh are retrieved from it. The terrain edge map of the target material map contains multiple edge sub-maps. After determining the sub-map identifiers, the target edge sub-maps corresponding to the aforementioned sub-map identifiers can be retrieved from the terrain edge map of the target terrain.

[0080] The following embodiment provides a specific implementation method for obtaining the terrain edge rendering effect of the target terrain.

[0081] If a specified grid exists in the first model grid, and the specified grid corresponds to target edge sub-maps of multiple target terrains, the rendering order of the target edge sub-maps of multiple target terrains is determined based on the terrain identifiers of multiple target terrains; the specified grid is rendered according to the rendering order to obtain the terrain edge rendering effect of the specified grid; wherein, the occlusion relationship of multiple target terrains in the terrain edge rendering effect of the specified grid is determined based on the terrain identifiers of multiple target terrains.

[0082] Specifically, the surface of the terrain model can include multiple model meshes. Within some of these meshes, various terrain types can exist; that is, the edge regions of multiple terrain types converge within the aforementioned mesh. This mesh model is the designated mesh mentioned above. In other words, the designated mesh in the terrain model corresponds to target edge sub-maps for multiple target terrains. In this case, the rendering order of the target edge sub-maps for multiple target terrains can be determined based on the terrain identifiers of the target terrains. In an optional implementation, terrains with earlier identifiers can be rendered first, followed by those with later identifiers.

[0083] Then, the specified mesh is rendered in the order it is rendered to obtain the terrain edge rendering effect of the specified mesh. It is important to note that in this rendering effect, there will be occlusion relationships between multiple target terrains. This occlusion relationship can be determined based on the terrain identifiers of the multiple target terrains. For example, if there are target edge sub-maps of three target terrains A, B, and C in the specified mesh, and the terrain identifiers of A, B, and C are arranged in the order A, B, C from front to back, then when rendering the specified mesh, the target edge sub-map of target terrain A can be rendered first, then the target edge sub-map of target terrain B, and finally the target edge sub-map of target terrain C. During the rendering process, the target edge sub-map of target terrain B can occlude the target edge sub-map of target terrain A, and the target edge sub-map of target terrain C can occlude the target edge sub-map of target terrain B, or it can occlude the target edge sub-map of target terrain A, or it can simultaneously occlude the target edge sub-maps of target terrain A and B.

[0084] Furthermore, if there are unrendered areas in the specified mesh that have not been rendered by any target edge sub-map, the final target edge sub-map to be rendered is determined from the target edge sub-maps of multiple target terrains; the terrain interior map of the target terrain corresponding to the final rendered target edge sub-map is obtained, and the specified mesh is rendered based on the terrain interior map to obtain the final rendering effect of the specified mesh.

[0085] Specifically, if a region exists within a specified mesh that is not rendered by any target edge sub-map—that is, a black area without any terrain texture—then the final target edge sub-map to be rendered is determined from the target edge sub-maps of various target terrains. In practice, the final target edge sub-map is determined based on the terrain identifier of the target terrain, or it can be determined based on the occlusion relationship described above.

[0086] Then, the terrain interior map of the target terrain corresponding to the target edge sub-map of the last rendering is obtained, and the specified mesh is rendered using the terrain interior map to obtain the final rendering effect of the specified mesh.

[0087] As an example, Figure 14 The model mesh shown renders the edges of four terrain types, but the central area of ​​the mesh contains unrendered areas. Figure 14 In the black area, the terrain at point C is the final rendered target edge sub-texture, and it is also the lowest-level terrain among the four terrain types in this mesh. Therefore, rendering the model mesh using the terrain's corresponding internal texture avoids unrendered areas. Figure 15As shown. Since the terrain interior map consists of multiple sub-regions, a sub-region can be selected randomly, or it can be selected from the terrain interior map based on the position of the currently used target edge sub-map.

[0088] In this step, if there are areas in the specified mesh that have not been rendered by any target edge sub-map, the last target edge sub-map to be rendered is first determined, and then the terrain interior map of the target terrain corresponding to the last rendered target edge sub-map is obtained, and the specified mesh is rendered. Based on this, it can be guaranteed that there will be no black areas in the specified mesh where no terrain map is sampled.

[0089] In this embodiment, by employing terrain edge mapping, the target terrain can have different textured edges. For example, grass, rocks, and bricks can all have special edge effects, and it ensures that the edges of different target terrains are superimposed without gaps. Theoretically, users can use countless textures created with the same scheme to superimpose each other, such as... Figure 16 This demonstrates the effect of terrain edges where various terrain features intersect. In this embodiment, terrain interior textures are used to render the terrain interiors to reduce repetition and prevent repetitiveness caused by map refresh. The sampling frequency is also reduced, making the artistic effect more controllable. By creating normal maps, the correct lighting effects can be ensured.

[0090] For an example of the rendering method for the above-mentioned surface model, please refer to... Figure 17 The diagram shows a structural schematic of a rendering device for a terrain model, the device comprising:

[0091] The acquisition module 172 is used to acquire the surface model and the target material texture; wherein, the target material texture is used to: render the target terrain on the surface model; the target terrain includes terrain edge areas and terrain interior areas; the target material texture includes: terrain edge texture for rendering the terrain edge areas and terrain interior texture for rendering the terrain interior areas; the terrain edge texture includes multiple edge sub-textures, and the terrain edge shapes in different edge sub-textures are different;

[0092] The first rendering module 174 is used to determine the target edge sub-map from the terrain edge map based on the model mesh information of the surface model, and render the first model mesh in the surface model based on the target edge sub-map to obtain the terrain edge rendering effect of the target terrain; wherein, the first model mesh corresponds to the terrain edge region of the target terrain.

[0093] The second rendering module 176 is used to render the second model mesh in the surface model based on the terrain interior texture to obtain the terrain interior rendering effect of the target terrain; wherein, the second model mesh corresponds to the terrain interior region of the target terrain.

[0094] The aforementioned rendering device for the terrain model acquires the terrain model and a target material texture. The target material texture is used to: render target terrain on the terrain model; the target terrain includes terrain edge regions and terrain interior regions; the target material texture includes: a terrain edge texture for rendering the terrain edge regions and a terrain interior texture for rendering the terrain interior regions; the terrain edge texture includes multiple edge sub-textures, with different terrain edge shapes in different edge sub-textures; based on the model mesh information of the terrain model, a target edge sub-texture is determined from the terrain edge texture; a first model mesh in the terrain model is rendered based on the target edge sub-texture to obtain the terrain edge rendering effect of the target terrain; wherein the first model mesh corresponds to the terrain edge region of the target terrain; a second model mesh in the terrain model is rendered based on the terrain interior texture to obtain the terrain interior rendering effect of the target terrain; wherein the second model mesh corresponds to the terrain interior region of the target terrain. In this method, a terrain edge map is pre-set for the target terrain, which includes a variety of different edge shapes. The terrain edge of the target terrain is obtained by rendering the textures of different edge shapes. This method can realistically simulate the terrain edge features in the real world. The rendering effect of the terrain edge is richer and more varied, and more natural, thus improving the realism of the terrain effect.

[0095] The aforementioned edge sub-maps have pre-set positioning points; the terrain edge lines in the edge sub-maps pass through the positioning points; these positioning points are used to ensure that the terrain edge lines of different edge sub-maps are continuous during the rendering of terrain edge effects.

[0096] The aforementioned positioning point is located at the center of the edge of the sub-map region.

[0097] The aforementioned terrain interior texture map includes multiple interior sub-texture maps, and the terrain texture distribution is different in different interior sub-texture maps.

[0098] Different internal sub-textures have continuous texture edges; different internal sub-textures have different textures except for the texture edges.

[0099] The aforementioned apparatus further includes a generation module, configured to: generate an initial edge map of the target terrain; wherein the initial edge map includes: a target terrain of a preset shape, wherein the shape edge of the preset shape is located within the map edge of the initial edge map; obtain a target map region from the initial edge map, perform a copying process on the target map region to generate multiple target map regions; wherein the multiple target map regions have different orientations; perform a compositing process on at least some of the target map regions to obtain multiple composite map regions; and generate a terrain edge map based on the multiple target map regions and the multiple composite map regions.

[0100] The aforementioned device further includes an adding module for: adding noise attributes to multiple target texture regions to obtain multiple target texture regions with noise attributes.

[0101] The aforementioned device also includes a rotation and twist module, used to: perform rotation and twist processing on the edges of multiple target texture regions based on preset rotation and twist parameters, to obtain multiple processed target texture regions.

[0102] The aforementioned device further includes a flipping module for: generating an initial internal texture map of the target terrain; wherein the initial internal texture map includes multiple internal sub-texture maps, and the terrain textures in different internal sub-texture maps are the same; flipping and / or rotating the multiple internal sub-texture maps in random directions to obtain multiple processed internal sub-texture maps, and combining the multiple processed internal sub-texture maps into a terrain internal texture map.

[0103] The aforementioned apparatus further includes a blurring module for: generating an initial normal map of the target material texture; wherein the initial normal map includes multiple normal components, each normal component corresponding to a dimensional direction; performing a blurring average on the multiple normal components to obtain a final normal map of the target material texture; wherein the normal directions in the final normal map are within a specified directional range.

[0104] The aforementioned acquisition module is also used to: acquire the surface model and the material identifier map of the surface model; wherein, the surface model includes multiple model meshes, and the material identifier map stores the terrain identifiers of the target terrain to be rendered corresponding to the model meshes; and acquire the target material texture map of the target terrain corresponding to the terrain identifiers.

[0105] The first rendering module mentioned above is also used to: obtain a region identifier map of the surface model; wherein the surface model includes multiple model meshes, and the region identifier map stores: sub-map identifiers for rendering edge sub-maps of the model meshes; and obtain the target edge sub-map corresponding to the sub-map identifier from the terrain edge map.

[0106] The first rendering module is further configured to: if a specified grid exists in the first model grid, and the specified grid corresponds to target edge sub-maps of multiple target terrains, determine the rendering order of the target edge sub-maps of multiple target terrains based on the terrain identifiers of the multiple target terrains; render the specified grid according to the rendering order to obtain the terrain edge rendering effect of the specified grid; wherein, in the terrain edge rendering effect of the specified grid, the occlusion relationship of multiple target terrains is determined based on the terrain identifiers of the multiple target terrains.

[0107] The aforementioned apparatus further includes a determining module, configured to: if there are unrendered areas in the specified mesh that have not been rendered by any target edge sub-map, determine the final rendered target edge sub-map from multiple target terrain target edge sub-maps; obtain the terrain interior map of the target terrain corresponding to the final rendered target edge sub-map; render the specified mesh based on the terrain interior map; and obtain the final rendering effect of the specified mesh.

[0108] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described method for rendering the terrain model. This electronic device can be a server or a terminal device.

[0109] See Figure 18 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described method for rendering the surface model.

[0110] Furthermore, Figure 18 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0111] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 18 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0112] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0113] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the aforementioned method for rendering the terrain model: acquiring a terrain model and a target material texture; wherein, the target material texture is used to: render target terrain on the terrain model; the target terrain includes terrain edge regions and terrain interior regions; the target material texture includes: a terrain edge texture for rendering the terrain edge regions and a terrain interior texture for rendering the terrain interior regions; the terrain edge texture includes multiple edge sub-textures, and the terrain edge shapes in different edge sub-textures are different; based on the model mesh information of the terrain model, determining the target edge sub-texture from the terrain edge texture, rendering the first model mesh in the terrain model based on the target edge sub-texture, and obtaining the terrain edge rendering effect of the target terrain; wherein, the first model mesh corresponds to the terrain edge region of the target terrain; rendering the second model mesh in the terrain model based on the terrain interior texture, and obtaining the terrain interior rendering effect of the target terrain; wherein, the second model mesh corresponds to the terrain interior region of the target terrain.

[0114] In this method, a terrain edge map is pre-set for the target terrain, which includes a variety of different edge shapes. The terrain edge of the target terrain is obtained by rendering the textures of different edge shapes. This method can realistically simulate the terrain edge features in the real world. The rendering effect of the terrain edge is richer and more varied, and more natural, thus improving the realism of the terrain effect.

[0115] The aforementioned edge sub-maps have pre-set positioning points; the terrain edge lines in the edge sub-maps pass through the positioning points; these positioning points are used to ensure that the terrain edge lines of different edge sub-maps are continuous during the rendering of terrain edge effects.

[0116] The aforementioned positioning point is located at the center of the edge of the sub-map region.

[0117] The aforementioned terrain interior texture map includes multiple interior sub-texture maps, and the terrain texture distribution is different in different interior sub-texture maps.

[0118] Different internal sub-textures have continuous texture edges; different internal sub-textures have different textures except for the texture edges.

[0119] The terrain edge map is generated in the following manner: generating an initial edge map of the target terrain; wherein, the initial edge map includes: a target terrain of a preset shape, wherein the shape edge of the preset shape is located within the texture edge of the initial edge map; obtaining a target texture region from the initial edge map, copying the target texture region to generate multiple target texture regions; wherein, the multiple target texture regions have different orientations; performing a composite processing on at least some of the target texture regions to obtain multiple composite texture regions; generating a terrain edge map based on the multiple target texture regions and the multiple composite texture regions.

[0120] The above method also includes: adding noise attributes to multiple target texture regions to obtain multiple target texture regions with noise attributes.

[0121] The above method also includes: rotating and twisting the edges of multiple target texture regions based on preset rotation and twist parameters to obtain multiple processed target texture regions.

[0122] The aforementioned terrain interior texture is generated in the following manner: an initial interior texture of the target terrain is generated; wherein the initial interior texture includes multiple interior sub-textures, and the terrain textures in different interior sub-textures are the same; the multiple interior sub-textures are flipped and / or rotated in random directions to obtain multiple processed interior sub-textures, and the multiple processed interior sub-textures are combined to form the terrain interior texture.

[0123] This step allows for different terrain texture distributions in multiple sub-maps within a terrain texture map, reducing redundancy.

[0124] The above method further includes: generating an initial normal map of the target material map; wherein the initial normal map includes multiple normal components, each normal component corresponding to a dimensional direction; performing a fuzzy average on the multiple normal components to obtain the final normal map of the target material map; wherein the normal direction in the final normal map is located within a specified directional range.

[0125] By using this step, incorrect lighting problems can be resolved.

[0126] The processor in the aforementioned electronic device can execute machine-executable instructions to perform the following operations in the above-mentioned surface model rendering method: obtaining the surface model and the material identifier map of the surface model; wherein, the surface model includes multiple model meshes, and the material identifier map stores the terrain identifiers of the target terrain to be rendered corresponding to the model meshes; obtaining the target material texture map of the target terrain corresponding to the terrain identifier.

[0127] The processor in the aforementioned electronic device can execute machine-executable instructions to perform the following operations in the above-mentioned surface model rendering method: obtaining a region identifier map of the surface model; wherein the surface model includes multiple model meshes, and the region identifier map stores: sub-map identifiers for rendering edge sub-maps of the model meshes; obtaining the target edge sub-map corresponding to the sub-map identifier from the terrain edge map.

[0128] The processor in the aforementioned electronic device can execute machine-executable instructions to implement the following operations in the above-mentioned surface model rendering method: if a specified grid exists in the first model grid, and the specified grid corresponds to target edge sub-maps of multiple target terrains, the rendering order of the target edge sub-maps of multiple target terrains is determined based on the terrain identifiers of the multiple target terrains; the specified grid is rendered according to the rendering order to obtain the terrain edge rendering effect of the specified grid; wherein, in the terrain edge rendering effect of the specified grid, the occlusion relationship of multiple target terrains is determined based on the terrain identifiers of the multiple target terrains.

[0129] The above method also includes: if there are unrendered areas in the specified mesh that have not been rendered by any target edge sub-map, determine the final rendered target edge sub-map from the target edge sub-maps of multiple target terrains; obtain the terrain interior map of the target terrain corresponding to the final rendered target edge sub-map, and render the specified mesh based on the terrain interior map to obtain the final rendering effect of the specified mesh.

[0130] In this step, if there are areas in the specified mesh that have not been rendered by any target edge sub-map, the last target edge sub-map to be rendered is first determined, and then the terrain interior map of the target terrain corresponding to the last rendered target edge sub-map is obtained, and the specified mesh is rendered. Based on this, it can be guaranteed that there will be no black areas in the specified mesh where no terrain map is sampled.

[0131] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above-described method for rendering the surface model.

[0132] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned surface model rendering method: obtaining a surface model and a target material texture; wherein, the target material texture is used to: render target terrain on the surface model; the target terrain includes terrain edge regions and terrain interior regions; the target material texture includes: a terrain edge texture for rendering the terrain edge regions and a terrain interior texture for rendering the terrain interior regions; the terrain edge texture includes multiple edge sub-textures, and the terrain edge shapes in different edge sub-textures are different; based on the model mesh information of the surface model, determining the target edge sub-texture from the terrain edge texture, rendering the first model mesh in the surface model based on the target edge sub-texture, and obtaining the terrain edge rendering effect of the target terrain; wherein, the first model mesh corresponds to the terrain edge region of the target terrain; rendering the second model mesh in the surface model based on the terrain interior texture, and obtaining the terrain interior rendering effect of the target terrain; wherein, the second model mesh corresponds to the terrain interior region of the target terrain.

[0133] In this method, a terrain edge map is pre-set for the target terrain, which includes a variety of different edge shapes. The terrain edge of the target terrain is obtained by rendering the textures of different edge shapes. This method can realistically simulate the terrain edge features in the real world. The rendering effect of the terrain edge is richer and more varied, and more natural, thus improving the realism of the terrain effect.

[0134] The aforementioned edge sub-maps have pre-set positioning points; the terrain edge lines in the edge sub-maps pass through the positioning points; these positioning points are used to ensure that the terrain edge lines of different edge sub-maps are continuous during the rendering of terrain edge effects.

[0135] The aforementioned positioning point is located at the center of the edge of the sub-map region.

[0136] The aforementioned terrain interior texture map includes multiple interior sub-texture maps, and the terrain texture distribution is different in different interior sub-texture maps.

[0137] Different internal sub-textures have continuous texture edges; different internal sub-textures have different textures except for the texture edges.

[0138] The terrain edge map is generated in the following manner: generating an initial edge map of the target terrain; wherein, the initial edge map includes: a target terrain of a preset shape, wherein the shape edge of the preset shape is located within the texture edge of the initial edge map; obtaining a target texture region from the initial edge map, copying the target texture region to generate multiple target texture regions; wherein, the multiple target texture regions have different orientations; performing a composite processing on at least some of the target texture regions to obtain multiple composite texture regions; generating a terrain edge map based on the multiple target texture regions and the multiple composite texture regions.

[0139] The above method also includes: adding noise attributes to multiple target texture regions to obtain multiple target texture regions with noise attributes.

[0140] The above method also includes: rotating and twisting the edges of multiple target texture regions based on preset rotation and twist parameters to obtain multiple processed target texture regions.

[0141] The aforementioned terrain interior texture is generated in the following manner: an initial interior texture of the target terrain is generated; wherein the initial interior texture includes multiple interior sub-textures, and the terrain textures in different interior sub-textures are the same; the multiple interior sub-textures are flipped and / or rotated in random directions to obtain multiple processed interior sub-textures, and the multiple processed interior sub-textures are combined to form the terrain interior texture.

[0142] This step allows for different terrain texture distributions in multiple sub-maps within a terrain texture map, reducing redundancy.

[0143] The above method further includes: generating an initial normal map of the target material map; wherein the initial normal map includes multiple normal components, each normal component corresponding to a dimensional direction; performing a fuzzy average on the multiple normal components to obtain the final normal map of the target material map; wherein the normal direction in the final normal map is located within a specified directional range.

[0144] By using this step, incorrect lighting problems can be resolved.

[0145] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned surface model rendering method: obtaining the surface model and the material identifier map of the surface model; wherein, the surface model includes multiple model meshes, and the material identifier map stores the terrain identifiers of the target terrain to be rendered corresponding to the model meshes; obtaining the target material texture map of the target terrain corresponding to the terrain identifier.

[0146] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned surface model rendering method: obtaining a region identifier map of the surface model; wherein the surface model includes multiple model meshes, and the region identifier map stores: sub-map identifiers for rendering edge sub-maps of the model meshes; obtaining the target edge sub-map corresponding to the sub-map identifier from the terrain edge map.

[0147] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned surface model rendering method: if a specified grid exists in the first model grid, and the specified grid corresponds to target edge sub-maps of multiple target terrains, the rendering order of the target edge sub-maps of multiple target terrains is determined based on the terrain identifiers of the multiple target terrains; the specified grid is rendered according to the rendering order to obtain the terrain edge rendering effect of the specified grid; wherein, in the terrain edge rendering effect of the specified grid, the occlusion relationship of multiple target terrains is determined based on the terrain identifiers of the multiple target terrains.

[0148] The above method also includes: if there are unrendered areas in the specified mesh that have not been rendered by any target edge sub-map, determine the final rendered target edge sub-map from the target edge sub-maps of multiple target terrains; obtain the terrain interior map of the target terrain corresponding to the final rendered target edge sub-map, and render the specified mesh based on the terrain interior map to obtain the final rendering effect of the specified mesh.

[0149] In this step, if there are areas in the specified mesh that have not been rendered by any target edge sub-map, the last target edge sub-map to be rendered is first determined, and then the terrain interior map of the target terrain corresponding to the last rendered target edge sub-map is obtained, and the specified mesh is rendered. Based on this, it can be guaranteed that there will be no black areas in the specified mesh where no terrain map is sampled.

[0150] The computer program products of the surface model rendering method, apparatus and electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0151] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0152] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0153] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0154] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0155] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for rendering a terrain model, characterized in that, The method includes: Obtain a surface model and a target material texture; wherein, the target material texture is used to: render target terrain on the surface model; the target terrain includes terrain edge regions and terrain interior regions; the target material texture includes: a terrain edge texture for rendering the terrain edge regions and a terrain interior texture for rendering the terrain interior regions; the terrain edge texture includes multiple edge sub-textures, and the terrain edge shapes in different edge sub-textures are different; Based on the model mesh information of the surface model, a target edge sub-map is determined from the terrain edge map, and a first model mesh in the surface model is rendered based on the target edge sub-map to obtain the terrain edge rendering effect of the target terrain; wherein, the first model mesh corresponds to the terrain edge region of the target terrain; The second model mesh in the surface model is rendered based on the terrain interior texture to obtain the terrain interior rendering effect of the target terrain; wherein, the second model mesh corresponds to the terrain interior region of the target terrain; The terrain edge map is generated in the following manner: Generate an initial edge map of the target terrain; wherein, the initial edge map includes: the target terrain of a preset shape, and the shape edge of the preset shape is located within the map edge of the initial edge map; The target texture region is obtained from the initial edge texture map, and the target texture region is copied to generate multiple target texture regions; wherein the multiple target texture regions have different orientations; At least a portion of the target texture region is composited to obtain multiple composite texture regions; The terrain edge map is generated based on multiple target texture regions and multiple composite texture regions.

2. The method according to claim 1, characterized in that, The edge sub-map has pre-set positioning points; the terrain edge lines in the edge sub-map pass through the positioning points; the positioning points are used to ensure that the terrain edge lines of different edge sub-maps are continuous during the rendering of the terrain edge effect.

3. The method according to claim 2, characterized in that, The positioning point is located at the center of the edge of the edge sub-map.

4. The method according to claim 1, characterized in that, The terrain interior map includes multiple interior sub-maps, and the terrain texture distribution is different in different interior sub-maps.

5. The method according to claim 4, characterized in that, The texture edges of the different internal sub-maps are continuous in all directions; the textures other than the texture edges in the different internal sub-maps are different.

6. The method according to claim 1, characterized in that, After obtaining the target texture region from the initial edge texture map, copying the target texture region to generate multiple target texture regions, the method further includes: Add noise attributes to multiple target texture regions to obtain multiple target texture regions with the noise attributes.

7. The method according to claim 1, characterized in that, After obtaining the target texture region from the initial edge texture map, copying the target texture region to generate multiple target texture regions, the method further includes: Based on preset rotation and distortion parameters, the edges of multiple target texture regions are rotated and distorted to obtain multiple processed target texture regions.

8. The method according to claim 1, characterized in that, The terrain interior texture is generated in the following manner: Generate an initial internal texture map of the target terrain; wherein, the initial internal texture map includes multiple internal sub-texture maps, and the terrain textures in different internal sub-texture maps are the same; The multiple internal sub-maps are flipped and / or rotated in random directions to obtain the processed internal sub-maps, and the processed internal sub-maps are combined to form the terrain internal map.

9. The method according to claim 1, characterized in that, Before the steps of acquiring the surface model and target material texture, the method further includes: Generate an initial normal map for the target material texture; wherein, the initial normal map includes multiple normal components, and each normal component corresponds to a dimensional direction; The multiple normal components are subjected to fuzzy averaging to obtain the final normal map of the target material texture; wherein the normal direction in the final normal map is located within a specified directional range.

10. The method according to claim 1, characterized in that, The steps to obtain the surface model and target material texture include: Obtain a surface model and its material identifier map; wherein, the surface model includes multiple model meshes, and the material identifier map stores the terrain identifiers of the target terrain to be rendered corresponding to the model meshes; Obtain the target material texture map of the target terrain corresponding to the terrain identifier.

11. The method according to claim 1, characterized in that, The step of determining the target edge sub-map from the terrain edge map based on the model mesh information of the surface model includes: Obtain the region identification map of the surface model; wherein, the surface model includes multiple model meshes, and the region identification map stores: sub-map identifiers for rendering the edge sub-maps of the model meshes; Obtain the target edge sub-map corresponding to the sub-map identifier from the terrain edge map.

12. The method according to claim 1, characterized in that, The step of rendering the first model mesh in the surface model based on the target edge sub-map to obtain the terrain edge rendering effect of the target terrain includes: If a specified grid exists in the first model grid, and the specified grid corresponds to target edge sub-maps of multiple target terrains, the rendering order of the target edge sub-maps of multiple target terrains is determined based on the terrain identifiers of the multiple target terrains; The specified mesh is rendered according to the rendering order to obtain the terrain edge rendering effect of the specified mesh; wherein, in the terrain edge rendering effect of the specified mesh, the occlusion relationship of multiple target terrains is determined based on the terrain identifiers of multiple target terrains.

13. The method according to claim 12, characterized in that, After the step of rendering the specified mesh according to the rendering order to obtain the terrain edge rendering effect of the specified mesh, the method further includes: If there are unrendered areas in the specified mesh that have not been rendered by any target edge submap, determine the final rendered target edge submap from the target edge submaps of multiple target terrains; Obtain the terrain interior texture of the target terrain corresponding to the final rendered target edge sub-texture, and render the specified mesh based on the terrain interior texture to obtain the final rendering effect of the specified mesh.

14. A rendering device for a terrain model, characterized in that, The device includes: An acquisition module is used to acquire a surface model and a target material texture; wherein, the target material texture is used to: render target terrain on the surface model; the target terrain includes terrain edge regions and terrain interior regions; the target material texture includes: a terrain edge texture for rendering the terrain edge regions and a terrain interior texture for rendering the terrain interior regions; the terrain edge texture includes multiple edge sub-textures, and the terrain edge shapes in different edge sub-textures are different; The first rendering module is used to determine a target edge sub-map from the terrain edge map based on the model mesh information of the surface model, and render the first model mesh in the surface model based on the target edge sub-map to obtain the terrain edge rendering effect of the target terrain; wherein, the first model mesh corresponds to the terrain edge region of the target terrain; The second rendering module is used to render the second model mesh in the surface model based on the terrain interior texture to obtain the terrain interior rendering effect of the target terrain; wherein, the second model mesh corresponds to the terrain interior region of the target terrain; A generation module is used to generate an initial edge map of the target terrain; wherein, the initial edge map includes: the target terrain of a preset shape, and the shape edge of the preset shape is located within the map edge of the initial edge map; The target texture region is obtained from the initial edge texture map, and the target texture region is copied to generate multiple target texture regions; wherein the multiple target texture regions have different orientations; At least a portion of the target texture region is composited to obtain multiple composite texture regions; The terrain edge map is generated based on multiple target texture regions and multiple composite texture regions.

15. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the rendering method of the terrain model according to any one of claims 1-13.

16. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the rendering method of the surface model according to any one of claims 1-13.

Citation Information

Patent Citations

  • Terrain splicing method and device, storage medium and electronic equipment

    CN115222594A

  • Model rendering method and device

    WO2022041548A1