Model map processing method, device, system, electronic device and storage medium
By establishing a mapping relationship between the vertices of the building model and the texture positions, the model texture processing flow was optimized, the problem of low model texture loading efficiency was solved, and efficient dynamic texture processing was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-16
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies have low efficiency in loading model textures, are time-consuming and labor-intensive, require high human and financial resources, and have long time cycles.
By obtaining the vertex positions of the building model, traversing and accumulating the texture positions of the texture map, establishing a mapping relationship between the vertex and texture positions, and applying the texture map to the model surface based on this relationship, the texture map processing process is optimized using a cache table.
It achieves efficient and accurate dynamic model texture processing, improves texture loading efficiency, reduces the need for manual configuration, and supports real-time texture replacement.
Smart Images

Figure CN115375819B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to model texture processing methods, apparatus, systems, electronic devices, and storage media. Background Technology
[0002] 3D architectural models are instantiated models of 3D buildings, enhancing the expression of their spatial information. 3D modeling often requires texturing large batches of architectural models. Related technologies primarily involve taking photos of the building's exterior and then applying textures to the 3D architectural model (white model). However, this method of mass texturing of 3D architectural models has drawbacks: it is labor-intensive and repetitive, time-consuming and labor-intensive, with high costs in terms of manpower and financial resources, low texture loading efficiency, and a long time cycle.
[0003] Currently, no effective solution has been proposed to address the technical issue of model texture loading efficiency in related technologies. Summary of the Invention
[0004] This application provides a model texture processing method, apparatus, system, electronic device, and storage medium to at least solve the problem of low model texture loading efficiency in related technologies.
[0005] In a first aspect, embodiments of this application provide a model texture processing method, the method comprising:
[0006] Obtain the current building model, and the position of the first vertex corresponding to each vertex in the building model;
[0007] Traverse the first vertex position, accumulate the preset initial value according to the result of each traversal to obtain the cumulative result, obtain the first texture position of the preset texture according to the cumulative result, and determine the mapping relationship between the first vertex position and the first texture position.
[0008] Based on the mapping relationship, the preset texture is overlaid onto the surface of the building model, and a first visualization processing result is generated for the building model.
[0009] In some embodiments, determining the mapping relationship between the first vertex position and the first texture position includes:
[0010] Obtain a preset initial cache table; wherein, the initial cache table stores the mapping relationship between the position of the first vertex and a preset mapping value;
[0011] The preset mapping value is updated based on the first texture position to obtain the target mapping value. The initial cache table is updated based on the target mapping value to obtain the current target cache table. The mapping relationship between the first vertex position and the first texture position is determined based on the current target cache table.
[0012] In some embodiments, after generating the first visualization result for the building model, the method further includes:
[0013] Obtain the next building model, and the position of the second vertex of the next building model;
[0014] Obtain the retrieval result for the second vertex position based on the current target cache table;
[0015] If the search result indicates a successful search, the mapping relationship between the second vertex position and the first texture position of the preset map is determined according to the current target cache table;
[0016] If the search result indicates that the search failed, the second texture position of the preset texture is calculated based on the cumulative information and the second vertex position, and the target cache table is updated based on the second texture position to obtain a new target cache table. The mapping relationship between the second vertex position and the second texture position is determined based on the new target cache table.
[0017] Based on the mapping relationship, the preset texture is overlaid onto the surface of the next building model, and a second visualization processing result is generated for the next building model.
[0018] In some embodiments, the first vertex position includes a horizontal vertex position and a vertical vertex position, and the cumulative result includes a target cumulative value; the step of traversing the first vertex position, accumulating the preset initial cumulative value based on the result of each traversal to obtain the cumulative result, and obtaining the first texture position of the preset texture based on the cumulative result includes:
[0019] If the vertical position of the vertex corresponding to the currently traversed vertex of the building model is detected to be 0, calculate the distance between the horizontal position of the currently traversed vertex and the horizontal position of the vertex corresponding to the previously traversed vertex, and calculate the perimeter of the base based on the distance.
[0020] The vertices of the building model are traversed again, and the target cumulative value is obtained by accumulating the initial cumulative value and the horizontal position of the vertex corresponding to the currently traversed vertex. The texture horizontal position of the preset texture is calculated based on the correlation between the target cumulative value and the perimeter of the base.
[0021] The vertical position of the preset texture is determined based on the vertical position of the vertex, and the first texture position is determined based on the horizontal position of the texture and the vertical position of the texture.
[0022] In some embodiments, the cumulative result includes a target count value; the calculation of the first texture position of the preset texture based on preset cumulative information and the first vertex position includes:
[0023] Get the preset count value;
[0024] The vertices of the building model are traversed. When the current vertex is reached, the initial cumulative value is accumulated based on the count value to obtain the target count value. The horizontal position of the preset texture is calculated based on the target count value.
[0025] The vertical position of the preset texture is determined based on the first vertex position, and the first texture position is determined based on the texture horizontal position and the texture vertical position.
[0026] In some embodiments, when there are at least two building models, applying the preset texture to the surface of the building model based on the mapping relationship includes:
[0027] Obtain the regions where all the building models are located, and the corresponding identification information of the regions;
[0028] Based on the mapping relationship and the identification information, the preset texture is applied to the surface of the building model within the corresponding area.
[0029] In some embodiments, obtaining the current building model and the first vertex position corresponding to each vertex in the building model includes:
[0030] Obtain the data source for the current building model;
[0031] The base vertex sorting result and height information are obtained from the data source, and the position of the first vertex is calculated by using a preset topology operator on the base vertex sorting result and the height information.
[0032] Secondly, embodiments of this application provide a model texture processing apparatus, the apparatus comprising: an acquisition module, a mapping module, and a generation module;
[0033] The acquisition module is used to acquire the current building model and the position of the first vertex corresponding to each vertex in the building model;
[0034] The mapping module is used to traverse the first vertex position, accumulate the preset initial value according to the result of each traversal to obtain the cumulative result, obtain the first texture position of the preset texture according to the cumulative result, and determine the mapping relationship between the first vertex position and the first texture position.
[0035] The generation module is used to cover the surface of the building model with the preset texture based on the mapping relationship, and generate a first visualization processing result for the building model.
[0036] Thirdly, embodiments of this application provide a model texture processing system, the system comprising: a terminal device and a server;
[0037] The terminal device is used to acquire a preset texture and send the preset texture to the server;
[0038] The server is used to execute the model texture processing method as described in the first aspect above.
[0039] Fourthly, embodiments of this application provide an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the model mapping processing method as described in the first aspect above.
[0040] Fifthly, embodiments of this application provide a storage medium storing a computer program that, when executed by a processor, implements the model mapping processing method as described in the first aspect above.
[0041] Compared to related technologies, the model texture processing method, apparatus, system, electronic device, and storage medium provided in this application embodiment obtain the current building model and the first vertex position corresponding to each vertex in the building model; traverse the first vertex position, accumulate the preset initial value according to the result of each traversal to obtain the accumulated result, obtain the first texture position of the preset texture according to the accumulated result, and determine the mapping relationship between the first vertex position and the first texture position; cover the preset texture onto the surface of the building model based on the mapping relationship, and generate the first visualization processing result for the building model. This solves the problem of low model texture loading efficiency and realizes an efficient and accurate dynamic model texture processing method.
[0042] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0043] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0044] Figure 1 This is an application environment diagram of a model texture processing method according to an embodiment of this application;
[0045] Figure 2 This is a flowchart of a model texture processing method according to an embodiment of this application;
[0046] Figure 3A This is a schematic diagram of a building model base according to an embodiment of this application;
[0047] Figure 3B This is a three-dimensional schematic diagram of an architectural model according to an embodiment of this application;
[0048] Figure 4 This is a structural block diagram of a model texture processing apparatus according to an embodiment of this application;
[0049] Figure 5 This is a structural diagram of the internal structure of a computer device according to an embodiment of this application. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application. Furthermore, it is understood that although the efforts made in such a development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, modifications to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.
[0051] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0052] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application means two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The terms “first,” “second,” “third,” etc., used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.
[0053] The model texture processing method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal device 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Server 104 obtains the first vertex position corresponding to each vertex in the current building model from terminal device 102; server 104 traverses the first vertex positions, accumulates the preset initial values based on the results of each traversal to obtain the accumulated result, obtains the first texture position of the preset texture based on the accumulated result, and determines the mapping relationship between the first vertex position and the first texture position; server 104 overlays the preset texture onto the surface of the building model based on the mapping relationship, generates a first visualization processing result for the building model, and sends the first visualization processing result to terminal device 102 for display. Terminal device 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices, such as smartwatches, smart bracelets, and head-mounted devices. Server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.
[0054] This embodiment provides a model texture processing method. Figure 2This is a flowchart of a model texture processing method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0055] Step S210: Obtain the current building model and the position of the first vertex corresponding to each vertex in the building model.
[0056] For example, assuming the base of the current architectural model is hexagonal, the specific coordinates of each vertex of the base of the architectural model are as follows: Figure 3A As shown, the values are (0.2, 0), (0.8, 0), (0, 0.5), (1, 0.5), (0.2, 1), and (0.8, 1), respectively. Assuming the building model's height is 10, the extrusion algorithm is used to obtain the first vertex position corresponding to each vertex of the building model based on the height information. Modeling based on these first vertex positions yields the following results: Figure 3B The three-dimensional architectural model shown.
[0057] Step S220: Traverse the first vertex position, accumulate the preset initial value according to the result of each traversal to obtain the accumulated result, obtain the first texture position of the preset texture according to the accumulated result, and determine the mapping relationship between the first vertex position and the first texture position.
[0058] The aforementioned initial cumulative value can be preset by the user, for example, it can be set to 0 or other values. Specifically, before traversing, a starting point needs to be selected, for example, the position of the first vertex corresponding to the first vertex in the current building model can be selected as the starting point; the remaining vertices of the building model are traversed in sequence, and the initial cumulative value can be accumulated during each traversal. Each accumulation can be the distance value between adjacent vertices, or it can be a fixed count value; finally, the first texture position of the preset texture is determined based on the cumulative value obtained after the traversal, and then the mapping relationship between the first vertex position and the first texture position is determined.
[0059] Step S230: Based on the mapping relationship, the preset texture is applied to the surface of the building model, and a first visualization processing result for the building model is generated.
[0060] Specifically, through the mapping relationship between the first vertex position and the first texture position, the preset texture is overlaid on the surface of the corresponding building model to obtain the first visualization processing result, thereby generating a vector 3D building model based on a Geographic Information System (GIS) map. This model can handle various business scenarios and solves the problem that traditional GIS engines and 3D libraries do not generate UV coordinates for vector buildings and extruded geometry, which makes it impossible to overlay textures on the surface of the geometry.
[0061] Through steps S210 to S230, the position of the first vertex is obtained by traversing the vertices of the building model, and the mapping relationship between the position of the first vertex and the first texture position of the preset texture is determined. Based on this mapping relationship, the preset texture is covered on the surface of the building model. This eliminates the need for staff to pre-configure the image texture coordinates corresponding to the vertices of the modeling model. Each texture can be changed in real time at the front end, realizing a method for dynamically processing model textures and solving the problem of low model texture loading efficiency.
[0062] In some embodiments, determining the mapping relationship between the first vertex position and the first texture position further includes the following steps:
[0063] A preset initial cache table is obtained; this initial cache table stores the mapping relationship between the first vertex position and the preset mapping value. The preset mapping value is updated according to the first texture position to obtain the target mapping value. The initial cache table is then updated according to the target mapping value to obtain the current target cache table. The mapping relationship between the first vertex position and the first texture position is determined based on the current target cache table. The preset mapping value can be a user-preset initial UV coordinate value or other default value. For example, the preset mapping value can be preset to (0, 0), meaning the initial cache table stores the mapping relationship between each first vertex position and (0, 0). After obtaining the current building model, the first texture position corresponding to each vertex in the current building model in the preset texture map can be calculated through the above steps. The preset mapping value is then updated to the currently calculated first texture position, and the mapping relationship between the first vertex position and the first texture position is stored in the target cache table for subsequent queries.
[0064] Through the above embodiments, after each acquisition of the building model and calculation of the corresponding preset texture position, the initial cache table can be updated in real time and the target cache table can be obtained, which facilitates subsequent retrieval and query operations and can effectively improve the efficiency of model texture processing.
[0065] In some embodiments, after generating the first visualization result for the building model, the model texture processing method further includes the following steps:
[0066] Step S241: Obtain the next building model and the position of the second vertex of the next building model.
[0067] After generating the first visualization result for the current building model, the system can respond to user requests to continue mapping the next batch of building models. For example, when the user zooms out the view on their device using the mouse wheel, the map loads more buildings, thus obtaining the next building model and its corresponding second vertex position.
[0068] Step S242: Obtain the retrieval result for the second vertex position based on the current target cache table.
[0069] Step S243: If the retrieval result indicates that the retrieval was successful, determine the mapping relationship between the second vertex position and the first texture position of the preset map according to the current target cache table.
[0070] Step S244: If the search result indicates that the search failed, the second texture position of the preset texture is calculated based on the cumulative information and the second vertex position, and the target cache table is updated based on the second texture position to obtain a new target cache table. The mapping relationship between the second vertex position and the second texture position is determined based on the new target cache table.
[0071] Step S245: Based on the mapping relationship, the preset texture is overlaid onto the surface of the next building model, and a second visualization processing result is generated for the next building model.
[0072] In steps S242 to S245, after obtaining the next batch of building models, a search for the second vertex position can be performed based on the target cache table. If the target cache table already contains the second vertex position, it means that the vertex is a known vertex that has already undergone UV coordinate calculation and is stored in the cache table. In this case, no further calculation is needed, and the UV coordinates of the corresponding vertex in the target cache table can be directly used as the UV coordinates of the second vertex position. If the second vertex position is not found in the target cache table, it means that the vertex has not undergone UV coordinate calculation. In this case, the second texture position corresponding to the second vertex position in the preset texture map can be calculated through step S220, and the current target cache table can be updated based on the second texture position for subsequent rounds of search.
[0073] Through steps S241 to S245 above, in the process of texturing the next batch of newly added building models, the cache table can be searched first. If found, the corresponding UV coordinates in the cache table can be directly used as the UV coordinates of the second vertex position, thereby further improving the efficiency of model texturing processing.
[0074] In some embodiments, the first vertex position includes a horizontal vertex position and a vertical vertex position, and the cumulative result includes a target cumulative value; the above-mentioned traversing the first vertex position, accumulating the preset initial cumulative value according to the result of each traversal to obtain the cumulative result, and obtaining the first texture position of the preset texture map according to the cumulative result further includes the following steps:
[0075] Step S221: When it is detected that the vertical position of the vertex corresponding to the vertex of the currently traversed building model is 0, calculate the distance between the horizontal position of the vertex corresponding to the currently traversed vertex and the horizontal position of the vertex corresponding to the previously traversed vertex, and calculate the perimeter of the base based on the distance.
[0076] Step S222: Traverse the vertices of the building model again, and accumulate the target cumulative value based on the initial cumulative value and the horizontal position of the vertex corresponding to the currently traversed vertex. Calculate the texture horizontal position of the preset texture based on the correlation between the target cumulative value and the perimeter of the base.
[0077] Step S223: Determine the vertical position of the preset texture based on the vertical position of the vertex, and determine the position of the first texture based on the horizontal position and the vertical position of the texture.
[0078] In steps S221 to S223 above, based on the number of vertices in the base information, the proportional range of the starting point to the remaining vertices within the base perimeter is calculated. This proportional range is the texture horizontal position U coordinate. Since the height is equal everywhere in the building model, the texture vertical position V is 0 when the vertex is on the bottom surface and 1 when it is on the roof.
[0079] Specifically, regarding the U-coordinate: First, select the first vertex in the vertex data as the starting point; the U-coordinate of this vertex is 0. Traverse the remaining vertices sequentially. Each traversal requires checking the vertex's Z-coordinate. If the Z-coordinate is 0, it indicates that the current traversal is at the base coordinate, and the distance between the currently traversed vertex and the previously traversed vertex needs to be calculated. Accumulate this distance for each traversal to obtain the base perimeter. Set an accumulation variable, initialized to 0. Then, traverse the remaining vertices again, checking the vertex's Z-coordinate. If the Z-coordinate is 0, calculate the distance between the currently traversed vertex and the previously traversed vertex, and accumulate this value to the accumulation variable. Next, check the cache table for the corresponding vertex's U-coordinate based on the vertex's XY coordinates. If a search result is found, the vertex's U-coordinate is the search result's U-coordinate. If no search result is found, divide the accumulation variable by the base perimeter to obtain the proportion of the vertex's position on the base perimeter; this proportion is the vertex's U-coordinate, and the mapping relationship for this vertex is added to the cache table. Regarding V-coordinates: The range of V-coordinates is 0 to 1. The goal is to map the bottom of the texture to the bottom of the building and the top of the texture to the top of the building. Therefore, the V-coordinate of the bottom of the building should be 0, and the coordinate of the top should be 1. The vertex coordinates are traversed. Each traversal requires checking the Z-coordinate of the vertex. If the Z-coordinate is 0, the V-coordinate of that vertex is 0; if the Z-coordinate of the vertex equals its height (roof coordinates), the V-coordinate of that vertex is 1, and this is added to the cache table. It should be noted that in some 3D technologies such as WebGL, the Y-axis of the texture is flipped. If no texture flip parameter is set, the texture is upside down. Therefore, the V-coordinates need to be flipped vertically, changing 1 to 0 and 0 to 1.
[0080] Through steps S221 to S223 above, by calculating the proportional range of each vertex in the perimeter of the base, the first texture position of the corresponding preset texture is determined, thereby realizing the complete coverage of the entire geometric surface of the building model with a texture, expanding the business display scenarios, and effectively improving the efficiency of model texture processing.
[0081] In some embodiments, the cumulative result includes a target count value; the calculation of the first texture position of the preset texture based on the preset cumulative information and the first vertex position further includes the following steps:
[0082] Step S224: Obtain a preset count value. This count value can be pre-set by the user, for example, it can be preset to a value of 1 or 2. Each iteration accumulates the corresponding value based on the preset count value, such as incrementing by 1 or 2 each time.
[0083] Step S225: Traverse the vertices of the building model. When the current vertex is reached, accumulate the initial cumulative value according to the count value to obtain the target count value. Calculate the texture horizontal position of the preset texture based on the target count value.
[0084] Step S226: Determine the vertical position of the preset texture based on the first vertex position, and determine the first texture position based on the texture horizontal position and the texture vertical position.
[0085] In steps S224 to S226, the vertices of each base are counted according to the number of vertices in the base information. For example, the final count for the hexagon is: [0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0]. Due to the interpolation mechanism of the shader, the U coordinates of 0 to 1 can be obtained by taking the decimal of the U coordinates in the fragment shader. The calculation method for the V coordinates is similar to that in step S223. Specifically, for the U coordinates: First, the first vertex information of the vertex data is selected as the starting point, and the U coordinate of this vertex is 0. A counter is initialized with an initial value of 0. The remaining vertices are traversed in order, and the U coordinates of the vertices are checked in the cache table according to the XY coordinates of the vertices. If there is a search result, the U coordinate of the vertex is the U coordinate of the search result; if no search result is found, the counter is incremented by 1, and the U coordinate of the current vertex is the cumulative value of the current counter. At the same time, the mapping relationship of the vertex is added and stored in the cache table.
[0086] Through steps S224 to S226 above, the first texture position of the corresponding preset texture is determined by counting the vertices of each base, thereby realizing the application of a texture to cover each side of a building model geometry, further expanding the business display scenarios, improving the diversity of building model visualization display, and improving the processing efficiency of model textures.
[0087] In some embodiments, when there are at least two building models, the process of applying the preset texture to the surface of the building model based on the mapping relationship further includes the following steps: obtaining all regions where the building model is located, and the corresponding identification information of each region; and applying the preset texture to the surface of the building model within the corresponding region based on the mapping relationship and the identification information. Specifically, the user can pre-set the identification information corresponding to different regions, for example, the plaza region can be set as region 1, the corridor region as region 2, etc. Then, after the server obtains the mapping relationship between the vertex positions of each building model and the texture positions of the preset texture, it can apply each preset texture to the surface of the building model within the corresponding region based on the identification information and the mapping relationship. It is understood that when multiple building models are introduced, the above embodiments can be used to apply corresponding textures to building models in different regions, or the same texture can be applied to all building models in all regions.
[0088] Through the above embodiments, by obtaining the identification information corresponding to different regions, different textures are applied to the building models within the corresponding regions, thereby further improving the visualization of the building models and further improving the processing efficiency for textures of large batches of building models.
[0089] In some embodiments, the above-mentioned acquisition of the current building model and the first vertex position corresponding to each vertex in the building model further includes the following steps:
[0090] Step S211: Obtain the data source for the current building model. This data source refers to building information from a vector data source or a GeoJSON data source, primarily including base vertex information and height information. GeoJSON is a format for encoding various geographic data structures; it's a geospatial information data exchange format based on JavaScript Object Notation (JSON).
[0091] Step S212: Obtain the base vertex sorting result and height information from the data source, and use a preset topology operator to calculate the position of the first vertex based on the base vertex sorting result and height information. The aforementioned topology operator can be an extrusion algorithm, triangulation algorithm, etc., used to establish the vertex position information of the 3D building model.
[0092] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0093] This embodiment also provides a model texture processing apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the terms "module," "unit," "subunit," etc., can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0094] Figure 4 This is a structural block diagram of a model texture processing apparatus according to an embodiment of this application, such as... Figure 4 As shown, the device includes: an acquisition module 42, a mapping module 44, and a generation module 46; the acquisition module 42 is used to acquire the current building model and the first vertex position corresponding to each vertex in the building model; the mapping module 44 is used to traverse the first vertex position, perform cumulative processing on a preset cumulative initial value according to the result of each traversal to obtain a cumulative result, obtain the first texture position of the preset texture according to the cumulative result, and determine the mapping relationship between the first vertex position and the first texture position; the generation module 46 is used to cover the preset texture onto the surface of the building model based on the mapping relationship, and generate a first visualization processing result for the building model.
[0095] Through the above embodiments, the mapping module 44 traverses the vertices of the building model to obtain the position of the first vertex and determines the mapping relationship between the position of the first vertex and the position of the first texture of the preset texture. The generation module 46 then applies the preset texture to the surface of the building model based on this mapping relationship. This eliminates the need for staff to pre-configure the image texture coordinates corresponding to the vertices of the modeling model. Each texture can be changed in real time at the front end, realizing a device for dynamically processing model textures and solving the problem of low model texture loading efficiency.
[0096] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.
[0097] This embodiment also provides a model texture processing system, which includes: a terminal device and a server; the terminal device is used to acquire a preset texture and send the preset texture to the server; the server is used to execute the steps in any of the above method embodiments.
[0098] In some embodiments, a computer device is provided, which may be a server. Figure 5This is a structural diagram of the internal structure of a computer device according to an embodiment of this application, such as... Figure 5 As shown.
[0099] The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores the initial visualization processing results.
[0100] The network interface of this computer device is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements the aforementioned model texturing processing method.
[0101] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0102] This embodiment also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0103] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0104] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0105] S1, obtain the current building model and the position of the first vertex corresponding to each vertex in the building model.
[0106] S2, traverse the first vertex position, accumulate the preset initial value according to the result of each traversal to obtain the cumulative result, obtain the first texture position of the preset texture according to the cumulative result, and determine the mapping relationship between the first vertex position and the first texture position.
[0107] S3, based on the mapping relationship, the preset texture is applied to the surface of the building model, and the first visualization result for the building model is generated.
[0108] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0109] Furthermore, in conjunction with the model texture processing methods in the above embodiments, this application embodiment can provide a storage medium for implementation. This storage medium stores a computer program; when executed by a processor, the computer program implements any of the model texture processing methods in the above embodiments.
[0110] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0111] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been 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.
[0112] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for processing model textures, characterized in that, The method includes: Obtain the current building model, and the position of the first vertex corresponding to each vertex in the building model; Traverse the first vertex position, accumulate the preset initial value according to the result of each traversal to obtain the cumulative result, obtain the first texture position of the preset texture according to the cumulative result, and determine the mapping relationship between the first vertex position and the first texture position. Based on the mapping relationship, the preset texture is overlaid onto the surface of the building model, and a first visualization processing result for the building model is generated; The first vertex position includes the vertex horizontal position and the vertex vertical position, and the cumulative result includes the target cumulative value; the step of traversing the first vertex position, accumulating the preset initial cumulative value according to the result of each traversal to obtain the cumulative result, and obtaining the first texture position of the preset texture according to the cumulative result includes: If the vertical position of the vertex corresponding to the currently traversed vertex of the building model is detected to be 0, calculate the distance between the horizontal position of the currently traversed vertex and the horizontal position of the vertex corresponding to the previously traversed vertex, and calculate the base perimeter based on the distance. The vertices of the building model are traversed again, and the target cumulative value is obtained by accumulating the initial cumulative value and the horizontal position of the vertex corresponding to the currently traversed vertex. The texture horizontal position of the preset texture is calculated based on the correlation between the target cumulative value and the perimeter of the base. The vertical position of the preset texture is determined based on the vertical position of the vertex, and the first texture position is determined based on the horizontal position of the texture and the vertical position of the texture.
2. The model texturing processing method according to claim 1, characterized in that, Determining the mapping relationship between the first vertex position and the first texture position includes: Obtain a preset initial cache table; wherein, the initial cache table stores the mapping relationship between the position of the first vertex and a preset mapping value; The preset mapping value is updated based on the first texture position to obtain the target mapping value. The initial cache table is updated based on the target mapping value to obtain the current target cache table. The mapping relationship between the first vertex position and the first texture position is determined based on the current target cache table.
3. The model texturing processing method according to claim 2, characterized in that, After generating the first visualization result for the building model, the method further includes: Obtain the next building model, and the position of the second vertex of the next building model; Obtain the retrieval result for the second vertex position based on the current target cache table; If the search result indicates a successful search, the mapping relationship between the second vertex position and the first texture position of the preset map is determined according to the current target cache table; If the search result indicates that the search failed, the second texture position of the preset texture is calculated based on the cumulative information and the second vertex position, and the target cache table is updated based on the second texture position to obtain a new target cache table. The mapping relationship between the second vertex position and the second texture position is determined based on the new target cache table. Based on the mapping relationship, the preset texture is overlaid onto the surface of the next building model, and a second visualization processing result is generated for the next building model.
4. The model texture processing method according to claim 1, characterized in that, The cumulative result includes the target count value; The step of calculating the first texture position of the preset texture based on the preset cumulative information and the first vertex position further includes: Get the preset count value; The vertices of the building model are traversed. When the current vertex is reached, the initial cumulative value is accumulated based on the count value to obtain the target count value. The horizontal position of the preset texture is calculated based on the target count value. The vertical position of the preset texture is determined based on the first vertex position, and the first texture position is determined based on the texture horizontal position and the texture vertical position.
5. The model texture processing method according to claim 1, characterized in that, When there are at least two building models, applying the preset texture to the surface of the building model based on the mapping relationship includes: Obtain the regions where all the building models are located, and the corresponding identification information of the regions; Based on the mapping relationship and the identification information, the preset texture is applied to the surface of the building model within the corresponding area.
6. The model texturing processing method according to any one of claims 1 to 5, characterized in that, The step of obtaining the current building model and the position of the first vertex corresponding to each vertex in the building model includes: Obtain the data source for the current building model; The base vertex sorting result and height information are obtained from the data source, and the position of the first vertex is calculated by using a preset topology operator on the base vertex sorting result and the height information.
7. A model texture processing device, characterized in that, The device includes: an acquisition module, a mapping module, and a generation module; The acquisition module is used to acquire the current building model and the position of the first vertex corresponding to each vertex in the building model; The mapping module is used to traverse the first vertex position, accumulate the preset initial value according to the result of each traversal to obtain the cumulative result, obtain the first texture position of the preset texture according to the cumulative result, and determine the mapping relationship between the first vertex position and the first texture position. The generation module is used to cover the surface of the building model with the preset texture based on the mapping relationship, and generate a first visualization processing result for the building model; The first vertex position includes the vertex horizontal position and the vertex vertical position, and the cumulative result includes the target cumulative value; the step of traversing the first vertex position, accumulating the preset initial cumulative value according to the result of each traversal to obtain the cumulative result, and obtaining the first texture position of the preset texture according to the cumulative result includes: If the vertical position of the vertex corresponding to the currently traversed vertex of the building model is detected to be 0, calculate the distance between the horizontal position of the currently traversed vertex and the horizontal position of the vertex corresponding to the previously traversed vertex, and calculate the perimeter of the base based on the distance. The vertices of the building model are traversed again, and the target cumulative value is obtained by accumulating the initial cumulative value and the horizontal position of the vertex corresponding to the currently traversed vertex. The texture horizontal position of the preset texture is calculated based on the correlation between the target cumulative value and the perimeter of the base. The vertical position of the preset texture is determined based on the vertical position of the vertex, and the first texture position is determined based on the horizontal position of the texture and the vertical position of the texture.
8. A model texturing processing system, characterized in that, The system includes: terminal devices and servers; The terminal device is used to acquire a preset texture and send the preset texture to the server; The server is used to execute the model texture processing method as described in any one of claims 1 to 6.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the model mapping processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method, device and terminal for acquiring building model in navigation map
CN109448095A
Texture mapping method and device of three-dimensional model, storage medium and computer equipment
CN112802172A