A method, device and electronic equipment for drawing surface texture

By performing program random sampling and tiling of surface texture templates in a three-dimensional scene, combined with the use of mixed weights of the template, the problem of repeated and unnatural surface textures at different visual distances is solved, and the similarity between the three-dimensional scene and the real scene is improved.

CN114663567BActive Publication Date: 2025-02-11JINSHAN SHIYOU (WUHAN) NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210113441.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-30
Publication Date
2025-02-11
Estimated Expiration
2042-01-30

AI Technical Summary

Technical Problem

In the case where the surface textures of surface areas under different visual ranges have high definition, it is difficult to reduce the repetition and unnatural phenomena of surface textures, and cannot meet the similarity requirements between three-dimensional scenes and real scenes.

Method used

By randomly sampling each target surface texture template in the corresponding tiling value of the surface area to be drawn in the three-dimensional scene, the texture template to be tiled is generated, and the tiling value to be tiled is obtained Mix texture template. Then, use these texture templates to be mixed according to the preset template mixing weights to draw the surface texture.

Benefits of technology

It realizes that the surface textures in the surface area at different visual ranges have high definition, reducing the repetition and unnatural phenomena of surface textures, making the surface texture closer to the real surface, thereby improving the similarity between three-dimensional scenes and real scenes. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114663567B_ABST
    Figure CN114663567B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention provide a method, device and electronic device for drawing surface textures, and relate to the technical field of three-dimensional scene texture drawing. The method comprises: based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, program random sampling is performed on each target surface texture template to generate a texture template to be tiled corresponding to the target surface texture template; according to the tiling value to be used, each texture template to be tiled is tiled respectively to obtain each texture template to be mixed; using each texture template to be mixed, according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, the surface texture is drawn to obtain the surface texture of the surface area to be drawn. Compared with the prior art, the solution provided by the embodiment of the present invention can reduce the repetitive and unnatural phenomena of surface texture presentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of three-dimensional scene texture rendering, and in particular to a method, device and electronic equipment for rendering ground surface texture. Background Art

[0002] Currently, in order to provide users with a better experience, the geographical area of ​​​​the three-dimensional scenes in various applications is becoming larger and larger, and the surface features are becoming richer and richer.

[0003] In order to make the surface texture in the three-dimensional scene closer to the surface texture in the real scene, a pre-made surface texture template to be used can usually be selected according to the surface features of the surface area in the three-dimensional scene, so that the surface texture is drawn for the surface area according to the selected surface texture template.

[0004] Considering the user experience, in a three-dimensional scene, it is usually hoped that the surface texture of the surface area at different viewing distances can have high clarity.

[0005] In the related art, in order to achieve high clarity of surface textures in surface areas at different viewing distances, the surface texture template may be repeatedly sampled, and a larger area of ​​surface texture may be tiled with smaller-sized sampling results.

[0006] However, in the above-mentioned related technologies, the surface texture obtained by tiling the sampling results obtained by repeated sampling will show obvious texture repetition and unnatural texture phenomena, and cannot meet the similarity requirements between the three-dimensional scene and the real scene.

[0007] Based on this, while achieving high clarity of surface textures in surface areas at different viewing distances, how to reduce the repetitive and unnatural phenomena in the presentation of surface textures and improve the similarity between three-dimensional scenes and real scenes is a technical problem that needs to be solved urgently. Summary of the invention

[0008] The purpose of the embodiments of the present invention is to provide a method, device and electronic device for drawing surface textures, so as to realize that the surface textures of surface areas at different viewing distances can have high clarity, while reducing the device memory pressure, improving the running speed of the application, and reducing the repetitive and unnatural phenomena of the surface texture presentation, thereby improving the similarity between the three-dimensional scene and the real scene. The specific technical solution is as follows:

[0009] In a first aspect, an embodiment of the present invention provides a method for rendering a surface texture, the method comprising:

[0010] Based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, each target surface texture template is randomly sampled by a program to generate a texture template to be tiled corresponding to the target surface texture template;

[0011] According to the tiling value to be used, each texture template to be tiled is tiled respectively to obtain each texture template to be mixed; wherein each texture template to be mixed has the same shape and size as the surface area to be drawn;

[0012] The surface texture is drawn using the obtained texture templates to be mixed according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, so as to obtain the surface texture of the surface area to be drawn.

[0013] Optionally, in a specific implementation, before performing program random sampling on each target surface texture template based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene to generate a texture template to be tiled corresponding to the target surface texture template, the method further includes:

[0014] Determine the target sight distance corresponding to the surface area to be drawn in the three-dimensional scene;

[0015] According to a pre-established mapping relationship between viewing distance and tiling value, a tiling value corresponding to the target viewing distance is determined as a tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene.

[0016] Optionally, in a specific implementation, in the mapping relationship, the larger the viewing distance, the smaller the corresponding tiling value.

[0017] Optionally, in a specific implementation, the target surface texture template is: a surface texture template that matches the surface features of the surface area to be mapped.

[0018] Optionally, in a specific implementation, the method of drawing the surface texture by using the obtained texture templates to be mixed according to the template mixing weights pre-set for the surface area to be drawn and corresponding to the target surface texture templates to obtain the surface texture of the surface area to be drawn includes:

[0019] Using the obtained texture templates to be mixed, and according to the specified mixing weight map, the surface texture is drawn to obtain the surface texture of the surface area to be drawn;

[0020] The designated blending weight map is pre-set for the surface area to be drawn, and is used to characterize the template blending weights corresponding to each target surface texture template.

[0021] Optionally, in a specific implementation, the number of the target surface texture templates is multiple, and the method of using the obtained texture templates to be mixed to draw the surface texture according to the specified mixing weight map to obtain the surface texture of the surface area to be drawn includes:

[0022] For each pixel point of the surface area to be drawn, a predetermined drawing operation is performed to obtain a surface texture of the surface area to be drawn;

[0023] Wherein, the predetermined drawing operation includes:

[0024] Obtain the color value of the first pixel point with the same coordinates as the pixel point in each texture template to be mixed, obtain the color values ​​of multiple first pixel points, and obtain the channel values ​​of each color channel of the second pixel point with the same coordinates as the pixel point in the specified mixing weight map;

[0025] Determining a template mixing weight of a target surface texture template corresponding to each color channel based on the channel values ​​of each color channel of the second pixel point;

[0026] Calculate the product of the color value of each first pixel obtained and the template mixing weight of the target surface texture template corresponding to the target color channel of the first pixel to obtain the channel value of each target color channel of the pixel in the surface area to be drawn;

[0027] The pixel point of the surface area to be drawn is drawn using the channel values ​​of each target color channel of the pixel point of the surface area to be drawn.

[0028] Optionally, in a specific implementation, before performing program random sampling on each target surface texture template based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene to generate a texture template to be tiled corresponding to the target surface texture template, the method further includes:

[0029] From a plurality of pre-made surface texture templates, each surface texture template matching the surface features of the surface area to be mapped is selected to obtain each target surface texture template.

[0030] In a second aspect, an embodiment of the present invention provides a device for drawing surface textures, the device comprising:

[0031] A template generation module is used to perform random sampling on each target surface texture template based on the tile value to be used corresponding to the surface area to be drawn in the three-dimensional scene, and generate a to-be-tiled texture template corresponding to the target surface texture template;

[0032] A template tiling module, used to tile each texture template to be tiled according to the tiling value to be used, to obtain each texture template to be mixed; wherein each texture template to be mixed has the same shape and size as the surface area to be drawn;

[0033] The texture drawing module is used to use the obtained texture templates to be mixed to draw the surface texture according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, so as to obtain the surface texture of the surface area to be drawn.

[0034] Optionally, in a specific implementation, the device further includes:

[0035] A view distance determination module, used for determining a target view distance of a surface area to be drawn in a three-dimensional scene before performing program random sampling on each target surface texture template based on the tile value to be used corresponding to the surface area to be drawn in the three-dimensional scene and generating a texture template to be tiled corresponding to the target surface texture template;

[0036] The tile value determination module is used to determine the tile value corresponding to the target viewing distance according to a pre-established mapping relationship between the viewing distance and the tile value, as the tile value to be used corresponding to the surface area to be drawn in the three-dimensional scene.

[0037] Optionally, in a specific implementation, in the mapping relationship, the larger the viewing distance, the smaller the corresponding tiling value.

[0038] Optionally, in a specific implementation, the target surface texture template is: a surface texture template that matches the surface features of the surface area to be mapped.

[0039] Optionally, in a specific implementation, the texture rendering module includes:

[0040] The first drawing submodule is used to draw the surface texture by using the obtained texture templates to be mixed according to the specified mixing weight map to obtain the surface texture of the surface area to be drawn;

[0041] The designated blending weight map is pre-set for the surface area to be drawn, and is used to characterize the template blending weights corresponding to each target surface texture template.

[0042] Optionally, in a specific implementation, there are multiple target surface texture templates, and the first drawing submodule is specifically used to:

[0043] For each pixel point of the surface area to be drawn, a predetermined drawing operation is performed to obtain a surface texture of the surface area to be drawn;

[0044] Wherein, the predetermined drawing operation includes:

[0045] Obtain the color value of the first pixel point with the same coordinates as the pixel point in each texture template to be mixed, obtain the colors of multiple first pixel points, and obtain the channel values ​​of each color channel of the second pixel point with the same coordinates as the pixel point in the specified mixing weight map;

[0046] Determining a template mixing weight of a target surface texture template corresponding to each color channel based on the channel values ​​of each color channel of the second pixel point;

[0047] Calculate the product of the color value of each first pixel obtained and the template mixing weight of the target surface texture template corresponding to the target color channel of the first pixel to obtain the channel value of each target color channel of the pixel in the surface area to be drawn;

[0048] The pixel point of the surface area to be drawn is drawn using the channel values ​​of each target color channel of the pixel point of the surface area to be drawn.

[0049] Optionally, in a specific implementation, the device further includes:

[0050] The template selection module is used to perform program random sampling on each target surface texture template based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, and before generating a texture template to be tiled corresponding to the target surface texture template, select each surface texture template that matches the surface features of the surface area to be drawn from multiple pre-made surface texture templates to obtain each target surface texture template.

[0051] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0052] Memory, used to store computer programs;

[0053] The processor is used to implement the steps of any surface texture rendering method provided in the first aspect when executing the program stored in the memory.

[0054] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any surface texture rendering method provided in the first aspect are implemented.

[0055] In a fifth aspect, an embodiment of the present invention provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps of any one of the surface texture rendering methods provided in the first aspect.

[0056] Beneficial effects of the embodiments of the present invention:

[0057] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, when texture drawing is performed on the surface area to be drawn, the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene can be first determined. After that, each texture template to be tiled can be tiled according to the tiling value to be used to obtain each texture template to be mixed, and each texture template to be mixed has the same shape and size as the surface area to be drawn. Then, the obtained multiple texture templates to be mixed can be used to draw the surface texture according to the template mixing weights pre-set for the surface area to be drawn and corresponding to the multiple target surface texture templates, so as to obtain the surface texture of the surface area to be drawn.

[0058] Based on this, the scheme provided by the embodiment of the present invention is applied. In the process of drawing the surface texture area to be drawn, the tiling value to be used corresponding to the surface area to be drawn is used to perform program random sampling on each target surface texture template, which can enrich the image content of the texture template to be tiled. Thus, the surface texture drawing using the texture template to be tiled can avoid the repetitive and unnatural phenomena presented by the drawn surface texture. In this way, the repetitive and unnatural phenomena presented by the surface texture can be reduced while achieving high clarity of the surface texture of the surface area at different viewing distances, so that the surface texture is closer to the real surface, thereby improving the similarity between the three-dimensional scene and the real scene. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0060] Figure 1 A schematic diagram of a flow chart of a method for rendering surface texture provided by an embodiment of the present invention;

[0061] Figure 2 A schematic flow chart of another method for rendering surface texture provided by an embodiment of the present invention;

[0062] Figure 3 A schematic diagram of a flow chart of another method for drawing surface texture provided by an embodiment of the present invention

[0063] Figure 4 A flowchart of the reservation drawing operation in step B11;

[0064] Figure 5 A schematic flow chart of a specific example of a method for rendering ground texture provided by an embodiment of the present invention;

[0065] Figure 6 A schematic diagram of the structure of a ground surface texture drawing device provided by an embodiment of the present invention;

[0066] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0067] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field based on this application belong to the scope of protection of the present invention.

[0068] In the related art, in order to achieve high clarity of surface textures in surface areas at different viewing distances, the surface texture template may be repeatedly sampled, and a larger area of ​​surface texture may be tiled with smaller-sized sampling results.

[0069] However, in the above-mentioned related technologies, the surface texture obtained by tiling the sampling results obtained by repeated sampling will show obvious texture repetition and unnatural texture phenomena, and cannot meet the similarity requirements between the three-dimensional scene and the real scene.

[0070] Based on this, while achieving high clarity of surface textures in surface areas at different viewing distances, how to reduce the repetitive and unnatural phenomena in the presentation of surface textures and improve the similarity between three-dimensional scenes and real scenes is a technical problem that needs to be solved urgently.

[0071] In order to solve the above technical problems, an embodiment of the present invention provides a method for rendering surface texture.

[0072] Among them, the method can be applied to various electronic devices that can run various applications with three-dimensional scenes, such as laptops, desktop computers, mobile phones, tablet devices, etc.; further, the method can be applied to various applications that need to perform texture drawing on the surface area in the three-dimensional scene, such as three-dimensional game software, three-dimensional shopping mall guide software, three-dimensional tourist attraction guide software, etc. In other words, the method can be applied to various application scenarios using the above-mentioned applications, such as players playing games, tourists visiting attractions, consumers shopping, etc.

[0073] In this regard, the embodiments of the present invention do not limit the execution subject and application scenario of the method.

[0074] A method for rendering a ground surface texture provided by an embodiment of the present invention may include the following steps:

[0075] Based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, each target surface texture template is randomly sampled by a program to generate a texture template to be tiled corresponding to the target surface texture template;

[0076] According to the tiling value to be used, each texture template to be tiled is tiled respectively to obtain each texture template to be mixed; wherein each texture template to be mixed has the same shape and size as the surface area to be drawn;

[0077] The surface texture is drawn using the obtained texture templates to be mixed according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, so as to obtain the surface texture of the surface area to be drawn.

[0078] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, when texture drawing is performed on the surface area to be drawn, the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene can be first determined. After that, each texture template to be tiled can be tiled according to the tiling value to be used to obtain each texture template to be mixed, and each texture template to be mixed has the same shape and size as the surface area to be drawn. Then, the obtained multiple texture templates to be mixed can be used to draw the surface texture according to the template mixing weights pre-set for the surface area to be drawn and corresponding to the multiple target surface texture templates, so as to obtain the surface texture of the surface area to be drawn.

[0079] Based on this, the scheme provided by the embodiment of the present invention is applied. In the process of drawing the surface texture area to be drawn, the tiling value to be used corresponding to the surface area to be drawn is used to perform program random sampling on each target surface texture template, which can enrich the image content of the texture template to be tiled. Thus, the surface texture drawing using the texture template to be tiled can avoid the repetitive and unnatural phenomena presented by the drawn surface texture. In this way, the repetitive and unnatural phenomena presented by the surface texture can be reduced while achieving high clarity of the surface texture of the surface area at different viewing distances, so that the surface texture is closer to the real surface, thereby improving the similarity between the three-dimensional scene and the real scene.

[0080] A method for rendering ground surface texture provided by an embodiment of the present invention is described in detail below in conjunction with the accompanying drawings.

[0081] Figure 1 A schematic diagram of a surface texture rendering method provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method may include the following steps:

[0082] S101: Based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, program random sampling is performed on each target surface texture template to generate a to-be-tiled texture template corresponding to the target surface texture template;

[0083] During the running of the application, as the user operates, for example, sliding the screen, zooming the screen, turning the electronic device, etc., the 3D scene of the application viewed by the user will change, and some areas in the 3D scene that were not presented before the user's operation, such as the ground area, the wall area, the object area, etc., will be presented to the user as the user operates. Furthermore, these areas that were not presented before the user's operation but are presented as the user operates can be called areas to be drawn.

[0084] Based on this, optionally, for the surface area to be drawn, the surface area to be drawn may be pre-drawn and presented according to the user's operation. Furthermore, the embodiment of the present invention provides a process for facilitating the pre-drawing of the surface area to be drawn.

[0085] Optionally, for the above-mentioned surface area to be drawn, the surface area to be drawn may also be drawn in real time as the user operates, that is, before the user operates to indicate the presentation of the above-mentioned surface area to be drawn, the above-mentioned surface area to be drawn has not been completed, but starts to be drawn as the user operates.

[0086] In the embodiment of the present invention, a corresponding tile value to be used may be set in advance for each surface area to be drawn. For example, a corresponding tile value to be used may be set for each surface area to be drawn according to the sight distance of each surface area to be drawn; a corresponding tile value to be used may also be set for each surface area to be drawn according to the surface features corresponding to each surface area to be drawn. Of course, a corresponding tile value to be used may also be set for each surface area to be drawn according to other rules. All of these are reasonable.

[0087] In this way, when drawing the surface area to be drawn in the three-dimensional scene, you can first obtain the tiling values ​​to be used and each target surface texture template corresponding to the surface area to be drawn. Then, after obtaining the above-mentioned tiling values ​​to be used and each target surface texture template, you can perform program random sampling on each target surface texture template based on the tiling values ​​to be used to generate a texture template to be tiled corresponding to the target surface texture template.

[0088] The so-called tiling value is a two-dimensional floating-point array, and the two floating-point numbers included therein represent the scaling factors in the horizontal direction and the vertical direction during the texture mapping process, respectively, and the scaling factors may be less than 1. Thus, for the surface area to be drawn, the tiling value corresponding to the surface area to be drawn can be used to determine: when the surface area to be drawn is obtained by tiling the texture templates of the same size, the number of texture templates required in the horizontal direction and the vertical direction.

[0089] The so-called texture mapping process refers to: the process of mapping texture pixels in the texture space to the grid or screen space. In the embodiment of the present invention, the above-mentioned texture mapping process can be understood as: after performing program random sampling on each target surface texture template, the obtained texture template to be tiled is tiled to obtain each texture template to be mixed.

[0090] After determining the tiling value corresponding to the surface area to be drawn, it is possible to determine the number of texture templates to be tiled required in the horizontal and vertical directions when tiling the texture templates to be tiled corresponding to each target surface texture template to obtain the texture template to be mixed; furthermore, the shape and size of the texture template to be tiled corresponding to each target surface texture template can be determined by using the shape and size of the surface area to be drawn and the above-determined number.

[0091] In this way, for each target surface texture template, the target surface texture template can be randomly sampled according to the shape and size of the texture template to be tiled corresponding to the target surface texture template determined as above, and a texture template with a shape and size that are the same as the shape and size of the texture template to be tiled corresponding to the target surface texture template is generated. The generated texture template is: the texture template to be tiled corresponding to the target surface texture template.

[0092] For example, functions such as fractal noise and turbulence functions may be used to perform random sampling on each target surface texture template to obtain a to-be-tiled texture template corresponding to each target surface texture template.

[0093] Wherein, optionally, in a specific implementation, the target surface texture template is: a surface texture template that matches the surface features of the surface area to be mapped;

[0094] In this specific implementation, different surface areas in the three-dimensional scene may have different surface features, so different surface areas may be matched with different surface texture templates. Each surface area may be matched with one surface texture template or with multiple surface texture templates, which is reasonable.

[0095] For example, a certain surface area is a transition area between grass, snow and sand, thus, the surface features of the surface area may have: grass features, snow features and sand features, and the surface area can be matched with the grass texture template, the snow texture template and the sand texture template; for another example, a certain surface area is a brick and stone ground with falling snow, thus, the surface features of the surface area may have: snow features, sand features and brick and stone features, and the surface area can be matched with the snow texture template, the sand texture template and the brick and stone texture template; for another example, a certain surface area is a cement ground, thus, the surface features of the surface area may have cement features, and the surface area can be matched with the cement texture template.

[0096] Thus, for the above-mentioned surface area to be mapped, each surface texture template that matches the surface features of the surface area to be mapped can be referred to as a target surface texture template.

[0097] Among them, optionally, in a specific implementation, such as Figure 2 As shown, before the above step S101, the surface texture rendering method provided by the embodiment of the present invention may further include the following step S104:

[0098] S104: Selecting surface texture templates that match the surface features of the surface area to be mapped from a plurality of pre-made surface texture templates to obtain target surface texture templates.

[0099] In this specific implementation, for each surface area that may appear in a three-dimensional scene, the surface features of each surface area can be determined, and then multiple surface texture templates can be pre-made. Therefore, when texture drawing is performed on the surface area to be drawn, each surface texture template that matches the surface features of the surface area to be drawn can be selected from the multiple pre-made surface texture templates to obtain each target surface texture template.

[0100] Optionally, the number of the determined target surface texture templates may be three.

[0101] Of course, the number of target surface texture templates determined above may also be other values, and the embodiment of the present invention does not make specific limitations on this. That is to say, the embodiment of the present invention can support the mixing of any number of target surface texture templates to achieve surface texture drawing of the surface area to be drawn.

[0102] S102: Tiling each texture template to be tiled according to the tiling value to be used, to obtain each texture template to be mixed;

[0103] Each texture template to be mixed has the same shape and size as the surface area to be drawn.

[0104] After the to-be-tiled texture templates corresponding to the target surface texture templates are generated, each to-be-tiled texture template can be tiled according to the tiling value to be used to obtain the to-be-mixed texture templates.

[0105] The shape and size of each texture template to be mixed are the same as the shape and size of the surface area to be drawn.

[0106] For example, if the surface area to be drawn is a rectangle, the tiled texture template to be mixed is a rectangle, and the length and width of the tiled texture template to be mixed are respectively the same as the length and width of the surface area to be drawn; for another example, if the surface area to be drawn is a circle, the tiled texture template to be mixed is a circle, and the radius of the tiled texture template to be mixed is the same as the radius of the surface area to be drawn.

[0107] The embodiment of the present invention does not limit the shape and area of ​​the surface area to be mapped.

[0108] Exemplarily, the surface area to be drawn is a rectangle, and the area of ​​the surface area to be drawn is 1km*0.5km, and the tiling value to be used is (2000,1000), that is, the size of the texture template to be tiled corresponding to the tiling value to be used is 0.5m*0.5m. For each target surface texture template, the target surface texture template can be randomly sampled by program to obtain a texture template to be tiled with a size of 0.5m*0.5m. Thus, by tiling 2000*1000 texture templates to be tiled with a size of 0.5m*0.5m, a texture template to be mixed with an area of ​​1km*0.5km for the target surface texture template is obtained. Among them, the obtained texture template to be mixed is a rectangle, and there are 2000 texture templates to be tiled with a size of 0.5m*0.5m in the length direction of the obtained texture template to be mixed, and there are 1000 texture templates to be tiled with a size of 0.5m*0.5m in the width direction.

[0109] In this way, when the number of target surface texture templates is one, a texture template to be mixed about the target surface texture template can be obtained, and the texture template to be mixed has the same shape and size as the above-mentioned surface area to be drawn; and when the number of target surface texture templates is multiple, a texture template to be mixed about each target surface texture template can be obtained, that is, multiple texture templates to be mixed are obtained, and each texture template to be mixed has the same shape and size as the above-mentioned surface area to be drawn.

[0110] S103: Draw the surface texture using the obtained texture templates to be mixed according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, to obtain the surface texture of the surface area to be drawn.

[0111] For each surface area, multiple surface texture templates matching the surface features of the surface area can be determined based on the surface features of the surface area. The role of each surface texture template in forming the above-mentioned surface features is different, that is, when the above-mentioned surface area is obtained by mixing the above-mentioned multiple surface texture templates and making the above-mentioned surface area present the above-mentioned surface features, the contribution of each surface texture template in the above-mentioned multiple surface texture templates is different, so that each surface texture template can have a different template mixing weight.

[0112] Based on this, for each surface area that may appear in a three-dimensional scene, the template blending weights corresponding to each surface texture template matching the surface area can be set in advance for each surface area according to the surface features of each surface area.

[0113] In this way, for the above-mentioned surface area to be drawn, the template mixing weights that are pre-set for the surface area to be drawn and correspond to each target surface texture template can be determined. Thus, the surface texture can be drawn using the above-mentioned texture templates to be mixed according to the template mixing weights that are pre-set for the surface area to be drawn and correspond to each target surface texture template. Thus, the surface texture of the surface area to be drawn is obtained.

[0114] Based on this, the scheme provided by the embodiment of the present invention is applied. In the process of drawing the surface texture area to be drawn, the tiling value to be used corresponding to the surface area to be drawn is used to perform program random sampling on each target surface texture template, which can enrich the image content of the texture template to be tiled. Thus, the surface texture drawing using the texture template to be tiled can avoid the repetitive and unnatural phenomena presented by the drawn surface texture. In this way, the repetitive and unnatural phenomena presented by the surface texture can be reduced while achieving high clarity of the surface texture of the surface area at different viewing distances, so that the surface texture is closer to the real surface, thereby improving the similarity between the three-dimensional scene and the real scene.

[0115] Optionally, in a specific implementation, such as Figure 3 As shown, in the above step S101, based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, each target surface texture template is randomly sampled by a program, and before a texture template to be tiled corresponding to the target surface texture template is generated, a surface texture drawing method provided by an embodiment of the present invention may also include the following steps S105-S106:

[0116] S105: Determine the target viewing distance corresponding to the surface area to be drawn in the three-dimensional scene;

[0117] For the same surface area in a three-dimensional scene, when different users simulate different virtual positions in the three-dimensional scene, there may be different distances between the virtual positions simulated by different users in the three-dimensional scene and the above-mentioned surface area to be drawn. Therefore, the virtual positions simulated by different users in the three-dimensional scene may correspond to different viewing distances for the above-mentioned surface area to be drawn.

[0118] Among them, the so-called viewing distance corresponding to the surface area can be used to represent: from the user's viewing perspective, the distance between the surface area and the virtual position simulated by the user in the three-dimensional scene. The larger the viewing distance, the farther the surface area is from the virtual position simulated by the user in the three-dimensional scene from the user's viewing perspective.

[0119] In this way, when the surface area to be drawn in the three-dimensional scene is determined, the viewing distance corresponding to the surface area to be drawn can be determined first, that is, the target viewing distance can be obtained.

[0120] S106: According to a pre-established mapping relationship between view distance and tile value, determine the tile value corresponding to the target view distance as the tile value to be used corresponding to the surface area to be drawn in the three-dimensional scene;

[0121] According to the principle of perspective, under the user's viewing angle, the various surface areas viewed by the user appear larger when they are near and smaller when they are far away. Therefore, when the same surface texture template is used to draw textures on various surface areas at different viewing distances, the drawn textures can have different clarity, and the texture clarity of the surface area with a larger viewing distance can be lower.

[0122] In this way, in order to ensure that when the same surface texture template is used to draw textures of various surface areas at different viewing distances, the drawn textures can have higher clarity, the corresponding tiling value can be set in advance for each viewing distance, thereby pre-establishing a mapping relationship between the viewing distance and the tiling value.

[0123] Optionally, in the mapping relationship between viewing distance and tiling value, the tiling value corresponding to each viewing distance can be determined based on the experience of the personnel, or can be determined through multiple test experiments at a specified texture clarity, which is reasonable.

[0124] In this way, after determining the target viewing distance corresponding to the above-mentioned surface area to be drawn, the tiling value corresponding to the above-mentioned target viewing distance can be found from the mapping relationship between the above-mentioned viewing distance and the tiling value. Thus, the tiling value corresponding to the above-mentioned target viewing distance can be used as the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene.

[0125] Optionally, in a specific implementation, in the above mapping relationship between viewing distance and tiling value, the larger the viewing distance, the smaller the corresponding tiling value.

[0126] That is, in this specific implementation, from the user's viewing angle, the farther the surface area is from the virtual position simulated by the user in the three-dimensional scene, the smaller the tiling value. That is, the larger the target viewing distance, the smaller the determined tiling value to be used.

[0127] In this way, when drawing surface texture, the surface texture template used can be converted into a template with a smaller scale, and tiled through a large number of the smaller scale templates, so that the details of the drawn surface texture can be more fully displayed to improve the clarity of the drawn surface texture.

[0128] Based on this, in this specific implementation, the tiling values ​​corresponding to each viewing distance in the three-dimensional scene can be pre-set, so that when the surface areas with different viewing distances in the three-dimensional scene are textured, the texture drawing of the surface areas at different viewing distances can be achieved according to the tiling values ​​corresponding to the viewing distances of the different surface areas, and the surface textures of the surface areas at different viewing distances can all have high clarity. Therefore, there is no need to set a larger surface texture template for the surface area with a larger viewing distance, so that during the operation of the application, the device memory occupied by each surface texture template can be reduced, the greater pressure on the device memory can be reduced, and the running speed of the application can be improved.

[0129] In this way, it is possible to achieve high clarity of surface textures in surface areas at different viewing distances, while reducing device memory pressure, increasing the running speed of the application, reducing repetitive and unnatural phenomena in surface texture presentation, and improving the similarity between the three-dimensional scene and the real scene.

[0130] Optionally, in a specific implementation, the above step S103, using the obtained texture templates to be mixed, draws the surface texture according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, to obtain the surface texture of the surface area to be drawn, which may include the following step B1:

[0131] Step B1: Using the obtained texture templates to be mixed, draw the surface texture according to the specified mixing weight map to obtain the surface texture of the surface area to be drawn.

[0132] The specified blending weight map is pre-set for the surface area to be drawn, and is used to characterize the template blending weights corresponding to each target surface texture template.

[0133] That is to say, the pixel value of each pixel point in the above-mentioned specified mixing weight map can be used to determine the template mixing weight corresponding to each target surface texture template. For example, the template mixing weight corresponding to each target surface texture template can be determined by using the channel value of each color channel of each pixel point in the above-mentioned specified mixing weight map; for another example, the template mixing weight corresponding to each target surface texture template can be determined by using the grayscale value of each pixel point and the channel value of each color channel in the above-mentioned specified mixing weight map, etc.

[0134] In this specific implementation, for each surface area that may appear in a three-dimensional scene, the template blending weights corresponding to each surface texture template matching the surface area can be determined according to the surface features of each surface area, and thus, a blending weight map corresponding to each surface area is set according to the determined template blending weights. Thus, each blending weight map is pre-set for each surface area and is used to characterize the template blending weights corresponding to each surface texture template matching the surface area.

[0135] Among them, for the surface area to be drawn, the mixing weight map that is pre-set for the surface area to be drawn and used to characterize the template mixing weights corresponding to each target surface texture template can be called a specified mixing weight map. In this way, after obtaining the above-mentioned texture templates to be mixed, the surface texture can be drawn according to the specified mixing weight map using the obtained texture templates to be mixed, and the surface texture of the surface area to be drawn can be obtained.

[0136] Optionally, in a specific implementation, when there are multiple target surface texture templates matching the surface area to be mapped, the step B1 may include the following step B11:

[0137] Step B11: For each pixel point of the surface area to be drawn, a predetermined drawing operation is performed to obtain the surface texture of the surface area to be drawn.

[0138] Accordingly, in this specific implementation, if Figure 4 As shown, the above-mentioned predetermined drawing operation may include the following steps:

[0139] S401: Obtain the color value of the first pixel point with the same coordinates as the pixel point in each texture template to be mixed, obtain the color values ​​of multiple first pixel points, and obtain the channel values ​​of each color channel of the second pixel point with the same coordinates as the pixel point in the specified mixing weight map;

[0140] S402: determining a template mixing weight of a target surface texture template corresponding to each color channel based on the channel values ​​of each color channel of the second pixel point;

[0141] S403: Calculate the product of the color value of each first pixel obtained and the template mixing weight of the target surface texture template corresponding to the target color channel of the first pixel to obtain the channel value of each target color channel of the pixel in the surface area to be drawn;

[0142] S404: Drawing the pixel point of the surface area to be drawn using the channel values ​​of each target color channel of the pixel point of the surface area to be drawn;

[0143] Among them, each pixel point in the surface area to be drawn can be used as the pixel point in the above steps S401-S404; the target color channel of each first pixel point is: the color channel corresponding to the target surface texture template to be mixed used to construct the texture template to which the first pixel point belongs, that is, the template mixing weight of the target surface texture template corresponding to the target color channel of the first pixel point is determined from the template mixing weight of the target surface texture module corresponding to each color channel.

[0144] In this specific implementation, each pixel point in the specified mixing weight map can have multiple color channels, and each color channel corresponds to a target surface texture template. Therefore, the channel value of each color channel can be used to determine the template mixing weight corresponding to each target surface texture template.

[0145] Among them, since each texture template to be mixed is generated for each target surface texture template according to the tiling value to be used obtained as mentioned above, the color channel corresponding to each target surface texture template is the color channel corresponding to the texture template to be mixed with respect to the target surface texture template.

[0146] In this way, for each pixel point in the surface area to be drawn, the color value of the first pixel point with the same coordinates as the pixel point in each texture template to be mixed, as well as the channel values ​​of each color channel of the second pixel point with the same coordinates as the pixel point in the specified mixing weight map can be obtained first.

[0147] Among them, since there are multiple target surface texture templates, multiple texture templates to be mixed can be generated, and each pixel in the specified mixing weight map can have multiple color channels. Therefore, some color channels can be selected from the multiple color channels of each pixel in the specified mixing weight map, that is, the number of selected color channels can be greater than 1, so that multiple color values ​​and channel values ​​of multiple color channels can be obtained. Among them, each color value is the color value of the first pixel of each texture template to be mixed, and each color channel corresponds to a target surface texture template, so the target color channel of each first pixel can be determined, and the target color channel of each first pixel is: the color channel corresponding to the target surface texture template used to construct the texture template to be mixed to which the first pixel belongs.

[0148] Furthermore, the weight of each color channel can be determined based on the channel values ​​of each color channel of the acquired second pixel point, so that the determined weight of each color channel is: the template mixing weight of the target surface texture template corresponding to the color channel, and then, since each target surface texture template and the texture template to be mixed related to the target surface texture template correspond to the same color channel, therefore, for each target surface texture template, the color channel corresponding to the target surface texture template is: the target color channel of the first pixel point of the texture template to be mixed related to the target surface texture template.

[0149] Optionally, for the above-mentioned second pixel point, the proportion of the channel value of each color channel of the second pixel point to the sum of the channel values ​​of each color channel of the second pixel point can be calculated as the template mixing weight of the target surface texture template corresponding to each color channel.

[0150] Optionally, when it is specified that each pixel in the mixing weight map can have three color channels, and the three color channels are: R (Red) channel, G (Green) channel and B (Blue) channel, for the above-mentioned second pixel, the ratio of the channel value of each color channel of the second pixel to 256 can be calculated as the template mixing weight of the target surface texture template corresponding to each color channel.

[0151] Of course, the template mixing weight of the target surface texture template corresponding to each color channel may also be calculated in other ways, and the embodiment of the present invention does not take any specific action for this.

[0152] After determining the template mixing weight of the target surface texture template corresponding to each color channel, that is, determining the template mixing weight of the target surface texture template corresponding to the target color channel of each first pixel, the product of the color value of each first pixel obtained and the template mixing weight of the target surface texture template corresponding to the target color channel of the first pixel can be calculated to obtain the channel value of the target color channel of the pixel.

[0153] After obtaining the channel values ​​of each target color channel of the pixel point, the channel values ​​of each target color channel of the pixel point can be used to draw the pixel point, that is, the channel values ​​of each target color channel of the pixel point can be set to the channel values ​​obtained above, thereby completing the drawing of the pixel point.

[0154] In this way, after completing the drawing of each pixel point of the above-mentioned surface area to be drawn according to the specific implementation method shown in the above-mentioned steps S401-S404, the texture drawing of the above-mentioned surface area to be drawn can be completed, thereby obtaining the surface texture of the surface area to be drawn.

[0155] For example, the number of the target surface texture templates mentioned above is three, and the three target surface texture templates are template 10, template 20 and template 30 respectively. Then the three texture templates to be mixed respectively related to template 10, template 20 and template 30 are: template 11, template 21 and template 31; and the R channel, G channel and B channel can be selected from the multiple color channels of each pixel point in the specified mixing weight map.

[0156] Among them, if template 10 corresponds to the R channel, template 20 corresponds to the G channel, and template 30 corresponds to the B channel, then template 11 corresponds to the R channel, template 21 corresponds to the G channel, and template 31 corresponds to the B channel.

[0157] In this way, for the pixel point X0 in the surface area to be drawn, the following can be obtained respectively: the color value N1 of the first pixel point X1 with the same coordinates as the pixel point X0 in template 11, the color value N2 of the first pixel point X2 with the same coordinates as the pixel point X0 in template 21, and the color value N3 of the first pixel point X3 with the same coordinates as the pixel point X0 in template 31. Therefore, the target color channel of the first pixel point X1 is the R channel, the target color channel of the first pixel point X2 is the G channel, and the target color channel of the first pixel point X3 is the B channel. Furthermore, the target surface texture template corresponding to the target color channel of the first pixel point X1 is template 10, the target surface texture template corresponding to the target color channel of the first pixel point X2 is template 20, and the target surface texture template corresponding to the target color channel of the first pixel point X3 is template 30.

[0158] Furthermore, the channel value R0 of the R channel, the channel value G0 of the G channel, and the channel value B0 of the B channel of the second pixel point X4 having the same coordinates as the pixel point X0 in the specified mixing weight map may also be obtained.

[0159] Thus, the proportion of the channel value R0 in the sum of the channel values ​​R0, G0 and B0 can be calculated as the template mixing weight R1 of the template 10 corresponding to the R channel, that is, the template mixing weight R1 of the target surface texture template corresponding to the target color channel of the first pixel point X1 is obtained;

[0160] Calculate the proportion of the channel value G0 in the sum of the channel value R0, the channel value G0 and the channel value B0 as the template mixing weight G1 of the template 20 corresponding to the G channel, that is, obtain the template mixing weight G1 of the target surface texture template corresponding to the target color channel of the first pixel point X2;

[0161] Calculate the proportion of channel value B0 in the sum of channel value R0, channel value G0 and channel value B0 as the template mixing weight B1 of template 30 corresponding to channel B, that is, obtain the template mixing weight B1 of the target surface texture template corresponding to the target color channel of the first pixel point X3.

[0162] Thus, the product of the color value N1 of the first pixel point X1 and the template mixing weight R1 of the target surface texture template corresponding to the target color channel of the first pixel point X1 can be calculated as the channel value of the R channel of the pixel point X0 in the surface area to be drawn; the product of the color value N2 of the first pixel point X2 and the template mixing weight G1 of the target surface texture template corresponding to the target color channel of the first pixel point X2 can be calculated as the channel value of the R channel of the pixel point X0 in the surface area to be drawn; the product of the color value N3 of the first pixel point X3 and the template mixing weight B1 of the target surface texture template corresponding to the target color channel of the first pixel point X3 can be calculated as the channel value of the B channel of the pixel point X0 in the surface area to be drawn. In this way, the pixel point X0 in the surface area to be drawn can be drawn using the channel value of the R channel of the pixel point X0, the channel value of the G channel of the pixel point X0, and the channel value of the B channel of the pixel point X0 obtained above.

[0163] It should be emphasized that: the specific implementation method in which the number of the target surface texture templates is three is only an example of drawing a surface texture provided by an embodiment of the present invention to obtain a surface texture of a surface area to be drawn.

[0164] In practical applications, the number of the above-mentioned target surface texture templates can be any other numerical value, and the number of channels for each pixel point in the specified mixing weight map that can be used can also be any number of channels that the pixel point can have, for example, the maximum number of color channels that the pixel point may have, for example, 4 channels, etc.

[0165] It should be noted that the "pixel point of the surface area to be drawn" in the above steps S401-S404 can be any pixel point in the surface area to be drawn; that is, each pixel point in the surface area to be drawn can be used as the "pixel point of the surface area to be drawn" in the above steps S401-S404.

[0166] In order to facilitate understanding of the surface texture rendering method provided by the above-mentioned embodiment of the present invention, a specific example is used below to illustrate.

[0167] like Figure 5 As shown, the grass texture template, snow texture template and sand texture template in the first column are three target surface texture templates. By performing random sampling on the grass texture template, snow texture template and sand texture template, the to-be-tiled texture templates corresponding to the grass texture template, snow texture template and sand texture template are generated, and each to-be-tiled texture template is tiled according to the to-be-used tiling value, so that the shapes and sizes of the to-be-mixed texture templates that are the same as the shapes and sizes of the to-be-drawn surface area can be obtained, that is, the grass color template, snow color template and sand color template in the second column are obtained.

[0168] Among them, since the number of texture templates to be mixed generated is multiple, but the surface texture of the surface area to be drawn is only one, the above-mentioned step S105 can be used to draw the surface texture by using the obtained texture templates to be mixed according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template. This can be understood as: superimposing the generated texture templates to be mixed according to the template mixing weights corresponding to each target surface texture template.

[0169] Specifically, in the mixed weight map, each pixel has an R channel, a G channel, and a B channel, and the target color channel of the grass texture template is the R channel, the target color channel of the snow texture template is the G channel, and the target color channel of the sand texture template is the B channel. In this way, after determining the R channel weight, the G channel weight, and the B channel weight, the color value of each pixel in the grass color template, the color value of each pixel in the snow texture template, and the color value of each pixel in the sand texture template are calculated by multiplying the R channel weight, the G channel weight, and the B channel weight, respectively, that is, by weighted summation, the color value of the surface area to be drawn is obtained, thereby obtaining the surface texture of the surface area to be drawn.

[0170] Corresponding to the method for drawing surface texture provided by the above-mentioned embodiment of the present invention, the embodiment of the present invention provides a device for drawing surface texture.

[0171] Figure 6 A schematic diagram of the structure of a surface texture drawing device provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the device may include the following modules:

[0172] The template generation module 610 is used to perform program random sampling on each target surface texture template based on the tile value to be used corresponding to the surface area to be drawn in the three-dimensional scene, and generate a to-be-tiled texture template corresponding to the target surface texture template;

[0173] The template tiling module 620 is used to tile each texture template to be tiled according to the tiling value to be used, so as to obtain each texture template to be mixed; wherein each texture template to be mixed has the same shape and size as the surface area to be drawn;

[0174] The texture drawing module 630 is used to draw the surface texture by using the obtained texture templates to be mixed, according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, so as to obtain the surface texture of the surface area to be drawn.

[0175] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, when texture drawing is performed on the surface area to be drawn, the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene can be first determined. After that, each texture template to be tiled can be tiled according to the tiling value to be used to obtain each texture template to be mixed, and each texture template to be mixed has the same shape and size as the surface area to be drawn. Then, the obtained multiple texture templates to be mixed can be used to draw the surface texture according to the template mixing weights pre-set for the surface area to be drawn and corresponding to the multiple target surface texture templates, so as to obtain the surface texture of the surface area to be drawn.

[0176] Based on this, the scheme provided by the embodiment of the present invention is applied. In the process of drawing the surface texture area to be drawn, the tiling value to be used corresponding to the surface area to be drawn is used to perform program random sampling on each target surface texture template, which can enrich the image content of the texture template to be tiled. Thus, the surface texture drawing using the texture template to be tiled can avoid the repetitive and unnatural phenomena presented by the drawn surface texture. In this way, the repetitive and unnatural phenomena presented by the surface texture can be reduced while achieving high clarity of the surface texture of the surface area at different viewing distances, so that the surface texture is closer to the real surface, thereby improving the similarity between the three-dimensional scene and the real scene.

[0177] Optionally, in a specific implementation, the device further includes:

[0178] A view distance determination module, used for determining a target view distance of a surface area to be drawn in a three-dimensional scene before performing program random sampling on each target surface texture template based on the tile value to be used corresponding to the surface area to be drawn in the three-dimensional scene and generating a texture template to be tiled corresponding to the target surface texture template;

[0179] The tile value determination module is used to determine the tile value corresponding to the target viewing distance according to a pre-established mapping relationship between the viewing distance and the tile value, as the tile value to be used corresponding to the surface area to be drawn in the three-dimensional scene.

[0180] Optionally, in a specific implementation, in the mapping relationship, the larger the viewing distance, the smaller the corresponding tiling value.

[0181] Optionally, in a specific implementation, the target surface texture template is: a surface texture template that matches the surface features of the surface area to be mapped

[0182] Optionally, in a specific implementation, the texture rendering module 603 includes:

[0183] The first drawing submodule is used to draw the surface texture by using the obtained texture templates to be mixed according to the specified mixing weight map to obtain the surface texture of the surface area to be drawn;

[0184] The designated blending weight map is pre-set for the surface area to be drawn, and is used to characterize the template blending weights corresponding to each target surface texture template.

[0185] Optionally, in a specific implementation, there are multiple target surface texture templates, and the first drawing submodule is specifically used to:

[0186] For each pixel point of the surface area to be drawn, a predetermined drawing operation is performed to obtain a surface texture of the surface area to be drawn;

[0187] Wherein, the predetermined drawing operation includes:

[0188] Obtain the color value of the first pixel point with the same coordinates as the pixel point in each texture template to be mixed, obtain the colors of multiple first pixel points, and obtain the channel values ​​of each color channel of the second pixel point with the same coordinates as the pixel point in the specified mixing weight map;

[0189] Determining a template mixing weight of a target surface texture template corresponding to each color channel based on the channel values ​​of each color channel of the second pixel point;

[0190] Calculate the product of the color value of each first pixel obtained and the template mixing weight of the target surface texture template corresponding to the target color channel of the first pixel, and obtain the channel value of each target color channel of the pixel of the surface area to be drawn; wherein the target color channel of each first pixel is: the color channel corresponding to the target surface texture template used to construct the texture template to be mixed to which the first pixel belongs;

[0191] The pixel point of the surface area to be drawn is drawn using the channel values ​​of each target color channel of the pixel point of the surface area to be drawn.

[0192] Optionally, in a specific implementation, the device further includes:

[0193] The template selection module is used to perform program random sampling on each target surface texture template based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, and before generating a texture template to be tiled corresponding to the target surface texture template, select each surface texture template that matches the surface features of the surface area to be drawn from multiple pre-made surface texture templates to obtain each target surface texture template.

[0194] Corresponding to the surface texture rendering method provided by the above embodiment of the present invention, the embodiment of the present invention also provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.

[0195] Memory 703, used for storing computer programs;

[0196] The processor 701 is used to implement the steps of any surface texture rendering method provided by the above-mentioned embodiments of the present invention when executing the program stored in the memory 703.

[0197] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0198] The communication interface is used for communication between the above electronic device and other devices.

[0199] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0200] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0201] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any surface texture rendering method provided by the above-mentioned embodiments of the present invention are implemented.

[0202] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the steps of any of the surface texture rendering methods provided by the above-mentioned embodiments of the present invention.

[0203] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0204] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0205] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, electronic device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0206] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A method for rendering surface texture, characterized in that: The method comprises: Based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, each target surface texture template is randomly sampled by a program to generate a texture template to be tiled corresponding to the target surface texture template; wherein the tiling value to be used corresponding to the surface area to be drawn is used to characterize the number of texture templates to be tiled required in the horizontal direction and the vertical direction; according to the tiling value to be used, each texture template to be tiled is tiled respectively to obtain each texture template to be mixed; wherein each texture template to be mixed has the same shape and size as the surface area to be drawn; Utilizing the obtained texture templates to be mixed, the surface texture is drawn according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, so as to obtain the surface texture of the surface area to be drawn; wherein the template mixing weight corresponding to each target surface texture template is used to characterize the contribution of each texture template to be mixed corresponding to the target surface texture template when mixing to obtain the surface texture of the surface area to be drawn.

2. The method according to claim 1, characterized in that Before performing program random sampling on each target surface texture template based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene to generate a to-be-tiled texture template corresponding to the target surface texture template, the method further includes: Determine the target sight distance corresponding to the surface area to be drawn in the three-dimensional scene; According to a pre-established mapping relationship between viewing distance and tiling value, a tiling value corresponding to the target viewing distance is determined as a tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene.

3. The method according to claim 2, characterized in that In the mapping relationship, the larger the viewing distance, the smaller the corresponding tiling value.

4. The method according to claim 1, characterized in that: The target surface texture template is: a surface texture template that matches the surface features of the surface area to be mapped.

5. The method according to any one of claims 1 to 4, characterized in that: The method of using the obtained texture templates to be mixed to draw the surface texture according to the template mixing weights that are pre-set for the surface area to be drawn and correspond to the target surface texture templates to obtain the surface texture of the surface area to be drawn includes: Using the obtained texture templates to be mixed, and according to the specified mixing weight map, the surface texture is drawn to obtain the surface texture of the surface area to be drawn; The designated blending weight map is pre-set for the surface area to be drawn, and is used to characterize the template blending weights corresponding to each target surface texture template.

6. The method according to claim 5, characterized in that The number of the target surface texture templates is multiple, and the surface texture is drawn according to the specified mixing weight map using the obtained texture templates to be mixed to obtain the surface texture of the surface area to be drawn, including: For each pixel point of the surface area to be drawn, a predetermined drawing operation is performed to obtain a surface texture of the surface area to be drawn; Wherein, the predetermined drawing operation includes: Obtain the color value of the first pixel point with the same coordinates as the pixel point in each texture template to be mixed, obtain the color values ​​of multiple first pixel points, and obtain the channel values ​​of each color channel of the second pixel point with the same coordinates as the pixel point in the specified mixing weight map; Determining a template mixing weight of a target surface texture template corresponding to each color channel based on the channel values ​​of each color channel of the second pixel point; Calculate the product of the color value of each first pixel obtained and the template mixing weight of the target surface texture template corresponding to the target color channel of the first pixel to obtain the channel value of each target color channel of the pixel in the surface area to be drawn; The pixel point of the surface area to be drawn is drawn using the channel values ​​of each target color channel of the pixel point of the surface area to be drawn.

7. The method according to any one of claims 1 to 4, characterized in that: Before performing program random sampling on each target surface texture template based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene to generate a to-be-tiled texture template corresponding to the target surface texture template, the method further includes: From a plurality of pre-made surface texture templates, each surface texture template matching the surface features of the surface area to be mapped is selected to obtain each target surface texture template.

8. A surface texture rendering device, characterized in that: The device comprises: The template generation module is used to perform random sampling on each target surface texture template based on the tiling value to be used corresponding to the surface area to be drawn in the three-dimensional scene, and generate a texture template to be tiled corresponding to the target surface texture template; wherein the tiling value to be used corresponding to the surface area to be drawn is used to represent the number of texture templates to be tiled required in the horizontal direction and the vertical direction; A template tiling module, used to tile each texture template to be tiled according to the tiling value to be used, to obtain each texture template to be mixed; wherein each texture template to be mixed has the same shape and size as the surface area to be drawn; The texture drawing module is used to use the obtained texture templates to be mixed to draw the surface texture according to the template mixing weights pre-set for the surface area to be drawn and corresponding to each target surface texture template, so as to obtain the surface texture of the surface area to be drawn; wherein the template mixing weight corresponding to each target surface texture template is used to characterize the contribution of each texture template to be mixed corresponding to the target surface texture template when mixing to obtain the surface texture of the surface area to be drawn.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Texture image stitching method and device

    CN104134201A

  • Method and device for processing texture image in game, electronic equipment and storage medium

    CN110363837A