Geometric parametric modeling-based real-time hair de-noising and repairing method and equipment

The geometric parameterization-based method addresses the challenges of real-time hair rendering by reconstructing and filling in missing hair geometry, ensuring accurate and noise-free rendering of hair in dynamic scenes.

CN120318123AInactive Publication Date: 2025-07-15NANJING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510399456.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-07-15
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When the prior art renders hair in real time, it is difficult to effectively solve the problems of hair fracture and dynamic noise suppression imbalance caused by low sampling rates, resulting in artifacts and physical characteristics distortion in rendering results.

Method used

Using a method based on geometric parameterization modeling, the core geometric features of the hair are captured by constructing a visibility buffer, the fracture area is filled with direction matching and dynamic step size, and brightness compensation and tangent direction filtering are performed to realize the noise reduction repair of the hair.

Benefits of technology

Effectively repair subpixel-level hair breakage, maintaining the highlight direction and brightness consistency of the hair, and improving the physical authenticity and detail fidelity of the rendering effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318123A_ABST
    Figure CN120318123A_ABST
Patent Text Reader

Abstract

The invention discloses a real-time hair de-noising and repairing method and equipment based on geometric parameterization modeling, and the method comprises the steps: (1) constructing a visible buffer region, and capturing the core geometric features of hair in a screen space through a light tracing technology by adopting the visible buffer region; (2) aiming at a hairline fracture area caused by low sampling, screening a pixel with the most matched direction from adjacent pixels as a filling reference source, and gradually filling core geometric features of the hairline fracture area in a visibility buffer area according to a dynamic step length in the hairline extension direction based on the filling reference source; (3) coloring each hairline pixel of each hairline according to the filled visible buffer area; (4) performing brightness compensation on the coloring result, so that the hair pixel brightness sum of each hair before and after filling is unchanged; and (5) performing screen space filtering on each hairline pixel of each hairline along the hairline extension direction to realize hairline denoising and repairing. The method is better in denoising effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to rendering technology, and in particular, to a real-time hair denoising and restoration method and device based on geometric parametric modeling. Background Art

[0002] Real-time rendering technology is the core foundation for supporting interactive applications such as games and virtual reality. Early rendering relied on rasterization pipelines to quickly generate images through triangle meshes, but it was difficult to simulate the physical properties of complex materials such as hair (such as hair gloss and translucency). With the popularization of ray tracing hardware, real-time rendering began to incorporate movie-level technologies, but how to process hair-level details within milliseconds remains a major challenge.

[0003] Ray tracing is a rendering technology that simulates the physical behavior of real light. By tracing the light starting from the camera and the interactions such as reflection, refraction, and scattering that occur on the surface of objects in the scene, it generates a physically realistic global illumination effect. Compared with traditional rasterization technology, ray tracing can more accurately present complex optical phenomena such as shadows, specular reflections, and caustics, and has become the core means of movie-level offline rendering.

[0004] With the introduction of the RT Core hardware unit and acceleration structure (BVH) of the RTX series of graphics cards, the intersection calculation efficiency of ray tracing has been improved by several orders of magnitude, making real-time ray tracing possible. However, real-time rendering needs to compress the sampling rate to 1-2 spp, resulting in serious Monte Carlo noise and loss of high-frequency details. To make up for the low sampling defect, the industry uses spatio-temporal filtering (such as SVGF) and importance sampling reuse (such as ReSTIR) technologies: the former suppresses noise by mixing multi-frame pixel data, and the latter uses a screen space reservoir to reuse light source samples across frames / pixels to improve the illumination convergence speed. However, such methods face fundamental limitations in dynamic scenes - the samples stored in screen space cannot adapt to fast-moving geometries (such as fluttering hair), resulting in the invalidation of historical data and the recurrence of noise. Hair rendering further magnifies this contradiction: the hair diameter is often lower than the pixel size, and sub-pixel fractures under low sampling form "hair tip fragmentation" artifacts; traditional isotropic filtering (such as Gaussian blur) ignores the tangential directionality of hair and smooths the highlight direction, making the hair texture appear plastic.

[0005] The core defects of current hair denoising technologies mainly focus on the lack of geometric fracture repair and the imbalance in dynamic noise suppression. Mainstream spatio-temporal filtering relies on color and normal similarity interpolation, unable to distinguish the intertwined hair strands within the same pixel (such as sub-pixel fractures of crossed hair bundles), resulting in hair adhesion or fracture residues after repair; although deep learning super-resolution technologies (such as DLSS) magnify the image resolution through neural networks, their super-resolution models are trained based on general scenes and lack targeted perception of hair-level geometric features, and instead expose the sawtooth or blur at the fracture edges after magnification. More critically, existing solutions treat denoising and geometric modeling separately, resulting in the lack of physical basis for fracture repair. In dynamic scenes, denoising or reuse methods in the time domain will cause ghosting problems in the rendering results. Summary of the Invention

[0006] Aiming at the problems existing in the prior art, the object of the present invention is to provide a real-time hair denoising and repair method and device based on geometric parametric modeling with better repair effects.

[0007] In order to achieve the above-mentioned invention object, the present invention provides the following technical solutions:

[0008] A real-time hair denoising and repair method based on geometric parametric modeling, comprising the following steps:

[0009] (1) Construct a visibility buffer, and use the visibility buffer to capture the core geometric features of the hair in the screen space through ray tracing technology, including the tangent direction, unique identifier, and parametric position of the visible points of each hair strand;

[0010] (2) For the hair fracture areas caused by low sampling, select the pixel with the most matching direction from adjacent pixels as the filling reference source, and gradually fill the core geometric features of the hair fracture areas in the visibility buffer along the hair extension direction based on the filling reference source according to a dynamic step size; wherein, the dynamic step size changes according to the curvature and density of the hair;

[0011] (3) Color each hair pixel of each hair strand according to the filled visibility buffer;

[0012] (4) Perform brightness compensation on the coloring result so that the sum of the brightness of the hair pixels of each hair strand before and after filling remains unchanged;

[0013] (5) Perform screen space filtering on each hair pixel of each hair strand along the hair extension direction to achieve hair denoising and repair.

[0014] Further, step (1) specifically includes:

[0015] (1.1) Construct a visibility buffer with a preset storage space;

[0016] (1.2) Emit light from each pixel in the screen space and intersect the light with the hair in the scene in the world space;

[0017] (1.3) When there is an intersection between the light and the hair, the intersection is taken as a visible point, and the pre-built visibility buffer is used to capture and record the core geometric features of the hair at the visible point. The RG channel of the visibility buffer stores the tangent direction of the visible point in the screen space, the B channel stores the parameterized position of the visible point, that is, the position of the visible point on the length of the hair, and the A channel stores the existence flag, the fitting source flag and the hair unique identifier. The existence flag is used to identify whether the pixel belongs to the hair area, and the fitting source flag is used to indicate whether the data source is algorithm fitting or original geometry.

[0018] Furthermore, step (2) specifically includes:

[0019] (2.1) The pixels in the screen space that intersect with the hair in the scene are regarded as hair pixels, and the pixels in the screen space that do not intersect with the hair in the scene are regarded as empty pixels in the fracture area;

[0020] (2.2) Calculate the direction vector between the empty pixel and each adjacent hair pixel:

[0021] d i =normalize(p empty -p i )

[0022] Where, d i Indicates empty pixel p empty With adjacent hair pixel p i The direction vector of

[0023] (2.3) Get the tangent direction T of each adjacent hair pixel from the visibility buffer i , and calculate d i Corresponding to the hair tangent direction T i The dot product ∈ i , and select the ones that satisfy ∈ i >σ and∈ i Highest hair pixel p i , as the filling reference source, σ is the preset threshold, and normalize() represents the normalization function;

[0024] (2.4) For each hair, fill each pixel of the hair along the extension direction of the hair according to the dynamic step length with the filling reference source as the starting point, wherein the dynamic step length changes according to the curvature and density of the hair.

[0025] Furthermore, step (2.4) specifically includes:

[0026] (2.4.1) For each filling reference source, obtain its parametric position and the unique identifier of the hair strand it belongs to from the visibility buffer, and set the initial value of the parametric position t curr to the parametric position of the filling reference source;

[0027] (2.4.2) For the current parametric position t curr , reconstruct its world space coordinates World curr according to the unique identifier of the hair strand and the parametric position t curr , and obtain the pixel p curr of the hair strand point at the parametric position t new in the screen space according to the projection matrix from the world space to the screen space;

[0028] (2.4.3) If the pixel p new does not store the core geometric feature data in the visibility buffer, then fill the core geometric feature data of the hair strand at the parametric position t curr in the world space as the core geometric feature data of p new into the visibility buffer; otherwise, directly execute (2.4.4);

[0029] (2.4.4) If the current parametric position t curr is the first value, then calculate the step size and the hair strand extension direction according to the following formula:

[0030]

[0031] s = sign((p empty - p new )T src )

[0032] In the formula, Δt represents the step size, M -1 () represents the projection matrix from the screen space to the world space, p src represents the pixel to be filled in the screen space, L Strand represents the length of the hair strand in the world space, s represents the hair strand extension direction, T src represents the tangent direction of the starting point of the hair strand in the screen space, and sign() represents the sign function;

[0033] If the current parametric position t curr is not the first value, then calculate the step size and the parametric propagation direction according to the following formula:

[0034]

[0035] s = sign((p prev - p new )T src )

[0036] In the formula, t prev represents the parameterized position in the previous iteration, and p prev represents the screen space pixel corresponding to t prev , and Δd represents the change in the parameterized position corresponding to one pixel length of the hair in the screen space;

[0037] (2.4.5) Update the parameterized position t curr = t curr + s * Δt, and determine whether t curr is greater than 1 or encounters a filled pixel. If so, it is considered that the current hair filling is completed; otherwise, return to execute (2.4.2).

[0038] Furthermore, step (3) includes:

[0039] (3.1) Extract the unique identifier and parameterized position of each visible point of the hair from the visibility buffer, obtain the hair pixels of the visible points of the hair in the screen space, and reconstruct the spatial coordinates of the visible points of the hair in the world space;

[0040] (3.2) Starting from the hair pixels in the screen space and focusing on the spatial coordinates of the visible points of the hair in the world space, reconstruct the light rays emitted by the hair pixels, and set the shading direction of the hair pixels to the direction of the reconstructed light rays;

[0041] (3.3) Select any mode from the full sub-pixel shading mode and the random sub-pixel shading mode to shade the hair pixels; among them, in the full sub-pixel shading mode, each pixel is shaded and settled separately; in the random sub-pixel shading mode, four adjacent hair pixels are taken as a group, and a hair pixel is randomly selected from each group for shading calculation, and the shading result is used as the shading result of all hair pixels in the group;

[0042] (3.4) Store the shading result in the color buffer to complete the shading.

[0043] Furthermore, step (4) includes:

[0044] (4.1) For each hair pixel, read the unique identifier of the hair it belongs to from the visibility buffer, and reconstruct the bounding box of the entire hair in the world space according to the unique identifier of the hair;

[0045] (4.2) Calculate the bounding box of the entire hair in the screen space according to the bounding box of the entire hair in the world space;

[0046] (4.3) Obtain the hash table with the following storage space according to the bounding box of the entire hair in the screen space:

[0047] HA = W proj×H proj ×1.2

[0048] Wherein, HA is the size of the hash table, and W proj 、H proj are the width and height of the bounding box of the overall hair in screen space, respectively;

[0049] (4.4) Calculate the total radiation of hair pixels before filling, the total radiation of replaced background pixels, and the total radiation of hair pixels after filling according to the following formula, and store them in the hash table:

[0050]

[0051] Wherein, E hair represents the total radiation of hair pixels before filling, L k is the brightness of hair strand pixel k before filling, and M represents the number of hair strand pixels before filling; E bg represents the total radiation of replaced background pixels, B j is the brightness of background pixel j, and N is the number of background pixels, is the total radiation of hair pixels after filling, LT k′ is the brightness of hair strand pixel k' after filling, and M' represents the number of hair strand pixels after filling;

[0052] (4.5) Calculate the scaling factor α according to the data in the hash table according to the following formula I :

[0053]

[0054] (4.6) Correct the coloring result of each hair strand pixel according to the scaling factor α I :

[0055] C correct = C shading *α I

[0056] Wherein, C shading represents the pixel coloring result of step (3), and C correct represents the coloring result of the corrected hair strand pixel.

[0057] Furthermore, step (5) includes:

[0058] (5.1) Obtain each hair strand pixel along the extension direction of the hair strand, and obtain the tangent direction of each hair strand pixel from the visibility buffer;

[0059] (5.2) Calculate the position of the center of the curvature circle according to the tangent direction and the preset filtering radius according to the following formula:

[0060] P center= p + R * N p

[0061] Wherein, P center is the position of the center of the curvature circle, p represents the current hair pixel position, R represents the preset filtering radius, and N p represents the normal direction perpendicular to the tangent direction T p of the hair pixel p;

[0062] (5.3) Draw a curvature circle with the position of the center of the curvature circle as the center and the preset filtering radius as the radius;

[0063] (5.4) Use the hair pixels within the preset radian range on the curvature circle as the set Ω(p) of adjacent hair pixels of the current hair pixel;

[0064] (5.5) For each hair pixel in the set Ω(p) of adjacent hair pixels, calculate the composite weight according to the following formula:

[0065] w q = w distance · w tangent · w color

[0066]

[0067] Wherein, w q represents the composite weight of q, w distance represents the Gaussian decay weight, w tangent represents the direction consistency weight, w color represents the color difference weight, d p represents the Euclidean distance between p and q, σ d is the pixel control decay rate, θ q represents the angle deviation, ∠() represents calculating the angle deviation, σ θ represents the radian adjustment direction sensitivity, C p , C q respectively represent the pixel colors of p and q, σ c is the color difference sensitivity, and q represents any hair pixel in Ω(p);

[0068] (5.6) Perform screen space filtering on the hair pixels according to the composite weight:

[0069]

[0070] Wherein, C′ p represents the color value of the hair pixel p after screen space filtering.

[0071] A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor executes the computer program to implement the above method.

[0072] A computer-readable storage medium stores a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.

[0073] A computer program product includes a computer program / instructions, characterized in that the computer program / instructions implement the above method when executed by a processor.

[0074] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0075] 1. A geometric perception gap filling mechanism is proposed. By parameterizing the hair strands and extending to reconstruct the sub-pixel fracture region, the problem of hair strand fractures caused by low sampling rates is solved.

[0076] 2. An energy consistency compensation algorithm is designed. By jointly calculating the luminance contributions of the hair strands and the background, the sudden change in dynamic illumination luminance caused by filled pixels is eliminated, breaking through the bottleneck of physical energy distortion in traditional filtering.

[0077] 3. Tangent direction-guided filtering is used. By fusing spatial, tangent, and color features with direction-sensitive weights, while removing noise, the highlight direction of the hair strands is retained, achieving a collaborative optimization of detail fidelity and noise reduction effects in real-time rendering. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 is a schematic flowchart of the real-time hair strand denoising and restoration method based on geometric parameterization modeling provided by the present invention;

[0079] Figure 2 is a comparison diagram of the rendering results of curly hair in the present invention;

[0080] Figure 3 is a comparison diagram of the rendering results of straight hair in the present invention;

[0081] Figure 4 is a structural diagram of the computer device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0082] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention.

[0083] Embodiment 1

[0084] The embodiment of the present invention provides a real-time hair strand denoising and restoration method based on geometric parameterization modeling. Before denoising and restoration, preprocessing needs to be performed, specifically as follows:

[0085] 1. Model the geometric model of hair using a cubic Bezier curve as the parametric curve of the hair. Each hair is defined by four control points, store the position coordinates and radius parameters to support the gradual change effect of hair thickness, and register the hair as a ray tracing geometry through the OptiX API, and construct a dynamic acceleration structure to achieve efficient intersection.

[0086] 2. Allocate core video memory resources based on the CUDA unified memory model: The visibility buffer (VBuffer) is created with twice the resolution of the color buffer (Color Buffer) (such as 3840×2160@1080p), store the hair tangent direction (float2), unique identifier (uint) and parametric position t (float) in screen space; The Color Buffer is allocated according to the native resolution of the screen and stores the final shading result. During the transparency correction process, dynamically construct a hash table: calculate the hash table size based on the hair projection area and manage conflicts through CUDA atomic operations. All resources are bound to the CUDA kernel function through device pointers to achieve zero-copy memory access and meet the real-time rendering performance requirements.

[0087] 3. Use the OptiX Shader Binding Table (SBT) to implement program-level parameter isolation binding, fix low-frequency data such as camera parameters and geometric acceleration structures in constant memory, and update dynamic data such as Buffers required for rendering in real time through device pointers. Create ray generation programs (RayGenProgram) required for different rendering processes.

[0088] After preprocessing, perform a denoising and repair process, as Figure 1 shown, including the following steps:

[0089] (1) Construct a visibility buffer, and use the visibility buffer to capture the core geometric features of the hair in screen space through ray tracing technology.

[0090] This step specifically includes:

[0091] (1.1) Construct a visibility buffer with a preset storage space;

[0092] (1.2) Emit rays starting from each pixel in screen space, and intersect the rays with the hair in the scene in world space;

[0093] (1.3) When there is an intersection point between the light ray and the hair strand, this intersection point is taken as the visible point, and the core geometric features of the hair strand at the visible point are captured and recorded using a pre-constructed visibility buffer. Among them, the core geometric features include the tangent direction, unique identifier, and parametric position of the visible point of each hair strand. Specifically, the visibility buffer records the key geometric information in a compact 128-bit pixel format. The RG channels of the visibility buffer store the tangent direction of the visible point in screen space, and the B channel stores the parametric position t of the visible point, that is, the position of the visible point along the length of the hair strand. For example, the parametric position t is a number within the range of [0, 1]. When the parametric position t = 0, it represents the starting point of the hair strand; when t = 1, it represents the end point of the hair strand; when t = 0.5, it represents the midpoint of the hair strand. The A channel stores the existence flag, fitting source marker, and hair strand unique identifier, and multiple identification information is integrated through the bitmask field. The existence flag is used to identify whether the pixel belongs to the hair area, and the fitting source marker is used to indicate whether the data source is algorithm fitting or original geometry. This buffer structure provides accurate data for subsequent anti-aliasing filtering, energy compensation, and rendering while efficiently storing the microscopic geometric features of the hair.

[0094] (2) For the hair breakage area caused by low sampling, the pixel with the most matching direction is selected from adjacent pixels as the filling reference source, and based on the filling reference source, the core geometric features of the hair breakage area are gradually filled in the visibility buffer along the hair extension direction according to a dynamic step size.

[0095] Step (2) specifically includes:

[0096] (2.1) The pixels in screen space that intersect with the hair strands in the scene are taken as hair pixels, and the pixels in screen space that do not intersect with the hair strands in the scene are taken as empty pixels in the breakage area.

[0097] (2.2) Calculate the direction vector between the empty pixel and each adjacent hair pixel:

[0098] d i =normalize(p empty -p i )

[0099] In the formula, d i represents the direction vector between the empty pixel p empty and the adjacent hair pixel p i ;

[0100] (2.3) Obtain the tangent direction T i of the hair strand where each adjacent hair pixel is located from the visibility buffer, and calculate the dot product ∈ i between d i and the corresponding hair strand tangent direction T i . Select from them those that satisfy ∈ i >σ and ∈i The highest hair pixel p i , as the filling reference source, σ is a preset threshold, and normalize() represents the normalization function;

[0101] (2.4) For each hair, starting from the filling reference source, fill each pixel of the hair along the extension direction of the hair with a dynamic step size to ensure the natural coherence of the repaired hair in the visual topological structure, where the dynamic step size changes according to the curvature and density of the hair.

[0102] Step (2.4) specifically includes:

[0103] (2.4.1) For each filling reference source, obtain its parametric position and the unique identifier of the hair it belongs to from the visibility buffer, and set the initial value of the parametric position t curr to the parametric position of the filling reference source;

[0104] (2.4.2) For the current parametric position t curr , reconstruct its world space coordinate World curr according to the unique identifier of the hair it belongs to and the parametric position t curr , and obtain the hair point at the parametric position t curr in the screen space according to the projection matrix from the world space to the screen space, which is pixel p new ;

[0105] (2.4.3) If pixel p new does not store the core geometric feature data in the visibility buffer, then use the core geometric feature data of the hair at the parametric position t curr in the world space as the core geometric feature data of p new , and fill it into the visibility buffer; otherwise, directly execute (2.4.4);

[0106] (2.4.4) If the current parametric position t curr is the first value, then calculate the step size and the hair extension direction according to the following formula:

[0107]

[0108] S = sign((p empty - p new ) T src )

[0109] In the formula, Δt represents the step size, M -1 () represents the projection matrix from the screen space to the world space, p src represents the pixel to be filled in the screen space, and L StrandIndicates the length of the hair strand in world space, s represents the hair strand extension direction, and T src Indicates the tangent direction of the starting point of the hair strand in screen space, and sign() represents the sign function;

[0110] If the current parameterized position t curr is not the first value, then calculate the step size and the parameterized propagation direction according to the following formula:

[0111]

[0112] s = sign((p prev - p new )T src )

[0113] In the formula, t prev represents the parameterized position at the previous iteration, p prev represents the screen space pixel corresponding to t prev , and Δd represents the change in the parameterized position corresponding to the length of one pixel of the hair strand in screen space;

[0114] (2.4.5) Update the parameterized position t curr = t curr + s * Δt, and determine whether t curr is greater than 1 or encounters a filled pixel. If so, it is considered that the current hair strand filling is completed, otherwise return to execute (2.4.2).

[0115] In step (2), using the screen space tangent direction and the screen space connection direction of the pixel as weights, ensure that the repair direction is consistent with the tangent direction, find more broken pixels that can be filled through soft rasterization, dynamically adjust the step size to make the search more efficient, and finally generate complete and high-precision visibility buffer data. The repaired visibility buffer data integrates the original geometric information and the attribute inheritance relationship of the filled area, provides reliable input for the subsequent shading, filtering, and energy compensation stages, and significantly improves the visual integrity and physical consistency of hair rendering.

[0116] (3) Color each hair pixel of each hair strand according to the filled visibility buffer.

[0117] Step (3) includes:

[0118] (3.1) Extract the unique identifier and parameterized position of each visible point of the hair strand from the visibility buffer, obtain the hair pixels of the visible points of the hair strand in screen space, and reconstruct the spatial coordinates of the visible points of the hair strand in world space;

[0119] (3.2) Starting from the hair pixels in screen space and taking the spatial coordinates of the visible points of the hair in world space as the end point, reconstruct the light rays emitted by the hair pixels, and set the shading direction of the hair pixels to the direction of the reconstructed light rays;

[0120] (3.3) Select any mode from the full sub-pixel shading mode and the random sub-pixel shading mode for hair pixel shading; among them, in the full sub-pixel shading mode, each pixel is shaded and settled individually; in the random sub-pixel shading mode, four adjacent hair pixels are taken as a group, and a hair pixel is randomly selected from each group for shading calculation, and the shading result is used as the shading result of all hair pixels in the group; among them, the resolution of the final rendered picture presented by the system is called the base resolution, VBuffer processes geometry at twice the resolution, and the random sub-pixel shading mode takes one pixel at the base resolution corresponding to four sub-pixels with VBuffer as a group;

[0121] (3.4) Store the shading result in the color buffer to complete the shading.

[0122] Among them, this stage provides two shading modes to adapt to different rendering requirements. The random sub-pixel shading mode significantly reduces the shading overhead and is suitable for dynamic scenes or performance-sensitive scenes, but may introduce slight noise in high-frequency detail areas. In the full sub-pixel shading mode, the system independently calculates the shading results of each high-resolution sub-pixel, and the shading overhead will be greater, but the effect will be better than random shading. Therefore, when pursuing higher rendering quality, select the full sub-pixel shading mode, and when pursuing higher performance, select the random sub-pixel shading mode.

[0123] The focus of the present invention lies in the process of hair rendering repair and denoising, which can be combined with any hair shading model. The hair shading model is already very mature and is not the focus of the present invention, so it will not be elaborated here.

[0124] (4) Perform brightness compensation on the shading result so that the sum of the brightness of the hair pixels of each hair remains unchanged before and after filling.

[0125] Step (4) includes:

[0126] (4.1) For each hair pixel, read the unique identifier of the hair to which it belongs from the visibility buffer, and reconstruct the bounding box of the entire hair in world space according to the unique identifier of the hair;

[0127] (4.2) Calculate the bounding box of the entire hair in screen space according to the bounding box of the entire hair in world space;

[0128] (4.3) Obtain the hash table with the following storage space according to the bounding box of the entire hair in screen space:

[0129] HA = W proj × H proj × 1.2

[0130] Wherein, HA is the hash table size, and W proj , H proj are respectively the width and height of the bounding box of the overall hair in screen space;

[0131] (4.4) Calculate the total radiation of hair pixels before filling, the total radiation of replaced background pixels, and the total radiation of hair pixels after filling according to the following formula, and store them in the hash table:

[0132]

[0133] Wherein, E hair represents the total radiation of hair pixels before filling, L k is the brightness of the k-th hair strand pixel before filling, and M represents the number of hair strand pixels before filling; E bg represents the total radiation of replaced background pixels, B j is the brightness of the j-th background pixel, and N is the number of background pixels, is the total radiation of hair pixels after filling, LT k′ is the brightness of the k'-th hair strand pixel after filling, and M' represents the number of hair strand pixels after filling;

[0134] (4.5) Calculate the scaling factor α according to the data in the hash table according to the following formula I :

[0135]

[0136] (4.6) Correct the coloring result of each hair strand pixel according to the scaling factor α I :

[0137] C correct = C shading * α I

[0138] Wherein, C shading represents the pixel coloring result of step (3), and C correct represents the coloring result of the corrected hair strand pixel.

[0139] In this stage, the brightness distortion problem in the hair filling area is solved through a dynamic energy compensation mechanism.

[0140] (5) Perform screen space filtering on each hair strand pixel along the hair strand extension direction to achieve hair strand denoising and restoration.

[0141] Step (5) includes:

[0142] (5.1) Obtain each hair pixel along the hair extension direction, and obtain the tangent direction of each hair pixel from the visibility buffer;

[0143] (5.2) Calculate the position of the center of the curvature circle according to the tangent direction and the preset filtering radius by the following formula:

[0144] P center = p + R * N p

[0145] In the formula, P center is the position of the center of the curvature circle, p represents the position of the current hair pixel, R represents the preset filtering radius, and N p represents the normal direction perpendicular to the tangent direction T p of the hair pixel p;

[0146] (5.3) Draw a curvature circle with the position of the center of the curvature circle as the center and the preset filtering radius as the radius;

[0147] (5.4) Take the hair pixels within the preset radian range on the curvature circle as the set Ω(p) of adjacent hair pixels of the current hair pixel;

[0148] (5.5) For each hair pixel in the set Ω(p) of adjacent hair pixels, calculate the composite weight according to the following formula:

[0149] w q = w distance · w tangent · w color

[0150]

[0151] In the formula, w q represents the composite weight of q, w distance represents the Gaussian attenuation weight, w tangent represents the direction consistency weight, w color represents the color difference weight, d p represents the Euclidean distance between p and q, σ d is the pixel control attenuation rate, θ q represents the angular deviation, ∠() represents finding the angular deviation, σ θ represents the radian adjustment direction sensitivity, C p 、C q respectively represent the pixel colors of p and q, σ c is the color difference sensitivity, and q represents any hair pixel in Ω(p);

[0152] (5.6) Perform screen space filtering on the hair pixels according to the composite weight:

[0153]

[0154] In the formula, C′ p represents the color value of the hair pixel p after screen space filtering.

[0155] An experiment was conducted on the present invention, and specifically, an RTX4090 graphics card was used for testing. Figure 2 This is a comparison chart of the rendering results of curly hair of the present invention. From left to right, 1spp is the ordinary rendering method, the random sub-pixel shading mode of this rendering method, 4spp ordinary rendering method, the full sub-pixel shading mode of this rendering method, 1024spp ordinary rendering method, and the 1024spp ordinary rendering method is used as a reference chart. Figure 3 This is a comparison chart of the rendering results of straight hair of the present invention. It can be seen that the present invention has achieved an obvious denoising and reconstruction effect, and the denoising effect is good.

[0156] Embodiment 2

[0157] The embodiment of the present invention provides a computer device, and the embodiment of the present invention provides services for the implementation of the method of the above Embodiment 1 of the present invention. As Figure 4 shown, the device may include: a memory 301 storing computer-executable programs; a processor 302 coupled to the memory 301; the processor 302 calls the computer-executable programs stored in the memory 301 to execute the steps in the method described in Embodiment 1.

[0158] The memory 301 may include a computer system-readable medium in the form of a volatile memory, such as a random access memory (RAM) and / or a cache memory. The device may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the memory 301 may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as a "hard disk drive"). Programs / utilities having a set (at least one) of program modules may be stored in, for example, the memory 301. Such program modules include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Implementations of a network environment may be included in each or some combination of these examples. The computer-executable programs of the program modules generally execute the functions and / or methods in the embodiments described in the present invention.

[0159] The processor 302 executes various functional applications and data processing by running the programs stored in the memory 301, such as implementing the method provided in Embodiment 1 of the present invention.

[0160] The code of the computer-executable program can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages.

[0161] Embodiment 3

[0162] An embodiment of the present invention provides a storage medium containing a computer-executable program, and the computer-executable program is used to execute the method of Embodiment 1 when executed by a computer processor.

[0163] The storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage medium include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0164] Embodiment 4

[0165] Embodiments of the present invention also provide a computer product, such as an app on a mobile phone or a tablet, an installation program on a computer, etc. The product includes computer programs / instructions, and when the computer programs / instructions are executed by a processor, the method described in Embodiment 1 is implemented. Code for a computer-executable program for performing the operations of the present invention can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0166] It should be understood that the above embodiments and the descriptions in the specification only illustrate the principles, main features and advantages of the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the protection scope of the present invention.

Claims

1. A real-time hair denoising and restoration method based on geometric parametric modeling, characterized in that The steps include the following: (1) Construct a visibility buffer, and use the visibility buffer to capture the core geometric features of hair strands in screen space through ray tracing technology, including the tangent direction, unique identifier, and parametric position of the visible points of each hair strand; (2) For the hair breakage areas caused by low sampling, screen the pixels with the most matching directions from adjacent pixels as the filling reference source, and gradually fill the core geometric features of the hair breakage areas in the visibility buffer along the hair extension direction based on the filling reference source; wherein, the dynamic step size changes according to the curvature and density of the hair strands; (3) Color each hair pixel of each hair strand according to the filled visibility buffer; (4) Perform brightness compensation on the coloring result so that the sum of the brightness of the hair pixels of each hair strand before and after filling remains unchanged; (5) Perform screen space filtering on each hair pixel of each hair strand along the hair extension direction to achieve hair denoising and restoration.

2. The real-time hair denoising and restoration method based on geometric parameterization modeling according to claim 1, wherein, (6) Step (1) specifically includes: (1.1) Construct a visibility buffer with a preset storage space; (1.2) Emit rays starting from each pixel in screen space, and intersect the rays with the hair strands in the scene in world space; (1.3) When there is an intersection between the ray and the hair strand, use the pre-constructed visibility buffer to capture and record the core geometric features of the hair strand at the visible point. Among them, the RG channels of the visibility buffer store the tangent direction of the visible point in screen space, the B channel stores the parametric position of the visible point, that is, the position of the visible point on the hair strand length, and the A channel stores the existence flag and the unique identifier of the hair strand. The existence flag is used to identify whether the pixel belongs to the hair area.

3. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 1, wherein (10) Step (2) specifically includes: (2.1) Take the pixels in screen space that intersect with the hair strands in the scene as hair pixels, and take the pixels in screen space that do not intersect with the hair strands in the scene as empty pixels in the breakage area; (2.2) Calculate the direction vectors between the empty pixels and each adjacent hair pixel: d i = normalize(p empty - p i ) In the formula, i represents an empty pixel p empty and the direction vector of the adjacent hair pixel p i ; (2.3) Obtain the tangent direction T of the hair to which each adjacent hair pixel is located from the visibility buffer i , and calculate d i and the dot product ∈ i with the corresponding hair tangent direction T i , and filter out those that satisfy ∈ i > σ and ∈ i the hair pixel p with the highest i , which is used as the filling reference source, σ is a preset threshold, and normalize() represents the normalization function; (2.4) For each hair strand, start from the filling reference source and fill each pixel of the hair strand along the hair extension direction according to the dynamic step size, wherein, the dynamic step size changes according to the curvature and density of the hair strands.

4. The real-time hair denoising and restoration method based on geometric parameterization modeling according to claim 3, wherein (14) Step (2.4) specifically includes: (2.4.1) For each filling reference source, obtain its parametric position and the unique identifier of the hair strand where it is located from the visibility buffer, and set the initial value of the parametric position t curr to be the parametric position of the filling reference source; (2.4.2) For the current parameterized position t curr , based on the unique identifier of the hair strand where it is located and the parameterized position t curr reconstruct its world space coordinates World curr , and according to the projection matrix from world space to screen space, obtain the pixel p of the hair strand point at the parameterized position t curr in screen space new ; (2.4.3) If pixel p new does not store the core geometric feature data in the visibility buffer, then use the core geometric feature data of the hair at the parameterized position t curr in world space as the core geometric feature data of p new and fill it into the visibility buffer; otherwise, directly execute (2.4.4); (2.4.4) If the current parameterized position t curr is the first value, calculate the step size and the hair strand extension direction according to the following formula: S = sign((p empty - p new ) T src ) where Δt represents the step size, M -1 () represents the projection matrix from screen space to world space, p src represents the pixel to be filled in screen space, L Strand represents the length of the hair strand in world space, s represents the hair strand extension direction, T src represents the tangent direction of the starting point of the hair strand in screen space, sign() represents the sign function; If the current parameterized position t curr is not the first value, calculate the step size and the parameterized propagation direction according to the following formula: s = sign((p prev - p new )T src ) where t prev represents the parameterized position at the previous iteration, p prev represents t prev corresponding screen space pixel, and Δd represents the change in the parameterized position corresponding to one pixel length of the hair strand in screen space; (2.4.5) Update the parameterized position t curr = t curr + s * Δt, and judge whether t curr is greater than 1 or encounters a filled pixel. If so, it is considered that the current hair filling is completed; otherwise, return to execute (2.4.2).

5. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 1, characterized in that (15) Step (3) includes: (3.1) Extract the unique identifier and parametric position of each hair visible point from the visibility buffer, obtain the hair pixels of the hair visible points in screen space, and reconstruct the spatial coordinates of the hair visible points in world space; (3.2) Reconstruct the ray emitted from the hair pixel with the hair pixel in screen space as the starting point and the spatial coordinates of the hair visible point in world space as the end point, and set the coloring direction of the hair pixel to the direction of the reconstructed ray; (3.3) Select any mode from the full sub-pixel coloring mode and the random sub-pixel coloring mode for hair pixel coloring; among them, in the full sub-pixel coloring mode, each pixel is colored and settled individually; in the random sub-pixel coloring mode, four adjacent hair pixels are taken as a group, and a hair pixel is randomly selected from each group for coloring calculation, and the coloring result is used as the coloring result of all hair pixels in the group; (3.4) Store the coloring result in the color buffer to complete the coloring.

6. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 1, characterized in that Step (4) includes: (4.1) For each hair pixel, read the unique identifier of the hair it belongs to from the visibility buffer, and reconstruct the bounding box of the whole hair in the world space according to the unique identifier of the hair; (4.2) Calculate the bounding box of the whole hair in the screen space according to the bounding box of the whole hair in the world space; (4.3) Obtain the hash table with the following storage space according to the bounding box of the whole hair in the screen space: HA = W proj × H proj × 1.2 where HA is the hash table size, and W proj and H proj are the width and height of the bounding box of the overall hair strand in screen space, respectively; (4.4) Calculate the total radiation of hair pixels before filling, the total radiation of replaced background pixels, and the total radiation of hair pixels after filling according to the following formula, and store them in the hash table: Where, E hair represents the total radiation of hair pixels before filling, L k is the brightness of hair strand pixel k before filling, and M represents the number of hair strand pixels of the hair before filling; E bg represents the total radiation of the replaced background pixels, B j is the brightness of background pixel j, and N is the number of background pixels, is the total radiation of hair pixels after filling, LT k′ is the brightness of hair strand pixel k' after filling, and M' represents the number of hair strand pixels of the hair after filling; (4.5) Calculate the scaling factor α according to the data in the hash table using the following formula I :[[]]END]] (4.6) Correct the coloring result of each hair pixel according to the scaling factor α I : C correct = C shading * α I where C shading represents the pixel coloring result of step (3), and C correct represents the coloring result of the corrected hair pixels.

7. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 1, characterized in that Step (5) includes: (5.1) Obtain each hair pixel along the hair extension direction, and obtain the tangent direction of each hair pixel from the visibility buffer; (5.2) Calculate the position of the center of the curvature circle according to the tangent direction and the preset filtering radius according to the following formula: P center = p + R * N p Wherein, P center is the position of the center of the curvature circle, p represents the position of the current hair pixel, R represents the preset filtering radius, and N p represents the normal direction perpendicular to the tangent direction T p of the hair pixel p; (5.3) Draw a curvature circle with the position of the center of the curvature circle as the center and the preset filtering radius as the radius; (5.4) Take the hair pixels within the preset radian range on the curvature circle as the set Ω(p) of adjacent hair pixels of the current hair pixel; (5.5) For each hair pixel in the set Ω(p) of adjacent hair pixels, calculate the composite weight according to the following formula: w q = w distance · w tangent · w color where, w q represents the composite weight of q, w distance represents the Gaussian decay weight, w tangent represents the direction consistency weight, w color represents the color difference weight, d p represents the Euclidean distance between p and q, σ d is the pixel control decay rate, θ q represents the angular deviation, ∠() represents finding the angular deviation, σ θ represents the radian adjustment direction sensitivity, C p 、C q respectively represent the pixel colors of p and q, σ c is the color difference sensitivity, and q represents any hair pixel in Ω(p); (5.6) Perform screen space filtering on the hair pixels according to the composite weight: where C′ p represents the color value of the hair strand pixel p after screen space filtering.

8. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that: The processor executes the computer program to implement the method according to any one of claims 1-7.

9. A computer-readable storage medium having computer programs / instructions stored thereon, characterized in that, The computer program / instructions implement the method according to any one of claims 1-7 when executed by the processor.

10. A computer program product comprising computer programs / instructions, characterized in that, The computer program / instructions implement the method according to any one of claims 1-7 when executed by the processor.