Multi-model patching method based on texture blending accumulation, terminal and storage medium

By using a texture blending and accumulation method, the inefficiency of traditional multi-model sectioning and surface patching methods is solved, enabling efficient parallel rendering of large-scale models, adapting to a larger number of models, and requiring no source code modification in modern graphics engines, thus improving rendering efficiency and compatibility.

CN121392105BActive Publication Date: 2026-03-31ZHEJIANG HUADONG ENG DIGITAL TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-24
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In existing technologies, traditional multi-model cutting and surface patching methods are inefficient and cannot support large-scale models in modern graphics engines. Template buffering methods are limited by bit width and lack compatibility, making them difficult to apply directly in engines such as UE5.

Method used

It adopts a texture blending and accumulation method, generates an auxiliary model for double-sided rendering, records the pixel state of the patch plane, and uses the rendering texture blending and accumulation method to record the number of pixel coverages, supports parallel processing of large-scale models, and can adapt to a larger number of models.

Benefits of technology

It achieves efficient multi-model sectioning and surface patching, supports rendering of a large number of models, is compatible with modern graphics engines without modifying the source code, and improves rendering efficiency and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121392105B_ABST
    Figure CN121392105B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of three-dimensional graphics rendering, and particularly relates to a multi-model surface repairing method based on texture mixing and accumulation, a terminal and a storage medium, comprising the following steps: obtaining a model to be processed, generating a surface repairing plane and an auxiliary model; generating a rendering target texture and dividing a weight bit section; each model to be processed, the corresponding surface repairing plane and the auxiliary model correspond to the weight bit section one by one; the auxiliary model is double-sided rendered, and the weight step is accumulated to the rendering target texture; the fragment with an odd number of accumulation times is reserved, and the trimming of the surface repairing plane is completed. The present application records the pixel coverage times in the way of texture mixing and accumulation, so that the number of rendering target textures generated can be increased according to the number of models processed simultaneously, and a large number of models can be processed simultaneously.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of 3D graphics rendering technology, and in particular to a multi-model surface patching method based on texture blending and accumulation, a terminal, and a storage medium. Background Technology

[0002] With the continuous advancement of computer graphics and 3D modeling technology, dynamic sectioning and surface patching techniques for 3D models have been widely applied in numerous fields such as architectural design, virtual reality, medical imaging, geological surveying, and engineering visualization. Sectioning and surface patching can more intuitively display the internal structure of a model, helping users understand and analyze complex 3D data.

[0003] However, traditional sectioning and surface patching methods often require explicit sorting or multiple renderings of different models, resulting in low efficiency and difficulty in maintaining stable rendering results. Especially with the widespread adoption of parallel rendering and batch processing technologies in modern graphics engines, forcibly controlling the rendering order of models is not only costly and difficult, but also greatly affects the performance of sectioning and surface patching in dynamic multi-model scenes.

[0004] In the prior art, Chinese patent with publication number CN119919557A discloses a stencil buffer-based cutting and patching method. It achieves multi-model sharing by bit-inverting the stencil buffer, which achieves extremely high efficiency and accuracy. However, it is limited by the 8-bit precision of the stencil buffer and can only support a maximum of 8 models, which cannot fully support large-scale multi-models. In addition, in some modern graphics engines (such as UE5), the bit-inverting operation may require modification of the engine source code and recompilation, resulting in insufficient compatibility. Summary of the Invention

[0005] To overcome the problem that existing patching methods cannot support a large number of models due to the limitation of template buffer bit width, this invention proposes a multi-model patching method based on texture blending and accumulation. This method makes full use of texture resources and blending modes to achieve efficient processing of large-scale multi-model cutting and patching, and supports multi-texture extension to accommodate more models.

[0006] The technical solution provided by this invention is as follows: A multi-model surface patching method based on texture blending and accumulation, comprising the following steps:

[0007] Obtain several models to be processed and defined cutting planes, generate corresponding patching planes, and copy the models to be processed to generate auxiliary models;

[0008] Generate the target texture and set its rendering state, including dividing the target texture's channels into several weighted segments.

[0009] Each model to be processed, its corresponding complementary plane, and auxiliary model correspond one-to-one with the weight segment;

[0010] The first step of rendering includes: performing double-sided rendering on the auxiliary model. During double-sided rendering, every time a pixel of the auxiliary model is covered by a fragment, the cumulative value of the weight bit segment corresponding to the pixel of the auxiliary model is increased by the weight step size and written to the rendering target texture.

[0011] The second rendering process includes: reading the texture value of the rendering target texture corresponding to the patch plane, calculating the cumulative count of the bit segment values; performing single-sided rendering on the patch plane, retaining fragments when the cumulative count is odd and discarding fragments when the cumulative count is even, thereby trimming the part of the patch plane that exceeds the area to be patched, and completing the patch trimming.

[0012] Preferably, the resolution of the target texture being rendered is the same as that of the viewport, ensuring a one-to-one correspondence between the pixels of the viewport and the target texture being rendered.

[0013] Preferably, the step of establishing a one-to-one correspondence between each model to be processed, its corresponding complement plane, auxiliary model, and weight segment includes:

[0014] Assign a one-to-one corresponding number n to the model to be processed, the auxiliary model, and the surface patching plane;

[0015] Determine the sequence number, channel, and weight bit range of the rendering target texture corresponding to the model to be processed, the patch plane, and the auxiliary model numbered n.

[0016] As a preferred option, the mixing mode of the auxiliary model is also set to accumulation.

[0017] Preferably, the calculation steps for the weight step size include:

[0018] The weight of the least significant bit in the weighted bit segment is recorded as the base weight;

[0019] Divide the base weights by the normalization coefficient to obtain the weight step size. The normalization coefficient is the maximum integer value that can be represented by the precision of a single channel plus 1.

[0020] Preferably, the number of generated target textures for rendering is one or more.

[0021] Preferably, in the second rendering process, reading the texture value of the rendering target texture corresponding to the patch plane includes the following steps:

[0022] Pass the target texture of the rendering object into the fragment shader of the patch plane;

[0023] Determine the rendering target texture number and channel corresponding to the complement plane numbered n;

[0024] Extract the texture value corresponding to the complement plane with number n based on the texture sequence number of the rendering target.

[0025] Preferably, each channel is divided into the same number of weighted bit segments, and each weighted bit segment has the same number of bits.

[0026] A smart terminal includes a processor and a memory. The memory stores a computer program, and the processor is communicatively connected to the memory. The processor executes the multi-model surface patching method based on texture blending and accumulation as described above through the computer program.

[0027] A computer-readable storage medium storing program data used to perform the multi-model surface patching method based on texture blending accumulation as described above.

[0028] Compared with the prior art, the present invention has the following beneficial effects:

[0029] 1. By copying the auxiliary model of the model to be processed and performing double-sided rendering, the state of the pixels on the surface is recorded, so that the rendering order can be adapted to parallel computing. That is, the auxiliary model is first rendered to the rendering target texture in batches, and then the surface is filled in uniformly.

[0030] 2. By using a method of blending and accumulating rendering textures to record the number of pixel coverages, the number of generated rendering target textures can be increased according to the number of models that need to be processed simultaneously, allowing for the simultaneous processing of a large number of models.

[0031] 3. Since modern graphics game engines such as UE5 support texture blending and accumulation, this method does not require modification of the engine source code and has good compatibility. It can be used without any source code-level modifications.

[0032] 4. By using a method of blending and accumulating rendering textures to record the number of pixel coverages, the rendering process itself is transformed into an efficient and parallel counter, which can process a large number of models in a small amount of video memory and maximize the GPU's capabilities. Attached Figure Description

[0033] Figure 1 This is a flowchart illustrating Embodiment 1 of the present invention;

[0034] Figure 2 This is a schematic diagram of the state of the model to be processed before it is cut and patched.

[0035] Figure 3 A schematic diagram showing the state of the model to be processed after it has been numbered;

[0036] Figure 4 This is a schematic diagram showing the state of the model to be processed after it has been cut by a single cutting plane.

[0037] Figure 5 for Figure 4 A schematic diagram of the patch plane, shown in semi-transparent form, was generated based on this.

[0038] Figure 6 A schematic diagram showing the unnormalized texture values ​​(hexadecimal) marked in the notches of the cube model in the model to be processed;

[0039] Figure 7 This is a schematic diagram showing the effect of patching the cube model in the model to be processed based on the texture value.

[0040] Figure 8 This is a schematic diagram showing the final surface patching effect for all models to be processed based on texture values. Detailed Implementation

[0041] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without inventive effort are within the scope of protection of the present invention. Unless otherwise defined, the technical or scientific terms used herein should have the ordinary meaning understood by those skilled in the art to which this invention pertains.

[0042] Example 1,

[0043] A multi-model surface patching method based on texture blending and accumulation, such as Figure 1 As shown, the specific steps are as follows.

[0044] S1: Obtain several models to be processed and defined cutting planes, generate corresponding patch planes, and copy the models to be processed to generate auxiliary models.

[0045] S11, Obtain the model to be processed, such as... Figure 2 As shown, this embodiment uses six models to be processed as examples.

[0046] The models to be processed can be loaded from the hard drive or generated in real time by the program, as long as they are closed mesh models. In this embodiment, there are six models to be processed, such as... Figure 2 As shown, it consists of multiple intersecting models, each of which is considered as a model to be processed.

[0047] S12, obtain the defined cutting plane, that is, pass the defined cutting plane information to the shader.

[0048] One or more cutting planes can be defined according to requirements. This embodiment uses a single plane as an example. If multiple planes are needed, the fragment will only be cut if it falls on the positive side of all planes. The cutting plane can be defined using a general plane equation, such as ax + by + cz + d = 0, where (a, b, c) are the plane's normal vectors, and d is a constant. The plane can be directly described using coefficients a, b, c, and d. For a given point P(x1, y1, z1), substituting its coordinates into the plane equation yields F = ax1 + by1 + cz1 + d. If:

[0049] F>0 indicates that the point is located on the positive side of the plane (the side to which the normal vector points).

[0050] F<0 indicates that the point is located on the negative side of the plane;

[0051] F=0 indicates that the point lies on the plane.

[0052] In this embodiment, the front side of the plane is considered as the area to be truncated. By discarding the front side fragments in the fragment shader, the truncating effect can be obtained, such as... Figure 4 As shown. The semi-transparent plane is a schematic diagram of the cutting plane. Model fragments in the positive side area are deleted, while the negative side area is retained.

[0053] If multiple cutting planes are used, the fragment will only be cut off if it is located on the positive side of all the planes.

[0054] The specific steps are as follows: First, apply the cutting plane to the fragment shader to form the cutting surface. That is, use F = ax + by + cz + d to describe the cutting plane, and pass the four coefficients a, b, c, and d to the fragment shader (i.e., the pixel shader). For the fragment's world coordinates (x1, y1, z1), calculate F = ax1 + by1 + cz1 + d. If F > 0, discard the fragment, thus removing the region on the positive side of the plane; otherwise, retain it. In this way, the positive side portion where the model intersects with the cutting plane will be "cut off," while the negative side portion is preserved, forming a clear cutting surface.

[0055] S13 generates the patch plane.

[0056] The process iterates through each model to be processed, generating a corresponding patch plane based on its intersection with the cutting plane. This patch plane is a renderable mesh model used to fill the gap created after cutting. Typically, the patch plane can be rectangular, its size only needing to cover the gap. By default, the material of the patch plane is the same as the model to be processed to maintain visual consistency, but other materials can be used as needed, such as... Figure 5 As shown.

[0057] S14, Copy the model to be processed to generate an auxiliary model.

[0058] Auxiliary models are generated by copying each model to be processed. The mesh of the auxiliary model is the same as that of the model to be processed, but it uses different material settings and is only used in the rendering to texture process, not in the final display. This copying process ensures that the auxiliary model inherits the geometric data of the model to be processed, but the material parameters are set independently.

[0059] S2 generates the target texture and sets its rendering state, including:

[0060] S21, Generate one or more rendering target textures based on the total number of models to be processed.

[0061] S22 divides the channels of the target texture to be rendered into several weighted segments.

[0062] A weighted bit field refers to a continuous bit field divided into bits within a channel. Each channel must be divided into at least one weighted bit field. In this embodiment, taking a common RGBA four-channel design with 8 bits per channel as an example, each channel is divided into two weighted bit fields: a high-order bit field and a low-order bit field, each occupying 4 bits. The high-order bit field corresponds to the first four bits from high to low, and the low-order bit field corresponds to the last four bits from high to low. Therefore, a single texture can carry the counts of 8 models. If more models need to be processed, more rendering target textures can be added. For example, if 80 models need to be processed simultaneously, 10 rendering target textures are required.

[0063] S23 sets the initial value of the target texture to 0.

[0064] S24. Set the resolution of the target texture to be the same as that of the actual display viewport. If the viewport resolution changes, the resolution of the target texture must be kept consistent with that of the viewport to ensure that the pixels of the viewport and the target texture correspond one-to-one.

[0065] S3, each model to be processed and its corresponding complementary plane and auxiliary model are one-to-one with the weight segment.

[0066] Each model to be processed corresponds one-to-one with a weight segment. The complement plane and auxiliary model corresponding to each model to be processed correspond to the same weight segment as the model to be processed. Each weight segment corresponds to a model to be processed and its corresponding complement plane and auxiliary model.

[0067] The corresponding steps include:

[0068] S31 assigns a one-to-one corresponding number n to the model to be processed, the auxiliary model, and the surface to be filled, such as... Figure 3 As shown.

[0069] The specific settings for the numbering rules are as follows:

[0070] The models to be processed, auxiliary models, and surface-filling planes are managed using a sequential numbering system. The numbers of multiple models to be processed start from 0 and increment sequentially. For example, in this embodiment, there are six models to be processed, numbered 0, 1, 2, 3, 4, and 5. When there are eight models to be processed in the scene, their numbers are 0, 1, 2, 3, 4, 5, 6, and 7, and so on.

[0071] like Figure 2 As shown, it consists of multiple intersecting models, with each geometric model being treated as a model to be processed. Figure 3 The numbers of the six models to be processed are marked in the image.

[0072] After each model to be processed is assigned a number, the auxiliary model and the patch plane use the same number as their corresponding model to achieve a one-to-one correspondence with the subsequent rendering target textures. This numbering system supports expansion; when the number of models exceeds the capacity of a single texture, they can be distributed across multiple rendering target textures.

[0073] S32, determine the sequence number, channel, and weight bit field of the rendering target texture corresponding to the model to be processed, the patch plane, and the auxiliary model with number n. Each weight bit field matches only one number n.

[0074] This embodiment uses an 8-bit, RGBA four-channel texture, with each channel divided into two 4-bit weighted segments, as an example for illustration. Other types and sizes of channels can also be derived using the method of this embodiment, including the following steps:

[0075] S321, determine the texID of the rendering target texture corresponding to the model to be processed, the patch plane, and the auxiliary model with number n. The calculation formula is:

[0076] texID=floor((n / floor(log(r,max))) / 4).

[0077] Where floor represents floor, r is the base used (in this embodiment, each channel is divided into two 4-bit weighted segments, so the base is 2 to the power of four, i.e., hexadecimal), and max is the normalization coefficient, which represents the maximum integer value that a single channel can represent plus 1 (e.g., 256 for 8 bits, max should be an integer power of r).

[0078] As described in step S31, if there are many models to be processed, they may be assigned to multiple rendering target textures. Therefore, it is necessary to determine the rendering target texture corresponding to the model to be processed, the patch plane, and the auxiliary model numbered n.

[0079] S322, determine the channel c corresponding to the model to be processed, the surface patching plane, and the auxiliary model numbered n, using the following formula:

[0080] c=floor(n / floor(log(r,max)))mod4.

[0081] Where c is the channel number of the RGBA channel, represented by 0-3, and mod represents modulo.

[0082] S323, determine the weight segments corresponding to the model to be processed, the supplementary plane, and the auxiliary model numbered n. The base weight w of the weight segment is the unnormalized weight of the least significant bit of the weight segment, i.e.:

[0083] w=r^(n mod floor(log(r,max))).

[0084] For example, in hexadecimal, each channel has two weighted bit segments: the base weight of the higher bit segment is w=0x10=16, and the base weight of the lower bit segment is w=0x01=1.

[0085] Because in subsequent steps, when textures are accumulated in blending modes, the accumulation operation is performed on floating-point numbers with values ​​between 0 and 1.

[0086] Therefore, the unnormalized base weight w of the weighted bit segment needs to be normalized to a weight step size wv as the accumulation unit and written into the corresponding weighted bit segment as the material color value, so that the cumulative value of the bit segment matches the range of color channel values. The formula for calculating the weight step size wv is as follows:

[0087] wv = w / max.

[0088] Furthermore, by using the weight step size wv as the identifier parameter for the weight segment, the weight segment corresponding to the model to be processed, the supplementary plane, and the auxiliary model with the number n can be determined.

[0089] In this embodiment, when each channel is 8 bits and divided into 4-bit segments (equivalent to hexadecimal), the weight step size wv of the high-order segment is 16 / 256, and the weight step size wv of the low-order segment is 1 / 256.

[0090] In this embodiment, the color channel has 8-bit precision, uses a hexadecimal system, and is divided into two weighted bit segments. Therefore, the normalization coefficient max=256, r=16, the weight step size wv of the higher bit segment is 16 / 256, and the weight step size wv of the lower bit segment is 1 / 256.

[0091] When model number n=3, then:

[0092] The rendering target texture number corresponding to number 3 is texID=floor((3 / log(16,256)) / 4)=0;

[0093] The RGBA channel corresponding to number 3 is c=floor((3 / log(16,256))mod4)=1;

[0094] The basis weight corresponding to number 3 is w = 16^(3mod log(16,256)) = 16.

[0095] The weight step size corresponding to number 3 is wv=16 / 256 =0.0625.

[0096] The result is that number 3 corresponds to the first rendering target texture with sequence number 0, the corresponding RGBA channel to be written is the second G channel, the corresponding base weight w is 16, the corresponding high bit segment, and the weight step size is 16 / 256.

[0097] The six auxiliary models are numbered n and their corresponding weight step sizes are as follows:

[0098] 1) Number 0 (R channel): Weight step size 1 / 256, the hexadecimal expression corresponding to 1 is 0x01;

[0099] 2) Number 1 (R channel): Weight step size 16 / 256, the hexadecimal expression corresponding to 16 is 0x10;

[0100] 3) Number 2 (G channel): Weight step size 1 / 256, the hexadecimal expression corresponding to 1 is 0x01;

[0101] 4) Number 3 (G channel): Weight step size 16 / 256, the hexadecimal expression corresponding to 16 is 0x10;

[0102] 5) Number 4 (Channel B): Weight step size 1 / 256, the hexadecimal expression corresponding to 1 is 0x01;

[0103] 6) Number 5 (Channel B): Weight step size 16 / 256, the hexadecimal expression corresponding to 16 is 0x10.

[0104] If there are 7 or 8 models, the A channel is expanded; if there are more than 8 models, a new texture is added. Each 8-bit channel can be divided into two 4-bit weight segments, and each weight segment supports a maximum of 15 overwrites. A single 4-channel rendering target texture can handle 8 models, which is suitable for most situations.

[0105] S4 sets the rendering state of the auxiliary model, including:

[0106] S41, the auxiliary model is enabled to render to texture, and the rendering result of the auxiliary model is set to be written to the rendering target texture.

[0107] S42, enable two-Sided rendering.

[0108] S43, set the blend mode to accumulation (source factor ONE, target factor ONE).

[0109] When rendering the auxiliary model, it is necessary to determine which fragments constitute "model gaps" and require patching. Model gaps refer to the exposed internal surfaces of the model being processed or the auxiliary model after it has been cut.

[0110] In double-sided rendering, if a pixel is covered by fragments an odd number of times during the rendering of the auxiliary model, it means that the pixel is ultimately located in a gap in the model and should be patched. If the number of coverages is an even number, it means that the pixel is in the solid part of the model and does not need to be patched. Therefore, by accumulating the number of coverages and determining whether they are odd or even, the position of the pixel that needs to be patched can be distinguished.

[0111] When the blend mode is set to accumulation (source factor ONE, target factor ONE), the GPU follows the mathematical equation (final color = (source color × 1) + (target color × 1)) during color blending. This means that whenever a fragment of an auxiliary model covers a pixel, the weight step size output by its shader does not overwrite the existing information of that pixel, but is linearly added to the accumulated bit segment value in the pixel. Since the accumulation operation in the accumulation mode is performed on floating-point numbers from 0 to 1, the base weight w needs to be normalized by dividing by max to obtain the weight step size wv before being written into the material color channel. Therefore, normalization processing is required for the values ​​within the weight bit segment.

[0112] When a fragment of the auxiliary model first covers a pixel, the cumulative value of the corresponding weighted bit segment is increased by a weight step size wv (e.g., 1 / 256 or 16 / 256) and written to the rendering target texture channel. Subsequent covers accumulate the same weight step size wv. For example, using a high bit segment and a weight step size wv = 16 / 256 (unnormalized base weight w = 0x10), after 3 covers, the cumulative bit segment value is 3 × 16 / 256 = 48 / 256 (unnormalized base weight w = 0x30). When the number of covers is odd, the parity is calculated as odd, indicating a gap; when it is even, the parity is calculated as even, indicating a solid part. Subsequently, when rendering the patch plane, the parity is calculated by reading the texture value to determine the gap.

[0113] In this way, the number of coverages can be counted efficiently and in parallel during the rendering process, accurately accumulating the total weighted value of each pixel being covered by different model fragments, supporting real-time processing of large-scale models (such as a single texture supporting 8 models, and expanding to 10 textures to process more than 80 models).

[0114] S44, set the depth test of the auxiliary model to off to ensure that all fragments of the auxiliary model can enter the processing flow.

[0115] S45, other settings, including: disable lighting, do not use color interpolation.

[0116] At this point, steps S1-S4 have completed the rendering state settings, supporting parallel rendering of multiple models.

[0117] S5 initiates the first rendering process, which includes: performing double-sided rendering on the auxiliary model. During double-sided rendering, every time a pixel of the auxiliary model is covered by a fragment, the cumulative value of the weight bit segment corresponding to the pixel of the auxiliary model is increased by the weight step size and written to the rendering target texture.

[0118] When writing to the target texture for rendering, the normalized value of the base weight w of the corresponding weight segment (i.e., the weight step size) is used as the accumulation unit within the corresponding weight segment.

[0119] The weight step size for the lower segment is 1 / 256 (its base weight w=0x01), and the weight step size for the higher segment is 16 / 256 (its base weight w=0x10).

[0120] The model to be processed is rendered normally, while the auxiliary model is rendered separately on both sides and the result is written to the corresponding rendering target texture. This realizes the operation of recording the number of times the model is covered by the rendering target texture, thereby writing the information of the model gap. That is, every time the fragment of the auxiliary model covers a pixel, the cumulative value of the bit segment in the corresponding channel of the rendering target texture is incremented once to record the pixel state at the model gap.

[0121] Compared with traditional template buffering methods, this invention uses hybrid accumulation, supports processing a larger number of models simultaneously, supports native engine functions, and does not require modification of the engine source code.

[0122] like Figure 6 The values ​​shown in the figure are the texture values ​​written to the notch area of ​​the cube model in the auxiliary model. Since the accumulation operation is performed on floating-point numbers between 0 and 1 when the blending mode is set to accumulation, the base weight w needs to be normalized by dividing by max to obtain the weight step size before being written into the weight bit field of the material color channel. Figure 3 As can be seen from the number in the code, at this time:

[0123] At the notch of auxiliary model number 2, the G channel of the corresponding rendering target texture writes a multiple of 0x01 (1 / 256 after normalization), and the multiple is equal to the fragment coverage number f.

[0124] At the notch of auxiliary model number 3, the G channel of the corresponding rendering target texture writes a multiple of 0x10 (16 / 256 after normalization), which is equal to the fragment coverage number f.

[0125] If there are intersections between models, the same gap location may accumulate the bit segment cumulative values ​​of multiple different auxiliary models, but the weighted bit segments within the channel do not interfere with each other. This process can process multiple auxiliary models in parallel, improving efficiency.

[0126] S6 initiates the second rendering process, thereby processing the patch planes corresponding to these gap locations, including:

[0127] S61, read the texture value of the rendering target texture corresponding to the patch plane, and calculate the accumulation count of the bit segment cumulative value based on the texture value and the weight step size. The specific steps are as follows:

[0128] S611, passes the rendering target texture to the fragment shader of the patch plane;

[0129] S612, determine the rendering target texture number, channel, base weight, and weight step size corresponding to the complement plane numbered n, that is:

[0130] texID =floor((n / bit_count) / 4);

[0131] c = floor((n / bit_count)mod 4);

[0132] w = r^(n mod bit_count);

[0133] wv = w / max.

[0134] Where bit_count is floor(log(r,max)), representing the number of "weighted bit segments" divided in each channel;

[0135] S613, extract the texture value v corresponding to the padded plane with number n according to the texture sequence of the rendering target, that is:

[0136] v=textures[texID]

[0137] Here, textures is an array of indices for the target texture to be rendered.

[0138] S614, calculate the cumulative number of times f is accumulated based on the texture value v and the weight step size corresponding to the number n.

[0139] Since the textures used for blending and accumulating can only store numbers between 0 and 1, inverse normalization is required to calculate the number of accumulations f.

[0140] S6141 calculates the weight step size factor, used to denormalize texture values.

[0141] factor =r^(bit_count-(n mod bit_count)).

[0142] S6142, calculate the cumulative count f based on the weight step size factor.

[0143] f = floor(v[c] * factor) mod r.

[0144] S62 performs single-sided rendering on the patch plane. During single-sided rendering, fragments with an odd number of accumulation counts are retained, while fragments with an even number of accumulation counts are discarded. This cuts off the portion of the patch plane that extends beyond the area to be patched, thus completing the trimming of the patch plane.

[0145] The rendering state setting of the patch plane can be completed in advance in step S3, and then the first rendering process and the second rendering process can be started. In this embodiment, the setting of the rendering state of the patch plane is arranged in step S5 only for ease of understanding and does not represent the actual operation sequence.

[0146] In the fragment shader, the parity of the cumulative count of the bit segment corresponding to the n-numbered patch plane is determined. If the count is odd, the fragment of the patch plane is retained; if the count is even, the fragment of the patch plane is discarded, and the part of the patch plane that exceeds the gap in the model to be processed is cut off.

[0147] Taking the 8-bit, 4-channel rendering target texture in this embodiment as an example, each channel is divided into 2 weight segments, and each weight segment is 4 bits. Therefore, the base r is 2 to the power of 4, which is hexadecimal; the max is 256, so the number of weight segments bit_count for each channel is 2.

[0148] Determine the rendering target texture number, channel, and weight bit segment corresponding to the patch plane numbered 3, that is:

[0149] texID=floor((3 / 2) / 4)=0, which means the first target texture to be rendered;

[0150] c = floor((3 / 2) mod 4) = floor(1.5 mod 4) = floor(1.5) = 1, which means the G channel;

[0151] w = 16^(3 mod 2) = 16^1 = 16, which is the base weight;

[0152] wv=16 / 256 =0.0625, which means it is in the high range.

[0153] Based on the texture index of the rendering target texture and the texture value v[1] corresponding to the padded plane of channel number 3, assuming the extracted texture value v[1] = 0.1875, i.e. 0x30, then:

[0154] The accumulation count f is calculated based on the texture value v and the factor corresponding to the number n, i.e.:

[0155] The weight step size factor is 16^(2-(3mod2))=16^(2-1)=16;

[0156] The cumulative number of times is f = floor(v[1]*factor) mod r = floor(0.1875*16) mod 16 = floor(3) mod 16 = 3.

[0157] Determine the parity of the cumulative count of the bit segment corresponding to the supplementary plane number 3, i.e.

[0158] The number of coverages, f mod 2, is equal to 1, so fragments are retained.

[0159] In addition, such as Figure 6 As shown, if the rendering target texture value corresponding to some pixels is 0x21, that is, v[1] = 33 / 256,

[0160] For the complement plane numbered 2, the weight step size coefficient factor = 16^(2-(2 mod 2)) = 256, then the cumulative number of additions f = floor(v[1]*factor) mod 16 = floor(33 / 256*256) mod 16 = floor(33) mod 16 = 1

[0161] For the complement plane numbered 3, the weight step size factor is 16^(2-(3 mod 2))=16, then the cumulative number of iterations is f=floor(v[1] *factor) mod 16=floor(33 / 256*16) mod 16=floor(2.0625) mod 16=2

[0162] If pixel number 2 is covered once (odd number) and pixel number 3 is covered twice (even number), then the pixel with number 2 is retained for patching, while the pixel with number 3 is discarded. This process accurately fills gaps and supports freely changing materials (such as adding texture maps to improve model visualization). If multiple bit segments of the rendered target texture value have an odd cumulative value, it indicates that this is an intersection of multiple models. You can customize which plane to prioritize display as needed, such as... Figure 7 and Figure 8 As shown.

[0163] The trimming and patching method in this embodiment is completed by determining the parity of the cumulative bit values. The number of times the status bit is covered in hexadecimal is limited to 15 times, which is suitable for most geological or architectural models. If the number of times the coverage exceeds 15 times, a higher precision can be used to represent the weight bit segment. For example, if a weight bit segment is set for each channel value, the number of times the coverage is supported is 255 times.

[0164] The beneficial effects of this embodiment include:

[0165] 1. Supports large-scale models: Through multi-texture extension, it can easily support a larger number of models, suitable for sectioning and patching in large-scale scenes.

[0166] 2. Engine compatibility: The rendering textures used are supported by modern graphics game engines such as UE5, requiring no modification to the engine source code and making integration easy.

[0167] 3. Suitable for rendering order and parallel adaptation, that is, it can first render auxiliary models to textures in batches, and then uniformly fill in the surfaces.

[0168] 4. Flexible texture expansion and relatively reasonable memory consumption maximize GPU capabilities, enabling true real-time dynamic slicing and surface patching of multiple models.

[0169] This invention can be widely applied to various graphics APIs and modern graphics engines, and has good compatibility.

[0170] It must be pointed out that the order of the above steps is not fixed and can be changed as needed.

[0171] like Figure 7 , Figure 8 As shown, the cuts of each model to be processed are precisely filled by the corresponding patch plane. Compared with the stencil buffer method, this invention overcomes the limitation on the number of models caused by insufficient bit width of the stencil buffer by using blended texture accumulation. It can process a large number of models at the same time, and is more compatible with modern graphics engines, and can be used without source code-level modifications.

[0172] Example 2

[0173] A smart terminal includes a processor and a memory. The memory stores a computer program, and the processor is communicatively connected to the memory. The processor executes the multi-model surface patching method based on texture blending accumulation as described in Embodiment 1 through the computer program.

[0174] Example 3

[0175] A computer-readable storage medium storing program data, the program data being used to execute the multi-model surface patching method based on texture blending accumulation of Embodiment 1.

[0176] The preferred embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present invention, various simple modifications can be made to the technical solution of the present invention, and these simple modifications all fall within the protection scope of the present invention.

Claims

1. A multi-model patching method based on texture blending accumulation, characterized in that, The method comprises the following steps: obtaining a plurality of to-be-processed models and defined section planes, generating corresponding supplementary planes, and copying the to-be-processed models to generate auxiliary models; generating a rendering target texture and setting the rendering state of the rendering target texture, comprising: dividing the channels of the rendering target texture into a plurality of weight bit segments; each to-be-processed model, the corresponding supplementary plane and auxiliary model thereof correspond to a weight bit segment; starting a first flow of rendering, comprising: performing double-sided rendering on the auxiliary models, wherein when the pixels of the auxiliary models are covered by a fragment each time, the bit segment cumulative value of the weight bit segment corresponding to the pixel of the auxiliary model is added by a weight step and written into the rendering target texture; starting a second flow of rendering, comprising: reading the texture value of the rendering target texture corresponding to the supplementary plane, calculating the number of times of adding the bit segment cumulative value; performing single-sided rendering on the supplementary plane, wherein when the number of times of adding is odd, the fragment is retained, and when the number of times of adding is even, the fragment is discarded, thereby cutting the part of the supplementary plane that exceeds the to-be-supplemented surface region and completing the trimming of the supplementary surface.

2. The multi-model patching method based on texture blending accumulation according to claim 1, characterized in that, The resolution of the rendering target texture is consistent with the viewport, ensuring that the pixels of the viewport and the rendering target texture correspond to each other.

3. The multi-model patching method based on texture blending accumulation according to claim 1, wherein, The step that each to-be-processed model, the corresponding supplementary plane and auxiliary model thereof correspond to a weight bit segment comprises: setting a one-to-one corresponding number n for the to-be-processed models, the auxiliary models and the supplementary planes; determining the sequence number, channel and weight bit segment of the rendering target texture corresponding to the to-be-processed model, the supplementary plane and the auxiliary model with the number n.

4. The multi-model patching method based on texture blending accumulation according to claim 1 or 2 or 3, characterized in that, The method further comprises setting the blending mode of the auxiliary model to accumulation.

5. The multi-model patching method based on texture blending accumulation according to claim 1 or 2 or 3, characterized in that, The calculation step of the weight step comprises: taking the weight value of the least significant bit of the weight bit segment as a base weight; dividing the base weight by a normalization coefficient to obtain the weight step, wherein the normalization coefficient is the maximum integer value that can be represented by the precision of a single channel plus 1.

6. The multi-model patching method based on texture blending accumulation according to claim 1 or 2 or 3, characterized in that, The number of the generated rendering target textures is one or more.

7. The multi-model patching method based on texture blending accumulation according to claim 1 or 2 or 3, characterized in that, In the second flow of rendering, the step of reading the texture value of the rendering target texture corresponding to the supplementary plane comprises the following steps: passing the rendering target texture into the fragment shader of the supplementary plane; determining the sequence number and channel of the rendering target texture corresponding to the supplementary plane with the number n; extracting the texture value corresponding to the supplementary plane with the number n according to the sequence number of the rendering target texture.

8. The multi-model patching method based on texture blending accumulation according to claim 1 or 2 or 3, characterized in that, Each channel is divided into the same number of weight bit segments, and each weight bit segment has the same number of bits.

9. A smart terminal, characterized by The intelligent terminal comprises a processor and a memory, the memory stores a computer program, the processor is in communication connection with the memory, and the processor executes the multi-model supplementary surface method based on texture blending accumulation according to any one of claims 1-8 through the computer program.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores program data, which is used to execute the multi-model supplementary surface method based on texture blending accumulation according to any one of claims 1-8.

Citation Information

Patent Citations

  • Multi-model surface complementing method based on template buffering, terminal and storage medium

    CN119919557A

  • Applying multiple texture maps to objects in three-dimensional imaging processes

    US20020140703A1