Geometric parametric modeling-based real-time hair de-noising and repairing method and equipment
By constructing a visibility buffer and an energy consistency compensation algorithm, the problems of hair breakage and dynamic noise in real-time rendering are solved, achieving efficient noise reduction and restoration of hair while preserving details.
Patent Information
- Application Number
- CN202510930219.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2025-04-01
- Filing Date
- 2025-07-07
- Publication Date
- 2025-11-04
AI Technical Summary
Existing technologies struggle to effectively address issues such as hair breakage and dynamic noise suppression imbalance caused by low sampling rates when rendering hair in real time. This is especially true in dynamic scenes, where traditional methods cannot accurately distinguish between intersecting hair strands, leading to hair strand adhesion or breakage residue after repair. Furthermore, the lack of physical basis in geometric modeling and fragmented processing results in motion blur in the rendering.
By constructing a visibility buffer to capture the core geometric features of hair strands, using direction matching and dynamic step size to fill the broken areas of hair strands, and combining energy consistency compensation algorithm and tangential direction guided filtering, noise reduction and repair of hair strands are achieved.
It effectively repairs hair breakage under low sampling rates, maintains the direction of hair highlights, eliminates sudden changes in dynamic lighting intensity, and achieves synergistic optimization of detail fidelity and noise reduction in real-time rendering.
Smart Images

Figure CN120894264A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to rendering technology, and in particular to a real-time hair denoising repair method and device based on geometric parameterization modeling. BACKGROUND
[0002] Real-time rendering technology is the core foundation of supporting interactive applications such as games and virtual reality. Early rendering relies on rasterization pipeline to quickly generate images through triangular mesh, but it is difficult to simulate the physical properties of complex materials such as hair (such as hair luster, translucent texture). With the popularization of ray tracing hardware, real-time rendering begins to integrate film-level technology, but how to process hair-level details within milliseconds is still a major challenge.
[0003] Ray tracing is a rendering technology that simulates the physical behavior of real light. By tracing the light from the camera, it generates global lighting effects with a sense of physical reality by simulating the interaction between the light and the surface of the object in the scene, such as reflection, refraction, scattering, etc. Compared with traditional rasterization technology, ray tracing can more accurately present complex optical phenomena such as shadows, specular reflection, and caustics, and has become the core means of film-level offline rendering.
[0004] With the introduction of RT Core hardware unit and acceleration structure (BVH) in RTX series graphics cards, the intersection calculation efficiency of ray tracing has been improved by orders of magnitude, making real-time ray tracing possible. However, real-time rendering needs to compress the sampling rate to 1-2spp, resulting in severe Monte Carlo noise and loss of high-frequency details. To make up for the defects of low sampling, the industry uses temporal filtering (such as SVGF) and importance sampling multiplexing (such as ReSTIR) technology: the former suppresses noise by mixing multiple frames of pixel data, and the latter uses screen space reservoir (Reservoir) to reuse light source samples across frames / pixels to improve lighting convergence speed. However, such methods face fundamental limitations in dynamic scenes - samples stored in screen space cannot adapt to fast-moving geometry (such as floating hair), resulting in invalidation of historical data and recurrence of noise. Hair rendering further amplifies this contradiction: the diameter of hair is often smaller than the size of a pixel, and sub-pixel level breaks under low sampling form "hair tip fragmentation" artifacts; traditional isotropic filtering (such as Gaussian blur) smoothes the highlight direction because it ignores the tangential directionality of hair, making the hair texture appear plastic.
[0005] The core defects of current hair denoising technology are concentrated in the missing of geometric fracture repair and the imbalance of dynamic noise suppression. The mainstream space-time filtering relies on color and normal similarity interpolation, which cannot distinguish the interlaced hair in the same pixel (such as sub-pixel fracture of intersecting hair bundles), resulting in sticking or fracture residue of the repaired hair; although the deep learning super-resolution technology (such as DLSS) enlarges the image resolution through a neural network, the super-resolution model is trained based on general scenes, and lacks targeted perception of hair-level geometric features, and after enlargement, the jagged or blurred edges of the fracture are exposed. More importantly, the existing solutions separate the denoising and geometric modeling, resulting in a lack of physical basis for fracture repair. In the dynamic scene, denoising or multiplexing in the time domain will cause the problem of trailing of the rendering result. SUMMARY
[0006] In view of the problems existing in the prior art, the purpose of the present application is to provide a real-time hair denoising repair method based on geometric parameterized modeling with better repair effect and equipment.
[0007] In order to achieve the above-mentioned purpose of the application, the present application provides the following technical scheme:
[0008] A real-time hair denoising repair method based on geometric parameterized modeling, comprising the following steps:
[0009] (1) constructing a visibility buffer, and using the visibility buffer to capture the core geometric features of the hair in the screen space by ray tracing technology, including the tangent direction, unique identifier and parameterized position of the visible point of each hair;
[0010] (2) for the hair fracture area caused by low sampling, selecting the pixel with the most matched direction from the adjacent pixels as the filling reference source, and filling the core geometric features of the hair fracture area in the visibility buffer along the extension direction of the hair based on the filling reference source according to a dynamic step length; wherein the dynamic step length changes according to the curvature and density of the hair;
[0011] (3) coloring each hair pixel of each hair according to the filled visibility buffer;
[0012] (4) performing brightness compensation on the coloring result, so that the brightness of each hair pixel of each hair before and after filling is unchanged;
[0013] (5) performing screen space filtering on each hair pixel of each hair along the extension direction of the hair to realize hair denoising repair.
[0014] Further, step (1) specifically comprises:
[0015] (1.1) constructing a visibility buffer with a preset storage space;
[0016] (1.2) emit a ray from each pixel in screen space and intersect the ray with the hairs in the scene in world space;
[0017] (1.3) when there is an intersection between the ray and a hair, take the intersection as a visible point, and capture and record the core geometric features of the hair at the visible point using a pre-constructed visibility buffer, wherein the RG channel of the visibility buffer stores the tangent direction of the visible point in screen space, the B channel stores the parametric position of the visible point, i.e. 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 unique identifier of the hair, the existence flag is used to identify whether the pixel belongs to the hair region, and the fitting source flag is used to indicate whether the data source is an algorithm fitting or an original geometry.
[0018] Further, step (2) specifically comprises:
[0019] (2.1) take the pixels in screen space intersecting with the hairs in the scene as hair pixels, and take the pixels in screen space not intersecting with the hairs in the scene as empty pixels of the broken region;
[0020] (2.2) calculate the directional vector between the empty pixel and each adjacent hair pixel:
[0021] d i =normalize(p empty -p i )
[0022] wherein d i represents the directional vector of the empty pixel p empty and the adjacent hair pixel p i .
[0023] (2.3) obtain the tangent direction T i of the hair where each adjacent hair pixel is located from the visibility buffer, and calculate the dot product ∈ i between d i and the corresponding hair tangent direction T i , from which the hair pixel p i with the highest ∈ i satisfying ∈ i >σ is selected as the filling reference source, and σ is a preset threshold, and normalize() represents a normalization function;
[0024] (2.4) for each hair, fill each pixel of the hair in the extension direction of the hair from the filling reference source with a dynamic step length, wherein the dynamic step length changes according to the curvature and density of the hair.
[0025] Further, step (2.4) specifically comprises:
[0026] (2.4.1) For each fill fiducial, get its parameterized position and the unique identifier of the hair strand it belongs to from the visibility buffer, set the parameterized position t curr as the parameterized position of the fill fiducial;
[0027] (2.4.2) For the current parameterized position t curr , reconstruct its world space coordinate World curr according to the unique identifier of the hair strand it belongs to and the parameterized position t curr , and get the pixel p curr in screen space of the hair strand point at the parameterized position t new according to the projection matrix from world space to screen space;
[0028] (2.4.3) If the pixel p new has no core geometry data stored in the visibility buffer, fill the core geometry data of the hair strand at the parameterized position t curr in world space as the core geometry data of p new in the visibility buffer; otherwise, directly execute (2.4.4);
[0029] (2.4.4) If the current parameterized position t curr is the first value, calculate the step size and the hair strand extending direction according to the following formula:
[0030]
[0031] s = sign((p empty -p new )T src )
[0032] 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 extending direction, T src represents the tangent direction of the hair strand starting point in screen space, and sign() represents the sign function;
[0033] 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:
[0034]
[0035] s = sign((p prev -p new )T src )
[0036] where t prev denotes the parameterized position at the last iteration, p prev denotes t prev the corresponding screen space pixel, and Δd denotes the change of the parameterized position corresponding to one pixel length of the hair in the screen space;
[0037] (2.4.5) updating the parameterized position t curr = t curr + s*Δt, judging whether t curr is greater than 1 or encounters a filled pixel, if yes, considering that the current hair is filled, otherwise returning to execute (2.4.2).
[0038] Further, step (3) comprises:
[0039] (3.1) extracting the unique identifier and the parameterized position of each hair visible point from the visibility buffer, obtaining the hair pixel of the hair visible point in the screen space, and reconstructing the spatial coordinates of the hair visible point in the world space;
[0040] (3.2) taking the hair pixel in the screen space as the starting point and the spatial coordinates of the hair visible point in the world space as the focus, reconstructing the light ray emitted by the hair pixel, and setting the shading direction of the hair pixel as the direction of the reconstructed light ray;
[0041] (3.3) selecting any mode from the full sub-pixel shading mode and the random sub-pixel shading mode for hair pixel shading; wherein in the full sub-pixel shading mode, each pixel is shaded and calculated 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 taken as the shading result of all hair pixels in the group;
[0042] (3.4) storing the shading result in the color buffer to complete the shading.
[0043] Further, step (4) comprises:
[0044] (4.1) for each hair pixel, reading the unique identifier of the hair in which it is located from the visibility buffer, and reconstructing the bounding box of the whole hair in the world space according to the unique identifier of the hair;
[0045] (4.2) calculating the bounding box of the whole hair in the screen space according to the bounding box of the whole hair in the world space;
[0046] (4.3) obtaining the hash table of the storage space as follows according to the bounding box of the whole hair in the screen space:
[0047] HA = W proj×H proj ×1.2
[0048] wherein, HA is the hash table size, W proj , H proj are the width and height of the bounding box of the hair strand in the screen space respectively;
[0049] (4.4) Calculate the total radiance of the hair pixels before filling, the total radiance of the replaced background pixels, and the total radiance of the hair pixels after filling according to the following formula, and store them in the hash table:
[0050]
[0051] wherein, E hair represents the total radiance of the hair pixels before filling, L k is the luminance of the hair strand pixel k before filling, and M represents the number of hair strand pixels of the hair strand before filling; E bg represents the total radiance of the replaced background pixels, B j is the luminance of the background pixel j, and N is the number of background pixels, represents the total radiance of the hair pixels after filling, LT k′ is the luminance of the hair strand pixel k' after filling, and M' represents the number of hair strand pixels of the hair strand after filling;
[0052] (4.5) According to the data in the hash table, the scaling factor a I is calculated according to the following formula:
[0053]
[0054] (4.6) According to the scaling factor a I , the coloring result of each hair strand pixel is corrected:
[0055] C correct = C shadung * a 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] Further, step (5) comprises:
[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) According to the tangent direction and the preset filter radius, the center position of the curvature circle is calculated according to the following formula:
[0060] P center= p + R*N p
[0061] wherein P center is the center position of the curvature circle, p represents the current hair pixel position, R represents the preset filter radius, N p represents the normal direction perpendicular to the tangent direction T p of the hair pixel p;
[0062] (5.3) drawing a curvature circle with the center position of the curvature circle as the center and the preset filter radius as the radius;
[0063] (5.4) taking the hair pixels within the preset radian range on the curvature circle as the adjacent hair pixel set Ω(p) of the current hair pixel;
[0064] (5.5) calculating the composite weight of each hair pixel in the adjacent hair pixel set Ω(p) 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 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 angle deviation, ∠() represents 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) screen space filtering the hair pixel 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 comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor executing the computer program to implement the above method.
[0072] A computer readable storage medium having stored thereon computer programs / instructions that, when executed by a processor, implement the above method.
[0073] A computer program product comprising computer programs / instructions, wherein the computer programs / instructions, when executed by a processor, implement the above method.
[0074] Compared with the prior art, the present application has the following advantages:
[0075] 1. A geometric perception gap filling mechanism is proposed to reconstruct sub-pixel level broken areas by hair parameterization extension, solving the problem of hair breakage caused by low sampling rate.
[0076] 2. An energy consistency compensation algorithm is designed to jointly calculate the brightness contribution of hair and background, eliminating the dynamic light brightness mutation caused by filling pixels, and breaking through the physical energy distortion bottleneck of traditional filtering.
[0077] 3. Tangential direction guided filtering is used to fuse space, tangent and color features through direction sensitive weight, removing noise while preserving hair highlight direction, achieving collaborative optimization of detail fidelity and noise reduction effect in real-time rendering. BRIEF DESCRIPTION OF DRAWINGS
[0078] Figure 1 is the flowchart of the real-time hair denoising and repairing method based on geometric parameterization modeling provided by the present application;
[0079] Figure 2 is the rendering result comparison chart of the curly hair provided by the present application;
[0080] Figure 3 is the rendering result comparison chart of the straight hair provided by the present application;
[0081] Figure 4 is the structure diagram of the computer device provided by the present application. DETAILED DESCRIPTION
[0082] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.
[0083] Embodiment one
[0084] The present application provides a real-time hair denoising and repairing method based on geometric parameterization modeling, which needs to be preprocessed before denoising and repairing, specifically:
[0085] 1. Model the geometric model of the hair strand by using a cubic Bezier curve as the parametric curve of the hair strand, each hair strand is defined by four control points, store the position coordinates and radius parameters to support the hair strand thickness gradient effect, and register the hair strand as a ray tracing geometry through the OptiX API, and construct a dynamic acceleration structure to realize efficient intersection.
[0086] 2. Allocate core memory resources based on the CUDA unified memory model: a visibility buffer (VBuffer) is created with twice the resolution of the color buffer (Color Buffer) (such as 3840x2160@1080p), which stores the screen space hair strand tangent direction (float2), unique identifier (uint), and parameterized position t (float); the Color Buffer is allocated according to the native resolution of the screen, and stores the final shading result. In the transparency correction process, a hash table is dynamically constructed: the hash table size is calculated according to the hair strand projection area, and the conflict is managed through CUDA atomic operations. All resources are bound to CUDA kernel functions through device pointers, realizing zero-copy memory access, meeting the real-time rendering performance requirements.
[0087] 3. Use OptiX Shader Binding Table (SBT) to realize 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 rendering required Buffer through device pointers in real time. Create RayGenProgram required by different rendering processes.
[0088] After preprocessing, the denoising and repair process is performed, as shown in Figure 1 , including the following steps:
[0089] (1) Construct a visibility buffer, and use the visibility buffer to capture the core geometric features of the hair strand in the 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 a ray from each pixel in the screen space, and perform intersection between the ray and the hair strands in the scene in the world space;
[0093] (1.3) When a light ray intersects with a hair strand, this intersection is taken as a visible point. A pre-constructed visibility buffer is used to capture and record the core geometric features of the hair strand at the visible point. The core geometric features include the tangent direction, unique identifier, and parameterized position of the visible point of each hair strand. Specifically, the visibility buffer records key geometric information in a compact 128-bit pixel format. The RG channel of the visibility buffer stores the tangent direction of the visible point in screen space, and the B channel stores the parameterized position t of the visible point, which is the position of the visible point on the hair strand length. For example, the parameterized position t is a number in the range [0,1]. When the parameterized position t = 0, it represents the hair strand start point; when t = 1, it represents the hair strand end point; and when t = 0.5, it represents the hair strand midpoint. The A channel stores the presence flag, the fitting source flag, and the hair strand unique identifier. Multiple identification information is integrated through a bitmask field. The presence flag is used to identify whether a pixel belongs to the hair region, and the fitting source flag is used to indicate whether the data source is algorithm fitting or the original geometry. This buffer structure efficiently stores the microscopic geometric features of hair while providing accurate data for subsequent anti-aliasing filtering, energy compensation, and rendering shading.
[0094] (2) For the hair breakage area caused by low sampling, the pixel with the best direction matching is selected from the adjacent pixels as the filling reference source. 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 the dynamic step size.
[0095] Step (2) specifically includes:
[0096] (2.1) Pixels in screen space that intersect with hair strands in the scene are taken as hair strand pixels, and pixels in screen space that do not intersect with hair strands in the scene are taken as empty pixels in the broken 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 Indicates empty pixel p empty With adjacent hair pixel p i The direction vector;
[0100] (2.3) Obtain the tangent direction T of the hair strand where each adjacent hair strand pixel is located from the visibility buffer. i And calculate d i tangential direction T of the corresponding hair strand i dot product ∈ i Filter from them to find those that satisfy ∈ i >σ and ∈i The highest hair pixel p i , as the filling reference source, σ is the preset threshold, and normalize() represents the normalization function;
[0101] (2.4) For each hair strand, starting from the filling reference source, each pixel of the hair strand is filled along the hair strand extension direction according to the dynamic step size to ensure the natural continuity of the repaired hair strand in the visual topology. The dynamic step size is changed according to the curvature and density of the hair strand.
[0102] Step (2.4) specifically includes:
[0103] (2.4.1) For each fill reference source, obtain its parameterized position and unique identifier of the hair strand from the visibility buffer, and set the parameterized position t. curr The initial value is the parameterized position of the fill reference source;
[0104] (2.4.2) For the current parameterized position t curr Based on the unique identifier of the hair strand and the parameterized position t curr Reconstruct its world space coordinates curr And according to the projection matrix from world space to screen space, the parameterized position t is obtained. curr The hair strands are located at pixels p in screen space. new ;
[0105] (2.4.3) If pixel p new If the core geometric feature data is not stored in the visibility buffer, then the parameterized position t in world space will be... curr The core geometric feature data of the hair strand is used as p new The core geometric feature data is filled into the visibility buffer; otherwise, proceed directly to (2.4.4).
[0106] (2.4.4) If the current parameterization position t curr If the first value is used, the step size and hair extension direction are calculated according to the following formula:
[0107]
[0108] s = sign((p empty -p new )T src )
[0109] In the formula, Δt represents the step size, and M -1 () represents the projection matrix from screen space to world space, p src L represents the pixels to be filled in screen space. Strandrepresents the length of the hair strand in the world space, s represents the direction of the hair strand, T src represents the tangent direction of the hair strand starting point in the screen space, and sign() represents a sign function.
[0110] If the current parameterized position t curr is not the first value, the step size and the parameterized propagation direction are calculated 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 last iteration, p prev represents the screen space pixel corresponding to t prev , and Δd represents the change amount of the parameterized position corresponding to one pixel length of the hair strand in the 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 yes, it is considered that the current hair strand is filled, otherwise, return to execute (2.4.2).
[0115] Step (2) ensures that the repair direction is consistent with the tangent direction by using the screen space tangent direction and the screen space connection direction of the pixel as weights, finds more broken pixels that can be filled through a soft raster, dynamically adjusts the step size to make the search more efficient, and finally generates 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 subsequent shading, filtering and energy compensation stages, and significantly improves the visual integrity and physical consistency of hair rendering.
[0116] (3) According to the filled visibility buffer, each hair strand pixel of each hair strand is shaded.
[0117] Step (3) includes:
[0118] (3.1) Extract the unique identifier and the parameterized position of each hair strand visible point from the visibility buffer, obtain the hair strand pixel of the hair strand visible point in the screen space, and reconstruct the spatial coordinates of the hair strand visible point in the world space;
[0119] (3.2) taking the hair pixel in screen space as the starting point and the spatial coordinates of the hair visible point in world space as the focus point, reconstructing the light ray emitted by the hair pixel, and setting the shading direction of the hair pixel as the direction of the reconstructed light ray;
[0120] (3.3) selecting any mode from the full sub-pixel shading mode and the random sub-pixel shading mode for hair pixel shading; wherein in the full sub-pixel shading mode, each pixel is independently shaded and calculated; 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 taken as the shading result of all hair pixels in the group; wherein the rendering picture resolution finally presented by the system is referred to as the base resolution, VBuffer processes geometry at double 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) storing the shading result in the color buffer to complete shading.
[0122] Among them, two shading modes are provided in this stage 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 result of each high-resolution sub-pixel, and the shading overhead will be larger, but the effect will be better than random shading. Therefore, in the case of pursuing higher rendering quality, the full sub-pixel shading mode is selected, and in the case of pursuing higher performance, the random sub-pixel shading mode is selected.
[0123] The present application focuses on the repair and denoising process of hair rendering, which can be combined with any hair shading model. The hair shading model is already mature and is not the focus of the present application, and will not be expanded here.
[0124] (4) performing brightness compensation on the shading result so that the brightness of the hair pixel of each hair strand before and after the filling is unchanged.
[0125] Step (4) includes:
[0126] (4.1) for each hair pixel, reading the unique identifier of the hair strand from the visibility buffer, and reconstructing the bounding box of the entire hair strand in world space according to the unique identifier of the hair strand;
[0127] (4.2) calculating the bounding box of the entire hair strand in screen space according to the bounding box of the entire hair strand in world space;
[0128] (4.3) obtaining a hash table with the following storage space according to the bounding box of the entire hair strand in screen space;
[0129] HA = W proj x H proj x 1.2
[0130] In the formula, HA is the size of the hash table, W proj , H proj are the width and height of the bounding box of the hair in the screen space, respectively;
[0131] (4.4) Calculate the total radiance of the hair pixels before filling, the total radiance of the replaced background pixels, and the total radiance of the hair pixels after filling according to the following formula and store them in the hash table:
[0132]
[0133] In the formula, E hair represents the total radiance of the hair pixels before filling, L k is the luminance of the hair pixel k before filling, and M represents the number of hair pixels of the hair before filling; E bg represents the total radiance of the replaced background pixels, B j is the luminance of the background pixel j, and N is the number of background pixels, is the total radiance of the hair pixels after filling, LT k′ is the luminance of the hair pixel k' after filling, and M' represents the number of hair pixels of the hair after filling;
[0134] (4.5) According to the data in the hash table, the scaling factor a I is calculated according to the following formula:
[0135]
[0136] (4.6) According to the scaling factor a I , the coloring result of each hair pixel is corrected:
[0137] C correct = C shading * a I
[0138] In the formula, C shading represents the coloring result of the pixel in step (3), and C correct represents the coloring result of the corrected hair pixel.
[0139] This stage solves the brightness distortion problem of the hair filling area through a dynamic energy compensation mechanism.
[0140] (5) Screen space filtering is performed on each hair pixel of each hair along the extension direction of the hair to achieve hair denoising and repair.
[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 curvature circle center position according to the tangent direction and the preset filter radius according to the following formula:
[0144] P center =p+R*N p
[0145] In the formula, P center is the curvature circle center position, p represents the current hair pixel position, R represents the preset filter radius, 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 curvature circle center position as the center and the preset filter radius as the radius;
[0147] (5.4) Take the hair pixels within the preset radian range on the curvature circle as the adjacent hair pixel set Ω(p) of the current hair pixel;
[0148] (5.5) For each hair pixel in the adjacent hair pixel set Ω(p), 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 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 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);
[0152] (5.6) Screen space filtering is performed on the hair pixel 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] Experiments were conducted on the present application, and specifically, an RTX4090 graphics card was used for testing, Figure 2 Fig. 1 is a rendering result comparison chart of the present application on curly hair, from left to right, 1spp is the ordinary rendering mode, the random sub-pixel shading mode of the present rendering method, 4spp ordinary rendering mode, the full sub-pixel shading mode of the present rendering method, 1024spp ordinary rendering mode, and 1024spp ordinary rendering mode as a reference chart. Figure 3 Fig. 2 is a rendering result comparison chart of the present application on straight hair. It can be seen that the present application achieves a significant denoising reconstruction effect, and the denoising effect is good.
[0156] Embodiment two
[0157] The embodiment of the present application provides a computer device, and the embodiment of the present application provides services for the implementation of the method of the above embodiment one of the present application. As shown in the figure, the device can include a memory 301 storing a computer executable program; a processor 302 coupled with the memory 301; the processor 302 invokes the computer executable program stored in the memory 301, and is used for executing the steps in the method described in embodiment one. Figure 4
[0158] The memory 301 can 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 can further include other removable / non-removable, volatile / non-volatile computer system storage media. For example, the memory 301 can be used to read and write non-removable, non-volatile magnetic media (commonly referred to as "hard disk drive"). The program / utility having a set of (at least one) program modules can 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, each of which or some combination thereof can include the implementation of a network environment. The computer executable programs of the program modules generally perform the functions and / or methods in the embodiments described in the present application.
[0159] The processor 302 performs various functional applications and data processing by running the program stored in the memory 301, such as implementing the method provided in the embodiment one of the present application.
[0160] Code of a computer program can be written in one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages.
[0161] Embodiment three
[0162] The embodiment of the present application provides a storage medium containing a computer executable program, which is used for executing the method of the embodiment one when executed by a computer processor.
[0163] The storage medium of the embodiment of the present application can adopt any combination of one or more computer readable mediums. 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 electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, 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 disc 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 connection with an instruction execution system, apparatus or device.
[0164] Embodiment four
[0165] The embodiment of the present application also provides a computer product, for example, an app on a mobile phone, a tablet computer, an installation program on a computer, etc., which comprises computer programs / instructions, and the computer programs / instructions are executed by a processor to realize the method in the embodiment one. The code for executing the computer executable program for operating the present application can be written in one or more programming languages or combinations thereof, and the programming languages include object-oriented programming languages, such as Java, Smalltalk, C++, and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed completely on a user computer, partially on a user computer, as an independent software package, partially on a user computer and partially on a remote computer, or completely on a remote computer or server. In the case of involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, connected through the Internet by using an Internet service provider).
[0166] It should be understood that the above embodiments and descriptions described in the specification are only the principles, main features and advantages of the present application, and various changes and improvements can be made to the present application without departing from the spirit and scope of the present application, and these changes and improvements all fall within the protection scope of the present application.
Claims
1. A real-time hair denoising and restoration method based on geometric parametric modeling, characterized in that, Includes the following steps: (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 parameterized position of the visible point of each hair strand; (2) For the hair breakage area caused by low sampling, the pixel with the best direction matching is selected from the adjacent pixels as the filling reference source. Based on the filling reference source, the core geometric features of the hair breakage area are gradually filled in the visibility buffer according to the hair extension direction with a dynamic step size. The dynamic step size is changed according to the curvature and density of the hair. (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 brightness of each hair strand pixel remains unchanged before and after filling; (5) Screen space filtering is performed on each pixel of each hair along the hair extension direction to achieve hair noise reduction and repair.
2. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 1, characterized in that, Step (1) specifically includes: (1.1) Construct a visibility buffer with a preset storage space; (1.2) Emit rays starting from each pixel in the screen space and find the intersection of the rays with the hair strands in the scene of the world space; (1.3) When there is an intersection between the light and the hair, the intersection is taken as the visible point. The core geometric features of the hair at the visible point are captured and recorded using a pre-built visibility buffer. 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 hair length, and the A channel stores the presence flag and the unique identifier of the hair. The presence flag is used to identify whether the pixel belongs to the hair region.
3. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 1, characterized in that, Step (2) specifically includes: (2.1) Pixels in screen space that intersect with hair strands in the scene are taken as hair strand pixels, and pixels in screen space that do not intersect with hair strands in the scene are taken as empty pixels in the broken area. (2.2) Calculate the direction vector between the empty pixel and each adjacent hair pixel: d i =normalize(p empty -p i ) In the formula, d i Indicates empty pixel p empty With adjacent hair pixel p i The direction vector; (2.3) Obtain the tangent direction T of the hair strand where each adjacent hair strand pixel is located from the visibility buffer. i And calculate d i tangential direction T of the corresponding hair strand i dot product ∈ i Filter from them to find those that satisfy ∈ i >σ and ∈ i The highest hair pixel p i , as the filling reference source, σ is the preset threshold, and normalize() represents the normalization function; (2.4) For each hair strand, starting from the filling reference source, each pixel of the hair strand is filled along the hair strand extension direction according to the dynamic step size, wherein the dynamic step size changes according to the curvature and density of the hair strand.
4. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 3, characterized in that, Step (2.4) specifically includes: (2.4.1) For each fill reference source, obtain its parameterized position and unique identifier of the hair strand from the visibility buffer, and set the parameterized position t. curr The initial value is the parameterized position of the fill reference source; (2.4.2) For the current parameterized position t curr Based on the unique identifier of the hair strand and the parameterized position t curr Reconstruct its world space coordinates curr And according to the projection matrix from world space to screen space, the parameterized position t is obtained. curr The hair strands are located at pixels p in screen space. new ; (2.4.3) If pixel p new If the core geometric feature data is not stored in the visibility buffer, then the parameterized position t in world space will be... curr The core geometric feature data of the hair strand is used as p new The core geometric feature data is filled into the visibility buffer; otherwise, proceed directly to (2.4.4). (2.4.4) If the current parameterization position t curr If the first value is used, the step size and hair extension direction are calculated according to the following formula: s=sign((p empty -p new )T src ) In the formula, Δt represents the step size, and M -1 () represents the projection matrix from screen space to world space, p src L represents the pixels to be filled in screen space. Strand The length of a hair strand in world space is represented by 's', and the direction of the hair strand's extension is represented by 'T'. src The tangent direction of the starting point of the hair in screen space is indicated by sign(), which represents the sign function. If the current parameterization position t curr If it is not the first value, then the step size and parameterized propagation direction are calculated according to the following formula: s=sign((p prev -p new )T src ) In the formula, t prev p represents the parameterization position during the previous iteration. prev Indicates t prev The corresponding screen space pixel, Δd represents the amount of change in the parameterized position of the hair strand in screen space corresponding to a pixel length; (2.4.5) Update parameterized position t curr =t curr +s*Δt, determine t curr If the value is greater than 1 or an already filled pixel is encountered, then the current hair strand is considered to be filled; otherwise, return to execution (2.4.2).
5. The real-time hair denoising and restoration method based on geometric parametric modeling according to claim 1, characterized in that, Step (3) includes: (3.1) Extract the unique identifier and parameterized position of each visible hair point from the visibility buffer, obtain the hair pixel in screen space, and reconstruct the spatial coordinates of the visible hair point in world space. (3.2) Starting from the hair pixel in screen space and focusing on the spatial coordinates of the visible hair point in world space, reconstruct the light emitted by the hair pixel and set the shading direction of the hair pixel as the direction of the reconstructed light. (3.3) Select any mode from the full subpixel coloring mode and the random subpixel coloring mode to perform hair pixel coloring; wherein, in the full subpixel coloring mode, each pixel is colored and calculated separately; in the random subpixel coloring mode, four adjacent hair pixels are grouped together, 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 from the visibility buffer, and reconstruct the bounding box of the hair in world space based on the unique identifier of the hair; (4.2) Calculate the bounding box of the entire hair strand in screen space based on the bounding box of the entire hair strand in world space; (4.3) Based on the bounding box of the entire hair strand in screen space, obtain the following hash table for storage space: HA=W proj ×H proj ×1.2 In the formula, HA is the hash table size, and W... proj H proj These are the width and height of the overall bounding box of the hair strand within the screen space; (4.4) Calculate the total radiance of the hair pixels before filling, the total radiance of the background pixels being replaced, and the total radiance of the hair pixels after filling according to the following formula, and store them in a hash table: In the formula, E hair L represents the total radiation of the hair pixels before filling. k M represents the brightness of pixel k in front of the fill hair, and M represents the number of pixels in front of the fill hair; E bg B represents the total radiance of the replaced background pixels. j Let N be the brightness of background pixel j, and N be the number of background pixels. LT represents the total radiation of the hair pixels after filling. k′ M' represents the brightness of pixel k' after filling, and M' represents the number of pixels of the hair strand after filling. (4.5) The scaling factor α is calculated based on the data in the hash table using the following formula. I : (4.6) Based on the scaling factor α I The coloring result for each hair pixel is corrected: C correct =C shading *α I In the formula, C shading C represents the pixel coloring result of step (3). correct This indicates the coloring result of the corrected hair pixel.
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 following formula based on the tangent direction and the preset filtering radius: P center =p+R*N p In the formula, P center Let p be the center position of the curvature circle, p represent the current hair pixel position, R represent the preset filter radius, and N represent the position of the center of the curvature circle. p Indicates the tangential direction T of the pixel p of the hair. p The direction of the perpendicular normal; (5.3) Draw a curvature circle with the center of the curvature circle as the center and the preset filter radius as the radius; (5.4) Take the hair pixels within the preset arc range on the curvature circle as the set of neighboring hair pixels Ω(p) of the current hair pixel; (5.5) For each hair pixel in the set of neighboring hair pixels Ω(p), the composite weight is calculated according to the following formula: In q =in distance ·In tangent ·In color In the formula, w q w represents the composite weight of q. distance w represents the Gaussian decay weight. tangent w represents the directional consistency weight. color Indicates the color difference weight, d p σ represents the Euclidean distance between p and q. d To control the decay rate of pixels, θ q σ represents the angular deviation, ∠() represents calculating the angular deviation. θ C represents the sensitivity of the radian adjustment direction. p C q Let p and q represent the pixel colors respectively, and σ represent the pixel colors respectively. c For color difference sensitivity, q represents any hair-like pixel in Ω(p); (5.6) Perform screen space filtering on the hair pixels according to the composite weights: In the formula, C′ p This represents the screen space filtered color value of the hair pixel p.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor executes the computer program to implement the method as described in any one of claims 1-7.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, The computer program / instructions, when executed by a processor, implement the method of any one of claims 1-7.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method of any one of claims 1-7.