A method, device, electronic device and storage medium for processing virtual characters
By adjusting the participation of normal maps and low-mode model normals, combined with the predetermined color map sampling results, the synthetic skin of virtual characters is rendered, solving the problem of difficult to balance computing power and skin presentation effects on mobile terminals, and achieving efficient skin rendering.
Patent Information
- Application Number
- CN202111577778.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2041-12-22
AI Technical Summary
The prior art is difficult to achieve a balance between computing power and virtual character skin presentation effects on mobile terminals, resulting in excessive calculation amount during skin rendering, affecting performance.
By obtaining the bright and dark areas of the skin of the virtual character under the action of the light source in the virtual scene, adjusting the participation of the normal map and the low-mode model normal, calculating the synthetic normal value, and rendering the character's low-mode model with the predetermined color map sampling results, realizing the synthetic skin rendering of the virtual character.
While ensuring the authenticity and clarity of the skin, the calculation amount during skin rendering is reduced, the problem of excessive consumption of mobile terminal performance is avoided, and the balance between computing power and skin presentation effect is achieved.
Smart Images

Figure CN114332316B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of game technology, and in particular to a method, device, electronic device and storage medium for processing a virtual character. Background Art
[0002] As the graphics computing and processing capabilities of the gaming industry continue to improve, the era of achieving images closer to reality has arrived. Among them, the expressiveness of character skins is constantly improving in various console games. The character skin rendering method can simulate the subsurface scattering of the skin, simulating the light source result that after the light reaches the skin, in addition to the light reflected and absorbed on the surface, a part of the light enters the skin and is scattered and then emitted from the skin. By superimposing colors on the light source, the skin can present different colors, such as a slightly reddish color, making the skin more realistic.
[0003] In the prior art, there are a variety of subsurface scattering rendering technologies in the field of games, such as the ability to achieve subsurface scattering effects through long-term rendering. For example, the traditional screen space blurring solution can obtain the result of light scattering in the epidermis by performing multiple Gaussian blurs on the texture, but this solution requires a lot of computing power, which puts a lot of pressure on the rendering of virtual characters, and the requirements for hardware performance are getting higher and higher, making it difficult to apply to mobile terminals; if in order to be able to be applied to mobile terminals, reducing computing power and reducing skin display accuracy will affect the skin texture, making the gaming experience poor. Therefore, it is currently difficult to achieve a balance between computing power and skin rendering effects. Summary of the invention
[0004] In view of this, the purpose of this application is to provide a method, device, electronic device and storage medium for processing a virtual character to solve the technical problem of finding a balance between computing power and skin presentation effects.
[0005] In a first aspect, an embodiment of the present application provides a method for processing a virtual character, which is applied to a mobile terminal. The processing method includes:
[0006] Obtaining bright skin areas and dark skin areas of the target virtual character under the effect of light sources in the current virtual scene;
[0007] Determine, according to the brightness of the character skin of the target virtual character in the bright area of the skin and the dark area of the skin, a first weight of a normal map derived from a high-poly model of the character when synthesizing the character skin and a second weight of a low-poly model normal of a low-poly model of the character when synthesizing the character skin; wherein the normal map carries the high-poly model normal of the high-poly model of the character in the tangent space where the low-poly model of the character is located, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character skin;
[0008] For each low-poly model normal, according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character skin and a second weight of the low-poly model normal when synthesizing the character skin, calculate a synthesized normal value corresponding to the low-poly model normal;
[0009] The character low-poly model is rendered using the synthesized normal value and a predetermined color map sampling result to obtain a synthesized skin of the target virtual character, and the target virtual character including the synthesized skin is displayed on a graphical user interface.
[0010] In an optional embodiment of the present application, for the bright skin area, the first weight is positively correlated with the brightness, and the second weight is negatively correlated with the brightness; for the dark skin area, neither the first weight nor the second weight changes with the brightness.
[0011] In an optional embodiment of the present application, the bright skin area is an area within a first angle range corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene; the dark skin area is an area within a second angle range corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene; wherein any angle within the first angle range is smaller than any angle within the second angle range.
[0012] In an optional embodiment of the present application, when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a first angle range, the value of the first weight and the value of the second weight are both determined based on the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, wherein the value of the first weight is positively correlated with the dot product result, and the value of the second weight is negatively correlated with the dot product result; when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a second angle range, the value of the first weight and the value of the second weight remain unchanged.
[0013] In an optional embodiment of the present application, when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a first angle range, the value of the first weight is the dot product of the direction of the low-poly model normal and the direction of the light source in the virtual scene, and the value of the second weight is the difference between 1 and the value of the first weight; when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a second angle range, the value of the first weight is 0 and the value of the second weight is 1.
[0014] In an optional embodiment of the present application, for each low-poly model normal, according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character skin and a second weight of the low-poly model normal when synthesizing the character skin, the step of calculating a synthesized normal value corresponding to the low-poly model normal includes:
[0015] For each low-poly model normal, a high-poly model normal in a normal map corresponding to the position of the low-poly model normal is multiplied by a first weight of the high-poly model normal when synthesizing the character skin, to obtain a first normal to be synthesized of the high-poly model normal;
[0016] Performing a product process on the low-poly model normal and a second weight of the low-poly model normal when synthesizing the character skin, to obtain a second normal to be synthesized of the low-poly model normal;
[0017] The first normal to be synthesized and the second normal to be synthesized are summed to obtain a synthesized normal value corresponding to the low-poly model normal.
[0018] In an optional embodiment of the present application, the color map sampling result is predetermined by the following steps:
[0019] According to the brightness of the target virtual character's skin in the bright skin area and the dark skin area, the color map of the target virtual character is sampled to obtain a color map sampling result; wherein the accuracy of sampling the color map is positively correlated with the brightness.
[0020] In an optional embodiment of the present application, the step of sampling the color map of the target virtual character according to the brightness of the character skin of the target virtual character in the bright skin area and the dark skin area to obtain the color map sampling result includes:
[0021] According to the dot product result between the direction of the normal of the low-poly model and the direction of the light source in the virtual scene, the color map of the target virtual character is sampled to obtain a color map sampling result corresponding to the dot product result; wherein the dot product result is used to determine the resolution of the color map, and the dot product result is positively correlated with the resolution of the color map.
[0022] In an optional embodiment of the present application, the color map sampling result is also predetermined by the following steps:
[0023] According to the acquired first distance between the target virtual character currently in the virtual scene and the camera in the virtual scene, the color map of the target virtual character is sampled to obtain a color map sampling result; wherein the accuracy of sampling the color map is negatively correlated with the first distance.
[0024] In a second aspect, an embodiment of the present application further provides a virtual character skin processing device, which is applied to a mobile terminal, and the processing device includes:
[0025] A light and dark area acquisition module is used to acquire the bright skin area and the dark skin area of the target virtual character under the light source in the current virtual scene;
[0026] A weight determination module, for determining, according to the brightness of the character skin of the target virtual character in the bright area of the skin and the dark area of the skin, a first weight of a normal map derived from a character high-poly model when synthesizing the character skin and a second weight of a low-poly model normal of a character low-poly model when synthesizing the character skin; wherein the normal map carries the high-poly model normal of the character high-poly model in the tangent space where the character low-poly model is located, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character skin;
[0027] A normal synthesis module, for calculating, for each low-poly model normal, a synthesized normal value corresponding to the low-poly model normal according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character skin and a second weight of the low-poly model normal when synthesizing the character skin;
[0028] The skin synthesis module is used to render the character low-poly model using the synthesized normal value and a predetermined color map sampling result to obtain the synthesized skin of the target virtual character, and display the target virtual character including the synthesized skin on a graphical user interface.
[0029] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the virtual character processing method as described above.
[0030] In a fourth aspect, an embodiment of the present application further 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 method for processing a virtual character as described above are executed.
[0031] The embodiments of the present application provide a method, device, electronic device and storage medium for processing a virtual character, which obtains the bright skin area and the dark skin area of the target virtual character under the action of the light source in the current virtual scene. For the bright skin area, the skin details of the character's skin should be more to make the skin more realistic. For the dark skin area, the skin details of the character's skin should be less. At this time, due to the dim light, there is no need to show too many skin details to reduce the computing power of the mobile terminal. Then, according to the brightness of the character skin of the target virtual character in the bright skin area and the dark skin area, the first weight of the normal map derived from the character's high-poly model when synthesizing the character's skin and the character's The second weight of the low-poly model normal of the low-poly model when synthesizing the character's skin; wherein the normal map carries the high-poly model normal of the character's high-poly model in the tangent space where the character's low-poly model is located, the high-poly model normal can show more skin details, while the low-poly model normal does not carry any skin details, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character's skin, so that in bright skin areas, the first weight has a greater participation in synthesizing the character's skin, and the virtual character shows more skin details, while in dark skin areas, the second weight has a greater participation in synthesizing the character's skin, and the virtual character shows fewer skin details. Under such conditions, for each low-poly model normal, the synthesized normal value corresponding to the low-poly model normal is calculated based on the first weight of the high-poly model normal in the normal map corresponding to the position of the low-poly model normal when synthesizing the character skin and the second weight of the low-poly model normal when synthesizing the character skin; the character low-poly model is rendered using the synthesized normal value and a predetermined color map sampling result to obtain the synthesized skin of the target virtual character, and the target virtual character including the synthesized skin is displayed on a graphical user interface.
[0032] Compared with the prior art, which is difficult to achieve a balance between computing power and skin rendering effects, the embodiments of the present application can adjust the skin details displayed by the virtual character according to the different brightness of the bright skin area and the dark skin area formed by the light source irradiating the virtual character. Specifically, the participation of the high-poly model normal and the low-poly model normal in the normal map involved in the calculation is adjusted according to the different brightness of the bright skin area and the dark skin area, so as to achieve a balance between the computing power of the mobile terminal and the skin rendering effect, thereby reducing the amount of calculation during skin rendering while ensuring the skin is real and clear, and avoiding the problem of excessive performance consumption of the mobile terminal.
[0033] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] 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.
[0035] Figure 1 A schematic diagram of a virtual character processing system provided in an embodiment of the present application;
[0036] Figure 2 A flowchart of a method for processing a virtual character provided in an embodiment of the present application;
[0037] Figure 3 A schematic diagram of a character skin before and after improvement provided in an embodiment of the present application;
[0038] Figure 4 A schematic diagram of the structure of a virtual character processing device provided in an embodiment of the present application;
[0039] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme 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 only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0041] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0042] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0043] It should be understood that in the embodiments of the present application, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0044] As the graphics computing and processing capabilities of the gaming industry continue to improve, the era of achieving images closer to reality has arrived. Among them, the expressiveness of character skins is constantly improving in various console games. The character skin rendering method can simulate the subsurface scattering of the skin, simulating the light source result that after the light reaches the skin, in addition to the light reflected and absorbed on the surface, a part of the light enters the skin and is scattered and then emitted from the skin. By superimposing colors on the light source, the skin can present different colors, such as a slightly reddish color, making the skin more realistic.
[0045] In the existing skin rendering, in order to improve the realism of the skin, there are a variety of subsurface scattering rendering technologies in the game field, such as the subsurface scattering effect can be achieved by long-term rendering. For example, the traditional screen space blurring solution can obtain the result of light scattering in the epidermis by performing multiple Gaussian blurs on the map, but this solution requires more computing power, which brings greater pressure to the rendering of virtual characters, and the requirements for hardware performance are getting higher and higher, but it is difficult to apply in mobile terminals. In addition, multiple first index value sets can be obtained through the direction of the light source and the normal direction of each pixel point in the skin part of the model, and the light and dark intensity corresponding to each index value in the first index value set is determined according to the mapping relationship between the first map containing the light and dark intensity gradient and the preset index value, and multiple light and dark intensity value sets are obtained, and each light and dark intensity value set is superimposed with its corresponding color to obtain multiple light source value sets, and the multiple light source value sets are fused, and the fused results are applied to the skin of the model. Therefore, the above method can simulate the subsurface scattering of the skin, simulating that after the light reaches the skin, in addition to the light reflected and absorbed on the surface, a part of the light enters the skin and is scattered and then emitted from the skin, making the skin close to the real light source performance, and by superimposing colors on the light source, the skin presents different colors, such as a slightly reddish color, making the skin color more realistic. This method requires simulating the results of subsurface scattering of multiple layers of reflection, so that each layer of reflection has different light and dark effects, but this method undoubtedly increases the amount of calculation. Although the skin texture is real, it has extremely high requirements on terminal processing performance and is difficult to apply in mobile terminals.
[0046] At present, in games or various simulation software, the performance of character skin materials has always been affected by performance, especially on mobile phones or virtual simulation devices. In the existing technical solutions, mobile terminals generally use pre-integration methods for skin rendering. For example, a scattering picture of the object to be rendered is obtained, and the scattering picture is used to represent the corresponding relationship between curvature and color band, wherein the curvature is represented by the dot product result between the light source direction in the virtual scene and the normal direction of the skin surface, the color band is represented by the light transmittance of the skin, and the normal direction of the skin surface is used to represent the normal direction of each pixel on the skin in the world space coordinate system. The scattering picture is sampled to obtain the pre-integration map sampling result; the obtained pre-integration map sampling result is multiplied by the skin basic color map to obtain the light source result, and the light source result is used to represent the final rendering result of the skin. Although the above technical solution has a small amount of calculation and saves calculation overhead, the texture of the character skin shown in this way is relatively dry, similar to the texture of Tang Sancai, and its ruddy feeling still stays on the surface of the model, lacking the translucent feeling that real skin should have. Furthermore, in order to be applied in mobile terminals, the existing technical solutions need to reduce computing power, but reducing computing power will reduce the skin display accuracy and affect the skin texture, resulting in a poor gaming experience.
[0047] In this way, how to maintain a balance between the computing power of mobile terminals and the skin presentation effect is a technical problem that needs to be solved urgently.
[0048] Based on this, the embodiments of the present application provide a method, device, electronic device and storage medium for processing a virtual character to solve the technical problem of finding a balance between computing power and skin rendering effects, while reducing computing power without affecting the transparency and realism of the skin.
[0049] In an embodiment of the present application, in real-time game data using a small number of faces, in order to achieve more realistic and faster real-time rendering, a normal map is required. Normal map refers to the use of RGB color to express the normal vector of the high-poly model of the character's high-poly model as a texture (Texture), outlining the directionality of the light source (Light), and expressing bumps and somatosensory shadows through the direction of light to synthesize the character skin of the virtual character. Normal maps can be used when calculating the direction of light and shadows and environmental maps. By using normal maps, complex and delicate material effects can be enhanced, or in the expression of bumps and bumps with delicate details such as bumps and skin wrinkles, even if there are no high-poly resources, maps can be used to provide great help in achieving simple and fast rendering.
[0050] The virtual character processing method provided in the embodiment of the present application can be executed in the virtual character processing system. Figure 1is a structural diagram of a virtual character processing system provided in an embodiment of the present application, such as Figure 1 As shown, the processing system 1 includes: a graphics processing unit (GPU) 10 and a display 20. The graphics processor 10 is an image processing device for processing image transformation and light source after receiving data. The graphics processor 10 includes: a model data processing module 101, a light source information preprocessing module 102, a mixing module 103, a map data processing module 104, and a light source processing module 105.
[0051] The model data processing module 101 is used to collect data of the input character low-poly model, including the low-poly model normal information and low-poly model UV information of the character low-poly model. The low-poly model normal information is used to be input to the light source information preprocessing module 102 for processing, and the UV information is used to be input to the texture data processing module 104 for processing.
[0052] It should be noted that the character low-poly model refers to a low-precision model with a simple structure, few faces, and few details. The low-poly model normal information refers to the vertex normal information of the character low-poly model, which does not contain any details; UV information is the abbreviation of u, v texture mapping coordinates, which defines the position information of each point on the image.
[0053] The light source information preprocessing module 102 performs dot product processing on the low-poly model normal direction and the light source direction in the virtual scene according to the low-poly model normal information output by the model data processing module 101, and outputs the dot product result, and uses the dot product result as the light source information preprocessing result. Exemplarily, the light source information preprocessing result is any value in the set [1, -1]. At the same time, the obtained light source information preprocessing result is input into the mixing module 103.
[0054] The mixing module 103 is used to remap the light source information preprocessing result, and return a weight for the color map and the normal map respectively. Among them, the weight for the color map is to remap the light source information preprocessing result from the set [1, -1] to the set [0, 2]. For the mixing weight of the normal map, the light source information preprocessing result is remapped from the set [1, -1] to the set [1, 0]. Here, the set [0, -1] in the set [1, -1] is mapped to 0.
[0055] The texture data processing module 104 is used to sample the input texture (including color map and normal map) to obtain sampling results, and in the sampling process, intervene in the sampling results according to the remapping results of the light source information preprocessing results of the mixing module. Then, the texture data processing module 104 will use the low-poly model UV information to sample the scattering image to obtain the skin transparency of each part of the skin surface.
[0056] The sampling process of the color map by the texture data processing module 104 is as follows: the sampling of the color map is based on the remapping result of the low-poly model UV information generated by the model data processing module 101 and the light source information preprocessing result generated by the mixing module 103. The color map is sampled based on the above information. The low-poly model UV information is used to locate the specific position in the color map, so as to obtain the color value of the corresponding position on the color map. Based on the remapping result of the light source information preprocessing result generated by the mixing module, the level of the color map to be used is determined according to the distance between the virtual character and the camera in the virtual scene and the size of the light and dark area formed by the virtual character under the action of the light source in the virtual scene. In which, color maps of different levels and sizes are prepared in advance. For example, the levels may include 1024*1024 level, 512*512 level, 256*256 level, 200*200 level, etc.
[0057] Furthermore, the sampling process of the normal map by the texture data processing module 104 is as follows: the sampling basis of the normal map is the low-poly model normal information generated by the model data processing module 101, and the RGB value (range is [0, 1]) of the collected normal map color is remapped to the set [-1, 1] as the normal direction of the character's high-poly model in the low-poly model tangent space; then the remapping result of the light source information preprocessing result generated by the mixing module 103 is used to perform linear interpolation on the normal direction and vector (0, 0, 1) of the character's high-poly model in the low-poly model tangent space, and the result is converted from the low-poly model tangent space to the world space through the space transformation matrix, and the result is used as the final synthetic normal information participating in the light source calculation.
[0058] It should be noted that the character high-poly model refers to a high-precision model with complex structure, many faces and rich details. The high-poly model itself has a lot of precision and details. The model performance mainly depends on the modeling itself, but the high-performance effect of the high-poly model is often accompanied by a greater operating burden. The tangent space is composed of the tangent, bitangent and normal direction of each vertex on the character's low-poly model. The Cartesian coordinate system composed of this XYZ axis is called the tangent space of the current position.
[0059] Finally, the light source processing module 105 first uses the synthetic normal information generated in the texture data processing module 104 to perform a dot product with the light source direction in the virtual scene, remaps the dot product result from the set [1, -1] to the set [1, 0], and uses the remapped result as the horizontal axis basis for pre-integration map sampling; uses the skin transparency generated in the texture data processing module 104 as the vertical axis basis for pre-integration map sampling; uses these two to sample the pre-integration map to obtain the pre-integration light source result of the skin; and multiplies the pre-integration light source result with the skin color value and the scene light color obtained in the texture data processing module 104 to obtain the character skin processing result output by the light source processing module 105.
[0060] In the above operating environment, Figure 2 The flowchart of a method for processing a virtual character provided in an embodiment of the present application is shown in FIG. The method for processing a virtual character provided in an embodiment of the present application is applied to a mobile terminal, such as Figure 2 As shown in , the processing method includes:
[0061] S210, obtaining a bright skin area and a dark skin area of the target virtual character under the light source in the current virtual scene;
[0062] S220, determining, according to the brightness of the character skin of the target virtual character in the bright skin area and the dark skin area, a first weight of the normal map derived from the character's high-poly model when synthesizing the character skin and a second weight of the low-poly model normal of the character's low-poly model when synthesizing the character skin; wherein the normal map carries the high-poly model normal of the character's high-poly model in the tangent space where the character's low-poly model is located, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character skin;
[0063] S230, for each low-poly model normal, according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character's skin and a second weight of the low-poly model normal when synthesizing the character's skin, calculating a synthesized normal value corresponding to the low-poly model normal;
[0064] S240, rendering the character low-poly model using the synthesized normal value and the predetermined color map sampling result to obtain the synthesized skin of the target virtual character, and displaying the target virtual character including the synthesized skin on a graphical user interface.
[0065] First, the names involved in the embodiments of the present application are briefly introduced.
[0066] In the embodiment of the present application, a graphical user interface may be provided by a mobile terminal, in which at least part of a virtual scene is displayed, and the virtual scene includes at least one virtual character, and the virtual character is controlled by a player, wherein:
[0067] Mobile terminals mainly refer to smart devices that are used to provide virtual scenes and can control virtual characters. Terminal devices may include but are not limited to any of the following devices: smart phones, notebooks, tablet computers, dynamic image expert compression standard audio layer 4 (player), game consoles, personal digital assistants (PDAs), e-book readers, etc. The mobile terminal has installed and runs an application that supports virtual scenes of games, such as an application that supports three-dimensional virtual scenes. The application may include but is not limited to any of virtual reality applications, three-dimensional map programs, military simulation programs, MOBA games, multiplayer gun battle survival games, and third-person shooter games (TPS, Third-Personal three-person shooter games (scene applications). Optionally, the application can be a stand-alone application, such as a stand-alone 3D game program, or it can be a network-connected application.
[0068] A graphical user interface is an interface display format for communication between people and mobile terminals. It allows users to manipulate icons, logos or menu options on the screen using input devices such as a mouse or keyboard, and also allows users to manipulate icons or menu options on the screen by performing touch operations on the touch screen of a touch terminal to select commands, start programs or perform other tasks.
[0069] The virtual scene is the scene displayed (or provided) when the application is running on a mobile terminal or server, that is, the scene used in the normal game process. In other words, the virtual scene refers to the virtual game control that carries the virtual character during the game process. The virtual character can be controlled by the operation instructions issued by the user (i.e., the player) to the mobile terminal in the virtual scene to perform actions such as movement and skill release. Optionally, the virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene. The game environment can be the sky, land, ocean, etc., wherein the land includes environmental elements such as deserts and cities. Among them, the virtual scene is a scene in which the user controls the complete game logic of the virtual character. Optionally, the virtual scene can also be used for scene battles between at least two virtual characters, and there are virtual resources available for at least two virtual characters in the virtual scene. Exemplarily, the virtual scene can include any one or more of the following elements: game background elements, game virtual character elements, game prop elements, etc.
[0070] A virtual character refers to an movable object in a virtual environment, and the movable object may be at least one of a virtual person, a virtual animal, and a cartoon character. Optionally, when the virtual environment is a three-dimensional virtual environment, the virtual character may be a three-dimensional virtual model, and each virtual character has its own shape and volume in the three-dimensional virtual environment, and occupies a part of the space in the three-dimensional virtual environment. Optionally, the virtual character is a three-dimensional character constructed based on three-dimensional human skeleton technology, and the virtual character achieves different external images by wearing different skins. In some implementations, the virtual character may also be implemented using a 2.5-dimensional or 2-dimensional model, which is not limited in the embodiments of the present application.
[0071] There may be multiple virtual characters in a virtual scene, which are virtual characters controlled by players (i.e., characters controlled by players through input devices), or artificial intelligence (AI) set in a virtual environment battle through training, or non-player characters (NPC) set in a virtual scene battle. Optionally, the virtual character may be a virtual person competing in a virtual scene. Optionally, the number of virtual characters in the virtual scene battle is preset, or is dynamically determined according to the number of clients joining the battle, and the embodiment of the present application does not limit this. In a possible implementation, the user can control the virtual character to move in the virtual scene, for example, control the virtual character to run, jump, crawl, etc., and can also control the virtual character to fight with other virtual characters using skills, virtual props, etc. provided by the application.
[0072] In one embodiment of the present application, the processing method of the virtual character can be run on a mobile terminal or a server. The mobile terminal can be a local terminal device. When the processing method of the virtual character is run on a server, the processing method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a mobile terminal.
[0073] In an optional embodiment, various cloud applications, such as cloud games, can be run under the cloud interaction system. 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 operating body of the game program and the main body of the game screen presentation are separated, the storage and operation of the processing method are completed on the cloud game server, and the role of the mobile terminal is used for receiving and sending data and presenting the game screen. For example, the mobile terminal can be a display device with data transmission function close to the user side, such as a smart phone, notebook, tablet computer, game console, etc.; but the device for information processing is a cloud game server in the cloud. When playing the game, the player operates the mobile terminal 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 the game screen and other data, and returns it to the client device through the network. Finally, the mobile terminal decodes and outputs the game screen.
[0074] In an optional embodiment, the mobile terminal may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0075] As a specific embodiment, the embodiment of the present application can be applied to the game engine Unity. Unity is a real-time 3D interactive content creation and operation platform that enables all creators, including game development, art, architecture, automotive design, and film and television, to turn their ideas into reality with the help of Unity, such as realizing three-dimensional games, architectural visualization, and real-time three-dimensional animation. It is a fully integrated professional game engine. Through the character skin system in Unity, the skin material of the virtual character in the virtual scene can be efficiently set, which is an indispensable and important tool in the production of virtual scenes.
[0076] The shader in Unity is a code snippet that is used to express the effect of light on the surface of the character's low-poly model and runs on the graphics card. In practical applications, the desired skin texture can be achieved in the virtual scene by writing a shader. Exemplarily, for the skin of a virtual character, the actual skin texture can be abstracted into different parameters, and then the shader uses the parameters to render the character's low-poly model in the virtual scene, thereby achieving the corresponding skin texture in the virtual scene. Specifically, the parameters may include skin color and skin details (such as acne marks, textures), etc., wherein the skin color is used to express the color distribution of the skin, and the skin details are used to express the detail distribution of the skin surface. In Unity, the skin color can be recorded by a color map, and the skin details can be recorded by a normal map. Among them, the normal map is a special texture that can be applied to a 3D surface, so that each pixel of each plane of the character's low-poly model has more skin detail information, and can create more three-dimensional visual effects on the surface of the character's low-poly model. Specifically, the normal map can record the difference in surface normal direction between the character's low-poly model and the character's high-poly model. The post-production shader uses the normal map to process the reflection direction of light, giving the viewer an illusion, thereby increasing the details of the surface of the character's low-poly model.
[0077] Furthermore, the processing of the character skin in the embodiment of the present application can be completed in the Universal Forward Pass in the Unity URP pipeline, which is consistent with the traditional object drawing order. After all the material balls drawn using the Universal Forward Pass in the virtual scene are drawn, the URP rendering pipeline will output a result image, which is called Camera OpaqueTexture in this embodiment. Taking into account compatibility issues, a new Pass dedicated to drawing skin is added to the pipeline, which is named: SkinHD in this embodiment. Get the Camera OpaqueTexture in the SkinHD Pass, and blur the skin part of this image in screen space to make the rendered skin more realistic and transparent. In this way, blurring the skin diffuse reflection calculation results in screen space can more accurately simulate the contribution of subsurface scattering to the skin surface color.
[0078] The following takes the application of the above method to a server as an example to illustrate the above exemplary steps provided in the embodiment of the present application.
[0079] In step S210, the bright skin area and the dark skin area of the target virtual character under the light source in the current virtual scene are obtained.
[0080] In this step, the bright skin area and the dark skin area of the target virtual character under the light source in the current virtual scene can be obtained in real time during the game. The target virtual character can be any virtual person or virtual animal in the current virtual scene.
[0081] Here, since the light source in the virtual scene and the position of the virtual character in the virtual scene are constantly changing, the bright skin area and the dark skin area on the target virtual character acted by the light source in the current virtual scene will also change accordingly. Different areas have different requirements for the displayed skin details. Therefore, the embodiment of the present application needs to obtain the relevant data about the bright skin area and the dark skin area in the virtual scene in real time to update the presentation effect of the virtual character skin in real time during the game.
[0082] In one embodiment, from a third-person perspective, the target virtual character will form a light-dark boundary line under the light source in the current virtual scene, with one side of the light-dark boundary line being a bright skin area, and the other side of the light-dark boundary line being a dark skin area. The closer the bright skin area is to the light-dark boundary line, the lower the brightness, and the closer the dark skin area is to the light-dark boundary line, the higher the brightness. For players, the lower the brightness, the fewer skin details the virtual character can present.
[0083] Specifically, the bright skin area is the area corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene within the first angle range; the dark skin area is the area corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene within the second angle range; wherein any angle within the first angle range is smaller than any angle within the second angle range.
[0084] Here, the brightness area to which the skin belongs is determined by the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene. The low-poly model normal refers to the normal direction of each point on the surface of the character's low-poly model, and the normal direction here is saved in the form of a vector. Exemplarily, assuming that point P is an arbitrary point on the surface of the character's low-poly model, including the case where point P is a vertex, the normal direction of point P is obtained by interpolating and mixing the normal directions of the three vertices of the triangle where the point is located, and is mainly determined based on the distance relationship between point P and the three vertices. Here, the normal direction of point P can be called the low-poly model normal.
[0085] It should be noted that the normal direction of point P is obtained by interpolating and mixing the normal directions of the three vertices of the triangle where the point is located. Since there are fewer vertices in the character's low-poly model and the normal directions of the vertices do not carry skin details, the normal direction of point P obtained by interpolating and mixing the normal directions of these three vertices does not carry skin details either, that is, the normal of the low-poly model does not carry skin details.
[0086] In order to make the objects in the virtual scene more realistic, it is usually necessary to project a light source in the virtual scene. The light source can be a point light source or a parallel light source. Exemplarily, the light source properties of each light source set in the virtual scene can be edited in advance, and then the number of light sources can be limited, such as at most 3 light sources can be valid at the same time, among which the directional light source must participate in the dynamic light source calculation, followed by the point light source in the special effects, and finally the point light source in the virtual scene. In this way, the effect of the dynamic light source can be achieved under the limited performance of the mobile terminal while ensuring the performance of the mobile terminal. In this way, by adding an editable on / off real-time light source calculation to the light source, and then in the game mode in the engine, the light source type and this property value of the light source are passed in to realize the real-time light source calculation of limited dynamic light sources.
[0087] In the embodiment of the present application, the areas corresponding to the first angle range are all bright skin areas, and the areas corresponding to the second angle range are all dark skin areas. Any angle in the first angle range is smaller than any angle in the second angle range. For example, the first angle range is between 0 and 90 degrees, and the second angle range is between 90 and 180 degrees. When the angle between the normal direction of the first area on the surface of the character low-poly model and the direction of the light source in the virtual scene is 0 degrees, the light source at this time is facing the first area, and at this time, the first area shows the most skin details. When the angle between the normal direction of the second area on the surface of the character low-poly model and the direction of the light source in the virtual scene is 90 degrees, the light source at this time is facing the second area, and at this time, the outgoing light of the second area mostly comes from the incident light of other areas and is emitted from the second area after being scattered by the subcutaneous tissue, and such outgoing light will not have too many skin surface details. Among them, the first area and the second area are any area on the surface of the character low-poly model. The normal direction of the first area and the normal direction of the second area are determined by the normal direction of the center point of the first area and the second area, respectively.
[0088] It should be noted that as long as the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is between 90 degrees and 180 degrees, the light source will cause the virtual character to have a shadow area, and the skin details in the shadow area do not need to be displayed.
[0089] In step S220, according to the brightness of the character skin of the target virtual character in the bright skin area and the dark skin area, the first weight of the normal map derived from the character's high-poly model when synthesizing the character's skin and the second weight of the low-poly model normal of the character's low-poly model when synthesizing the character's skin are determined; wherein the normal map carries the high-poly model normal of the character's high-poly model in the tangent space where the character's low-poly model is located, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character's skin.
[0090] In this step, when rendering the skin of a virtual character, it is necessary to use the character's high-poly model to export a normal map, and then paste the exported normal map on the character's low-poly model, which can also make the character's skin appear more detailed, thereby greatly improving efficiency. Among them, the normal map exported from the character's high-poly model carries at least part of the high-poly model normals of the character's high-poly model in the tangent space where the character's low-poly model is located.
[0091] Here, the low-poly model normal refers to the normal direction of each point on the surface of the character's low-poly model, and the normal direction of the point is obtained by interpolating and mixing the normal directions of the three vertices of the triangle where the point is located; the high-poly model normal refers to the normal direction of each point on the surface of the character's high-poly model, and the normal direction of the point is obtained by interpolating and mixing the normal directions of the three vertices of the triangle where the point is located; among them, the number of vertices of the character's high-poly model is much larger than the number of vertices of the character's low-poly model.
[0092] Among them, since the number of vertices in the character's low-poly model is small and the normal direction of the vertex does not carry skin details, the normal direction of any point obtained by interpolating and blending the normal directions of the three vertices in the character's low-poly model does not carry skin details, that is, the low-poly model normal does not carry skin details. Since the number of vertices in the character's high-poly model is large and the normal direction of each vertex carries skin details, the normal direction of any point obtained by interpolating and blending the normal directions of the three vertices in the character's high-poly model also carries skin details, that is, the high-poly model normal carries skin details.
[0093] In an embodiment of the present application, the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character's skin; the character skin of the target virtual character has different brightness in the bright skin area and the dark skin area, and the first weight of the normal map when synthesizing the character's skin and the second weight of the low-poly model normal when synthesizing the character's skin are also different.
[0094] In a preferred embodiment, when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a first angle range, the value of the first weight and the value of the second weight are both determined based on the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, wherein the value of the first weight is positively correlated with the dot product result, and the value of the second weight is negatively correlated with the dot product result; when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a second angle range, the value of the first weight and the value of the second weight remain unchanged.
[0095] Exemplarily, when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within the first angle range, the value of the first weight is the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, and the value of the second weight is the difference between 1 and the value of the second weight; when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within the second angle range, the value of the first weight is 0 and the value of the second weight is 1. In addition, the first weight can be assigned a value according to the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene and the change rule of the value of the first weight in the virtual scene, and at the same time, the sum of the value of the first weight and the value of the second weight remains unchanged.
[0096] As a preferred embodiment of the present application, for bright skin areas, the first weight is positively correlated with brightness, and the second weight is negatively correlated with brightness; for dark skin areas, neither the first weight nor the second weight changes with brightness.
[0097] First, for the bright skin area, the first weight is positively correlated with the brightness, and the second weight is negatively correlated with the brightness. In one embodiment, the brightness of the character's skin in the virtual scene is determined by the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, and the calculated dot product result is divided according to a predetermined order of magnitude, and the corresponding relationship between each dot product result after division and the brightness is found. Here, the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene also corresponds to the value range of the first weight and the second weight. Exemplarily, the first angle range corresponding to the bright skin area is between 0 and 90 degrees, and the dot product result at this time is between 1 and 0. According to the positive correlation between the first weight and the brightness, and the negative correlation between the second weight and the brightness, when the brightness of the character's skin changes from large to small, the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene changes from small to large, then the value of the first weight changes from large to small, and the value of the second weight changes from small to large. For example, when the angle between the direction of the light source in the virtual scene and the direction of the normal of the low-poly model is 30 degrees due to the light source acting on the target virtual character, the value of the first weight is 0.87 and the value of the second weight is 0.13; when the angle between the direction of the light source in the virtual scene and the direction of the normal of the low-poly model is 45 degrees, the value of the first weight is 0.71 and the value of the second weight is 0.29; when the angle between the direction of the light source in the virtual scene and the direction of the normal of the low-poly model is 60 degrees, the value of the first weight is 0.5 and the value of the second weight is 0.5.
[0098] In addition, the dot product result can be divided into multiple intervals, such as 1, (1, 0.9], [0.9, 0.8], [0.8, 0.7], [0.7, 0.6], [0.6, 0.5], [0.5, 0.4], [0.4, 0.3], [0.3, 0.2], [0.2, 0.1], [0.1, 0), 0, and the calibration angle range corresponding to each interval is determined. The angle between the direction of the low-poly model normal corresponding to 1 and the direction of the light source in the virtual scene is 0 degrees. At this time, the light source is facing the target virtual character, the brightness is maximum, and the skin details are displayed the most; the direction of the low-poly model normal corresponding to 0 is opposite to the direction of the virtual scene. The angle between the light source directions in is 90 degrees. At this time, the light source is facing the target virtual character, the brightness is small, and there is no need to show skin details. The first weight value and the second weight value are assigned to each interval in advance. For example, the first weight value corresponding to 1 (angle is 0 degrees) is 1, and the corresponding second weight value is 0; the first weight value corresponding to [1,0.9] is 0.95, and the corresponding second weight value is 0.05; the first weight value corresponding to [0.9,0.8] is 0.85, and the corresponding second weight value is 0.15; the first weight value corresponding to [0.8,0.7] is 0.75, and the corresponding second weight value is 0.25 ; The first weight value corresponding to [0.7,0.6] is 0.65, and the corresponding second weight value is 0.35; The first weight value corresponding to [0.6,0.5] is 0.55, and the corresponding second weight value is 0.45; The first weight value corresponding to [0.5,0.4] is 0.45, and the corresponding second weight value is 0.55; The first weight value corresponding to [0.4,0.3] is 0.35, and the corresponding second weight value is 0.65; The first weight value corresponding to [0.3,0.2] is 0.25, and the corresponding second weight value is 0.75; The first weight value corresponding to [0.2,0.1] is 0.15, the corresponding second weight value is 0.85; [0.1,0] corresponds to a first weight value of 0.05, and a second weight value of 0.95; 0 (angle is 90 degrees) corresponds to a first weight value of 0, and a second weight value of 1. In this way, the current angle between the light source direction in the current virtual scene and the direction of the low-poly model normal caused by the light source acting on the target virtual character is determined, the dot product result is calculated according to the current angle, the target interval corresponding to the current angle is found, and the current first weight value and the current second weight value are determined according to the first weight value and the second weight value pre-set for the target interval.
[0099] Second, for dark skin areas, the first weight and the second weight do not change with brightness. That is to say, for dark skin areas, there is no need to show skin details, so regardless of whether the brightness of the character's skin in the virtual scene changes, the first weight and the second weight do not change. Exemplarily, when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is between 90 degrees and 180 degrees, the value of the first weight is always 0, and the value of the second weight is always 1.
[0100] The above steps adjust the normals involved in the integral calculation according to the light and dark areas formed by the light source illuminating the character's low-poly model. That is, the area with more light exposure needs more skin details, and more normal maps are used at this time (equivalent to high-precision pictures); the area with less light exposure has fewer skin details, and fewer normal maps are used at this time, and more low-poly model normals are selected (equivalent to low-precision pictures). This can reduce the skin details near the boundary between light and dark, further increase the softness of the skin and reduce the amount of calculation for processing skin details.
[0101] In step S230, for each low-poly model normal, the synthesized normal value corresponding to the low-poly model normal is calculated based on the first weight of the high-poly model normal in the normal map corresponding to the position of the low-poly model normal when synthesizing the character's skin and the second weight of the low-poly model normal when synthesizing the character's skin.
[0102] In this step, interpolation processing is performed based on the high-poly model normal and the first weight of the high-poly model normal when synthesizing the character skin, and the low-poly model normal and the second weight of the low-poly model normal when synthesizing the character skin, to obtain the synthesized normal value corresponding to the low-poly model normal. The number of low-poly model normals determines the number of times the interpolation processing is performed.
[0103] Exemplarily, for each low-poly model normal, the high-poly model normal in the normal map corresponding to the position of the low-poly model normal is multiplied with the first weight of the high-poly model normal when synthesizing the character's skin to obtain a first normal to be synthesized of the high-poly model normal; the low-poly model normal is multiplied with the second weight of the low-poly model normal when synthesizing the character's skin to obtain a second normal to be synthesized of the low-poly model normal; the first normal to be synthesized and the second normal to be synthesized are summed to obtain a synthesized normal value corresponding to the low-poly model normal.
[0104] In step S240, the character low-poly model is rendered using the synthesized normal value and the predetermined color map sampling result to obtain the synthesized skin of the target virtual character, and the target virtual character including the synthesized skin is displayed on the graphical user interface.
[0105] In the embodiment of the present application, the color map sampling result is predetermined by the following steps:
[0106] According to the brightness of the target virtual character's skin in bright areas and dark areas, the color map of the target virtual character is sampled to obtain a color map sampling result; wherein the accuracy of sampling the color map is positively correlated with the brightness.
[0107] Here, the sampling accuracy can be shown by the resolution of the color map. Specifically, for bright skin areas, the virtual character needs to show more skin details. At this time, when sampling the color map, you can choose a color map with higher accuracy, that is, use a color map with higher resolution for sampling; for dark skin areas, the virtual character needs to show less skin details. At this time, when sampling the color map, you can choose a color map with lower accuracy, that is, use a color map with lower resolution for sampling. In this way, according to the size of the light and dark areas formed by the virtual character under the light source in the virtual scene, different color maps with different accuracy are selected for sampling, which can reduce the computing power of the mobile terminal.
[0108] Exemplarily, based on the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, the color map of the target virtual character is sampled to obtain a color map sampling result corresponding to the dot product result; wherein the dot product result is used to determine the resolution of the color map, and the dot product result is positively correlated with the resolution of the color map.
[0109] Here, the dot product result is used to determine the resolution of the color map, that is, the dot product result is positively correlated with the resolution of the color map (sampling accuracy).
[0110] In the embodiment of the present application, for the bright skin area, the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene can be [1,0]; for the dark skin area, the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene can be [0,-1]. Exemplarily, the dot product result corresponding to the bright skin area can be divided into a preset order of magnitude, such as [1,0.9], [0.9,0.8], [0.8,0.7], [0.7,0.6], [0.6,0.5], [0.5,0.4], [0.4,0.3], [0.3,0.2], [0.2,0.1], [0.1,0], and a sampling accuracy can be assigned to each divided interval, such as assigning a sampling accuracy of a*a to [1,0.9], b*b to [0.9,0.8], and [0. 8,0.7], the sampling accuracy is c*c for [0.7,0.6], the sampling accuracy is d*d for [0.6,0.5], the sampling accuracy is e*e for [0.5,0.4], the sampling accuracy is f*f for [0.4,0.3], the sampling accuracy is g*g for [0.3,0.2], the sampling accuracy is h*h for [0.2,0.1], the sampling accuracy is i*i for [0.1,0], and the sampling accuracy is j*j for [0.1,0], where the values of a, b, c, d, e, f, g, h, i, and j decrease in sequence. Then, a sampling accuracy is determined according to the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, and the color map is sampled according to the determined sampling accuracy to obtain the color map sampling result corresponding to the dot product result.
[0111] In addition, the color map sampling result can be predetermined by the following steps: based on the acquired first distance between the target virtual character currently in the virtual scene and the camera in the virtual scene, the color map of the target virtual character is sampled to obtain the color map sampling result; wherein the accuracy of sampling the color map is negatively correlated with the first distance.
[0112] Here, the level of the color map to be used is determined based on the distance between the virtual character and the camera in the virtual scene, wherein color maps of different levels and sizes are prepared in advance, for example, the levels may include 1024*1024, 512*512, 256*256, 200*200, etc.
[0113] For example, when sampling the color map, as the camera gets farther and farther away, if the original picture is still collected, flickering will occur because there are too many details in the original picture. At this time, it is necessary to collect some reduced-size and relatively blurred pictures, so that the color map can be imported into the game engine. The game engine will collect these pictures according to the size corresponding to the depth of this color map, such as 1 / 2 of the original size, 1 / 4 of the original size, 1 / 8 of the original size, etc. The farther the distance, the higher the level and the blurrier the picture. The part close to the boundary between light and dark also needs to collect high-level blurred pictures. Among them, if the original size of the picture is 1024*1024, 1 / 2 of the original size is 512*512, and 1 / 4 of the original size is 256*256.
[0114] In this way, the embodiment of the present application can adjust the sampling accuracy of the color map according to the light source illuminating the character's low-poly model. The sampling accuracy of the color map is determined according to the distance between the virtual character and the camera. For example, a color map with high accuracy is selected for bright areas, and a color map with low accuracy (relatively fuzzy) is selected for dark areas. For example, a virtual character that is close to the camera selects a color map with high accuracy. This method can make the basic color of the light and dark boundary part softer, and then sample such a color map to obtain a color map sampling result, and can also reduce computing power. In addition, the pressure of the subsequent screen space blur sampling can also be alleviated, so that the sampling number of screen space blur is relatively low, so that the performance of the mobile terminal can also support the processing of the character's skin.
[0115] Furthermore, if during the course of the game, the current virtual scene includes multiple virtual characters, the processing method also includes: obtaining a second distance between the multiple virtual characters currently in the virtual scene and the camera in the virtual scene; determining the rendering priority of the multiple virtual characters in the virtual scene based on the second distance between the multiple virtual characters and the camera in the virtual scene; wherein the rendering priority is negatively correlated with the length of the second distance; rendering the character low-poly model based on the rendering priority of the multiple virtual characters in the virtual scene using the synthesized normal value and a predetermined color map sampling result to obtain a synthesized skin of the target virtual character, and displaying the target virtual character including the synthesized skin on a graphical user interface.
[0116] In this step, the rendering priority is used to indicate which virtual character is selected first for rendering among the multiple virtual characters. Here, it can be determined according to the second distance between each virtual character among the multiple virtual characters and the camera. The smaller the length of the second distance, the higher the rendering priority of the virtual character corresponding to the second distance, that is, it is rendered first, and vice versa.
[0117] In addition, before using the synthesized normal value and the predetermined color map sampling result to render the character's low-poly model, the normal map can also be used to perform highlight calculations. The obtained highlight calculation results are used together with the synthesized normal value and the predetermined color map sampling result to render the character's low-poly model to obtain the synthesized skin of the target virtual character, and the target virtual character containing the synthesized skin is displayed on the graphical user interface.
[0118] It should be noted that when processing a virtual character, the embodiments of the present application can perform coordinate space conversion according to actual conditions. For example, in the world space, the normal direction of the virtual character (the low-poly model normal of the character's low-poly model) will change, and its own vertex normal direction can be converted to the vertex normal direction in the world space through matrix conversion.
[0119] For example, see Figure 3 , Figure 3 A schematic diagram of a character skin before and after improvement provided in an embodiment of the present application, such as Figure 3 As shown, picture (a) is a schematic diagram of the character skin before improvement applied in the mobile terminal, and picture (b) is a schematic diagram of the character skin after improvement applied in the mobile terminal. According to the comparison of the two pictures, the processing method of the virtual character provided in the embodiment of the present application reduces the computing power of the mobile terminal while increasing the texture and transparency of the skin.
[0120] Compared with the prior art which is difficult to achieve a balance between computing power and skin rendering effects, the processing method of the virtual character provided by the embodiment of the present application can adjust the skin details displayed by the virtual character according to the different brightness of the bright skin area and the dark skin area formed by the light source irradiating the virtual character. Specifically, the participation of the high-poly model normal and the low-poly model normal in the normal map participating in the calculation is adjusted according to the different brightness of the bright skin area and the dark skin area to achieve a balance between the computing power and skin rendering effects of the mobile terminal. The embodiment of the present application not only greatly weakens the influence of the skin surface on the light source calculation, but also makes the skin diffuse reflection result separate from the details of the skin surface, and has the characteristics of scattering light of the deeper subcutaneous tissue. After the additional highlight calculation, the character's skin shows the subtle and fine texture of the outermost skin. Compared with the diffuse reflection result drawn previously, a clear visual gap is formed between the surface and the subcutaneous layer, thereby increasing the transparency of the skin, and then while ensuring the real and clear skin, the amount of calculation during skin rendering is also reduced, avoiding the problem of excessive performance consumption of the mobile terminal.
[0121] Based on the same inventive concept, the embodiment of the present application also provides a virtual character processing device corresponding to the virtual character processing method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0122] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a virtual character processing device provided in an embodiment of the present application. Figure 4 As shown in , the processing device of the virtual character provided in the embodiment of the present application is applied to a mobile terminal, and the processing device 400 includes:
[0123] A light and dark area acquisition module 410 is used to acquire the bright skin area and the dark skin area of the target virtual character under the light source in the current virtual scene;
[0124] The weight determination module 420 is used to determine, according to the brightness of the character skin of the target virtual character in the bright area of the skin and the dark area of the skin, a first weight of the normal map derived from the character's high-poly model when synthesizing the character's skin and a second weight of the low-poly model normal of the character's low-poly model when synthesizing the character's skin; wherein the normal map carries the high-poly model normal of the character's high-poly model in the tangent space where the character's low-poly model is located, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character's skin;
[0125] A normal synthesis module 430 is used to calculate, for each low-poly model normal, a synthesized normal value corresponding to the low-poly model normal according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character skin and a second weight of the low-poly model normal when synthesizing the character skin;
[0126] The skin synthesis module 440 is used to render the character low-poly model using the synthesized normal value and a predetermined color map sampling result to obtain the synthesized skin of the target virtual character, and display the target virtual character including the synthesized skin on a graphical user interface.
[0127] In an optional embodiment of the present application, for the bright skin area, the first weight is positively correlated with the brightness, and the second weight is negatively correlated with the brightness; for the dark skin area, neither the first weight nor the second weight changes with the brightness.
[0128] In an optional embodiment of the present application, the bright skin area is an area within a first angle range corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene; the dark skin area is an area within a second angle range corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene; wherein any angle within the first angle range is smaller than any angle within the second angle range.
[0129] In an optional embodiment of the present application, when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a first angle range, the value of the first weight and the value of the second weight are both determined based on the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, wherein the value of the first weight is positively correlated with the dot product result, and the value of the second weight is negatively correlated with the dot product result; when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a second angle range, the value of the first weight and the value of the second weight remain unchanged.
[0130] In an optional embodiment of the present application, when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a first angle range, the value of the first weight is the dot product of the direction of the low-poly model normal and the direction of the light source in the virtual scene, and the value of the second weight is the difference between 1 and the value of the first weight; when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a second angle range, the value of the first weight is 0 and the value of the second weight is 1.
[0131] In an optional embodiment of the present application, the normal synthesis module 430 is specifically used to: for each low-poly model normal, perform a product process on the high-poly model normal in the normal map corresponding to the position of the low-poly model normal and the first weight of the high-poly model normal when synthesizing the character skin, to obtain a first normal to be synthesized of the high-poly model normal;
[0132] Performing a product process on the low-poly model normal and a second weight of the low-poly model normal when synthesizing the character skin, to obtain a second normal to be synthesized of the low-poly model normal;
[0133] The first normal to be synthesized and the second normal to be synthesized are summed to obtain a synthesized normal value corresponding to the low-poly model normal.
[0134] In an optional embodiment of the present application, the skin synthesis module 440 is used to predetermine the color map sampling result through the following steps:
[0135] According to the brightness of the target virtual character's skin in the bright skin area and the dark skin area, the color map of the target virtual character is sampled to obtain a color map sampling result; wherein the accuracy of sampling the color map is positively correlated with the brightness.
[0136] In an optional embodiment of the present application, the skin synthesis module 440 is specifically used for:
[0137] According to the dot product result between the direction of the normal of the low-poly model and the direction of the light source in the virtual scene, the color map of the target virtual character is sampled to obtain a color map sampling result corresponding to the dot product result; wherein the dot product result is used to determine the resolution of the color map, and the dot product result is positively correlated with the resolution of the color map.
[0138] In an optional embodiment of the present application, the skin synthesis module 440 is further configured to predetermine the color map sampling result through the following steps:
[0139] According to the acquired first distance between the target virtual character currently in the virtual scene and the camera in the virtual scene, the color map of the target virtual character is sampled to obtain a color map sampling result; wherein the accuracy of sampling the color map is negatively correlated with the first distance.
[0140] The embodiment of the present application provides a processing device for a virtual character, which can adjust the skin details displayed by the virtual character according to the different brightness of the bright skin area and the dark skin area formed by the light source irradiating the virtual character. Specifically, the participation of the high-poly model normal and the low-poly model normal in the normal map participating in the calculation is adjusted according to the different brightness of the bright skin area and the dark skin area, so as to achieve a balance between the computing power of the mobile terminal and the skin rendering effect. The embodiment of the present application not only greatly weakens the influence of the skin surface on the light source calculation, but also makes the skin diffuse reflection result detached from the details of the skin surface, and has the characteristics of scattering light of the deeper subcutaneous tissue. After the additional highlight calculation, the character's skin shows the subtle and fine texture of the outermost skin. Compared with the diffuse reflection result drawn previously, a clear visual gap is formed between the surface and the subcutaneous layer, thereby increasing the transparency of the skin, and then while ensuring the real and clear skin, it also reduces the amount of calculation during skin rendering, avoiding the problem of excessive performance consumption of the mobile terminal.
[0141] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown in , the electronic device 500 includes a processor 510 , a memory 520 and a bus 530 .
[0142] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 communicates with the memory 520 via the bus 530. When the machine-readable instructions are executed by the processor 510, the above-mentioned Figure 2 The steps of the method for processing the virtual character in the method embodiment shown, the specific implementation method can be found in the method embodiment, and will not be repeated here.
[0143] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 2 The steps of the method for processing the virtual character in the method embodiment shown, the specific implementation method can be found in the method embodiment, and will not be repeated here.
[0144] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0145] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, 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 communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0146] 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.
[0147] 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.
[0148] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0149] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for processing a virtual character, characterized in that: Applied to a mobile terminal, the processing method includes: Obtaining bright skin areas and dark skin areas of the target virtual character under the effect of light sources in the current virtual scene; According to the brightness of the character skin of the target virtual character in the bright skin area and the dark skin area, determine the first weight of the normal map derived from the character's high-poly model when synthesizing the character's skin and the second weight of the low-poly model normal of the character's low-poly model when synthesizing the character's skin; wherein the normal map carries the high-poly model normal of the character's high-poly model in the tangent space where the character's low-poly model is located, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character's skin; the bright skin area is the area corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene within a first angle range; the dark skin area is the area corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene within a second angle range; wherein any angle within the first angle range is smaller than any angle within the second angle range; For each low-poly model normal, according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character skin and a second weight of the low-poly model normal when synthesizing the character skin, calculate a synthesized normal value corresponding to the low-poly model normal; The character low-poly model is rendered using the synthesized normal value and a predetermined color map sampling result to obtain a synthesized skin of the target virtual character, and the target virtual character including the synthesized skin is displayed on a graphical user interface.
2. The processing method according to claim 1, characterized in that: For the bright skin area, the first weight is positively correlated with the brightness, and the second weight is negatively correlated with the brightness; for the dark skin area, neither the first weight nor the second weight changes with the brightness.
3. The processing method according to claim 1, characterized in that: When the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a first angle range, the value of the first weight and the value of the second weight are both determined according to the dot product result between the direction of the low-poly model normal and the direction of the light source in the virtual scene, wherein the value of the first weight is positively correlated with the dot product result, and the value of the second weight is negatively correlated with the dot product result; when the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a second angle range, the value of the first weight and the value of the second weight remain unchanged.
4. The processing method according to claim 3, characterized in that: When the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene is within a first angle range, the value of the first weight is the dot product of the direction of the low-poly model normal and the direction of the light source in the virtual scene, and the value of the second weight is the difference between 1 and the value of the first weight; When the angle between the direction of the normal of the low-poly model and the direction of the light source in the virtual scene is within a second angle range, the value of the first weight is 0, and the value of the second weight is 1.
5. The processing method according to claim 1, characterized in that: For each low-poly model normal, the step of calculating a synthesized normal value corresponding to the low-poly model normal according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character skin and a second weight of the low-poly model normal when synthesizing the character skin comprises: For each low-poly model normal, a high-poly model normal in a normal map corresponding to the position of the low-poly model normal is multiplied by a first weight of the high-poly model normal when synthesizing the character skin, to obtain a first normal to be synthesized of the high-poly model normal; Performing a product process on the low-poly model normal and a second weight of the low-poly model normal when synthesizing the character skin, to obtain a second normal to be synthesized of the low-poly model normal; The first normal to be synthesized and the second normal to be synthesized are summed to obtain a synthesized normal value corresponding to the low-poly model normal.
6. The processing method according to claim 1, characterized in that: The color map sampling result is predetermined by the following steps: According to the brightness of the target virtual character's skin in the bright skin area and the dark skin area, the color map of the target virtual character is sampled to obtain a color map sampling result; wherein the accuracy of sampling the color map is positively correlated with the brightness.
7. The processing method according to claim 6, characterized in that: The step of sampling the color map of the target virtual character according to the brightness of the character skin of the target virtual character in the bright skin area and the dark skin area to obtain the color map sampling result includes: According to the dot product result between the direction of the normal of the low-poly model and the direction of the light source in the virtual scene, the color map of the target virtual character is sampled to obtain a color map sampling result corresponding to the dot product result; wherein the dot product result is used to determine the resolution of the color map, and the dot product result is positively correlated with the resolution of the color map.
8. The processing method according to claim 1 or 6, characterized in that: The color map sampling result is also predetermined by the following steps: According to the acquired first distance between the target virtual character currently in the virtual scene and the camera in the virtual scene, the color map of the target virtual character is sampled to obtain a color map sampling result; wherein the accuracy of sampling the color map is negatively correlated with the first distance.
9. A virtual character processing device, characterized in that: Applied to a mobile terminal, the processing device comprises: A light and dark area acquisition module is used to acquire the bright skin area and the dark skin area of the target virtual character under the light source in the current virtual scene; A weight determination module, for determining, according to the brightness of the character skin of the target virtual character in the bright skin area and the dark skin area, a first weight of a normal map derived from a character high-poly model when synthesizing the character skin and a second weight of a low-poly model normal of a character low-poly model when synthesizing the character skin; wherein the normal map carries the high-poly model normal of the character high-poly model in the tangent space where the character low-poly model is located, and the first weight and the second weight are respectively used to represent the participation of the normal map and the low-poly model normal in synthesizing the character skin; the bright skin area is an area corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene within a first angle range; the dark skin area is an area corresponding to the angle between the direction of the low-poly model normal and the direction of the light source in the virtual scene within a second angle range; wherein any angle within the first angle range is smaller than any angle within the second angle range; A normal synthesis module, for calculating, for each low-poly model normal, a synthesized normal value corresponding to the low-poly model normal according to a first weight of a high-poly model normal in a normal map corresponding to a position of the low-poly model normal when synthesizing the character skin and a second weight of the low-poly model normal when synthesizing the character skin; The skin synthesis module is used to render the character low-poly model using the synthesized normal value and a predetermined color map sampling result to obtain the synthesized skin of the target virtual character, and display the target virtual character including the synthesized skin on a graphical user interface.
10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the method for processing a virtual character as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: A computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for processing a virtual character as claimed in any one of claims 1 to 8 are executed.
Citation Information
Patent Citations
Virtual character skin adjustment method and device
CN111784814A
Virtual character rendering method and device and electronic equipment
CN113350785A