Building group rendering method and apparatus, computer device, and storage medium
By generating physical texture maps and optimizing video memory footprints with virtual texture maps, the problems of central processor overload and video memory footprints caused by the increase in the number of materials in traditional methods are solved, and efficient building complex rendering is achieved.
Patent Information
- Application Number
- PCT/CN2024/105191
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-08
- Filing Date
- 2024-07-12
- Publication Date
- 2025-03-13
AI Technical Summary
The traditional building complex rendering method causes the central processor to be overloaded due to the increase in the number of materials, and the increase in the number of maps occupies a large amount of video memory, affecting the normal operation of computer equipment.
By obtaining the building complex model and rendering material parameters, a physical texture map is generated, and virtual texture maps are used to optimize the video memory usage of the physical texture map, reducing the number of calls to the drawing interface and avoiding overloading of the central processor.
Effectively reduce video memory usage, avoid overloading of the central processor, ensure the normal operation of computer equipment, and improve rendering performance.
Smart Images

Figure CN2024105191_13032025_PF_FP_ABST
Abstract
Description
Building complex rendering method, device, computer equipment and storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2023111535127, filed on September 8, 2023, entitled “Architectural Complex Rendering Method, Apparatus, Computer Equipment and Storage Medium,” the entire text of which is incorporated herein by reference. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for rendering a building complex. Background Art
[0004] With the development of computer technology, image rendering processing technology has also developed rapidly. Computer devices can perform image rendering by calling a drawing interface. In the process of calling a drawing interface, the central processing unit of the computer device calls the underlying graphics drawing interface to instruct the graphics processor to perform rendering operations.
[0005] Traditionally, when rendering a building complex, the buildings within the complex are first modeled, resulting in multiple building models. These models are then rendered separately using their respective materials. Each building model has multiple faces. To achieve distinct visual effects on different faces of the complex, different materials are typically assigned to each face. By applying different textures to these different materials, the resulting faces can produce distinct visual effects.
[0006] However, traditional methods use multiple materials when rendering building complexes. Because computers cannot combine models with different materials and call the drawing interface, a single rendered image can only be rendered multiple times. As the number of materials increases, the number of drawing interface calls also increases, easily leading to CPU overload. Furthermore, an increase in the number of materials also means an increase in the number of textures, which consumes a large amount of video memory and affects the normal operation of the computer.
[0007] Summary of the Invention
[0008] The present application provides a building complex rendering method, apparatus, computer equipment, computer-readable storage medium, and computer program product.
[0009] In a first aspect, the present application provides a method for rendering a building complex, which is executed by a computer device, and the method includes:
[0010] Acquire a building complex model, the building complex model indicating rendering material parameters for rendering the building complex, the rendering material parameters including texture data, the texture data including mapping information of a plurality of building texture maps of the building complex model, the building complex model including at least one target building block model to be rendered;
[0011] Based on the mapping information in the texture data, the plurality of building texture maps are spliced together to generate a physical texture map of the building complex model;
[0012] For each target pixel point for texture sampling in the at least one target building block model, determining a physical texture coordinate corresponding to the target pixel point in the physical texture map, and determining a virtual texture coordinate corresponding to the target pixel point in a preset virtual texture map based on the physical texture coordinates;
[0013] Determining a virtual texture block in the virtual texture map where the virtual texture coordinates are located, and determining a portion of the physical texture map in the physical texture map corresponding to the virtual texture block based on a mapping relationship between the virtual texture map and the physical texture map;
[0014] Filling the virtual texture map with a portion of the physical texture map corresponding to the target pixel, and sampling, from the virtual texture map, texture pixels that match the virtual texture coordinates corresponding to the target pixel; and
[0015] The at least one target building block model is rendered using texture pixels that match the virtual texture coordinates corresponding to each target pixel point.
[0016] In a second aspect, the present application further provides a building complex rendering device, the device comprising:
[0017] a model acquisition module, configured to acquire a building complex model, wherein the building complex model indicates rendering material parameters for rendering the building complex, the rendering material parameters including texture data, the texture data including mapping information of a plurality of building texture maps of the building complex model, and the building complex model including at least one target building block model to be rendered;
[0018] a texture generation module, configured to splice the plurality of building texture maps based on the texture information in the texture data to generate a physical texture map of the building complex model;
[0019] a coordinate conversion module, configured to determine, for each target pixel point for texture sampling in the at least one target building block model, a physical texture coordinate corresponding to the target pixel point in the physical texture map, and determine, based on the physical texture coordinates, a virtual texture coordinate corresponding to the target pixel point in a preset virtual texture map;
[0020] a texture sampling module, configured to determine a virtual texture block in the virtual texture map where the virtual texture coordinates are located, and determine a portion of the physical texture map in the physical texture map corresponding to the virtual texture block based on a mapping relationship between the virtual texture map and the physical texture map, fill the virtual texture map with a portion of the physical texture map corresponding to the target pixel, and sample, from the virtual texture map, texture pixels that match the virtual texture coordinates corresponding to the target pixel; and
[0021] The rendering module is configured to render the at least one target building block model by using texture pixels that match the virtual texture coordinates corresponding to each target pixel point.
[0022] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the building complex rendering method when executing the computer program.
[0023] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the building complex rendering method.
[0024] In a fifth aspect, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the building complex rendering method.
[0025] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0027] FIG1 is a diagram illustrating an application environment of a building complex rendering method according to an embodiment;
[0028] FIG2 is a schematic diagram of a flow chart of a method for rendering a building complex in one embodiment;
[0029] FIG3 is a schematic diagram of a configuration interface for importing configurations in one embodiment;
[0030] FIG4 is a schematic diagram of a physical texture map according to an embodiment;
[0031] FIG5 is a schematic diagram of a physical texture map according to another embodiment;
[0032] FIG6 is a schematic diagram of rendering an image in one embodiment;
[0033] FIG7 is a schematic diagram of determining physical texture coordinates in one embodiment;
[0034] FIG8 is a schematic diagram of obtaining a portion of a physical texture map corresponding to a target pixel in one embodiment;
[0035] FIG9 is a schematic diagram of a loading process in one embodiment;
[0036] FIG10 is a schematic diagram of a flow chart of a rendering process in one embodiment;
[0037] FIG11 is a diagram showing the effect of using a traditional solution in one embodiment;
[0038] FIG12 is a diagram showing the effect of using the solution of the present application in one embodiment;
[0039] FIG13 is a diagram showing the effect of using a traditional solution in another embodiment;
[0040] FIG14 is a diagram showing the effect of using the solution of the present application in another embodiment;
[0041] FIG15 is a structural block diagram of a building group rendering device according to an embodiment;
[0042] FIG16 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0044] The present application relates to computer vision technology (Computer Vision, CV). Computer vision is a science that studies how to make machines "see". More specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further performing graphic processing so that the computer processing becomes an image that is more suitable for human eye observation or transmission to instruments for 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 multidimensional data. Computer vision technology generally includes image processing, image recognition, image semantic understanding, image retrieval, 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, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition. It can be understood that the building complex rendering method in the present application is based on computer vision technology to render the building complex model.
[0045] The building complex rendering method provided in the embodiments of the present application can be applied in the application environment shown in FIG1 . In this embodiment, terminal 102 communicates with server 104 via a network. A data storage system can store data that server 104 needs to process. The data storage system can be integrated with server 104 or placed in the cloud or on another server. The terminal 102 can obtain a building complex model from the server 104. The building complex model indicates rendering material parameters for rendering the building complex. The rendering material parameters include texture data. The texture data includes mapping information of multiple building texture maps of the building complex model. The building complex model includes at least one target building block model to be rendered. Based on the mapping information in the texture data, the multiple building texture maps are spliced to generate a physical texture map of the building complex model. The physical texture map is formed by splicing multiple building texture maps. For each target pixel point for texture sampling in the at least one target building block model, the physical texture coordinates corresponding to the target pixel point in the physical texture map are determined. Based on the physical texture coordinates, the virtual texture coordinates corresponding to the target pixel point in a preset virtual texture map are determined. Based on the virtual texture coordinates, a portion of the physical texture map corresponding to the target pixel point is filled into the virtual texture map. Texture pixels that match the virtual texture coordinates corresponding to the target pixel point are sampled from the virtual texture map. The at least one target building block model is rendered using the texture pixels that match the virtual texture coordinates corresponding to each target pixel point. Terminal 102 may include, but is not limited to, various desktop computers, laptops, smartphones, tablet computers, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, and smart car devices. Portable wearable devices may include smart watches, smart bracelets, and head-mounted devices. Server 104 may be implemented as a standalone server or a server cluster consisting of multiple servers.
[0046] In one embodiment, as shown in FIG2 , a method for rendering a building complex is provided. The method can be executed by a terminal or a server alone, or by a terminal and a server in collaboration. In the embodiment of the present application, the method is described using the terminal as an example, and includes the following steps:
[0047] Step 202: Acquire a building complex model. The building complex model indicates rendering material parameters for rendering the building complex. The rendering material parameters include texture data. The texture data includes mapping information of multiple building texture maps of the building complex model. The building complex model includes at least one target building block model to be rendered.
[0048] Among them, the building complex refers to a cluster of multiple buildings, which is the result that needs to be rendered. The building complex model refers to a model established for the building complex, which is used to render the building complex. For example, the building complex model can specifically refer to a three-dimensional model established for the building complex. The building complex model includes multiple building block models obtained by splitting, and each building block model includes at least one building model. The building model can be composed of multiple facet meshes, and the position where two adjacent facet meshes intersect is the vertex of the building model. Each vertex of the building model has a corresponding vertex attribute, which is used to describe the vertex. For example, the vertex attribute can specifically include the corresponding texture coordinates of the vertex in the corresponding building texture map, the position information of the vertex in the world coordinate system, etc. The rendering material parameters indicated by the building complex model can be included in the building complex model, or the building complex model can record the location where the rendering material parameters are stored, such as the folder path.
[0049] The rendering material parameters refer to the materials used to render the building complex model. In this embodiment, the rendering material parameters include texture data, which includes mapping information for multiple building texture maps of the building complex model. In some embodiments, the texture data can be a texture array, which can package multiple building texture maps into a single array and be used during rendering.
[0050] Among them, the architectural texture map is a flat image covered on the surface of the building model, storing the graphic features of the building model surface. It is understandable that the architectural texture map can actually be a two-dimensional array, and the elements in the two-dimensional array are some color values. When the architectural texture map is mapped onto the surface of the building model in a specific way, the building model can appear more realistic, that is, the architectural texture map can be used to reflect the content included in the building model to be rendered. The architectural texture map of each building model can be pre-drawn according to the actual application scenario. Mapping information refers to the information used to obtain the architectural texture map. For example, the mapping information can specifically refer to the reference path used to obtain the architectural texture map. Through this reference path, the file handle of the architectural texture map can be obtained, and then any operation on the architectural texture map can be performed through the file handle.
[0051] Among them, the at least one target building block model to be rendered refers to the target building block model that needs to be displayed on the terminal. It can be understood that by splitting the building complex model, the building complex model can be split into multiple building block models. Each time it is displayed on the terminal, only the target building block model needs to be displayed among the multiple building block models. By displaying only at least one target building block model, the culling function of the rendering engine can be fully utilized, which can improve the rendering performance. The target building block model is at least a part of the building block model that needs to be rendered in the building complex model determined based on the current observation perspective. Not rendering the other building block models will not affect the final rendered building complex.
[0052] Specifically, when rendering a building complex, the terminal obtains a building complex model. The building complex model indicates rendering material parameters used to render the building complex. The rendering material parameters include texture data, and the texture data includes mapping information of multiple building texture maps of the building complex model. In a specific application, the building complex model includes multiple building block models obtained by splitting. The multiple building block models can be obtained by splitting multiple building models included in the initial model of the building complex.
[0053] In a specific application, the initial model of the building complex and multiple building texture maps are drawn by the drawing object using computer graphics software (such as Houdini). After the drawing is completed, the engine editor can obtain the initial model of the building complex including multiple building models and multiple building texture maps output from the computer graphics software, convert the initial model of the building complex including multiple building models and multiple building texture maps into a format usable by the rendering engine, and generate rendering material parameters. The terminal obtains the rendering material parameters generated by the engine editor. The format usable by the rendering engine here can be configured according to the actual application scenario.
[0054] In a specific application, the engine editor can use a pre-configured building complex import tool to convert the initial model of a building complex, including multiple building models, and multiple building texture maps into a format usable by the rendering engine, generating rendering material parameters. During import, the engine editor will first merge the multiple building texture maps into texture data, add the index of the corresponding building texture map in the texture data to the vertices of the multiple building models, and then generate rendering material parameters based on the texture data for easy use by the rendering engine.
[0055] In a specific application, when using the building complex import tool to combine multiple building texture maps into texture data and generate rendering material parameters based on the texture data, the model import configuration is required in the engine editor. The configuration interface can be shown in Figure 3. During configuration, you need to select the creation of a combined material and a unified building texture map texture size (SQUARE_1024 as shown in Figure 3). Then, select a material from the existing base materials (a preset shader is selected as shown in Figure 3) for import. Based on the imported base materials, the rendering material parameters can be generated based on the imported base materials and the generated texture data. Clicking the "Confirm" control completes the rendering material parameter generation. The existing base materials can be configured according to the actual application scenario. By selecting a unified building texture map texture size, the texture sizes of multiple building texture maps can be unified, so that the texture sizes of multiple building texture maps in the texture data are the same.
[0056] In a specific application, adding the index of the corresponding building texture map in the texture data to the vertices of multiple building models means adding the index of the corresponding building texture map in the texture data to the texture coordinates corresponding to the vertex in the corresponding building texture map during import. For example, before generating the texture data, the texture coordinates can be in the form of [U1, V1], where U1 and V1 are the texture coordinates corresponding to the vertex in the corresponding building texture map. After generating the texture data, the texture coordinates can be in the form of [U1, V1, index 1], where index 1 is the index of the building texture map corresponding to the vertex in the texture data. The building texture map corresponding to the vertex can be the building texture map used to render the vertex.
[0057] Among them, texture coordinates refer to UV coordinates, which are used to indicate where to sample from the building texture map, that is, to collect pixel colors. U refers to the horizontal direction and V refers to the vertical direction. The texture coordinates can be understood as percentage coordinates on the building texture map. The range of texture coordinates can be from 0 to 1, or more than 1. When the range of texture coordinates exceeds 1, the part of the texture coordinates that exceeds 1 indicates reuse. For example, if the coordinates of two adjacent points are (0, 0) and (0, 1.5), it means that the building texture map will be reused in the V direction. It should be noted that the basic geometric figure for rendering is a triangle, and two adjacent points refer to any two vertices in any triangle.
[0058] Step 204 : Based on the mapping information in the texture data, multiple building texture maps are spliced together to generate a physical texture map of the building complex model.
[0059] When determining that there is at least one target building block model to be rendered in the building complex model, the computer device splices multiple building texture maps based on the mapping information in the texture data to generate a physical texture map of the building complex model.
[0060] By stitching together multiple architectural texture maps according to preconfigured stitching parameters, a physical texture map can be generated. A physical texture map can be obtained by stitching together real texture maps. The stitching parameters can be configured according to the actual application scenario, and specifically may include the number of stitched images in the first direction and the number of stitched images in the second direction. By stitching together multiple architectural texture maps according to different numbers of stitched images in the first direction and the second direction, different physical texture maps can be generated. For example, assuming there are 12 architectural texture maps, and the number of stitched images in the first direction (assuming horizontal) is 2, and the number of stitched images in the second direction (assuming vertical) is 6, the generated physical texture map may be in the form shown in FIG4 . For another example, assuming there are 12 architectural texture maps, and the number of stitched images in the first direction (assuming horizontal) is 3, and the number of stitched images in the second direction (assuming vertical) is 4, the generated physical texture map may be in the form shown in FIG5 .
[0061] It should be noted that the physical texture map includes stitched images of at least one texture level, and for each of the at least one texture level, the stitched image of the texture level is obtained by stitching texture images of the texture level of multiple architectural texture maps. Texture level can also be called mip level, that is, the physical texture map includes stitched images of at least one mip level. In the case where at least one mip level is multiple mip levels, in the physical texture map, as the mip level decreases, the resolution of the stitched images of the multiple mip levels decreases mip level by mip level. For example, assuming that the multiple mip levels are mip0 and mip1, the size of the stitched image of the mip0 level can be 64*64 pixels, and the size of the stitched image of the mip1 level can be 32*32 pixels, and the resolution of the stitched image of the mip0 level is greater than the resolution of the stitched image of the mip1 level.
[0062] Specifically, the building complex model includes multiple building block models obtained by splitting. The terminal will determine whether there is at least one target building block model to be rendered from the multiple building block models based on the camera position of the preconfigured virtual camera. When it is determined that there is at least one target building block model to be rendered, the terminal obtains and saves the file handles of the multiple building texture maps based on the mapping information of the multiple building texture maps of the building complex model in the texture data. The file handles of the multiple building texture maps are used to generate a physical texture map of the building complex model. In a specific application, after obtaining and saving the file handles of the multiple building texture maps, the terminal can use the file handles of the multiple building texture maps to read the multiple building texture maps, splice the read multiple building texture maps, and generate a physical texture map of the building complex model.
[0063] Step 206 , for each target pixel point used for texture sampling in at least one target building block model, determine the physical texture coordinates corresponding to the target pixel point in the physical texture map, and determine the virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map based on the physical texture coordinates.
[0064] The target pixel refers to the pixel used for texture sampling when rendering the target building block model. The physical texture coordinate refers to the texture coordinate corresponding to the target pixel in the physical texture map. The virtual texture map is a pre-stored data container used to populate the physical texture map. The concept of a virtual texture map is similar to virtual memory. Used in graphics rendering, it can split large and complex textures into smaller tiles, loading and rendering them only when needed. Using virtual texture maps can reduce memory usage and rendering time while improving graphics quality and flexibility. The virtual texture coordinate refers to the texture coordinate corresponding to the target pixel in the virtual texture map.
[0065] Specifically, when generating a physical texture map, for each target pixel in at least one target building block, the terminal will reposition the map texture coordinates corresponding to the target pixel in the corresponding building texture map, map the map texture coordinates to the physical texture map, and obtain the physical texture coordinates corresponding to the target pixel in the physical texture map. When determining the physical texture coordinates, the terminal will determine the target texture level corresponding to the target pixel, and based on the target texture level, perform coordinate conversion on the physical texture coordinates to obtain the virtual texture coordinates corresponding to the target pixel in the preset virtual texture map. Among them, the building texture map corresponding to the target pixel refers to the texture map used to render the target building block including the target pixel. The building texture map corresponding to the target pixel can be the building texture map used to render the target pixel.
[0066] In a specific application, the target texture level corresponding to the target pixel point refers to the texture level to which a portion of the physical texture map in the virtual texture map belongs that needs to be obtained and filled before sampling the texture pixel that matches the virtual texture coordinates corresponding to the target pixel point, that is, the texture level to which a portion of the physical texture map corresponding to the target pixel point belongs. It should be noted that the physical texture map includes a spliced image of at least one texture level, and it is necessary to obtain and fill in the spliced image of a portion of the physical texture map in the virtual texture map belonging to the target texture level, that is, the terminal obtains a portion of the physical texture map corresponding to the target pixel point from the spliced image of the target texture level for filling.
[0067] In a specific application, the target texture level corresponding to a target pixel point can also be understood as the target texture level corresponding to the target building block model to which the target pixel point belongs, and can be determined based on the distance between the target building block model to which the target pixel point belongs and a preconfigured virtual camera. Specifically, the closer the target building block model to which the target pixel point belongs is to the preconfigured virtual camera, the higher the corresponding target texture level; the farther the target building block model to which the target pixel point belongs is from the preconfigured virtual camera, the lower the corresponding target texture level.
[0068] In a specific application, a preconfigured mapping relationship between the distance between the target building block model and a preconfigured virtual camera and the texture level can be preconfigured. Different distances correspond to different texture levels. Based on the distance between the target building block model and the preconfigured virtual camera, the target texture level corresponding to the target pixel can be determined based on this distance. The preconfigured mapping relationship can be configured according to the actual application scenario. For example, the preconfigured mapping relationship may be: if the distance is within X1 meters, the texture level is 0; if the distance is greater than X1 meters and less than X2 meters, the texture level is 1.
[0069] Step 208: Determine the virtual texture block where the virtual texture coordinates are located in the virtual texture map, and determine a portion of the physical texture map in the physical texture map that corresponds to the virtual texture block based on the mapping relationship between the virtual texture map and the physical texture map. Fill the virtual texture map with a portion of the physical texture map corresponding to the target pixel point, and sample the texture pixel that matches the virtual texture coordinates corresponding to the target pixel point from the virtual texture map.
[0070] A portion of the physical texture map corresponding to the target pixel is filled into the virtual texture map, and a texture pixel matching the virtual texture coordinates corresponding to the target pixel is sampled from the virtual texture map.
[0071] Here, a texel refers to a texel value in a virtual texture map, such as a texture color value. It is understood that sampling refers to the process of extracting an individual or sample from a population. In this embodiment, sampling a texel may refer to reading the color value at the virtual texture coordinate from the virtual texture map using the virtual texture coordinate. This process is referred to as texture sampling.
[0072] Specifically, when determining the virtual texture coordinates, the terminal can determine the virtual texture block where the virtual texture coordinates are located in the virtual texture map, and then determine the part of the physical texture map corresponding to the virtual texture block in the physical texture map based on the mapping relationship between the virtual texture map and the physical texture map, and fill the virtual texture map with the part of the physical texture map corresponding to the virtual texture block as the part of the physical texture map corresponding to the target pixel point, and sample the texture pixels that match the virtual texture coordinates corresponding to the target pixel point from the virtual texture map.
[0073] Step 210 : Render at least one target building block model using texture pixels that match the virtual texture coordinates corresponding to each target pixel point.
[0074] Specifically, the shader on the terminal can render at least one target building block model using texture pixels that match the virtual texture coordinates corresponding to each target pixel point, thereby obtaining a rendered image of at least a portion of the building complex. The shader is a small program that runs in the graphics processor within the graphics card and is used to parallelize calculations on various graphics units. In a specific application, the resulting rendered image of at least a portion of the building complex can be as shown in FIG6 , including at least a portion of the rendered building complex (including seven buildings as shown in FIG6 ). It should be noted that, for ease of illustration, the color of the rendered image is not shown in FIG6 .
[0075] In the aforementioned building complex rendering method, building complex models share a single rendering material parameter. During texture sampling, only the portion of the physical texture map corresponding to the target pixel is filled into the virtual texture map. This method does not require additional video memory for the texture map, effectively reducing video memory usage. This process avoids CPU overload by reducing the number of calls to the drawing interface, and effectively reduces video memory usage by utilizing virtual texture maps to optimize the memory usage of the physical texture map, ensuring normal computer operation during rendering.
[0076] The above-mentioned building complex rendering method obtains a building complex model, and the building complex model indicates the rendering material parameters for rendering the building complex. The rendering material parameters include texture data. Since the texture data includes the mapping information of multiple building texture maps of the building complex model, the building complex model can share a rendering material parameter, which is convenient for merging processing, can reduce the number of times the drawing interface is called, and avoids overloading of the central processing unit. When it is determined that there is at least one target building block model to be rendered in the building complex model, based on the mapping information in the texture data, a physical texture map of the building complex model is generated. For each target pixel point for texture sampling in the at least one target building block model, the corresponding pixel point is first determined. The virtual texture coordinates corresponding to the target pixel are determined based on the physical texture coordinates. Based on the virtual texture coordinates, a portion of the physical texture map corresponding to the target pixel is filled into the virtual texture map. Texture pixels that match the virtual texture coordinates corresponding to the target pixel are sampled from the virtual texture map. This allows the virtual texture map to be used to optimize the video memory usage of the physical texture map. During texture sampling, only a portion of the physical texture map corresponding to the target pixel is needed to be filled into the virtual texture map, without adding additional video memory to the map. This effectively reduces video memory usage, allowing the at least one target building block model to be rendered directly using the texture pixels that match the virtual texture coordinates corresponding to each target pixel. This entire process avoids CPU overload by reducing the number of calls to the drawing interface, and effectively reduces video memory usage by optimizing the video memory usage of the physical texture map using the virtual texture map, thus ensuring the normal operation of the computer device during rendering.
[0077] In one embodiment, the building complex model includes multiple building block models obtained by splitting; the building complex rendering method also includes: determining the distances between the building block centers of the multiple building block models and a preconfigured virtual camera respectively; and screening out at least one building block model from the multiple building block models whose distance from the preconfigured virtual camera is less than a preset distance as at least one target building block model to be rendered.
[0078] Among them, the building block center refers to the center of the bounding box of the building block model. A bounding box refers to a geometric space that can contain an object. In this embodiment, the bounding box of the building block model refers to a geometric space that can contain the building block model. It can be understood that the bounding box of the building block model in this embodiment can refer to the smallest bounding box that can contain the building block model. The virtual camera, which can also be called a camera model, is a virtual model used to capture images in a virtual scene containing a building complex model. The virtual camera has camera information similar to that of a physical camera, such as camera position, posture, aperture size, focal length, etc. The images captured by the virtual camera in the virtual scene can be determined by the camera information of the virtual camera in the virtual scene.
[0079] Specifically, the building complex model includes multiple building block models obtained through segmentation. When determining at least one target building block model to be rendered within the building complex model, the terminal first determines the distance between the center of each building block of the multiple building block models and a preconfigured virtual camera. Then, the terminal selects at least one building block model from the multiple building block models whose distance from the preconfigured virtual camera is less than a preset distance as the at least one target building block model to be rendered. The preset distance can be configured according to the actual application scenario.
[0080] In this embodiment, on the basis of respectively determining the distances between the building block centers of multiple building block models and a preconfigured virtual camera, at least one target building block model to be rendered is determined from the multiple building block models based on the distances. The distances can be used to eliminate building block models that do not need to be displayed, thereby improving rendering efficiency.
[0081] In one embodiment, the initial model of the building complex includes multiple building models; the multiple building block models are obtained by splitting the multiple building models based on the bounding boxes corresponding to the multiple building models and preconfigured building block sizes.
[0082] The bounding box of a building model refers to the geometric space that can enclose the building model. It is understood that in this embodiment, the bounding box of a building model can refer to the minimum bounding box that can enclose the building model. The preconfigured building block size refers to a preconfigured building block size that can be configured according to the actual application scenario.
[0083] Specifically, the initial model of the building complex includes multiple building models. The multiple building block models included in the building complex model are obtained by splitting the multiple building models based on their respective bounding boxes and preconfigured building block sizes. In a specific application, the process of splitting the multiple building models can be performed by an engine editor. The engine editor first determines the bounding boxes corresponding to the multiple building models. For each of the multiple building models, the center of the bounding box of the building model is used as the model center of the building model. Based on the model centers of the multiple building models and the preconfigured building block sizes, the multiple building models are split into multiple building block models.
[0084] In this embodiment, the bounding box of the building model can be used to determine the model center of the building model, and then the multiple building models can be split based on the preconfigured building block size and the model center of each of the multiple building models to obtain multiple building block models, so that they can be eliminated during rendering based on the multiple building block models, thereby improving rendering efficiency.
[0085] In one embodiment, each target pixel point for texture sampling in at least one target building block model is determined by:
[0086] For each target building block model in at least one target building block model, a detail level model to be rendered corresponding to the target building block model is determined based on the distance between the target building block model and a preconfigured virtual camera, and a target pixel point of the target building block model is determined based on the vertices on the detail level model to be rendered.
[0087] The target building block model includes multiple levels of detail (LOD) models. A LOD model is constructed based on multiple levels of detail (LOD) technology. LOD technology reduces the geometric complexity of a scene by gradually simplifying the surface details of objects without affecting the visual quality of the image, thereby improving the efficiency of the rendering algorithm. It should be noted that each LOD model retains a certain level of detail. During rendering, the appropriate LOD model can be selected based on different criteria to represent the target building block model.
[0088] Specifically, for each target building block model in at least one target building block model, the target building block model includes multiple levels of detail models at different levels. When determining the target pixel point of the target building block model, the terminal needs to determine the level of detail model to be rendered corresponding to the target building block model based on the distance between the target building block model and a preconfigured virtual camera, and perform rasterization processing based on the vertices on the level of detail model to be rendered to determine the target pixel point of the target building block model. It should be noted that the number of vertices on the level of detail models at different levels is different. The higher the level, the more vertices on the level of detail model that can display more details.
[0089] In a specific application, if the distance between the target building block model and the pre-configured virtual camera is closer, the target building block model needs to display more model details, and a detail level model that can display more details should be selected. If the distance between the target building block model and the pre-configured virtual camera is farther, the target building block model needs to select fewer model details, and a detail level model that can roughly represent the target building block model should be selected.
[0090] In specific applications, the mapping relationship between the distance between the target building block model and the preconfigured virtual camera and the detail level model can be pre-set. Different distances correspond to detail level models of different levels. Based on the distance between the target building block model and the preconfigured virtual camera, the detail level model to be rendered corresponding to the target building block model can be determined according to the distance.
[0091] In a specific application, for each target building block model in at least one target building block model, the multiple levels of detail models included in the target building block model can be pre-edited. Editing here means that any building model in the target building block model can be added to another building model as a level of detail. In this way, multiple levels of detail models can be constructed. It should be noted that when adding any building model to another building model as a level of detail, it is necessary to consider whether the vertex formats of the two building models are the same, that is, whether the vertex attributes are the same. Only when the vertex formats of the two building models are the same can the addition be performed.
[0092] In this embodiment, for the buildings in the target building block model, detail level models of different levels are generated by reducing the building density, which can optimize the rendering performance. On the basis of generating detail level models of different levels, the detail level model to be rendered is determined based on the distance between the target building block model and the preconfigured virtual camera. The target pixel points of the target building block model are determined based on the vertices on the detail level model to be rendered, rather than determining the target pixel points based on all the vertices on the target building block model. This can effectively reduce the number of vertices that need to be processed during the image rendering process and improve the rendering efficiency.
[0093] In one embodiment, based on the mapping information in the texture data, splicing multiple building texture maps to generate a physical texture map of the building complex model includes:
[0094] Based on the mapping information of the multiple building texture maps in the texture data, obtain the file handles of the multiple building texture maps;
[0095] For each texture level of the at least one texture level, based on the file handles of the multiple building texture maps, the texture images of the respective texture levels of the multiple building texture maps are loaded and stitched together to obtain a stitched image of the texture level;
[0096] A physical texture map of the building complex model is generated based on the stitched images of the at least one texture level.
[0097] In the file system, to read data from a file, an application first calls an operating system function, passing the file name and selecting a path to the file to open the file. The function returns a sequence number, i.e., a file handle, which uniquely identifies the open file. To read a block of data from a file, the application calls the ReadFile function and passes the address of the file handle in memory and the number of bytes to be copied to the operating system. Once the task is completed, the file is closed by calling a system function. In this embodiment, the texture image of at least one texture level of the building texture map is read using the file handle of the building texture map.
[0098] Specifically, the terminal will obtain the file handles of multiple building texture maps based on the mapping information of multiple building texture maps in the texture data, and save the file handles of multiple building texture maps. Each building texture map includes a texture image of at least one texture level. For each texture level of at least one texture level, the terminal will read and load the texture images of the texture level of the multiple building texture maps based on the file handles of the multiple building texture maps, splice the texture images of the texture level to obtain the spliced image of the texture level, and generate the physical texture map of the building complex model based on the spliced images of at least one texture level, that is, the physical texture map of the building complex model includes the spliced images of at least one texture level.
[0099] In a specific application, the mapping information of multiple building texture maps in the texture data can specifically be reference paths for the multiple building texture maps. The reference path refers to the path required to locate and reference the building texture map during image rendering, and can be understood as the storage path of the building texture map on the terminal. For each building texture map, the terminal can obtain a file handle for the building texture map based on the reference path of the building texture map, and then read a texture image of at least one texture level of the building texture map based on the file handle of the building texture map.
[0100] In this embodiment, the file handle can be obtained based on the mapping information, and then the file handle can be used to obtain and load the texture map of at least one texture level of multiple building texture maps, so that the texture images of at least one texture level can be spliced together to obtain the spliced images of at least one texture level. Based on the spliced images of at least one texture level, the physical texture map of the building complex model can be generated.
[0101] In one embodiment, for each target pixel point for texture sampling in at least one target building block model, determining the physical texture coordinates corresponding to the target pixel point in the physical texture map includes:
[0102] Determine the texture stitching parameters corresponding to the physical texture map; the texture stitching parameters include the number of stitching images in the first direction and the number of stitching images in the second direction;
[0103] For each target pixel point for texture sampling in at least one target building block model, determine the corresponding map texture coordinates of the target pixel point in the corresponding building texture map, and based on the number of stitched images in the first direction, the number of stitched images in the second direction and the map texture coordinates, determine the corresponding physical texture coordinates of the target pixel point in the physical texture map.
[0104] The texture stitching parameters are parameters set when stitching texture images at each texture level of multiple building texture maps. These parameters can be pre-configured based on the actual application scenario and may include the number of images stitched in the first direction and the number of images stitched in the second direction. By stitching multiple building texture maps with different numbers of images stitched in the first direction and the second direction, different physical texture maps can be generated.
[0105] Specifically, when determining the physical texture coordinates corresponding to the target pixel point in the physical texture map, the terminal will first determine the map stitching parameters corresponding to the physical texture map, and the map stitching parameters include the number of stitching images in the first direction and the number of stitching images in the second direction. On this basis, for each target pixel point in at least one target building block, the terminal will first determine the map texture coordinates corresponding to the target pixel point in the corresponding building texture map, and then reposition the map texture coordinates based on the number of stitching images in the first direction and the number of stitching images in the second direction, and map the map texture coordinates to the physical texture map to obtain the physical texture coordinates corresponding to the target pixel point in the physical texture map.
[0106] In a specific application, the texture coordinates corresponding to the target pixel in the corresponding building texture map can be obtained by interpolating the texture coordinates corresponding to multiple target vertices in the target building block model in the same building texture map. The target vertex refers to the vertex in the target building block model that is adjacent to the target pixel.
[0107] In a specific application, according to the index of the building texture map in the texture data in the map texture coordinates, the number of stitched images in the first direction, and the number of stitched images in the second direction, the area where the building texture map is located can be located from the physical texture map, and then according to the physical texture coordinate range of the area where the building texture map is located, the texture coordinates of the target pixel point in the map texture coordinates in the corresponding building texture map can be relocated to obtain the physical texture coordinates corresponding to the target pixel point in the physical texture map.
[0108] In a specific application, when relocating the texture coordinates of the target pixel in the corresponding building texture map in the texture coordinates of the map to obtain the physical texture coordinates corresponding to the target pixel, since the building texture map may be reused between two vertices in the building model, but each target pixel can be directly sampled, it is necessary to first round the texture coordinates of the target pixel in the corresponding building texture map, and then relocate the rounded texture coordinates according to the physical texture coordinate range of the area where the building texture map is located to obtain the physical texture coordinates corresponding to the target pixel in the physical texture map. It should be noted that rounding here refers to removing the integer part of the texture coordinates of the target pixel in the corresponding building texture map and only retaining the decimal part. For example, if the texture coordinates of the target pixel in the corresponding building texture map are (1.5, 1.5), the rounded texture coordinates obtained after rounding are (0.5, 0.5). In a specific application, as shown in FIG7 , the texture coordinates of the target pixel in the corresponding building texture map are [0.5, 0.5, index 4] (assuming that the texture coordinate origin of the building texture map is in the lower left corner as shown in FIG7 ), and the texture splicing parameters corresponding to the physical texture map are 2 in the first direction (horizontally as shown in FIG7 ) and 2 in the second direction (vertically as shown in FIG7 ). As an example, according to the index of the building texture map in the texture coordinates in the texture data, the number of splicing images in the first direction and the number of splicing images in the second direction, The number of directional stitching images can be used to locate the area where the building texture map is located in the physical texture map as 702. Then, based on the physical texture coordinate range of the area where the building texture map is located (assuming that the texture coordinate origin of the physical texture map is also in the lower left corner, the four physical texture coordinates of the physical texture coordinate range are: upper left corner (0.5, 0.5), upper right corner (1, 0.5), lower left corner (0.5, 0), lower right corner (1, 0)), the physical texture coordinates (0.75, 0.25) corresponding to the target pixel point in the physical texture map can be obtained.
[0109] In this embodiment, by determining the map stitching parameters corresponding to the physical texture map, the number of first-direction stitching images and the number of second-direction stitching images included in the map stitching parameters can be used to reposition the map texture coordinates corresponding to the target pixel point in the corresponding building texture map, and determine the physical texture coordinates corresponding to the target pixel point in the physical texture map.
[0110] In one embodiment, determining the virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map according to the physical texture coordinates includes:
[0111] Determine the target texture level corresponding to the target pixel point;
[0112] Calculating a first size ratio between a stitched image size corresponding to a target texture level and a map size of a preset virtual texture map;
[0113] Based on the first size ratio, coordinate transformation is performed on the physical texture coordinates to obtain virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map.
[0114] Specifically, the stitched image sizes of stitched images of different texture levels are different. It is understandable that the higher the texture level, the larger the stitched image size, and the lower the texture level, the smaller the stitched image size. For example, the stitched image size of a stitched image of level mip0 is larger than the stitched image size of a stitched image of level mip1, and the stitched image size of a stitched image of level mip1 is larger than the stitched image size of a stitched image of level mip2. Therefore, in order to achieve accurate coordinate conversion, the terminal needs to first determine the target texture level corresponding to the target pixel point, and then calculate the first size ratio between the stitched image size corresponding to the target texture level and the map size of the pre-created virtual texture map, and then based on the first size ratio, perform coordinate conversion on the physical texture coordinates to obtain the virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map.
[0115] In a specific application, assuming that the stitching image size corresponding to the target texture level is m, and the map size of the pre-created virtual texture map is n, the first size ratio can be obtained as m / n. If the physical texture coordinate is (U2, V2), the virtual texture coordinate corresponding to the target pixel point in the preset virtual texture map can be obtained as (U2*(m / n), V2*(m / n)).
[0116] In this embodiment, by determining the target texture level corresponding to the target pixel point and calculating the first size ratio between the stitched image size corresponding to the target texture level and the map size of the pre-created virtual texture map, the first size ratio can be used to realize the conversion of the physical texture coordinates and obtain the virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map.
[0117] In one embodiment, determining a portion of the physical texture map corresponding to the virtual texture block in the physical texture map according to a mapping relationship between the virtual texture map and the physical texture map includes:
[0118] Determining second position information of a physical texture block in the physical texture map corresponding to the virtual texture block according to a mapping relationship between the virtual texture map and the physical texture map and based on first position information of the virtual texture block in the virtual texture map;
[0119] According to the second position information, a portion of the physical texture map corresponding to the target pixel is obtained from the physical texture map.
[0120] The first position information refers to the texture coordinate range of the virtual texture block in the virtual texture map, and the second position information refers to the texture coordinate range of the physical texture block in the physical texture map.
[0121] Specifically, when filling a part of the physical texture map corresponding to the target pixel point into the virtual texture map, the terminal needs to first determine the virtual texture block where the virtual texture coordinates are located in the virtual texture map, and then perform position mapping based on the first position information of the virtual texture block in the virtual texture map, and determine the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map. Finally, according to the second position information, obtain a part of the physical texture map corresponding to the target pixel point from the physical texture map, and fill the part of the physical texture map corresponding to the target pixel point into the virtual texture block of the virtual texture map.
[0122] In a specific application, since the second position information refers to the texture coordinate range of the physical texture block in the physical texture map, when obtaining a part of the physical texture map corresponding to the target pixel point from the physical texture map based on the second position information, the terminal will obtain the texture map within the second position information in the physical texture map, and use the texture map within the second position information as the part of the physical texture map corresponding to the target pixel point.
[0123] In a specific application, a virtual texture map can be used to fill a physical texture map. The virtual texture map includes multiple virtual texture blocks, each of which can be used to fill at least a portion of the texture map in the physical texture map. When at least a portion of the virtual texture blocks are used to fill the physical texture map, each virtual texture block used for filling corresponds to a physical texture block in the physical texture map, and a physical texture block indicates a range of texture coordinates. Based on this, texture pixels that match the virtual texture coordinates corresponding to the target pixel can be sampled from the virtual texture blocks in the virtual texture map that are filled with the physical texture map.
[0124] In a specific application, as shown in FIG8 , the virtual texture map includes multiple virtual texture blocks 802. Assuming that the virtual texture block where the virtual texture coordinates are located in the virtual texture map is 804, position mapping is performed based on the first position information of the virtual texture block 804 in the virtual texture map (including the texture coordinates of the four vertices of the virtual texture block, and the four vertices are represented by four small circles in FIG8 ), and the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map can be determined (as shown in FIG8 , the texture coordinates of the four vertices of the physical texture block, and the four vertices are represented by four small circles in FIG8 ). Then, based on the second position information, a part of the physical texture map corresponding to the target pixel point can be obtained from the physical texture map (as shown in FIG8 , a part of the physical texture map in the physical texture block 806) for filling.
[0125] In this embodiment, by first determining the virtual texture block where the virtual texture coordinates are located in the virtual texture map, the first position information of the virtual texture block in the virtual texture map can be used to determine the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map. Then, based on the second position information, a part of the physical texture map corresponding to the target pixel point can be obtained from the physical texture map for filling, which can achieve accurate filling, so that accurate texture sampling can be performed based on the filled map to achieve accurate rendering.
[0126] In one embodiment, determining, based on first position information of the virtual texture block in the virtual texture map, second position information of a physical texture block corresponding to the virtual texture block in the physical texture map includes:
[0127] Determine the target texture level corresponding to the target pixel point;
[0128] Calculating a second size ratio between a map size of the virtual texture map and a size of a stitched image corresponding to the target texture level;
[0129] Based on the second size ratio, coordinate transformation is performed on the first position information of the virtual texture block in the virtual texture map to obtain second position information of the physical texture block corresponding to the virtual texture block in the physical texture map.
[0130] Specifically, the stitched image sizes of stitched images of different texture levels are different. It is understandable that the higher the texture level, the larger the stitched image size, and the lower the texture level, the smaller the stitched image size. Therefore, in order to achieve accurate coordinate conversion, the terminal needs to first determine the target texture level corresponding to the target pixel point, and then calculate the second size ratio between the map size of the virtual texture map and the stitched image size corresponding to the target texture level, and then based on the second size ratio, perform coordinate conversion on the first position information of the virtual texture block in the virtual texture map to obtain the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map.
[0131] In a specific application, assuming that the size of the stitched image corresponding to the target texture level is m and the map size of the virtual texture map is n, the second size ratio can be obtained as n / m. If the first position information (including the texture coordinates of the four vertices of the virtual texture block, which are texture coordinate 1, texture coordinate 2, texture coordinate 3, and texture coordinate 4), the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map can be obtained (including the texture coordinates of the four vertices of the physical texture block, which are texture coordinate 1*(n / m), texture coordinate 2*(n / m), texture coordinate 3*(n / m), and texture coordinate 4*(n / m)). It should be noted that in the process of coordinate conversion, it is assumed that the texture coordinate origins of the physical texture map and the virtual texture map are corresponding. For example, the texture coordinate origin can be the vertex in the lower left corner of the physical texture map and the virtual texture map.
[0132] In this embodiment, by determining the target texture level corresponding to the target pixel point and calculating the second size ratio based on the target texture level, the second size ratio can be used to convert the first position information to obtain the second position information. Then, based on the second position information, a part of the physical texture map corresponding to the target pixel point can be obtained from the physical texture map for filling, which can achieve accurate filling, so that accurate texture sampling can be performed based on the filled map to achieve accurate rendering.
[0133] In one embodiment, the physical texture map includes a stitched image of at least one texture level; and obtaining a portion of the physical texture map corresponding to the target pixel point from the physical texture map according to the second position information includes:
[0134] When the physical texture map includes a stitched image of a target texture level, a portion of the physical texture map corresponding to the target pixel point is obtained from the stitched image of the target texture level according to the second position information, where the target texture level refers to the texture level to which the portion of the physical texture map corresponding to the target pixel point belongs.
[0135] Specifically, after determining the second position information, the terminal needs to determine whether the physical texture map includes a stitched image of the target texture level. In the case that the physical texture map includes a stitched image of the target texture level, the terminal directly obtains the texture map within the second position information from the stitched image of the target texture level based on the second position information as a part of the physical texture map corresponding to the target pixel point. The target texture level refers to the texture level to which a part of the physical texture map corresponding to the target pixel point belongs. It should be noted that the physical texture map includes a stitched image of at least one texture level, and a part of the physical texture map in the virtual texture map that needs to be obtained and filled into the stitched image of the target texture level needs to be determined first. Therefore, it is necessary to determine whether the physical texture map includes a stitched image of the target texture level.
[0136] In a specific application, assuming that the physical texture map includes a mip0 level stitching image and a mip1 level stitching image, and the texture level of a part of the physical texture map corresponding to the target pixel point is mip1 level, then the part of the physical texture map corresponding to the target pixel point can be directly obtained from the mip1 level stitching image based on the second position information, that is, the texture map within the second position information in the mip1 level stitching image.
[0137] In this embodiment, when there is a spliced image of the target texture level, a portion of the physical texture map corresponding to the target pixel point can be acquired from the spliced image of the target texture level according to the second position information.
[0138] In one embodiment, the physical texture map includes a stitched image of at least one texture level; and obtaining a portion of the physical texture map corresponding to the target pixel point from the physical texture map according to the second position information includes:
[0139] When the physical texture map does not include a mosaic image of the target texture level, the target texture level texture images of multiple architectural texture maps are loaded;
[0140] splicing texture images of a target texture level of a plurality of building texture maps to obtain a spliced image of the target texture level;
[0141] According to the second position information, a portion of the physical texture map corresponding to the target pixel is obtained from the spliced image at the target texture level.
[0142] Specifically, when the physical texture map does not include a stitched image of the target texture level, the terminal needs to first read and load the texture images of the target texture level of multiple building texture maps based on the file handles of the saved multiple building texture maps, and then stitch the texture images of the target texture level of the multiple building texture maps to obtain a stitched image of the target texture level. According to the second position information, the texture map within the second position information is obtained from the stitched image of the target texture level as a part of the physical texture map corresponding to the target pixel point.
[0143] In a specific application, assuming that the physical texture map includes a mip0-level stitching image and a mip1-level stitching image, and the texture level of a part of the physical texture map corresponding to the target pixel point is mip2-level, the terminal needs to first read and load the mip2-level texture images of multiple building texture maps based on the file handles of the saved multiple building texture maps, and then stitch the mip2-level texture images of the multiple building texture maps to obtain a mip2-level stitching image, and then obtain a part of the physical texture map corresponding to the target pixel point from the mip2-level stitching image according to the second position information, that is, the texture map within the second position information in the mip2-level stitching image.
[0144] In this embodiment, when the physical texture map does not include a stitched image of the target texture level, the texture image is first loaded, and then the texture image is stitched to obtain a stitched image of the target texture level. Then, based on the second position information, a part of the physical texture map corresponding to the target pixel point is obtained from the stitched image of the target texture level, thereby achieving the acquisition of a part of the physical texture map corresponding to the target pixel point.
[0145] In one embodiment, the building complex rendering method of the present application mainly includes two processes: loading and rendering.
[0146] A flowchart of the loading process may be shown in FIG9 . The terminal obtains a building complex model, which indicates rendering material parameters for rendering the building complex, the rendering material parameters including texture data. The terminal determines the distance between the center of each building block of a plurality of building block models and a preconfigured virtual camera. Based on the distance, the terminal determines whether to display the building block model, i.e., whether at least one target building block model to be rendered exists. If at least one target building block model to be rendered exists, the terminal loads the at least one target building block model (mesh material), loads the texture data in the rendering material parameters, obtains and saves the file handles of the plurality of building texture maps based on mapping information of the plurality of building texture maps in the texture data, generates a data structure for a physical texture map based on the texture data, includes a spliced image of at least one texture level in the data structure, generates a physical texture map for the building complex model based on the spliced images of each of the at least one texture level, creates a virtual texture map, and uploads parameters related to the physical texture map, i.e., the splicing parameters.
[0147] In a specific application, a method for generating a stitched image of at least one texture level based on texture data can be: for each texture level in at least one texture level, based on the file handles of multiple building texture maps, load the texture images of the texture level of multiple building texture maps, stitch the texture images of the texture level, and obtain the stitched image of the texture level.
[0148] In a specific application, the building complex model includes a plurality of building block models obtained by splitting, and the plurality of building block models can be obtained by splitting a plurality of building models included in the initial model of the building complex.
[0149] In a specific application, the initial model of the building complex and multiple building texture maps are drawn using computer graphics software (such as Houdini). After the drawing is completed, the engine editor can obtain the initial model of the building complex including multiple building models and multiple building texture maps output from the computer graphics software, convert the initial model of the building complex including multiple building models and multiple building texture maps into a format usable by the rendering engine, and generate rendering material parameters. The terminal obtains the rendering material parameters generated by the engine editor. The format usable by the rendering engine here can be configured according to the actual application scenario. In a specific application, the engine editor can use a pre-configured building complex import tool to convert the initial model of the building complex including multiple building models and multiple building texture maps into a format usable by the rendering engine, and generate rendering material parameters. During import, the engine editor will first merge the multiple building texture maps into texture data, add the index of the corresponding building texture map in the texture data to the vertices of the multiple building models, and then generate rendering material parameters based on the texture data for easy use by the rendering engine. It should be noted that the initial model of the building complex including multiple building models is obtained by merging multiple building models. The merging here is mainly for models with the same material reference shader but different references to building texture maps. When merging multiple building models to obtain the initial model of the building complex, the multiple building texture maps will be merged into texture data.
[0150] In a specific application, the process of splitting multiple building models can be performed through the model editing tool of the engine editor. The model editing tool of the engine editor will first determine the bounding boxes corresponding to the multiple building models. For each of the multiple building models, the center of the bounding box of the building model is used as the model center of the building model. Based on the model centers of the multiple building models and the preconfigured building block sizes, the multiple building models are split into multiple building block models.
[0151] In a specific application, after splitting to obtain multiple building block models, for each of the multiple building block models, the model editing tool in the engine editor can be used to pre-edit the multiple different levels of detail models included in the building block model. Editing here means that any building model in the building block model can be added to another building model as a certain level of detail. In this way, multiple different levels of detail models can be constructed. It should be noted that when adding any building model to another building model as a certain level of detail, it is necessary to consider whether the vertex formats of the two building models are the same, that is, whether the vertex attributes are the same. Only when the vertex formats of the two building models are the same can the addition be performed.
[0152] It should be noted that the resources involved in this application (including building complex models, rendering material parameters, etc.) can be automatically generated through tools (such as the model editing tool and building complex import tool in the above embodiment), and the saved models, rendering material parameters, and building texture maps can all be matched. At the same time, the entire process can be independently controlled based on the tool parameter configuration, such as the size of the building blocks, the configuration of the detail level model, and the type of texture data used.
[0153] The flowchart of the rendering process may be shown in FIG10 . During rendering, for each target pixel point for texture sampling in at least one target building block model, the map texture coordinates of the target pixel point in the corresponding physical texture map are converted into physical texture coordinates in the physical texture map, that is, the physical texture coordinates corresponding to the target pixel point in the physical texture map are determined. Based on the physical texture coordinates, the virtual texture coordinates corresponding to the target pixel point in the pre-created virtual texture map are determined. Based on the virtual texture coordinates, the physical texture block in the required physical texture map is parsed to determine whether data of a target texture level corresponding to the target pixel point has been loaded, that is, whether the physical texture map includes a spliced image of the target texture level. If the physical texture map includes a spliced image of the target texture level, a portion of the physical texture map corresponding to the physical texture block (that is, the portion of the physical texture map corresponding to the target pixel point) is obtained from the spliced image of the target texture level based on second position information of the physical texture block, and uploaded to the virtual texture map (that is, filled into the virtual texture map). Texture pixels matching the virtual texture coordinates corresponding to the target pixel point are sampled from the virtual texture map. The at least one target building block model is rendered using the texture pixels matching the virtual texture coordinates corresponding to each target pixel point to obtain a rendered image of at least a portion of the building complex.
[0154] When the physical texture map does not include a stitched image of a target texture level, the texture images of the target texture level of multiple building texture maps in the texture data are loaded, the texture images of the target texture level of the multiple building texture maps are stitched together to obtain a stitched image of the target texture level, which is merged into the data structure of the physical texture map, and according to the second position information, a part of the physical texture map corresponding to the target pixel point is obtained from the stitched image of the target texture level.
[0155] In one embodiment, when rendering, it is also necessary to determine each target pixel point for texture sampling in at least one target building block model. Each target pixel point for texture sampling in at least one target building block model can be determined in the following manner: for each target building block model in at least one target building block model, based on the distance between the target building block model and the preconfigured virtual camera, determine the detail level model to be rendered corresponding to the target building block model, and based on the vertices on the detail level model to be rendered, determine the target pixel point of the target building block model.
[0156] In one embodiment, a method for determining the physical texture coordinates corresponding to a target pixel point in a physical texture map can be to determine a texture stitching parameter corresponding to the physical texture map, where the texture stitching parameter includes the number of stitching images in the first direction and the number of stitching images in the second direction. For each target pixel point for texture sampling in at least one target building block model, the texture coordinates corresponding to the target pixel point in the corresponding building texture map are determined. Based on the number of stitching images in the first direction, the number of stitching images in the second direction and the texture coordinates, the physical texture coordinates corresponding to the target pixel point in the physical texture map are determined.
[0157] In one embodiment, based on the physical texture coordinates, the method for determining the virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map can be as follows: determining the target texture level corresponding to the target pixel point, calculating the first size ratio between the stitching image size corresponding to the target texture level and the map size of the preset virtual texture map, and based on the first size ratio, performing coordinate transformation on the physical texture coordinates to obtain the virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map.
[0158] In one embodiment, a method for resolving a desired physical texture block in a physical texture map based on virtual texture coordinates may include determining the virtual texture block in the virtual texture map where the virtual texture coordinates are located, and then determining second position information of a physical texture block in the physical texture map corresponding to the virtual texture block based on first position information of the virtual texture block in the virtual texture map. Based on the second position information, the texture map within the second position information, i.e., the portion of the physical texture map corresponding to the target pixel, can be obtained from the physical texture map.
[0159] In one embodiment, a method for determining the second position information of a physical texture block corresponding to a virtual texture block in a physical texture map may be to determine a target texture level corresponding to a target pixel point, calculate a second size ratio between a map size of the virtual texture map and a stitched image size corresponding to the target texture level, and based on the second size ratio, perform coordinate transformation on the first position information of the virtual texture block in the virtual texture map to obtain the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map.
[0160] The building complex rendering method provided by the present application, by merging different building texture maps into a piece of texture data, can enable the building complex model to share a rendering material parameter, facilitate merging processing, reduce the number of times the drawing interface is called, and avoid overloading the central processing unit. At the same time, based on virtual texture mapping, it supports the flow of texture data, and uses virtual texture mapping to optimize the video memory occupancy of physical texture mapping. When performing texture sampling, it is only necessary to fill a part of the physical texture map corresponding to the target pixel point into the virtual texture map, without adding additional video memory for the map, which can effectively reduce the video memory occupancy. In addition, in the present application, by dividing the building complex model into blocks, the building models in the individually divided building block models are meshed and merged, and the culling function of the rendering engine is fully utilized under the premise of controlling the drawing call, which can improve performance. For the building models in the same building block, the level of detail models of different levels are generated by reducing the building density, which can improve rendering efficiency.
[0161] In one embodiment, when the building complex model and the texture data included in the rendering material parameters indicated by the building complex model are obtained, and at least one target building block model to be rendered in the building complex model is determined, the at least one target building block model can also be rendered in the following manner: the terminal can first deserialize the texture data, load multiple building texture maps into the memory in sequence, copy the textures of the graphics processor of the loaded multiple building texture maps and merge them into the texture data of the image processor, for each target pixel point for texture sampling in the at least one target building block model, the shader samples the corresponding building texture map according to the index of the texture data in the vertex attribute of the target pixel point, obtains the texture pixel that matches the texture coordinates of the map corresponding to the target pixel point, and uses the texture pixels that match the texture coordinates of the map corresponding to each target pixel point to render at least one target building block model to obtain a rendered image of at least a part of the building complex.
[0162] The building cluster rendering method described in this application can significantly reduce draw calls for building cluster rendering. By merging multiple building texture maps using texture data and then using the rendering engine's automatic merging, the rendering of a single building block model can be controlled within a single draw call. Furthermore, by optimizing texture data using virtual texture maps, in scenes with existing virtual texture maps, as long as the textures are saved in the same format, no additional video memory is required for the textures. Simultaneously, a texture loading stream and a building block stream are provided, reducing CPU pressure.
[0163] In one embodiment, the building cluster rendering method of the present application can be applied to rendering urban building images. The inventors believe that in traditional large-scale urban building rendering, to enrich the effect, there are a large number of different types of buildings. At the same time, for the same type of building, there may be multiple styles of materials. Because traditional methods use merging strategies based on the same material, this makes it difficult to merge buildings and cannot reduce the number of draw calls. Furthermore, more types of buildings mean more textures, which also consumes a large amount of video memory. Furthermore, since urban building models are inherently simple, with each building typically having only a few dozen faces, it is difficult to effectively reduce faces to create a high-level-of-detail model. Therefore, continuing to use traditional methods for urban building image rendering will affect the normal operation of the computer equipment used for rendering. Based on this, the present application provides a building cluster rendering method that, when applied to urban building image rendering, can achieve performance optimization without affecting the effect. In addition to urban building image rendering, the building cluster rendering method of the present application can also be applied to rendering any specific model cluster with multiple styles of materials. For example, it can be applied to rendering a cluster of virtual object models with multiple styles of materials, or to rendering terrain models with multiple styles of materials. In a real-world application, for an urban area with 200,000 buildings, using a traditional approach, for example, on a computer equipped with a 2060-8GB (gigabyte) graphics card and 32GB of memory, the distant view requires approximately 4,000 draw calls, with an FPS of around 30, while the near view requires between 700 and 1,000 draw calls, with an FPS of around 40. However, after applying the building complex rendering method described in this application, the distant view requires approximately 100 draw calls, while the near view requires only 1-2 draw calls, with the FPS remaining stable at around 60. This represents a significant performance gain.
[0164] In one embodiment, as shown in Figure 11, a rendering of a city building image using a traditional solution achieves an FPS of 36.8 and a rendering time of 27.2 ms. Figure 12 shows a rendering of the same area in Figure 11 using the building complex rendering method of the present application. As shown in Figure 12, an FPS of 60 and a rendering time of 16.7 ms are achieved, demonstrating significant performance gains.
[0165] In one embodiment, as shown in Figure 13, another rendering of a city building image using a traditional solution is shown. As can be seen from Figure 13, the FPS is 34.0 and the rendering time is 29.2ms. As shown in Figure 14, the rendering of the same area in Figure 13 using the building complex rendering method of the present application is shown. As can be seen from Figure 14, the FPS is 59.9 and the rendering time is 16.7ms, which shows a significant performance gain.
[0166] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0167] Based on the same inventive concept, embodiments of the present application also provide a building complex rendering device for implementing the aforementioned building complex rendering method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more of the following embodiments of the building complex rendering device can be found in the aforementioned limitations of the building complex rendering method and will not be further elaborated here.
[0168] In one embodiment, as shown in FIG15 , a building complex rendering apparatus is provided, comprising: a model acquisition module 1502 , a texture generation module 1504 , a coordinate conversion module 1506 , a texture sampling module 1508 , and a rendering module 1510 , wherein:
[0169] The model acquisition module 1502 is configured to acquire a building complex model, wherein the building complex model indicates rendering material parameters for rendering the building complex, wherein the rendering material parameters include texture data, and wherein the texture data includes mapping information of multiple building texture maps of the building complex model. The building complex model includes at least one target building block model to be rendered.
[0170] A texture generation module 1504 is configured to combine multiple building texture maps based on the texture information in the texture data to generate a physical texture map of the building complex model;
[0171] A coordinate conversion module 1506 is configured to determine, for each target pixel point used for texture sampling in at least one target building block model, a physical texture coordinate corresponding to the target pixel point in the physical texture map, and determine, based on the physical texture coordinates, a virtual texture coordinate corresponding to the target pixel point in a preset virtual texture map;
[0172] The texture sampling module 1508 is configured to determine a virtual texture block in the virtual texture map where the virtual texture coordinates are located, and based on a mapping relationship between the virtual texture map and the physical texture map, determine a portion of the physical texture map in the physical texture map that corresponds to the virtual texture block, fill the virtual texture map with the portion of the physical texture map that corresponds to the target pixel, and sample the texture pixel that matches the virtual texture coordinates corresponding to the target pixel from the virtual texture map;
[0173] The rendering module 1510 is configured to render at least one target building block model using texture pixels that match the virtual texture coordinates corresponding to each target pixel point.
[0174] The above-mentioned building complex rendering device obtains a building complex model, and the building complex model indicates the rendering material parameters for rendering the building complex. The rendering material parameters include texture data. Since the texture data includes the mapping information of multiple building texture maps of the building complex model, the building complex model can share a rendering material parameter, which is convenient for merging processing, can reduce the number of times the drawing interface is called, and avoids overloading of the central processing unit. When it is determined that there is at least one target building block model to be rendered in the building complex model, based on the mapping information in the texture data, a physical texture map of the building complex model is generated. For each target pixel point for texture sampling in the at least one target building block model, the corresponding texture map of the target pixel point is first determined. The virtual texture coordinates corresponding to the target pixel are determined based on the physical texture coordinates. Based on the virtual texture coordinates, a portion of the physical texture map corresponding to the target pixel is filled into the virtual texture map. Texture pixels that match the virtual texture coordinates corresponding to the target pixel are sampled from the virtual texture map. This allows the virtual texture map to be used to optimize the video memory usage of the physical texture map. During texture sampling, only a portion of the physical texture map corresponding to the target pixel is needed to be filled into the virtual texture map, without adding additional video memory to the map. This effectively reduces video memory usage, allowing the at least one target building block model to be rendered directly using the texture pixels that match the virtual texture coordinates corresponding to each target pixel. This entire process avoids CPU overload by reducing the number of calls to the drawing interface, and effectively reduces video memory usage by optimizing the video memory usage of the physical texture map using the virtual texture map, thus ensuring the normal operation of the computer device during rendering.
[0175] In one embodiment, the building complex model includes multiple building block models obtained by splitting; the texture generation module is also used to determine the distance between the building block centers of the multiple building block models and a preconfigured virtual camera respectively, and based on the distance, determine at least one target building block model to be rendered from the multiple building block models.
[0176] In one embodiment, the initial model of the building complex includes multiple building models; the multiple building block models are obtained by splitting the multiple building models based on the bounding boxes corresponding to the multiple building models and preconfigured building block sizes.
[0177] In one embodiment, the coordinate conversion module is further used to determine, for each target building block model in at least one target building block model, a detail level model to be rendered corresponding to the target building block model based on the distance between the target building block model and a preconfigured virtual camera, and to determine the target pixel point of the target building block model based on the vertices on the detail level model to be rendered.
[0178] In one embodiment, the texture generation module is also used to obtain file handles of multiple building texture maps based on the texture information of multiple building texture maps in the texture data, and for each texture level in at least one texture level, load the texture images of the multiple building texture maps at that texture level based on the file handles of the multiple building texture maps, splice the texture images of the texture level to obtain the spliced image of the texture level, and generate a physical texture map of the building complex model based on the spliced images of the at least one texture level.
[0179] In one embodiment, the coordinate conversion module is also used to determine the map stitching parameters corresponding to the physical texture map, the map stitching parameters include the number of stitching images in the first direction and the number of stitching images in the second direction. For each target pixel point used for texture sampling in at least one target building block model, the map texture coordinates corresponding to the target pixel point in the corresponding building texture map are determined. Based on the number of stitching images in the first direction, the number of stitching images in the second direction and the map texture coordinates, the physical texture coordinates corresponding to the target pixel point in the physical texture map are determined.
[0180] In one embodiment, the coordinate conversion module is also used to determine the target texture level corresponding to the target pixel point, calculate the first size ratio between the stitched image size corresponding to the target texture level and the map size of the preset virtual texture map, and based on the first size ratio, perform coordinate conversion on the physical texture coordinates to obtain the virtual texture coordinates corresponding to the target pixel point in the preset virtual texture map.
[0181] In one embodiment, the texture sampling module is further used to determine the virtual texture block where the virtual texture coordinates are located in the virtual texture map, and based on the first position information of the virtual texture block in the virtual texture map, determine the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map, and according to the second position information, obtain a part of the physical texture map corresponding to the target pixel point from the physical texture map, and fill the part of the physical texture map corresponding to the target pixel point into the virtual texture map.
[0182] In one embodiment, the texture sampling module is further used to determine the target texture level corresponding to the target pixel point, calculate a second size ratio between the map size of the virtual texture map and the stitched image size corresponding to the target texture level, and based on the second size ratio, perform coordinate transformation on the first position information of the virtual texture block in the virtual texture map to obtain the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map.
[0183] In one embodiment, the physical texture map includes a stitched image of at least one texture level; the texture sampling module is further used to obtain a portion of the physical texture map corresponding to the target pixel point from the stitched image of the target texture level according to the second position information when the physical texture map includes a stitched image of the target texture level, and the target texture level refers to the texture level to which the portion of the physical texture map corresponding to the target pixel point belongs.
[0184] In one embodiment, the physical texture map includes at least one stitched image of each texture level; the texture sampling module is further used to load the texture images of the target texture level of multiple building texture maps when the physical texture map does not include the stitched image of the target texture level, stitch the texture images of the target texture level of the multiple building texture maps to obtain the stitched image of the target texture level, and obtain a part of the physical texture map corresponding to the target pixel point from the stitched image of the target texture level according to the second position information.
[0185] Each module in the aforementioned building complex rendering device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a computer device memory in software form, so that the processor can call and execute the corresponding operations of each module.
[0186] In one embodiment, a computer device is provided. The computer device can be either a terminal or a server. For example, the internal structure of the terminal is shown in FIG16 . The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and computer program in the non-volatile storage medium to run. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless communication. The wireless communication can be achieved via Wi-Fi, a mobile cellular network, NFC (near-field communication), or other technologies. When executed by the processor, the computer program implements a method for rendering a building complex. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0187] Those skilled in the art will understand that the structure shown in Figure 16 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0188] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0189] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0190] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0191] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0192] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0193] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A method for rendering a building complex, executed by a computer device, the method comprising: Acquire a building complex model, wherein the building complex model indicates rendering material parameters for rendering the building complex, wherein the rendering material parameters include texture data, wherein the texture data includes mapping information of a plurality of building texture maps of the building complex model, and wherein the building complex model includes at least one target building block model to be rendered; Based on the mapping information in the texture data, the plurality of building texture maps are spliced to generate a physical texture map of the building complex model; For each target pixel point for texture sampling in the at least one target building block model, determine a physical texture coordinate corresponding to the target pixel point in the physical texture map, and determine a virtual texture coordinate corresponding to the target pixel point in a preset virtual texture map according to the physical texture coordinate; Determine a virtual texture block in the virtual texture map where the virtual texture coordinates are located, and determine a portion of the physical texture map in the physical texture map corresponding to the virtual texture block according to a mapping relationship between the virtual texture map and the physical texture map; Filling a portion of the physical texture map corresponding to the target pixel into the virtual texture map, and sampling texture pixels matching the virtual texture coordinates corresponding to the target pixel from the virtual texture map; and The at least one target building block model is rendered using texture pixels that match the virtual texture coordinates corresponding to each target pixel point.
2. The method according to claim 1, wherein the building complex model comprises a plurality of building block models obtained by splitting, and the method further comprises: respectively determining the distances between the centers of the building blocks of the plurality of building block models and a preconfigured virtual camera; At least one building block model whose distance from the preconfigured virtual camera is less than a preset distance is screened out from the multiple building block models as at least one target building block model to be rendered.
3. According to the method of claim 2, the initial model of the building complex includes multiple building models, and the multiple building block models are obtained by splitting the multiple building models based on the bounding boxes corresponding to the multiple building models and the preconfigured building block sizes.
4. According to the method according to any one of claims 1 to 3, each target pixel point for texture sampling in the at least one target building block model is determined by: For each target building block model of the at least one target building block model, based on the distance between the target building block model and a preconfigured virtual camera, a detail level model to be rendered corresponding to the target building block model is determined, and based on the vertices on the detail level model to be rendered, a target pixel point of the target building block model is determined.
5. The method according to any one of claims 1 to 4, wherein the step of splicing the plurality of building texture maps based on the mapping information in the texture data to generate a physical texture map of the building complex model comprises: Based on the mapping information of the plurality of building texture maps in the texture data, obtaining the file handles of the plurality of building texture maps; For each texture level of at least one texture level, based on the file handles of the multiple building texture maps, the texture images of the texture level of the multiple building texture maps are loaded for stitching to obtain a stitched image of the texture level; A physical texture map of the building complex model is generated based on the stitched images of the at least one texture level.
6. The method according to any one of claims 1 to 5, wherein for each target pixel point for texture sampling in the at least one target building block model, determining the physical texture coordinates corresponding to the target pixel point in the physical texture map comprises: Determine the texture stitching parameters corresponding to the physical texture map; the texture stitching parameters include the number of stitching images in the first direction and the number of stitching images in the second direction; For each target pixel point for texture sampling in the at least one target building block model, determine the texture coordinates of the target pixel point in the corresponding building texture map, and stitch the image based on the first direction. The physical texture coordinates corresponding to the target pixel point in the physical texture map are determined by using the number of the second-direction stitched images and the map texture coordinates.
7. The method according to any one of claims 1 to 6, wherein determining, based on the physical texture coordinates, the virtual texture coordinates corresponding to the target pixel point in a preset virtual texture map comprises: Determining a target texture level corresponding to the target pixel point; Calculating a first size ratio between a stitched image size corresponding to the target texture level and a map size of a preset virtual texture map; Based on the first size ratio, coordinate transformation is performed on the physical texture coordinates to obtain virtual texture coordinates corresponding to the target pixel point in the virtual texture map.
8. The method according to any one of claims 1 to 7, wherein determining a portion of the physical texture map corresponding to the virtual texture block in the physical texture map according to a mapping relationship between the virtual texture map and the physical texture map comprises: Determine, according to a mapping relationship between the virtual texture map and the physical texture map, second position information of a physical texture block in the physical texture map corresponding to the virtual texture block based on first position information of the virtual texture block in the virtual texture map; According to the second position information, a portion of the physical texture map corresponding to the target pixel is obtained from the physical texture map.
9. The method according to claim 8, wherein determining, based on the first position information of the virtual texture block in the virtual texture map, the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map comprises: Determining a target texture level corresponding to the target pixel point; Calculating a second size ratio between a map size of the virtual texture map and a size of a stitched image corresponding to the target texture level; Based on the second size ratio, coordinate transformation is performed on the first position information of the virtual texture block in the virtual texture map to obtain the second position information of the physical texture block corresponding to the virtual texture block in the physical texture map.
10. The method according to claim 8 or 9, wherein the physical texture map comprises a stitched image of at least one texture level, and obtaining a portion of the physical texture map corresponding to the target pixel from the physical texture map according to the second position information comprises: When the physical texture map includes a stitched image of a target texture level, a portion of the physical texture map corresponding to the target pixel is obtained from the stitched image of the target texture level according to the second position information, and the target texture level refers to the texture level to which the portion of the physical texture map corresponding to the target pixel belongs.
11. The method according to any one of claims 8 to 10, wherein the physical texture map comprises a stitched image of at least one texture level, and obtaining a portion of the physical texture map corresponding to the target pixel from the physical texture map according to the second position information comprises: When the physical texture map does not include a spliced image of a target texture level, loading texture images of the target texture level of the plurality of architectural texture maps; Splicing the texture images of the target texture level of the multiple building texture maps to obtain a spliced image of the target texture level; According to the second position information, a portion of the physical texture map corresponding to the target pixel is obtained from the spliced image at the target texture level.
12. A building group rendering device, the device comprising: A model acquisition module, used to acquire a building complex model, wherein the building complex model indicates rendering material parameters for rendering the building complex, wherein the rendering material parameters include texture data, wherein the texture data includes mapping information of a plurality of building texture maps of the building complex model, and wherein the building complex model includes at least one target building block model to be rendered; A texture generation module is used to splice the plurality of building texture maps based on the texture information in the texture data, To generate a physical texture map of the building complex model; A coordinate conversion module, for determining, for each target pixel point for texture sampling in the at least one target building block model, a physical texture coordinate corresponding to the target pixel point in the physical texture map, and determining, based on the physical texture coordinates, a virtual texture coordinate corresponding to the target pixel point in a preset virtual texture map; A texture sampling module, configured to determine a virtual texture block in the virtual texture map where the virtual texture coordinates are located, and determine a portion of the physical texture map in the physical texture map corresponding to the virtual texture block according to a mapping relationship between the virtual texture map and the physical texture map, fill the virtual texture map with a portion of the physical texture map corresponding to the target pixel point, and sample a texture pixel matching the virtual texture coordinates corresponding to the target pixel point from the virtual texture map; and The rendering module is used to render the at least one target building block model by using texture pixels that match the virtual texture coordinates corresponding to each target pixel point.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 11 when executing the computer program.
14. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
15. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Target model rendering method and device, equipment and storage medium
CN113947657A
Terrain rendering method and device, electronic equipment, medium and product
CN114842127A
Texture mapping processing method and device
CN115035169A
Image generation method and device of virtual building group, storage medium and electronic device
CN115713589A
Building group rendering method and device, computer equipment and storage medium
CN116883575A
Cited By
BIM model texture dynamic display method, system and equipment and storage medium
CN120235995A
Texture loading method based on three-dimensional engine, electronic equipment and storage medium
CN120580333A