Terrain rendering method and device, electronic equipment, medium and product

By determining the physical texture coordinates of the rendered graphics during terrain rendering, RVT solves the problems of excessive pressure on the vertex shader and frequent rendering page switching during terrain rendering, achieving a stable frame rate and fixed memory.

CN114842127BActive Publication Date: 2025-01-21BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210567577.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-23
Publication Date
2025-01-21
Estimated Expiration
2042-05-23

AI Technical Summary

Technical Problem

RVT needs to process all vertex information when rendering terrain, resulting in excessive pressure on the vertex shader and requires frequent rendering page switching and copying operations, which is not friendly to the renderer.

Method used

By determining the rendering graphics corresponding to the terrain to be rendered, the world coordinates of the vertices of the rendering graphics are passed to the vertex shader, the homogeneous coordinates of the vertices of the rendering graphics are determined through the vertex shader, and passed to the pixel shader, combined with the rendering graphics in the physics Based on the position information on the texture and virtual texture, the physical texture coordinates of the rendered graphics are calculated, and finally these coordinates are used to render the terrain to be rendered.

Benefits of technology

It reduces the vertex shading pressure in the vertex shader stage, avoids frequent rendering page switching and copy operations, and ensures stable frame rate and fixed memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114842127B_ABST
    Figure CN114842127B_ABST
Patent Text Reader

Abstract

The present disclosure provides a terrain rendering method and device, electronic equipment, medium and product, and relates to the field of computer vision technology. The terrain rendering method includes: determining a rendering graphic corresponding to the terrain to be rendered, and passing the world coordinates of the vertices of the rendering graphic into a vertex shader; determining the homogeneous coordinates of the vertices of the rendering graphic through the vertex shader according to the world coordinates of the vertices of the rendering graphic and the position information of the rendering graphic on the physical map; passing the homogeneous coordinates of the vertices of the rendering graphic into a pixel shader; determining the physical texture coordinates of the rendering graphic through the pixel shader according to the homogeneous coordinates of the vertices of the rendering graphic, the position information of the rendering graphic on the physical map and the position information of the rendering graphic on the virtual map; rendering the terrain to be rendered based on the physical texture coordinates of the rendering graphic. This method can reduce the vertex shading pressure in the vertex shader stage and ensure a stable frame rate and memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer vision technology, and in particular to a terrain rendering method and device, electronic equipment, medium and product. Background Art

[0002] Terrain rendering is an important part of virtual natural scenes, and can be achieved through runtime virtual texture (RVT). RVT is a feature provided by Unreal Engine 4.23, which can use the Graphics Processing Unit (GPU) to generate and cache texture data on demand at runtime. It can cache large-area shading data, so it is very suitable for landscape shading using decal materials and splines that are very suitable for terrain. In related technologies, terrain rendering can be achieved through RVT provided by Unreal Engine 4.23. However, analysis shows that RVT needs to process all vertex information when rendering terrain, which causes excessive pressure on the vertex shader, and requires frequent rendering page switching and copying operations, which is not friendly to the renderer.

[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0004] The present disclosure provides a terrain rendering method, device, electronic device, computer-readable storage medium and computer program product to at least solve the problem of excessive pressure on the vertex shader caused by the need to process all vertex information.

[0005] According to one aspect of an embodiment of the present disclosure, a terrain rendering method is provided, including: determining a rendering graphic corresponding to a terrain to be rendered, and passing the world coordinates of the vertices of the rendering graphic into a vertex shader; determining, through the vertex shader, the homogeneous coordinates of the vertices of the rendering graphic according to the world coordinates of the vertices of the rendering graphic and position information of the rendering graphic on a physical map; passing the homogeneous coordinates of the vertices of the rendering graphic into a pixel shader; determining, through the pixel shader, the physical texture coordinates of the rendering graphic according to the homogeneous coordinates of the vertices of the rendering graphic, the position information of the rendering graphic on the physical map, and the position information of the rendering graphic on the virtual map.

[0006] In one embodiment of the present disclosure, the world coordinates of the vertices of the rendered graphic include: first-dimensional world coordinate data, second-dimensional world coordinate data, and third-dimensional world coordinate data, wherein the third-dimensional world coordinate data is determined by a serial number identifier of the rendered graphic.

[0007] In one embodiment of the present disclosure, the method further includes: obtaining a serial number identifier of the rendered graphic according to the third-dimensional world coordinate data; determining position information of the rendered graphic on a physical map according to the serial number identifier of the rendered graphic, wherein the position information of the rendered graphic on the physical map is the physical map coordinates of the vertices of the rendered graphic, and the physical map coordinates of the vertices of the rendered graphic include first-dimensional physical map coordinate data and second-dimensional physical map coordinate data; and determining position information of the rendered graphic on a virtual map according to the serial number identifier of the rendered graphic, wherein the position information of the rendered graphic on the virtual map is the virtual map coordinates of the vertices of the rendered graphic, and the virtual map coordinates of the vertices of the rendered graphic include first-dimensional virtual map coordinate data and second-dimensional virtual map coordinate data.

[0008] In one embodiment of the present disclosure, determining the homogeneous coordinates of the vertices of the rendered graphic based on the world coordinates of the vertices of the rendered graphic and the position information of the rendered graphic on the physical map includes: using the world coordinates of the vertices of the rendered graphic as a reference, mapping the physical map coordinates of the vertices of the rendered graphic to a homogeneous space, and obtaining the homogeneous coordinates of the vertices of the rendered graphic, wherein the homogeneous coordinates of the vertices of the rendered graphic include first-dimensional homogeneous coordinate data, second-dimensional homogeneous coordinate data, third-dimensional homogeneous coordinate data, and fourth-dimensional homogeneous coordinate data.

[0009] In one embodiment of the present disclosure, the method of mapping the physical mapping coordinates of the vertices of the rendered graphics to a homogeneous space with the world coordinates of the vertices of the rendered graphics as a reference to obtain the homogeneous coordinates of the vertices of the rendered graphics includes: using the first-dimensional world coordinate data as a reference, based on the first-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the first-dimensional physical mapping coordinate data to obtain the first-dimensional homogeneous coordinate data; using the second-dimensional world coordinate data as a reference, based on the second-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the second-dimensional physical mapping coordinate data to obtain the second-dimensional homogeneous coordinate data; based on the third-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the third-dimensional world coordinate data to obtain the third-dimensional homogeneous coordinate data; setting the fourth-dimensional homogeneous coordinate data to a preset value; and determining the homogeneous coordinates of the vertices of the rendered graphics according to the first-dimensional homogeneous coordinate data, the second-dimensional homogeneous coordinate data, the third-dimensional homogeneous coordinate data, and the fourth-dimensional homogeneous coordinate data.

[0010] In one embodiment of the present disclosure, the physical texture coordinates of the rendered graphic are determined according to the homogeneous coordinates of the vertices of the rendered graphic, the position information of the rendered graphic on the physical map, and the position information of the rendered graphic on the virtual map, including: performing coordinate transformation on the first-dimensional physical map coordinate data and the second-dimensional physical map coordinate data based on the size information of the rendered graphic in the virtual map according to the first-dimensional homogeneous coordinate data and the second-dimensional homogeneous coordinate data to obtain first-dimensional coordinate offset data and second-dimensional coordinate offset data, wherein the size information of the rendered graphic in the virtual map is determined by the serial number identifier of the rendered graphic; taking the first-dimensional virtual map coordinate data and the second-dimensional virtual map coordinate data as reference, performing coordinate transformation on the first-dimensional coordinate offset data and the second-dimensional coordinate offset data to obtain the physical texture coordinates of the rendered graphic.

[0011] In one embodiment of the present disclosure, the number of the rendered graphics is at least one.

[0012] In one embodiment of the present disclosure, the rendering graphic is a square.

[0013] According to another aspect of an embodiment of the present disclosure, a terrain rendering device is provided, comprising: a rendering graphic determination module, used to determine a rendering graphic corresponding to a terrain to be rendered; a coordinate input module, used to input the world coordinates of the vertices of the rendering graphic into a vertex shader; a homogeneous coordinate determination module, used to determine the homogeneous coordinates of the vertices of the rendering graphic through the vertex shader according to the world coordinates of the vertices of the rendering graphic and the position information of the rendering graphic on a physical map; the coordinate input module is also used to input the homogeneous coordinates of the vertices of the rendering graphic into a pixel shader; a physical texture coordinate determination module, used to determine the physical texture coordinates of the rendering graphic through the pixel shader according to the homogeneous coordinates of the vertices of the rendering graphic, the position information of the rendering graphic on the physical map and the position information of the rendering graphic on the virtual map; and a rendering module, used to render the terrain to be rendered based on the physical texture coordinates of the rendering graphic.

[0014] In one embodiment of the present disclosure, the world coordinates of the vertices of the rendered graphic include: first-dimensional world coordinate data, second-dimensional world coordinate data, and third-dimensional world coordinate data, wherein the third-dimensional world coordinate data is determined by a serial number identifier of the rendered graphic.

[0015] In one embodiment of the present disclosure, the device also includes a position information determination module, which is used to: obtain a serial number identifier of the rendered graphic according to the third-dimensional world coordinate data; determine the position information of the rendered graphic on the physical map according to the serial number identifier of the rendered graphic, wherein the position information of the rendered graphic on the physical map is the physical map coordinates of the vertices of the rendered graphic, and the physical map coordinates of the vertices of the rendered graphic include first-dimensional physical map coordinate data and second-dimensional physical map coordinate data; and determine the position information of the rendered graphic on the virtual map according to the serial number identifier of the rendered graphic, wherein the position information of the rendered graphic on the virtual map is the virtual map coordinates of the vertices of the rendered graphic, and the virtual map coordinates of the vertices of the rendered graphic include first-dimensional virtual map coordinate data and second-dimensional virtual map coordinate data.

[0016] In one embodiment of the present disclosure, the homogeneous coordinate determination module is also used to: use the world coordinates of the rendered graphic vertices as a reference, map the physical mapping coordinates of the rendered graphic vertices to the homogeneous space, and obtain the homogeneous coordinates of the rendered graphic vertices, wherein the homogeneous coordinates of the rendered graphic vertices include first-dimensional homogeneous coordinate data, second-dimensional homogeneous coordinate data, third-dimensional homogeneous coordinate data, and fourth-dimensional homogeneous coordinate data.

[0017] In one embodiment of the present disclosure, the homogeneous coordinate determination module is also used to: use the first-dimensional world coordinate data as a reference, based on the first-dimensional coordinate value range of the homogeneous space, perform coordinate transformation on the first-dimensional physical mapping coordinate data to obtain the first-dimensional homogeneous coordinate data; use the second-dimensional world coordinate data as a reference, based on the second-dimensional coordinate value range of the homogeneous space, perform coordinate transformation on the second-dimensional physical mapping coordinate data to obtain the second-dimensional homogeneous coordinate data; based on the third-dimensional coordinate value range of the homogeneous space, perform coordinate transformation on the third-dimensional world coordinate data to obtain the third-dimensional homogeneous coordinate data; set the fourth-dimensional homogeneous coordinate data to a preset value; determine the homogeneous coordinates of the vertices of the rendered graphic according to the first-dimensional homogeneous coordinate data, the second-dimensional homogeneous coordinate data, the third-dimensional homogeneous coordinate data and the fourth-dimensional homogeneous coordinate data.

[0018] In one embodiment of the present disclosure, the physical texture coordinate determination module is also used to: perform coordinate conversion on the first-dimensional physical texture coordinate data and the second-dimensional physical texture coordinate data based on the first-dimensional homogeneous coordinate data and the second-dimensional homogeneous coordinate data and based on the size information of the rendered graphic in the virtual texture to obtain first-dimensional coordinate offset data and second-dimensional coordinate offset data, wherein the size information of the rendered graphic in the virtual texture is determined by the serial number identifier of the rendered graphic; and perform coordinate conversion on the first-dimensional coordinate offset data and the second-dimensional coordinate offset data with reference to the first-dimensional virtual texture coordinate data and the second-dimensional virtual texture coordinate data to obtain the physical texture coordinates of the rendered graphic.

[0019] In one embodiment of the present disclosure, the number of the rendered graphics is at least one.

[0020] In one embodiment of the present disclosure, the rendering graphic is a square.

[0021] According to another aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the above-mentioned terrain rendering method.

[0022] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the above-mentioned terrain rendering method.

[0023] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the above-mentioned terrain rendering method is implemented.

[0024] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: first determine the rendering graphics corresponding to the terrain to be rendered, and then pass the world coordinates of the vertices of the rendering graphics into the vertex shader, so that the vertex shader can use the world coordinates of the vertices of the rendering graphics as a reference to determine the homogeneous coordinates of the vertices of the rendering graphics according to the position information of the rendering graphics on the physical map; then pass the homogeneous coordinates into the pixel shader, and then the pixel shader can calculate the physical texture coordinates of the rendering graphics according to the homogeneous coordinates determined by the vertex shader, combined with the position information of the rendering graphics on the physical map and the position information on the virtual map; finally, the obtained physical texture coordinates can be used to render the terrain to be rendered. On the one hand, there is no need to process all the vertex information, which can reduce the vertex shading pressure in the vertex shader stage; on the other hand, there is no need for frequent rendering page switching and copying operations, which can ensure a stable frame rate and fixed memory.

[0025] 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

[0026] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0027] Figure 1 is a schematic diagram of an exemplary system architecture of a terrain rendering method according to an exemplary embodiment;

[0028] Figure 2 is a flow chart of a terrain rendering method according to an exemplary embodiment;

[0029] Figure 3 is an example diagram of a terrain rendering method in the related art;

[0030] Figure 4 is a top view of a wireframe mode showing the terrain;

[0031] Figure 5 is a schematic diagram of a rendering graphic according to an exemplary embodiment;

[0032] Figure 6 It is a schematic diagram of the relationship between the virtual map, the virtual texture page table and the physical map;

[0033] Figure 7 According to an exemplary embodiment Figure 5 The position information of the rendered graphics shown on the physical map;

[0034] Figure 8 is a coordinate diagram of a physical map according to an exemplary embodiment;

[0035] Fig. 9 is a schematic diagram of a process of determining homogeneous coordinates of vertices of a rendered graphic through a vertex shader according to an exemplary embodiment;

[0036] Fig.10 is a schematic diagram of frame rate comparison results between a terrain rendering method of the related art and a terrain rendering method of an embodiment of the present disclosure;

[0037] Fig.11 is a schematic diagram of memory comparison results between a terrain rendering method of the related art and a terrain rendering method of an embodiment of the present disclosure;

[0038] Fig.12 is a block diagram of a terrain rendering device 1200 according to an exemplary embodiment;

[0039] Fig.13 The figure is a structural block diagram of an electronic device for terrain rendering according to an exemplary embodiment. DETAILED DESCRIPTION

[0040] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0041] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0042] Figure 1 FIG. 1 is a schematic diagram of an exemplary system architecture of a terrain rendering method according to an exemplary embodiment. Figure 1 As shown, the system architecture may include a server 101, a network 102, and a client 103. The network 102 is used to provide a medium for a communication link between the client 103 and the server 101. The network 102 may include various connection types, such as wired, wireless communication links, or optical fiber cables.

[0043] In some optional embodiments, the client 103 for data transmission with the server 101 may include but is not limited to electronic devices of the type of smart phones, desktop computers, tablet computers, laptop computers, smart speakers, digital assistants, AR (Augmented Reality) devices, VR (Virtual Reality) devices, smart wearable devices, etc., or the client 103 may also be a personal computer, such as a laptop computer and a desktop computer, etc. Optionally, the operating system running on the electronic device may include but is not limited to Android system, IOS system, Linux, Windows, etc.

[0044] Server 101 can 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In some practical applications, server 101 can also be a server of a network platform, which can be, for example, a trading platform, a live broadcast platform, a social platform, or a music platform, etc., which is not limited in the embodiments of the present disclosure. Among them, the server can be a single server or a cluster formed by multiple servers, and the present disclosure does not limit the specific architecture of the server.

[0045] In some optional embodiments, the process of client 103 implementing the terrain rendering method may be: client 103 determines the rendering graphic corresponding to the terrain to be rendered, and passes the world coordinates of the vertices of the rendering graphic into the vertex shader; client 103 determines the homogeneous coordinates of the vertices of the rendering graphic through the vertex shader according to the world coordinates of the vertices of the rendering graphic and the position information of the rendering graphic on the physical map; client 103 passes the homogeneous coordinates of the vertices of the rendering graphic into the pixel shader; client 103 determines the physical texture coordinates of the rendering graphic through the pixel shader according to the homogeneous coordinates of the vertices of the rendering graphic, the position information of the rendering graphic on the physical map, and the position information of the rendering graphic on the virtual map; client 103 renders the terrain to be rendered based on the physical texture coordinates of the rendering graphic.

[0046] In addition, it should be noted that Figure 1 What is shown is only one application environment of the terrain rendering method provided by the present disclosure. Figure 1 The numbers of clients, networks and servers in the embodiment are merely illustrative, and any number of clients, networks and servers may be provided according to actual needs.

[0047] Computer Vision Technology (CV) Computer vision is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing so that the computer processing becomes an image that is more suitable for human eye observation or transmission to instrument detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image information annotation, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, etc.

[0048] In order to enable ordinary persons in the art to better understand the technical solution of the present disclosure, each step of the terrain rendering method in the exemplary embodiment of the present disclosure will be described in more detail below with reference to the accompanying drawings and embodiments.

[0049] Figure 2 is a flowchart of a terrain rendering method according to an exemplary embodiment. Figure 2 The execution subject of the method provided in the embodiment may be any electronic device, such as Figure 1 The client 103 in the embodiment, but the present disclosure is not limited thereto.

[0050] like Figure 2 As shown, the terrain rendering method may include the following steps S210 to S250.

[0051] Step S210: determining a rendering graphic corresponding to the terrain to be rendered, and passing the world coordinates of the vertices of the rendering graphic into a vertex shader;

[0052] Step S220: determining homogeneous coordinates of the vertices of the rendered graphic through a vertex shader according to the world coordinates of the vertices of the rendered graphic and the position information of the rendered graphic on the physical map;

[0053] Step S230: passing the homogeneous coordinates of the vertices of the rendered graphics into the pixel shader;

[0054] Step S240: determining the physical texture coordinates of the rendered graphic according to the homogeneous coordinates of the vertices of the rendered graphic, the position information of the rendered graphic on the physical map, and the position information of the rendered graphic on the virtual map through the pixel shader;

[0055] Step S250: Rendering the terrain to be rendered based on the physical texture coordinates of the rendered graphics.

[0056] In the terrain rendering method provided in the embodiment of the present application, the rendering graphics corresponding to the terrain to be rendered are first determined, and then the world coordinates of the vertices of the rendering graphics are passed into the vertex shader, so that the vertex shader can use the world coordinates of the vertices of the rendering graphics as a reference to determine the homogeneous coordinates of the vertices of the rendering graphics according to the position information of the rendering graphics on the physical map; then the homogeneous coordinates are passed into the pixel shader, and then the pixel shader can calculate the physical texture coordinates of the rendering graphics according to the homogeneous coordinates determined by the vertex shader, combined with the position information of the rendering graphics on the physical map and the position information on the virtual map; finally, the obtained physical texture coordinates can be used to render the terrain to be rendered. On the one hand, the present application does not need to process all vertex information, which can reduce the vertex shading pressure in the vertex shader stage; on the other hand, it does not require frequent rendering page switching and copying operations, which can ensure a stable frame rate and fixed memory.

[0057] The specific implementation of each method step of the terrain rendering method is described in detail below.

[0058] In step S210, a rendering graphic corresponding to the terrain to be rendered is determined, and the world coordinates of the vertices of the rendering graphic are passed into a vertex shader.

[0059] In computer graphics, rendering refers to the process of projecting an object model in a three-dimensional scene into a digital image in two dimensions according to the set environment, material, lighting and rendering parameters. In other words, rendering is the process of converting three-dimensional light energy transfer processing into a two-dimensional image.

[0060] The client has an application for 3D scene applications, and a renderer is deployed in the application. The renderer is the core component or system that can realize terrain rendering. By using the renderer, the required terrain rendering function can be quickly realized, and all effects such as models, animations, lighting, and special effects can be calculated in real time, and the rendering effect can be displayed on the client's display screen. For example, the renderer in the game application can include Unreal Engine, Unity Engine, etc.

[0061] Among them, the renderer includes a shader, which is an algorithm program interspersed in the rendering pipeline for realizing terrain rendering. It is responsible for combining the input vertex data with the input map or color in a specified way, and then outputting it. Usually, the GPU reads the corresponding input texture data through the shader, and renders the terrain to be rendered through the GPU's rendering pipeline. Specifically, the shader can include a vertex shader and a pixel shader. The vertex shader is mainly responsible for the calculation and processing of the geometric relationship of the vertices, and the pixel shader is mainly responsible for the calculation and processing of the color of the fragment.

[0062] The terrain to be rendered can be a terrain image to be displayed in a three-dimensional scene. For example, in a game scene, if the camera is rotated, the terrain image to be displayed changes. By displaying image frames corresponding to continuous terrain images, a dynamic terrain scene or terrain scene video can be displayed. Among them, the terrain to be rendered can represent the image frame that currently needs to be rendered in the process of displaying a three-dimensional scene.

[0063] In the related art, terrain rendering can be achieved through RVT provided by Unreal Engine version 4.23. Figure 3 is an example diagram of a terrain rendering method in the related art. Figure 3It can be seen that in the method of terrain rendering provided by Unreal Engine 4.23, the texture is obtained by rendering the actual object above the required position. Since RVT needs to process all vertex information, the vertex shader is overloaded and frequent rendering page switching and copying operations are required, which is not friendly to the renderer.

[0064] Figure 4 is a top view showing the terrain in wireframe mode. Figure 4 It can be seen that the terrain is a uniform mesh on the plane, but in fact the terrain is undulating. In other words, the terrain can be considered as a special mesh that is uniformly distributed in the XY direction, and the undulation of the terrain is achieved by adjusting the value in the Z direction. The rendering of the terrain requires a weight map, and the number of vertices in the weight map is the same as the number of vertices in the terrain. If the terrain is a uniform mesh, then rasterized linear interpolation can be used instead of the individual calculation of each vertex. Therefore, when rendering the terrain, rasterized linear interpolation can be used instead of the actual object being rendered.

[0065] Specifically, in step S210, the rendering graphics corresponding to the terrain to be rendered are first obtained. Among them, the number of rendering graphics is at least one, and the rendering graphics can be a square. In other words, it can be considered that the terrain to be rendered is obtained by at least one rendering graphic. Each rendering graphic representative can draw a map, and the position information of each rendering graphic in the physical map and the position information in the virtual map are determined in the subsequent processing, and then the terrain to be rendered can be rendered using the determined position information. Since the number of rendering graphics is at least one, the rendering graphics can be distinguished by using the unique identifier of the rendering graphics. Specifically, the serial number identifier of the rendering graphics can be used to distinguish different rendering graphics. Figure 5 FIG. 1 is a schematic diagram of a rendering graphic according to an exemplary embodiment. Figure 5 As shown, the rendering graphics corresponding to the terrain to be rendered are 8 squares, each square represents that a texture can be drawn, and the serial numbers of the 8 squares are 0, 1, 2, 3, 4, 5, 6, and 7 respectively.

[0066] The world coordinates of the vertices of the rendered graphics are passed into the vertex shader, and the specific position information of the rendered graphics on the physical map can be determined by the vertex shader later. Among them, the vertex shader is a processing unit used to add various special effects to the three-dimensional scene. The programmable nature of the vertex shader allows developers to adjust various special effects by loading new software instructions. Each vertex can be clearly defined by various data, including at least the x, y, and z coordinates of each vertex. For example, each vertex can include at least one of the data such as color, initial path, material, and light characteristics.

[0067] The coordinate systems in computer graphics are relative to each other. For example, the coordinate system can include the world coordinate system, texture coordinate system, screen coordinate system, etc. World coordinates refer to the coordinates in the world space coordinate system in a three-dimensional scene. Among them, the world coordinates of each vertex in the three-dimensional scene are fixed. Therefore, the coordinates of the vertices of the rendered graphics can be converted with the world coordinates as a reference. The world coordinates of the vertices of the rendered graphics can include: first-dimensional world coordinate data, second-dimensional world coordinate data, and third-dimensional world coordinate data, wherein the third-dimensional world coordinate data is determined by the serial number identifier of the rendered graphics. Figure 5 Taking the rendering graphics shown as an example, for the square with serial number identification 0, the first dimensional world coordinate data and the second dimensional world coordinate data of the vertices of the square are the coordinate data in the XY direction in the time-space coordinate system in the three-dimensional scene, and the third dimensional world coordinate data of the vertices of the square can be the serial number identification 0 of the square.

[0068] In some optional embodiments, the terrain rendering method may further include: obtaining a serial number identifier of the rendered graphic based on third-dimensional world coordinate data; determining position information of the rendered graphic on the physical map based on the serial number identifier of the rendered graphic, wherein the position information of the rendered graphic on the physical map is the physical map coordinates of the vertices of the rendered graphic, and the physical map coordinates of the vertices of the rendered graphic include first-dimensional physical map coordinate data and second-dimensional physical map coordinate data; and determining position information of the rendered graphic on the virtual map based on the serial number identifier of the rendered graphic, wherein the position information of the rendered graphic on the virtual map is the virtual map coordinates of the vertices of the rendered graphic, and the virtual map coordinates of the vertices of the rendered graphic include first-dimensional virtual map coordinate data and second-dimensional virtual map coordinate data.

[0069] Ideally, all objects in a 3D scene use the same texture and the same shader (i.e., a piece of code running on the GPU, to which the engine provides 3D model vertices, textures and other information, and obtains the returned pixel color), so that the entire scene can be obtained through a Draw Call (i.e., the initiator is the CPU and the receiver is the GPU command. When a Draw Call is given, the GPU will calculate according to the rendering state and all the input vertex data, and finally output the pixels displayed on the screen). Therefore, if the entire terrain uses the same texture, it can greatly save performance. However, if a 2KM*2KM terrain uses a texture, then while ensuring accuracy, this texture is about 256*256*256*256 pixels, and even if it is stored in the R8G8B8A8 format, it will reach 64G. It can be seen that this super large texture is impossible to obtain, and it is impossible to display all Mip0 textures when rendering the terrain, so it can be achieved through virtual textures.

[0070] The concept of virtual texture (VT) is similar to virtual memory. It does not load all the data of a large texture into the memory. Instead, it only loads the required part of the large texture into the memory according to the implementation needs of the three-dimensional scene application at runtime. Physical texture (PT) refers to the texture image that actually exists in the memory, that is, the texture map in the actual texture data loaded into the memory, which is the physical texture. Unlike virtual memory, virtual texture will not cause blocking during operation. When the data cannot be read from the hard disk, the corresponding multi-level gradually distant texture in the memory can be used to temporarily replace the display. For example, the map texture can be divided into hierarchical textures of different resolutions, and each can be divided into multiple blocks. When rendering, the closer the blocks are, the higher the resolution will be. Then, through the pre-defined mapping relationship, it is mapped to a physical texture in the memory. When the displayed field of view changes, part of the physical texture will be replaced and part of the physical texture will be loaded.

[0071] The mapping relationship between the virtual texture and the physical texture can be stored in a virtual texture page table. Figure 6 It is a schematic diagram of the relationship between virtual texture, virtual texture page table and physical texture. Figure 6 As shown, the virtual texture can be divided into 10*10 small virtual textures, the size of the physical texture is 6*6 small physical textures, and the size of the virtual texture page table is 10*10 pixels. Each pixel records the position of each small virtual texture in the virtual texture in the physical texture.

[0072] As explained above, the third-dimensional world coordinate data of the rendered graphic is determined by the serial number identifier of the rendered graphic. Therefore, the serial number identifier of the rendered graphic can be obtained through the third-dimensional world coordinate data, that is, the specific rendered graphic currently being processed can be determined. A rendered graphic represents a texture that can be drawn on a physical map, and different rendered graphics can be distinguished by the serial number identifier of the rendered graphic. After obtaining the serial number identifier of the rendered graphic, the position information of the rendered graphic on the physical map can be determined according to the serial number identifier.

[0073] Figure 7 According to an exemplary embodiment Figure 5 The position information of the rendered graphics on the physical map shown. Figure 7 As shown, we can get Figure 5 The position information of the 8 squares shown in the figure on the physical map. The position information of the rendered graphics on the physical map can be represented by the physical map coordinates of the vertices of the rendered graphics.

[0074] Figure 8 is a coordinate diagram of a physical map according to an exemplary embodiment. Figure 8 As shown, the physical map 81 includes 6*6 small physical maps 82. The origin coordinates of the physical map 81 can be the coordinates (0,0) corresponding to the vertex in the upper left corner. The coordinates of the first small physical map 82 in the upper left corner of the physical map 81 can be the vertex coordinates corresponding to the vertex in the upper left corner, that is, also (0,0); the coordinates of the small physical map 82 in the lower left corner are the vertex coordinates (0,5) corresponding to the vertex in the lower left corner; the coordinates of the small physical map 82 in the upper right corner are the vertex coordinates (5,0) corresponding to the vertex in the upper right corner; the coordinates of the small physical map 82 in the lower right corner are the vertex coordinates (5,5) corresponding to the vertex in the lower right corner. Among them, the position information of the rendered graphics on the physical map can be used to obtain which small physical maps the vertices of the rendered graphics are located on, and then the physical map coordinates of the vertices of the rendered graphics can be determined by the coordinates of the small physical maps. In addition, the physical map can be regarded as a two-dimensional coordinate system, so the physical map coordinates of the rendered graphic vertices may include first-dimensional physical map coordinate data and second-dimensional physical map coordinate data.

[0075] After obtaining the serial number identification of the rendering graphic, in addition to determining the position information of the rendering graphic on the physical map according to the serial number identification, the position information of the rendering graphic on the virtual map can also be determined according to the serial number identification. Specifically, after obtaining the position information of the rendering graphic on the physical map, the position information of the rendering graphic on the virtual map can be determined by querying the virtual texture page table.

[0076] In step S220, the homogeneous coordinates of the vertices of the rendering graphic are determined by the vertex shader according to the world coordinates of the vertices of the rendering graphic and the position information of the rendering graphic on the physical map.

[0077] In some optional embodiments, determining the homogeneous coordinates of the vertices of the rendered graphics according to the world coordinates of the vertices of the rendered graphics and the position information of the rendered graphics on the physical map may include: using the world coordinates of the vertices of the rendered graphics as a reference, mapping the physical map coordinates of the vertices of the rendered graphics to a homogeneous space, and obtaining the homogeneous coordinates of the vertices of the rendered graphics. The homogeneous coordinates of the vertices of the rendered graphics include first-dimensional homogeneous coordinate data, second-dimensional homogeneous coordinate data, third-dimensional homogeneous coordinate data, and fourth-dimensional homogeneous coordinate data.

[0078] Homogeneous coordinates represent an n-dimensional vector with an n+1-dimensional vector. For example, the homogeneous coordinates of a two-dimensional point (x, y) are represented as (hx, hy, h). It can be seen that the homogeneous representation of a vector is not unique. Different values ​​of h in homogeneous coordinates represent the same point. For example, the homogeneous coordinates (8, 4, 2) and (4, 2, 1) both represent the two-dimensional point (4, 2). Many graphics applications involve geometric transformations, mainly including translation, rotation, and scaling. When these transformations are calculated using matrix expressions, translation is matrix addition, and rotation and scaling are matrix multiplication. The purpose of introducing homogeneous coordinates is mainly to merge multiplication and addition in matrix operations, that is, it provides an effective method to use matrix operations to transform a point set in two-dimensional, three-dimensional, or even high-dimensional space from one coordinate system to another. Secondly, it can represent points at infinity. If h = 0 in n+1-dimensional homogeneous coordinates, it actually represents a point at infinity in n-dimensional space.

[0079] As explained above, the world coordinates of each vertex in a three-dimensional scene are fixed. Therefore, the physical mapping coordinates of the rendered graphics vertices can be converted with the world coordinates of the rendered graphics vertices as a reference and mapped to the homogeneous space. Since the world coordinate system is a three-dimensional coordinate system, the homogeneous coordinates obtained are four-dimensional coordinates, that is, the homogeneous coordinates of the rendered graphics vertices include first-dimensional homogeneous coordinate data, second-dimensional homogeneous coordinate data, third-dimensional homogeneous coordinate data, and fourth-dimensional homogeneous coordinate data.

[0080] In some optional embodiments, taking the world coordinates of the vertices of the rendered graphics as a reference, mapping the physical mapping coordinates of the vertices of the rendered graphics to the homogeneous space to obtain the homogeneous coordinates of the vertices of the rendered graphics may include: taking the first-dimensional world coordinate data as a reference, based on the first-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the first-dimensional physical mapping coordinate data to obtain the first-dimensional homogeneous coordinate data; taking the second-dimensional world coordinate data as a reference, based on the second-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the second-dimensional physical mapping coordinate data to obtain the second-dimensional homogeneous coordinate data; based on the third-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the third-dimensional world coordinate data to obtain the third-dimensional homogeneous coordinate data; setting the fourth-dimensional homogeneous coordinate data to a preset value; and determining the homogeneous coordinates of the vertices of the rendered graphics according to the first-dimensional homogeneous coordinate data, the second-dimensional homogeneous coordinate data, the third-dimensional homogeneous coordinate data, and the fourth-dimensional homogeneous coordinate data.

[0081] It should be noted that in the disclosed embodiment, the coordinate value ranges of the first dimension, the second dimension, and the third dimension of the homogeneous space are determined by the hardware virtual texture. The coordinate value range of the first dimension is -1 to 1, the coordinate value range of the second dimension is 1 to -1, and the coordinate value range of the third dimension is 1 to 0. Next, the specific process of obtaining the homogeneous coordinate data of each dimension is described.

[0082] (1) In the process of mapping the physical texture coordinates of the rendered graphics vertices to the homogeneous space, the first-dimensional world coordinate data and the first-dimensional physical texture coordinate data can be summed, and then the summation result can be processed using the parameter information of the virtual texture to convert it to a space from 0 to 1 to obtain the converted coordinate data. Then, based on the coordinate value range of the first dimension from -1 to 1, -1 is added to the converted coordinate data to obtain the first-dimensional homogeneous coordinate data. The parameter information of the virtual texture can be determined by the size information of the virtual texture.

[0083] (2) In the process of mapping the physical texture coordinates of the rendered graphics vertices to the homogeneous space, the second-dimensional world coordinate data and the second-dimensional physical texture coordinate data may be summed, and then the summation result may be processed using the parameter information of the virtual texture to convert it to a space from 0 to 1, thereby obtaining the converted coordinate data. Next, based on the coordinate value range of the second dimension from 1 to -1, -1 is added to the converted coordinate data and then multiplied by -1 to obtain the second-dimensional homogeneous coordinate data.

[0084] (3) In the process of mapping the physical texture coordinates of the rendered graphic vertices to the homogeneous space, based on the third-dimensional coordinate value range of the homogeneous space from 1 to 0, the third-dimensional world coordinate data is converted to obtain the third-dimensional homogeneous coordinate data. As described above, the third-dimensional world coordinate data of the rendered graphic vertices is determined by the serial number of the rendered graphic. Figure 5 For example, the serial numbers of 8 squares are 0 to 7. For each square, the serial number of the square is increased by 1 and then the reciprocal is calculated. The obtained data is the third-dimensional homogeneous coordinate data of the vertices of the square.

[0085] (4) In the process of mapping the physical texture coordinates of the rendered graphic vertices to the homogeneous space, the fourth-dimensional homogeneous coordinate data can be directly set to 1.

[0086] Fig. 9 FIG. 1 is a flow chart showing a method of determining homogeneous coordinates of vertices of a rendered graphic by a vertex shader according to an exemplary embodiment. Fig. 9 As shown, the process of determining the homogeneous coordinates of the vertices of the rendered graphics may include:

[0087] Step S901, passing the world coordinates of the vertices of the rendered graphic into the vertex shader, wherein the world coordinates include first-dimensional world coordinate data, second-dimensional world coordinate data and third-dimensional world coordinate data, and the third-dimensional world coordinate data is a serial number identifier of the rendered graphic;

[0088] Step S902, obtaining a serial number identifier of the rendering graphic according to the third-dimensional world coordinate data, and then determining the physical mapping coordinates of the vertices of the rendering graphic according to the serial number identifier of the rendering graphic, wherein the physical mapping coordinates include the first-dimensional physical mapping coordinate data and the second-dimensional physical mapping coordinate data;

[0089] Step S903, summing the first-dimensional world coordinate data and the first-dimensional physical texture coordinate data, and then processing the summation result using the parameter information of the virtual texture to convert it to a space from 0 to 1 to obtain converted coordinate data, and then adding -1 to the converted coordinate data to obtain first-dimensional homogeneous coordinate data;

[0090] Step S904, summing the second-dimensional world coordinate data and the second-dimensional physical texture coordinate data, and then processing the summation result using the parameter information of the virtual texture to convert it to a space from 0 to 1 to obtain converted coordinate data, and then adding -1 to the converted coordinate data and multiplying it by -1 to obtain second-dimensional homogeneous coordinate data;

[0091] Step S905, adding 1 to the serial number of the rendered graphic and then calculating the inverse thereof to obtain homogeneous coordinate data of the third dimension;

[0092] Step S906, setting the fourth dimension homogeneous coordinate data to 1;

[0093] Step S907 , determining the homogeneous coordinates of the vertices of the rendered graphic according to the homogeneous coordinate data of the first dimension, the homogeneous coordinate data of the second dimension, the homogeneous coordinate data of the third dimension, and the homogeneous coordinate data of the fourth dimension.

[0094] It should be noted that the above steps S901 to S907 are a specific process for determining the homogeneous coordinates of a vertex of a rendered graphic. In the embodiment of the present disclosure, the homogeneous coordinates of each vertex of each rendered graphic are determined through the above steps S901 to S907. Figure 5 The rendering graph shown is used as an example to illustrate that the homogeneous coordinates of 32 vertices of 8 squares are determined by the vertex shader. In addition, the execution order of the above steps S903 to S906 can be adjusted according to actual conditions, and the embodiment of the present disclosure does not limit this.

[0095] In step S230, the homogeneous coordinates of the vertices of the rendered graphics are passed into the pixel shader.

[0096] After obtaining the homogeneous coordinates of the vertices of the rendered graphics, the homogeneous coordinates can be passed to the pixel shader, and the subsequent pixel shader performs fragment color processing based on the homogeneous coordinates. The pixel shader is a set of instructions that are executed when the pixel is rendered. At each execution time, many pixels will be rendered. The number of pixels depends on the resolution of the screen.

[0097] In step S240, the physical texture coordinates of the rendering graphic are determined by the pixel shader according to the homogeneous coordinates of the vertices of the rendering graphic, the position information of the rendering graphic on the physical map, and the position information of the rendering graphic on the virtual map.

[0098] As described above, the position information of the rendered graphics on the physical texture is the physical texture coordinates of the vertices of the rendered graphics, and the physical texture coordinates of the vertices of the rendered graphics include the first dimension physical texture coordinate data and the second dimension physical texture coordinate data. Also, the position information of the rendered graphics on the virtual texture is the virtual texture coordinates of the vertices of the rendered graphics, and the virtual texture coordinates of the vertices of the rendered graphics include the first dimension virtual texture coordinate data and the second dimension virtual texture coordinate data.

[0099] In some reference embodiments, determining the physical texture coordinates of the rendered graphics according to the homogeneous coordinates of the vertices of the rendered graphics, the position information of the rendered graphics on the physical map, and the position information of the rendered graphics on the virtual map may include: performing coordinate conversion on the first-dimensional physical map coordinate data and the second-dimensional physical map coordinate data based on the size information of the rendered graphics in the virtual map according to the first-dimensional homogeneous coordinate data and the second-dimensional homogeneous coordinate data, and obtaining the first-dimensional coordinate offset data and the second-dimensional coordinate offset data; using the first-dimensional virtual map coordinate data and the second-dimensional virtual map coordinate data as references, performing coordinate conversion on the first-dimensional coordinate offset data and the second-dimensional coordinate offset data, and obtaining the physical texture coordinates of the rendered graphics. Among them, the size information of the rendered graphics in the virtual map is determined by the serial number identification of the rendered graphics. The pixel shader stage is to color the vertices processed by the vertex shader, and the pixels to be rendered can be converted to the 0 to 1 space of the terrain. Specifically, in the process of determining the physical texture coordinates of the rendered graphics, the serial number identification of the rendered graphics can be determined according to the third-dimensional homogeneous coordinate data of the vertices of the rendered graphics, so that the specific rendered graphics to be processed can be determined. In addition, the physical texture coordinates of the vertices of the rendered graphics and the virtual texture coordinates of the vertices of the rendered graphics can be determined according to the serial number identifier of the rendered graphics. After the physical texture coordinates of the vertices of the rendered graphics are determined, that is, after the coordinates of the first-dimensional physical texture coordinate data and the second-dimensional physical texture coordinate data are determined, the first-dimensional homogeneous coordinate data and the second-dimensional homogeneous coordinate data are used as references, and the parameter information of the virtual texture and the size information of the rendered graphics in the virtual texture are used to process the first-dimensional physical texture coordinate data and the second-dimensional physical texture coordinate data to obtain the first-dimensional coordinate offset data and the second-dimensional coordinate offset data. Finally, the first-dimensional virtual texture coordinate data and the first-dimensional coordinate offset data are summed to obtain the physical texture coordinates in one direction of the rendered graphics; the second-dimensional virtual texture coordinate data and the second-dimensional coordinate offset data are summed to obtain the physical texture coordinates in another direction of the rendered graphics.

[0100] In step S250, the terrain to be rendered is rendered based on the physical texture coordinates of the rendered graphics.

[0101] After obtaining the physical texture coordinates of the rendered graphics, the physical texture coordinates can be used to render the terrain to be rendered. Specifically, through the pixel shader, the texture pixels that match the physical texture coordinates are sampled from the physical map, and the image to be rendered is rendered based on the texture pixels. Among them, texture pixels refer to the texture pixel values ​​in the texture map, for example, they can be texture color values. Sampling refers to the process of extracting individuals or samples from the population. Among them, sampling texture pixels can refer to the sampling coordinates obtained by mapping the vertex coordinates with the texture coordinates, and reading the color value at the sampling coordinates from the physical map. This process is texture sampling. After the client obtains the physical texture coordinates through the pixel shader, the pixel shader samples the texture pixels that match the physical texture coordinates from the physical map. The pixel shader then calculates the final pixel value of each pixel in the image to be rendered based on the sampled texture pixels, thereby rendering the terrain to be rendered.

[0102] Fig.10 It is a schematic diagram of frame rate comparison results between the terrain rendering method of the related art and the terrain rendering method of the embodiment of the present disclosure. Fig.11 : It is a schematic diagram of memory comparison results between the terrain rendering method of the related art and the terrain rendering method of the embodiment of the present disclosure. The clients used are the same and the test time is 2 minutes. In the first 16 seconds, the virtual terrain scene displayed by the client is kept still. At 16 seconds, the camera is rotated crazily. The camera here refers to the virtual camera in the virtual terrain scene. At 1 minute, run in the virtual terrain scene and rotate the camera. The running here can refer to the user character in the virtual terrain scene running crazily. From Fig.10 and Fig.11 It can be seen that, in the static state, there is no difference between the performance of the terrain rendering method of the related art and the performance of the terrain rendering method of the embodiment of the present invention. However, when the lens is rotated wildly, the physical map needs to be updated. Since the way the terrain rendering method of the related art updates the physical map and the way the terrain rendering method of the embodiment of the present invention updates the physical map are different, the performance difference is caused. By comparison, the frame rate is relatively stable and the memory is stable using the terrain rendering method of the embodiment of the present invention. This is because the terrain rendering method of the embodiment of the present invention does not apply for new memory when rendering small maps, so the memory is fixed, but in the terrain rendering method of the related art, since it is necessary to continuously render on small maps when updating the physical map, the memory is constantly changing.

[0103] In the related art, in the method of terrain rendering provided by Unreal Engine 4.23, the texture is obtained by rendering the actual object above the required position. Since RVT needs to process all vertex information, the vertex shader is overloaded and frequent rendering page switching and copying operations are required, which is not friendly to the renderer.

[0104] In the disclosed embodiment, the rendering graphics corresponding to the terrain to be rendered are first determined, and then the world coordinates of the vertices of the rendering graphics are passed into the vertex shader, so that the vertex shader can use the world coordinates of the vertices of the rendering graphics as a reference to determine the homogeneous coordinates of the vertices of the rendering graphics according to the position information of the rendering graphics on the physical map; then the homogeneous coordinates are passed into the pixel shader, and then the pixel shader can calculate the physical texture coordinates of the rendering graphics according to the homogeneous coordinates determined by the vertex shader, combined with the position information of the rendering graphics on the physical map and the position information on the virtual map; finally, the obtained physical texture coordinates can be used to render the terrain to be rendered. On the one hand, there is no need to process all vertex information, which can reduce the vertex shading pressure in the vertex shader stage; on the other hand, there is no need for frequent rendering page switching and copying operations, which can ensure a stable frame rate and fixed memory.

[0105] Fig.12 is a block diagram of a terrain rendering device 1200 according to an exemplary embodiment. The terrain rendering device 1200 can be applied to a client, referring to Fig.12 The device 1200 may include: a rendering graphics determination module 1210, a coordinate input module 1220, a homogeneous coordinate determination module 1230, a physical texture coordinate determination module 1240 and a rendering module 1250.

[0106] The rendering graphic determination module 1210 can be used to determine the rendering graphic corresponding to the terrain to be rendered; the coordinate input module 1220 can be used to input the world coordinates of the vertices of the rendering graphic into the vertex shader; the homogeneous coordinate determination module 1230 can be used to determine the homogeneous coordinates of the vertices of the rendering graphic through the vertex shader according to the world coordinates of the vertices of the rendering graphic and the position information of the rendering graphic on the physical map; the coordinate input module 1220 can also be used to input the homogeneous coordinates of the vertices of the rendering graphic into the pixel shader; the physical texture coordinate determination module 1240 can be used to determine the physical texture coordinates of the rendering graphic through the pixel shader according to the homogeneous coordinates of the vertices of the rendering graphic, the position information of the rendering graphic on the physical map and the position information of the rendering graphic on the virtual map; the rendering module 1250 can be used to render the terrain to be rendered based on the physical texture coordinates of the rendering graphic. Among them, the number of the rendering graphics is at least one; and the rendering graphics can be square.

[0107] The world coordinates of the vertices of the rendered graphics may include: first-dimensional world coordinate data, second-dimensional world coordinate data, and third-dimensional world coordinate data. The third-dimensional world coordinate data is determined by the serial number identification of the rendered graphics.

[0108] In some optional embodiments, the terrain rendering device 1200 may further include a position information determination module 1260. The position information determination module 1260 may be used to: obtain the serial number identification of the rendering graphic according to the third-dimensional world coordinate data; determine the position information of the rendering graphic on the physical map according to the serial number identification of the rendering graphic, wherein the position information of the rendering graphic on the physical map is the physical map coordinates of the vertices of the rendering graphic, and the physical map coordinates of the vertices of the rendering graphic include the first-dimensional physical map coordinate data and the second-dimensional physical map coordinate data; and determine the position information of the rendering graphic on the virtual map according to the serial number identification of the rendering graphic. Wherein, the position information of the rendering graphic on the virtual map is the virtual map coordinates of the vertices of the rendering graphic, and the virtual map coordinates of the vertices of the rendering graphic may include the first-dimensional virtual map coordinate data and the second-dimensional virtual map coordinate data.

[0109] In some optional embodiments, the homogeneous coordinate determination module 1230 can also be used to: use the world coordinates of the rendered graphic vertices as a reference, map the physical mapping coordinates of the rendered graphic vertices to the homogeneous space, and obtain the homogeneous coordinates of the rendered graphic vertices, wherein the homogeneous coordinates of the rendered graphic vertices include first-dimensional homogeneous coordinate data, second-dimensional homogeneous coordinate data, third-dimensional homogeneous coordinate data, and fourth-dimensional homogeneous coordinate data.

[0110] In some optional embodiments, the homogeneous coordinate determination module 1230 can also be used to: use the first-dimensional world coordinate data as a reference, based on the first-dimensional coordinate value range of the homogeneous space, perform coordinate transformation on the first-dimensional physical mapping coordinate data to obtain first-dimensional homogeneous coordinate data; use the second-dimensional world coordinate data as a reference, based on the second-dimensional coordinate value range of the homogeneous space, perform coordinate transformation on the second-dimensional physical mapping coordinate data to obtain second-dimensional homogeneous coordinate data; based on the third-dimensional coordinate value range of the homogeneous space, perform coordinate transformation on the third-dimensional world coordinate data to obtain third-dimensional homogeneous coordinate data; set the fourth-dimensional homogeneous coordinate data to a preset value; determine the homogeneous coordinates of the vertices of the rendered graphics based on the first-dimensional homogeneous coordinate data, the second-dimensional homogeneous coordinate data, the third-dimensional homogeneous coordinate data and the fourth-dimensional homogeneous coordinate data.

[0111] In some optional embodiments, the physical texture coordinate determination module 1240 may also be used to: perform coordinate conversion on the first-dimensional physical texture coordinate data and the second-dimensional physical texture coordinate data based on the size information of the rendered graphic in the virtual texture according to the first-dimensional homogeneous coordinate data and the second-dimensional homogeneous coordinate data, to obtain the first-dimensional coordinate offset data and the second-dimensional coordinate offset data; perform coordinate conversion on the first-dimensional coordinate offset data and the second-dimensional coordinate offset data with reference to the first-dimensional virtual texture coordinate data and the second-dimensional virtual texture coordinate data, to obtain the physical texture coordinates of the rendered graphic. The size information of the rendered graphic in the virtual texture is determined by the serial number identifier of the rendered graphic.

[0112] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0113] Fig.13 is a structural block diagram of an electronic device for terrain rendering according to an exemplary embodiment. Fig.13 1300 according to this embodiment of the present disclosure is described. Fig.13 The electronic device 1300 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0114] like Fig.13 As shown, the electronic device 1300 is in the form of a general computing device. The components of the electronic device 1300 may include, but are not limited to: at least one processing unit 1310, at least one storage unit 1320, a bus 1330 connecting different system components (including the storage unit 1320 and the processing unit 1310), and a display unit 1340.

[0115] The storage unit stores program codes, which can be executed by the processing unit 1310, so that the processing unit 1310 performs the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 1310 can perform the following steps: Figure 2 As another example, the electronic device can implement the method shown in Figure 2 The steps shown.

[0116] The storage unit 1320 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1321 and / or a cache memory unit 1322 , and may further include a read-only memory unit (ROM) 1323 .

[0117] The storage unit 1320 may also include a program / utility 1324 having a set (at least one) of program modules 1325, such program modules 1325 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.

[0118] Bus 1330 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.

[0119] The electronic device 1300 may also communicate with at least one external device 1370 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1300, and / or communicate with any device that enables the electronic device 1300 to communicate with at least one other computing device (e.g., a router, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 1350. Furthermore, the electronic device 1300 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 1360. As shown, the network adapter 1360 communicates with other modules of the electronic device 1300 via a bus 1330. 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 1300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0120] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment 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, and includes 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 embodiment of the present disclosure.

[0121] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of the device to complete the above method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0122] In an exemplary embodiment, a computer program product is also provided, including a computer program and / or instructions, and when the computer program and / or instructions are executed by a processor, the terrain rendering method in the above embodiment is implemented.

[0123] 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 techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0124] 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: Determine the rendering graphics corresponding to the terrain to be rendered, and pass the world coordinates of the vertices of the rendering graphics into the vertex shader; Determine, by the vertex shader, the homogeneous coordinates of the vertices of the rendered graphic according to the world coordinates of the vertices of the rendered graphic and the position information of the rendered graphic on the physical map; Passing homogeneous coordinates of the vertices of the rendered graphic into a pixel shader; Determining the physical texture coordinates of the rendered graphic according to the homogeneous coordinates of the vertices of the rendered graphic, the position information of the rendered graphic on the physical map, and the position information of the rendered graphic on the virtual map by the pixel shader; Rendering the terrain to be rendered based on the physical texture coordinates of the rendering graphics; Wherein, the position information of the rendered graphics on the physical texture is the physical texture coordinates of the vertices of the rendered graphics, and the physical texture coordinates of the vertices of the rendered graphics include first-dimensional physical texture coordinate data and second-dimensional physical texture coordinate data; the position information of the rendered graphics on the virtual texture is the virtual texture coordinates of the vertices of the rendered graphics, and the virtual texture coordinates of the vertices of the rendered graphics include first-dimensional virtual texture coordinate data and second-dimensional virtual texture coordinate data; The step of determining the physical texture coordinates of the rendered graphic according to the homogeneous coordinates of the vertices of the rendered graphic, the position information of the rendered graphic on the physical map, and the position information of the rendered graphic on the virtual map comprises: According to the first-dimensional homogeneous coordinate data and the second-dimensional homogeneous coordinate data, based on the size information of the rendered graphic in the virtual map, coordinate conversion is performed on the first-dimensional physical map coordinate data and the second-dimensional physical map coordinate data to obtain first-dimensional coordinate offset data and second-dimensional coordinate offset data; the size information of the rendered graphic in the virtual map is determined by the serial number identifier of the rendered graphic; The first-dimensional virtual texture coordinate data and the second-dimensional virtual texture coordinate data are used as references to perform coordinate transformation on the first-dimensional coordinate offset data and the second-dimensional coordinate offset data to obtain physical texture coordinates of the rendered graphics.

2. The method according to claim 1, characterized in that The world coordinates of the vertices of the rendered graphic include: first-dimensional world coordinate data, second-dimensional world coordinate data and third-dimensional world coordinate data, wherein the third-dimensional world coordinate data is determined by the serial number identification of the rendered graphic.

3. The method according to claim 2, characterized in that The method further comprises: According to the third-dimensional world coordinate data, obtaining a serial number identifier of the rendered graphic; Determining position information of the rendered graphic on the physical map according to the serial number identifier of the rendered graphic; and According to the serial number identifier of the rendering graphic, the position information of the rendering graphic on the virtual map is determined.

4. The method according to claim 3, characterized in that Determining homogeneous coordinates of the vertices of the rendered graphics according to the world coordinates of the vertices of the rendered graphics and the position information of the rendered graphics on the physical map includes: Using the world coordinates of the rendered graphic vertices as a reference, the physical mapping coordinates of the rendered graphic vertices are mapped to a homogeneous space to obtain the homogeneous coordinates of the rendered graphic vertices, wherein the homogeneous coordinates of the rendered graphic vertices include first-dimensional homogeneous coordinate data, second-dimensional homogeneous coordinate data, third-dimensional homogeneous coordinate data, and fourth-dimensional homogeneous coordinate data.

5. The method according to claim 4, characterized in that The method of mapping the physical mapping coordinates of the vertices of the rendered graphics to a homogeneous space using the world coordinates of the vertices of the rendered graphics as a reference to obtain the homogeneous coordinates of the vertices of the rendered graphics includes: Taking the first-dimensional world coordinate data as a reference and based on the first-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the first-dimensional physical mapping coordinate data to obtain the first-dimensional homogeneous coordinate data; Taking the second-dimensional world coordinate data as a reference and based on the second-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the second-dimensional physical mapping coordinate data to obtain the second-dimensional homogeneous coordinate data; Based on the third-dimensional coordinate value range of the homogeneous space, coordinate conversion is performed on the third-dimensional world coordinate data to obtain the third-dimensional homogeneous coordinate data; Setting the fourth-dimensional homogeneous coordinate data to a preset value; The homogeneous coordinates of the vertices of the rendered graphic are determined according to the first-dimensional homogeneous coordinate data, the second-dimensional homogeneous coordinate data, the third-dimensional homogeneous coordinate data, and the fourth-dimensional homogeneous coordinate data.

6. The method according to any one of claims 1 to 5, characterized in that: The number of the rendered graphics is at least one.

7. The method according to any one of claims 1 to 5, characterized in that: The rendering graphic is a square.

8. A terrain rendering device, characterized in that: include: A rendering graphic determination module, used to determine the rendering graphic corresponding to the terrain to be rendered; The coordinate input module is used to input the world coordinates of the rendered graphics vertices into the vertex shader; A homogeneous coordinate determination module, used to determine the homogeneous coordinates of the vertices of the rendering graphic according to the world coordinates of the vertices of the rendering graphic and the position information of the rendering graphic on the physical map through the vertex shader; The coordinate input module is further used to input the homogeneous coordinates of the vertices of the rendered graphics into the pixel shader; A physical texture coordinate determination module, used to determine the physical texture coordinates of the rendering graphic according to the homogeneous coordinates of the vertices of the rendering graphic, the position information of the rendering graphic on the physical map, and the position information of the rendering graphic on the virtual map through the pixel shader; A rendering module, used for rendering the terrain to be rendered based on the physical texture coordinates of the rendering graphics; Wherein, the position information of the rendered graphics on the physical texture is the physical texture coordinates of the vertices of the rendered graphics, and the physical texture coordinates of the vertices of the rendered graphics include first-dimensional physical texture coordinate data and second-dimensional physical texture coordinate data; the position information of the rendered graphics on the virtual texture is the virtual texture coordinates of the vertices of the rendered graphics, and the virtual texture coordinates of the vertices of the rendered graphics include first-dimensional virtual texture coordinate data and second-dimensional virtual texture coordinate data; The physical texture coordinate determination module is also used for: According to the first-dimensional homogeneous coordinate data and the second-dimensional homogeneous coordinate data, based on the size information of the rendered graphic in the virtual map, coordinate conversion is performed on the first-dimensional physical map coordinate data and the second-dimensional physical map coordinate data to obtain first-dimensional coordinate offset data and second-dimensional coordinate offset data; the size information of the rendered graphic in the virtual map is determined by the serial number identifier of the rendered graphic; The first-dimensional virtual texture coordinate data and the second-dimensional virtual texture coordinate data are used as references to perform coordinate transformation on the first-dimensional coordinate offset data and the second-dimensional coordinate offset data to obtain physical texture coordinates of the rendered graphics.

9. The device according to claim 8, characterized in that The world coordinates of the vertices of the rendered graphic include: first-dimensional world coordinate data, second-dimensional world coordinate data and third-dimensional world coordinate data, wherein the third-dimensional world coordinate data is determined by the serial number identification of the rendered graphic.

10. The device according to claim 9, characterized in that The device also includes a location information determination module, which is used to: According to the third-dimensional world coordinate data, obtaining a serial number identifier of the rendered graphic; Determining position information of the rendered graphic on the physical map according to the serial number identifier of the rendered graphic; as well as According to the serial number identifier of the rendering graphic, the position information of the rendering graphic on the virtual map is determined.

11. The device according to claim 10, characterized in that The homogeneous coordinate determination module is also used for: Using the world coordinates of the rendered graphic vertices as a reference, the physical mapping coordinates of the rendered graphic vertices are mapped to a homogeneous space to obtain the homogeneous coordinates of the rendered graphic vertices, wherein the homogeneous coordinates of the rendered graphic vertices include first-dimensional homogeneous coordinate data, second-dimensional homogeneous coordinate data, third-dimensional homogeneous coordinate data, and fourth-dimensional homogeneous coordinate data.

12. The device according to claim 11, characterized in that The homogeneous coordinate determination module is also used for: Taking the first-dimensional world coordinate data as a reference and based on the first-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the first-dimensional physical mapping coordinate data to obtain the first-dimensional homogeneous coordinate data; Taking the second-dimensional world coordinate data as a reference and based on the second-dimensional coordinate value range of the homogeneous space, performing coordinate transformation on the second-dimensional physical mapping coordinate data to obtain the second-dimensional homogeneous coordinate data; Based on the third-dimensional coordinate value range of the homogeneous space, coordinate conversion is performed on the third-dimensional world coordinate data to obtain the third-dimensional homogeneous coordinate data; Setting the fourth-dimensional homogeneous coordinate data to a preset value; The homogeneous coordinates of the vertices of the rendered graphic are determined according to the first-dimensional homogeneous coordinate data, the second-dimensional homogeneous coordinate data, the third-dimensional homogeneous coordinate data, and the fourth-dimensional homogeneous coordinate data.

13. The device according to any one of claims 8 to 12, characterized in that: The number of the rendered graphics is at least one.

14. The device according to any one of claims 8 to 12, characterized in that: The rendering graphic is a square.

15. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the terrain rendering method as described in any one of claims 1 to 7. 16 . A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the terrain rendering method according to any one of claims 1 to 7.

17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the terrain rendering method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Image rendering method and device, computer equipment and storage medium

    CN112884875A

  • Computer graphics rendering apparatus and method

    US20090102851A1