A texture mapping manner, device, equipment and computer readable storage medium
By using texture classification and intelligent hierarchical bonding algorithms, the problems of visual deformation and clipping of textures on walls of different widths have been solved, achieving the best balance between visual effect and technical feasibility, and improving the visual performance and realism of the building facade.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG KELAN INFORMATION TECH CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-06-05
Smart Images

Figure CN121505130B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of texture bonding technology, and in particular to a texture bonding method, texture bonding device, texture bonding equipment, and computer-readable storage medium. Background Technology
[0002] Texture lamination technology is the core technology for achieving the visual effect of vector data stretched into a block facade. Existing texture lamination technologies mainly employ two schemes: single-texture stretching and repeated lamination. The single-texture stretching scheme uses a single texture to stretch and laminate the entire facade, adjusting the UV coordinates (texture coordinates) to ensure the texture covers the entire wall width. However, when the wall width differs significantly from the texture's reference width, this scheme suffers from visual distortion. The repeated lamination scheme repeatedly lays the texture according to its original size, trimming any excess. However, when the wall width is not an integer multiple of the texture width, this scheme suffers from texture trimming. Both schemes' problems affect the final visual realism and user experience. Therefore, how to avoid visual distortion and texture trimming problems when vector data stretched into a block facade and lamination onto walls of different widths, and achieve optimal texture allocation and visual effect, is a technical problem that those skilled in the art need to solve. Summary of the Invention
[0003] The purpose of this application is to provide a texture bonding method, texture bonding device, texture bonding equipment, and computer-readable storage medium to avoid visual distortion and texture clipping problems that occur when vector data is stretched and bonded to wall surfaces of different widths, thereby achieving optimized texture allocation and visual effects.
[0004] To achieve the above objectives, this application provides a texture bonding method, including:
[0005] Step 1: Define different levels of textures; the textures of different levels have the same height;
[0006] Step 2: Based on the actual height of the facade and the actual height of the texture, perform height division processing to obtain the height division result; the height division result includes the number of times the texture is repeated in the height direction, the height stretching coefficient, and the texture width correction rule;
[0007] Step 3: Set the current position and target width of the texture to be attached to the facade, as well as the current level of the texture; according to the height division result, allocate the complete texture of the current level, and after the first width allocation process is completed, based on the stretching threshold range to control whether to trigger the degradation mechanism, perform different width allocation processes on the remaining width to obtain the width allocation result;
[0008] Step 4: Map and render the texture based on the height division result and the width allocation result.
[0009] Optionally, step 1 includes:
[0010] Step 11: Establish a four-level texture classification system, classifying the textures into four levels: primary texture, secondary texture, auxiliary texture, and base texture, in a manner that progressively decreases the resolution and content complexity.
[0011] Step 12: Establish a graded resolution standard based on the balance between visual perception and rendering efficiency; the graded resolution standard includes:
[0012] The texture width relationship satisfies the following conditions: the width of the main texture is not less than twice the width of the secondary texture, twice the width of the secondary texture is not less than four times the width of the auxiliary texture, and four times the width of the auxiliary texture is not less than eight times the width of the bottom texture.
[0013] The texture height relationship satisfies that the textures of different levels have the same height.
[0014] Optionally, step 1 further includes:
[0015] Step 13: Control the main color deviation of the texture at each level to less than 5;
[0016] And / or, control the surface roughness variation of the texture at adjacent levels within Within the range;
[0017] And / or, control the visual detail contained in adjacent higher-level textures to be 1.5 to 2 times that of the visual detail contained in lower-level textures;
[0018] And / or, set the edges of all said textures to use a seamless bonding technique.
[0019] Optionally, step 1 may be followed by:
[0020] Step 5: Determine the applicable scope of each level of texture, so as to select the corresponding texture in step 3 according to the applicable scope of each level of texture.
[0021] Optionally, step 5 includes:
[0022] Step 51: Obtain the actual width of the highest-level texture as the width reference parameter, and obtain the pixel width of each level of texture;
[0023] Step 52: Determine the actual width of each texture level based on the pixel width of each texture level and the width reference parameter;
[0024] Step 53: Determine the applicable range of each level of texture based on the actual width of each level of texture.
[0025] Optionally, step 2 includes:
[0026] Step 21: Obtain the actual height of the facade and the actual height of the texture;
[0027] Step 22: Determine the number of times the texture is repeated in the height direction based on the actual height of the facade and the actual height of the texture;
[0028] Step 23: Determine the height stretching coefficient based on the actual height of the facade, the actual height of the texture, and the number of times the texture is repeated in the height direction;
[0029] Step 24: Establish the texture width correction rule based on the height stretching coefficient and the actual width of the texture.
[0030] Optionally, step 4 includes:
[0031] Step 41: Determine the V coordinate of the texture based on the number of times the texture repeats in the height direction and the height stretching coefficient in the height division result;
[0032] Based on the width allocation result, determine the U-coordinate mapping relationship of the texture for each segment in the width direction;
[0033] Step 42: At the junction of textures of different levels, edge pixel blending technology is used to perform seamless splicing to complete the rendering.
[0034] Optionally, step 3 includes:
[0035] Step 31: Based on the height stretching coefficient and the texture width correction rule, correct the actual width of the texture at the current level to obtain the corrected base width of the texture at the current level;
[0036] Step 32: Determine the number of complete textures of the current level that can be allocated based on the current position, the target width, and the base width of the texture at the current level; after allocation, update the current position and determine the final remaining width;
[0037] Step 33: When the final remaining width is greater than 0, determine the width stretching ratio value based on the final remaining width and the reference width of the texture at the current level;
[0038] When the width stretch ratio is within the stretch threshold range, the texture of the current level is used to stretch and fit the final remaining width to obtain the width allocation result;
[0039] When the width stretching ratio exceeds the stretching threshold range, the texture of the current level is downgraded, and then the process returns to step 32 until the final remaining width is equal to 0, thus obtaining the width allocation result.
[0040] Optionally, when the downgraded texture is at the lowest level, step 33 further includes:
[0041] When the final remaining width is greater than 0, the lowest level of texture is used to stretch and fit the final remaining width to obtain the width allocation result.
[0042] To achieve the above objectives, this application also provides a texture bonding device, comprising:
[0043] The texture grading definition module is used to perform step 1: define textures of different grades; the textures of different grades have the same height;
[0044] The height division processing module is used to perform step 2: perform height division processing based on the actual height of the facade and the actual height of the texture to obtain the height division result; the height division result includes the number of times the texture is repeated in the height direction, the height stretching coefficient, and the texture width correction rule;
[0045] The width allocation processing module is used to perform step 3: set the current position and target width of the texture to be attached to the facade, as well as the current level of the texture; allocate the complete texture of the current level according to the height division result; and after the first width allocation processing is completed, control whether to trigger the degradation mechanism based on the stretching threshold range to perform different width allocation processing on the remaining width to obtain the width allocation result.
[0046] The mapping and rendering module is used to perform step 4: mapping and rendering the texture based on the height division result and the width allocation result.
[0047] To achieve the above objectives, this application also provides a texture bonding device, comprising:
[0048] Memory, used to store computer programs;
[0049] A processor for executing the computer program to implement the steps of the texture bonding method as described above.
[0050] To achieve the above objectives, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the texture bonding method described above.
[0051] Clearly, the texture bonding method provided in this application effectively solves the key defects of the prior art by establishing a texture classification system and an intelligent hierarchical bonding algorithm:
[0052] First, to address the visual distortion problem caused by stretching a single texture, by setting a stretching threshold range, the texture stretching ratio can be controlled within an acceptable range (usually within 20%). When the stretching threshold range is exceeded, a more suitable texture level is automatically downgraded, thereby avoiding severe texture distortion and maintaining the true proportional relationship of architectural elements.
[0053] Secondly, to address the risk of texture clipping at the edges in the repetitive bonding mode, a strategy of prioritizing the allocation of complete texture units is adopted to minimize the area that needs to be clipped. Even if there are remaining parts, the remaining width is allocated differently by controlling whether to trigger a degradation mechanism based on the stretching threshold range, thus ensuring visual continuity and avoiding the problem of irregularly cutting off architectural elements.
[0054] Therefore, this application can intelligently select the optimal combination of texture levels according to the specific conditions of facades of different widths, achieving the best balance between visual effect and technical feasibility, and significantly improving the visual performance and realism of building facades.
[0055] This application also provides a texture bonding apparatus, device, and computer-readable storage medium, which have the aforementioned beneficial effects. Attached Figure Description
[0056] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0057] Figure 1 A flowchart illustrating a texture bonding method provided in an embodiment of this application;
[0058] Figure 2 This is a structural block diagram of a texture bonding device provided in an embodiment of this application. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0060] In 3D architectural visualization and game engines, vector data extrusion blocks refer to 3D geometric shapes formed by stretching 2D planar polygons along a vertical direction, often used to quickly generate architectural facade models. Texture lamination technology is the core technology for achieving visual facade effects, applying 2D texture images to 3D geometric surfaces through UV coordinate mapping. The quality of texture lamination directly affects the final visual realism and user experience. Existing texture lamination technologies mainly employ the following two approaches:
[0061] Option 1: Single Texture Stretching Solution. This solution uses a single texture to stretch and fit the entire facade, adjusting the UV coordinates to make the texture cover the entire wall width. The implementation steps are: (1) Obtain the wall width and the texture reference width; (2) Calculate the stretching ratio; (3) Adjust the UV coordinates to achieve stretching and fitting. However, when the wall width and the texture reference width differ significantly, an excessive stretching ratio will cause severe texture deformation. In particular, textures containing architectural elements such as windows and doors will show obvious horizontal or vertical compression / stretching, affecting visual realism. For example, when a standard texture of 4 meters wide is applied to a wall of 10 meters wide, the stretching ratio reaches 2.5 times, and the windows will be severely widened, completely losing their realism.
[0062] Option 2: Repeated Lamination Solution. This solution involves repeatedly tiling the texture according to its original size, with excess parts being trimmed. The implementation steps are: (1) Calculate the number of texture repetitions; (2) Tile the texture in integer multiples; (3) Trim and laminate the remaining width portion of the texture. However, when the wall width is not an integer multiple of the texture width, texture trimming is required at the edges, which will cause architectural elements (such as windows and doors) to be irregularly cut off, resulting in visual discontinuity and abruptness. At the same time, the repeated texture pattern will produce obvious repetition marks on wider walls, reducing the naturalness of the visual effect.
[0063] Therefore, this application provides a texture bonding method that can intelligently select the appropriate texture level according to the width of the facade, avoid excessive stretching and deformation and edge clipping problems, and achieve a graded bonding method with optimal texture distribution for facades of different widths, thereby significantly improving the visual performance and realism of the building facade.
[0064] This application can be applied to fields such as 3D building visualization, urban planning display, game engine, virtual reality, and Building Information Modeling (BIM).
[0065] Please refer to Figure 1 , Figure 1 A flowchart illustrating a texture bonding method provided in this application embodiment, the method may include:
[0066] Step 1: Define different levels of textures; textures of different levels have the same height.
[0067] This embodiment does not limit the specific way of defining different texture levels. It can be determined according to the actual application scenario, as long as it can ensure that different texture levels can be distinguished. For example, the following methods can be used:
[0068] Step 11: Establish a four-level texture classification system, classifying textures into four levels: primary texture, secondary texture, auxiliary texture, and base texture, based on a progressively decreasing resolution and content complexity.
[0069] The main texture is a high-resolution composite texture, which can contain wall combinations of 2 to 4 complete window units. It is suitable for wide building walls to showcase a complete sense of architectural rhythm.
[0070] Subtexture is a medium-resolution unit texture that can contain a complete window unit and its surrounding walls. It is suitable for medium-width walls and maintains the integrity of basic architectural elements.
[0071] Auxiliary textures simplify the texture of high-resolution materials. They can include pure wall materials, which do not include window elements. They can include details such as brick joints and material textures. They are suitable for narrower walls to ensure the continuity of the wall texture.
[0072] The base texture is the lowest resolution basic texture, which can contain flat textures with a uniform tone, retain basic material properties (such as color and roughness), and does not include line styles. It is suitable for extremely narrow walls and transition areas.
[0073] It should be noted that, through the above-described method of dividing textures, a four-level texture classification system can be established. Each level of texture has different resolutions, content complexity, and applicable scenarios, and can correspond to different applicable width ranges.
[0074] Step 12: Establish a hierarchical resolution standard based on the balance between visual perception and rendering efficiency; the hierarchical resolution standard includes: texture width relationship: the width of the primary texture is not less than twice the width of the secondary texture, twice the width of the secondary texture is not less than four times the width of the auxiliary texture, and four times the width of the auxiliary texture is not less than eight times the width of the base texture; texture height relationship: textures of different levels have the same height.
[0075] It should be noted that in this embodiment, different levels of texture maintain a uniform facade height standard.
[0076] Furthermore, step 1 in this embodiment may also include:
[0077] Step 13: Control the main color deviation of each texture level to less than 5 (i.e. It should be noted that, It is CIE ( The color difference standard established by the International Commission on Illumination (ICI) ensures color consistency by setting this texture quality control standard.
[0078] And / or, control the surface roughness variation of adjacent texture levels within Within the specified range; it should be noted that setting this texture quality control standard can ensure material consistency;
[0079] And / or, control the visual detail contained in adjacent high-level textures to be 1.5 to 2 times that of low-level textures; it should be noted that setting this texture quality control standard can satisfy the principle of diminishing detail.
[0080] And / or, set all texture edges to use seamless bonding technology; it should be noted that setting this texture quality control standard and processing the texture edges can avoid obvious repeated splicing marks.
[0081] Furthermore, in this embodiment, step 1 may be followed by:
[0082] Step 5: Determine the applicable scope of each texture level so that the corresponding texture can be selected in step 3 according to the applicable scope of each texture level.
[0083] This embodiment does not limit the specific method of determining the scope of application, as long as it ensures that the scope of application for different levels of texture can be determined separately. For example, it may include:
[0084] Step 51: Obtain the actual width of the highest-level texture as the width baseline parameter, and obtain the pixel width of each level of texture.
[0085] Step 52: Determine the actual width of each texture level based on the pixel width and width reference parameters of each texture level.
[0086] In this embodiment, the actual width of each level of texture may include:
[0087] The actual width of the highest-level texture is based on the width parameter;
[0088] The actual width of each remaining level of texture is the product of the ratio of the pixel width of each remaining level of texture to the pixel width of the highest level texture and the width baseline parameter.
[0089] Step 53: Determine the applicable range of each texture level based on the actual width of each texture level.
[0090] It should be noted that the applicable scope in this embodiment refers to the range of width of the facade to which the texture can be applied.
[0091] The applicable scope of each level of texture in this embodiment can include:
[0092] The applicable range of the highest-level texture is no less than the actual width of the highest-level texture;
[0093] The applicable range of each remaining level of texture is from the actual width of the texture of that remaining level to the actual width of the texture of the adjacent higher level, excluding the value at the right end.
[0094] It should be noted that this embodiment adopts the above-mentioned reference width parameterized grading mechanism. Based on the reference width parameter a, it establishes a grading application range such as a, a / 2, a / 4 to achieve intelligent matching between texture level and wall width. This can ensure that each texture can maintain the best visual proportion relationship within its corresponding real width range. Moreover, the adjustment of the width reference parameter can adapt to the architectural scale requirements of different projects.
[0095] Step 2: Based on the actual height of the facade and the actual height of the texture, perform height division processing to obtain the height division result; the height division result includes the number of times the texture repeats in the height direction, the height stretching coefficient, and the texture width correction rule.
[0096] This embodiment does not limit the specific method of performing height division, as long as the desired height division result can be obtained. For example, the following method can be used:
[0097] Step 21: Obtain the actual height of the facade and the actual height of the texture.
[0098] It should be noted that the actual height of the facade refers to its height in the real world; the actual height of the texture refers to its height in the real world; textures of different levels have the same actual height.
[0099] Step 22: Determine the number of times the texture is repeated in the height direction based on the actual height of the facade and the actual height of the texture.
[0100] In this embodiment, step 22 may include:
[0101] Substituting the actual height and the actual height into the repetition count expression, we determine the number of times the texture repeats in the height direction; the repetition count expression is:
[0102] ;
[0103] In the formula, Indicates the number of times the texture is repeated in the height direction; Indicates the actual height of the facade; Indicates the actual height of the texture; This represents the ratio of the actual height of the facade to the actual height of the texture, rounded to the nearest integer.
[0104] Step 23: Determine the height stretch factor based on the actual height of the facade, the actual height of the texture, and the number of times the texture is repeated in the height direction.
[0105] In this embodiment, step 23 may include:
[0106] Substituting the actual height of the facade, the actual height of the texture, and the number of times the texture repeats in the height direction into the height stretching coefficient expression, the height stretching coefficient is determined; the height stretching coefficient expression is:
[0107] ;
[0108] In the formula, Indicates the elongation factor; Indicates the number of times the texture is repeated in the height direction; Indicates the actual height of the facade; Indicates the actual height of the texture.
[0109] Step 24: Establish texture width correction rules based on the height stretch factor and the actual width of the texture.
[0110] The texture width correction rule in this embodiment is as follows:
[0111] ;
[0112] In the formula, Indicates the base width of the texture; This represents the actual width of the texture, which refers to the width of the texture in the real world. Indicates the elongation factor.
[0113] It should be noted that the above-mentioned height division process in this embodiment can ensure that there is no remaining space in the height direction and that all texture units are stretched and fitted evenly. At the same time, due to the existence of the height stretching coefficient, the effective reference width of the texture in the width direction needs to be adjusted accordingly. The actual width of the texture is corrected based on the height stretching coefficient. This correction can ensure that the texture maintains a coordinated stretching ratio in both the width and height dimensions, avoiding visual distortion.
[0114] Step 3: Set the current position and target width of the texture to be applied in the facade, as well as the current level of the texture; based on the height division result, allocate the complete texture of the current level, and after the first width allocation process is completed, control whether to trigger the degradation mechanism based on the stretching threshold range, and perform different width allocation processes on the remaining width to obtain the width allocation result.
[0115] It should be noted that the current position in this embodiment is the position within the facade, and the target width is the actual width of the facade, which refers to the width of the facade in the real world.
[0116] This embodiment does not limit the specific method of width allocation processing, as long as the desired width allocation result can be obtained. For example, the following methods can be used:
[0117] Step 31: Based on the height stretching factor and texture width correction rules, correct the actual width of the texture at the current level to obtain the corrected base width of the texture at the current level.
[0118] In this embodiment, step 31 may include:
[0119] Based on the current level of the texture, obtain the actual width of the texture at the current level;
[0120] Get the height stretch factor of the texture at the current level; this height stretch factor is determined based on the actual height of the facade.
[0121] Substitute the actual width and height stretch factor of the current level texture into the texture width correction rule to obtain the corrected base width of the current level texture.
[0122] Step 32: Determine the number of complete textures of the current level that can be allocated based on the current position, target width, and base width of the texture of the current level; after allocation, update the current position and determine the final remaining width.
[0123] Step 32 in this embodiment may include:
[0124] Step 321: Determine the remaining width based on the current position and the target width.
[0125] In this embodiment, step 321 may include:
[0126] Substitute the current position and target width into the remaining width expression to determine the remaining width; the remaining width expression is:
[0127] ;
[0128] In the formula, Indicates the remaining width; P represents the target width; P represents the current position before the update.
[0129] Step 322: Determine the number of complete textures that can be allocated to the remaining width based on the remaining width and the baseline width of the texture at the current level.
[0130] In this embodiment, step 322 may include:
[0131] Substitute the remaining width and the baseline width of the texture at the current level into the texture quantity expression to determine the total number of textures that can be allocated to the remaining width; the texture quantity expression is:
[0132] ;
[0133] In the formula, N represents the number of textures; Indicates the remaining width; Indicates the base width of the texture at the current level; This indicates that the ratio of the remaining width to the base width of the texture at the current level is rounded down.
[0134] Step 323: After allocating the complete textures according to the number of textures, update the current position.
[0135] In this embodiment, step 323 may include:
[0136] Substitute the current position before the update, the number of textures, and the baseline width of the texture at the current level into the update position expression to determine the current position after the update; the update position expression is:
[0137] ;
[0138] In the formula, P represents the current position after the update; P represents the current position before the update; N represents the number of textures. Indicates the base width of the texture at the current level.
[0139] Step 324: Determine the final remaining width based on the current position.
[0140] In this embodiment, step 324 may include:
[0141] Substitute the current position and target width before the update into the final remaining width expression to determine the final remaining width; the final remaining width expression is:
[0142] ;
[0143] In the formula, Indicates the final remaining width. Indicates the target width; This indicates the current position after the update.
[0144] It should be noted that in this embodiment, when the final remaining width is equal to 0, the width allocation result is obtained directly; when the final remaining width is greater than 0, it is necessary to continue to fit the remaining width.
[0145] In this embodiment, the step of determining the width stretching ratio based on the final remaining width and the baseline width of the texture at the current level may include:
[0146] Substitute the final remaining width and the baseline width of the texture at the current level into the width stretch ratio expression to determine the width stretch ratio; the width stretch ratio expression is:
[0147] ;
[0148] In the formula, R represents the width stretch ratio; Indicates the final remaining width; Indicates the base width of the texture at the current level.
[0149] It should be noted that this embodiment uses a hierarchical bonding algorithm with decreasing priority: it starts by attempting to allocate textures from the highest level, giving priority to using complete textures, and then determines whether to downgrade the remaining parts by stretching the threshold range.
[0150] Step 33: When the final remaining width is greater than 0, determine the width stretching ratio based on the final remaining width and the base width of the texture at the current level;
[0151] When the width stretch ratio is within the stretch threshold range, the current level of texture is used to stretch and fit the final remaining width to obtain the width allocation result;
[0152] When the width stretching ratio exceeds the stretching threshold, the texture of the current level is downgraded, and then the process returns to step 32 until the final remaining width is equal to 0, thus obtaining the width allocation result.
[0153] It should be noted that the stretching threshold range in this embodiment is preset to control the degree of deformation of the texture in the width direction, that is, it also includes the following before step 3:
[0154] Step 6: Set the stretch threshold range.
[0155] This embodiment does not limit the specific method of setting the stretching threshold range; it can be determined based on the degree of deformation of the texture in the width direction. For example, the stretching threshold range can be... ;in, This is the lower threshold, which can be 0.8, to prevent excessive texture compression that could lead to loss of detail. The upper limit threshold can be 1.2 to prevent excessive stretching of textures from causing visual distortion.
[0156] It should be noted that in this embodiment, setting the above-mentioned stretching threshold range can control the stretching deformation of the texture in the width direction to within 20%, thus maintaining a reasonable proportion of the architectural elements.
[0157] It should be noted that step 33 in this embodiment is based on the width stretching ratio and the stretching threshold range to determine the texture level:
[0158] 1) If This allows the current level of texture to continue being used for stretching and fitting;
[0159] 2) If If this happens, the texture degradation mechanism is triggered, and the next lower level texture is used.
[0160] During the downgrade process, the applicability of the next texture level needs to be recalculated to ensure that the final selected texture level meets the stretching control requirements.
[0161] It should be noted that the stretching threshold control mechanism described above in this embodiment can ensure that the stretching deformation of the texture in the width direction is always controlled within the visually acceptable range; while the height stretching width correction mechanism described above takes into account the influence of height stretching on the width reference.
[0162] Furthermore, when the downgraded texture is the lowest level, step 33 in this embodiment also includes: when the final remaining width is greater than 0, using the lowest level texture to stretch and fit the final remaining width to obtain the width allocation result.
[0163] It should be noted that this embodiment employs an integrity guarantee mechanism: when downgraded to the lowest level texture (such as a base texture), the special processing steps of unconditional bonding of the lowest level texture can ensure that any width of facade can obtain complete texture coverage.
[0164] Step 4: Map and render the texture based on the height division and width allocation results.
[0165] This embodiment does not limit the specific method of mapping, as long as the UV coordinates of the texture can be determined. For example, the following method can be used:
[0166] Step 41: Determine the V coordinate of the texture based on the number of times the texture repeats in the height direction and the height stretching coefficient in the height division result;
[0167] Based on the width allocation results, determine the U-coordinate mapping relationship of the texture of each segment in the width direction.
[0168] It should be noted that the mapping method described above in this embodiment can ensure that the UV coordinates are within the specified range. Correct mapping within the range to avoid texture overflow.
[0169] This embodiment does not limit the specific rendering method, as long as seamless stitching can be achieved. For example, the following methods can be used:
[0170] Step 42: Use edge pixel blending technology to seamlessly stitch together the edges of textures at different levels to complete the rendering.
[0171] It should be noted that the above rendering method is used in this embodiment to avoid obvious dividing lines between textures.
[0172] Based on the above embodiments, this application effectively solves the key defects of the prior art by establishing a texture classification system and an intelligent hierarchical bonding algorithm:
[0173] First, to address the visual distortion problem caused by stretching a single texture, by setting a stretching threshold range, the texture stretching ratio can be controlled within an acceptable range (usually within 20%). When the stretching threshold range is exceeded, a more suitable texture level is automatically downgraded, thereby avoiding severe texture distortion and maintaining the true proportional relationship of architectural elements.
[0174] Secondly, to address the risk of texture clipping at the edges in the repetitive bonding mode, a strategy of prioritizing the allocation of complete texture units is adopted to minimize the area that needs to be clipped. Even if there are remaining parts, the remaining width is allocated differently by controlling whether to trigger a degradation mechanism based on the stretching threshold range, thus ensuring visual continuity and avoiding the problem of irregularly cutting off architectural elements.
[0175] Therefore, this application can intelligently select the optimal combination of texture levels according to the specific conditions of facades of different widths, achieving the best balance between visual effect and technical feasibility, and significantly improving the visual performance and realism of building facades.
[0176] This application also provides the following three alternative solutions:
[0177] Alternative Solution 1: Dynamic Texture Generation. This solution employs procedural texture generation technology to generate textures that adapt to the wall width in real time. Specifically, it involves pre-setting basic texture element templates (such as windows, walls, and doors) and dynamically combining them to generate perfectly matching textures based on the wall width. This solution avoids stretching issues but requires complex procedural algorithms and significant computational resources.
[0178] Alternative Solution 2: Multi-scale texture library solution. This solution establishes a finer-grained texture library, pre-creating specialized textures for each possible wall width range. For example, one set of textures corresponds to each 0.5-meter width range. This solution provides more accurate adaptation, but significantly increases the storage requirements and management complexity of texture resources.
[0179] Alternative Solution 3: Hybrid Interpolation Blending. This solution uses interpolation blending between adjacent texture levels for a smoother transition, weighting the blending between the two textures based on the actual width. This solution provides a smoother visual transition but increases the complexity of rendering calculations and the burden on the GPU (Graphics Processing Unit).
[0180] While the above alternatives may have advantages in some aspects, they are not as simple and efficient as the texture bonding method provided in the above embodiments in terms of resource consumption, implementation complexity, and versatility.
[0181] The texture bonding process described above is illustrated below with a specific example. The process is as follows:
[0182] Step 1, Texture Hierarchy Definition Module:
[0183] 1.1 Texture Content Hierarchy System:
[0184] A four-level texture classification system is established, with each level having different resolutions, content complexities, and applicable scenarios:
[0185] Main texture: High-resolution composite texture, which can contain wall combinations of 2-4 complete window units, suitable for wide building walls to show a complete sense of architectural rhythm;
[0186] Subtexture: Medium-resolution unit texture, which can contain a complete window unit and its surrounding walls, suitable for medium-width walls, maintaining the integrity of basic architectural elements;
[0187] Secondary textures: Simplify the texture of resolution materials. They can include pure wall materials, which do not include window elements. They can include details such as brick joints and material textures. They are suitable for narrower walls to ensure the continuity of the wall texture.
[0188] Base texture: The lowest resolution base texture, which can contain flat textures with a uniform tone, retain basic material properties (such as color and roughness), and does not include line styles. It is suitable for extremely narrow walls and transition areas.
[0189] 1.2 Resolution Specification System:
[0190] Based on a balance between visual perception and rendering efficiency, a graded resolution standard is established; the graded resolution standard includes:
[0191] Main texture resolution: Pixel;
[0192] Subtexture resolution: Pixel;
[0193] Secondary texture resolution: Pixel;
[0194] Background texture resolution: Pixel;
[0195] Texture width relationships can follow: ;
[0196] Texture height relationships can follow: (The height of different grades of texture is almost exactly the same to maintain a uniform facade height standard).
[0197] 1.3 Texture quality control standards:
[0198] Color consistency: Control the main color deviation of each level of texture within... ;
[0199] Material continuity: controlling the surface roughness variation between adjacent texture levels within a certain range. Within the range;
[0200] The principle of diminishing detail: control the visual detail contained in adjacent high-level textures to be 1.5 to 2 times that of low-level textures;
[0201] Edge processing: All texture edges are set to use seamless bonding technology; this avoids obvious repetitive splicing marks.
[0202] The second step is the algorithm for defining the scope of application.
[0203] 2.1. Reference Parameter Setting:
[0204] Obtain the real-world width of the main texture and set it as the width baseline parameter a (meters) to serve as the real-world metric for texture grading; simultaneously obtain the pixel width specifications for each texture level:
[0205] Main texture pixel width: (pixels);
[0206] Subtexture pixel width: (pixels);
[0207] Secondary texture pixel width: (pixels);
[0208] Bottom texture pixel width: (pixels).
[0209] 2.2 Calculation of texture display width:
[0210] Calculate the actual width corresponding to each texture level based on the pixel width of each texture level and the width reference parameter 'a':
[0211] Main texture display width: (rice);
[0212] Subtexture real width: rice;
[0213] Auxiliary texture real width: rice;
[0214] Background texture actual width: rice.
[0215] 2.3 Defining the Scope of Dynamic Application:
[0216] Based on the calculated actual widths of each texture level, the applicable facade width W range for each texture level is determined:
[0217] Main texture applicable scope: ;
[0218] Subtexture application scope: ;
[0219] Scope of application for auxiliary textures: ;
[0220] Scope of application for background texture: ;
[0221] The above grading method can ensure that each texture can maintain the best visual proportion within its corresponding real-world width range; moreover, the adjustment of the width reference parameter can adapt to the architectural scale requirements of different projects.
[0222] Step 3: Mechanism for equal division of height dimensions:
[0223] 3.1 Algorithm for equal height division:
[0224] 1) Obtain the actual height of the facade and the realistic height of the texture ;
[0225] 2) Calculate the number of times the texture repeats in the height direction (using rounding): ;
[0226] 3) Calculate the equal-division stretch factor of the texture in the height direction (referred to as the height stretch factor): ;
[0227] The above-mentioned height division process ensures that there is no remaining space in the height direction, and all texture units are stretched and fitted evenly;
[0228] 3.2 The impact of height stretching on width calculation:
[0229] Due to the high elongation coefficient The existence of this necessitates adjusting the effective reference width of the texture in the width direction accordingly: A texture width correction rule is established based on the height stretching factor and the actual width of the texture; the texture width correction rule is as follows:
[0230] ;
[0231] This correction ensures that the texture maintains a consistent stretch ratio in both width and height dimensions, avoiding visual distortion.
[0232] Step 4, Stretch threshold control mechanism:
[0233] 4.1 Setting the basic stretching threshold:
[0234] Set texture stretching threshold range This is used to control the degree of texture deformation in the width direction:
[0235] Set a lower threshold (which can be 0.8) to prevent excessive texture compression that could lead to loss of detail.
[0236] The upper limit threshold (which can be 1.2) is set to prevent excessive stretching of the texture from causing visual distortion.
[0237] Threshold range design principle: Control the stretching deformation of texture in the width direction to within 20% to maintain a reasonable proportion of architectural elements.
[0238] 4.2 Calculation of width stretch ratio:
[0239] Calculate the width stretch ratio based on the height-corrected baseline width:
[0240] Width stretch ratio: ;
[0241] in, For the remaining width, The current texture level baseline width after high-level correction.
[0242] 4.3. Graded Degradation Judgment Mechanism:
[0243] Texture level selection is based on width stretching ratio and stretching threshold range:
[0244] 1) If This allows the current level of texture to continue being used for stretching and fitting;
[0245] 2) If If this happens, the texture degradation mechanism is triggered, and the next lower level texture is used.
[0246] During the downgrade process, the applicability of the next texture level needs to be recalculated to ensure that the final selected texture level meets the stretching control requirements.
[0247] This mechanism ensures that the stretching deformation of the texture in the width direction is always controlled within a visually acceptable range; while the height stretching to width correction mechanism mentioned above takes into account the impact of height stretching on the width reference.
[0248] Step 5: Hierarchical Fitting Core Algorithm
[0249] 5.1 Initialization: Set the current position Target width The current texture level of the texture. (Main texture);
[0250] 5.2 Obtaining Texture Level Parameters:
[0251] 1) Based on the current texture level, obtain the actual width of the texture at the current level: ;
[0252] 2) Based on the actual height of the facade Calculate the height stretch factor of the texture at the current level. ;
[0253] 3) Calculate the base width of the texture at the corrected current level: ;
[0254] 5.3 Texture Allocation Cycle:
[0255] 1) Calculate the remaining width ;
[0256] 2) Calculate the number of complete textures that can be allocated to the remaining width: ;
[0257] 3) After allocating N complete textures, update the position; the updated current position. ;
[0258] 4) Calculate the final remaining width ;
[0259] 5.4. Handling of the remaining parts:
[0260] 1) If The algorithm ends;
[0261] 2) If Calculate the width stretch ratio. ;
[0262] 3) If The algorithm ends when the texture of the current level is stretched and fitted to the final remaining width.
[0263] 4) If R exceeds the threshold range, downgrade the texture of the current level. ), return to step 5.2, until The algorithm ends;
[0264] 5.5 Special processing: When downgrading to the bottom texture, unconditionally fit all remaining widths to ensure complete coverage.
[0265] Step 6: Texture Mapping and Rendering Implementation
[0266] 6.1 Calculation of two-dimensional UV coordinates:
[0267] 1) Height-direction UV calculation: Calculate the V coordinate of the texture based on the number of times the texture repeats in the height direction and the height stretching coefficient in the height division result;
[0268] 2) UV calculation in the width direction: Based on the width allocation results, calculate the precise U-coordinate mapping relationship for the texture of each segment in the width direction;
[0269] The above mapping method can ensure that the UV coordinates are in Correct mapping within the specified range to avoid texture overflow;
[0270] 6.2 Seamless splicing processing: Edge pixel fusion technology is used to seamlessly splice the textures at the junctions of different texture levels, avoiding obvious dividing lines between textures.
[0271] The following describes a texture bonding apparatus, device, and computer-readable storage medium provided in the embodiments of this application. The texture bonding apparatus, device, and computer-readable storage medium described below can be referred to in correspondence with the texture bonding method described above.
[0272] Please refer to Figure 2 , Figure 2 This application provides a structural block diagram of a texture bonding device, which may include:
[0273] Texture grading definition module 100 is used to perform step 1: define textures of different grades; textures of different grades have the same height;
[0274] The height division processing module 200 is used to perform step 2: perform height division processing based on the actual height of the facade and the actual height of the texture to obtain the height division result; the height division result includes the number of times the texture is repeated in the height direction, the height stretching coefficient, and the texture width correction rule;
[0275] The width allocation processing module 300 is used to perform step 3: set the current position and target width of the texture to be attached in the facade, as well as the current level of the texture; allocate the complete texture of the current level according to the height division result, and after the first width allocation processing is completed, control whether to trigger the degradation mechanism based on the stretching threshold range, and perform different width allocation processing on the remaining width to obtain the width allocation result;
[0276] The mapping and rendering module 400 is used to perform step 4: mapping and rendering the texture based on the height division result and the width allocation result.
[0277] Based on the above embodiments, step 1 may include:
[0278] Step 11: Establish a four-level texture classification system, classifying textures into four levels: primary texture, secondary texture, auxiliary texture, and base texture, in a manner that progressively decreases in resolution and content complexity.
[0279] Step 12: Establish a graded resolution standard based on the balance between visual perception and rendering efficiency; the graded resolution standard includes:
[0280] The texture width relationship satisfies the following conditions: the width of the primary texture is not less than twice the width of the secondary texture, twice the width of the secondary texture is not less than four times the width of the auxiliary texture, and four times the width of the auxiliary texture is not less than eight times the width of the base texture.
[0281] Texture height relationships satisfy the requirement that textures of different levels have the same height.
[0282] Based on the above embodiments, step 1 may further include:
[0283] Step 13: Control the main color deviation of each texture level to less than 5;
[0284] And / or, control the surface roughness variation of adjacent texture levels within Within the range;
[0285] And / or, control the visual detail contained in adjacent high-level textures to be 1.5 to 2 times that of low-level textures;
[0286] And / or, set all texture edges to use seamless bonding technology.
[0287] Based on the above embodiments, the texture classification definition module 100 can also be used to execute step 5 after step 1: determine the applicable scope of each level of texture, so as to select the corresponding texture in step 3 according to the applicable scope of each level of texture.
[0288] Based on the above embodiments, step 5 may include:
[0289] Step 51: Obtain the actual width of the highest-level texture as the width reference parameter, and obtain the pixel width of each level of texture;
[0290] Step 52: Determine the actual width of each texture level based on the pixel width and width reference parameters of each texture level;
[0291] Step 53: Determine the applicable range of each texture level based on the actual width of each texture level.
[0292] Based on the above embodiments, step 2 may include:
[0293] Step 21: Obtain the actual height of the facade and the actual height of the texture;
[0294] Step 22: Determine the number of times the texture is repeated in the height direction based on the actual height of the facade and the actual height of the texture;
[0295] Step 23: Determine the height stretch factor based on the actual height of the facade, the actual height of the texture, and the number of times the texture repeats in the height direction;
[0296] Step 24: Establish texture width correction rules based on the height stretch factor and the actual width of the texture.
[0297] Based on the above embodiments, step 4 may include:
[0298] Step 41: Determine the V coordinate of the texture based on the number of times the texture repeats in the height direction and the height stretching coefficient in the height division result;
[0299] Based on the width allocation results, determine the U-coordinate mapping relationship of the texture of each segment in the width direction;
[0300] Step 42: Use edge pixel blending technology to seamlessly stitch together the edges of textures at different levels to complete the rendering.
[0301] Based on the above embodiments, step 3 may include:
[0302] Step 31: Based on the height stretching factor and texture width correction rules, correct the actual width of the texture at the current level to obtain the corrected base width of the texture at the current level.
[0303] Step 32: Determine the number of complete textures of the current level that can be allocated based on the current position, target width, and base width of the texture at the current level; after allocation, update the current position and determine the final remaining width;
[0304] Step 33: When the final remaining width is greater than 0, determine the width stretching ratio based on the final remaining width and the base width of the texture at the current level;
[0305] When the width stretch ratio is within the stretch threshold range, the current level of texture is used to stretch and fit the final remaining width to obtain the width allocation result;
[0306] When the width stretching ratio exceeds the stretching threshold, the texture of the current level is downgraded, and then the process returns to step 32 until the final remaining width is equal to 0, thus obtaining the width allocation result.
[0307] Based on the above embodiments, step 33 may further include:
[0308] When the final remaining width is greater than 0, the lowest level of texture is used to stretch and fit the final remaining width to obtain the width allocation result.
[0309] Based on the above embodiments, this application also provides a texture bonding device, including: a memory and a processor, wherein the memory is used to store a computer program; the processor is used to execute the computer program to implement the steps of the texture bonding methods of the above embodiments. Of course, the texture bonding device may also include various necessary network interfaces, power supplies, and other components.
[0310] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the texture bonding methods described in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0311] This document uses specific examples to illustrate the principles and implementation methods of this application, and the various embodiments are progressively related. Each embodiment focuses on the differences from other embodiments, and similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, please refer to the corresponding method section description. The above description of the embodiments is only for helping to understand the method and core ideas of this application. For those skilled in the art, several improvements and modifications can be made to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of this application.
[0312] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
Claims
1. A texture bonding method, characterized in that, include: Step 1: Define different levels of textures; each level of texture has different resolutions, content complexity, and applicable scenarios; textures of different levels have the same realistic height; Step 2: Based on the actual height of the facade and the actual height of the texture, perform height division processing to obtain the height division result; the height division result includes the number of times the texture is repeated in the height direction, the height stretching coefficient, and the texture width correction rule; Step 3: Set the current position and target width of the texture to be attached to the facade, as well as the current level of the texture; according to the height division result, allocate the complete texture of the current level, and after the first width allocation process is completed, based on the stretching threshold range to control whether to trigger the degradation mechanism, perform different width allocation processes on the remaining width to obtain the width allocation result; Step 4: Map and render the texture based on the height division result and the width allocation result.
2. The texture bonding method according to claim 1, characterized in that, Step 1 includes: Step 11: Establish a four-level texture classification system, classifying the textures into four levels: primary texture, secondary texture, auxiliary texture, and base texture, in a manner that progressively decreases the resolution and content complexity. Step 12: Establish a graded resolution standard based on the balance between visual perception and rendering efficiency; the graded resolution standard includes: The texture width relationship satisfies the following conditions: the width of the main texture is not less than twice the width of the secondary texture, twice the width of the secondary texture is not less than four times the width of the auxiliary texture, and four times the width of the auxiliary texture is not less than eight times the width of the bottom texture. The texture height relationship satisfies that the textures of different levels have the same height.
3. The texture bonding method according to claim 1, characterized in that, Step 1 further includes: Step 13: Control the main color deviation of the texture at each level to less than 5; And / or, control the surface roughness variation of the texture at adjacent levels within Within the range; And / or, control the visual detail contained in adjacent higher-level textures to be 1.5 to 2 times that of the visual detail contained in lower-level textures; And / or, set the edges of all said textures to use a seamless bonding technique.
4. The texture bonding method according to claim 1, characterized in that, After step 1 and before step 3, the following is also included: Step 5: Determine the applicable scope of each level of texture, so as to select the corresponding texture in step 3 according to the applicable scope of each level of texture.
5. The texture bonding method according to claim 4, characterized in that, Step 5 includes: Step 51: Obtain the actual width of the highest-level texture as the width reference parameter, and obtain the pixel width of each level of texture; Step 52: Determine the actual width of each texture level based on the pixel width of each texture level and the width reference parameter; Step 53: Determine the applicable range of each level of texture based on the actual width of each level of texture.
6. The texture bonding method according to claim 1, characterized in that, Step 2 includes: Step 21: Obtain the actual height of the facade and the actual height of the texture; Step 22: Determine the number of times the texture is repeated in the height direction based on the actual height of the facade and the actual height of the texture; Step 23: Determine the height stretching coefficient based on the actual height of the facade, the actual height of the texture, and the number of times the texture is repeated in the height direction; Step 24: Establish the texture width correction rule based on the height stretching coefficient and the actual width of the texture.
7. The texture bonding method according to claim 1, characterized in that, Step 4 includes: Step 41: Determine the V coordinate of the texture based on the number of times the texture repeats in the height direction and the height stretching coefficient in the height division result; Based on the width allocation result, determine the U-coordinate mapping relationship of the texture for each segment in the width direction; Step 42: At the junction of textures of different levels, edge pixel blending technology is used to perform seamless splicing to complete the rendering.
8. The texture bonding method according to any one of claims 1 to 7, characterized in that, Step 3 includes: Step 31: Based on the height stretching coefficient and the texture width correction rule, correct the actual width of the texture at the current level to obtain the corrected base width of the texture at the current level; Step 32: Determine the number of complete textures of the current level that can be allocated based on the current position, the target width, and the base width of the texture at the current level; after allocation, update the current position and determine the final remaining width; Step 33: When the final remaining width is greater than 0, determine the width stretching ratio value based on the final remaining width and the reference width of the texture at the current level; When the width stretching ratio is within the stretching threshold range, the texture of the current level is used to stretch and fit the final remaining width to obtain the width allocation result; When the width stretching ratio exceeds the stretching threshold range, the texture of the current level is downgraded, and then the process returns to step 31 until the final remaining width is equal to 0, thus obtaining the width allocation result.
9. The texture bonding method according to claim 8, characterized in that, When the downgraded texture is at the lowest level, step 33 further includes: When the final remaining width is greater than 0, the lowest level of texture is used to stretch and fit the final remaining width to obtain the width allocation result.
10. A texture bonding device, characterized in that, include: The texture grading definition module is used to perform step 1: defining textures of different grades; each grade of texture has different resolutions, content complexity, and applicable scenarios; textures of different grades have the same real-world height; The height division processing module is used to perform step 2: perform height division processing based on the actual height of the facade and the actual height of the texture to obtain the height division result; the height division result includes the number of times the texture is repeated in the height direction, the height stretching coefficient, and the texture width correction rule; The width allocation processing module is used to perform step 3: set the current position and target width of the texture to be attached to the facade, as well as the current level of the texture; allocate the complete texture of the current level according to the height division result; and after the first width allocation processing is completed, control whether to trigger the degradation mechanism based on the stretching threshold range to perform different width allocation processing on the remaining width to obtain the width allocation result. The mapping and rendering module is used to perform step 4: mapping and rendering the texture based on the height division result and the width allocation result.
11. A texture bonding device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the texture bonding method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the texture bonding method as described in any one of claims 1 to 9.