Terrain rendering method and device, storage medium and electronic equipment
By using vertex normal vectors, mask maps and anti-aliasing methods in terrain rendering, the problem of texture stretching and calculation overhead in traditional methods is solved, and efficient and high-quality terrain rendering is achieved.
Patent Information
- Application Number
- CN202411907716.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-03-28
AI Technical Summary
When traditional terrain rendering methods deal with significantly high and low terrain, they will lead to texture stretching and distortion, increasing the overhead of computing resources, and affecting real-time rendering performance.
By obtaining the vertex normal vectors of each vertex in the terrain to be rendered, the mask map of multiple initial planes is determined, the gap range mask map is calculated, and anti-aliased is performed. Finally, the rendered target terrain is generated through interpolation processing.
This method only requires a single texture sampling, which significantly reduces the computing load of the GPU and improves real-time rendering performance, especially in large-scale terrain scenarios. It reduces visual artifacts and improves visual effects through jitter noise and DitherTAA technology.
Smart Images

Figure CN119722899A_ABST
Abstract
Description
Background Art
[0002] In some game scenes, the ups and downs of the terrain, narrow passages, or the location of obstacles can directly affect the player's game strategy and tactical choices, thereby increasing the depth and complexity of the game. Traditional terrain rendering methods often use tiled texture mapping technology, but when the terrain has significant ups and downs, tiled texture mapping will cause texture stretching and distortion, which will affect the final visual effect.
[0003] In related technical solutions, the tri-planar mapping technology is generally used, that is, based on the world space coordinates, the texture map is sampled from three axes (X, Y, Z) respectively to obtain the sampling results of each axis, and the above sampling results are mixed to achieve the technical effect of reducing texture stretching.
[0004] However, the above three-plane mapping method requires three texture samplings in three axes for each texture map, and in real-time rendering, the performance bottleneck is mainly reflected in the texture sampling and computing load of the graphics processing unit (GPU). Therefore, the above three-plane mapping method significantly increases the overhead and cost of computing resources, seriously affecting the real-time rendering performance, especially in large-scale terrain scenes.
[0005] Therefore, there is an urgent need for a terrain rendering solution that can reduce computational overhead while ensuring visual effects. Summary of the invention
[0006] The present disclosure provides a terrain rendering method, a terrain rendering device, a computer storage medium and an electronic device, thereby reducing the computational overhead and cost of terrain rendering while ensuring visual effects during the terrain rendering process.
[0007] In a first aspect, an embodiment of the present disclosure provides a terrain rendering method, the method comprising: obtaining vertex normal vectors of each vertex in a terrain to be rendered in a world space, and determining a first mask map of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vectors; determining a gap range mask map at a connection position between the multiple initial planes according to the first mask maps of the multiple initial planes; performing anti-aliasing processing on each gap range mask map to obtain a second mask map of each gap range mask map; obtaining multiple target planes including the second mask map, and interpolating the initial UV coordinates of the multiple target planes to obtain target UV coordinates of the terrain to be rendered; and generating a rendered target terrain according to the target UV coordinates.
[0008] In a second aspect, an embodiment of the present disclosure provides a terrain rendering device, which includes: a vector acquisition module, configured to execute acquisition of vertex normal vectors of each vertex in the terrain to be rendered in the world space, and determine the first mask map of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vector; a gap range determination module, used to determine the gap range mask map at the connection position between the multiple initial planes according to the first mask map of the multiple initial planes; an anti-aliasing processing module, used to perform anti-aliasing processing on each gap range mask map to obtain a second mask map of each gap range mask map; an interpolation processing module, configured to execute acquisition of multiple target planes containing the second mask map, and interpolate the initial UV coordinates of the multiple target planes to obtain the target UV coordinates of the terrain to be rendered; a terrain generation module, configured to generate the rendered target terrain according to the target UV coordinates.
[0009] In a third aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the above terrain rendering method when executed by a processor.
[0010] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above terrain rendering method by executing the executable instructions.
[0011] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which is executed by a processor to implement the terrain rendering method as described above.
[0012] The technical solution disclosed in this disclosure has the following beneficial effects:
[0013] The terrain rendering method described above obtains the vertex normal vectors of each vertex in the terrain to be rendered in the world space, and determines the first mask map of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vectors; determines the gap range mask map at the connection position between the multiple initial planes according to the first mask map of the multiple initial planes; performs anti-aliasing processing on each gap range mask map to obtain the second mask map of each gap range mask map; obtains multiple target planes containing the second mask map, and interpolates the initial UV coordinates of the multiple target planes to obtain the target UV coordinates of the terrain to be rendered; generates the rendered target terrain according to the target UV coordinates. On the one hand, this method only requires a single sampling of the terrain to be rendered, which greatly reduces the number of texture search operations compared to the related technical solution using three sampling methods, thereby effectively reducing the computing load of the GPU and improving the real-time rendering performance, especially in large-scale terrain scenes. On the other hand, single sampling introduces a gap range, and smooth fusion is achieved in the gap area through dithering noise and anti-aliasing DitherTAA technology, which significantly reduces visual artifacts, makes the transition more natural, and improves the visual effect. This provides a new path for efficient and high-quality terrain rendering, solving the dual bottleneck problems of current terrain rendering in visual effects and computing performance.
[0014] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A system architecture diagram of a terrain rendering system in this exemplary embodiment is schematically shown;
[0017] Figure 2 A flowchart of a terrain rendering method in this exemplary embodiment is schematically shown;
[0018] Figure 3 A schematic diagram schematically shows the effect of a gap range at a plurality of initial plane connection positions being a gap area in this exemplary embodiment;
[0019] Figure 4 A schematic diagram schematically shows the effect of a gap range at a plurality of initial plane connection positions being a gap line in this exemplary embodiment;
[0020] Figure 5 A schematic diagram of a gap range mask map at a connection position between a plurality of initial planes in this exemplary embodiment is schematically shown;
[0021] Figure 6 A schematic diagram of a second mask map of each gap range mask map obtained after DitherTAA processing in this exemplary embodiment is schematically shown;
[0022] Figure 7 A schematic diagram schematically shows a plurality of target planes before texture interpolation processing in this exemplary embodiment;
[0023] Figure 8 A schematic diagram schematically shows a plurality of target planes after texture interpolation processing in this exemplary embodiment;
[0024] Fig. 9A A schematic diagram of terrain rendering effect processed by a prior art solution in this exemplary embodiment is schematically shown;
[0025] Fig. 9B A schematic diagram of terrain rendering effect processed by an embodiment of the present disclosure in this exemplary embodiment is schematically shown;
[0026] Fig.10 A schematic diagram of the structure of a terrain rendering device in this exemplary embodiment is shown;
[0027] Fig.11 The structure diagram of an electronic device in this exemplary embodiment is schematically shown. DETAILED DESCRIPTION
[0028] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the exemplary embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0029] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0030] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps may be decomposed, while some steps may be combined or partially combined, so the actual execution order may change according to the actual situation.
[0031] In order to help those skilled in the art better understand the technical solution of the present disclosure, the relevant contents involved in the technical solution of the present disclosure are introduced below.
[0032] 1) Shader: A program used to generate images in computer graphics, coloring objects on the screen.
[0033] 2) 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 model's surface color, texture, reflectivity, transparency, gloss, and other properties, as well as properties that control how the model reflects, refracts, and scatters light.
[0034] 3) UV coordinates: A coordinate system used to describe texture mapping. Texture mapping is a technique for attaching a texture image to a flat or curved surface, which can make the appearance of the 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, so texture coordinates are needed. Texture coordinates are usually a two-dimensional coordinate system used to describe the pixel position in the texture image. And 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, thereby achieving the effect of texture mapping.
[0035] 4) 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, so it needs to use sampling coordinates to specify the pixel position to be obtained. Sampling coordinates are usually an extension of texture coordinates, which can be two-dimensional, three-dimensional or higher-dimensional coordinates. And when performing texture sampling, the shader will look up the corresponding color value in the texture image according to the sampling coordinates corresponding to each pixel, and apply it to the surface of the three-dimensional model, thereby achieving the effect of texture mapping.
[0036] 5) World Space Coordinates: refers to the position in a global coordinate system; it is the absolute coordinate relative to the entire scene, relative to the local space coordinates (such as the model local coordinates).
[0037] 6) Normal: A normal is a vector perpendicular to the surface and is used to describe the direction of the surface. In graphics rendering, normals are often used to calculate lighting and reflection effects.
[0038] 7) Seam: A seam is the boundary between different textures or planes. In three-plane mapping, discontinuities may appear in the seam area and need to be smoothed to avoid visual artifacts.
[0039] 8) Linear Interpolation (Lerp): Linear interpolation is a mathematical method for smooth transition between two values. In graphics rendering, it is usually used to blend different texture sampling results.
[0040] 9) Temporal Anti-Aliasing (TAA): Temporal anti-aliasing is a technique that reduces the jagged effect by sampling and averaging in the temporal dimension. It uses information from multiple frames to smooth the edges of an image.
[0041] 10) Dither Temporal Anti-Aliasing (DitherTAA): It 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. Dither TAA combines information from historical frames with information from the current frame to smooth the image and reduce significant edge jaggedness. The core idea is to use temporal information to achieve anti-aliasing effects and use dithering to reduce flickering and color banding.
[0042] In the relevant technical background, the terrain of the game scene is not only used as the game background to present unique natural scenery, but also as the core gameplay in some games, thereby directly affecting the player's strategy and tactical choices through the ups and downs of the terrain, narrow passages or the location of obstacles. And a well-designed map can provide players with rich tactical choices through layout and terrain features, thereby increasing the depth and complexity of the game. In the field of modern computer graphics and three-dimensional rendering, the generation and rendering of terrain in virtual scenes has always been a complex and resource-intensive task, and high-quality terrain rendering tasks need to find a balance between realistic visual effects and rendering performance. Traditional terrain rendering methods often use two-dimensional tiled texture mapping sampling technology. However, when the terrain has significant ups and downs, tiled texture mapping will cause texture stretching and distortion, which will affect the final visual effect.
[0043] In order to solve the problems existing in the above-mentioned tiled texture map sampling technology, in the relevant technical solutions, the tri-planar mapping technology is generally used. The specific process of the above-mentioned tri-planar mapping technology is exemplarily described below:
[0044] Step 1: Normal calculation: Determine the direction of each vertex in world space based on the normals of each vertex on the terrain surface.
[0045] Step 2: Texture sampling: Use the direction of each vertex normal to perform texture sampling from the three axes of X, Y, and Z to obtain the texture sampling result. This process is to perform three texture lookup operations on each vertex.
[0046] Step 3, weight calculation: Calculate the weights of the three texture sampling results based on the direction of each vertex normal. For example, the absolute value of the normal component can be used to calculate the weight, for example, the absolute value of the x, y, and z components of the normal are used as the weights of the texture in the X, Y, and Z axes, respectively.
[0047] Step 4, texture blending: Based on the weights of the texture sampling results of each axis obtained in step 3 above, the texture results obtained from the three axis sampling are weighted blended to obtain the final texture color. This step can effectively reduce the texture stretching and distortion problems on the surface of the final terrain model, thereby achieving high-quality terrain rendering effects.
[0048] However, on the one hand, the above three-plane mapping method requires three texture samplings in three axes for each texture map. In real-time rendering, the performance bottleneck is mainly reflected in the texture sampling and computational load of the GPU. Therefore, this will significantly increase the overhead cost of computing resources and GPU texture lookup, which will have an adverse effect on real-time rendering performance, especially in large-scale terrain scenes. On the other hand, since the three-plane mapping method samples from different axes, the corresponding textures may be discontinuous at the seams, resulting in obvious seam problems in visual effects. This requires an additional smoothing process to reduce seam artifacts, which also increases the computational complexity. On the third hand, in order to achieve three-plane mapping, it is usually necessary to prepare multiple texture maps (for textures in different axes) in advance, which further increases the occupation of memory resources.
[0049] In summary, there is an urgent need for a terrain material implementation solution that can reduce computational overhead while ensuring visual effects.
[0050] In view of the above problems, the exemplary embodiment of the present disclosure proposes a terrain rendering method, which can be applied to any application scenario that requires terrain rendering. Specifically, the method obtains the vertex normal vector of each vertex in the terrain to be rendered in the world space, and determines the first mask map of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vector; according to the first mask map of the multiple initial planes, the gap range mask map at the connection position between the multiple initial planes is determined; anti-aliasing processing is performed on each gap range mask map to obtain the second mask map of each gap range mask map; multiple target planes containing the second mask map are obtained, and the initial UV coordinates of the multiple target planes are interpolated to obtain the target UV coordinates of the terrain to be rendered; according to the target UV coordinates, the rendered target terrain is generated. On the one hand, the method only needs to perform a single sampling of the terrain to be rendered, which greatly reduces the number of texture lookup operations compared to the method of using three samplings in the related technical solution, thereby effectively reducing the computing load of the GPU and improving the real-time rendering performance, especially in large-scale terrain scenes. On the other hand, single sampling introduces a gap range, and smooth fusion is achieved in the gap area through dithering noise and anti-aliasing DitherTAA technology, which significantly reduces visual artifacts, makes the transition more natural, and improves the visual effect. This provides a new path for efficient and high-quality terrain rendering, solving the dual bottleneck problems of current terrain rendering in visual effects and computing performance.
[0051] The following will be combined Figure 1 , a terrain rendering method and device proposed in the present disclosure is applied to Figure 1 The embodiments are described in the system architecture of the exemplary application environment shown.
[0052] like Figure 1 As shown, it is a schematic diagram of an application scenario provided by an embodiment of the present application. In this scenario, a terminal device 101 and a server 102 may be included.
[0053] The terminal device 101 can be, for example, a mobile phone, a tablet computer (PAD), a laptop computer, a desktop computer, a smart TV, a smart vehicle device, a smart wearable device, a smart TV, and an aircraft, and any other device that involves terrain rendering. The terminal device 101 can be installed with a target application, and the target application can have functions such as presenting rendered terrain. The application involved in the embodiment of the present application can be a software client, or a client such as a web page or a small program. The server 102 is a server corresponding to the software or a web page, a small program, etc., and does not limit the specific type of the client.
[0054] The server 102 may be a background server of the target application, used to provide corresponding background services for it, such as terrain rendering services. It may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, i.e., content delivery networks (CDNs), and big data and artificial intelligence platforms, but is not limited thereto.
[0055] It should be noted that the terrain rendering method in the embodiment of the present application can be executed separately by the terminal device 101 or the server 102, or it can be executed jointly by the server 102 and the terminal device 101. In actual application, specific configuration can be performed according to the situation, and this application does not make specific limitations here. Among them, the server 102 and the terminal device 101 can both include one or more processors, memories, and interactive I / O interfaces, etc. In addition, the server 102 can also be configured with a database, which can be used to store data generated during the terrain rendering process, etc. Among them, the memories of the server 102 and the terminal device 101 can also store the program instructions required to be executed in the terrain rendering method provided in the embodiment of the present application, and these program instructions can be used to implement the terrain rendering process provided in the embodiment of the present application when executed by the processor.
[0056] It should be noted that when the terrain rendering method provided in the embodiment of the present application is executed by the server 102 or the terminal device 101 alone, the above-mentioned application scenario may also only include a single device of the server 102 or the terminal device 101, or the server 102 and the terminal device 101 may also be considered to be the same device. Of course, in actual application, when the terrain rendering method provided in the embodiment of the present application is jointly executed by the server 102 and the terminal device 101, the server 102 and the terminal device 101 may also be the same device, that is, the server 102 and the terminal device 101 may be different functional modules of the same device, or virtual devices virtualized by the same physical device.
[0057] In the embodiment of the present application, the terminal device 101 and the server 102 can be directly or indirectly connected to each other through one or more networks 103. The network 103 can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a wireless fidelity (Wireless-Fidelity, WIFI) network. Of course, it can also be other possible networks, which are not limited in the embodiment of the present application. It should be noted that Figure 1 The figure is only an example. In fact, the number of terminal devices and servers is not limited and is not specifically limited in the embodiments of the present application.
[0058] For example, in an exemplary embodiment, the terminal device 101 may obtain the vertex normal vectors of each vertex in the terrain to be rendered in the world space, and determine the first mask maps of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vectors; determine the gap range mask maps at the connection positions between the multiple initial planes according to the first mask maps of the multiple initial planes; perform anti-aliasing processing on each gap range mask map to obtain the second mask map of each gap range mask map; obtain multiple target planes containing the second mask map, and perform interpolation processing on the initial UV coordinates of the multiple target planes to obtain the target UV coordinates of the terrain to be rendered; generate the rendered target terrain according to the target UV coordinates. Finally, the rendered target terrain is displayed in the graphical user interface of the terminal device 101.
[0059] The following uses the terminal device 101 as an execution subject and illustrates the terrain rendering method by applying the terminal device 101 as an example. Figure 2 A flowchart schematically shows a method for terrain rendering in this exemplary embodiment, see Figure 2 The terrain rendering method provided by the embodiment of the present disclosure includes the following steps S201 to S205:
[0060] Step S201: obtaining vertex normal vectors of each vertex in the terrain to be rendered in the world space, and determining first mask maps of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vectors.
[0061] Step S202: Determine a gap range mask map at the connection position between the multiple initial planes according to the first mask map of the multiple initial planes.
[0062] Step S203: perform anti-aliasing processing on each gap range mask map to obtain a second mask map for each gap range mask map.
[0063] Step S204: Acquire multiple target planes containing the second mask map, and perform interpolation processing on the initial UV coordinates of the multiple target planes to obtain the target UV coordinates of the terrain to be rendered.
[0064] Step S205: Generate a rendered target terrain according to the target UV coordinates.
[0065] In the technical solutions provided by some embodiments of the present disclosure, the vertex normal vectors of each vertex in the terrain to be rendered in the world space are obtained, and the first mask maps of multiple initial planes of the terrain to be rendered in the world space are determined based on the vertex normal vectors; the gap range mask maps at the connection positions between the multiple initial planes are determined according to the first mask maps of the multiple initial planes; anti-aliasing processing is performed on each gap range mask map to obtain the second mask map of each gap range mask map; multiple target planes containing the second mask map are obtained, and the initial UV coordinates of the multiple target planes are interpolated to obtain the target UV coordinates of the terrain to be rendered; and the rendered target terrain is generated according to the target UV coordinates. On the one hand, this method only requires a single sampling of the terrain to be rendered, which greatly reduces the number of texture lookup operations compared to the method of three samplings used in the related technical solution, thereby effectively reducing the computational load of the GPU and improving the real-time rendering performance, especially in large-scale terrain scenes. On the other hand, single sampling introduces a gap range, and smooth fusion is achieved in the gap area through dithering noise and anti-aliasing DitherTAA technology, which significantly reduces visual artifacts, makes the transition more natural, and improves the visual effect. This provides a new path for efficient and high-quality terrain rendering, solving the dual bottleneck problems of current terrain rendering in visual effects and computing performance.
[0066] The following will be combined with specific embodiments to Figure 2 The specific implementation methods of each step in the embodiment shown are described in detail:
[0067] In step S201, the vertex normal vector of each vertex in the terrain to be rendered in the world space is obtained, and the first mask map of multiple initial planes of the terrain to be rendered in the world space is determined based on the vertex normal vector.
[0068] Wherein, each vertex is a plurality of vertices on the model surface corresponding to the terrain to be rendered. The vertex normal vector of each vertex in the world space is the normal vector of each vertex in the world space coordinate system. The world space contains multiple axes, such as the x-axis, the y-axis and the z-axis, and the corresponding multiple initial planes can be the first initial sub-plane corresponding to the x-axis, the second initial sub-plane corresponding to the y-axis and the third initial sub-plane corresponding to the z-axis.
[0069] Exemplarily, the terminal device can obtain the vertex normal vector of each vertex in the terrain to be rendered in the world space, and then determine the mask maps of the above-mentioned multiple initial planes based on the vertex normal vector, such as the first mask map of the x plane, y plane and z plane.
[0070] When executing the above step S201, after obtaining the vertex normal vectors of each vertex in the terrain to be rendered in the world space, in some example embodiments of the present disclosure, the vertex normal vectors are subjected to absolute value processing to obtain the vertex normal vectors after absolute value processing; based on the vertex normal vectors after absolute value processing, the mask maps of multiple target planes of the terrain to be rendered in the world space are determined.
[0071] Exemplarily, by performing absolute value processing on the vertex normal vector, the mask maps of multiple initial planes (for example, the x plane, the y plane, and the z plane) determined based on the vertex normal vector after absolute value processing can respectively achieve mask symmetry effects in the up and down directions, left and right directions, and front and back directions.
[0072] It needs to be explained that in the shader, the VertexNormalWS node can be used to obtain the vertex normal vector of each vertex in the terrain to be rendered in the world space, and the Mask node can be used to obtain the mask maps of the three initial planes x, y, and z respectively.
[0073] In step S202, a gap range mask map at the connection position between the multiple initial planes is determined according to the first mask map of the multiple initial planes.
[0074] Exemplarily, there are multiple initial planes in the terrain to be rendered in the three-dimensional scene, and there is a gap range at the connection position between the multiple initial planes, which can be an area with a certain area or a gap line without an area. The following will be described in conjunction with specific embodiments:
[0075] Embodiment 1: In an optional embodiment of the present disclosure, an image sharpening parameter of a terrain to be rendered is determined to be a first parameter value; based on the first parameter value and the pixel values of a plurality of initial planes, a proportion of each initial plane relative to the sum of the pixel values of the plurality of initial planes is determined; in response to a difference between the proportion values of each initial plane being less than a preset pixel threshold, a gap range at a connection position between the plurality of initial planes is determined to be a gap region having a first area, the first area being determined by the first parameter value; a gap range mask map at a connection position between the plurality of initial planes is determined based on a first mask map of the plurality of initial planes; a gap region of the first area is included in the first mask map of the plurality of initial planes.
[0076] The image sharpening parameter is used to describe the sharpening value of the image, and is usually characterized by a Sharpness parameter.
[0077] Exemplarily, assuming that the sharpness parameter (i.e., the first parameter value) is n, and taking the multiple initial planes including the x plane, the y plane, and the z plane as an example, the proportion values corresponding to the x plane, the y plane, and the z plane are calculated based on the following formula (1):
[0078]
[0079] In formula (1), X is the proportion value corresponding to the x plane, Y is the proportion value corresponding to the y plane, Z is the proportion value corresponding to the z plane, n is the first parameter value, x is the pixel value of the x plane, y is the pixel value of the y plane; z is the pixel value of the z plane.
[0080] Based on formula (1), the X, Y, and Z values are similar, that is, the values of XY, YZ, and XZ are all less than the preset pixel threshold, then the gap range at the corresponding connection position of the x plane, y plane, and z plane is a gap area with a first area.
[0081] Figure 3 The schematic diagram of the effect that the gap range at the corresponding connection position of the x plane, y plane, and z plane is a gap region with a first area, referring to Figure 3 As shown, based on formula (1), if the X, Y, and Z values are close, the following will appear at the junction of adjacent planes (such as the x plane and the y plane): Figure 3 The gap area shown in FIG. The area of the gap area is determined by the value of the first parameter.
[0082] Based on the above embodiment, the user may also adjust the area of the gap region by adjusting the parameter value of the image sharpening parameter.
[0083] In an optional embodiment of the present disclosure, in response to adjusting an image sharpening parameter from a first parameter value to a second parameter value, the gap region of the first area is reduced to a second area.
[0084] The second parameter value is greater than the first parameter value.
[0085] Exemplarily, the larger the image sharpness parameter Sharpness value is, the smaller the area of the gap region is; conversely, if the image sharpness parameter Sharpness value is smaller, the area of the generated gap region is larger.
[0086] Embodiment 2: In an optional embodiment of the present disclosure, an image sharpening parameter of the terrain to be rendered is determined to be a first parameter value; based on the first parameter value and the pixel values of multiple initial planes, a proportion of each initial plane relative to the sum of the pixel values of the multiple initial planes is determined; in response to the difference between the proportions of each initial plane being not less than a preset pixel threshold, a gap range at the connection position between the multiple initial planes is determined to be a gap line.
[0087] Exemplarily, if the difference between the proportion values of each initial plane is not less than the preset pixel threshold, that is, the X, Y, and Z values calculated based on formula (1) are not close, then the gap range at the connection position between the multiple initial planes is the gap line. That is, there is no gap area of a certain area between the multiple initial planes, but a line without area.
[0088] Figure 4 Schematically showing the effect of a gap range at a plurality of initial plane connection positions being a gap line in this exemplary embodiment; Figure 4 As shown, if the X, Y, and Z values calculated based on formula (1) are not close, the following will appear at the junction of adjacent planes (such as the x plane and the y plane): Figure 4 Gap lines shown.
[0089] It needs to be explained that through Figure 3 and Figure 4 By comparison, it can be seen that the parameter value of the image sharpening parameter not only affects the size of the generated gap area, but also affects the edge blur of the gap area, that is, the larger the Sharpness value of the image sharpening parameter, the smaller the area of the gap area, and the smaller the edge blur of the gap area (that is, the clearer the edge, the smaller the area of the gap area); conversely, the smaller the Sharpness value of the image sharpening parameter, the larger the area of the gap area, and the greater the edge blur of the gap area (that is, the blurrier the edge, the larger the area of the gap area).
[0090] It can be seen from the above embodiments that the gap range (for example, the gap range at the connection position between the multiple initial planes) included in the first mask map corresponding to the multiple initial planes Figure 3 The gap area shown or Figure 4 The gap line shown in FIG. 10 ) can be used to determine the gap range mask map at the connection position between the multiple initial planes based on the first mask map of the multiple initial planes in step S202.
[0091] exist Figure 3 On the basis of the shown embodiment, in an optional embodiment of the present disclosure, for the first mask map of each initial plane, difference processing is performed between the first mask map and a preset value, and based on the product of the mask map after the difference processing and the first mask map, a mask map of the gap range at the connection position between multiple initial planes is determined.
[0092] Exemplarily, for the first mask map of each initial plane among the multiple initial planes, a difference processing is performed between the preset value and the first mask map, and the mask map of the gap range at the connection position between the multiple initial planes is determined based on the product of the mask map after the difference processing and the first mask map.
[0093] Taking the first mask map corresponding to the x-plane as an example, the gap range mask map for the x-plane can be obtained by [1-(pixel value of the first mask map)]*(pixel value of the first mask map). Similarly, the gap range mask map for the y-plane and the gap range mask map for the z-plane can be determined, which will not be described in detail here.
[0094] right Figure 4 By performing a series of processing in the above embodiment on the first mask map of each initial plane shown in FIG. Figure 5 The effect of the gap range mask map at the connection position between multiple initial planes is shown.
[0095] In step S203, anti-aliasing processing is performed on each seam range mask map to obtain a second mask map for each seam range mask map.
[0096] In an optional embodiment of the present disclosure, when executing step S203, anti-aliasing processing is performed on each gap range mask map to obtain an initial mask map of each gap range mask map; each initial mask map is superimposed with the corresponding gap range mask map to obtain an intermediate mask map; the pixel values in the intermediate mask map are rounded to obtain a second mask map of each gap range mask map.
[0097] For example, after anti-aliasing processing is performed on each seam range mask map, an initial mask map of each seam range mask map is obtained, and then the initial mask map is superimposed with the corresponding seam range mask map to obtain an intermediate mask map. Finally, the round node can be used to round the pixel values in the intermediate mask map to ensure that the final mask value is only 0 or 1, thereby generating a clear and clean second mask map.
[0098] Figure 6A schematic diagram of a second mask map of each gap range mask map obtained after DitherTAA processing in this exemplary embodiment is schematically shown, referring to Figure 6 The resulting second mask map shown has only 0s or 1s, resulting in a well-defined, clean mask.
[0099] Among them, in any of the above embodiments, during the process of performing anti-aliasing processing on each gap range mask map, dither information can also be added, that is, DitherTAA (dithered temporal anti-aliasing) processing is performed on each gap range mask map to improve the anti-aliasing effect of the image and reduce the jagged phenomenon on the edge of the image. Dither TAA combines dithering technology and temporal anti-aliasing (TAA) technology to smooth the image and reduce significant edge jaggedness through the information of historical frames and the information of the current frame. The core idea is to use time information to achieve anti-aliasing effects and reduce flickering and color banding by adding dither information.
[0100] In an optional embodiment of the present disclosure, when adding jitter information to each gap range mask map and performing anti-aliasing processing, the color information of each gap range mask map at a historical moment is obtained, and the color information of each gap range mask map at a current moment is obtained; jitter information is added to each gap range mask map at a historical moment to obtain the first color information of each gap range mask map at a historical moment, and jitter information is added to each gap range mask map at a current moment to obtain the second color information of each gap range mask map at the current moment; the first color information and the second color information are color-fused to obtain a second mask map of each gap range mask map.
[0101] Exemplarily, in the time frame of the terrain to be rendered, it includes each seam range mask map at a historical moment (also referred to as a historical frame) and each seam range mask map at a current moment (also referred to as a current frame).
[0102] Step 1: Sample the historical frames: Dither TAA first needs to save the color information of each gap range mask map in the historical frames. It should be noted that the color information of multiple frames is usually saved in a ring buffer for use in the rendering of the current frame.
[0103] Step 2: Calculate the color of the current frame: The color information of the current frame can be calculated based on the material and lighting of the terrain model in the virtual scene. Usually, this step is completed through conventional material calculation.
[0104] Step 3, dithering: Dither TAA uses dithering information (for example, dithering information can be provided by dithering an image) to break the regularity of each seam range mask map, thereby reducing obvious aliasing. The above dithering information can be randomly generated or predefined. Dithering can be applied to different pixels to create an effect of micro-movement in different frames, thereby reducing color banding and flickering. That is, dithering information is added to each seam range mask map at a historical moment to obtain the first color information of each seam range mask map at the historical moment, and dithering information is added to each seam range mask map at the current moment to obtain the second color information of each seam range mask map at the current moment.
[0105] Step 4: Mix the color information of the historical frame and the current frame: Mix the second color information of the current frame and the first color value of the historical frame, usually using a weighted average method. The calculation formula (1) is as follows:
[0106] FinalColor= CurrentColor \times (1 - \alpha) + PreviousColor \times\alpha Formula (1)
[0107] In formula (1), alpha is a value between 0 and 1, which usually depends on the anti-aliasing setting and the amount of motion in the image. It should be explained that a larger alpha value means more weight is given to the historical frame, which is suitable for static scenes, while a smaller alpha value is more suitable for dynamic scenes. PreviousColor is the first color information of each gap range mask map in the historical frame; CurrentColor is the second color information of each gap range mask map in the current frame; times is the time frame.
[0108] Step 5, Final Output: The final color value is post-processed to obtain the second mask map of each gap range mask map, and output to the display device. This process can be completed in the post-processing material, usually in the later stage of the graphics pipeline.
[0109] In this embodiment, the anti-aliasing process can be achieved by obtaining the color information of each gap range mask map at a historical moment, and obtaining the color information of each gap range mask map at a current moment; and performing color fusion on the above two color information, thereby utilizing time information to achieve an anti-aliasing effect.
[0110] In step S204, a plurality of target planes including the second mask map are obtained, and initial UV coordinates of the plurality of target planes are interpolated to obtain target UV coordinates of the terrain to be rendered.
[0111] The multiple target planes may be planes surrounded by multiple axes, for example, an xy plane formed by an x-axis and a y-axis; an xz plane formed by an x-axis and a z-axis; and a yz plane formed by a y-axis and a z-axis. Figure 7 As shown, Figure 7 To obtain multiple target planes containing a second mask map.
[0112] In an optional embodiment of the present disclosure, the multiple target planes at least include a first target sub-plane, a second target sub-plane, and a third target sub-plane, the first target sub-plane is a sub-plane composed of a first axis and a second axis in the world space; the second target sub-plane is a sub-plane composed of a first axis and a third axis in the world space; the third target sub-plane is a sub-plane composed of a second axis and a third axis in the world space; the multiple initial planes at least include a first initial sub-plane corresponding to the first axis; a second initial sub-plane corresponding to the second axis, and a third initial sub-plane corresponding to the third axis;
[0113] The initial UV coordinates of multiple target planes are interpolated to obtain the target UV coordinates of the terrain to be rendered, including:
[0114] Determine that the mask maps corresponding to the first target sub-plane and the second target sub-plane are the first sub-mask maps corresponding to the first initial sub-plane among the multiple initial planes;
[0115] Interpolation processing is performed on the initial UV coordinates of the first sub-mask map, so that the first target sub-plane obtains a first area with a pixel value of the first pixel value in the first sub-mask map, and fills the first area with a texture corresponding to the first target sub-plane, and the second target sub-plane obtains a second area with a pixel value of the second pixel value in the first sub-mask map, and fills the second area with a texture corresponding to the second target sub-plane, to obtain a texture map;
[0116] The texture map and the mask map of the third target sub-plane are interpolated so that the third target sub-plane obtains a third area in the first sub-mask map whose pixel value is the second pixel value, and fills the third area with the texture corresponding to the third target sub-plane to obtain the target UV coordinates of the terrain to be rendered.
[0117] The interpolation process may use the lerp function to perform interpolation operations on the initial UV coordinates of multiple target planes.
[0118] by Figure 7Taking the initial UV coordinates of the three planes shown as an example, the xy plane (first target sub-plane) and the yz plane (second target sub-plane) use the mask map of the x plane (i.e., the first sub-mask map) as the standard for lerp operation, so that the xy plane obtains the black part (the first pixel value = 0, the black part area corresponds to the first area) to fill in the texture Texture corresponding to the first target sub-plane, and the yz plane obtains the white part (the second pixel value = 1, the white part area corresponds to the second area) to fill in the texture Texture corresponding to the second target sub-plane.
[0119] The texture map (Texture Coodinate) obtained by the above operation is interpolated with the mask map of the xz plane (corresponding to the third target sub-plane). The result is that the texture of the xz plane obtains the white part of the y plane mask (that is, the third area of the second pixel value), and the remaining black part is the mask of the z plane, and the result is as follows Figure 8 The effect diagram shown.
[0120] Based on the above embodiments, the target UV coordinates of the terrain to be rendered can be obtained.
[0121] In step S205, a rendered target terrain is generated according to the target UV coordinates.
[0122] The rendered target terrain can be obtained by superimposing materials based on the target UV coordinates. Fig. 9A , Fig. 9B By comparing the effects of terrain rendering using the method of the related technical solution with the terrain rendering method provided by the embodiment of the present disclosure, it can be seen that: Fig. 9A The rendering effect of the present invention has the problems of stretching and deformation, while the terrain rendering effect of the present invention has the problem of evenly distributed texture and the number of samples is not increased, which reduces the performance consumption.
[0123] In order to implement the above terrain rendering method, an embodiment of the present disclosure provides a terrain rendering device. Fig.10 A schematic architecture diagram of a terrain rendering device 1000 is schematically shown.
[0124] The terrain rendering device includes a vector acquisition module 1001 , a gap range determination module 1002 , an anti-aliasing processing module 1003 , an interpolation processing module 1004 and a terrain generation module 1005 .
[0125] The vector acquisition module 1001 is configured to execute the acquisition of the vertex normal vector of each vertex in the terrain to be rendered in the world space, and determine the first mask map of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vector; the gap range determination module 1002 is used to determine the gap range mask map at the connection position between the multiple initial planes according to the first mask map of the multiple initial planes; the anti-aliasing processing module 1003 is used to perform anti-aliasing processing on each gap range mask map to obtain the second mask map of each gap range mask map; the interpolation processing module 1004 is configured to execute the acquisition of multiple target planes including the second mask map, and interpolate the initial UV coordinates of the multiple target planes to obtain the target UV coordinates of the terrain to be rendered; the terrain generation module 1005 is configured to execute the generation of the rendered target terrain according to the target UV coordinates.
[0126] In an optional embodiment of the present disclosure, the vector acquisition module 1001 is specifically used to perform absolute value processing on the vertex normal vector to obtain the vertex normal vector after absolute value processing; based on the vertex normal vector after absolute value processing, determine the mask map of multiple target planes of the terrain to be rendered in the world space.
[0127] In an optional embodiment of the present disclosure, the gap range determination module 1002 is used to determine that the image sharpening parameter of the terrain to be rendered is a first parameter value; based on the first parameter value and the pixel values of multiple initial planes, determine the proportion of each initial plane relative to the sum of the pixel values of the multiple initial planes; in response to the difference between the proportion values of each initial plane being less than a preset pixel threshold, determine that the gap range at the connection position between the multiple initial planes is a gap area with a first area, and the first area is determined by the first parameter value; determine the gap range mask map at the connection position between the multiple initial planes according to the first mask map of the multiple initial planes; the first mask map of the multiple initial planes includes a gap area of the first area.
[0128] In an optional embodiment of the present disclosure, the gap range determination module 1002 is used to perform difference processing between a preset value and the first mask map for each initial plane, and determine the gap range mask map at the connection position between multiple initial planes based on the product of the mask map after the difference processing and the first mask map.
[0129] In an optional embodiment of the present disclosure, the device may also include a parameter adjustment module, which is configured to execute, in response to adjusting the image sharpening parameter from a first parameter value to a second parameter value, reducing the boundary area of the first area to a second area; wherein the second parameter value is greater than the first parameter value.
[0130] In an optional embodiment of the present disclosure, the gap range determination module 1002 is further used to determine the gap range at the connection position between multiple initial planes as a gap line in response to the difference between the proportion values of each initial plane being not less than a preset pixel threshold.
[0131] In an optional embodiment of the present disclosure, the anti-aliasing processing module 1003 is specifically used to add anti-aliasing processing to each gap range mask map to obtain an initial mask map of each gap range mask map; superimpose each initial mask map with the corresponding gap range mask map to obtain an intermediate mask map; round off the pixel values in the intermediate mask map to obtain a second mask map of each gap range mask map.
[0132] In an optional embodiment of the present disclosure, the anti-aliasing processing module 1003 is specifically used to obtain the color information of each gap range mask map at a historical moment, and to obtain the color information of each gap range mask map at a current moment; to add jitter information to each gap range mask map at a historical moment to obtain the first color information of each gap range mask map at a historical moment, and to add jitter information to each gap range mask map at a current moment to obtain the second color information of each gap range mask map at the current moment; to perform color fusion processing on the first color information and the second color information to obtain the second mask map of each gap range mask map.
[0133] In an optional embodiment of the present disclosure, the plurality of target planes at least include a first target sub-plane, a second target sub-plane and a third target sub-plane, the first target sub-plane being a sub-plane composed of a first axis and a second axis in the world space; the second target sub-plane being a sub-plane composed of a first axis and a third axis in the world space; the third target sub-plane being a sub-plane composed of a second axis and a third axis in the world space; the plurality of initial planes at least include a first initial sub-plane corresponding to the first axis; a second initial sub-plane corresponding to the second axis and a third initial sub-plane corresponding to the third axis; the interpolation processing module 1004 is used to determine that the mask maps corresponding to the first target sub-plane and the second target sub-plane are the mask maps corresponding to the first initial sub-plane in the plurality of initial planes. The first sub-mask map corresponding to the texture map is interpolated; the initial UV coordinates of the first sub-mask map are interpolated so that the first target sub-plane obtains the first area with the pixel value of the first pixel value in the first sub-mask map, and fills the first area with the texture corresponding to the first target sub-plane, and the second target sub-plane obtains the second area with the pixel value of the second pixel value in the first sub-mask map, and fills the second area with the texture corresponding to the second target sub-plane, so as to obtain the texture map; the texture map is interpolated with the mask map of the third target sub-plane, so that the third target sub-plane obtains the third area with the pixel value of the second pixel value in the first sub-mask map, and fills the third area with the texture corresponding to the third target sub-plane, so as to obtain the target UV coordinates of the terrain to be rendered.
[0134] The terrain rendering device 1000 provided in the embodiment of the present disclosure can execute the technical solution of the terrain rendering method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to those of the terrain rendering method. Please refer to the implementation principle and beneficial effects of the terrain rendering method, and no further details will be given here.
[0135] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0136] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device.
[0137] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0138] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0139] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
[0140] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet Service Provider).
[0141] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0142] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0143] Refer to the following Fig.11 The electronic device 1100 according to this embodiment of the present invention is described. Fig.11 The electronic device 1100 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0144] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. The components of the electronic device 1100 may include, but are not limited to: the at least one processing unit 1110, the at least one storage unit 1120, a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110), and a display unit 1140.
[0145] The storage unit stores program codes, which can be executed by the processing unit 1110, so that the processing unit 1110 executes the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1110 can execute the following steps: Figure 2 Steps S201 to S205 shown in FIG.
[0146] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and / or a cache storage unit 11202 , and may further include a read-only storage unit (ROM) 11203 .
[0147] The storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0148] Bus 1130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0149] The electronic device 1100 may also communicate with one or more external devices 2000 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and / or communicate with any device that enables the electronic device 1100 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1150. Furthermore, the electronic device 1100 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems.
[0150] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0151] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0152] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0153] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0154] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A terrain rendering method, characterized in that: include: Obtaining a vertex normal vector of each vertex in the terrain to be rendered in the world space, and determining a first mask map of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vector; Determine a gap range mask map at a connection position between the plurality of initial planes according to the first mask maps of the plurality of initial planes; Performing anti-aliasing processing on each of the gap range mask maps to obtain a second mask map for each of the gap range mask maps; Acquire multiple target planes including the second mask map, and perform interpolation processing on the initial UV coordinates of the multiple target planes to obtain the target UV coordinates of the terrain to be rendered; A rendered target terrain is generated according to the target UV coordinates.
2. The method according to claim 1, characterized in that The step of determining mask maps of multiple target planes of the terrain to be rendered in the world space based on the vertex normal vectors includes: Performing absolute value processing on the vertex normal vector to obtain the vertex normal vector after absolute value processing; Based on the vertex normal vectors after absolute value processing, mask maps of multiple target planes of the terrain to be rendered in the world space are determined.
3. The method according to claim 1, characterized in that The step of determining the gap range mask map at the connection position between the multiple initial planes according to the first mask map of the multiple target planes includes: Determine that the image sharpening parameter of the terrain to be rendered is a first parameter value; Determine, based on the first parameter value and the pixel values of the multiple initial planes, a proportion of each initial plane to the sum of the pixel values of the multiple initial planes; In response to a difference between the proportions of the initial planes being less than a preset pixel threshold, determining that a gap range at a connection position between the multiple initial planes is a gap region having a first area, where the first area is determined by the first parameter value; The gap range mask map at the connection position between the multiple initial planes is determined according to the first mask map of the multiple initial planes; the first mask map of the multiple initial planes includes the gap area of the first area.
4. The method according to claim 3, characterized in that The step of determining the gap range mask map at the connection position between the multiple initial planes according to the first mask map of the multiple initial planes includes: For the first mask map of each initial plane, difference processing is performed between the first mask map and a preset value, and based on the product of the mask map after the difference processing and the first mask map, the gap range mask map at the connection position between the multiple initial planes is determined.
5. The method according to claim 3, characterized in that: The method further comprises: In response to the image sharpening parameter being adjusted from the first parameter value to a second parameter value, the boundary region of the first area is reduced to a second area; wherein the second parameter value is greater than the first parameter value.
6. The method according to claim 3, characterized in that The method further comprises: In response to the difference between the proportion values of each of the initial planes being not less than the preset pixel threshold, a gap range at a connecting position between the multiple initial planes is determined as a gap line.
7. The method according to claim 1, characterized in that The step of performing anti-aliasing processing on each of the gap range mask maps to obtain a second mask map for each of the gap range mask maps comprises: Performing anti-aliasing processing on each of the gap range mask maps to obtain an initial mask map of each of the gap range mask maps; Superimposing each of the initial mask maps with the corresponding gap range mask map to obtain an intermediate mask map; The pixel values in the intermediate mask map are rounded off to obtain a second mask map for each of the gap range mask maps.
8. The method according to claim 1 or 7, characterized in that: Performing anti-aliasing processing on each of the gap range mask maps to obtain a second mask map for each of the gap range mask maps; comprising: Obtaining color information of each of the gap range mask maps at a historical moment, and obtaining color information of each of the gap range mask maps at a current moment; Adding jitter information to each of the gap range mask maps at the historical moment to obtain first color information of each of the gap range mask maps at the historical moment, and adding jitter information to each of the gap range mask maps at the current moment to obtain second color information of each of the gap range mask maps at the current moment; The first color information and the second color information are subjected to color fusion processing to obtain a second mask map of each of the gap range mask maps.
9. The method according to claim 1, characterized in that: The multiple target planes at least include a first target sub-plane, a second target sub-plane and a third target sub-plane, the first target sub-plane is a sub-plane composed of a first axis and a second axis in the world space; the second target sub-plane is a sub-plane composed of a first axis and a third axis in the world space; the third target sub-plane is a sub-plane composed of a second axis and a third axis in the world space; the multiple initial planes at least include a first initial sub-plane corresponding to the first axis; a second initial sub-plane corresponding to the second axis, and a third initial sub-plane corresponding to the third axis; The interpolation process is performed on the initial UV coordinates of the plurality of target planes to obtain the target UV coordinates of the terrain to be rendered, including: Determine that the mask maps corresponding to the first target sub-plane and the second target sub-plane are the first sub-mask maps corresponding to the first initial sub-plane among the multiple initial planes; Interpolation processing is performed on the initial UV coordinates of the first sub-mask map, so that the first target sub-plane acquires a first area in the first sub-mask map whose pixel value is a first pixel value, and fills the first area with a texture corresponding to the first target sub-plane, and the second target sub-plane acquires a second area in the first sub-mask map whose pixel value is a second pixel value, and fills the second area with a texture corresponding to the second target sub-plane, to obtain a texture map; The texture map and the mask map of the third target sub-plane are interpolated so that the third target sub-plane obtains a third area in the first sub-mask map whose pixel value is the second pixel value, and the texture corresponding to the third target sub-plane is filled in the third area to obtain the target UV coordinates of the terrain to be rendered.
10. A terrain rendering device, characterized in that: The device comprises: A vector acquisition module is configured to acquire a vertex normal vector of each vertex in the terrain to be rendered in the world space, and determine a first mask map of multiple initial planes of the terrain to be rendered in the world space based on the vertex normal vector; A gap range determination module, used for determining a gap range mask map at a connection position between the plurality of initial planes according to the first mask map of the plurality of initial planes; An anti-aliasing processing module, used for performing anti-aliasing processing on each of the gap range mask maps to obtain a second mask map for each of the gap range mask maps; an interpolation processing module, configured to execute acquisition of a plurality of target planes including the second mask map, and to perform interpolation processing on initial UV coordinates of the plurality of target planes to obtain target UV coordinates of the terrain to be rendered; The terrain generation module is configured to generate a rendered target terrain according to the target UV coordinates.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the terrain rendering method according to any one of claims 1 to 9 is implemented.
12. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the terrain rendering method described in any one of claims 1 to 9 by executing the executable instructions.