Texture rendering method and device, electronic equipment and storage medium

By generating mixed texture maps and superimposing them on the target model, the problem of inflexible interaction between texture and ambient lighting in the existing technology is solved, real-time dynamic adjustment of texture rendering effects is achieved, and the realism and diversity of rendering effects are improved.

CN119810286APending Publication Date: 2025-04-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411813789.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

Existing texture rendering methods cannot achieve real-time dynamic interaction between texture and ambient lighting, resulting in the texture rendering effect being unable to be adjusted synchronously with the changes in lighting parameters and viewing angle parameters.

Method used

By obtaining the basic texture map of the target model and in response to the adjustment of lighting parameters and viewing angle parameters, a mixed texture map is generated, and finally superimposing the basic texture map and mixed texture map on the target model to achieve dynamic adjustment of texture rendering effect.

Benefits of technology

Real-time dynamic interaction between texture and lighting is realized, so that the texture rendering effect can be adjusted synchronously with the changes in lighting parameters and viewing angle parameters, improving the realism and diversity of the rendering effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810286A_ABST
    Figure CN119810286A_ABST
Patent Text Reader

Abstract

The invention provides a texture rendering method and device, electronic equipment and a storage medium, and relates to the technical field of graphic rendering. The method comprises the steps of obtaining at least one layer of basic texture map corresponding to a target model; processing the at least one layer of basic texture map in response to an adjustment operation on the illumination parameter and / or the visual angle parameter, and generating at least one layer of mixed texture map corresponding to the target model; and superposing the at least one layer of basic texture map and the at least one layer of mixed texture map on the target model, and obtaining a texture rendering effect corresponding to the target model, so that when the illumination parameter and / or the view angle direction change, the texture rendering effect can be synchronously changed, namely, the texture rendering effect can be synchronously changed for the target model. The texture rendering effect capable of changing along with the visual angle parameter and / or the illumination parameter can be presented, and real-time dynamic interaction of texture and illumination is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of graphics rendering technology, and in particular to a texture rendering method, device, electronic device and storage medium. Background Art

[0002] 3D graphics rendering is a process that combines three-dimensional models, textures, lighting and other elements to calculate and generate the final two-dimensional image. It is widely used in industries such as film, games, and design, and achieving dynamic and realistic visual effects is its continuous pursuit.

[0003] In the prior art, it usually relies on UV mapping and static texture of the model. In the specific implementation, the texture is mainly mapped to the 3D model using UV coordinates, and the lighting model is used to calculate the lighting effect.

[0004] It can be seen that the existing texture rendering method mainly relies on the UV sampling of the model and does not involve the process of dynamic interaction with lighting. Therefore, it is impossible to achieve real-time dynamic interaction between texture and ambient lighting. Summary of the invention

[0005] The purpose of the present application is to provide a texture rendering method, device, electronic device and storage medium to address the deficiencies in the above-mentioned prior art, which can realize real-time dynamic interaction between texture and ambient lighting.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, the present invention provides a texture rendering method, the method comprising:

[0008] Obtain at least one layer of basic texture map corresponding to the target model;

[0009] In response to the adjustment operation of the illumination parameter and / or the viewing angle parameter, processing at least one layer of the basic texture map to generate at least one layer of mixed texture map corresponding to the target model;

[0010] At least one layer of the basic texture map and at least one layer of the mixed texture map are superimposed on the target model to obtain a texture rendering effect corresponding to the target model.

[0011] In a second aspect, the present invention provides a texture rendering device, comprising:

[0012] An acquisition module, used to acquire at least one layer of basic texture map corresponding to the target model;

[0013] A response module, configured to process at least one layer of the basic texture map in response to an adjustment operation on the illumination parameter and / or the viewing angle parameter, and generate at least one layer of mixed texture map corresponding to the target model;

[0014] A rendering module is used to superimpose at least one layer of the basic texture map and at least one layer of the mixed texture map on the target model to obtain a texture rendering effect corresponding to the target model.

[0015] In a third aspect, the present invention provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the texture rendering method as described in any of the aforementioned implementations.

[0016] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the texture rendering method as described in any of the aforementioned embodiments are executed.

[0017] The beneficial effects of this application are:

[0018] In the texture rendering method, device, electronic device and storage medium provided in the embodiments of the present application, at least one layer of basic texture map corresponding to the target model is obtained; in response to the adjustment operation of the lighting parameters and / or the viewing angle parameters, the at least one layer of basic texture map is processed to generate at least one layer of mixed texture map corresponding to the target model; at least one layer of basic texture map and at least one layer of mixed texture map are superimposed on the target model to obtain the texture rendering effect corresponding to the target model, so that when the lighting parameters and / or the viewing angle direction change, the texture rendering effect can change synchronously, that is, for the target model, it is possible to present a texture rendering effect that can change with the viewing angle parameters and / or lighting parameters, thereby realizing real-time dynamic interaction between texture and lighting. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 A schematic diagram of a texture rendering effect of a prior art provided in an embodiment of the present application;

[0021] Figure 2 A flowchart of a texture rendering method provided in an embodiment of the present application;

[0022] Figure 3A schematic diagram of a flow chart of another texture rendering method provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of a texture rendering effect provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of another texture rendering effect provided in an embodiment of the present application;

[0025] Figure 6 A schematic diagram of a flow chart of another texture rendering method provided in an embodiment of the present application;

[0026] Figure 7 A schematic diagram of a flow chart of another texture rendering method provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of another texture rendering effect provided in an embodiment of the present application;

[0028] Fig. 9 A schematic diagram of functional modules of a texture rendering device provided in an embodiment of the present application;

[0029] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0031] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0032] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0033] In the prior art, it usually relies on UV mapping and static texture of the model. In the specific implementation, the texture is mainly mapped to the 3D model using UV coordinates, and the lighting model is used to calculate the lighting effect.

[0034] Figure 1 A schematic diagram of a texture rendering effect of the prior art provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, it shows the texture rendering effect of the ball model under a certain lighting angle. It can be seen that the texture of the ball model cannot dynamically interact with the ambient lighting.

[0035] In addition, the existing image sampling accuracy is limited by the texture resolution and pattern repetition rate, and lacks flexibility. For example, in the existing technology, when using a map in a game, the usage rate is generally increased, that is, a map is reused. For example, the color map of the entire ground in the game is displayed by using a map to tile and repeat multiple times.

[0036] In view of this, an embodiment of the present application provides a texture rendering method, the application of which can reflect the real-time dynamic interaction effect between the texture and ambient lighting in the model. Furthermore, the texture can be dynamically adjusted according to the lighting direction and intensity, thereby improving the flexibility of the rendering method.

[0037] Figure 2 The present invention provides a flowchart of a texture rendering method according to an embodiment of the present invention. The execution subject of the method can be a computer, a server, a processor, or other electronic device that can perform graphics rendering. Optionally, the present invention method can be applied in the fields of games, movies, and architectural design. In order to better understand the present invention, the following examples are given using the field of games as an example.

[0038] like Figure 1 As shown, the method includes

[0039] Step 101: Obtain at least one layer of basic texture map corresponding to the target model.

[0040] Optionally, the target model may be any model that requires texture rendering, for example, a virtual character model, a virtual equipment model, a virtual building model, a virtual terrain model, etc., which is not limited here.

[0041] In some embodiments, the target model may correspond to one or more layers of basic texture maps, for example, two, three, or five layers of texture, etc., which are not limited here and can be flexibly set according to the actual application scenario; optionally, each layer of basic texture maps can be generated by a programmatic algorithm, or can be generated by UV sampling technology, which is not limited here. Among them, if generated by a programmatic algorithm, each basic texture map can be regarded as a basic program texture map.

[0042] Step 102: In response to the adjustment operation of the illumination parameter and / or the viewing angle parameter, at least one layer of basic texture map is processed to generate at least one layer of mixed texture map corresponding to the target model.

[0043] Among them, the target rendering parameters corresponding to the target model may include lighting parameters and / or viewing angle parameters. Optionally, the lighting parameters may be obtained through the lighting components of the game world where the target model is located. In some embodiments, the specific acquisition may be based on the game engine and obtained through the lighting system in the game engine. In some embodiments, the lighting parameters may include: lighting properties such as light source position, lighting direction, lighting intensity, and lighting color, which may vary according to the actual application scenario; the viewing angle parameters may be obtained through the camera of the game world where the target model is located, and the viewing angle parameters may include: viewing angle direction, wherein the viewing angle direction may represent the player's line of sight direction in the game scene.

[0044] The mixed texture map corresponding to the target model may include multiple layers, for example, one layer, two layers, or more layers, which is not limited here.

[0045] Optionally, each layer of mixed texture map may be obtained by processing at least one layer of basic texture map based on illumination parameters and / or viewing angle parameters.

[0046] In some embodiments, if the illumination parameter and / or the viewing angle parameter are adjusted, in response to the adjustment operation, a corresponding mixed rendering weight may be obtained, and based on the mixed weight, at least one layer of base texture map is mixed pixel by pixel to obtain a corresponding mixed texture map. It is understandable that based on the mixed texture map, when the illumination parameter and / or the viewing angle parameter changes, the texture rendering effect of the mixed texture map may change synchronously.

[0047] It should be noted that, when mixing, multiple layers of basic texture maps can be mixed pixel by pixel based on the mixing weight to obtain a corresponding mixed texture map; or, based on the mixing weight, at least one layer of basic texture map and a preset texture map can be mixed pixel by pixel to obtain a corresponding mixed texture map, which is not limited here and can be flexibly selected according to the actual application scenario. Optionally, the preset texture map can be generated by 3D modeling software, or it can be generated programmatically, which is not limited here.

[0048] Step 103: superimpose at least one layer of basic texture map and at least one layer of mixed texture map on the target model to obtain a texture rendering effect corresponding to the target model.

[0049] Based on the above description, after obtaining each layer of basic texture maps and each layer of mixed texture maps, the each layer of basic texture maps and each layer of mixed texture maps can be superimposed on the target model. It can be understood that due to the setting of the mixed texture maps, at this time, the target model can present a texture rendering effect that can change with lighting parameters and / or viewing angle parameters, thereby realizing real-time dynamic interaction between texture and lighting.

[0050] In summary, an embodiment of the present application provides a texture rendering method, which includes: obtaining at least one layer of basic texture map corresponding to a target model; in response to an adjustment operation on illumination parameters and / or viewing angle parameters, processing at least one layer of basic texture map to generate at least one layer of mixed texture map corresponding to the target model; superimposing at least one layer of basic texture map and at least one layer of mixed texture map on the target model to obtain a texture rendering effect corresponding to the target model, so that when the illumination parameters and / or viewing angle parameters change, the texture rendering effect can change synchronously, that is, for the target model, it is possible to present a texture rendering effect that can change with the viewing angle parameters and / or illumination parameters, thereby realizing real-time dynamic interaction between texture and illumination.

[0051] Figure 3 A flowchart of another texture rendering method provided in an embodiment of the present application. Figure 4 A schematic diagram of a texture rendering effect provided in an embodiment of the present application. Figure 5 A schematic diagram of a texture rendering effect provided by an embodiment of the present application. In an optional implementation, the lighting parameters include: lighting direction and lighting intensity, and the basic texture map includes at least two layers.

[0052] like Figure 3 As shown, in response to the adjustment operation of the illumination parameter and / or the viewing angle parameter, at least one layer of the basic texture map is processed to generate at least one layer of the mixed texture map corresponding to the target model, including:

[0053] Step 201: In response to an adjustment operation on a lighting direction and / or a viewing angle direction, a hybrid rendering weight is calculated according to the adjusted lighting direction and / or viewing angle direction.

[0054] The mixed rendering weight is used as an interpolation factor to mix multiple layers of base textures during the mixing process to obtain a random texture that can change with the viewing direction and / or the lighting direction.

[0055] Optionally, the lighting parameters may include: lighting direction and lighting intensity. When the lighting direction and / or viewing angle direction is adjusted, the mixed rendering weight may be calculated according to the adjusted lighting direction and / or viewing angle direction.

[0056] It should be noted that in some scenes, if only the illumination direction is adjusted, the mixed rendering weight can be recalculated based on the adjusted illumination direction and the existing viewing angle direction; if only the viewing angle direction is adjusted, the mixed rendering weight can be recalculated based on the adjusted viewing angle direction and the existing illumination direction; if both the illumination direction and the viewing angle direction are adjusted, the mixed rendering weight can be recalculated based on the adjusted illumination direction and the viewing angle direction. The calculation method can be flexibly selected according to the actual application scenario.

[0057] Step 202: Perform a blending operation on any two layers of basic texture maps according to the blending rendering weights to obtain a first illumination blending texture map corresponding to the target model.

[0058] Wherein, referring to the above description, the target model may correspond to a multi-layer basic texture map, and the first illumination mixed texture map may be obtained by mixing any two layers of basic texture maps in the multi-layer basic texture map in combination with the mixed rendering weight. Optionally, when performing a specific mixing operation, it may be obtained based on a mixing function such as mix() and lerp().

[0059] For example, in a certain scene, the target model corresponds to two layers of basic texture maps: RandomTextures01 and RandomTextures02. Optionally, the first illumination mixed texture map can be obtained through mixing functions such as mix() and lerp().

[0060] In some embodiments, taking mix() as an example, the implementation code corresponding to the first lighting mixed texture map can be: RandomTexturesWithLight=mix(RandomTextures01, RandomTextures02, VdotL), wherein RandomTextures01 represents the first layer of basic texture map, RandomTextures02 represents the second layer of basic texture map, VdotL represents the mixed rendering weight, and RandomTexturesWithLight represents the first lighting mixed texture map.

[0061] Based on the acquisition process of the first illumination mixed texture map, refer to Figure 4 As shown, taking the target model as a spherical model as an example, if the first lighting mixed texture map is used to render the target model, when the lighting direction and / or viewing direction changes, the texture rendering effect of the first lighting mixed texture map will change synchronously, realizing real-time dynamic interaction between texture and lighting direction, and enhancing the realism and diversity of visual effects.

[0062] It should be noted that the specific implementation method is not limited to the above examples and can be flexibly set according to the actual application scenario.

[0063] Step 203: In response to the adjustment operation on the illumination intensity, a mixing operation is performed on the first illumination mixed texture map and at least one layer of basic texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model.

[0064] Based on the above description, after obtaining the first illumination mixed texture map, the first illumination mixed texture map and at least one layer of basic texture map can be further mixed according to the illumination intensity to obtain the second illumination mixed texture map. Optionally, when performing the mixing operation, it can be obtained based on a mixing function such as mix() and lerp().

[0065] Among them, refer to Figure 5 As shown, taking the target model as a spherical model as an example, if the target model is rendered using the second illumination mixed texture map, it can be seen that when any parameters in the illumination direction, illumination intensity, and viewing direction change, the texture rendering effect of the second illumination mixed texture map will change synchronously, thereby realizing real-time dynamic interaction between texture and illumination.

[0066] In summary, the embodiments of the present application realize that a first lighting mixed texture map can be obtained based on the lighting direction and the viewing direction; a second lighting mixed texture map can be obtained based on the lighting intensity and the first lighting mixed texture map, and then the first lighting mixed texture map, the second lighting mixed texture map and at least one layer of basic texture map are superimposed and rendered, and the texture can be dynamically adjusted according to the lighting direction, lighting intensity and viewing direction.

[0067] It should be noted that the specific mixing method is not limited to the above-mentioned embodiments, and the mixing order can be flexibly adjusted according to the actual application scenario. For example, in some scenarios, in response to the adjustment operation of the light intensity, a mixing operation can be performed on any two layers of basic texture maps to obtain a first lighting mixed texture map corresponding to the target model; in response to the adjustment operation of the lighting direction and / or the viewing angle direction, a mixed rendering weight is calculated according to the adjusted lighting direction and / or the viewing angle direction; according to the mixed rendering weight, a mixing operation is performed on the first lighting mixed texture map and at least one layer of basic texture maps to obtain a second lighting mixed texture map corresponding to the target model.

[0068] In an optional implementation, the above-mentioned calculation of the mixed rendering weight according to the adjusted illumination direction and / or viewing angle direction includes:

[0069] The illumination vector corresponding to the illumination direction and the viewing vector corresponding to the viewing direction are obtained respectively; a dot product is calculated for the illumination vector and the viewing vector, and the dot product calculation result is used as a mixed rendering weight.

[0070] The illumination direction may be represented by an illumination vector, and the viewing angle direction may be represented by a viewing angle vector. Optionally, the illumination vector corresponding to the illumination direction may be obtained by a preset illumination vector obtaining function, and the viewing angle vector corresponding to the viewing angle direction may be obtained by a preset viewing angle vector obtaining function.

[0071] Optionally, the mixed operation of the illumination direction and the viewing direction can be obtained by performing a dot product calculation on the illumination vector and the viewing vector. For example, it can be calculated by the dot() function. The corresponding implementation code can be:

[0072] float VdotL=dot(lightDirection,viewDirection), where lightDirection represents the light vector, and viewDirection represents the view vector. lightDirection can be obtained through the light vector acquisition function GetLightDirection(), and viewDirection can be obtained through the view vector acquisition function GetViewDirection().

[0073] In an optional embodiment, in response to the adjustment operation on the illumination intensity, performing a mixing operation on the first illumination mixed texture map and at least one layer of base texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model includes:

[0074] The adjusted illumination intensity is used as a linear interpolation parameter to perform a blending operation on the first illumination mixed texture map and at least one layer of basic texture map to obtain a second illumination mixed texture map corresponding to the target model.

[0075] Optionally, the second lighting mixed texture map may be mixed based on the first lighting mixed texture map and one or more base texture map textures.

[0076] In order to better understand the present application, the second lighting mixed texture map is obtained by mixing the first lighting mixed texture map and a layer of basic texture map texture as an example for explanation. Optionally, in the specific implementation, the second lighting mixed texture map can be obtained through mixing functions such as mix() and lerp().

[0077] In some embodiments, the implementation code corresponding to the second lighting mixed texture map may be: FinalTexture = mix(RandomTextures03, RandomTexturesWithLight, lightIntensity), wherein RandomTextures03 represents the third layer basic texture map, RandomTexturesWithLight represents the first lighting mixed texture map, lightIntensity represents the light intensity, and FinalTexture represents the second lighting mixed texture map.

[0078] It can be seen that by taking the illumination intensity as a weight and performing a mixing operation on the first illumination mixed texture map and the third layer basic texture map, the second illumination mixed texture map can be obtained.

[0079] Optionally, according to the actual application scenario, the third layer of basic texture map can be set to be the same as or different from the first layer of basic texture map. It can be understood that if they are set to be the same, the generation efficiency of the basic texture map can be improved.

[0080] Figure 6 A schematic diagram of another texture rendering method provided in an embodiment of the present application. In an optional implementation, as Figure 6 As shown, the above-mentioned obtaining at least one layer of basic texture map corresponding to the target model includes:

[0081] Step 301: Based on the material blueprint, a preset noise algorithm is used to fit and generate texture units of multiple basic shapes corresponding to the target model.

[0082] Step 302: Obtain basic texture maps of each layer corresponding to the target model according to the texture units of multiple basic shapes.

[0083] Optionally, each layer of base texture maps can be obtained based on a preset engine, which can include a material blueprint, wherein the material blueprint is a visual programming tool for creating and editing materials, for example, it can build material logic by dragging and dropping nodes and connecting nodes. In some embodiments, the material blueprint can be a component in Unreal Engine for creating and editing materials.

[0084] In some embodiments, during specific acquisition, a plurality of texture units of basic shapes may be calculated by fitting through a preset noise algorithm in a material blueprint, and the plurality of texture units of basic shapes may be arranged to obtain basic texture maps of each layer corresponding to the target model.

[0085] Optionally, the preset noise algorithm may be Perlin Noise, Simplex Noise, Value Noise, Wavelet Noise, etc., which is not limited here and can be flexibly selected according to actual application scenarios.

[0086] Optionally, the basic shape generated by fitting can be a regular shape such as a rectangle, triangle, etc., of course, it can also be an irregular shape, which is not limited here and may vary according to the actual application scenario; the basic texture maps of each layer obtained can specifically be: wood texture, cloth texture, rock texture, metal texture, vegetation texture, gravel texture, etc., which are not limited here.

[0087] It can be seen that the present application can use a preset noise algorithm to generate multi-layer procedural textures. Compared with the prior art, it does not need to rely on model UV sampling and can improve the texture rendering speed. In addition, combined with the above embodiments, since the lighting parameters can be changed at any time to adjust the texture style, it has the characteristics of flexible design.

[0088] In addition, it should be noted that, in some embodiments, multiple trigonometric function superposition, mean filtering, mathematical formula fitting, etc. can also be used to fit and generate texture units, which is not limited here.

[0089] Figure 7 A schematic diagram of another texture rendering method provided in an embodiment of the present application. In an optional implementation, as Figure 7 As shown, the above-mentioned texture units of multiple basic shapes corresponding to the target model are generated based on the material blueprint through a preset noise algorithm fitting, including:

[0090] Step 401: Based on the material blueprint, the size parameters of each texture unit and the corresponding arrangement position of each texture unit are calculated by fitting through a preset noise algorithm.

[0091] The arrangement positions corresponding to the texture units may represent the arrangement positions of the texture units in the basic texture maps of each layer.

[0092] In an optional embodiment, if Figure 7 As shown, the above-mentioned basic texture maps of each layer corresponding to the target model are obtained according to the texture units of multiple basic shapes, including:

[0093] Step 402: Obtain basic texture maps of each layer corresponding to the target model according to the size parameters of each texture unit and the corresponding arrangement positions of each texture unit.

[0094] Optionally, when fitting, the target model can be UV expanded to obtain the UV coordinates corresponding to each vertex in the target model in the UV space, and based on the UV coordinates, the size parameters of each texture unit and the corresponding arrangement position of each texture unit are calculated by fitting through a preset noise algorithm, and a layer of basic texture map is generated accordingly. Referring to the acquisition process, a multi-layer basic texture map can be obtained.

[0095] In some embodiments, the size parameters of each texture unit and the corresponding arrangement position of each texture unit can be determined by participating in the following code:

[0096] float2 blockCenter=UV×(1.0+PerlinNoise(UV×10.0)×0.1);

[0097] float blockSize=4.0×Random(UV×10.0);

[0098] Among them, UV represents the UV coordinates corresponding to the target model, PerlinNoise represents the Perlin noise function, blockCenter represents the arrangement position of each texture unit generated by fitting in the basic texture map, blockSize represents the size parameter of each texture unit generated by fitting, and Random() represents the random number generation function.

[0099] Optionally, the definition of the random number generation function Random() can be seen as follows:

[0100] float Random(float2 p){

[0101] return frac(sin(dot(p,float2(12.9898,78.233)))×43758.5453123);

[0102] }

[0103] Among them, frac() represents the fractional exponential function, sin() represents the trigonometric sine function, and dot() represents the dot product function.

[0104] In some embodiments, each layer of base texture map may include multiple texture units of different sizes.

[0105] It should be noted that, of course, a random number generation function can also be used to perform further random calculations on the size parameters of each texture unit generated above and the corresponding arrangement positions of each texture unit, so as to meet the design requirements in different scenarios and improve the applicability of the method of the present application.

[0106] Figure 8 Another schematic diagram of texture rendering effect provided by an embodiment of the present application. In an optional implementation, the above-mentioned acquisition of each layer of basic texture maps corresponding to the target model according to the size parameters and UV coordinates of each texture unit includes:

[0107] Obtain color parameters of each texture unit; arrange multiple texture units according to the color parameters of each texture unit, the size parameters of each texture unit and the corresponding arrangement positions of each texture unit to obtain basic texture maps of each layer corresponding to the target model.

[0108] Optionally, the color parameter of each texture unit may be determined by a random number generation function, or may be specified by a user, which is not limited here and may be flexibly selected according to actual application scenarios.

[0109] For example, for the first layer of basic texture map, the following code can be used to fill each texture unit in the first layer of basic texture map:

[0110] float RandomTextures01=blockSize×Ramdom(color.r)

[0111] Among them, blockSize represents the texture unit in the first layer of basic texture map, Ramdom() represents the random number generation function, and color.r represents the color single layer channel.

[0112] After obtaining the color parameters of each texture unit, each texture unit can be filled according to the obtained color parameters, and combined with the size parameters of each texture unit and the corresponding arrangement position of each texture unit, the basic texture maps of each layer corresponding to the target model can be obtained, thereby realizing the ability to obtain basic texture maps of any color, thereby improving the applicability of the method of the present application.

[0113] Reference Figure 8 As shown in the figure, the target model is a ball model as an example. Figure 8 As shown, the first layer of basic texture map corresponding to the target model in a certain scene may include multiple block textures of different sizes, and the color of each block texture is determined by a random number generation function. Of course, it should be noted that basic texture maps of other texture styles can also be generated according to actual application scenarios.

[0114] In summary, compared with the prior art, the implementation of the texture rendering method of the present application does not need to rely on model UV sampling. Therefore, it can not only achieve the effect of real-time interaction and dynamic adjustment of ambient lighting, but also improve the rendering speed.

[0115] In an optional implementation, the basic texture map includes multiple layers, and the basic shape and / or size parameters of the texture units corresponding to each layer of the basic texture map are different.

[0116] Optionally, the above-mentioned basic texture map may include multiple layers. In order to achieve design diversity, the basic shape and / or size parameters of the texture units corresponding to each layer of basic texture map may be set to be different, so that each basic texture map can display different texture effects, thereby improving the flexibility and applicability of the method of the present application.

[0117] In summary, in the texture rendering method provided in the present application, there is no need to manually create UV coordinates, the algorithm can automatically adapt to lighting changes, and thus the texture effect can be adjusted in real time according to the ambient lighting to enhance the visual effect; and the calculation of procedural textures can ensure efficient operation on the graphics processing unit (GPU) and improve rendering performance.

[0118] Fig. 9This is a functional module diagram of a texture rendering device provided in an embodiment of the present application. The basic principle and technical effects of the device are the same as those of the corresponding method embodiment described above. For the sake of brief description, the parts not mentioned in this embodiment can be referred to the corresponding contents in the method embodiment. Fig. 9 As shown, the texture rendering device 100 includes:

[0119] An acquisition module 110 is used to acquire at least one layer of basic texture map corresponding to the target model;

[0120] The response module 120 is used to process at least one layer of the basic texture map in response to the adjustment operation of the illumination parameter and / or the viewing angle parameter, and generate at least one layer of mixed texture map corresponding to the target model.

[0121] The rendering module 130 is used to obtain the texture rendering effect corresponding to the target model by superimposing at least one layer of the basic texture map and at least one layer of the mixed texture map.

[0122] In an optional embodiment, the illumination parameters include: illumination direction and illumination intensity, the basic texture map includes at least two layers, and the response module 120 is specifically configured to respond to an adjustment operation on the illumination direction and / or the viewing angle direction, and calculate a hybrid rendering weight according to the adjusted illumination direction and / or the viewing angle direction;

[0123] According to the mixed rendering weight, a mixing operation is performed on any two layers of basic texture maps to obtain a first illumination mixed texture map corresponding to the target model;

[0124] In response to the adjustment operation on the illumination intensity, a mixing operation is performed on the first illumination mixed texture map and at least one layer of basic texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model.

[0125] In an optional implementation, the response module 120 specifically obtains the illumination vector corresponding to the illumination direction and the viewing angle vector corresponding to the viewing angle direction respectively;

[0126] A dot product calculation is performed on the illumination vector and the viewing angle vector, and a dot product calculation result is used as a mixed rendering weight.

[0127] In an optional embodiment, the acquisition module 110 is specifically used to use the adjusted light intensity as a linear interpolation parameter, perform a blending operation on the first light mixed texture map and at least one layer of basic texture map, and obtain a second light mixed texture map corresponding to the target model.

[0128] In an optional implementation, the acquisition module 110 is specifically used to generate a plurality of texture units of basic shapes corresponding to the target model by fitting a preset noise algorithm based on the material blueprint;

[0129] According to the texture units of multiple basic shapes, the basic texture maps of each layer corresponding to the target model are obtained.

[0130] In an optional embodiment, the acquisition module 110 is specifically used to calculate the size parameters of each texture unit and the arrangement position corresponding to each texture unit based on the material blueprint by fitting through a preset noise algorithm; according to the size parameters of each texture unit and the arrangement position corresponding to each texture unit, multiple texture units are arranged to obtain each layer of basic texture maps corresponding to the target model.

[0131] In an optional implementation, the acquisition module 110 is specifically used to acquire color parameters of each texture unit;

[0132] According to the color parameters of each texture unit, the size parameters of each texture unit and the corresponding arrangement position of each texture unit, the plurality of texture units are arranged to obtain the basic texture maps of each layer corresponding to the target model.

[0133] In an optional implementation, the basic texture map includes multiple layers, and the basic shape and / or size parameters of the texture units corresponding to the basic texture maps in each layer are different.

[0134] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0135] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0136] Fig.10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, and the electronic device can be integrated into the above-mentioned texture rendering device. Fig.10 As shown, the electronic device may include: a processor 210, a storage medium 220 and a bus 230, the storage medium 220 stores machine-readable instructions executable by the processor 210, when the electronic device is running, the processor 210 and the storage medium 220 communicate through the bus 230, the processor 210 executes the machine-readable instructions to perform the steps of the following method embodiment:

[0137] Obtain at least one layer of basic texture map corresponding to the target model;

[0138] In response to the adjustment operation of the illumination parameter and / or the viewing angle parameter, processing at least one layer of the basic texture map to generate at least one layer of mixed texture map corresponding to the target model;

[0139] At least one layer of the basic texture map and at least one layer of the mixed texture map are superimposed on the target model to obtain a texture rendering effect corresponding to the target model.

[0140] In an optional embodiment, the illumination parameters include: illumination direction and illumination intensity, the basic texture map includes at least two layers, and in response to the adjustment operation of the illumination parameters and / or the viewing angle parameters, at least one layer of the basic texture map is processed to generate at least one layer of mixed texture map corresponding to the target model, including:

[0141] In response to an adjustment operation on a lighting direction and / or a viewing angle direction, calculating a hybrid rendering weight according to the adjusted lighting direction and / or the viewing angle direction;

[0142] According to the mixed rendering weight, a mixing operation is performed on any two layers of basic texture maps to obtain a first illumination mixed texture map corresponding to the target model;

[0143] In response to the adjustment operation on the illumination intensity, a mixing operation is performed on the first illumination mixed texture map and at least one layer of basic texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model.

[0144] In an optional implementation, calculating the mixed rendering weight according to the adjusted illumination direction and / or viewing angle direction includes:

[0145] Respectively obtain an illumination vector corresponding to the illumination direction and a viewing angle vector corresponding to the viewing angle direction;

[0146] A dot product calculation is performed on the illumination vector and the viewing angle vector, and a dot product calculation result is used as a mixed rendering weight.

[0147] In an optional embodiment, in response to the adjustment operation on the illumination intensity, performing a mixing operation on the first illumination mixed texture map and at least one layer of base texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model includes:

[0148] The adjusted illumination intensity is used as a linear interpolation parameter, and a blending operation is performed on the first illumination mixed texture map and at least one layer of basic texture map to obtain a second illumination mixed texture map corresponding to the target model.

[0149] In an optional implementation, the obtaining of at least one layer of basic texture map corresponding to the target model includes:

[0150] Based on the material blueprint, a preset noise algorithm is used to fit and generate texture units of multiple basic shapes corresponding to the target model;

[0151] According to the texture units of multiple basic shapes, the basic texture maps of each layer corresponding to the target model are obtained.

[0152] In an optional embodiment, the method of generating a plurality of texture units of basic shapes corresponding to the target model based on the material blueprint by fitting a preset noise algorithm includes:

[0153] Based on the material blueprint, the size parameters of each texture unit and the corresponding arrangement position of each texture unit are calculated through the preset noise algorithm fitting;

[0154] The step of obtaining the basic texture maps of each layer corresponding to the target model according to the texture units of the multiple basic shapes includes:

[0155] According to the size parameters of each texture unit and the arrangement position corresponding to each texture unit, a plurality of the texture units are arranged to obtain basic texture maps of each layer corresponding to the target model.

[0156] In an optional implementation, the arranging the plurality of texture units according to the size parameters of the texture units and the arrangement positions corresponding to the texture units to obtain the basic texture maps of each layer corresponding to the target model includes:

[0157] Get the color parameters of each texture unit;

[0158] According to the color parameters of each texture unit, the size parameters of each texture unit and the corresponding arrangement position of each texture unit, the basic texture maps of each layer corresponding to the target model are obtained.

[0159] In an optional implementation, the basic texture map includes multiple layers, and the basic shape and / or size parameters of the texture units corresponding to the basic texture maps in each layer are different.

[0160] The specific implementation methods and technical effects of the above steps can be found in the above related instructions, which will not be repeated here.

[0161] Optionally, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the following method embodiment are executed:

[0162] Obtain at least one layer of basic texture map corresponding to the target model;

[0163] In response to the adjustment operation of the illumination parameter and / or the viewing angle parameter, processing at least one layer of the basic texture map to generate at least one layer of mixed texture map corresponding to the target model;

[0164] At least one layer of the basic texture map and at least one layer of the mixed texture map are superimposed on the target model to obtain a texture rendering effect corresponding to the target model.

[0165] In an optional embodiment, the illumination parameters include: illumination direction and illumination intensity, the basic texture map includes at least two layers, and in response to the adjustment operation of the illumination parameters and / or the viewing angle parameters, at least one layer of the basic texture map is processed to generate at least one layer of mixed texture map corresponding to the target model, including:

[0166] In response to an adjustment operation on a lighting direction and / or a viewing angle direction, calculating a hybrid rendering weight according to the adjusted lighting direction and / or the viewing angle direction;

[0167] According to the mixed rendering weight, a mixing operation is performed on any two layers of basic texture maps to obtain a first illumination mixed texture map corresponding to the target model;

[0168] In response to the adjustment operation on the illumination intensity, a mixing operation is performed on the first illumination mixed texture map and at least one layer of basic texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model.

[0169] In an optional implementation, calculating the mixed rendering weight according to the adjusted illumination direction and / or viewing angle direction includes:

[0170] Respectively obtain an illumination vector corresponding to the illumination direction and a viewing angle vector corresponding to the viewing angle direction;

[0171] A dot product calculation is performed on the illumination vector and the viewing angle vector, and a dot product calculation result is used as a mixed rendering weight.

[0172] In an optional embodiment, in response to the adjustment operation on the illumination intensity, performing a mixing operation on the first illumination mixed texture map and at least one layer of base texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model includes:

[0173] The adjusted illumination intensity is used as a linear interpolation parameter, and a blending operation is performed on the first illumination mixed texture map and at least one layer of basic texture map to obtain a second illumination mixed texture map corresponding to the target model.

[0174] In an optional implementation, the obtaining of at least one layer of basic texture map corresponding to the target model includes:

[0175] Based on the material blueprint, a preset noise algorithm is used to fit and generate texture units of multiple basic shapes corresponding to the target model;

[0176] According to the texture units of multiple basic shapes, the basic texture maps of each layer corresponding to the target model are obtained.

[0177] In an optional embodiment, the method of generating a plurality of texture units of basic shapes corresponding to the target model based on the material blueprint by fitting a preset noise algorithm includes:

[0178] Based on the material blueprint, the size parameters of each texture unit and the corresponding arrangement position of each texture unit are calculated through the preset noise algorithm fitting;

[0179] The step of obtaining the basic texture maps of each layer corresponding to the target model according to the texture units of the multiple basic shapes includes:

[0180] According to the size parameters of each texture unit and the corresponding arrangement position of each texture unit, a plurality of the texture units are arranged to obtain basic texture maps of each layer corresponding to the target model.

[0181] In an optional implementation, the arranging the plurality of texture units according to the size parameters of the texture units and the arrangement positions corresponding to the texture units to obtain the basic texture maps of each layer corresponding to the target model includes:

[0182] Get the color parameters of each texture unit;

[0183] According to the color parameters of each texture unit, the size parameters of each texture unit and the corresponding arrangement position of each texture unit, the basic texture maps of each layer corresponding to the target model are obtained.

[0184] In an optional implementation, the basic texture map includes multiple layers, and the basic shape and / or size parameters of the texture units corresponding to the basic texture maps in each layer are different.

[0185] The specific implementation methods and technical effects of the above steps can be found in the above related instructions, which will not be repeated here.

[0186] Optionally, the present application also provides a computer program product, which includes instructions, and when the instructions are executed on an electronic device, the electronic device implements the steps of the above method embodiment.

[0187] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0188] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0189] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0190] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0191] It should be noted that, in this article, relational terms such as "first" and "second" 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.

[0192] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A texture rendering method, characterized in that: The method comprises: Obtain at least one layer of basic texture map corresponding to the target model; In response to the adjustment operation of the illumination parameter and / or the viewing angle parameter, processing at least one layer of the basic texture map to generate at least one layer of mixed texture map corresponding to the target model; At least one layer of the basic texture map and at least one layer of the mixed texture map are superimposed on the target model to obtain a texture rendering effect corresponding to the target model.

2. The method according to claim 1, characterized in that The illumination parameters include: illumination direction and illumination intensity, the basic texture map includes at least two layers, and in response to the adjustment operation of the illumination parameters and / or the viewing angle parameters, at least one layer of the basic texture map is processed to generate at least one layer of mixed texture map corresponding to the target model, including: In response to an adjustment operation on the illumination direction and / or the viewing angle direction, a hybrid rendering weight is calculated according to the adjusted illumination direction and / or the viewing angle direction; According to the mixed rendering weight, a mixing operation is performed on any two layers of basic texture maps to obtain a first illumination mixed texture map corresponding to the target model; In response to the adjustment operation on the illumination intensity, a mixing operation is performed on the first illumination mixed texture map and at least one layer of basic texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model.

3. The method according to claim 2, characterized in that The calculating the mixed rendering weight according to the adjusted illumination direction and / or viewing angle direction includes: Respectively obtain an illumination vector corresponding to the illumination direction and a viewing angle vector corresponding to the viewing angle direction; A dot product calculation is performed on the illumination vector and the viewing angle vector, and a dot product calculation result is used as a mixed rendering weight.

4. The method according to claim 2, characterized in that: In response to the adjustment operation on the illumination intensity, performing a mixing operation on the first illumination mixed texture map and at least one layer of base texture map based on the adjusted illumination intensity to obtain a second illumination mixed texture map corresponding to the target model, including: The adjusted illumination intensity is used as a linear interpolation parameter, and a blending operation is performed on the first illumination mixed texture map and at least one layer of basic texture map to obtain a second illumination mixed texture map corresponding to the target model.

5. The method according to any one of claims 1 to 4, characterized in that: The step of obtaining at least one layer of basic texture map corresponding to the target model includes: Based on the material blueprint, a preset noise algorithm is used to fit and generate texture units of multiple basic shapes corresponding to the target model; According to the texture units of multiple basic shapes, the basic texture maps of each layer corresponding to the target model are obtained.

6. The method according to claim 5, characterized in that The method of generating a plurality of texture units of basic shapes corresponding to the target model based on the material blueprint by fitting a preset noise algorithm includes: Based on the material blueprint, the size parameters of each texture unit and the corresponding arrangement position of each texture unit are calculated through the preset noise algorithm fitting; The step of obtaining the basic texture maps of each layer corresponding to the target model according to the texture units of the multiple basic shapes includes: According to the size parameters of each texture unit and the corresponding arrangement position of each texture unit, a plurality of the texture units are arranged to obtain basic texture maps of each layer corresponding to the target model.

7. The method according to claim 6, characterized in that The method of arranging the plurality of texture units according to the size parameters of the texture units and the arrangement positions corresponding to the texture units to obtain the basic texture maps of each layer corresponding to the target model includes: Get the color parameters of each texture unit; According to the color parameters of each texture unit, the size parameters of each texture unit and the corresponding arrangement position of each texture unit, the plurality of texture units are arranged to obtain the basic texture maps of each layer corresponding to the target model.

8. The method according to claim 6, characterized in that The basic texture map includes multiple layers, and the basic shape and / or size parameters of the texture units corresponding to the basic texture maps in each layer are different.

9. A texture rendering device, characterized in that: include: An acquisition module, used to acquire at least one layer of basic texture map corresponding to the target model; A response module, configured to process at least one layer of the basic texture map in response to an adjustment operation on the illumination parameter and / or the viewing angle parameter, and generate at least one layer of mixed texture map corresponding to the target model; A rendering module is used to superimpose at least one layer of the basic texture map and at least one layer of the mixed texture map on the target model to obtain a texture rendering effect corresponding to the target model.

10. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the texture rendering method as described in any one of claims 1-8.

11. 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 steps of the texture rendering method according to any one of claims 1 to 8 are executed.