A character rendering method based on local-global feature enhancement and style fusion

By combining physics-based rendering and stylized rendering technology, using point cloud processing and feature extraction network models, the problem of poor lighting models and details in real-time rendering is solved, and good visual effects and stylized pictures under different lighting conditions are achieved.

CN119251378BActive Publication Date: 2025-04-18HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411348998.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-04-18
Estimated Expiration
2044-09-26

AI Technical Summary

Technical Problem

The prior art is difficult to maintain good visual effects under different lighting conditions in real-time rendering, and the lighting model and details are not performed well, resulting in different visual perceptions of objects in the scene.

Method used

Combining physics-based rendering and stylized rendering technology, the network model is extracted through data loading and initialization, point cloud processing, improved reflection intensity-assisted PCA method and the enhanced global-local point cloud geometric feature feature extraction, and the three-dimensional points of the character are reconstructed and rendered, realizing local-global feature enhancement and style fusion.

Benefits of technology

On the basis of retaining the character characteristics, good visual effects under different lighting conditions are achieved, and stylized pictures with characteristics are also solved, solving the problem of unsatisfactory lighting model and details.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119251378B_ABST
    Figure CN119251378B_ABST
Patent Text Reader

Abstract

The present invention discloses a character rendering method with local-global feature enhancement and style fusion, which specifically relates to the field of graphics rendering technology, including: data loading and initialization; data point clouding: converting the geometric information of a model into point cloud data and normalizing it to the same distribution; using an improved reflection intensity-assisted PCA method to evaluate the normal vector of each point in the point cloud; reconstructing the three-dimensional points of the character based on a network model that extracts the global-local point cloud geometric features; reversely restoring the point cloud information: linearly denormalizing the point cloud data to the original model coordinate range; rendering processing: completing the character's outline stroke, bump mapping, highlight item, diffuse reflection item, and self-luminous item rendering improvement based on physical and stylized fusion, and finally obtaining the corresponding style rendering effect after feature enhancement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of graphics rendering technology, and in particular to a character rendering method with local-global feature enhancement and style fusion. Background Art

[0002] With the update of software and hardware technology, real-time rendering technology has become more and more important in people's lives. From the initial engineering drawing, game entertainment to the current medical and even military training, we can see the benefits of real-time rendering technology. The application of these aspects has higher and higher requirements for the image quality of real-time rendering. However, due to the material, lighting and other reasons, different models have very different effects under different systems. Therefore, artists need to adjust the detailed parameters of the model in each scene to achieve a good visual effect, which often leads to different perceptions of objects in the scene and a sense of fragmentation. This is because the previous lighting models are all empirical models and cannot restore objects well.

[0003] Physically Based Rendering (PBR) is dedicated to restoring the lighting in the real world. The material data is also based on physical measurements, and the rendering equation derived from radiometry is used to make the computer as close to the real scene as possible. Physically Based Rendering allows artists to use the same parameters to maintain good visual effects under different lighting conditions, so that realistic rendering of a large number of materials can be achieved quickly.

[0004] Non-Photorealistic Rendering (NPR), also known as stylized rendering, aims to simulate or emphasize artistic effects instead of pursuing the appearance of the real world. Unlike traditional photorealistic rendering techniques, NPR focuses more on expressing artistic styles, hand-painted styles or abstract effects. However, it is usually not ideal in terms of detail expression, and the lighting model is not realistic enough. Summary of the invention

[0005] With the development of deep learning technology, it is good at processing complex scenes and diverse data, and has strong capabilities in processing high-dimensional data, which can improve the accuracy of point cloud reconstruction.

[0006] Therefore, we can combine the advantages of the three, and combine physically based rendering with stylized rendering on the basis of strengthening the characteristics of the character area, so that we can preserve the details of the model and material while achieving stylized image performance. This will undoubtedly enhance the image performance of some objects that cannot be described by real rendering.

[0007] In order to overcome the limitations of a single rendering method, a character rendering method with local-global feature enhancement and style fusion is provided, which mainly includes data loading and initialization, including four steps: passing the character model data from the application to the vertex shader, then passing it from the vertex shader to the fragment shader, converting the vertex coordinates from the model space to the clipping space, and obtaining the light source position and camera position in the world coordinates by the fragment shader. Then, the data is point clouded, and the geometric information of the model is converted into point cloud data and normalized to the same distribution. Then, the normal vector of each point in the point cloud is evaluated using the improved reflection intensity assisted PCA method, and the three-dimensional points of the character are reconstructed based on the global-local point cloud geometric feature extraction network model. On this basis, the point cloud information is reversely restored, and the point cloud data is linearly denormalized to the original model coordinate range. Finally, the global character model feature information is rendered, including the outline stroke, bump map, highlight item, diffuse reflection item, and self-luminous item rendering improvement of the character based on physical and stylized fusion, and finally the corresponding style rendering effect after feature enhancement is obtained to solve the problems raised in the background technology.

[0008] In order to achieve the above object, the present invention provides the following technical solution: The present invention provides a character rendering method with local-global feature enhancement and style fusion, comprising the following steps:

[0009] S1: Data loading and initialization: mainly includes four steps: passing the character model data from the application to the vertex shader, then passing it from the vertex shader to the fragment shader, converting the vertex coordinates from the model space to the clip space, and the fragment shader obtaining the light source position and camera position in the world coordinates;

[0010] S2: Data point clouding: convert the geometric information of the model into point cloud data and normalize it to the same distribution;

[0011] S3: Evaluate the normal vector of each point in the point cloud using the improved reflection intensity assisted PCA method;

[0012] S4: Reconstructing 3D points of characters based on the network model of strengthening global-local point cloud geometric feature extraction;

[0013] S5: Reverse restoration of point cloud information: linearly denormalize the point cloud data to the original model coordinate range;

[0014] S6: Rendering processing: Based on the fusion of physics and stylization, the character's outline, bump map, highlight item, diffuse reflection item, and self-luminous item rendering are improved, and finally the corresponding style rendering effect with enhanced features is obtained.

[0015] Furthermore, the specific operation of data initialization in step S1 is:

[0016] S11: passing character model data from the application to the vertex shader, and organizing the data passed to the shader from the application into a structure Appdata, which contains four variables: vertex, normal, tangent, and uv, which represent the vertex position in the model space, the vertex normal, the vertex tangent direction, and the semantics of the first set of texture coordinates in the model, respectively;

[0017] S12: according to the method of S11, the data processed by the vertex shader is passed to the fragment shading;

[0018] S13: In order to transform the vertex coordinates from the model space to the clipping space, a transformation function of model coordinates-world coordinates-observation coordinates-clipping coordinates is designed. This function represents matrix multiplication, and the formula is as follows:

[0019] result = MVP * pos;

[0020] Among them, result is the clip space coordinate, MVP is the model-view-projection matrix, and pos is the object space coordinate of the vertex;

[0021] S14: In the fragment shader, in order to obtain the light source position and camera position in the world coordinates, a function is designed to obtain the preliminary data of the light source position and camera position, and the normalized data is the light source direction and observation direction of the fragment. The formulas of the two are as follows:

[0022] viewDir=normalize(cameraPosition-worldPos);

[0023] lightDir=normalize(lightPosition-worldPos);

[0024] Among them, viewDir is the view direction vector of the vertex in the world space, cameraPosition is the position of the camera in the world space; lightDir is the direction vector pointing from the vertex position to the light source, lightPosition is the position of the light source in the world space, worldPos is the world space coordinate of the vertex, and the normalize function normalizes the two.

[0025] Furthermore, the specific operations of step S2 are:

[0026] S21: Given a character model X with N vertices raw , each point consists of (x, y, z) coordinates, and the i-th vertex of the model is transformed into the i-th point in the point cloud: (x i ,y i , z i );

[0027] S22: Normalize the i-th point in the point cloud, taking the x coordinate as an example:

[0028]

[0029] Among them, x min and x max are the minimum and maximum values ​​of all points in the point cloud on the x-axis.

[0030] Furthermore, the specific steps of evaluating the normal vector of each point in the point cloud using the improved reflection intensity assisted PCA method in step S3 are:

[0031] S31: Point cloud with 7 channels (x, y, z, n x , n y , n z , i) including position, normal vector and reflection intensity, the weight of the reflection intensity information of the normal vector It is calculated by the |intensity difference index of each neighborhood point, and the formula is as follows:

[0032]

[0033] S32: The weighted covariance matrix M′ can be calculated as follows:

[0034]

[0035] Among them, p is the point of interest, p i (i=1, ..., K) is a point in the nearest neighborhood of p, and the maximum eigenvalue of the M′ matrix is ​​taken as the eigenvalue n of the normal vector of point p;

[0036] S33: Apply a median filter to remove the effects of noise from the evaluated normal vector; the direction of the current normal vector is represented as a scalar value in the Hue, Saturation, Value (HSV) color space; therefore, if the normal vectors have the same direction within a region, the points in the region are drawn with the same color.

[0037] Furthermore, the specific steps of reconstructing the three-dimensional points of the character based on the enhanced global-local point cloud geometric feature extraction network model in step S4 are:

[0038] S41: The enhanced global-local point cloud geometric feature extraction network consists of 3 layers of local enhancement modules and MLP; the former extracts local high-dimensional information of the point cloud, and the latter integrates global information. The two work together to ensure that local and global features in the data are fully extracted;

[0039] S42: Concatenate the features after the three-layer local enhancement module to fuse features of different scales to obtain the global feature P, and then use a maximum pooling operation and a single-layer MLP to reduce the feature dimension to obtain the global feature P′∈(N, k, 2d);

[0040] S43: Use the loss function to apply and process the features to map to the real 3D character point cloud features. The loss function is designed as follows:

[0041]

[0042] Furthermore, the specific operation of the local enhancement module in step S41 is:

[0043] S411: Person point cloud (x, y, z, n x , n y , n z , i) The input data is decomposed into two types of normal vectors n i =(n xi , n yi , n zi ) and location information p i =(p xi , p yi , p zi );

[0044] S412: The position features will be further encoded into point cloud position information The specific operations are:

[0045]

[0046] in, Represents the splicing operation, local features For relative position encoding, Yes k to The relative position of As an influencing factor;

[0047] S413: Normal vector features will be further encoded as point cloud normal vectors The specific operations are:

[0048]

[0049] in, Represents the splicing operation, local normal vector feature is encoded to reduce redundant point cloud normal vectors, Relative to n k changes in direction, Indicates the similarity of directions. This step shares MLP with S412.

[0050] S414: N person point clouds (x, y, z, n x , n y , n z , i) After the shared MLP classification processing, the local feature F∈(N, k, 2d) will be obtained, and then processed by the proxy attention mechanism to obtain the local feature F′∈(N, k, 2d).

[0051] Furthermore, the specific operations of step S42 are:

[0052]

[0053] P′=maxpool[MLP(P)];

[0054] Furthermore, the specific operation of the proxy attention mechanism in step S414 is as follows:

[0055] S4141: The input data feature F is linearly transformed to obtain Q, K and V. The specific operation is:

[0056] Q=FW Q , K=FW K , V=FW V ;

[0057] Among them, W Q / W / V represents the projection matrix;

[0058] S4142: The point cloud feature Q is pooled to obtain the proxy feature A, and then the enhanced point cloud feature F′ can be obtained. The specific operation is:

[0059] F′=σ(QA T +B2)σ(AK T +B1)V;

[0060] Among them, B1 and B2 represent proxy biases, and σ(·) represents the softmax operation.

[0061] Furthermore, the specific operations of step S5 are:

[0062] S51: Given a cloud of N1 sample points, each point consisting of (x, y, z) coordinates, the i-th point in the point cloud is converted into the i-th vertex (x i ,y i , z i );

[0063] S52: Reversely restore the point cloud information for the i-th point in the point cloud, taking the x coordinate as an example:

[0064] x restored,i =x i×(x max -x min );

[0065] Among them, x min and x max are the minimum and maximum values ​​of all points in the sampled point cloud on the x-axis.

[0066] Furthermore, the specific operations of step S7 are:

[0067] S71: Transform the normal into NDC space. This space is the normalized device coordinates obtained by homogeneous division of the homogeneous clipping space. The range of the xyz axis is -1 to 1. The transformation formula is as follows:

[0068] NDC=normalize((MVP*float4(normal, 0.0)).xyz);

[0069] This means appending a 0 to the normal vector normal as the w component of the homogeneous coordinate to form a four-dimensional vector (normal.x, normal.y, normal.z, 0.0), multiplying this four-dimensional vector by the model-view-projection matrix MVP to get a new four-dimensional vector, taking the first three components of this new vector and normalizing them;

[0070] S72: Normals are converted from tangent space to world space. The conversion formula is as follows:

[0071] P 世界 =M·P 切线 ;

[0072] Among them, P 世界 is the coordinate of the transformed point in world space, P 切线 is the coordinate of the original point in the tangent space, and the matrix M is the transformation matrix from the tangent space to the world space, which can be defined as follows:

[0073]

[0074] Among them, vectors T, B, and N are the normal vector, tangent vector, and bitangent vector in the world space respectively;

[0075] Decode the RGB value of the normal texture and convert it into a normal vector in world space:

[0076] Since the component range of the normal is -1 to 1, and the RGB range of the normal map is 0 to 1, the RGB value needs to be remapped to the normal. The formula is as follows:

[0077]

[0078] Among them, normal is the components (x, y, z) of the normal vector after remapping, and pixel is the RGB value (r, g, b) of the normal texture, and the normal coordinates in the world space can be obtained;

[0079] S73: The BRDF mathematical formula of the highlight term is expressed as:

[0080] BRDF=D(h)*F(v,l)*F(v,h);

[0081] Where D(h) represents the normal distribution function, G(v, I) represents the shadow masking function, F(v, h) represents the Fresnel term, h is the half-distance vector, v is the viewing direction, and I is the light source direction;

[0082] S74: Linear interpolation function Lerp (L bright , L dark , t) is designed as follows:

[0083]

[0084] Here, L bright is the apparent semi-Lambert term result, L dark is the semi-Lambert term result of the dark side, and t is the interpolation factor, which is between 0 and 1 and represents the weight of light and dark. By adjusting the value of the interpolation factor t, different degrees of transition effects can be obtained at the junction of light and dark.

[0085] The present invention has the following advantages:

[0086] 1. Convert character model data into flexible point cloud data that can capture the character’s geometry, shape, and details. This representation allows for easier shape analysis, feature extraction, and model learning.

[0087] 2. On the basis of retaining the original character features, the improved reflection intensity assisted PCA method is used to strengthen the law of each point, and the three-dimensional points of the character are reconstructed by extracting the network model based on the enhanced global-local point cloud geometric features to capture the distinctive character details.

[0088] 3. Compared with a single physically based rendering method, the present invention not only restores the images of the real world, but also has a characteristic stylized image.

[0089] 4. Compared with a single non-realistic rendering method, the present invention not only has a characteristic stylized picture, but also aims to restore the lighting in the real world. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 It is a schematic diagram of the process of the present invention.

[0091] Figure 2 The figure is a schematic diagram of the data initialization process of the method of the present invention.

[0092] Figure 3 The figure is a schematic diagram of a point cloud geometric feature extraction network based on enhanced global-local point cloud feature extraction of the method of the present invention.

[0093] Figure 4 It is a structural schematic diagram of the local reinforcement module of the method of the present invention.

[0094] Figure 5 Schematic diagram of the proxy attention mechanism structure of the method of the present invention.

[0095] Figure 6 The figure is a schematic diagram of the rendering process flow of the method of the present invention. DETAILED DESCRIPTION

[0096] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0097] The present invention provides a character rendering method with local-global feature enhancement and style fusion, such as Figure 1-6 As shown, it includes the following steps:

[0098] S1: Data loading and initialization: mainly includes four steps: passing the character model data from the application to the vertex shader, then passing it from the vertex shader to the fragment shader, converting the vertex coordinates from the model space to the clip space, and the fragment shader obtaining the light source position and camera position in the world coordinates;

[0099] The specific steps are:

[0100] S11: passing character model data from the application to the vertex shader, and organizing the data passed to the shader from the application into a structure Appdata, which contains four variables: vertex, normal, tangent, and uv, which represent the vertex position in the model space, the vertex normal, the vertex tangent direction, and the semantics of the first set of texture coordinates in the model, respectively;

[0101] S12: according to the method of S11, the data processed by the vertex shader is passed to the fragment shading;

[0102] S13: In order to transform the vertex coordinates from the model space to the clipping space, a transformation function of model coordinates-world coordinates-observation coordinates-clipping coordinates is designed. This function represents a matrix multiplication, and the formula is as follows:

[0103] result = MVP * pos;

[0104] Among them, result is the clip space coordinate, MVP is the model-view-projection matrix, and pos is the object space coordinate of the vertex;

[0105] S14: In the fragment shader, in order to obtain the light source position and camera position in the world coordinates, a function is designed to obtain the preliminary data of the light source position and camera position, and the normalized data is the light source direction and observation direction of the fragment. The formulas of the two are as follows:

[0106] viewDir=normalize(cameraPosition-worldPos);

[0107] lightDir=normalize(lightPosition-worldPos);

[0108] Among them, viewDir is the view direction vector of the vertex in the world space, cameraPosition is the position of the camera in the world space; lightDir is the direction vector pointing from the vertex position to the light source, lightPosition is the position of the light source in the world space, worldPos is the world space coordinate of the vertex, and the normalize function normalizes the two.

[0109] S2: Data point clouding: convert the geometric information of the model into point cloud data and normalize it to the same distribution;

[0110] The specific steps are:

[0111] S21: Given a character model X with N vertices raw , each point consists of (x, y, z) coordinates, and the i-th vertex of the model is transformed into the i-th point in the point cloud: (x i ,y i , z i );

[0112] S22: Normalize the i-th point in the point cloud, taking the x coordinate as an example:

[0113]

[0114] Among them, x min and x max are the minimum and maximum values ​​of all points in the point cloud on the x-axis.

[0115] S3: Evaluate the normal vector of each point in the point cloud using the improved reflection intensity assisted PCA method;

[0116] The specific steps are:

[0117] S31: Point cloud with 7 channels (x, y, z, n x , n y , n z , i) including position, normal vector and reflection intensity, the weight of the reflection intensity information of the normal vector It is calculated by the |intensity difference index of each neighborhood point, and the formula is as follows:

[0118]

[0119] S32: The weighted covariance matrix M′ can be calculated as follows:

[0120]

[0121] Among them, p is the point of interest, p i (i=1, ..., K) is a point in the nearest neighborhood of p, and the maximum eigenvalue of the M′ matrix is ​​taken as the eigenvalue n of the normal vector of point p;

[0122] S33: Apply a median filter to remove the effect of noise from the evaluated normal vector. The direction of the current normal vector is represented as a scalar value in the Hue, Saturation, Value (HSV) color space. Therefore, if the normal vectors have the same direction within a region, the points in the region are drawn with the same color.

[0123] S4: Reconstructing 3D points of characters based on the network model of strengthening global-local point cloud geometric feature extraction;

[0124] The specific steps are:

[0125] S41: Strengthening global-local point cloud geometric feature extraction network consists of 3 layers of local strengthening modules and MLP. The former extracts local high-dimensional information of point clouds, and the latter integrates global information. The two work together to ensure that local and global features in the data are fully extracted.

[0126] The specific operations of the local enhancement module in S41 are:

[0127] S411: Person point cloud (x, y, z, n x , n y , n z , i) The input data is decomposed into two types of normal vectors n i =(n xi , n yi , n zi ) and location information pi =(p xi , p yi , p zi );

[0128] S412: The position features will be further encoded into point cloud position information The specific operations are:

[0129]

[0130] in, Represents the splicing operation, local features For relative position encoding, Yes k to The relative position of As an influencing factor;

[0131] S413: Normal vector features will be further encoded as point cloud normal vectors The specific operations are:

[0132]

[0133] in, Represents the splicing operation, local normal vector feature is encoded to reduce redundant point cloud normal vectors, Relative to n k changes in direction, Indicates the similarity of directions. This step shares MLP with S412.

[0134] S414: N person point clouds (x, y, z, n x , n y , n z , i) After the shared MLP classification processing, the local feature F∈(N, k, 2d) will be obtained, and then processed by the proxy attention mechanism to obtain the local feature F′∈(N, k, 2d).

[0135] The specific operation of S414's proxy attention mechanism is:

[0136] S4141: The input data feature F is linearly transformed to obtain Q, K and V. The specific operation is:

[0137] Q=FW Q , K=FW K , V=FW V ;;

[0138] Among them, W Q / W / V represents the projection matrix;

[0139] S4142: The point cloud feature Q is pooled to obtain the proxy feature A, and then the enhanced point cloud feature F′ can be obtained. The specific operation is:

[0140] F′=σ(QA T +B2)σ(AK T +B1)V;

[0141] Among them, B1 and B2 represent proxy biases, and σ(·) represents the softmax operation.

[0142] S42: Concatenate the features after the three-layer local enhancement module to fuse features of different scales to obtain the global feature P, and then use a maximum pooling operation and a single-layer MLP to reduce the feature dimension to obtain the global feature P′∈(N, k, 2d);

[0143] The specific operations are:

[0144]

[0145] P′=maxpool[MLP(P)];

[0146] S43: Use the loss function to apply and process the features to map to the real 3D character point cloud features. The loss function is designed as follows:

[0147]

[0148] S5: Reverse restoration of point cloud information: linearly denormalize the point cloud data to the original model coordinate range;

[0149] The specific operations are:

[0150] S51: Given a cloud of N1 sample points, each point consisting of (x, y, z) coordinates, the i-th point in the point cloud is converted into the i-th vertex (x i ,y i , z i );

[0151] S52: Reversely restore the point cloud information for the i-th point in the point cloud, taking the x coordinate as an example:

[0152] x restored,i =x i ×(x max -x min );

[0153] Among them, x min and x max are the minimum and maximum values ​​of all points in the sampled point cloud on the x-axis.

[0154] S6: Rendering processing: Based on the fusion of physics and stylization, the character's outline, bump map, highlight item, diffuse item, and self-luminous item rendering are improved, and finally the corresponding style rendering effect with enhanced features is obtained;

[0155] The specific steps are:

[0156] S61: Transform the normal into NDC space. The transformation formula is as follows:

[0157] NDC=normalize((MVP*float4(normal, 0.0)).xyz);

[0158] This means appending a 0 to the normal vector normal as the w component of the homogeneous coordinate to form a four-dimensional vector (normal.x, normal.y, normal.z, 0.0), multiplying this four-dimensional vector by the model-view-projection matrix MVP to get a new four-dimensional vector, taking the first three components of this new vector and normalizing them;

[0159] S62: Normals are converted from tangent space to world space. The conversion formula is as follows:

[0160] P 世界 =M·P 切线 ;

[0161] Among them, P 世界 is the coordinate of the transformed point in world space, P 切线 is the coordinate of the original point in the tangent space, and the matrix M is the transformation matrix from the tangent space to the world space, which can be defined as follows:

[0162]

[0163] Among them, vectors T, B, and N are the normal vector, tangent vector, and bitangent vector in the world space respectively;

[0164] Decode the RGB value of the normal texture and convert it into a normal vector in world space:

[0165] Since the component range of the normal is -1 to 1, and the RGB range of the normal map is 0 to 1, the RGB value needs to be remapped to the normal. The formula is as follows:

[0166]

[0167] Among them, normal is the components (x, y, z) of the normal vector after remapping, and pixel is the RGB value (r, g, b) of the normal texture, and the normal coordinates in the world space can be obtained;

[0168] S63: The BRDF mathematical formula of the highlight term is expressed as:

[0169] BRDF=D(h)*G(v, l)*F(v, h);;

[0170] Among them, G(v, l) adopts the Smith-Joint shadow masking function, and incorporates the normalization coefficient into the calculation to simplify the calculation steps and process. The formula is as follows:

[0171]

[0172] G1(·) is calculated as follows:

[0173]

[0174] Here, α is the roughness parameter, n is the refractive index of the surface, and θ x is the angle between the incident angle and the normal;

[0175] F(v, h) uses the Fresnel approximation, and the formula is as follows:

[0176] F(v,h)=F0+(1-F0)(1-(v·h)) 5 ;

[0177] Here, F0 is the reflectivity of the surface, h is the half-way vector, and v is the viewing direction;

[0178] S64: Linear interpolation function Lerp (L bright , L dark , t) is designed as follows:

[0179]

[0180] Here, L bright is the apparent semi-Lambert term result, L dark is the semi-Lambert term result of the dark side, and t is the interpolation factor, which is between 0 and 1 and represents the weight of light and dark. By adjusting the value of the interpolation factor t, different degrees of transition effects can be obtained at the junction of light and dark.

[0181] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.

Claims

1. A character rendering method with local-global feature enhancement and style fusion, characterized by: include: S1: Data loading and initialization: Pass the character model data from the application to the vertex shader; Then pass it from the vertex shader to the fragment shader; Convert vertex coordinates from model space to clip space; The fragment shader obtains the light source position and camera position in world coordinates; S2: Data point clouding: convert the geometric information of the model into point cloud data and normalize it to the same distribution; S3: Evaluate the normal vector of each point in the point cloud using the improved reflection intensity assisted PCA method; S4: Reconstructing 3D points of characters based on the network model of strengthening global-local point cloud geometric feature extraction; The specific steps of reconstructing the three-dimensional points of a person based on the enhanced global-local point cloud geometric feature extraction network model are as follows: S41: The enhanced global-local point cloud geometric feature extraction network consists of 3 layers of local enhancement modules and MLP; the former extracts local high-dimensional information of the point cloud, and the latter integrates global information. The two work together to ensure that local and global features in the data are fully extracted; The specific operation of the local strengthening module in step S41 is: S411: Person point cloud (x, y, z, n x , n y , n z , i) The input data is decomposed into two types of normal vectors n i =(n xi , n yi , n zi ) and location information p i =(p xi , p yi , p zi ); S412: The position features will be further encoded into point cloud position information The specific operations are: in, Represents the splicing operation, local features For relative position encoding, Yes k to The relative position of As an influencing factor; S413: Normal vector features will be further encoded as point cloud normal vectors The specific operations are: in, Represents the splicing operation, local normal vector feature is encoded to reduce redundant point cloud normal vectors, Relative to n k changes in direction, Indicates the similarity of directions. This step shares MLP with S412. S414: N person point clouds (x, y, z, n x , n y , n z ,i) After the shared MLP classification process, the local feature F∈(N, k, 2d) is obtained, and then processed by the proxy attention mechanism to obtain the local feature F′∈(N, k, 2d); S42: Concatenate the features after the three-layer local enhancement module to fuse features of different scales to obtain the global feature P, and then use a maximum pooling operation and a single-layer MLP to reduce the feature dimension to obtain the global feature P′∈(N, k, 2d); S43: Use the loss function to apply and process the features to map to the real 3D character point cloud features. The loss function is designed as follows: S5: Reverse restoration of point cloud information: linearly denormalize the point cloud data to the original model coordinate range; S6: Rendering processing: Based on the fusion of physics and stylization, the character's outline, bump map, highlight item, diffuse reflection item, and self-luminous item rendering are improved, and finally the corresponding style rendering effect with enhanced features is obtained.

2. The character rendering method of local-global feature enhancement and style fusion according to claim 1, characterized in that: The specific steps of data loading and initialization in step S1 are as follows: S11: passing character model data from the application to the vertex shader, and organizing the data passed from the application to the shader into a structure Appdata, which contains four variables: vertex, normal, tangent, and uv, which represent the vertex position in the model space, the vertex normal, the vertex tangent direction, and the semantics of the first set of texture coordinates in the model, respectively; S12: according to the method of S11, the data processed by the vertex shader is passed to the fragment shading; S13: In order to transform the vertex coordinates from the model space to the clipping space, a transformation function of model coordinates-world coordinates-observation coordinates-clipping coordinates is designed. This function represents matrix multiplication, and the formula is as follows: result = MVP * pos; Among them, result is the clip space coordinate, MVP is the model-view-projection matrix, and pos is the object space coordinate of the vertex; S14: In the fragment shader, a function is designed to obtain preliminary data of the light source position and the camera position, and normalized data is the light source direction and observation direction of the fragment. The formulas for the two are as follows: viewDir=normalize(cameraPosition-worldPos); lightDir=normalize(lightPosition-worldPos); Among them, viewDir is the view direction vector of the vertex in the world space, cameraPosition is the position of the camera in the world space; lightDir is the direction vector pointing from the vertex position to the light source, lightPosition is the position of the light source in the world space, wor|dPos is the world space coordinate of the vertex, and the normalize function normalizes the two.

3. The character rendering method of local-global feature enhancement and style fusion according to claim 1, characterized in that: The specific steps of data point clouding in step S2 are: S21: Given a character model X with N vertices raw , each point consists of (x, y, z) coordinates, and the i-th vertex of the model is transformed into the i-th point in the point cloud: (x i ,y i , z i ); S22: Normalize the i-th point in the point cloud, taking the x coordinate as an example: Among them, x min and x max are the minimum and maximum values ​​of all points in the point cloud on the x-axis.

4. The character rendering method of local-global feature enhancement and style fusion according to claim 1, characterized in that: The specific steps of evaluating the normal vector of each point in the point cloud using the improved reflection intensity assisted PCA method in step S3 are: S31: Point cloud with 7 channels (x, y, z, n x , n y , n z , i) including position, normal vector and reflection intensity, the weight of the reflection intensity information of the normal vector It is calculated by the I intensity difference index of each neighborhood point, and the formula is as follows: S32: The weighted covariance matrix M′ can be calculated as follows: Among them, p is the point of interest, p i (i=1, ..., K) is a point in the nearest neighborhood of p, and the maximum eigenvalue of the M′ matrix is ​​taken as the eigenvalue n of the normal vector of point p; S33: Apply a median filter to remove the effects of noise from the evaluated normal vector; the direction of the current normal vector is represented as a scalar value in the Hue, Saturation, Value (HSV) color space; therefore, if the normal vectors have the same direction within a region, the points in the region are drawn with the same color.

5. The character rendering method of local-global feature enhancement and style fusion according to claim 1, characterized in that: The specific steps of reversely restoring the point cloud information in step S5 are: S51: Given a cloud of N1 sample points, each point consisting of (x, y, z) coordinates, the i-th point in the point cloud is converted into the i-th vertex (x i ,y i , z i ); S52: Reversely restore the point cloud information for the i-th point in the point cloud, taking the x coordinate as an example: x restored,i =x i ×(x max -x min );; Among them, x min and x max are the minimum and maximum values ​​of all points in the sampled point cloud on the x-axis.

6. The character rendering method of local-global feature enhancement and style fusion according to claim 1, characterized in that: The specific steps of the rendering process in step S7 are: S71: Outline stroke: In the vertex shader, first transform the normal to NDC space, then eliminate the changes caused by homogeneous division and adapt to the 16:9 wide screen, and finally output the defined color in the fragment shader, and the outline stroke effect is presented on the final image; S72: Bump map: First, convert the normal from tangent space to world space, then use UV value sampling for the normal map to be processed, and finally decode the RGB value of the normal texture and convert it into a normal vector in world space; S73: Highlight item: First calculate the BRDF of the highlight item, including the normal distribution function D, the shadow shading function G and the Fresnel item F. Then multiply the above three items D, G and F and substitute them into the rendering equation to find the color of the current light source and the final highlight item shading value. S74: Diffuse reflection term: The normal direction after S71-S73 is recorded as n and the light source direction I. The dot product of the two is mapped to the range of 0 to 1 using the semi-Lambert formula. The formula is as follows: Compare the result L with the threshold variable declared in S11 to determine whether the fragment is on the bright side or the dark side, and finally obtain different degrees of transition effects at the boundary between light and dark through the linear interpolation function Lerp(a, b, t); S75: Self-illumination item: According to the defined edge light color and the range of the self-illumination item, a soft dividing line is formed in the same way as S74.

Citation Information

Patent Citations

  • Laser radar simulation method based on PBR reflection model

    CN113034660A

  • Implicit stylized new view angle synthesis method

    CN117237501A