Virtual model rendering method and device, electronic equipment and storage medium
Through the processing of material partition maps and splicing normal maps, the target channel map is extracted and the target normal map is obtained for rendering, which solves the problem of low rendering efficiency of virtual models in the existing technology and achieves efficient rendering effect.
Patent Information
- Application Number
- CN202311570200.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2025-05-23
AI Technical Summary
In the construction of virtual models, in order to improve authenticity and detail, a large number of maps are often used, resulting in the normal map being compressed during use, blurring texture details, increasing memory usage, affecting rendering efficiency, and having limitations in later iteration adjustments.
By obtaining the material partition map and splicing normal map of the virtual model, extract the target channel map of the to-processed material, and in response to the map selection operation, obtain the target normal map corresponding to the target channel map from the splicing normal map and render it.
Reduces the number of normal maps, reduces the number of texture samples, saves memory and processor burden, improves the rendering efficiency of virtual models, while maintaining authenticity and detail.
Smart Images

Figure CN120022586A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a virtual model rendering method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of computer technology, virtual models are increasingly used. For example, in game production, virtual models are used to form virtual scenes of games. At present, in order to improve the authenticity and details of virtual models, a large number of textures are often used to build virtual models.
[0003] At present, there are two main ways to build virtual models:
[0004] The first method is to draw the basic normal and detail normal of the virtual model on the same map to obtain a large-size normal map to build the virtual model. However, the defects of the first method are: the large-size normal map will be compressed during use, causing the texture details of the virtual model to be blurred, and the large-size normal map will also increase the space occupied by the video memory and content, resulting in loading time, slow operation or freezing, etc., affecting the rendering efficiency of the virtual model; and the use of a normal map has limitations in the adjustment of later iterations, and the adjustment of the normal will extend to the entire model, and it is impossible to make independent and detailed adjustments.
[0005] The second method is to superimpose the texture detail normal and the base normal after tiling in the material to build a virtual model and create a delicate detail effect. However, the second method has the disadvantage that there are a large number of textures, especially in complex material details, which often require the use of multiple different texture detail normals. Using multiple normal maps will increase memory and loading time, affecting the rendering efficiency of the virtual model.
[0006] Based on this, how to improve the rendering efficiency of virtual models while ensuring the authenticity and details of virtual models has become a technical problem that needs to be solved urgently. Summary of the invention
[0007] The embodiments of the present disclosure provide a virtual model rendering method, device, electronic device and storage medium, which can improve the rendering efficiency of the virtual model while ensuring the authenticity and details of the virtual model.
[0008] In a first aspect, an embodiment of the present disclosure provides a virtual model rendering method, comprising:
[0009] Obtaining a material partition map and a spliced normal map corresponding to a virtual model to be rendered, wherein the spliced normal map is composed of a plurality of normal maps to be superimposed, and the material partition map is used to represent different materials in the virtual model through different colors;
[0010] Determine the material to be processed in the virtual model, and extract the target channel map corresponding to the material to be processed from the material partition map;
[0011] In response to the map selection operation, obtaining a target normal map corresponding to the target channel map from the concatenated normal map;
[0012] The virtual model is rendered using the target normal map corresponding to the target channel map.
[0013] In a second aspect, an embodiment of the present disclosure provides a virtual model rendering device, including:
[0014] A data acquisition unit, used to acquire a material partition map and a spliced normal map corresponding to a virtual model to be rendered, wherein the spliced normal map is composed of a plurality of normal maps to be superimposed, and the material partition map is used to represent different materials in the virtual model by different colors;
[0015] A texture determination unit, used to determine the material to be processed in the virtual model, and extract the target channel texture corresponding to the material to be processed from the material partition texture;
[0016] A response unit, configured to obtain a target normal map corresponding to a target channel map from the concatenated normal map in response to a map selection operation;
[0017] The rendering unit is used for rendering the virtual model through the target normal map corresponding to the target channel map.
[0018] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising a memory storing a plurality of instructions; a processor loads the instructions from the memory to execute the steps of any one of the virtual model rendering methods provided in the embodiments of the present disclosure.
[0019] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the steps of any one of the virtual model rendering methods provided in the embodiments of the present disclosure.
[0020] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps in any one of the virtual model rendering methods provided in the embodiments of the present disclosure.
[0021] By adopting the scheme of the application embodiment, the target channel map corresponding to the material to be processed can be extracted from the material partition map of the virtual model, and then in response to the corresponding map operation, the target normal map corresponding to the target channel map is obtained from the spliced normal map of the virtual model. Then, the virtual model is rendered by the target normal map, which can reduce the number of normal maps and thus reduce the number of texture sampling times, which can save memory controls and reduce the burden on the processor caused by texture switching, thereby improving the rendering efficiency of the virtual model while ensuring the rendering effect of the virtual model (including authenticity and detail). BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A schematic diagram of a first method of the prior art provided for an embodiment of the present disclosure;
[0024] Figure 2 The embodiments of the present disclosure provide Figure 1 A is an enlarged schematic diagram;
[0025] Figure 3 A schematic diagram of a normal map before and after compression provided by an embodiment of the present disclosure;
[0026] Figure 4 A schematic diagram of a second method of the prior art provided by an embodiment of the present disclosure;
[0027] Figure 5 One of the flowcharts of the virtual model rendering method provided in the embodiment of the present disclosure;
[0028] Figure 6 An example diagram of an ID sticker provided in an embodiment of the present disclosure;
[0029] Figure 7 An example diagram of a spliced normal map provided in an embodiment of the present disclosure;
[0030] Figure 8 Another example diagram of a spliced normal map provided by an embodiment of the present disclosure;
[0031] Fig. 9 A second flowchart of the virtual model rendering method provided in an embodiment of the present disclosure;
[0032] Fig.10 A schematic diagram of a target normal map provided by an embodiment of the present disclosure;
[0033] Fig.11 A schematic diagram of the effect of normal strength adjustment provided in an embodiment of the present disclosure;
[0034] Fig.12 A schematic diagram of the overall effect of a rendered virtual model provided by an embodiment of the present disclosure;
[0035] Fig.13 A schematic diagram of the local detail effect of a virtual model after rendering provided by an embodiment of the present disclosure;
[0036] Fig.14 A schematic diagram of the local detail effect of a virtual model after rendering provided by an embodiment of the present disclosure;
[0037] Fig.15 It is a structural schematic diagram of a virtual model rendering device provided in an embodiment of the present disclosure;
[0038] Fig.16 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure. At the same time, in the description of the embodiments of the present disclosure, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present disclosure, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0040] In the process of describing the embodiments of the present application, some nouns or terms appearing are applicable to the following interpretations:
[0041] ID Texture Map: refers to a texture that represents different virtual materials through different colors.
[0042] Normal map: refers to a map that marks the normal direction of each point on the concave and convex surface of a virtual object through the RGB color channel. Normal map can display detailed information of models with more faces.
[0043] From the above background technology, it can be seen that there are mainly two ways to build a virtual model in the prior art, which are described as follows:
[0044] The first method is to draw the basic normals and detail normals of the virtual model on the same map to obtain a large-size normal map, such as Figure 1 As shown, Figure 1 A normal map of 2048*2048 pixels. Figure 2 for Figure 1 The local details of the area A in the figure are shown in FIG. 1 . In the process of rendering the virtual model in the first way, the virtual model will be compressed due to its large size. For example, Figure 2 Compress as shown to get 512*512 pixels Figure 3 ,visible Figure 3 The texture details in Figure 2 is blurred, so rendering the model through virtual model in the first way will affect the details of the model.
[0045] The second way is to overlay the texture detail normal map with the base normal map after tiling the material, for example Figure 4 As shown, the base normal map and the cloth detail normal map (ie, the texture detail normal map) are superimposed. Although the second method can improve the detail of the virtual model, when there are a large number of maps, such as when making virtual clothing for virtual characters in games, the rendering efficiency of the virtual model is low.
[0046] Based on this, the embodiments of the present disclosure provide a virtual model rendering method, device, electronic device and computer-readable storage medium.
[0047] Specifically, this embodiment will be described from the perspective of a virtual model rendering device, which can be integrated into an electronic device, that is, the virtual model rendering method of the disclosed embodiment can be executed by an electronic device, and optionally, the electronic device can include: a terminal device. The terminal device can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a game console, or a personal computer (PC).
[0048] The virtual model rendering method provided by the embodiment of the present disclosure can be applied to a virtual model rendering system. The virtual model rendering system may include a terminal device and a server. The terminal device may be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. The terminal device and the server may perform two-way communication via a network.
[0049] Optionally, the electronic device may be a server, which may be an independent server or a server network or server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. Among them, the cloud server is composed of a large number of computers or network servers based on cloud computing (Cloud Computing).
[0050] The virtual model rendering method in one embodiment of the present disclosure may run on a local terminal device or a server. When the virtual model rendering method runs on the server, the method may be implemented and executed based on a cloud interaction system, where the cloud interaction system includes a server and a client device.
[0051] In an optional implementation, various cloud applications may run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the running entity of the game program and the presenting entity of the game screen are separated. The storage and running of the interaction method in the game are completed on the cloud game server. The client device is used for receiving and sending data and presenting the game screen. For example, the client device may be a display device with data transmission function close to the user side, such as a mobile terminal, a television, a computer, a palm computer, etc.; however, the information processing is performed by the cloud game server in the cloud. When playing a game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses data such as the game screen, returns it to the client device through the network, and finally, the client device decodes and outputs the game screen.
[0052] The following will be described in detail with reference to the accompanying drawings. In this embodiment, the execution entity is taken as an example of a terminal device. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order from that shown in the drawings.
[0053] Figure 5 For the flowchart of the virtual model rendering method provided by the embodiment of the present disclosure, as Figure 5 shown, the virtual model rendering method provided by the embodiment of the present disclosure at least includes the following steps:
[0054] S501, obtain the material partition map and the spliced normal map corresponding to the virtual model to be rendered.
[0055] The above virtual model may be a virtual character model, a virtual item model, a virtual prop model, a virtual clothing model, etc. in a game scene, which is not specifically limited in the embodiment of the present application.
[0056] The material partition map is used to represent different materials in the virtual model through different colors, which is the ID map. The ID map can encode the material ID information of different parts of the virtual model into different colors, and then put these colors on a map, thereby realizing the separation of the materials of the virtual model. Figure 6 The virtual model shown includes 4 different materials, namely, ink printed fabric area, rough elastic fabric area, knitted fabric area, and leather fabric area. Figure 6 As shown, the virtual model is distinguished according to its material, and the same material area is covered with white, and other areas are covered with black, and the following is obtained: Figure 6 ID image shown.
[0057] The above-mentioned spliced normal map is composed of a plurality of normal maps to be superimposed, and the spliced normal map has four-way continuity. The normal map to be superimposed can be a normal map pre-made by a technician for rendering the normal texture of the virtual model. In this embodiment, the normal maps to be superimposed corresponding to the virtual model are spliced to form a square spliced normal map, for example, Figure 7 , Figure 8 As shown, Figure 7 , Figure 8 A square-shaped stitched normal map is obtained by stitching four different normal maps to be superimposed.
[0058] Furthermore, a unique corresponding variable value is pre-set for each normal map to be superimposed in the spliced normal map, such as Figure 7 As shown, 0 represents the normal map to be superimposed in the upper left of the spliced normal map, 0.25 represents the normal map to be superimposed in the upper right of the spliced normal map, 0.5 represents the normal map to be superimposed in the lower left of the spliced normal map, and 0.75 represents the normal map to be superimposed in the lower right of the spliced normal map. On this basis, the normal map to be superimposed selected by the designer in the spliced normal map can be determined by the variable value.
[0059] In actual application scenarios, the number of normal maps to be superimposed on the virtual model may not be enough to form a square-shaped spliced normal map, thereby affecting the subsequent rendering of the virtual model. Therefore, before step S501, Fig. 9 As shown, the above-mentioned acquisition of the spliced normal map of the virtual model to be rendered can be achieved by at least the following steps:
[0060] S901, obtaining the number of multiple normal maps to be superimposed corresponding to the virtual model.
[0061] In this embodiment, the number of normal maps to be superimposed corresponding to the virtual model may be determined first, for example, the virtual model A has 4 normal maps to be superimposed, or the virtual model B has 6 normal maps to be superimposed.
[0062] S902: If the number of maps does not meet the preset splicing condition, a corresponding template map is obtained, and the template map and the normal map to be superimposed are spliced to obtain a square spliced normal map.
[0063] The above preset splicing condition is that the number of tiles is the number of squares, such as 4, 9, 16, etc.
[0064] In this embodiment, if the number of maps does not meet the preset splicing conditions, it indicates that the normal map to be superimposed of the virtual model cannot be directly spliced into a square spliced normal map. At this time, a corresponding number of preset template maps can be obtained, so that the total number of maps of the template map and the normal map to be superimposed meets the preset splicing conditions, that is, the total number of maps of the template map and the normal map to be superimposed is a square number, thereby splicing the template map and the normal map to be superimposed into a square spliced normal map.
[0065] For example, the number of normal maps to be superimposed corresponding to the virtual model is 3, and at this time, 1 template map is obtained to splice them into a square-shaped spliced normal map; for example, the number of normal maps to be superimposed corresponding to the virtual model is 7, and at this time, 2 template maps are obtained to splice them into a square-shaped spliced normal map.
[0066] It is understandable that the specific implementation of the above template map may include but is not limited to: being pre-drawn by a designer using a graphics drawing software, or being selected from a preset map database.
[0067] In addition, if the number of textures does not meet the preset splicing conditions, the total number of the obtained template textures and the normal map to be superimposed can be a square number that is greater than the number of textures and closest to the number of textures, so as to avoid adding more template textures to affect the rendering efficiency of the virtual model. For example, if the number of textures of the multiple normal maps to be superimposed corresponding to the virtual model is 8, then only one template texture needs to be obtained to splice the normal map into a square splicing.
[0068] S903: If the number of maps meets the preset splicing condition, the normal maps to be superimposed are spliced into a spliced normal map in a square form.
[0069] In this embodiment, if the number of maps meets the preset splicing condition, the normal maps to be superimposed of the virtual model can be directly spliced into a square spliced normal map without obtaining a template map.
[0070] In the embodiment of the present disclosure, the number of normal maps to be superimposed on the virtual model is used to ensure that the spliced normal map is in a square form, thereby ensuring the subsequent accurate calling of the corresponding normal map to be superimposed, thereby improving the accuracy and authenticity of the virtual model rendering.
[0071] It is understandable that the specific implementation of the material partition map, spliced normal map and normal map to be superimposed of the above virtual model may include but is not limited to: pre-drawn by designers using graphics drawing software, or selected from a preset map database.
[0072] S502, determining a material to be processed in the virtual model, and extracting a target channel map corresponding to the material to be processed from the material partition map.
[0073] The material to be processed in the virtual model can be determined by selecting the material of the virtual model. Then, the target channel map corresponding to the material to be processed is extracted from the material partition map, and the area corresponding to the material to be processed in the target channel map is covered with white, and the other areas are covered with black.
[0074] In one example, a material selection control may be pre-set, and a material selection operation for a virtual model may be implemented through a touch operation on the material selection control.
[0075] In this embodiment, the materials of the virtual model can be classified through the ID map, which increases the visibility during preview and the flexibility during production. By modifying the ID map, the target channel map corresponding to the material to be processed can be quickly obtained to further improve the virtual model rendering efficiency.
[0076] S503 , in response to the map selection operation, obtaining a target normal map corresponding to the target channel map from the concatenated normal map.
[0077] In this embodiment, a target normal map corresponding to the target channel map can be obtained from the spliced normal map through a map selection operation.
[0078] Specifically, in response to a texture selection operation on a texture control, a target variable value is determined; a target area image corresponding to the target variable value is determined from a spliced normal map; and using a texture mapping relationship, the target area image is controlled to be tiled according to a target channel image to obtain a target normal map corresponding to the target channel map.
[0079] For example, if the target variable value is 0, the corresponding target area image is as follows Figure 8 The normal map in the upper left corner is shown in the figure; if the target variable value is 0.25, the corresponding target area image is as follows Figure 8 The normal map in the upper right corner is shown in the figure; if the target variable value is 0.5, the corresponding target area image is as follows Figure 8 The normal map in the lower left corner is shown in the figure; the target variable value is 0.75, then the corresponding target area image is as follows Figure 8 The normal map shown in the bottom right.
[0080] In the embodiment of the present application, during the tiling process of the target area image, texture mapping is performed by using the UV value of the target channel image to obtain, for example, Fig.10 The target normal map is used to render the model in the area corresponding to the material to be processed through the target normal map, so as to ensure that the texture details of the target normal map are directly rendered in the area corresponding to the material to be processed, thereby improving the accuracy of virtual model rendering.
[0081] In this embodiment, a map control may be provided for interaction, and the map control is used to determine the target texture details selected by the designer. The target variable value selected or input by the designer is determined by touch operation of the map control, and the target area image in the spliced normal map is determined by the target variable value, and the target area image is the normal map corresponding to the target texture details.
[0082] Furthermore, in response to a touch operation on the first adjustment control, a tiling density parameter is determined; and by utilizing a texture mapping relationship, during a tiling operation of the target area image according to the target channel map, the tiling density of the target area image is controlled according to the tiling density parameter.
[0083] In this embodiment, after the target area image is determined, a first adjustment control can be provided. The first adjustment control is used to determine the tiling density of the target area image. Through the interaction between the designer and the first adjustment control, the rendering effect of the details corresponding to the target area in the virtual model can be further adjusted to improve the user experience.
[0084] S504, rendering the virtual model through the target normal map corresponding to the target channel map.
[0085] Specifically, an initial normal map corresponding to a target channel map is obtained; the initial normal map corresponding to the target channel map and the target normal map are superimposed on each other to obtain a superimposed normal map; and a virtual model is rendered according to the superimposed normal map to obtain a target virtual model.
[0086] The initial normal map may be the current normal map of the virtual model. In the embodiment of the present application, the virtual model to be rendered is rendered using the target normal map obtained by superimposing the normal textures, thereby obtaining a target virtual model with texture details adjusted for the material to be processed.
[0087] The virtual model rendering method provided by the embodiment of the present disclosure extracts the target channel map corresponding to the material to be processed from the material partition map of the virtual model, and then obtains the target normal map corresponding to the target channel map from the spliced normal map of the virtual model in response to the corresponding map operation, and then renders the virtual model through the target normal map, which can reduce the number of normal maps and thus reduce the number of texture sampling times, which can save memory controls and reduce the burden on the processor caused by texture switching, thereby improving the rendering efficiency of the virtual model while ensuring the virtual model rendering effect (including authenticity and detail).
[0088] In some optional embodiments, before step S504: rendering the virtual model using the target normal map corresponding to the target channel map, the virtual model rendering method provided by the embodiment of the present disclosure may further include:
[0089] Call the preset Frac node and use the Frac node to perform decimal processing on the UV value of the target normal map.
[0090] The Frac node can convert the UV value after tiling to a value range of 0-1 after canceling the number. For example, when the target area image is tiled twice during the tiling process, the conventional UV value is a gradient from 0 to 2. The Frac node can limit the UV value after tiling to the range of 0-1, thereby ensuring that the UV of the target area image itself will not be stretched during the mobile tiling process, avoiding the phenomenon of reduced rendering effect of the virtual model due to tiling, and ensuring the rendering effect of the virtual model.
[0091] In some optional embodiments, before step S504: rendering the virtual model using the target normal map corresponding to the target channel map, the virtual model rendering method provided by the embodiment of the present disclosure may further include:
[0092] In response to the touch operation of the second adjustment control, the normal strength of the target normal map is adjusted.
[0093] The second adjustment control is used to adjust the normal strength of the target normal map. The target normal strength value is determined by interaction through the second adjustment control, and the normal strength of the target normal map is adjusted according to the target normal strength value.
[0094] Specifically, the normal strength of the target normal map is adjusted by linear interpolation. Since the RGB value of the normal map is usually obtained by normalizing the XYZ components of the normal vector, and normalization is the process of changing the length of the vector to 1, which can ensure that the direction of the normal vector remains unchanged, the normal map can be strengthened by adjusting the normal strength through linear interpolation. For example, Fig.11 As shown, Fig.11The left side of the middle arrow is the original normal map, and the right side is the normal map after the normal strength is continuously strengthened.
[0095] In this embodiment, by adjusting the normal strength of the target normal map through the second adjustment control, the flexibility of the material can be increased, the reuse rate of the material can be improved, and the effect iteration can be performed quickly, thereby reducing the tediousness of modifying the normal map, improving the rendering efficiency of the virtual model, and improving the user experience.
[0096] The virtual model rendering method provided by the above embodiment is used to render the virtual model. For example, the target rendering model obtained is as follows: Fig.12 As shown, in order to more fully reflect the rendering effect of this embodiment, a Fig.12 Detailed diagrams such as Fig.13 , Fig.14 shown. Fig.13 and Fig.14 The left side of the arrow is the effect before rendering, and the right side of the arrow is the effect after rendering.
[0097] Correspondingly, the embodiment of the present disclosure also provides a structural schematic diagram of a virtual model rendering device, such as Fig.15 As shown, the virtual model rendering device includes:
[0098] The data acquisition unit 1510 is used to acquire a material partition map and a spliced normal map corresponding to the virtual model to be rendered. The spliced normal map is composed of a plurality of normal maps to be superimposed. The material partition map is used to represent different materials in the virtual model by different colors.
[0099] A texture determination unit 1520 is used to determine the material to be processed in the virtual model, and extract the target channel texture corresponding to the material to be processed from the material partition texture;
[0100] A response unit 1530 is used to obtain a target normal map corresponding to the target channel map from the spliced normal map in response to the map selection operation;
[0101] The rendering unit 1540 is used to render the virtual model using the target normal map corresponding to the target channel map.
[0102] In some optional embodiments, the data acquisition unit 1510 is further configured to:
[0103] Obtain the number of multiple normal maps to be superimposed corresponding to the virtual model;
[0104] If the number of maps does not meet the preset splicing conditions, the corresponding template map is obtained, so that the template map and the normal map to be superimposed are spliced to obtain a square spliced normal map;
[0105] If the number of maps meets the preset stitching conditions, the normal maps to be superimposed are stitched into a square stitching normal map.
[0106] In some optional embodiments, the map determination unit 1520 is specifically used to:
[0107] In response to a tile selection operation on the tile control, determining a target variable value;
[0108] From the spliced normal map, determine the target region image corresponding to the target variable value;
[0109] By using the texture mapping relationship, the target area image is controlled to be tiled according to the target channel image, so as to obtain the target normal map corresponding to the target channel map.
[0110] In some optional embodiments, the above-mentioned map determination unit 1520 is further used for:
[0111] In response to a touch operation on the first adjustment control, determining a tiling density parameter;
[0112] In the process of controlling the target area image to perform a tiling operation according to the target channel map by using the texture mapping relationship, the density of the target area image is controlled according to the tiling density parameter.
[0113] In some optional embodiments, the virtual model rendering device provided by the embodiment of the present disclosure further includes: a calling unit (not shown in the figure), the calling unit is used to:
[0114] Call the preset Frac node and use the Frac node to perform decimal processing on the UV value of the target normal map.
[0115] In some optional embodiments, the virtual model rendering device provided by the embodiment of the present disclosure further includes: an intensity adjustment unit (not shown in the figure), which is used to:
[0116] In response to a touch operation on the second adjustment control, a normal strength adjustment is performed on the target normal map.
[0117] In some optional embodiments, the rendering unit 1540 is specifically used for:
[0118] Get the initial normal map corresponding to the target channel map;
[0119] Performing normal texture superposition on the initial normal map corresponding to the target channel map and the target normal map to obtain a superimposed normal map;
[0120] The virtual model is rendered according to the superimposed normal map.
[0121] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0122] Correspondingly, an embodiment of the present disclosure further provides an electronic device, which may be a terminal, and the terminal may be a terminal device such as a smart phone, a tablet computer, a notebook computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), etc. Alternatively, the electronic device may be a server.
[0123] As Fig.16 shown, Fig.16 is a schematic structural diagram of the electronic device provided by an embodiment of the present disclosure. The electronic device 1600 includes a processor 1601 having one or more processing cores, a memory 1602 having one or more computer-readable storage media, and a computer program stored on the memory 1602 and executable on the processor. Among them, the processor 1601 is electrically connected to the memory 1602. Those skilled in the art can understand that the structure of the electronic device shown in the figure does not constitute a limitation on the electronic device, and it may include more or fewer components than shown, or combine certain components, or arrange different components.
[0124] The processor 1601 is the control center of the electronic device 1600, connecting various parts of the entire electronic device 1600 through various interfaces and lines. By running or loading software programs and / or units stored in the memory 1602, and calling data stored in the memory 1602, it executes various functions of the electronic device 1600 and processes data, thereby monitoring the entire electronic device 1600. The processor 1601 may be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure.
[0125] In an embodiment of the present disclosure, the processor 1601 in the electronic device 1600 will load the instructions corresponding to the processes of one or more application programs into the memory 1602 according to the following steps, and the processor 1601 will run the application programs stored in the memory 1602 to implement various functions, such as:
[0126] Obtain a material partition map and a spliced normal map corresponding to the virtual model to be rendered. The spliced normal map is composed of multiple normal maps to be superimposed, and the material partition map is used to represent different materials in the virtual model by different colors;
[0127] Determine the material to be processed in the virtual model, and extract the target channel map corresponding to the material to be processed from the material partition map;
[0128] In response to the map selection operation, obtaining a target normal map corresponding to the target channel map from the concatenated normal map;
[0129] The virtual model is rendered using the target normal map corresponding to the target channel map.
[0130] In some optional embodiments, obtaining a spliced normal map of a virtual model to be rendered includes:
[0131] Obtain the number of multiple normal maps to be superimposed corresponding to the virtual model;
[0132] If the number of maps does not meet the preset splicing conditions, the corresponding template map is obtained, so that the template map and the normal map to be superimposed are spliced to obtain a square spliced normal map;
[0133] If the number of maps meets the preset stitching conditions, the normal maps to be superimposed are stitched into a square stitching normal map.
[0134] In some optional embodiments, in response to the map selection operation, obtaining a target normal map corresponding to the target channel map from the concatenated normal map includes:
[0135] In response to a tile selection operation on the tile control, determining a target variable value;
[0136] From the spliced normal map, determine the target region image corresponding to the target variable value;
[0137] By using the texture mapping relationship, the target area image is controlled to be tiled according to the target channel image, so as to obtain the target normal map corresponding to the target channel map.
[0138] In some optional embodiments, the target region image is controlled to be tiled according to the target channel map by using the texture mapping relationship to obtain a target normal map corresponding to the target channel map, including:
[0139] In response to a touch operation on the first adjustment control, determining a tiling density parameter;
[0140] In the process of controlling the target area image to perform a tiling operation according to the target channel map by using the texture mapping relationship, the density of the target area image is controlled according to the tiling density parameter.
[0141] In some optional embodiments, before rendering the virtual model using the target normal map corresponding to the target channel map, the method further includes:
[0142] Call the preset Frac node and use the Frac node to perform decimal processing on the UV value of the target normal map.
[0143] In some optional embodiments, before rendering the virtual model using the target normal map corresponding to the target channel map, the method further includes:
[0144] In response to a touch operation on the second adjustment control, a normal strength adjustment is performed on the target normal map.
[0145] In some optional embodiments, rendering the virtual model using a target normal map corresponding to the target channel map includes:
[0146] Get the initial normal map corresponding to the target channel map;
[0147] Performing normal texture superposition on the initial normal map corresponding to the target channel map and the target normal map to obtain a superimposed normal map;
[0148] The virtual model is rendered according to the superimposed normal map.
[0149] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0150] Optional, such as Fig.16 As shown, the electronic device 1600 further includes: a touch screen 1603, a radio frequency circuit 1604, an audio circuit 1605, an input unit 1606, and a power supply 1607. The processor 1601 is electrically connected to the touch screen 1603, the radio frequency circuit 1604, the audio circuit 1605, the input unit 1606, and the power supply 1607, respectively. Those skilled in the art can understand that Fig.16 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0151] The touch display screen 1603 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 1603 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-EmittingDiode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1601, and can receive the command sent by the processor 1601 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 1601 to determine the type of touch event, and then the processor 1601 provides a corresponding visual output on the display panel according to the type of touch event. In the embodiment of the present disclosure, the touch panel and the display panel can be integrated into the touch display screen 1603 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 1603 can also be used as a part of the input unit 1606 to realize the input function.
[0152] The radio frequency circuit 1604 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to send and receive signals with the network device or other electronic devices.
[0153] The audio circuit 1605 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 1605 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 1605 and converted into audio data, and then the audio data is output to the processor 1601 for processing, and then sent to another electronic device through the radio frequency circuit 1604, or the audio data is output to the memory 1602 for further processing. The audio circuit 1605 may also include an earplug jack to provide communication between an external headset and an electronic device.
[0154] The input unit 1606 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0155] The power supply 1607 is used to supply power to various components of the electronic device 1600. Optionally, the power supply 1607 can be logically connected to the processor 1601 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1607 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0156] although Fig.16 Not shown, the electronic device 1600 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0157] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0158] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0159] To this end, an embodiment of the present disclosure provides a computer-readable storage medium, in which a plurality of computer programs are stored. The computer program can be loaded by a processor to execute any virtual model rendering method provided in the embodiment of the present disclosure. The computer program can execute the following steps of the virtual model rendering method:
[0160] Obtaining a material partition map and a spliced normal map corresponding to the virtual model to be rendered, wherein the spliced normal map is composed of a plurality of normal maps to be superimposed, and the material partition map is used to represent different materials in the virtual model through different colors;
[0161] Determine the material to be processed in the virtual model, and extract the target channel map corresponding to the material to be processed from the material partition map;
[0162] In response to the map selection operation, obtaining a target normal map corresponding to the target channel map from the concatenated normal map;
[0163] The virtual model is rendered using the target normal map corresponding to the target channel map.
[0164] In some optional embodiments, obtaining a spliced normal map of a virtual model to be rendered includes:
[0165] Obtain the number of multiple normal maps to be superimposed corresponding to the virtual model;
[0166] If the number of maps does not meet the preset splicing conditions, the corresponding template map is obtained, so that the template map and the normal map to be superimposed are spliced to obtain a square spliced normal map;
[0167] If the number of maps meets the preset stitching conditions, the normal maps to be superimposed are stitched into a square stitching normal map.
[0168] In some optional embodiments, in response to the map selection operation, obtaining a target normal map corresponding to the target channel map from the concatenated normal map includes:
[0169] In response to a tile selection operation on the tile control, determining a target variable value;
[0170] From the spliced normal map, determine the target region image corresponding to the target variable value;
[0171] By using the texture mapping relationship, the target area image is controlled to be tiled according to the target channel image, so as to obtain the target normal map corresponding to the target channel map.
[0172] In some optional embodiments, the target region image is controlled to be tiled according to the target channel map by using the texture mapping relationship to obtain a target normal map corresponding to the target channel map, including:
[0173] In response to a touch operation on the first adjustment control, determining a tiling density parameter;
[0174] In the process of controlling the target area image to perform a tiling operation according to the target channel map by using the texture mapping relationship, the density of the target area image is controlled according to the tiling density parameter.
[0175] In some alternative embodiments, before rendering the virtual model with the target normal map corresponding to the target channel map, the method further includes:
[0176] Call a preset Frac node to perform a fractional part operation on the UV values of the target normal map through the Frac node.
[0177] In some alternative embodiments, before rendering the virtual model with the target normal map corresponding to the target channel map, the method further includes:
[0178] In response to a touch operation on the second adjustment control, adjust the normal intensity of the target normal map.
[0179] In some alternative embodiments, rendering the virtual model with the target normal map corresponding to the target channel map includes:
[0180] Obtain an initial normal map corresponding to the target channel map;
[0181] Perform normal texture overlay on the initial normal map corresponding to the target channel map and the target normal map to obtain an overlaid normal map;
[0182] Render the virtual model according to the overlaid normal map. For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.
[0183] Wherein, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
[0184] Since the computer program stored in the computer-readable storage medium can execute any virtual model rendering method provided by the embodiments of the present disclosure, the beneficial effects achievable by any virtual model rendering method provided by the embodiments of the present disclosure can be realized. For details, reference may be made to the previous embodiments, which will not be elaborated here.
[0185] According to one aspect of the present disclosure, there is also provided a computer program product or computer program. The computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the methods provided in the various alternative implementation manners in the above embodiments.
[0186] In the above-mentioned virtual model rendering device, computer-readable storage medium, electronic device, and computer program product embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the virtual model rendering device, computer-readable storage medium, computer program product, electronic device and its corresponding units described above can refer to the description of the virtual model rendering method in the above embodiment, and will not be repeated here.
[0187] The virtual model rendering method, device, electronic device, computer-readable storage medium and computer program product provided by the embodiments of the present disclosure are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method of the present disclosure and its core idea. At the same time, for technical personnel in this field, according to the ideas of the present disclosure, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present disclosure.
Claims
1. A virtual model rendering method, It is characterized in that The method comprises: Obtaining a material partition map and a spliced normal map corresponding to a virtual model to be rendered, wherein the spliced normal map is composed of a plurality of normal maps to be superimposed, and the material partition map is used to represent different materials in the virtual model by different colors; Determine a material to be processed in the virtual model, and extract a target channel map corresponding to the material to be processed from the material partition map; In response to a map selection operation, obtaining a target normal map corresponding to the target channel map from the concatenated normal map; The virtual model is rendered using a target normal map corresponding to the target channel map.
2. The virtual model rendering method according to claim 1, It is characterized in that Obtaining a spliced normal map of the virtual model to be rendered, comprising: Obtaining the number of multiple normal maps to be superimposed corresponding to the virtual model; If the number of the maps does not meet the preset splicing condition, a corresponding template map is obtained, so that a square spliced normal map is obtained after the template map and the normal map to be superimposed are spliced; If the number of the maps meets the preset splicing condition, the normal maps to be superimposed are spliced into a spliced normal map in the form of a square.
3. The virtual model rendering method according to claim 1, It is characterized in that The step of obtaining, in response to the map selection operation, a target normal map corresponding to the target channel map from the spliced normal map comprises: In response to a tile selection operation on the tile control, determining a target variable value; Determining a target region image corresponding to the target variable value from the spliced normal map; The target region image is controlled to be tiled according to the target channel image by using the texture mapping relationship, so as to obtain a target normal map corresponding to the target channel map.
4. The virtual model rendering method according to claim 3, It is characterized in that The method of utilizing the texture mapping relationship to control the target area image to be tiled according to the target channel map to obtain a target normal map corresponding to the target channel map includes: In response to a touch operation on the first adjustment control, determining a tiling density parameter; In the process of controlling the target area image to perform a tiling operation according to the target channel map by using the texture mapping relationship, the density of the target area image is controlled according to the tiling density parameter.
5. The virtual model rendering method according to claim 1, It is characterized in that Before rendering the virtual model using the target normal map corresponding to the target channel map, the method further includes: A preset Frac node is called, and a decimal processing is performed on the UV value of the target normal map through the Frac node.
6. The virtual model rendering method according to claim 1, It is characterized in that Before rendering the virtual model using the target normal map corresponding to the target channel map, the method further includes: In response to a touch operation on the second adjustment control, a normal strength adjustment is performed on the target normal map.
7. The virtual model rendering method according to claim 1, It is characterized in that The rendering of the virtual model by using the target normal map corresponding to the target channel map includes: Obtaining an initial normal map corresponding to the target channel map; Performing normal texture superposition on the initial normal map corresponding to the target channel map and the target normal map to obtain a superimposed normal map; The virtual model is rendered according to the superimposed normal map.
8. A virtual model rendering device, It is characterized in that The device comprises: A data acquisition unit, used to acquire a material partition map and a spliced normal map corresponding to a virtual model to be rendered, wherein the spliced normal map is composed of a plurality of normal maps to be superimposed, and the material partition map is used to represent different materials in the virtual model by different colors; A texture determination unit, used to determine the material to be processed in the virtual model, and extract a target channel texture corresponding to the material to be processed from the material partition texture; A response unit, configured to obtain a target normal map corresponding to the target channel map from the spliced normal map in response to a map selection operation; A rendering unit is used to render the virtual model through a target normal map corresponding to the target channel map.
9. An electronic device, It is characterized in that It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of the virtual model rendering method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the virtual model rendering method according to any one of claims 1 to 7.