Virtual character pupil processing method, device, equipment and storage medium

Virtual space mapping and ray tracing calculations are performed through the eye pupil model of the virtual character to generate pupil iris patterns, solving the problem of realism and inefficiency in pupil processing of virtual characters, and achieving efficient and realistic 3D effects.

CN114972613BActive Publication Date: 2024-12-06GUANGZHOU SHIWEI INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210457272.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-28
Publication Date
2024-12-06
Estimated Expiration
2042-04-28

AI Technical Summary

Technical Problem

In the prior art, virtual character pupil processing methods are difficult to achieve a balance between reality and efficiency. The plane drawing method lacks a 3D perspective relationship, and the efficiency and effect of the model calculation method are not satisfied enough.

Method used

By creating the eye pupil model of the virtual character, performing virtual space mapping and ray tracing calculations, determining the ray tracing direction and starting point, and using ray tracing technology to generate pupil iris patterns to achieve the 3D effect of the pupil.

Benefits of technology

It realizes a stronger 3D perspective relationship and realism in the pupils of virtual characters, and improves efficiency. It is more realistic than the plane drawing method and more efficient than the model calculation method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114972613B_ABST
    Figure CN114972613B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, equipment and storage medium for pupil processing of a virtual character. The method comprises: creating a pupil model of the virtual character's eye; performing virtual space mapping on the pupil model to determine the boundary of the virtual space of the mapped pupil model; after determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing, performing ray tracing calculation on the virtual space to obtain the pupil iris pattern. The solution provided by the present application can more conveniently achieve the 3D effect of the pupil iris of the virtual character.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, equipment and storage medium for processing pupils of a virtual character. Background Art

[0002] In the three-dimensional animation of the game, virtual characters are usually included. At present, the generation of virtual character images in game development is one of the concerns of players, and in the generation of virtual character images, the generation of virtual character eye images is particularly important.

[0003] In the related art, the drawing methods for the pupil and iris of the eyes of virtual characters include two methods: plane drawing and model calculation. Among them, the plane drawing method is widely used for 2D virtual characters and is also adopted by most 3D virtual characters; the model calculation method is mainly used for 3D virtual characters.

[0004] For the plane drawing method, the effect is the drawing effect, which can efficiently achieve the 2D plane effect desired by the painter, but the expression of 3D perspective relationship is weak and lacks realism; for the model calculation method, the effect is a series of calculations related to the model and shader rendering code to present a more realistic effect, but for painters or characters that prefer a 2D sense, neither the efficiency nor the effect can meet the requirements.

[0005] Therefore, the pupil processing method of virtual characters in the related art needs to be improved. Summary of the invention

[0006] In order to solve or partially solve the problems existing in the related art, the present application provides a pupil processing method, device, equipment and storage medium for a virtual character, which can more conveniently achieve the 3D effect of the pupil and iris of the virtual character.

[0007] The first aspect of the present application provides a method for processing pupils of a virtual character, comprising:

[0008] Create pupil models for the avatar's eyes;

[0009] Performing virtual space mapping on the pupil model to determine a boundary of the virtual space of the mapped pupil model;

[0010] After determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing, a ray tracing calculation is performed on the virtual space to obtain the pupil iris pattern.

[0011] In one embodiment, after determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing, performing ray tracing calculation on the virtual space to obtain the pupil iris pattern includes:

[0012] Determine the vector of the ray tracing direction and set the starting and ending points of the ray tracing;

[0013] Performing setting processing using the vector of the ray tracing direction, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point;

[0014] According to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations, ray tracing calculation is performed on the virtual space to obtain the pupil iris pattern.

[0015] In one embodiment, the setting process using the vector of the ray tracing direction, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point includes:

[0016] Determining the limit values ​​of the ray tracing volume on each axis of the virtual space;

[0017] According to the comparison result of the limit values ​​of each axis, a maximum boundary range value of the ray tracing volume and a minimum boundary range value of the ray tracing volume are determined;

[0018] A setting operation is performed according to the maximum boundary range value of the ray tracing volume, the minimum boundary range value of the ray tracing volume, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point.

[0019] In one embodiment, performing ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations to obtain the pupil iris pattern includes:

[0020] Calculate the ray tracing iteration step length according to the set ray tracing iteration number;

[0021] According to the actual position of the starting point, the actual position of the ending point, the number of ray tracing iterations, and the ray tracing iteration stride length, ray tracing calculation is performed on the virtual space to obtain a pupil iris pattern.

[0022] In one embodiment, performing ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point, the number of ray tracing iterations, and the ray tracing iteration stride length to obtain the pupil iris pattern includes:

[0023] Using the actual position of the starting point as a shading position, wherein the shading position increases by the ray tracing iteration stride length after each iteration;

[0024] In each iteration of the ray tracing calculation, the color gradient map is sampled in the T-axis direction of the shading position as the color value Gradient;

[0025] When the maximum value of the color value Gradient is greater than 0, the RS axial plane sampling shape graph of the shading position is used as the shape value Shape;

[0026] Performing a set operation according to the color value Shape and the shape value Gradient to obtain a color pattern result Color;

[0027] The color pattern results Color of all iterations are added together to obtain the pupil iris pattern.

[0028] In one embodiment, performing a setting operation according to the color value Shape and the shape value Gradient to obtain a color pattern result Color includes:

[0029] When the color value Gradient and the shape value Shape each include at least two;

[0030] Multiplying the different color values ​​Gradient and the different shape values ​​Shape respectively to obtain at least two groups of multiplied data;

[0031] The at least two groups of multiplied data are added together to obtain a color pattern result Color.

[0032] A second aspect of the present application provides a pupil processing device for a virtual character, comprising:

[0033] A creation module for creating a pupil model of the virtual character's eyes;

[0034] A mapping module, used to perform virtual space mapping on the pupil model and determine the boundary of the virtual space of the pupil model after mapping;

[0035] The tracing module is used to perform ray tracing calculation on the virtual space to obtain the pupil iris pattern after determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing.

[0036] In one embodiment, the tracking module includes:

[0037] The initial setting module is used to determine the vector of the ray tracing direction and set the starting point and the ending point of the ray tracing;

[0038] A position processing module, using the vector of the ray tracing direction, the starting point and the ending point to perform setting processing to obtain the actual position of the starting point and the actual position of the ending point;

[0039] The tracing calculation module is used to perform ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations to obtain the pupil iris pattern.

[0040] A third aspect of the present application provides a computing device, including:

[0041] Processor; and

[0042] The memory stores executable codes thereon, and when the executable codes are executed by the processor, the processor is caused to execute the method as described above.

[0043] A fourth aspect of the present application provides a computer-readable storage medium having executable code stored thereon, which, when executed by a processor of a computing device, causes the processor to execute the method as described above.

[0044] The technical solution provided by this application may have the following beneficial effects:

[0045] The technical solution of the present application, after creating the pupil model of the virtual character's eye, performs virtual space mapping on the pupil model to determine the boundary of the virtual space of the mapped pupil model; then, after determining the vector of the ray tracing direction and setting the starting point and ending point of the ray tracing, performs ray tracing calculations on the virtual space to obtain the pupil iris pattern. By using ray tracing technology to perform ray tracing calculations on the virtual space after the pupil model is mapped to obtain the pupil iris pattern, the 3D effect of the pupil iris of the virtual character can be achieved more quickly and conveniently. Compared with the planar drawing method of the related art, the pupil of the present application has a stronger 3D perspective relationship and a stronger sense of reality; compared with the model calculation method of the related art, the present application is more efficient and has better effects.

[0046] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The above and other objects, features and advantages of the present application will become more apparent by describing in more detail exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present application.

[0048] Figure 1 is a flowchart of a method for processing pupils of a virtual character shown in an embodiment of the present application;

[0049] Figure 2 is another flowchart of the method for processing pupils of a virtual character shown in an embodiment of the present application;

[0050] Figure 3 is a schematic diagram of creating a pupil model in the pupil processing method shown in an embodiment of the present application;

[0051] Figure 4 is a schematic diagram of a sampled color gradient map in a pupil processing method shown in an embodiment of the present application;

[0052] Figure 5 is a schematic diagram of a sampling shape graph in a pupil processing method shown in an embodiment of the present application;

[0053] Figure 6 is a schematic diagram of a pupil iris pattern obtained in the pupil processing method shown in an embodiment of the present application;

[0054] Figure 7 is a schematic diagram of the structure of a pupil processing device for a virtual character shown in an embodiment of the present application;

[0055] Figure 8 It is a schematic diagram of the structure of a computing device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0057] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0058] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0059] The embodiment of the present application provides a method for processing the pupil of a virtual character, which can more conveniently achieve a 3D effect of the pupil and iris of the virtual character.

[0060] The pupil processing method provided in the embodiment of the present application can be executed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA), etc. The terminal can also include a client, which can be a game application client, a browser client carrying a game program, or an instant messaging client, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0061] The technical solution of the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0062] Figure 1 It is a flowchart of a pupil processing method for a virtual character shown in an embodiment of the present application.

[0063] See also Figure 1 , the method comprising:

[0064] S101. Create a pupil model of the virtual character's eyes.

[0065] This step can create a pupil model of the virtual character's eye through relevant software with model resources, wherein the pupil model can be set to a set size.

[0066] S102: Perform virtual space mapping on the pupil model to determine the boundary of the virtual space of the mapped pupil model.

[0067] The virtual space of the present application is also a 3D space, which can be recorded as RST space. For example, based on the origin coordinate (0, 0, 0) of the RST space, the virtual boundary range limit values ​​of the virtual space are set as B0 (-1, -1, -1) and B1 (1, 1, 1).

[0068] S103: After determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing, perform ray tracing calculation on the virtual space to obtain the pupil iris pattern.

[0069] The step S103 may include:

[0070] 1) Determine the vector of the ray tracing direction and set the starting and ending points of the ray tracing;

[0071] 2) Using the vector of the ray tracing direction, the starting point and the ending point for setting processing, the actual position of the starting point and the actual position of the ending point are obtained;

[0072] 3) According to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations, ray tracing calculations are performed on the virtual space to obtain the pupil iris pattern.

[0073] Among them, setting processing is performed using the vector of the ray tracing direction, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point, including: determining the limit values ​​of each axis of the ray tracing volume in the virtual space; determining the maximum boundary range value of the ray tracing volume and the minimum boundary range value of the ray tracing volume based on the comparison results of the limit values ​​of each axis; performing setting operations based on the maximum boundary range value of the ray tracing volume, the minimum boundary range value of the ray tracing volume, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point.

[0074] Among them, according to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations, ray tracing calculations are performed on the virtual space to obtain the pupil iris pattern, including: calculating the ray tracing iteration step length according to the set number of ray tracing iterations; according to the actual position of the starting point, the actual position of the ending point, the number of ray tracing iterations, and the ray tracing iteration step length, ray tracing calculations are performed on the virtual space to obtain the pupil iris pattern.

[0075] For example, the actual position of the starting point can be used as the shading position, where the shading position increases the ray tracing iteration step length after each iteration; in each iteration of the ray tracing calculation, the color gradient map is sampled in the T-axis direction of the shading position as the color value Gradient; when the maximum value of the color value Gradient is greater than 0, the shape map is sampled in the RS-axis plane of the shading position as the shape value Shape; according to the color value Shape and the shape value Gradient, a set operation is performed to obtain a color pattern result Color; the color pattern result Color of all iterations is added to obtain the pupil iris pattern.

[0076] It should be noted that after obtaining the pupil iris pattern, that is, the result of ray tracing, the pupil can be rendered according to the pupil iris pattern to display the pupil image of the virtual character's eye.

[0077] It can be seen from this embodiment that the technical solution shown in the embodiment of the present application, after creating the pupil model of the virtual character's eye, performs virtual space mapping on the pupil model, and determines the boundary of the virtual space of the mapped pupil model; then after determining the vector of the ray tracing direction and setting the starting point and end point of the ray tracing, performs ray tracing calculations on the virtual space to obtain the pupil iris pattern. By using ray tracing technology to perform ray tracing calculations on the virtual space after the pupil model is mapped to obtain the pupil iris pattern, the 3D effect of the pupil iris of the virtual character can be achieved more quickly and conveniently. Compared with the planar drawing method of the related art, the pupil of the present application scheme has a stronger 3D perspective relationship and a stronger sense of reality; compared with the model calculation method of the related art, the present application scheme is more efficient and has better effects.

[0078] Figure 2 It is another flowchart of the pupil processing method of a virtual character shown in an embodiment of the present application. Figure 2 Relative to Figure 1 The solution of the present application is described in more detail. The solution of the embodiment of the present application can be used to improve the 2D artistic effect of the pupil and iris of a 3D virtual character, and to improve the perspective effect of the pupil and iris of a virtual character while retaining the 2D drawing efficiency.

[0079] See also Figure 2 , the method comprising:

[0080] S201, creating a pupil model of a set size for the virtual character's eyes.

[0081] This step can create a pupil model of the virtual character's eye through relevant software with model resources, wherein the pupil model can be set to a set size, for example, to a set proportional size. The pupil model can be set based on the XYZ space. The pupil model can be found in Figure 3 As shown. For example, the pupil model can be created using Unity software but is not limited to this. Unity is a 3D / 2D game engine and a powerful cross-platform IDE (Integrated Development Environment) for developers. Unity can provide many of the most important built-in functions to make the game run properly.

[0082] The pupil model created in this step can be a three-dimensional model. A three-dimensional model is a polygonal representation of an object, usually displayed by a computer or other video device. The displayed object can be a real-world entity or a fictional object. The use of three-dimensional models in the video game industry can provide a more realistic gaming experience.

[0083] S202: Perform virtual space mapping on the pupil model to determine the boundary of the virtual space of the mapped pupil model.

[0084] In 3D space, the XYZ coordinate system is usually used to represent the spatial axis. In the embodiment of the present application, the virtual space range is calculated based on the back direction of the pupil model in the XYZ space (for example, the -Z direction in the present application). The virtual space is also a 3D space. To distinguish it from the XYZ space, the present application records it as RST space (including R axis, S axis, and T axis).

[0085] For the convenience of calculation, the present application can set the height unit distance and width unit distance of the pupil to 1, and define the depth of the pupil as 1, that is, the width vector in the RST space is (1, 0, 0), the height vector is (0, 1, 0), and the depth vector is (0, 0, 1).

[0086] Then, based on the origin coordinate position (0, 0, 0) of the RST space, the virtual boundary range limit values ​​of the virtual space are set to B0 (-1, -1, -1) and B1 (1, 1, 1) respectively.

[0087] S203, determine the vector of the ray tracing direction and set the starting point and the ending point of the ray tracing.

[0088] Ray tracing technology uses algorithms to simulate the physical properties of light in the real world. It can achieve physically accurate shadows, reflections and refractions, as well as global illumination, making objects in the game more realistic in virtual game scenes. Ray tracing generates images by tracing the path of light in units of pixels in the pixel plane and simulating the effect of its encounter with virtual objects. Ray tracing can produce a high degree of visual realism and is widely used in computer-generated still images and film and television visual effects.

[0089] 1) A vector that determines the direction of the ray tracing.

[0090] This application sets the ray tracing ray direction to the negative direction of the viewpoint position (observation camera position) C in the RST space, denoted as vector D (also called direction vector D).

[0091] Among them, the viewpoint position is custom data, and the game engine can convert and use the custom data, but the game engine itself does not contain the viewpoint position. Usually, the game engine will provide a default lens. This operation can be understood as the game engine providing a default custom data to represent the viewpoint position, and the default position can be adjusted, replaced, or abandoned. The viewpoint position in this application can be understood as "any custom data set as the viewpoint position", not just the default lens position of the game engine.

[0092] Among them, the viewpoint position C is in the negative direction of the RST space, which can be understood as a vector. Its vector direction is the position of the camera lens, and this position is in a three-dimensional space coordinate system. The axis of this three-dimensional space coordinate system is not the XYZ axis but the RST axis. Assuming that the vector is described as C (r: 1, s: 1, t: 1), its negative direction is -C (r: -1, s: -1, t: -1), that is, the vector D = -C of the ray tracing direction.

[0093] 2) Set the starting and ending points of ray tracing.

[0094] This application can set the starting point P0 and the ending point P1 of the ray tracing calculation. P0 and P1 can be set arbitrarily. In this step, P0 and P1 have no actual values ​​yet. At this time, they are both empty values, and actual values ​​will be filled in the subsequent steps.

[0095] S204, performing setting processing using the vector of the ray tracing direction, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point.

[0096] 1) Determine the limits of the ray tracing volume on each axis in virtual space.

[0097] Set the maximum and minimum values ​​of each axis of the ray tracing volume based on the RST space. The set spatial range of the RST space can be called the ray tracing volume. Taking the R axis as an example, the axial maximum and minimum values ​​can be recorded as Trmax and Trmin. The same is true for the S and T axes. The axial maximum and minimum values ​​of the S axis are recorded as Tsmax and Tsmin, and the axial maximum and minimum values ​​of the T axis are recorded as Ttmax and Ttmin.

[0098] 2) Based on the comparison results of the limit values ​​of each axis, determine the maximum boundary range value Tmax and the minimum boundary range value Tmin of the ray tracing volume.

[0099] The center coordinates of the RST space are (0, 0, 0). Vector D will have a vector value in the RST space, and this value will change with the position of the observation camera. However, the value of vector D is not necessarily greater than 0 on all three axes R / S / T, because the observation camera can be set and moved at will, which means that it is entirely possible that the value of one or more axes of vector D is negative.

[0100] In this application, the three axes of the RST space of the vector D are judged to be greater than 0, and the vector modulus from the boundary to the observation camera position and the percentage of the D vector modulus are compared each time. Taking the R axis as an example, if the axis is greater than 0, (B0-C) / D is the minimum value of the R axis, denoted as Trmin; (B1-C) / D is the maximum value of the R axis, denoted as Trmax. If the axis is less than 0, (B1-C) / D is the minimum value of the R axis, denoted as Trmin; (B0-C) / D is the maximum value of the R axis, denoted as Trmax. The maximum and minimum axial values ​​of the S axis and T axis can be obtained in the same way.

[0101] It should be noted that in game rendering, the concept of coloring is involved. The so-called coloring is a layer-by-layer superposition, which can be understood as drawing a stroke on a piece of paper. If the second stroke is superimposed on the first stroke, an overlapping relationship will be generated. Regardless of whether the second stroke is transparent or opaque, it is on the upper layer of the first stroke from a spatial relationship. Therefore, according to the concept of coloring, it can be simply understood that the boundary points B0 and B1 set previously are a spatial drawing paper. If the observation direction of the observation camera is in the positive direction in the RST space, the bottom layer is the limit value of its negative direction, that is, B0, and when the observation direction is in the negative direction, the limit value of the bottom layer is B1. Among them, B0-C is the vector modulus from the negative boundary to the positive observation camera position. At this time, the positive observation camera position can be understood as that the vector axes of the observation camera position are positive in the RST space. If one or more of the vector axes of the observation camera position are negative, the negative axis is calculated using B1-C. Because the observation camera C is custom data, C and D in the formula are variables and there will be no actual fixed values. Once C changes, D will change, and the corresponding other results will also change.

[0102] After obtaining the maximum and minimum values ​​of each axis of the ray tracing volume, compare the minimum values ​​of each axis, namely Trmin, Tsmin and Ttmin, and take the maximum value as the minimum boundary range value Tmin of the ray tracing volume. Similarly, compare the maximum values ​​of each axis, namely Trmax, Tsmax and Ttmax, and take the minimum value as the maximum boundary range value Tmax of the ray tracing volume.

[0103] It should be noted that B0 to B1 is a fixed range of the RST space, which does not change with C and D, while Tmin and Tmax will change with C and D.

[0104] 3) Perform setting operations based on the maximum boundary range value Tmax of the ray tracing volume, the minimum boundary range value Tmin of the ray tracing volume, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point.

[0105] Among them, the actual starting position of the starting point P0 is calculated according to the following formula: C+D*Tmin;

[0106] The actual position of the end point P1 is calculated according to the following formula: C+D*Tmax.

[0107] That is to say, the actual position of the starting point is obtained by multiplying the vector D with the minimum boundary range value Tmin of the ray tracing volume and adding it to the viewpoint position C; the actual position of the ending point is obtained by multiplying the vector D with the maximum boundary range value Tmax of the ray tracing volume and adding it to the viewpoint position C.

[0108] S205 , performing ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations to obtain a pupil iris pattern.

[0109] 1) Set the number of ray tracing iterations SC.

[0110] The number of times of the SC can be customized, for example, 128 but not limited thereto.

[0111] 2) Based on the number of iterations SC, calculate the actual iteration step length Step of ray tracing.

[0112] The calculation formula of the iteration step length Step is:

[0113] Step=(P1-P0) / (SC-1)

[0114] That is to say, after subtracting the actual position of the end point P1 from the actual starting position of the starting point P0, the result is divided by the difference between the number of iterations SC and 1 to obtain the iteration stride length Step.

[0115] 3) Based on the actual position of the starting point, the actual position of the ending point, the number of iterations SC, and the iteration step length Step, perform optical tracking iterative calculation.

[0116] 31) The actual position of the starting point is used as the shading position, where the shading position increases by the ray tracing iteration stride length after each iteration.

[0117] The present application can set the actual coloring position P, and set the actual coloring position P to P0. Setting P to P0 means that the next P will be superimposed on the current P.

[0118] Then, based on the number of iterations SC and the iteration step length Step, the optical tracking iteration calculation is performed. After each iteration, the actual shading position P needs to be added with the iteration step length Step.

[0119] 32) Sample the color gradient image to obtain the color value Gradient.

[0120] In each iteration, a color gradient image is sampled in the T-axis direction of the actual shading position P (see Figure 4 As shown in Figure 2, the gradient is the color value (color basis) of the T axis. The gradient is the color value of the T axis. The color value is usually represented by the set [0, 1], where 0 is the darkest and 1 is the whitest. Figure 4 The color gradients shown are for illustrative purposes only and may be replaced at will.

[0121] Sampling refers to the method of mapping a 2D image or a set of 3D data into a 3D space through UVW. Generally, based on the coordinate value of UVW space, the corresponding 2D image or 3D data is calculated through the space matrix and the result is converted into XYZ space, which is called UVW mapping. Similarly, UV mapping refers to mapping only the U and V axes, which is usually used to process 2D image mapping.

[0122] In the UV mapping sampled and used in this application, one axis is the T-axis direction, and the other axis is custom data. The so-called custom data can be set arbitrarily, but it does not represent any color. The color data depends on the data in the figure corresponding to the UV mapping. Because the T-axis direction is bound to an axis in the UV mapping, the other axis can be custom data. In other words, assuming that the data of the rows or columns of the data of this figure is preset, you can select which row or column of data to output as the T-axis color value based on the custom data. In the embodiment of the present application, the T-axis is used as the U-axis in the UV mapping.

[0123] In the embodiment of the present application, a set number of color value gradients can be sampled, for example, 4, and the names are distinguished by suffix numbers, and are respectively recorded as Gradient1, Gradient2, Gradient3, and Gradient4.

[0124] 33) Sample the shape graph to obtain the shape value Shape.

[0125] After comparing the color values ​​Gradient1, Gradient2, Gradient3, and Gradient4, take the maximum value as the total color value GradientTotal, where the maximum value is the brightest color value in a row or column of the color gradient map. If the color GradientTotal is greater than 0, sample a shape map along the RS axis plane of the actual shading position P (see Figure 5 As shown in Figure 2, the shape value (shape basis) Shape is used. It should be noted that Figure 5 The shapes shown are for illustration purposes only and may be substituted at will.

[0126] Among them, the UV mapping used for sampling corresponds to the two axes of RS. The total color value GradientTotal obtained by comparison in the previous step is the result of taking the maximum value of the color values ​​Gradient1, Gradient2, Gradient3, and Gradient4, that is, the color value collection of each point on the T axis. Although this collection takes the maximum value, it does not mean that Gradient1, Gradient2, Gradient3, and Gradient4 must have a value at a certain position in the gradient map, that is, there may be a point or a section of value on the T axis that is 0; and whether the total color value GradientTotal is 0 is directly related to whether the shape map is sampled at a certain position on the T axis. Because the shape map is a 2D data map, UV mapping is required, and UV mapping requires corresponding UV two axes. Therefore, in the current RST space, the T axis is used as a judgment on whether to sample the shape map, and the data of the two RS axes are used as the value of the UV axis used to sample the shape map when the GradientTotal of the T axis has a value greater than 0.

[0127] In the embodiment of the present application, a set number of shape values ​​Shape can be sampled, for example, the number is 4, and the names are distinguished by suffix numbers, respectively recorded as Shape1, Shape2, Shape3, and Shape4. It should be noted that the number of Gradient and Shape can be defined arbitrarily, and can generally be selected to be equal.

[0128] 34) Perform set operations based on the color value Shape and the shape value Gradient to obtain the color pattern result Color.

[0129] Multiply the Shape and Gradient results with the corresponding digital suffixes, such as Shape1*Gradient1. After obtaining multiple sets of data, such as 4 sets of data, add them all together to get the final output color result Color. After the result is output, one iteration is completed.

[0130] Because the actual result of Shape is a pattern, and Gradient is a color, multiplying the results of Shape and Gradient can be understood as applying the color of Gradient to a certain pattern Shape. The final result is a colored pattern, not a pure color.

[0131] 35) Add all the iterated color pattern results Color to obtain the pupil iris pattern.

[0132] Add all the iterated color pattern results Color to get the pupil iris pattern (see Figure 6In other words, it can be understood as the color superposition of multiple Shapes, and the superimposed pattern is a new pattern that contains the characteristics of all Shape patterns.

[0133] It should be noted that after obtaining the pupil iris pattern, that is, the result of ray tracing, the pupil can be rendered according to the pupil iris pattern to display the pupil image of the virtual character's eye.

[0134] As can be seen from this embodiment, the embodiment of the present application performs virtual space mapping on the pupil model to obtain a virtual space recorded as RST space. In the current RST space, a color gradient image is sampled in the T-axis direction of the actual shading position P as the color value in each iterative calculation, and when the GradientTotal of the T-axis appears to be greater than 0, the data of the two RS axes sample a shape image in the RS-axis plane of the actual shading position P as the shape value Shape. Then, the setting operation can be performed according to the color value Shape and the shape value Gradient to obtain the color pattern result Color; all the iterative color pattern results Color are added together to obtain the pupil iris pattern, so as to use ray tracing technology to more quickly and conveniently achieve the 3D effect of the pupil iris of the virtual character.

[0135] Corresponding to the aforementioned application function implementation method embodiment, the present application also provides a pupil processing device for a virtual character, a computing device and corresponding embodiments.

[0136] Figure 7 It is a structural schematic diagram of a pupil processing device for a virtual character shown in an embodiment of the present application.

[0137] See also Figure 7 , a pupil processing device 70 for a virtual character provided in an embodiment of the present application includes: a creation module 71, a mapping module 72, and a tracking module 73.

[0138] The creation module 71 is used to create a pupil model of the virtual character's eyes.

[0139] The mapping module 72 is used to perform virtual space mapping on the pupil model and determine the boundary of the virtual space of the mapped pupil model.

[0140] The tracing module 73 is used to perform ray tracing calculations on the virtual space to obtain pupil iris patterns after determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing.

[0141] The tracking module 73 may include: an initial setting module 731 , a position processing module 732 , and a tracking calculation module 733 .

[0142] An initial setting module 731, used to determine the vector of the ray tracing direction and to set the starting point and the ending point of the ray tracing;

[0143] The position processing module 732 performs setting processing using the vector of the ray tracing direction, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point;

[0144] The tracing calculation module 733 is used to perform ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations to obtain the pupil iris pattern.

[0145] Among them, the tracing calculation module 733 can determine the limit values ​​of each axis of the ray tracing volume in the virtual space; determine the maximum boundary range value of the ray tracing volume and the minimum boundary range value of the ray tracing volume based on the comparison results of the limit values ​​of each axis; perform setting operations based on the maximum boundary range value of the ray tracing volume, the minimum boundary range value of the ray tracing volume, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point.

[0146] Among them, the tracing calculation module 733 can calculate the ray tracing iteration step length according to the set ray tracing iteration number; perform ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point, the ray tracing iteration number, and the ray tracing iteration step length to obtain the pupil iris pattern.

[0147] The tracing calculation module 733 can use the actual position of the starting point as the shading position, where the shading position increases the ray tracing iteration step length after each iteration; in each iteration of the ray tracing calculation, the color gradient map is sampled in the T-axis direction of the shading position as the color value Gradient; when the maximum value of the color value Gradient is greater than 0, the shape map is sampled in the RS-axis plane of the shading position as the shape value Shape; set operations are performed according to the color value Shape and the shape value Gradient to obtain the color pattern result Color; the color pattern results Color of all iterations are added to obtain the pupil iris pattern.

[0148] When the color value Gradient and the shape value Shape include at least two respectively, different color values ​​Gradient and different shape values ​​Shape are correspondingly multiplied to obtain at least two groups of multiplied data; and at least two groups of multiplied data are added to obtain the color pattern result Color.

[0149] For example, a set number of color values ​​Gradient are recorded as Gradient1, Gradient2, Gradient3, and Gradient4 respectively; a set number of shape values ​​Shape are recorded as Shape1, Shape2, Shape3, and Shape4 respectively. Multiply the Shape and Gradient results with the corresponding digital suffixes, such as Shape1*Gradient1. After obtaining 4 sets of data, add them all together to obtain the final output color pattern result Color. After the result is output, one iteration is completed. Add all the iterated color pattern results Color to obtain the pupil iris pattern. After obtaining the pupil iris pattern, which is the result of ray tracing, the pupil can be rendered according to the pupil iris pattern to display the pupil image of the virtual character's eye.

[0150] The pupil processing device of the virtual character shown in the embodiment of the present application obtains the pupil iris pattern by using ray tracing technology to perform ray tracing calculation on the virtual space after the pupil model is mapped, which can more quickly and conveniently achieve the 3D effect of the pupil iris of the virtual character. Compared with the plane drawing method of the related art, the pupil of the present application has a stronger 3D perspective relationship and a stronger sense of reality; compared with the model calculation method of the related art, the efficiency and effect of the present application are also higher.

[0151] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated again here.

[0152] Figure 8 It is a schematic diagram of the structure of a computing device shown in an embodiment of the present application.

[0153] See also Figure 8 , the computing device 80 includes a memory 810 and a processor 820 .

[0154] The processor 820 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0155] The memory 810 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage. Among them, ROM can store static data or instructions required by the processor 820 or other modules of the computer. The permanent storage device may be a readable and writable storage device. The permanent storage device may be a non-volatile storage device that does not lose the stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large-capacity storage device (such as a magnetic or optical disk, flash memory) as a permanent storage device. In some other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, optical drive). The system memory may be a readable and writable storage device or a volatile readable and writable storage device, such as a dynamic random access memory. The system memory may store some or all instructions and data required by the processor at run time. In addition, the memory 810 may include any combination of computer-readable storage media, including various types of semiconductor storage chips (such as DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 810 may include a readable and / or writable removable storage device, such as a laser disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. The computer-readable storage medium does not include carrier waves and transient electronic signals transmitted wirelessly or wired.

[0156] The memory 810 stores executable codes, and when the executable codes are processed by the processor 820 , the processor 820 can execute part or all of the methods described above.

[0157] In addition, the method according to the present application may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing some or all of the steps in the above method of the present application.

[0158] Alternatively, the present application can also be implemented as a computer-readable storage medium (or non-transitory machine-readable storage medium or machine-readable storage medium) on which executable code (or computer program or computer instruction code) is stored. When the executable code (or computer program or computer instruction code) is executed by a processor of a computing device (or server, etc.), the processor executes part or all of the steps of the above-mentioned method according to the present application.

[0159] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for processing pupils of a virtual character, characterized in that: include: Create pupil models for the avatar's eyes; Performing virtual space mapping on the pupil model to determine a boundary of the virtual space of the mapped pupil model; After determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing, performing ray tracing calculation on the virtual space to obtain the pupil iris pattern; These include: Determine the vector of the ray tracing direction and set the starting and ending points of the ray tracing; Performing setting processing using the vector of the ray tracing direction, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point, including: determining the limit values ​​of each axis of the ray tracing volume in the virtual space, determining the maximum boundary range value of the ray tracing volume and the minimum boundary range value of the ray tracing volume according to the comparison results of the limit values ​​of each axis, performing setting operation according to the maximum boundary range value of the ray tracing volume, the minimum boundary range value of the ray tracing volume, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point; According to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations, ray tracing calculation is performed on the virtual space to obtain the pupil iris pattern.

2. The method according to claim 1, characterized in that The step of performing ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations to obtain the pupil iris pattern includes: Calculate the ray tracing iteration step length according to the set ray tracing iteration number; According to the actual position of the starting point, the actual position of the ending point, the number of ray tracing iterations, and the ray tracing iteration stride length, ray tracing calculation is performed on the virtual space to obtain a pupil iris pattern.

3. The method according to claim 2, characterized in that The step of performing ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point, the number of ray tracing iterations, and the ray tracing iteration stride length to obtain the pupil iris pattern includes: Using the actual position of the starting point as a shading position, wherein the shading position increases by the ray tracing iteration stride length after each iteration; In each iteration of the ray tracing calculation, the color gradient map is sampled in the T-axis direction of the shading position as the color value Gradient; When the maximum value of the color value Gradient is greater than 0, the RS axial plane sampling shape graph of the shading position is used as the shape value Shape; Performing a set operation according to the color value Shape and the shape value Gradient to obtain a color pattern result Color; The color pattern results Color of all iterations are added together to obtain the pupil iris pattern.

4. The method according to claim 3, characterized in that The setting operation is performed according to the color value Shape and the shape value Gradient to obtain the color pattern result Color, including: When the color value Gradient and the shape value Shape each include at least two; Multiplying the different color values ​​Gradient and the different shape values ​​Shape respectively to obtain at least two groups of multiplied data; The at least two groups of multiplied data are added together to obtain a color pattern result Color.

5. A pupil processing device for a virtual character, characterized in that: include: A creation module for creating a pupil model of the virtual character's eyes; A mapping module, used to perform virtual space mapping on the pupil model and determine the boundary of the virtual space of the pupil model after mapping; A tracing module is used to perform ray tracing calculation on the virtual space to obtain pupil iris patterns after determining the vector of the ray tracing direction and setting the starting point and the ending point of the ray tracing; wherein the tracing module includes: The initial setting module is used to determine the vector of the ray tracing direction and set the starting point and the ending point of the ray tracing; a position processing module, performing setting processing using the vector of the ray tracing direction, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point, including: determining the limit values ​​of each axis of the ray tracing volume in the virtual space, determining the maximum boundary range value of the ray tracing volume and the minimum boundary range value of the ray tracing volume according to the comparison results of the limit values ​​of each axis, performing setting operation according to the maximum boundary range value of the ray tracing volume, the minimum boundary range value of the ray tracing volume, the starting point and the ending point to obtain the actual position of the starting point and the actual position of the ending point; The tracing calculation module is used to perform ray tracing calculation on the virtual space according to the actual position of the starting point, the actual position of the ending point and the set number of ray tracing iterations to obtain the pupil iris pattern.

6. A computing device, characterized in that include: processor; as well as A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: An executable code is stored thereon, and when the executable code is executed by a processor of a computing device, the processor is caused to execute the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Virtual object eyeball simulation method and device and storage medium

    CN109903374A

  • Rendering method and device, storage medium and computer equipment

    CN112206517A