A method, system, and computer readable storage medium for repairing baked model baked color

By automatically filtering and processing blocks with excessively small texture coordinates, the problem of black color defects caused by excessively small texture coordinates in the baked lightmap was solved, achieving a uniform texture coordinate distribution and improving the baking effect.

CN115345977BActive Publication Date: 2026-03-24SHENGQU INFORMATION TECH SHANGHAI
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-14
Publication Date
2026-03-24

Smart Images

  • Figure CN115345977B_ABST
    Figure CN115345977B_ABST
Patent Text Reader

Abstract

The application provides a method, a system and a computer readable storage medium for repairing the baking color of a baking model, wherein the method comprises: running a baking model to be repaired in a running software, obtaining the texture coordinate value of the baking model to be repaired, determining the texture coordinate block with too small texture coordinate value in the baking model to be repaired according to the texture coordinate value of the baking model to be repaired, processing the coordinate block, and obtaining the repaired baking model. The method can automatically screen out the UV block with too small texture coordinate value in the model to be repaired, process the screened UV block, eliminate the defect of color blackening caused by the too small texture coordinate value in the model, and improve the baking effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of baking texture technology, and in particular to a method, system, and computer-readable storage medium for repairing baking models. Background Technology

[0002] In 3D game engines, rendering uses a second set of texture coordinates to store the location of lighting information maps. Texture coordinates refer to the information contained in each vertex of the model, corresponding to the horizontal and vertical coordinate range of a certain texture, usually represented by the letters UV. During lightmap baking, some areas often appear very dark. Investigation and analysis have shown that this is due to the texture coordinates of certain faces being too small. If the texture coordinates are too small, and the lightmap is not large enough, a single pixel may directly contain an entire face, or even multiple faces, resulting in a single pixel being calculated multiple times. Currently, there are no automated tools or methods to solve this problem. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method, system and computer-readable storage medium for repairing the baking color of a baking model, so as to solve the defect in the prior art that the baking color is black due to the texture coordinates of some surfaces being too small in the baking light map.

[0004] The first aspect of this invention provides a method for repairing the baking color of a baking model, comprising:

[0005] Run the baking model to be repaired in the software, obtain the texture coordinate values ​​of the baking model to be repaired, and determine the texture coordinate blocks in the baking model to be repaired that have too small texture coordinates based on the texture coordinate values ​​of the baking model to be repaired;

[0006] The coordinate block is processed to obtain the repaired baking model.

[0007] In one specific embodiment, the method further includes:

[0008] Determine the preset height and width values ​​of the baking texture occupying the texture map in the baking model to be repaired, and determine the width and height values ​​of a single pixel in the texture coordinate space based on the preset height and width values.

[0009] In one specific embodiment, determining the texture coordinate block with excessively small texture coordinates in the baked model to be repaired based on the texture coordinate values ​​of the baked model to be repaired specifically includes:

[0010] In the UV coordinate system, determine whether the width value of the bounding box of each texture coordinate plane in the horizontal direction is less than the width value of a single pixel. If so, determine the texture coordinate block where the texture coordinate plane is located as the texture coordinate block with too small texture coordinates in the baking model to be repaired.

[0011] In one specific embodiment, determining the texture coordinate block with excessively small texture coordinates in the baked model to be repaired based on the texture coordinate values ​​of the baked model to be repaired specifically includes:

[0012] In the UV coordinate system, determine whether the height value of the bounding box of each texture coordinate plane in the vertical direction is less than the height value of a single pixel. If so, determine the texture coordinate block where the texture coordinate plane is located as the texture coordinate block with too small texture coordinates in the baking model to be repaired.

[0013] In one specific embodiment, determining the texture coordinate block with excessively small texture coordinates in the baked model to be repaired based on the texture coordinate values ​​of the baked model to be repaired specifically includes:

[0014] In the UV coordinate system, it is determined whether the width value of the bounding box of each texture coordinate surface in the horizontal direction is less than the single pixel width value and whether the height value of the bounding box of each texture coordinate surface in the vertical direction is less than the single pixel height value. If the width value of the bounding box of the texture coordinate surface is less than the single pixel width value and / or the height value of the bounding box of each texture coordinate surface is less than the single pixel height value, then the texture coordinate block where the texture coordinate surface is located is determined as the texture coordinate block with too small texture coordinates in the baking model to be repaired.

[0015] In one specific embodiment, processing the coordinate block to obtain the repaired baked model specifically includes:

[0016] For any texture coordinate block with excessively small texture coordinates, select the texture coordinate block with excessively small texture coordinates and scale the texture coordinate surface in the selected texture coordinate block until the texture coordinate surface in the selected texture coordinate block meets the preset conditions.

[0017] The repaired baked model is obtained based on the scaled texture coordinate blocks.

[0018] In one specific embodiment, the step of selecting any texture coordinate block with excessively small texture coordinates and scaling the texture coordinate plane within the selected texture coordinate block until the texture coordinate plane meets a preset condition specifically includes:

[0019] Select any texture coordinate block in the model to be repaired that has too small a texture coordinate and determine the texture coordinate surface with the smallest pixel in the selected texture coordinate block;

[0020] The texture coordinate plane of the selected texture coordinate block is scaled along both the horizontal and vertical axes until the width of the texture coordinate plane with the smallest pixel is equal to the width of the single pixel, and the height of the texture coordinate plane with the smallest pixel is equal to the height of the single pixel.

[0021] In one specific embodiment, the step of selecting any texture coordinate block with excessively small texture coordinates and scaling the texture coordinate plane within the selected texture coordinate block until the texture coordinate plane meets a preset condition specifically includes:

[0022] Select any texture coordinate block in the model to be repaired that has an excessively small texture coordinate and determine the texture coordinate surface with the smallest width value in the horizontal coordinate direction among the selected texture coordinate blocks;

[0023] The texture coordinate planes in the selected texture coordinate block are scaled proportionally until the short side of the bounding shell of the texture coordinate plane with the smallest width value in the horizontal coordinate direction is enlarged to the width value corresponding to the single pixel.

[0024] In one specific embodiment, the step of selecting any texture coordinate block with excessively small texture coordinates and scaling the texture coordinate plane within the selected texture coordinate block until the texture coordinate plane meets a preset condition specifically includes:

[0025] Select any texture coordinate block in the baking model to be repaired that has too small a texture coordinate and determine the texture coordinate surface with the smallest height value in the vertical coordinate direction of the selected texture coordinate block;

[0026] The texture coordinate planes in the selected texture coordinate block are scaled proportionally until the short side of the bounding shell of the texture coordinate plane with the smallest height value in the vertical coordinate direction is enlarged to the height value corresponding to the single pixel.

[0027] In one specific embodiment, obtaining the repaired baked model based on the scaled texture coordinate blocks specifically includes:

[0028] Arrange the scaled texture coordinate blocks to obtain the repaired baked model.

[0029] A second aspect of the present invention provides a system for repairing the baking color of a baking model, comprising:

[0030] The texture coordinate block filtering unit is used to run the baking model to be repaired in the running software, obtain the texture coordinate values ​​of the baking model to be repaired, and determine the texture coordinate blocks in the baking model to be repaired that have too small texture coordinates based on the texture coordinate values ​​of the baking model to be repaired.

[0031] The processing unit is used to process the coordinate block to obtain the repaired baking model.

[0032] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the aforementioned method.

[0033] The beneficial effects of this invention are as follows: By obtaining the texture coordinate values ​​in the model to be repaired and baking, UV blocks with excessively small texture coordinates are automatically selected based on these values. These UV blocks are then scaled and rearranged to achieve a uniform texture coordinate distribution. This method automatically selects UV blocks with excessively small texture coordinates from the model to be repaired and processes them, eliminating the defect of darkening due to excessively small texture coordinates and improving the baking effect. Attached Figure Description

[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention 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 some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0035] Figure 1 This is a flowchart illustrating a method for repairing the baking color of a baking model according to an embodiment of the present invention;

[0036] Figure 2 This is a more detailed flowchart illustrating step S2 of a method for repairing the baking color of a baking model according to an embodiment of the present invention. Detailed Implementation

[0037] The following description of the embodiments is taken with reference to the accompanying drawings, which illustrate specific embodiments in which the invention can be implemented.

[0038] The following is for reference Figure 1 As shown, Embodiment 1 of the present invention provides a method for repairing the baking color of a baking model, comprising the following steps:

[0039] S1. Run the baking model to be repaired in the software, obtain the texture coordinate values ​​of the baking model to be repaired, and determine the texture coordinate blocks with excessively small texture coordinates in the baking model to be repaired based on the texture coordinate values ​​of the baking model to be repaired.

[0040] Specifically, the baked model to be repaired can be run in 3ds Max. It can be checked whether the baked model to be repaired is an editable mesh. If not, the baked model to be repaired is converted into an editable mesh. At the same time, it can be checked whether the baked model to be repaired has coordinate editing attributes (Unwrap UVW). If not, coordinate editing attributes are automatically added to the baked model to be repaired.

[0041] Specifically, in the tool interface of the running software, the width and height values ​​of the texture map occupied by the baked texture are set, and the width and height values ​​of a single pixel in the UV space are determined based on the set width and height values.

[0042] In one specific implementation, the UV block with excessively small texture coordinates (i.e., texture coordinate block) is determined as follows: In the UV coordinate system, it is determined whether the width value of the bounding box of each UV surface in the horizontal direction is less than the width value of a single pixel. If so, the UV block where the UV surface is located is determined as the UV block with excessively small UV in the baking model to be repaired.

[0043] In one specific implementation, UV blocks with excessively small texture coordinates can also be determined as follows: In the UV coordinate system, determine whether the height value of the bounding box of each UV surface in the vertical direction is less than the height value of a single pixel. If so, the UV block where the UV surface is located is determined as the UV block with excessively small UV in the baking model to be repaired.

[0044] In one specific implementation, UV blocks with excessively small texture coordinates can also be determined as follows: In the UV coordinate system, it is determined whether the width value of the bounding box of each UV surface in the horizontal direction is less than the single pixel width value and whether the height value of the bounding box of each UV surface in the vertical direction is less than the single pixel height value. If the width value of the bounding box of the UV surface is less than the single pixel width value and / or the height value of the bounding box of each UV surface is less than the single pixel height value, then the UV block where the UV surface is located is determined as the UV block with excessively small UV in the baking model to be repaired.

[0045] S2. Process the coordinate block to obtain the repaired baking model.

[0046] In one specific embodiment, step S2 includes:

[0047] S21. For any texture coordinate block with excessively small texture coordinates, select the texture coordinate block with excessively small texture coordinates and scale the texture coordinate surface in the selected texture coordinate block until the texture coordinate surface in the selected texture coordinate block meets the preset conditions.

[0048] like Figure 2 As shown, in one specific embodiment, step S21 specifically includes selecting any texture coordinate block in the model to be repaired that has an excessively small texture coordinate and determining the texture coordinate surface with the smallest pixel in the selected texture coordinate block. The texture coordinate surface of the selected texture coordinate block is scaled from the horizontal axis and the vertical axis respectively until the width value of the texture coordinate surface with the smallest pixel is equal to the width value of the single pixel, and the height value of the texture coordinate surface with the smallest pixel is equal to the height value of the single pixel.

[0049] In one specific implementation, step S21 specifically includes selecting any texture coordinate block in the model to be repaired that has an excessively small texture coordinate and determining the texture coordinate surface with the smallest width value in the horizontal coordinate direction in the selected texture coordinate block, and scaling the texture coordinate surface in the selected texture coordinate block proportionally until the short side of the bounding shell of the texture coordinate surface with the smallest width value in the horizontal coordinate direction is enlarged to the width value corresponding to the single pixel.

[0050] In one specific implementation, step S21 specifically includes selecting any texture coordinate block in the baking model to be repaired that has an excessively small texture coordinate and determining the texture coordinate surface with the smallest height value in the vertical coordinate direction in the selected texture coordinate block, and scaling the texture coordinate surface in the selected texture coordinate block proportionally until the short side of the bounding shell of the texture coordinate surface with the smallest height value in the vertical coordinate direction is enlarged to the height value corresponding to the single pixel.

[0051] S22. Obtain the repaired baked model based on the scaled texture coordinate blocks.

[0052] In one specific embodiment, step S22 includes directly obtaining the repaired baked model based on the scaled texture coordinate blocks.

[0053] In one specific implementation, scaling alone is insufficient to obtain the repaired baked model; all texture coordinate blocks also need to be arranged. The Rescale Cluster option is automatically disabled before arrangement. Arrangement is performed linearly, with normalize, rotate, and fillholes options enabled. All UV blocks are automatically arranged, regardless of whether they are selected. Spacing during arrangement is based on the single-pixel size multiplied by the spacing factor. A value between 2 and 4 is recommended. If there are too many UV blocks, maintain a value between 1 and 2. Because arrangement normalizes, some previously enlarged UV blocks may be shrunk again, potentially requiring multiple consecutive scaling and arrangement operations. When multiple arrangement and scaling operations are required, an iteration count can be set to iterate the UV arrangement and scaling multiple times, ultimately achieving a uniform distribution.

[0054] This invention discloses a method for repairing the baking color of a baking model. The method involves obtaining the texture coordinate values ​​of the model to be repaired, automatically filtering out UV blocks with excessively small texture coordinates based on these values, scaling and rearranging these UV blocks to achieve a uniform texture coordinate distribution. This method automatically filters out UV blocks with excessively small texture coordinates in the model and processes them to eliminate the defect of darkening due to excessively small texture coordinates, thus improving the baking effect.

[0055] Based on Embodiment 1 of the present invention, Embodiment 2 of the present invention provides a system for repairing the baking color of a baking model, including a texture coordinate block filtering unit and a processing unit. The texture coordinate block filtering unit is used to run the baking model to be repaired in the running software, obtain the texture coordinate values ​​of the baking model to be repaired, and determine the texture coordinate blocks with excessively small texture coordinates in the baking model to be repaired based on the texture coordinate values ​​of the baking model to be repaired. The processing unit is used to process the coordinate blocks to obtain the repaired baking model.

[0056] Based on Embodiment 1 of the present invention, Embodiment 3 of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the aforementioned method.

[0057] Specifically, the computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0058] For the working principle and beneficial effects of this embodiment, please refer to the description of Embodiment 1 of the present invention, which will not be repeated here.

[0059] The above description discloses only preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Therefore, equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for repairing the baking color of a baking mold, characterized in that, include: Run the baking model to be repaired in the running software, obtain the texture coordinate values ​​of the baking model to be repaired, and determine the texture coordinate blocks with excessively small texture coordinates in the baking model to be repaired based on the width and height values ​​of a single pixel in the texture coordinate space, according to the texture coordinate values ​​of the baking model to be repaired. The texture coordinates being too small means that the width of the bounding box of the texture coordinate plane is less than the width of a single pixel and / or the height is less than the height of a single pixel; The texture coordinate block with excessively small texture coordinates is scaled up until the texture coordinate surface in the texture coordinate block meets the preset conditions. The preset conditions include that the width value of the texture coordinate surface is equal to the width value of a single pixel and / or the height value is equal to the height value of a single pixel. Arrange the scaled texture coordinate blocks to obtain the repaired baked model; For any texture coordinate block with excessively small texture coordinates, select the texture coordinate block with excessively small texture coordinates and scale the texture coordinate plane in the selected texture coordinate block until the texture coordinate plane meets the preset conditions, specifically including: Select any texture coordinate block in the baking model to be repaired that has too small a texture coordinate and determine the texture coordinate surface with the smallest pixel in the selected texture coordinate block; The texture coordinate planes of the selected texture coordinate block are scaled along both the horizontal and vertical axes until the width of the texture coordinate plane with the smallest pixel is equal to the width of the single pixel, and the height of the texture coordinate plane with the smallest pixel is equal to the height of the single pixel; the repaired baked model is obtained based on the scaled texture coordinate block.

2. The method according to claim 1, characterized in that, The method further includes: In the running software, preset values ​​for the height and width of the baked texture occupying the texture map in the baked model to be repaired are set, and the width and height values ​​of a single pixel in the texture coordinate space are determined based on the preset values ​​for height and width.

3. The method according to claim 2, characterized in that, The step of determining the texture coordinate block with excessively small texture coordinates in the baked model to be repaired based on the texture coordinate values ​​specifically includes: In the UV coordinate system, determine whether the width value of the bounding box of each texture coordinate plane in the horizontal direction is less than the width value of a single pixel. If so, determine the texture coordinate block where the texture coordinate plane is located as the texture coordinate block with too small texture coordinates in the baking model to be repaired.

4. The method according to claim 2, characterized in that, The step of determining the texture coordinate block with excessively small texture coordinates in the baked model to be repaired based on the texture coordinate values ​​specifically includes: In the UV coordinate system, determine whether the height value of the bounding box of each texture coordinate plane in the vertical direction is less than the height value of a single pixel. If so, determine the texture coordinate block where the texture coordinate plane is located as the texture coordinate block with too small texture coordinates in the baking model to be repaired.

5. The method according to claim 2, characterized in that, The step of determining the texture coordinate block with excessively small texture coordinates in the baked model to be repaired based on the texture coordinate values ​​specifically includes: In the UV coordinate system, it is determined whether the width value of the bounding box of each texture coordinate surface in the horizontal direction is less than the single pixel width value and whether the height value of the bounding box of each texture coordinate surface in the vertical direction is less than the single pixel height value. If the width value of the bounding box of the texture coordinate surface is less than the single pixel width value and the height value of the bounding box of each texture coordinate surface is less than the single pixel height value, then the texture coordinate block where the texture coordinate surface is located is determined as the texture coordinate block with too small texture coordinates in the baking model to be repaired.

6. The method according to any one of claims 3-5, characterized in that, The scaling of the texture coordinate block with excessively small texture coordinates specifically includes: For any texture coordinate block with excessively small texture coordinates, select the texture coordinate block with excessively small texture coordinates and scale the texture coordinate surface in the selected texture coordinate block until the texture coordinate surface in the selected texture coordinate block meets the preset conditions.

7. The method according to claim 6, characterized in that, For any texture coordinate block with excessively small texture coordinates, selecting the texture coordinate block with excessively small texture coordinates and scaling the texture coordinate plane in the selected texture coordinate block until the texture coordinate plane meets the preset conditions specifically includes: Select any texture coordinate block in the baking model to be repaired that has an excessively small texture coordinate and determine the texture coordinate surface with the smallest width value in the horizontal coordinate direction among the selected texture coordinate blocks; The texture coordinate planes in the selected texture coordinate block are scaled proportionally until the short side of the bounding shell of the texture coordinate plane with the smallest width value in the horizontal coordinate direction is enlarged to the width value corresponding to the single pixel.

8. The method according to claim 6, characterized in that, For any texture coordinate block with excessively small texture coordinates, selecting the texture coordinate block with excessively small texture coordinates and scaling the texture coordinate plane in the selected texture coordinate block until the texture coordinate plane meets the preset conditions specifically includes: Select any texture coordinate block in the baking model to be repaired that has too small a texture coordinate and determine the texture coordinate surface with the smallest height value in the vertical coordinate direction of the selected texture coordinate block; The texture coordinate planes in the selected texture coordinate block are scaled proportionally until the short side of the bounding shell of the texture coordinate plane with the smallest height value in the vertical coordinate direction is enlarged to the height value corresponding to the single pixel.

9. The method according to claim 6, characterized in that, The step of obtaining the repaired baked model based on the scaled texture coordinate blocks specifically includes: Arrange the scaled texture coordinate blocks to obtain the repaired baked model.

10. A system for repairing the baking color of a baking mold, characterized in that, include: The texture coordinate block filtering unit is used to run the baking model to be repaired in the running software, obtain the texture coordinate values ​​of the baking model to be repaired, and determine the texture coordinate blocks in the baking model to be repaired that have too small texture coordinates based on the width and height values ​​of a single pixel in the texture coordinate space according to the texture coordinate values ​​of the baking model to be repaired. The texture coordinates being too small means that the width value of the bounding box of the texture coordinate plane is less than the width value of a single pixel and / or the height value is less than the height value of a single pixel. The processing unit is configured to scale the texture coordinate blocks with excessively small texture coordinates until the texture coordinate surfaces within the texture coordinate blocks meet preset conditions. These preset conditions include the width value of the texture coordinate surface being equal to the width value of a single pixel and / or the height value being equal to the height value of a single pixel. The scaled texture coordinate blocks are then arranged to obtain a repaired baked model. For any texture coordinate block with excessively small texture coordinates, selecting the selected block and scaling the texture coordinate surfaces within it until the texture coordinate surfaces meet the preset conditions specifically includes: Select any texture coordinate block in the baking model to be repaired that has too small a texture coordinate and determine the texture coordinate surface with the smallest pixel in the selected texture coordinate block; The texture coordinate planes of the selected texture coordinate block are scaled along both the horizontal and vertical axes until the width of the texture coordinate plane with the smallest pixel is equal to the width of the single pixel, and the height of the texture coordinate plane with the smallest pixel is equal to the height of the single pixel; the repaired baked model is obtained based on the scaled texture coordinate block.

11. A computer-readable storage medium, characterized in that: It stores a computer program thereon, which, when executed by a processor, implements the steps of the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Three-dimensional texture modification method and system, automatic mapping method and system

    CN108734671A