Virtual character eye rendering method, device, electronic device and storage medium

By offsetting and rotating the UV coordinate value of the virtual character's eyes, combined with color and brightness values, the effect of the highlights of the game character's eyes rotate along the eye circle, solving the problem of insufficient eye flexibility in the existing technology, and improving player interest and stickiness.

CN114949863BActive Publication Date: 2025-03-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210523633.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2025-03-11
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

In the prior art, the eyes of game characters are too real, which leads to not being flexible enough, reducing players' interest in playing and user stickiness.

Method used

By obtaining the UV coordinate value of the three-dimensional model of the virtual character's eye, and performing offset processing, calculating the UV rotation value, and reverse offset processing to obtain the highlight component, combining the color value and brightness value coefficient for rendering, the agile effect of the eye highlights is achieved.

Benefits of technology

The eye highlights of the virtual character are rotated along the eye due to the virtual character's orientation, observation angle, lighting direction and current time point, enhancing the agility of the game character, thereby improving the player's interest in playing and user stickiness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114949863B_ABST
    Figure CN114949863B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, electronic device and storage medium for rendering eyes of a virtual character; including: obtaining the UV coordinate value of the target colored surface, and performing offset processing on the UV coordinate value of the target colored surface to obtain the UV coordinate offset value; calculating the first offset value of the UV coordinate value according to the virtual character orientation vector, the viewing angle orientation vector and the illumination direction vector; calculating the second offset value of the UV coordinate value according to the current time point and the UV coordinate offset value; calculating the UV rotation value according to the first offset value, the second offset value and the UV coordinate offset value; and performing reverse offset processing to obtain the highlight component of the target colored surface; obtaining the calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface and the brightness value coefficient of the target colored surface; rendering the target colored surface according to the calculation result to obtain the rendering result. The present application makes the eyes of virtual characters more agile, enhances the interest of players in playing games and improves user stickiness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a method, device, electronic device and storage medium for rendering virtual character eyes. Background Art

[0002] In the prior art, when drawing the eyes of a game character, it is often achieved through a two-layer modeling method: the bottom plane is rendered with an eye map, and a transparent patch with an arc surface is superimposed on the surface of the bottom layer. The transparent patch obeys the physical laws of simulating the real world: rendering is performed in a physically based rendering (Physical-Based Rendering, abbreviated as PBR) manner.

[0003] However, the eyes of the game characters obtained by the above-mentioned drawing method are often too realistic, making the eyes of the game characters often not smart enough, thereby weakening the player's interest in playing and reducing the user stickiness of the player users. Summary of the invention

[0004] The embodiments of the present application provide a method, device, electronic device and storage medium for rendering virtual character eyes, which can improve the problem of weakening player's interest in playing and reducing user stickiness in the prior art.

[0005] The present application provides a method for rendering virtual character eyes, the method comprising:

[0006] Acquire UV coordinate values ​​of a target colored surface, and perform offset processing on the UV coordinate values ​​of the target colored surface to obtain UV coordinate offset values, wherein the target colored surface is any one of a plurality of planes included in the three-dimensional model of the eyes of the virtual character;

[0007] Calculate a first offset value of the UV coordinate value according to the virtual character's orientation vector, the viewing angle orientation vector, and the illumination direction vector;

[0008] Calculate a second offset value of the UV coordinate value according to the current time point and the UV coordinate offset value;

[0009] Calculating a UV rotation value according to the first offset value, the second offset value, and the UV coordinate offset value;

[0010] Performing reverse offset processing on the UV rotation value to obtain the highlight component of the target colored surface, wherein the reverse offset processing is opposite to the offset processing in offset direction and the offset distance is equal to that of the offset processing;

[0011] Obtaining a calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface;

[0012] The target shading surface is rendered according to the calculation result to obtain a rendering result.

[0013] The embodiment of the present application also provides a virtual character eye rendering device, the device comprising:

[0014] an offset processing unit, used to obtain a UV coordinate value of a target colored surface, and perform an offset processing on the UV coordinate value of the target colored surface to obtain a UV coordinate offset value, wherein the target colored surface is any one of a plurality of planes included in the three-dimensional model of the eye of the virtual character;

[0015] A first offset calculation unit, used for calculating a first offset value of the UV coordinate value according to a virtual character orientation vector, an observation angle orientation vector and a light direction vector;

[0016] A second offset calculation unit, used for calculating a second offset value of the UV coordinate value according to the current time point and the UV coordinate offset value;

[0017] A UV rotation calculation unit, configured to calculate a UV rotation value according to the first offset value, the second offset value and the UV coordinate offset value;

[0018] A highlight component unit, used for performing reverse offset processing on the UV rotation value to obtain the highlight component of the target colored surface, wherein the reverse offset processing is opposite to the offset processing in offset direction and the offset distance is equal;

[0019] A calculation result unit, used for obtaining a calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface;

[0020] A rendering result unit is used to render the target shading surface according to the calculation result to obtain a rendering result.

[0021] In some embodiments, the first offset calculation unit includes:

[0022] a normalization subunit, configured to obtain a virtual character orientation vector, an observation angle orientation vector, and a lighting direction vector, and to perform normalization processing on the virtual character orientation vector, the observation angle orientation vector, and the lighting direction vector to obtain a virtual character orientation normalized vector, an observation angle orientation normalized vector, and a lighting direction normalized vector;

[0023] A weighted sum subunit, used to calculate the weighted sum of the virtual character's normalized orientation vector, the observation angle orientation normalized vector, and the illumination direction normalized vector;

[0024] An absolute value subunit is used to take an absolute value of the weighted sum to obtain the first offset value.

[0025] In some embodiments, the second offset calculation unit includes:

[0026] A time increment subunit, used to obtain a decimal part of the current time point, and multiply the decimal part by a preset influence coefficient to obtain a time increment;

[0027] A coordinate increment subunit, used for adding the U coordinate value and the V coordinate value of the UV coordinate offset value to the time increment to obtain a UV coordinate increment value;

[0028] The noise value subunit is used to obtain the pixel point corresponding to the UV coordinate increment value in the two-dimensional image of the virtual character's eye, obtain the noise value of the pixel point, and obtain the product of the noise value and the noise intensity parameter, wherein the product of the noise value and the noise intensity parameter is the second offset value.

[0029] In some embodiments, the UV rotation calculation unit includes:

[0030] A rotation component subunit, configured to calculate a UV rotation component according to the first offset value and the second offset value;

[0031] The rotation processing subunit is used to perform rotation processing on the UV coordinate offset value by using the UV rotation component to obtain the UV rotation value.

[0032] In some embodiments, the highlight component unit includes:

[0033] A correction coordinate subunit, used for performing reverse offset processing on the UV rotation value to obtain a UV correction coordinate value;

[0034] The highlight component subunit is used to obtain the pixel point corresponding to the highlight map of the target shading surface in the virtual character's eye according to the UV corrected coordinate value, and obtain the highlight value of the pixel point, wherein the highlight value is the highlight component.

[0035] In some embodiments, the calculation result unit includes:

[0036] A summing subunit, used for calculating the sum of the highlight component and the color value component;

[0037] The product subunit is used to calculate the product of the sum and the brightness value coefficient, and the product is the calculation result.

[0038] In some embodiments, the apparatus further comprises:

[0039] The color component unit is used to obtain the color value component of the target shading surface.

[0040] In some embodiments, the color component unit includes:

[0041] A target pixel subunit, used for obtaining a target pixel point corresponding to the two-dimensional image of the virtual character's eye of the target colored surface according to the UV coordinate value of the target colored surface;

[0042] The color value subunit is used to obtain the color value of a target pixel, where the color value is the color value component.

[0043] In some embodiments, the apparatus further comprises:

[0044] The brightness value unit is used to obtain the brightness value coefficient of the target colored surface.

[0045] In some embodiments, the brightness value unit includes:

[0046] A projection acquisition subunit, used to acquire a projection plane perpendicular to the standing direction of the virtual character;

[0047] A projection vector subunit, used to obtain a projection vector of the illumination direction on the projection plane;

[0048] A projection normalization subunit, used for normalizing the projection vector to obtain a projection normalized vector;

[0049] A point multiplication subunit, configured to perform a point multiplication operation on the projected normalized vector and the character forward unit vector to obtain a point multiplication result, wherein the character forward unit vector is a unit vector corresponding to the direction in which the virtual character is facing;

[0050] The brightness mapping subunit is used to obtain the mapping result of the dot product result in the brightness interval, and the mapping result is the brightness value coefficient.

[0051] An embodiment of the present application also provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the steps in any one of the virtual character eye rendering methods provided in the embodiments of the present application.

[0052] In the virtual character eye rendering method provided in the embodiment of the present application, any one of the multiple planes included in the three-dimensional model where the virtual character's eyes are located can be obtained, and the UV coordinate value corresponding to the plane and the UV coordinate offset value obtained after the offset processing can be further obtained. Subsequently, based on the virtual character's orientation vector, the viewing angle orientation vector and the illumination direction vector, the first offset value is calculated; based on the current time point and the UV coordinate offset value, the second offset value is calculated. Then, the UV rotation value is calculated according to the UV coordinate offset value and the calculated first offset value and the second offset value. Then, the UV rotation value is reversely offset processed to obtain the highlight component of the target colored surface, and according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface, the calculation result of the target colored surface is obtained, and finally, the target colored surface is rendered according to the calculation result to obtain the rendering result.

[0053] In the present application, the obtained highlight component carries information such as the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point. Therefore, the highlights in the virtual character's eyes obtained after rendering can be affected by the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point, and rotate around the eyes, making the virtual character's eyes more flexible, thereby enhancing the player's interest in playing and improving the user stickiness of the player. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0055] Figure 1a Schematic diagram of a scene of a method for rendering virtual character eyes provided in an embodiment of the present application;

[0056] Figure 1b It is a flowchart of a method for rendering virtual character eyes provided in one embodiment of the present application;

[0057] Figure 1c A function graph of the UV rotation component is shown;

[0058] Figure 1d A schematic diagram showing a rendering result of a virtual character's eyes;

[0059] Figure 1e A schematic diagram showing another rendering result of the eyes of a virtual character;

[0060] Figure 1fA schematic diagram showing another rendering result of a virtual character's eyes;

[0061] Figure 2 is a flowchart of a method for rendering virtual character eyes provided by another embodiment of the present application;

[0062] Figure 3 This is a structural diagram of a virtual character eye rendering device provided in one embodiment of the present application;

[0063] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0065] Embodiments of the present application provide a method, device, mobile terminal, and storage medium for rendering virtual character eyes.

[0066] The virtual character eye rendering method can be integrated into an electronic device, which can be a terminal, a server, etc. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, or a personal computer (PC); the server can be a single server or a server cluster composed of multiple servers.

[0067] In some embodiments, the virtual character eye rendering method can also be integrated into multiple electronic devices. For example, the virtual character eye rendering method can be integrated into multiple servers, and the virtual character eye rendering method of the present application can be implemented by multiple servers.

[0068] In some embodiments, the server may also be implemented in the form of a terminal.

[0069] For example, see Figure 1aIn some embodiments, the electronic device may be a mobile terminal. The embodiment may obtain the UV coordinate value of the target colored surface, and perform an offset process on the UV coordinate value of the target colored surface to obtain a UV coordinate offset value, wherein the target colored surface is any one of the multiple planes included in the three-dimensional model of the eye of the virtual character; calculate a first offset value of the UV coordinate value according to the virtual character orientation vector, the viewing angle orientation vector, and the illumination direction vector; calculate a second offset value of the UV coordinate value according to the current time point and the UV coordinate offset value; calculate a UV rotation value according to the first offset value, the second offset value, and the UV coordinate offset value; perform a reverse offset process on the UV rotation value to obtain a highlight component of the target colored surface, wherein the reverse offset process is opposite to the offset direction of the offset process, and the offset distance is equal; obtain a calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface; render the target colored surface according to the calculation result to obtain a rendering result.

[0070] In one embodiment of the present disclosure, a method for rendering eyes of a virtual character may be run on a terminal device or a server. The terminal device may be a local terminal device. When the method for rendering eyes of a virtual character is run on a server, the method may be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0071] In an optional embodiment, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operation subject of the game program and the game screen presentation subject are separated. The storage and operation of the virtual character eye rendering method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a terminal, a TV, a computer, a handheld computer, etc.; but the terminal device for rendering the virtual character's eyes is a cloud game server in the cloud. When playing the game, the user operates the client device to send an operation instruction to the cloud game server, such as a touch operation instruction. 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 client device decodes and outputs the game screen.

[0072] In an optional embodiment, the terminal device 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 user 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 user in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the user 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.

[0073] The game scene (or virtual scene) is a virtual scene displayed (or provided) when the application is running on a terminal or server. Optionally, the virtual scene is a simulation environment of the real world, or a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene is any one of a two-dimensional virtual scene and a three-dimensional virtual scene. The virtual 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 with complete game logic of virtual objects such as user control. For example, in a sandbox 3D shooting game, the virtual scene is a 3D game world for users to control virtual objects for battle. Exemplary virtual scenes may include: at least one element of mountains, plains, rivers, lakes, oceans, deserts, skies, plants, buildings, and vehicles.

[0074] The game interface refers to the interface corresponding to the application provided or displayed through the graphical user interface, which includes the graphical user interface for users to interact with and the game screen, which is the screen of the game scene.

[0075] In an optional embodiment, the UI interface may include game controls (such as skill controls, behavior controls, function controls, etc.), indicators (such as direction indicators, character indicators, etc.), information display areas (such as number of kills, match time, etc.), or game setting controls (such as system settings, stores, gold coins, etc.).

[0076] In an optional implementation, the game screen is a display screen corresponding to the terminal device displaying a virtual scene. The game screen may include virtual objects such as game objects that execute game logic in the virtual scene, non-virtual characters (NPC), artificial intelligence (AI) characters, etc.

[0077] For example, in some embodiments, the content displayed in the graphical user interface at least partially includes a game scene, wherein the game scene includes at least one game object.

[0078] In some embodiments, the game objects in the game scene include virtual objects controlled by the player user, namely user objects.

[0079] Game objects refer to virtual objects in a virtual scene, including game characters. Game characters are dynamic objects that can be controlled, i.e., dynamic virtual objects. Optionally, the dynamic object can be a virtual person, a virtual animal, a cartoon character, etc. The virtual object is a character controlled by a user through an input device, or an AI set in a virtual environment through training, or an NPC set in a virtual scene.

[0080] Optionally, the virtual object is a virtual character competing in a virtual scene. Optionally, the number of virtual objects in the virtual scene battle is preset, or dynamically determined according to the number of clients joining the battle, which is not limited in the embodiment of the present application.

[0081] In one possible implementation, the user can control the virtual object to perform game behaviors in the virtual scene. Game behaviors may include movement, casting skills, using props, and conversations. For example, the user can control the virtual object to run, jump, crawl, etc., and can also control the virtual object to use the skills and virtual props provided by the application to fight with other virtual objects.

[0082] The virtual camera is a necessary component for presenting the game scene. One game scene corresponds to at least one virtual camera. Depending on actual needs, there can be two or more virtual cameras, which serve as game rendering windows to capture and present the game world's screen content to users. By setting the parameters of the virtual camera, the user's perspective of viewing the game world can be adjusted, such as the first-person perspective and the third-person perspective.

[0083] In an optional implementation, an embodiment of the present invention provides a method for rendering virtual character eyes, providing a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be a client device in the cloud interaction system mentioned above.

[0084] It should be noted that the serial numbers of the following embodiments are not intended to limit the preferred order of the embodiments.

[0085] In this embodiment, a method for rendering virtual character eyes is provided. Figure 1b As shown, the specific process of the method may include the following steps 110 to 170:

[0086] 110. Obtain UV coordinate values ​​of a target colored surface, and perform an offset process on the UV coordinate values ​​of the target colored surface to obtain UV coordinate offset values.

[0087] The target shading surface is any one of the multiple planes included in the three-dimensional model of the virtual character's eyes. The three-dimensional model of the virtual character's eyes may be composed of multiple planes. Each of the multiple planes has its own UV coordinate value, and there may be two or more planes corresponding to the same UV coordinate value.

[0088] UV mapping is a 3D modeling process that projects a 2D image onto the surface of a 3D model for texture mapping. After mapping, each plane has its own UV coordinate value, which can be used to correspond to the pixel points on the 2D image.

[0089] The offset processing is a process to make the center of the sampling graph corresponding to the target shading surface coincide with the origin of the UV coordinate axis. Under the premise of implementing the above process, the offset direction and offset distance of the offset processing should not be understood as limitations on this application. For example, it is assumed that the offset processing is specifically to subtract the UV coordinate value of the target shading surface from (0.5, 0.5) to obtain the UV coordinate offset value, which can be represented by (U0, V0).

[0090] 120. Calculate a first offset value of the UV coordinate value according to the virtual character's orientation vector, the viewing angle orientation vector, and the illumination direction vector.

[0091] The virtual character orientation vector is the vector of the virtual character's face orientation in the game; the viewing angle orientation vector is the vector corresponding to the direction of the virtual camera; and the illumination direction is the vector corresponding to the illumination direction simulated in the game.

[0092] Optionally, in a specific implementation, step 120 may specifically include the following steps 121 to 123:

[0093] 121. Obtain a virtual character's orientation vector, an observation angle orientation vector, and a lighting direction vector, and normalize the virtual character's orientation vector, the observation angle orientation vector, and the lighting direction vector to obtain a normalized virtual character orientation vector, a normalized observation angle orientation vector, and a normalized lighting direction vector.

[0094] Normalizing a vector is a process of keeping the direction of the vector unchanged and changing the modulus of the vector to 1. Normalization can be achieved through a variety of calculation methods, and the specific processing steps should not be understood as limiting the present application.

[0095] 122. Calculate a weighted sum of the virtual character's normalized orientation vector, the observation angle normalized orientation vector, and the illumination direction normalized vector.

[0096] The virtual character's normalized orientation vector, the observation angle's normalized orientation vector, and the illumination direction normalized vector all have corresponding weight values, and the above weight values ​​can be set by developers based on historical development experience.

[0097] For example, let the virtual character's normalized vector be v1, the observation angle normalized vector be v2, and the illumination direction normalized vector be v3; and the weight value of the virtual character's normalized vector is a, the weight value of the observation angle normalized vector is b, and the weight value of the illumination direction normalized vector is c. Then the weighted sum calculated in step 122 can be calculated by the following formula:

[0098] AD=a*v1+b*v2+c*v3.

[0099] 123. Take an absolute value of the weighted sum to obtain the first offset value.

[0100] By taking the absolute value of the weighted sum calculated in step 122, the first offset value O1 of the UV coordinate value = |a*v1+b*v2+c*v3| can be obtained.

[0101] 130. Calculate a second offset value of the UV coordinate value according to the current time point and the UV coordinate offset value.

[0102] The current time point is the real-time current time point when the player runs the game. Accordingly, in a specific implementation, step 130 may specifically include the following steps 131 to 133:

[0103] 131. Obtain a decimal part of the current time point, and multiply the decimal part by a preset influence coefficient to obtain a time increment.

[0104] The decimal part of the current time point can be obtained by obtaining the minute and second value of the current time, and calculating the ratio of the minute and second value to 3600 seconds. The obtained ratio is the decimal part of the current time point. Among them, the minute and second value can be the sum of the current minute value and the second value, and the sum is converted into seconds. For example, let's assume that the current time point is 13:30, then the number of seconds corresponding to 30 minutes is 1800 seconds, and the ratio of 1800 seconds to 3600 seconds is calculated to be 0.5, so the decimal part of the current time point is 0.5.

[0105] The preset impact coefficient is set by the developer based on historical development experience, and its specific value should not be understood as a limitation of this application. The time increment can be obtained by multiplying the decimal part of the current time point by the preset impact coefficient.

[0106] 132. Add the U coordinate value and the V coordinate value of the UV coordinate offset value to the time increment to obtain a UV coordinate increment value.

[0107] Let's assume the time increment is z, and continue with the above example: the U coordinate value of the UV coordinate offset value (U0, V0) is U0, and the V coordinate value is V0, then the UV coordinate increment value is (U0+z, V0+z).

[0108] 133. Obtain the pixel point corresponding to the UV coordinate increment value in the two-dimensional image of the virtual character's eye, obtain the noise value of the pixel point, and obtain the product of the noise value and the noise intensity parameter, wherein the product of the noise value and the noise intensity parameter is the second offset value.

[0109] The noise intensity parameter is set by the developer based on historical development experience, and its specific value should not be understood as a limitation to this application.

[0110] After calculating the UV coordinate increment value (U0+z, V0+z), the pixel corresponding to the above coordinate value (U0+z, V0+z) in the two-dimensional image of the virtual character's eye is obtained according to the UV coordinate increment value (U0+z, V0+z), and the noise value of the pixel in the noise map is further obtained. Then, the product of the noise value and the noise intensity parameter is calculated, and the product result is the second offset value O2.

[0111] 140. Calculate a UV rotation value according to the first offset value, the second offset value, and the UV coordinate offset value.

[0112] Optionally, in a specific implementation, step 140 may specifically include the following steps 141 to 142:

[0113] 141. Calculate a UV rotation component according to the first offset value and the second offset value.

[0114] Optionally, step 141 can be specifically implemented in the following manner: calculate the sum of the first offset and the second offset, and take the decimal part of the sum, which is recorded as Frac0, where Frac0 is a function that is customized in the range of [0,1] and presents the decimal part of the above sum on the v coordinate axis.

[0115] According to the formula (U1, V1) = (4|Frac0-0.5|-1, Sign (Frac0-0.5) * [1-(4|Frac0-0.5|-1) 2 ]) Calculate the UV rotation component (U1, V1), see Figure 1c , Figure 1c The U line in is the function graph of 4|Frac0-0.5|-1. Figure 1c The V curve in is Sign(Frac0-0.5)*[1-(4|Frac0-0.5|-1) 2 ] The value of Sign(Frac0-0.5) is related to the positive or negative state of Frac0-0.5: if Frac0-0.5 is positive, then Sign(Frac0-0.5) is 1; if Frac0-0.5 is negative, then Sign(Frac0-0.5) is -1. The UV rotation component can make the UV coordinate value carry the information of the virtual character's orientation, the viewing angle orientation, and the lighting direction.

[0116] 142. Use the UV rotation component to rotate the UV coordinate offset value to obtain the UV rotation value.

[0117] Optionally, the UV rotation value (U', V') can be calculated according to the formula (U', V') = (U0*U1-V0*V1, U0*U1+V0*V1). The UV coordinate offset value (U0, V0) is rotated so that the highlight component rotates around the eye of the virtual character according to the UV rotation component (U1, V1), and the rotation process also includes changes in the axial direction.

[0118] 150. Perform reverse offset processing on the UV rotation value to obtain the highlight component of the target colored surface.

[0119] The reverse offset process is opposite to the offset process in offset direction and has the same offset distance. For example, the offset process is specifically a process of subtracting the UV coordinate value from (0.5, 0.5), so the reverse offset process is a process of adding the UV rotation value (U', V') to (0.5, 0.5).

[0120] Optionally, in a specific implementation, step 150 may specifically include the following steps 151 to 152:

[0121] 151. Perform reverse offset processing on the UV rotation value to obtain a UV correction coordinate value.

[0122] 152. According to the UV corrected coordinate value, obtain the pixel point corresponding to the highlight map of the target shading surface in the virtual character's eye, and obtain the highlight value of the pixel point, where the highlight value is the highlight component.

[0123] In the above implementation, the pixel corresponding to the target shading surface in the highlight map of the virtual character's eyes can be obtained according to the UV corrected coordinate value of the target shading surface, and the highlight value of the pixel can be further obtained, and the highlight value is the above-mentioned highlight component; the highlight value in the highlight map corresponding to the virtual character's eyes can be obtained according to the UV corrected coordinate value, so that the obtained highlight component is more accurate. 160. According to the highlight component, the color value component of the target shading surface, and the brightness value coefficient of the target shading surface, the calculation result of the target shading surface is obtained.

[0124] After the highlight component is calculated, the highlight component is calculated together with the color value component and the brightness value coefficient to obtain a calculation result corresponding to the target colored surface. Optionally, in a specific implementation, step 160 may specifically include the following steps 161 to 162:

[0125] 161. Calculate the sum of the highlight component and the color value component.

[0126] 162. Calculate the product of the sum and the brightness value coefficient, where the product is the calculation result.

[0127] In the above implementation, the sum of the highlight component and the color value component may be calculated, and the sum may be multiplied by the brightness value coefficient to obtain a calculation result, so that the calculation result may be affected by the highlight component, the color value component and the brightness value coefficient.

[0128] Optionally, in a specific implementation manner, before step 160, the embodiment of the present application may further include the following steps:

[0129] Gets the color value component of the target shading surface.

[0130] Optionally, the step of “obtaining the color value component of the target colored surface” may include the following steps A1 to A2:

[0131] A1. According to the UV coordinate value of the target colored surface, obtain the target pixel point corresponding to the two-dimensional image of the virtual character's eye of the target colored surface.

[0132] A2. Obtain a color value of a target pixel, where the color value is the color value component.

[0133] In the above-mentioned embodiment, the target pixel point corresponding to the target colored surface in the two-dimensional image of the virtual character's eye can be obtained according to the UV coordinate value of the target colored surface, and the color value of the target pixel point can be further obtained. The color value is the above-mentioned color value component; the color value in the two-dimensional image of the virtual character's eye can be obtained according to the UV coordinate value, so that the color of the obtained color value component is more accurate.

[0134] Optionally, in a specific implementation manner, before step 160, the embodiment of the present application may further include the following steps:

[0135] Get the brightness value coefficient of the target colored surface.

[0136] Optionally, the step of “obtaining the brightness value coefficient of the target colored surface” may specifically include the following steps B1 to B5:

[0137] B1. Acquire a projection plane perpendicular to the standing direction of the virtual character.

[0138] Optionally, the virtual character's facing direction and the virtual character's sideways direction may be obtained, and the projection plane may be determined using the facing direction and the sideways direction. The sideways direction of the virtual character may be the virtual character's left side direction or the virtual character's right side direction, and the specific direction should not be construed as a limitation of the present application.

[0139] B2. Obtain the projection vector of the illumination direction on the projection plane.

[0140] B3. Normalize the projection vector to obtain a projection normalized vector.

[0141] Normalizing a vector is a process of keeping the direction of the vector unchanged and changing the modulus of the vector to 1. Therefore, the direction of the projected normalized vector is consistent with the direction of the projection vector, and the modulus of the projected normalized vector is 1.

[0142] B4. Perform a dot product operation on the projected normalized vector and the character forward unit vector to obtain a dot product result, wherein the character forward unit vector is a unit vector corresponding to the facing direction of the virtual character.

[0143] B5. Obtain a mapping result of the dot product result in a brightness range, where the mapping result is the brightness value coefficient.

[0144] Let the dot product result be represented by FdotL, the brightness interval is [Lmin, Lmax], and the specific process of mapping FdotL in the brightness interval [Lmin, Lmax] is as follows: if FdotL is less than Lmin, the mapping result is Lmin; if FdotL is greater than Lmax, the mapping result is Lmax; if the value of FdotL is within [Lmin, Lmax], FdotL is used as the mapping result. It should be understood that the above mapping process is only an exemplary description, and the dot product result can also be mapped in the brightness interval in other ways. The specific mapping steps should not be understood as limitations on the present application.

[0145] Optionally, the acquisition of highlight components, color value components and brightness value coefficients can be achieved through shaders. Shader is a piece of program code used to render graphics. Through shaders, developers can customize the way graphics cards render objects to be processed, thereby achieving the rendering effect that developers expect to achieve.

[0146] 170. Render the target shading surface according to the calculation result to obtain a rendering result.

[0147] Through the above steps 110 to 170, any one of the multiple planes included in the three-dimensional model of the virtual character's eyes can be rendered. By executing steps 110 to 170 multiple times, the rendering results of all the planes included in the three-dimensional model of the virtual character's eyes can be obtained. For details, please refer to Figure 1d , Figure 1e as well as Figure 1f , Figure 1d , Figure 1e as well as Figure 1f Schematic diagrams of the rendering results of the virtual character's eyes are shown respectively. It can be seen from the figure that the highlights in the virtual character's eyes rotate around the eyes under the influence of the virtual character's direction, the viewing angle direction, the lighting direction and the current time point, thereby making the virtual character's eyes more flexible.

[0148] In the virtual character eye rendering method provided in the embodiment of the present application, any one of the multiple planes included in the three-dimensional model where the virtual character's eyes are located can be obtained, and the UV coordinate value corresponding to the plane and the UV coordinate offset value obtained after the offset processing can be further obtained. Subsequently, based on the virtual character's orientation vector, the viewing angle orientation vector and the illumination direction vector, the first offset value is calculated; based on the current time point and the UV coordinate offset value, the second offset value is calculated. Then, the UV rotation value is calculated according to the UV coordinate offset value and the calculated first offset value and the second offset value. Then, the UV rotation value is reversely offset processed to obtain the highlight component of the target colored surface, and according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface, the calculation result of the target colored surface is obtained, and finally, the target colored surface is rendered according to the calculation result to obtain the rendering result. In the present application, the obtained highlight component carries information such as the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point. Therefore, the highlights in the virtual character's eyes obtained after rendering can be affected by the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point, and rotate around the eyes, thereby making the virtual character's eyes more flexible.

[0149] In this application, the player's interest in playing can be enhanced and the user stickiness of the player users can be improved.

[0150] The method described in the above embodiment will be further described in detail below.

[0151] In this embodiment, the offset processing is to subtract (0.5, 0.5) from the coordinate value as an example to describe the method of the embodiment of the present application in detail.

[0152] like Figure 2 As shown, the specific process of a virtual character eye rendering method is as follows:

[0153] 201. According to the UV coordinate value of the target colored surface, obtain the target pixel point corresponding to the target colored surface in the two-dimensional image of the virtual character's eyes; and obtain the color value of the target pixel point, where the color value is the color value component.

[0154] 202. Obtain the brightness value coefficient of the target colored surface.

[0155] Step 202 may specifically include the following steps: obtaining a projection plane perpendicular to the standing direction of the virtual character; obtaining a projection vector of the lighting direction on the projection plane; normalizing the projection vector to obtain a projection normalized vector; performing a dot product operation on the projection normalized vector and the character's forward unit vector to obtain a dot product result, wherein the character's forward unit vector is a unit vector corresponding to the facing direction of the virtual character; obtaining a mapping result of the dot product result in a brightness range, wherein the mapping result is the brightness value coefficient.

[0156] 203. Obtain the UV coordinate value of the target colored surface, and subtract the UV coordinate value of the target colored surface from (0.5, 0.5) to obtain a UV coordinate offset value.

[0157] The target colored surface is any one of a plurality of planes included in the three-dimensional model of the virtual character's eyes.

[0158] 204. Obtain a virtual character orientation vector, an observation angle orientation vector, and a lighting direction vector, and normalize the virtual character orientation vector, the observation angle orientation vector, and the lighting direction vector to obtain a virtual character orientation normalized vector, an observation angle orientation normalized vector, and a lighting direction normalized vector.

[0159] 205. Calculate a weighted sum of the virtual character's normalized orientation vector, the observation angle normalized orientation vector, and the illumination direction normalized vector; and take an absolute value of the weighted sum to obtain the first offset value.

[0160] 206. Obtain a decimal part of the current time point, and multiply the decimal part by a preset influence coefficient to obtain a time increment; and add the U coordinate value and the V coordinate value of the UV coordinate offset value to the time increment to obtain a UV coordinate increment value.

[0161] 207. Obtain the pixel point corresponding to the UV coordinate increment value in the two-dimensional image of the virtual character's eye, obtain the noise value of the pixel point, and obtain the product of the noise value and the noise intensity parameter, wherein the product of the noise value and the noise intensity parameter is the second offset value.

[0162] 208. Calculate a UV rotation component according to the first offset value and the second offset value; and use the UV rotation component to rotate the UV coordinate offset value to obtain the UV rotation value.

[0163] 209. Add the UV rotation value to (0.5, 0.5) to obtain the highlight component of the target colored surface.

[0164] 210. Calculate the sum of the highlight component and the color value component.

[0165] 211. Calculate the product of the sum and the brightness value coefficient, where the product is the calculation result.

[0166] 212. Render the target shading surface according to the calculation result to obtain a rendering result.

[0167] As can be seen from the above, the embodiment of the present application can obtain any one of the multiple planes included in the three-dimensional model where the eyes of the virtual character are located, and further obtain the UV coordinate value corresponding to the plane and the UV coordinate offset value obtained after the offset processing. Subsequently, based on the virtual character's orientation vector, the viewing angle orientation vector and the illumination direction vector, the first offset value is calculated; based on the current time point and the UV coordinate offset value, the second offset value is calculated. Then, the UV rotation value is calculated according to the UV coordinate offset value and the calculated first offset value and the second offset value. The UV rotation value is then reversely offset processed to obtain the highlight component of the target shading surface, and based on the highlight component, the color value component of the target shading surface, and the brightness value coefficient of the target shading surface, the calculation result of the target shading surface is obtained, and finally, the target shading surface is rendered according to the calculation result to obtain the rendering result.

[0168] In the present application, the obtained highlight component carries information such as the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point. Therefore, the highlights in the virtual character's eyes obtained after rendering can be affected by the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point, and rotate along the eye periphery, thereby enhancing the player's interest in playing and improving the user stickiness of the player.

[0169] In the present application, the highlight map that realizes the highlight component can be designed by an artist, so that the eyes of the virtual character can be highly customized. The rendering result obtained in the embodiment of the present application makes the highlights in the eyes of the virtual character more flexible while satisfying the requirements related to the character's posture, lighting direction, and shadow relationship.

[0170] In order to better implement the above method, the embodiment of the present application also provides a virtual character eye rendering device, which can be integrated in an electronic device, and the electronic device can be a terminal. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer, and other devices.

[0171] For example, in this embodiment, the device of the embodiment of the present application is described in detail by taking the virtual character eye rendering device specifically integrated in the terminal as an example.

[0172] For example, Figure 3 As shown, the virtual character eye rendering device may include:

[0173] An offset processing unit 301 is used to obtain a UV coordinate value of a target colored surface, and perform an offset process on the UV coordinate value of the target colored surface to obtain a UV coordinate offset value, wherein the target colored surface is any one of a plurality of planes included in the three-dimensional model of the virtual character's eye;

[0174] A first offset calculation unit 302, used to calculate a first offset value of the UV coordinate value according to the virtual character orientation vector, the viewing angle orientation vector and the illumination direction vector;

[0175] A second offset calculation unit 303, used to calculate a second offset value of the UV coordinate value according to the current time point and the UV coordinate offset value;

[0176] A UV rotation calculation unit 304, configured to calculate a UV rotation value according to the first offset value, the second offset value and the UV coordinate offset value;

[0177] A highlight component unit 305 is used to perform reverse offset processing on the UV rotation value to obtain a highlight component of the target colored surface, wherein the reverse offset processing is opposite to the offset processing in offset direction and the offset distance is equal;

[0178] A calculation result unit 306, configured to obtain a calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface;

[0179] The rendering result unit 307 is used to render the target shading surface according to the calculation result to obtain a rendering result.

[0180] In some embodiments, the first offset calculation unit 302 includes:

[0181] a normalization subunit, configured to obtain a virtual character orientation vector, an observation angle orientation vector, and a lighting direction vector, and to perform normalization processing on the virtual character orientation vector, the observation angle orientation vector, and the lighting direction vector to obtain a virtual character orientation normalized vector, an observation angle orientation normalized vector, and a lighting direction normalized vector;

[0182] A weighted sum subunit, used to calculate the weighted sum of the virtual character's normalized orientation vector, the observation angle orientation normalized vector, and the illumination direction normalized vector;

[0183] An absolute value subunit is used to take an absolute value of the weighted sum to obtain the first offset value.

[0184] In some embodiments, the second offset calculation unit 303 includes:

[0185] A time increment subunit, used to obtain a decimal part of the current time point, and multiply the decimal part by a preset influence coefficient to obtain a time increment;

[0186] A coordinate increment subunit, used for adding the U coordinate value and the V coordinate value of the UV coordinate offset value to the time increment to obtain a UV coordinate increment value;

[0187] The noise value subunit is used to obtain the pixel point corresponding to the UV coordinate increment value in the two-dimensional image of the virtual character's eye, obtain the noise value of the pixel point, and obtain the product of the noise value and the noise intensity parameter, wherein the product of the noise value and the noise intensity parameter is the second offset value.

[0188] In some embodiments, the UV rotation calculation unit 304 includes:

[0189] A rotation component subunit, configured to calculate a UV rotation component according to the first offset value and the second offset value;

[0190] The rotation processing subunit is used to perform rotation processing on the UV coordinate offset value by using the UV rotation component to obtain the UV rotation value.

[0191] In some embodiments, the highlight component unit 305 includes:

[0192] A correction coordinate subunit, used for performing reverse offset processing on the UV rotation value to obtain a UV correction coordinate value;

[0193] The highlight component subunit is used to obtain the pixel point corresponding to the highlight map of the target shading surface in the virtual character's eye according to the UV corrected coordinate value, and obtain the highlight value of the pixel point, wherein the highlight value is the highlight component.

[0194] In some embodiments, the calculation result unit 306 includes:

[0195] A summing subunit, used for calculating the sum of the highlight component and the color value component;

[0196] The product subunit is used to calculate the product of the sum and the brightness value coefficient, and the product is the calculation result.

[0197] In some embodiments, the apparatus further comprises:

[0198] The color component unit is used to obtain the color value component of the target shading surface.

[0199] In some embodiments, the color component unit includes:

[0200] A target pixel subunit, used for obtaining a target pixel point corresponding to the two-dimensional image of the virtual character's eye of the target colored surface according to the UV coordinate value of the target colored surface;

[0201] The color value subunit is used to obtain the color value of a target pixel, where the color value is the color value component.

[0202] In some embodiments, the apparatus further comprises:

[0203] The brightness value unit is used to obtain the brightness value coefficient of the target colored surface.

[0204] In some embodiments, the brightness value unit includes:

[0205] A projection acquisition subunit, used to acquire a projection plane perpendicular to the standing direction of the virtual character;

[0206] A projection vector subunit, used to obtain a projection vector of the illumination direction on the projection plane;

[0207] A projection normalization subunit, used for normalizing the projection vector to obtain a projection normalized vector;

[0208] A point multiplication subunit, configured to perform a point multiplication operation on the projected normalized vector and the character forward unit vector to obtain a point multiplication result, wherein the character forward unit vector is a unit vector corresponding to the direction in which the virtual character is facing;

[0209] The brightness mapping subunit is used to obtain the mapping result of the dot product result in the brightness interval, and the mapping result is the brightness value coefficient.

[0210] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.

[0211] From the above, it can be seen that the obtained highlight component can carry information such as the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point. Therefore, the highlights in the virtual character's eyes obtained after rendering can be rotated along the eye periphery under the influence of the virtual character's orientation, the viewing angle orientation, the lighting direction, and the current time point.

[0212] The embodiments of the present application can make the eyes of the virtual character more lively, thereby enhancing the player's interest in playing the game and improving the user stickiness of the player user.

[0213] The embodiment of the present application also provides an electronic device, which can be a terminal, a server, etc. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc. The server can be a single server or a server cluster composed of multiple servers, etc.

[0214] In some embodiments, the virtual character eye rendering device may also be integrated into multiple electronic devices. For example, the virtual character eye rendering device may be integrated into multiple servers, and the virtual character eye rendering method of the present application may be implemented by multiple servers.

[0215] In this embodiment, the electronic device of this embodiment is an electronic device as an example for detailed description, for example, Figure 4 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:

[0216] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, an input module 404, and a communication module 405. Those skilled in the art will appreciate that Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0217] The processor 401 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402 and calling data stored in the memory 402, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. In some embodiments, the processor 401 may include one or more processing cores; in some embodiments, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.

[0218] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0219] The electronic device also includes a power supply 403 for supplying power to various components. In some embodiments, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0220] The electronic device may further include an input module 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0221] The electronic device may further include a communication module 405. In some embodiments, the communication module 405 may include a wireless module. The electronic device may perform short-range wireless transmission through the wireless module of the communication module 405, thereby providing the user with wireless broadband Internet access. For example, the communication module 405 may be used to help the user send and receive emails, browse web pages, and access streaming media.

[0222] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:

[0223] The UV coordinate value of the target shading surface is obtained, and the UV coordinate value of the target shading surface is offset to obtain the UV coordinate offset value, wherein the target shading surface is any one of the multiple planes included in the three-dimensional model of the eye of the virtual character; a first offset value of the UV coordinate value is calculated according to the virtual character orientation vector, the viewing angle orientation vector and the illumination direction vector; a second offset value of the UV coordinate value is calculated according to the current time point and the UV coordinate offset value; a UV rotation value is calculated according to the first offset value, the second offset value and the UV coordinate offset value; a reverse offset process is performed on the UV rotation value to obtain the highlight component of the target shading surface, wherein the reverse offset process is opposite to the offset direction of the offset process and the offset distance is equal; a calculation result of the target shading surface is obtained according to the highlight component, the color value component of the target shading surface and the brightness value coefficient of the target shading surface; the target shading surface is rendered according to the calculation result to obtain a rendering result.

[0224] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0225] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0226] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any of the virtual character eye rendering methods provided in the embodiments of the present application. For example, the instructions can execute the following steps:

[0227] The UV coordinate value of the target shading surface is obtained, and the UV coordinate value of the target shading surface is offset to obtain the UV coordinate offset value, wherein the target shading surface is any one of the multiple planes included in the three-dimensional model of the eye of the virtual character; a first offset value of the UV coordinate value is calculated according to the virtual character orientation vector, the viewing angle orientation vector and the illumination direction vector; a second offset value of the UV coordinate value is calculated according to the current time point and the UV coordinate offset value; a UV rotation value is calculated according to the first offset value, the second offset value and the UV coordinate offset value; a reverse offset process is performed on the UV rotation value to obtain the highlight component of the target shading surface, wherein the reverse offset process is opposite to the offset direction of the offset process and the offset distance is equal; a calculation result of the target shading surface is obtained according to the highlight component, the color value component of the target shading surface and the brightness value coefficient of the target shading surface; the target shading surface is rendered according to the calculation result to obtain a rendering result.

[0228] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0229] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations provided in the above embodiments.

[0230] Since the instructions stored in the storage medium can execute the steps in any virtual character eye rendering method provided in the embodiments of the present application, the beneficial effects that can be achieved by any virtual character eye rendering method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0231] The above is a detailed introduction to a virtual character eye rendering method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for rendering virtual character eyes, characterized in that: The method comprises: Acquire UV coordinate values ​​of a target colored surface, and perform offset processing on the UV coordinate values ​​of the target colored surface to obtain UV coordinate offset values, wherein the target colored surface is any one of a plurality of planes included in the three-dimensional model of the eyes of the virtual character; Calculate a first offset value of the UV coordinate value according to the virtual character's orientation vector, the viewing angle orientation vector, and the illumination direction vector; Obtaining a decimal part of the current time point, and multiplying the decimal part by a preset influence coefficient to obtain a time increment; Adding the U coordinate value and the V coordinate value of the UV coordinate offset value to the time increment to obtain a UV coordinate increment value; Obtaining the pixel point corresponding to the UV coordinate increment value in the two-dimensional image of the virtual character's eye, obtaining the noise value of the pixel point, and obtaining the product of the noise value and the noise intensity parameter, wherein the product of the noise value and the noise intensity parameter is the second offset value; Calculating a UV rotation value according to the first offset value, the second offset value, and the UV coordinate offset value; Performing reverse offset processing on the UV rotation value to obtain the highlight component of the target colored surface, wherein the reverse offset processing is opposite to the offset processing in offset direction and the offset distance is equal to that of the offset processing; Obtaining a calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface; The target shading surface is rendered according to the calculation result to obtain a rendering result.

2. The method according to claim 1, characterized in that The calculating the first offset value of the UV coordinate value according to the virtual character orientation vector, the viewing angle orientation vector and the illumination direction vector comprises: Acquire a virtual character orientation vector, an observation angle orientation vector, and a lighting direction vector, and normalize the virtual character orientation vector, the observation angle orientation vector, and the lighting direction vector to obtain a virtual character orientation normalized vector, an observation angle orientation normalized vector, and a lighting direction normalized vector; Calculating a weighted sum of the virtual character's normalized orientation vector, the observation angle orientation normalized vector, and the illumination direction normalized vector; The absolute value of the weighted sum is taken to obtain the first offset value.

3. The method according to claim 1, characterized in that The calculating the UV rotation value according to the first offset value, the second offset value and the UV coordinate offset value includes: Calculating a UV rotation component according to the first offset value and the second offset value; The UV rotation component is used to rotate the UV coordinate offset value to obtain the UV rotation value.

4. The method according to claim 1, characterized in that The reverse offsetting process is performed on the UV rotation value to obtain the highlight component of the target colored surface, including: Performing reverse offset processing on the UV rotation value to obtain a UV correction coordinate value; According to the UV corrected coordinate value, the pixel point corresponding to the highlight map of the virtual character's eye on the target shading surface is obtained, and the highlight value of the pixel point is obtained, and the highlight value is the highlight component.

5. The method according to claim 1, characterized in that The step of obtaining a calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface comprises: Calculate the sum of the highlight component and the color value component; The product of the sum and the brightness value coefficient is calculated, and the product is the calculation result.

6. The method according to claim 1, characterized in that Before obtaining the calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface, the method further includes: Gets the color value component of the target shading surface.

7. The method according to claim 6, characterized in that The step of obtaining the color value component of the target colored surface includes: According to the UV coordinate value of the target colored surface, obtaining the target pixel point corresponding to the two-dimensional image of the eye of the virtual character of the target colored surface; Get the color value of the target pixel, where the color value is the color value component.

8. The method according to claim 1, characterized in that Before obtaining the calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface, the method further includes: Get the brightness value coefficient of the target colored surface.

9. The method according to claim 8, characterized in that The step of obtaining the brightness value coefficient of the target colored surface includes: Acquire a projection plane perpendicular to the standing direction of the virtual character; Obtaining a projection vector of the illumination direction on the projection plane; Normalizing the projection vector to obtain a projection normalized vector; Performing a dot product operation on the projected normalized vector and the character's forward unit vector to obtain a dot product result, wherein the character's forward unit vector is a unit vector corresponding to the direction in which the virtual character is facing; A mapping result of the dot product result in a brightness range is obtained, where the mapping result is the brightness value coefficient.

10. A virtual character eye rendering device, characterized in that: The device comprises: an offset processing unit, used to obtain a UV coordinate value of a target colored surface, and perform an offset processing on the UV coordinate value of the target colored surface to obtain a UV coordinate offset value, wherein the target colored surface is any one of a plurality of planes included in the three-dimensional model of the eye of the virtual character; A first offset calculation unit, used for calculating a first offset value of the UV coordinate value according to a virtual character orientation vector, an observation angle orientation vector and a light direction vector; The second offset calculation unit is used to obtain the decimal part of the current time point, and multiply the decimal part by a preset influence coefficient to obtain a time increment; add the U coordinate value and the V coordinate value of the UV coordinate offset value to the time increment to obtain a UV coordinate increment value; obtain the pixel point corresponding to the UV coordinate increment value in the two-dimensional image of the virtual character's eye, obtain the noise value of the pixel point, and obtain the product of the noise value and the noise intensity parameter, wherein the product of the noise value and the noise intensity parameter is the second offset value; A UV rotation calculation unit, configured to calculate a UV rotation value according to the first offset value, the second offset value and the UV coordinate offset value; A highlight component unit, used for performing reverse offset processing on the UV rotation value to obtain the highlight component of the target colored surface, wherein the reverse offset processing is opposite to the offset processing in offset direction and the offset distance is equal; A calculation result unit, used for obtaining a calculation result of the target colored surface according to the highlight component, the color value component of the target colored surface, and the brightness value coefficient of the target colored surface; A rendering result unit is used to render the target shading surface according to the calculation result to obtain a rendering result.

11. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the virtual character eye rendering method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the method for rendering eyes of a virtual character according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Stereoscopic rendering to eye positions

    CN106415364A

  • Image generation method and device, storage medium and electronic device

    CN111179396A