Map rendering method and device, electronic equipment and storage medium
By dividing the map into grid units and generating random offset information for sampling, the seam problem caused by repeated materials is solved, improving visual effects and hardware efficiency.
Patent Information
- Application Number
- CN202111626049.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In the existing technology, the seam line problem caused by repeated materials is difficult to avoid in the visual rendering of large areas, affecting the visual effect.
By dividing the map into multiple grid units, random offset information is generated based on the initial UV information of each grid unit, and random sampling is performed to obtain sampling data for map rendering.
It eliminates the visual repetition in texture rendering, reduces the requirements for texture resolution, improves the utilization of texture content, and reduces hardware performance consumption.
Smart Images

Figure CN114399573B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional animation technology, and in particular to a texture rendering method, device, electronic equipment and storage medium. Background Art
[0002] Material duplication is a common problem encountered by game and filmmakers in their workflows. This is because after flattening the UVs of an object, the resolution of a single texture is insufficient to meet the project's visual accuracy requirements. Therefore, the same texture needs to be repeatedly tiled to achieve improved visual accuracy.
[0003] In the existing solution, the production staff flattens the model UV according to the needs, selects the material map with appropriate resolution and directly adds it to the model in proportion to the UV size to complete the material adding process.
[0004] When drawing large areas, such as the ground or the exterior walls of large buildings, the limited resolution of available textures can cause repeated texture edges to produce noticeable traces, known as seams. Summary of the Invention
[0005] The present invention provides a texture rendering method, device, electronic device and storage medium for randomly sampling textures and rendering using the randomly sampled textures to avoid generating seams and thereby eliminate the visual repetition generated in texture rendering.
[0006] A first aspect of an embodiment of the present invention provides a texture rendering method, comprising: obtaining a first texture and dividing the first texture into a plurality of grid units, the first texture being a graphic arranged horizontally and vertically; generating random offset information corresponding to each grid unit based on initial UV information corresponding to each grid unit; sampling the first texture according to the initial UV information and the corresponding random offset information corresponding to each grid unit to obtain sampling data; and performing texture rendering on a target model using the sampling data.
[0007] In a feasible implementation, the sampling of the first map according to the initial UV information and the corresponding random offset information corresponding to each grid unit to obtain sampling data includes: generating first channel information and second channel information corresponding to each grid unit according to the corresponding random offset information, wherein the first channel information and the second channel information are both used to drive UV sampling; sampling the first map according to the initial UV information, the first channel information, and the second channel information corresponding to each grid unit to obtain sampling data.
[0008] In a feasible embodiment, the sampling of the first map according to the initial UV information, the first channel information, and the second channel information corresponding to each grid unit to obtain sampled data includes: multiplying the first channel information and the second channel information corresponding to each grid unit with a preset seed parameter to obtain a first product and a second product corresponding to each grid unit; generating a first random offset value and a second random offset value corresponding to each grid unit according to the first product, the second product, and a preset function node corresponding to each grid unit; sampling the first map according to the initial UV information, the first random offset value, and the second random offset value corresponding to each grid unit to obtain sampled data.
[0009] In a feasible embodiment, the generating the first random offset value and the second random offset value corresponding to each grid unit according to the first product, the second product and a preset function node corresponding to each grid unit includes: rounding up the first product and the second product corresponding to each grid unit through the preset first function node to obtain the first integer and the second integer corresponding to each grid unit; adjusting the first integer and the second integer corresponding to each grid unit through the preset second function node to obtain the first random offset value and the second random offset value corresponding to each grid unit, the first random offset value being used to adjust the initial U-axis coordinate in the initial UV information of each grid unit, and the second random offset value being used to adjust the initial V-axis coordinate in the initial UV information of each grid unit.
[0010] In a feasible implementation manner, the sampling of the first map according to the initial UV information, the first random offset value, and the second random offset value corresponding to each grid unit to obtain sampling data includes: summing the initial U-axis coordinate in the initial UV information corresponding to each grid unit with the first random offset value to obtain target U-axis coordinate information of each grid unit; summing the initial V-axis coordinate in the initial UV information with the second random offset value to obtain target V-axis coordinate information of each grid unit; and sampling each grid unit in the first map according to the target U-axis coordinate information and the target V-axis coordinate information of each grid unit to obtain sampling data.
[0011] In a feasible embodiment, the generating of random offset information corresponding to each grid unit based on the initial UV information corresponding to each grid unit includes: obtaining the initial UV information of each grid unit in the first map through a preset texture node to obtain the U-axis coordinate information and V-axis coordinate information of each grid unit; and generating random offset information corresponding to each grid unit according to the U-axis coordinate information and V-axis coordinate information of each grid unit.
[0012] In a feasible embodiment, the random offset information corresponding to each grid unit is generated based on the U-axis coordinate information and V-axis coordinate information of each grid unit, including: multiplying the U-axis coordinate information and V-axis coordinate information of each grid unit by a preset number of rows and columns to obtain random color information; converting the random color information into a grid-shaped vector noise map through a preset vector noise node, and determining the vector noise map as the random offset information corresponding to each grid unit.
[0013] A second aspect of an embodiment of the present invention provides a texture rendering device, comprising: an acquisition and division module for acquiring a first texture and dividing the first texture into multiple grid units, the first texture being a graphic arranged horizontally and vertically; a generation module for generating random offset information corresponding to each grid unit based on the initial UV information corresponding to each grid unit; a sampling module for sampling the first texture according to the initial UV information corresponding to each grid unit and the corresponding random offset information to obtain sampling data; and a rendering module for performing texture rendering on a target model using the sampling data.
[0014] In a feasible embodiment, the sampling module includes: a generation unit, which is used to generate first channel information and second channel information corresponding to each grid unit according to the corresponding random offset information, and the first channel information and the second channel information are both used to drive UV sampling; a sampling unit, which is used to sample the first map according to the initial UV information, the first channel information and the second channel information corresponding to each grid unit to obtain sampling data.
[0015] In a feasible embodiment, the sampling unit includes: an operation subunit, which is used to perform a product operation on the first channel information and the second channel information corresponding to each grid unit with a preset seed parameter respectively to obtain a first product and a second product corresponding to each grid unit; a generation subunit, which is used to generate a first random offset value and a second random offset value corresponding to each grid unit based on the first product, the second product and a preset function node corresponding to each grid unit; a sampling subunit, which is used to sample the first map according to the initial UV information, the first random offset value and the second random offset value corresponding to each grid unit to obtain sampling data.
[0016] In a feasible embodiment, the generating subunit is specifically used to: round up the first product and the second product corresponding to each grid unit through a preset first function node to obtain a first integer and a second integer corresponding to each grid unit; adjust the first integer and the second integer corresponding to each grid unit through a preset second function node to obtain a first random offset value and a second random offset value corresponding to each grid unit, the first random offset value is used to adjust the initial U-axis coordinate in the initial UV information of each grid unit, and the second random offset value is used to adjust the initial V-axis coordinate in the initial UV information of each grid unit.
[0017] In a feasible embodiment, the sampling subunit is specifically used to: sum the initial U-axis coordinate in the initial UV information corresponding to each grid unit with the first random offset value to obtain the target U-axis coordinate information of each grid unit; sum the initial V-axis coordinate in the initial UV information with the second random offset value to obtain the target V-axis coordinate information of each grid unit; sample each grid unit in the first map according to the target U-axis coordinate information of each grid unit and the target V-axis coordinate information of each grid unit to obtain sampling data.
[0018] In a feasible embodiment, the generation module includes: a UV information acquisition unit, which is used to obtain the initial UV information of each grid unit in the first map through a preset texture node, and obtain the U-axis coordinate information and V-axis coordinate information of each grid unit; an offset information generation unit, which is used to generate random offset information corresponding to each grid unit based on the U-axis coordinate information and V-axis coordinate information of each grid unit.
[0019] In a feasible embodiment, the offset information generation unit is specifically used to: multiply the U-axis coordinate information and V-axis coordinate information of each grid unit by a preset number of rows and columns to obtain random color information; convert the random color information into a grid-shaped vector noise map through a preset vector noise node, and determine the vector noise map as the random offset information corresponding to each grid unit.
[0020] A third aspect of an embodiment of the present invention provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory to enable the electronic device to execute the above-mentioned texture rendering method.
[0021] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned texture rendering method.
[0022] In the technical solution provided by an embodiment of the present invention, a first texture is obtained and divided into a plurality of grid cells, wherein the first texture is a graphic arranged horizontally and vertically. Based on the initial UV information corresponding to each grid cell, random offset information corresponding to each grid cell is generated. The first texture is sampled based on the initial UV information and the corresponding random offset information corresponding to each grid cell to obtain sampled data. The sampled data is then used to render the target model. In this embodiment of the present invention, the texture is randomly sampled and rendered using the randomly sampled texture, thereby avoiding the generation of seams and eliminating the visual repetition caused by the texture rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A schematic diagram of an embodiment of a texture rendering method according to an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of a grid unit according to an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of another embodiment of a texture rendering method according to an embodiment of the present invention;
[0026] Figure 4 Schematic diagram comparing rendering effects before and after random sampling in an embodiment of the present invention;
[0027] Figure 5 A schematic diagram of an embodiment of a texture rendering device according to an embodiment of the present invention;
[0028] Figure 6 FIG. 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The present invention provides a texture rendering method, device, electronic device and storage medium for randomly sampling textures and rendering using the randomly sampled textures to avoid generating seams and thereby eliminate the visual repetition generated in texture rendering.
[0030] It is understandable that the present invention can be applied to electronic devices. As an example but not a limitation, the electronic device can be a server. This application is described using a server as an example.
[0031] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the invention described herein can, for example, be implemented in orders other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0032] In existing solutions, developers flatten the model's UVs as needed, select a texture map with the appropriate resolution, and directly apply it to the model in a proportional manner to the UV size to complete the material addition process. Scaling is performed slightly or not at all to ensure material accuracy. When rendering large areas, the upper limit of available material resolution can lead to a repetitive effect in the rendering.
[0033] See also Figure 1 , a flowchart of a texture rendering method provided by an embodiment of the present invention specifically includes:
[0034] 101. Obtain a first map and divide the first map into a plurality of grid units, wherein the first map is a graphic arranged horizontally and vertically.
[0035] The server obtains the first texture and divides it into multiple grid cells. The first texture is a graphic arranged horizontally and vertically. The first texture must be arranged horizontally and vertically in a certain pattern with clear boundaries. The first texture can be a specific material texture, such as a floor tile texture, a wall tile, or a ceramic tile texture. Natural organic textures such as grass, stone, and sand cannot be used as the first texture.
[0036] It should be noted that the execution subject of the present invention may be a server or a terminal, and the embodiments of the present invention are described using a server as an example.
[0037] It is understood that the size of the grid cells can be set according to actual conditions. That is, the number of horizontal grid cells in each row and the number of vertical grid cells in each column can be set, and the number of horizontal grid cells and the number of vertical grid cells can be the same or different. For example, the first map can be divided into 4*4 grid cells, or 6*6 grid cells, or other values are also possible, and the specific values are not limited here.
[0038] 102. Generate random offset information corresponding to each grid unit based on the initial UV information corresponding to each grid unit.
[0039] The server generates random offset information for each grid cell based on the initial UV information corresponding to each grid cell. Because UV information is two-channel information and random offset information is three-channel information, the Append node is used to add a third channel, with the row and column numbers as the third channel information and the three channels as the random offset information.
[0040] It should be noted that the initial UV information of each grid unit is different, for example, Figure 2 As shown, the first map has been divided into 4*4 grid units, numbered 1-16, and the coordinates corresponding to each grid unit are shown in the figure. The four vertex coordinates of grid unit No. 1 are (0, 0), (0.25, 0), (0, 0.25), and (0.25, 0.25), while the four vertex coordinates of grid unit No. 6 are (0.25, 0.25), (0.5, 0.25), (0.25, 0.5), and (0.5, 0.5). The other grid units are similar and will not be described in detail here.
[0041] 103. Sample the first map according to the initial UV information and the corresponding random offset information corresponding to each grid unit to obtain sampling data.
[0042] The server samples the first map according to the initial UV information and the corresponding random offset information of each grid unit to obtain sampling data. Each grid unit needs to be sampled separately, for example, according to the random offset information Figure 2 The material effect of grid 1 is sampled to the corresponding position of grid 6.
[0043] 104. Render the target model using the sampling data.
[0044] The server uses the sampled data to render the target model. The target model can be divided into multiple texture areas, each of which can be rendered based on pre-collected sampled data to achieve a material tiling effect.
[0045] In an embodiment of the present invention, textures are randomly sampled and rendered using the randomly sampled textures, thereby avoiding the generation of seams and eliminating the visual repetition generated in texture rendering. This reduces the resolution requirements for the textures, improves the utilization rate of the texture content, and reduces the consumption of hardware performance.
[0046] See also Figure 3 , another flowchart of the texture rendering method provided by an embodiment of the present invention specifically includes:
[0047] 301. Obtain a first map and divide the first map into a plurality of grid units, wherein the first map is a graphic arranged horizontally and vertically.
[0048] The server obtains the first texture and divides it into multiple grid cells. The first texture is a graphic arranged horizontally and vertically. The first texture must be arranged horizontally and vertically in a certain pattern with clear boundaries. The first texture can be a specific material texture, such as a floor tile texture, a wall tile, or a ceramic tile texture. Natural organic textures such as grass, stone, and sand cannot be used as the first texture.
[0049] It should be noted that the execution subject of the present invention may be a server or a terminal, and the embodiments of the present invention are described using a server as an example.
[0050] It is understood that the size of the grid cells can be set according to actual conditions. That is, the number of horizontal grid cells in each row and the number of vertical grid cells in each column can be set, and the number of horizontal grid cells and the number of vertical grid cells can be the same or different. For example, the first map can be divided into 4*4 grid cells, or 6*6 grid cells, or other values are also possible, and the specific values are not limited here.
[0051] 302. Generate random offset information corresponding to each grid unit based on the initial UV information corresponding to each grid unit.
[0052] Specifically, the server uses a pre-configured texture node to obtain the initial UV information for each grid cell in the first map, obtaining the U-axis and V-axis coordinate information for each grid cell. Based on this information, the server generates the corresponding random offset information for each grid cell. Because UV information is two-channel information and random offset information is three-channel information, the Append node is used to add a third channel, using the row and column numbers as the third channel information and the three-channel information as the random offset information (i.e., vector noise).
[0053] It should be noted that the initial UV information of each grid unit is different, for example, Figure 2 As shown, the first map has been divided into 4*4 grid units, numbered 1-16, and the coordinates corresponding to each grid unit are shown in the figure. The four vertex coordinates of grid unit No. 1 are (0, 0), (0.25, 0), (0, 0.25), and (0.25, 0.25), while the four vertex coordinates of grid unit No. 6 are (0.25, 0.25), (0.5, 0.25), (0.25, 0.5), and (0.5, 0.5). The other grid units are similar and will not be described in detail here.
[0054] In a feasible implementation, the server generates random offset information corresponding to each grid unit according to the U-axis coordinate information and the V-axis coordinate information of each grid unit, including:
[0055] The server multiplies the U-axis coordinate information and V-axis coordinate information of each grid unit by the preset number of rows and columns to obtain random color information; the server converts the random color information into a grid-shaped vector noise map through a preset vector noise node, and determines the vector noise map as the random offset information corresponding to each grid unit.
[0056] 303. Generate first channel information and second channel information corresponding to each grid unit according to the corresponding random offset information. Both the first channel information and the second channel information are used to drive UV sampling.
[0057] The first channel information is the red channel information in the RGB channel, and the second channel information is the green channel information. The red channel information is used to drive U-axis sampling, and the green channel information is used to drive V-axis sampling.
[0058] For example, extract the red and green color channels from the random offset information as floating-point information to drive the UV coordinates. On a 4X4 grid, divide each grid into 0.25, 0.5, 0.75, and 1 in the form of a coordinate system. The UV coordinate offset after driving must be a multiple of the above 4 to ensure correct performance when the material is repeated.
[0059] It should be noted that any two of the three RGB channels can be used to drive UV sampling. The values will be decimals between 0 and 1, which does not affect subsequent calculations; only the random values will vary. Since vector parameters do not have transparency information, their values will always be 0, so the transparency channel cannot be selected.
[0060] 304. Perform product operations on the first channel information and the second channel information corresponding to each grid unit and the preset seed parameter respectively to obtain a first product and a second product corresponding to each grid unit.
[0061] The server performs product operations on the first channel information and the second channel information corresponding to each grid unit and the preset seed parameter respectively to obtain the first product and the second product corresponding to each grid unit.
[0062] It should be noted that since 1 multiplied by any number except 0 is equal to itself and therefore meaningless, the seed parameter can be any number except 1, and its function is to multiply the grayscale value (first channel information or second channel information) and then round it.
[0063] 305 . Generate a first random offset value and a second random offset value corresponding to each grid unit according to the first product, the second product, and a preset function node corresponding to each grid unit.
[0064] Specifically, the server rounds up the first product and the second product corresponding to each grid unit through a preset first function node to obtain a first integer and a second integer corresponding to each grid unit; the server adjusts the first integer and the second integer corresponding to each grid unit through a preset second function node to obtain a first random offset value and a second random offset value corresponding to each grid unit, the first random offset value is used to adjust the initial U-axis coordinate in the initial UV information of each grid unit, and the second random offset value is used to adjust the initial V-axis coordinate in the initial UV information of each grid unit.
[0065] For example, when the grayscale information derived from the color channel of the random offset information is a random decimal between 0 and 1, such as 0.35, it is rounded up to 1 using the first function node (such as the ceil node), and then divided by the number of vertical and horizontal grids (here, assuming 4). That is, 0.35 is rounded to 1 divided by 4, which equals 0.25. At this time, because all grayscale values are decimals between 0 and 1, their integer value is always equal to 1, which will make all offset values consistent. Therefore, the floating-point number is multiplied by the seed number (using 10 as an example here), that is, 0.35*10=3.5 rounded to 4, and then divided by 4 equals 1. When the grayscale value is different, the offset value will be different, thus completing the generation of the random offset number.
[0066] 306. Sample the first map according to the initial UV information, the first random offset value, and the second random offset value corresponding to each grid unit to obtain sampled data.
[0067] Specifically, the server sums the initial U-axis coordinate in the initial UV information corresponding to each grid unit with the first random offset value to obtain the target U-axis coordinate information of each grid unit; the server sums the initial V-axis coordinate in the initial UV information with the second random offset value to obtain the target V-axis coordinate information of each grid unit; the server samples each grid unit in the first map according to the target U-axis coordinate information and the target V-axis coordinate information of each grid unit to obtain sampled data. Each grid unit needs to be sampled separately, for example, according to the random offset information, Figure 2 The material effect of grid 1 is sampled to the corresponding position of grid 6.
[0068] 307. Render the target model using the sampled data.
[0069] The server renders the target model using the sampled data. The target model can be divided into multiple mapping areas, and each mapping area can be rendered based on the pre-collected sampling data to achieve a material tiling effect. Figure 4As shown, the left image shows the effect of the existing solution, showing that the materials have obvious visual repetition, while the right image shows the effect after random processing. In summary, when using materials that naturally follow a grid arrangement, such as floor tiles, ceramic tiles, and brick walls, the solution of the embodiment of the present invention can completely eliminate the problem of material repetition.
[0070] In an embodiment of the present invention, textures are randomly sampled and rendered using the randomly sampled textures, thereby avoiding the generation of seams and eliminating the visual repetition generated in texture rendering. This reduces the resolution requirements for the textures, improves the utilization rate of the texture content, and reduces the consumption of hardware performance.
[0071] The above describes the texture rendering method in the embodiment of the present invention. The following describes the texture rendering device in the embodiment of the present invention. Figure 5 , an embodiment of a texture rendering device in an embodiment of the present invention includes:
[0072] An acquisition and division module 501 is configured to acquire a first map and divide the first map into a plurality of grid units, wherein the first map is a graphic arranged horizontally and vertically;
[0073] A generating module 502 is configured to generate random offset information corresponding to each grid cell based on initial UV information corresponding to each grid cell;
[0074] A sampling module 503 is configured to sample the first map according to the initial UV information and the corresponding random offset information corresponding to each grid unit to obtain sampling data;
[0075] The rendering module 504 is used to perform texture rendering on the target model using the sampling data.
[0076] In a feasible implementation, the sampling module 503 includes:
[0077] A generating unit 5031 is configured to generate first channel information and second channel information corresponding to each grid unit according to the corresponding random offset information, where both the first channel information and the second channel information are used to drive UV sampling;
[0078] The sampling unit 5032 is configured to sample the first map according to the initial UV information, the first channel information, and the second channel information corresponding to each grid unit to obtain sampling data.
[0079] In a feasible implementation manner, the sampling unit 5032 includes:
[0080] An operator unit 50321 is configured to perform a product operation on the first channel information and the second channel information corresponding to each grid unit and a preset seed parameter, respectively, to obtain a first product and a second product corresponding to each grid unit;
[0081] a generating subunit 50322, configured to generate a first random offset value and a second random offset value corresponding to each grid cell according to the first product, the second product, and a preset function node corresponding to each grid cell;
[0082] The sampling subunit 50323 is used to sample the first map according to the initial UV information, the first random offset value and the second random offset value corresponding to each grid unit to obtain sampling data.
[0083] In a feasible implementation manner, the generating subunit 50322 is specifically configured to:
[0084] Rounding up the first product and the second product corresponding to each grid unit respectively through a preset first function node to obtain a first integer and a second integer corresponding to each grid unit;
[0085] The first integer and the second integer corresponding to each grid cell are adjusted respectively through a preset second function node to obtain a first random offset value and a second random offset value corresponding to each grid cell, where the first random offset value is used to adjust the initial U-axis coordinate in the initial UV information of each grid cell, and the second random offset value is used to adjust the initial V-axis coordinate in the initial UV information of each grid cell.
[0086] In a feasible implementation manner, the sampling subunit 50323 is specifically configured to:
[0087] Summing the initial U-axis coordinate in the initial UV information corresponding to each grid unit and the first random offset value to obtain target U-axis coordinate information of each grid unit;
[0088] Summing the initial V-axis coordinate in the initial UV information and the second random offset value to obtain target V-axis coordinate information of each grid unit;
[0089] Each grid unit in the first map is sampled according to the target U-axis coordinate information of each grid unit and the target V-axis coordinate information of each grid unit to obtain sampling data.
[0090] In a feasible implementation, the generating module 502 includes:
[0091] A UV information acquisition unit 5021 is configured to acquire initial UV information of each grid unit in the first map through a preset texture node, and obtain U-axis coordinate information and V-axis coordinate information of each grid unit;
[0092] The offset information generating unit 5022 is configured to generate random offset information corresponding to each grid unit according to the U-axis coordinate information and the V-axis coordinate information of each grid unit.
[0093] In a feasible implementation manner, the offset information generating unit 5022 is specifically configured to:
[0094] Multiplying the U-axis coordinate information and the V-axis coordinate information of each grid unit by the preset row and column numbers respectively to obtain random color information;
[0095] The random color information is converted into a grid-shaped vector noise map through a preset vector noise node, and the vector noise map is determined as random offset information corresponding to each grid unit.
[0096] Figure 6 : is a structural diagram of an electronic device provided by an embodiment of the present invention. The electronic device 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 610 (for example, one or more processors) and a memory 620, and one or more storage media 630 (for example, one or more mass storage devices) storing application programs 633 or data 632. Among them, the memory 620 and the storage medium 630 can be temporary storage or permanent storage. The program stored in the storage medium 630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the electronic device 600. Furthermore, the processor 610 can be configured to communicate with the storage medium 630 to execute a series of instruction operations in the storage medium 630 on the electronic device 600.
[0097] The electronic device 600 may further include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input and output interfaces 660, and / or one or more operating devices 631, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 6 The illustrated structure of the electronic device does not limit the electronic device and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0098] As an example and not a limitation, the electronic device 900 may be a server or a terminal device.
[0099] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, cause the computer to execute the steps of the texture rendering method.
[0100] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0101] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0103] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0104] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A texture rendering method, characterized in that: include: Obtain a first texture, and divide the first texture into a plurality of grid units, wherein the first texture is a graphic arranged horizontally and vertically, and the first texture is a material that naturally follows a grid arrangement; Generate random offset information corresponding to each grid cell based on the initial UV information corresponding to each grid cell; Sampling the first map according to the initial UV information and the corresponding random offset information corresponding to each grid unit to obtain sampling data; The target model is texture rendered using the sampling data.
2. The texture rendering method according to claim 1, characterized in that: The sampling of the first map according to the initial UV information and the corresponding random offset information corresponding to each grid unit to obtain sampling data includes: Generate first channel information and second channel information corresponding to each grid unit according to the corresponding random offset information, where the first channel information and the second channel information are both used to drive UV sampling; The first map is sampled according to the initial UV information, the first channel information, and the second channel information corresponding to each grid unit to obtain sampling data.
3. The texture rendering method according to claim 2, wherein: The sampling of the first map according to the initial UV information, the first channel information, and the second channel information corresponding to each grid unit to obtain sampling data includes: Perform product operations on the first channel information and the second channel information corresponding to each grid unit and the preset seed parameter respectively to obtain the first product and the second product corresponding to each grid unit; Generate a first random offset value and a second random offset value corresponding to each grid unit according to the first product, the second product, and a preset function node corresponding to each grid unit; The first map is sampled according to the initial UV information, the first random offset value, and the second random offset value corresponding to each grid unit to obtain sampling data.
4. The texture rendering method according to claim 3, wherein: Generating a first random offset value and a second random offset value corresponding to each grid unit according to the first product, the second product, and a preset function node corresponding to each grid unit includes: Rounding up the first product and the second product corresponding to each grid unit respectively through a preset first function node to obtain a first integer and a second integer corresponding to each grid unit; The first integer and the second integer corresponding to each grid cell are adjusted respectively through a preset second function node to obtain a first random offset value and a second random offset value corresponding to each grid cell, where the first random offset value is used to adjust the initial U-axis coordinate in the initial UV information of each grid cell, and the second random offset value is used to adjust the initial V-axis coordinate in the initial UV information of each grid cell.
5. The texture rendering method according to claim 3, wherein: The sampling of the first map according to the initial UV information, the first random offset value, and the second random offset value corresponding to each grid unit to obtain sampling data includes: Summing the initial U-axis coordinate in the initial UV information corresponding to each grid unit and the first random offset value to obtain target U-axis coordinate information of each grid unit; Summing the initial V-axis coordinate in the initial UV information and the second random offset value to obtain target V-axis coordinate information of each grid unit; Each grid unit in the first map is sampled according to the target U-axis coordinate information of each grid unit and the target V-axis coordinate information of each grid unit to obtain sampling data.
6. The texture rendering method according to any one of claims 1 to 5, characterized in that: Generating random offset information corresponding to each grid unit based on the initial UV information corresponding to each grid unit includes: Obtaining initial UV information of each grid unit in the first map through a preset texture node to obtain U-axis coordinate information and V-axis coordinate information of each grid unit; Random offset information corresponding to each grid unit is generated according to the U-axis coordinate information and the V-axis coordinate information of each grid unit.
7. The texture rendering method according to claim 6, characterized in that: Generating random offset information corresponding to each grid unit according to the U-axis coordinate information and the V-axis coordinate information of each grid unit includes: Multiplying the U-axis coordinate information and the V-axis coordinate information of each grid unit by the preset row and column numbers respectively to obtain random color information; The random color information is converted into a grid-shaped vector noise map through a preset vector noise node, and the vector noise map is determined as random offset information corresponding to each grid unit.
8. A texture rendering device, characterized in that: include: An acquisition and division module, configured to acquire a first texture and divide the first texture into a plurality of grid units, wherein the first texture is a graphic arranged horizontally and vertically, and the first texture is a material that naturally follows a grid arrangement; A generation module, configured to generate random offset information corresponding to each grid cell based on the initial UV information corresponding to each grid cell; a sampling module, configured to sample the first map according to the initial UV information and the corresponding random offset information corresponding to each grid unit to obtain sampling data; The rendering module is used to perform texture rendering on the target model using the sampling data.
9. An electronic device, characterized in that: The electronic device includes: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory to enable the electronic device to execute the texture rendering method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the texture rendering method according to any one of claims 1 to 7 is implemented.