Parametric curved surface rendering method and device, equipment, medium and program product
By directly rasterizing parametric surfaces on the GPU and combining crack repair and contour recovery strategies, the triangulation error and crack problems in high-order parametric surface rendering are solved, achieving efficient and accurate rendering effects.
Patent Information
- Application Number
- CN202510853598.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-09-09
AI Technical Summary
Existing technologies require triangulation when rendering high-order parametric surfaces, which makes the calculation complex and introduces geometric errors and cracks. In particular, the performance decreases when rendering large-scale models. In addition, existing methods are inefficient and unsuitable for real-time rendering.
An iterative solution method is used to directly rasterize parametric surfaces on the GPU, omitting the triangulation step, and crack repair and contour recovery strategies are used to ensure the continuity and boundary integrity of the rendering results.
It achieves high-precision, high-performance real-time rendering, avoids errors and cracks caused by triangulation, and improves rendering efficiency and image quality.
Smart Images

Figure CN120612415A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer image processing, and more specifically, to a parametric surface rendering method, apparatus, device, medium, and program product. Background Art
[0002] In the graphics rendering process, most graphics hardware uses triangles as the basic rendering unit for rasterization. Parametric surfaces (parametric and NURBS surfaces) are widely used in engineering design, CAD, and animation due to their smoothness and expressiveness. However, current mainstream rendering methods typically first triangulate parametric surfaces (tessellation) to adapt them to the GPU hardware pipeline. This process is complex and can introduce geometric errors and cracks, resulting in significant performance degradation when rendering large models. Although some research has attempted to directly render parametric surfaces on the CPU or GPU using ray casting or recursive tessellation, these methods are generally inefficient and unsuitable for real-time rendering. Summary of the Invention
[0003] In view of the above problems, the present disclosure provides a parametric surface rendering method, apparatus, device, medium and program product for improving parametric surface rendering performance.
[0004] According to a first aspect of the present disclosure, a parametric surface rendering method is provided, comprising:
[0005] Get the control parameters of each parametric surface patch to be rendered;
[0006] Linearize the parametric surface patch according to the control parameters to obtain a linear segment corresponding to the parametric surface patch; perform hardware rasterization on the linear segment to obtain an initial parameter position value of a point corresponding to each screen pixel on the parametric surface patch;
[0007] Iteratively solving the accurate parameter position of the corresponding point of each screen pixel on the parameter surface patch according to the initial value of the parameter position;
[0008] Calculating the precise position and normal vector of the corresponding point of each screen pixel in world space based on the accurate parameter position and the parameter expression of the corresponding parametric surface patch;
[0009] The parametric surface patch is rendered according to the precise position and the normal vector to obtain a target image.
[0010] According to an embodiment of the present disclosure, the method further includes:
[0011] If there is a crack pixel among the screen pixels, obtaining an adjacent parametric surface patch of the parametric surface patch corresponding to the crack pixel;
[0012] Back-projecting the crack pixel onto the linear segment corresponding to the adjacent parametric surface patch to obtain the centroid coordinates of the crack pixel on the linear segment as the corrected parameter position initial value of the corresponding point of the crack pixel;
[0013] According to the corrected initial parameter position value, the corrected accurate parameter position of the corresponding point of the crack pixel is iteratively solved, and according to the corrected accurate parameter position and the parameter expression of the adjacent parametric surface patch, the corrected precise position and normal vector of the corresponding point of the crack pixel in the world space are calculated.
[0014] According to an embodiment of the present disclosure, the method further includes:
[0015] identifying contour pixels among the screen pixels;
[0016] Performing boundary extension on a linear segment of a parametric surface patch corresponding to each of the contour pixels;
[0017] The iterative solution is performed again on the linear segment after the boundary is expanded.
[0018] According to an embodiment of the present disclosure, identifying contour pixels among the screen pixels includes:
[0019] Get the angle between the sight direction and the normal direction corresponding to each screen pixel;
[0020] When the angle meets the set condition, the corresponding screen pixel is marked as a contour pixel.
[0021] According to an embodiment of the present disclosure, each of the parametric surface patches has a determined patch number, and the control parameters of the parametric surface patch include control points, weights, and topological relationships. The topological relationship is the boundary connection relationship between each parametric surface patch and adjacent parametric surface patches.
[0022] According to an embodiment of the present disclosure, after obtaining the initial parameter position value of the corresponding point of each screen pixel on the parametric surface patch, the initial parameter position value of the corresponding point of each screen pixel on the parametric surface patch and the patch sequence number of the parametric surface patch are written into the texture buffer.
[0023] Another aspect of the present disclosure provides a parametric surface rendering apparatus, comprising:
[0024] A parameter acquisition module is used to obtain the control parameters of each parametric surface patch to be rendered;
[0025] An initial value generation module is used to linearize the parametric surface patch according to the control parameters to obtain linear segments corresponding to the parametric surface patch; perform hardware rasterization on the linear segments to obtain the initial parameter position value of the corresponding point of each screen pixel on the parametric surface patch;
[0026] An iterative solution module, configured to iteratively solve the accurate parameter position of the corresponding point of each screen pixel on the parameter surface patch according to the initial value of the parameter position;
[0027] a pixel information solving module, configured to calculate the precise position and normal vector of the corresponding point of each screen pixel in world space based on the accurate parameter position and the parameter expression of the corresponding parametric surface patch; and
[0028] A rendering module is used to render the parametric surface patch according to the precise position and the normal vector to obtain a target image.
[0029] Another aspect of an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the method described above.
[0030] Another aspect of an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the processor is caused to perform the method described above.
[0031] Another aspect of an embodiment of the present disclosure provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0032] One or more of the above-described embodiments have the following beneficial effects: The disclosed embodiments eliminate the need for a triangulation step when rendering parametric surfaces, transforming the parametric surface rasterization problem into a point inversion problem. The parametric surface is input as a single primitive, and rasterization is performed directly on the GPU using an iterative solution method, thereby omitting the complex triangulation step and achieving high-precision, high-performance real-time rendering. Furthermore, the disclosed embodiments further propose crack repair and contour recovery strategies to avoid visual breaks or transparent areas caused by incorrect classification or calculation of some pixels due to parameter estimation errors or insufficient iterative area coverage, thereby ensuring the continuity and boundary integrity of the rendering results. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0034] Figure 1A flowchart of a parametric surface rendering method according to an embodiment of the present disclosure is schematically shown;
[0035] Figure 2 Schematically shows a flow chart of a crack repair strategy according to an embodiment of the present disclosure;
[0036] Figure 3 Schematically shows a flow chart of a contour recovery strategy according to an embodiment of the present disclosure;
[0037] Figure 4 Schematically shows a flow chart of contour pixel recognition according to an embodiment of the present disclosure;
[0038] Figure 5 Schematic diagrams showing the comparison of the effects before and after crack repair according to an embodiment of the present disclosure; (a) is a schematic diagram before crack repair, and (b) is a schematic diagram after crack repair;
[0039] Figure 6 Schematic diagrams showing the comparison of the effects before and after contour restoration according to an embodiment of the present disclosure are shown; (a) is a schematic diagram before contour restoration, and (b) is a schematic diagram after contour restoration;
[0040] Figure 7 The following schematically shows a structural block diagram of a parametric surface rendering device according to an embodiment of the present disclosure;
[0041] Figure 8 A block diagram of an electronic device suitable for implementing a parametric surface rendering method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0042] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0043] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise," "include," etc. used herein indicate the presence of the features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0044] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0045] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0046] High-order parametric surfaces, such as (Bezier) surfaces and NURBS (Non-Uniform Rational B-Spline) surfaces are widely used in engineering design and other fields due to their good smoothness and expressiveness. For the rendering of high-order parametric surfaces, traditional rendering methods require triangulation first, but this process will increase the amount of additional calculations and make the processing complex. On the other hand, it will introduce geometric errors and cracks, and the performance will be significantly reduced, especially when rendering large-scale models. In this regard, the embodiments of the present disclosure provide a parametric surface rendering method, device, equipment, medium and program product, which can omit the triangulation step, directly input the parametric surface as a single primitive, and use an iterative solution method to complete rasterization on the GPU, thereby achieving high-precision, high-performance real-time rendering. The method of the embodiments of the present disclosure is based on GPU programming and OpenGL rendering pipeline implementation, and uses Compute Shader to iteratively solve the parameters of each fragment pixel to achieve efficient and accurate large-scale parametric surface rendering.
[0047] Figure 1 A flowchart of a parametric surface rendering method according to an embodiment of the present disclosure is schematically shown.
[0048] like Figure 1 As shown, this embodiment includes operations S110 to S150:
[0049] In operation S110, the control parameters of each parametric surface patch to be rendered are obtained. The main goal of this operation is to input the control point data of the parametric surface into the GPU and prepare the necessary structural information for the subsequent parallel calculation of each patch. The control parameters include the control points, weights, and topological relationships of the parametric surface patch. The control points and weights are used to describe the shape of the parametric surface patch, and the topological relationships are used to describe the adjacency relationship between the parametric surface patches.
[0050] Parametric surfaces typically include Since NURBS surfaces cannot be directly used for rasterization processing in the method of the embodiment of the present disclosure, they need to be converted first and decomposed into multiple rational surfaces. Noodles ( ).
[0051] A NURBS patch can be converted to one or more rational The expression for the patch is as follows:
[0052] ;
[0053] in, It makes sense The parametric equations of the patch, represents the parameters corresponding to the parametric surface, Indicates that the NURBS surface is parameterized The weighted control point combination at Indicates that the parameter The weight function at Represents the three-dimensional coordinates of the control vertex, Indicates the weight coefficient corresponding to the control vertex, , Representation and control points The tensor basis functions corresponding to the Bernstein polynomials, , .
[0054] All The control points, weights, and topological relationships of the patches are organized into a structured buffer (ShaderStorage Buffer Object, SSBO) and passed to the GPU, where the topological relationships are stored based on the patch IDs of adjacent patches. The control points of the patch are stored as a 3D coordinate array , the weights are stored as , and for each The patch is assigned a fixed global patch ID for subsequent fragment processing. In addition, to handle the cracks between patches, it is necessary to build a topological relationship, that is, the boundary connection relationship between each parametric surface patch and the adjacent parametric surface patches.
[0055] In some implementations, the following structure may be defined to store incoming data:
[0056] struct PatchMeta {
[0057] vec3 controlPoints
[16] ;
[0058] float weights
[16] ;
[0059] int patchID;
[0060] int adjacentPatch[4];
[0061] };
[0062] In addition, the control points need to be transformed from model space to world space and then to clip space. The transformation process is achieved by multiplying the Model-View-Projection (MVP) matrix. The result of this transformation is used for subsequent screen space inversion calculations. The transformation process can be expressed by the following formula:
[0063]
[0064] in, Represents the coordinates of the transformed control point in the clip space. Indicates the position coordinates of the control point in the model space. Represents the MVP matrix, corresponding to the projection matrix (Projection), view matrix (View) and model matrix (Model).
[0065] In operation S120, an initial value corresponding to each screen pixel is generated. Each parametric surface patch is linearized according to the control parameter to obtain a linear segment corresponding to the parametric surface patch. The linear segment is hardware rasterized to obtain the initial parameter position value of each screen pixel corresponding to the point on the parametric surface patch.
[0066] In order to efficiently solve the parameter coordinates corresponding to the screen pixels, first The patch is approximated by linearizing it in screen space, constructing a triangular mesh surrounding the patch to quickly estimate the initial parameter values for each pixel. The goal of this step is to provide a starting point close enough to the true value to make subsequent iterative solutions more stable and converge faster.
[0067] Using the fourth triangle Taking the patch as an example, its surface expression is as follows:
[0068] ;
[0069] in, Represents a parameter point on a surface The corresponding three-dimensional position, are two parameters of the surface defined in the two-dimensional parameter space, satisfying 0≤u,v≤1 and u+v≤1, that is, it is located in the unit triangle domain, express Corresponding control points, constraints The degree of the surface is 4, that is, a quartic triangle The surface condition is .
[0070] To obtain an approximately linear segment, three sets of control points are selected As vertices, a screen space triangle is formed (note: these points have been transformed by MVP). Hardware rasterization is performed on this screen space triangle, and the fragment interpolation function provided by the GPU Raster Engine can be used to obtain the centroid coordinates within the linear fragment. , the coordinates of the center of gravity correspond to the screen pixels, which are used as the initial value of the parameter position of the corresponding point of each screen pixel on the parametric surface patch.
[0071] In some embodiments, the initial value of the parameter position of each screen pixel obtained by initialization and the Patch ID to which it belongs are written into a texture buffer (such as an OpenGL Texture2D of RGBA32F). The specific storage format is R: , G: , B: Patch ID, A: Reserved bit. The advantage of this is that the subsequent Compute Shader can perform iterative operations on each pixel in parallel based on a one-time reading of the initial parameter values, greatly improving performance and scalability.
[0072] In operation S130, the accurate parameter position of the corresponding point of each screen pixel on the parametric surface patch is iteratively solved based on the initial parameter position value obtained in operation S120.
[0073] Although the initial values of the parameter positions are close, they cannot meet the requirements of high-precision rendering. Therefore, an iterative method is needed to solve the accurate parameter positions. , so that the parameter point is as close as possible to the center of the current pixel in the projection space.
[0074] In some embodiments, a second-order iteration method may be used to iteratively solve the accurate parameter position, or other iteration methods such as the Newton iteration method may be used to iteratively solve the problem. When the convergence condition is met or the set number of iterations is reached, the iteration stops and the calculation result is output.
[0075] In some embodiments, the iterative solution step is specifically as follows.
[0076] First, perform one iteration. Let the current screen pixel The initial value of the corresponding parameter position is , ,in Is to use the initial parameters Substitute the surface equation Calculated initial parameters The corresponding point coordinates in screen space, here The fourth triangle For a patch with control points in screen space, define:
[0077] ;
[0078] in, Represents the equation of a line segment in screen space with respect to parameter t, where the starting and ending points of the line segment are and , and are all On the patch, the line segment can be used express, represent On the surface, the point trajectory changes with the parameter t∈[0,1], so that the line segment is obtained and The relationship between the surfaces can be Start and iterate to find the exact point Positional parameters.
[0079] Taking the derivative of the above formula we can get:
[0080] ;
[0081] in, and The original surface equations are about First derivatives in both directions.
[0082] Then we can calculate:
[0083] ;
[0084] ;
[0085] Further seeking the second-order derivative can be obtained:
[0086] ;
[0087] in, , , They represent the second-order partial derivatives of the surface in the u direction, v direction and uv mixed direction respectively.
[0088] Then we can calculate 、 .
[0089] Thus we can make:
[0090] ;
[0091] ;
[0092] This completes one step of iterative calculation and obtains the coordinates of the center of gravity after one step of iteration. .
[0093] When the kth iteration meets the convergence condition: The iteration stops when is a constant threshold that can be set manually, indicating the pixel error that is satisfied by iteration. For example, when When set to 0.1, it means that the distance between the calculated parameter and the true value is less than 0.1 pixel width. Ensure that the point is within the legal parameter domain. In addition, if the iteration does not converge after the set number of times, the iteration is terminated and output As an instruction.
[0094] In operation S140 , the precise position and normal vector of the corresponding point of each screen pixel in the world space are calculated based on the accurate parameter position obtained through iterative solution and the parameter expression of the corresponding parametric surface patch.
[0095] After iterating to obtain the accurate parameter position, we can The parametric expression of the surface calculates the precise position and normal vector of the point in world space. The position coordinates can be directly obtained from the parametric surface expression, that is, the obtained parameters are directly substituted into the parametric expression calculation of the surface. The normal calculation requires the cross product of the derivatives and normalization:
[0096] ;
[0097] in, Represents the normal vector.
[0098] In operation S150 , the parametric surface patch is rendered according to the precise position and the normal vector to obtain a target image.
[0099] Once the spatial position and normal information of all pixels are stored in the texture, the standard fragment shader can be used for final rendering. The rendering stage includes:
[0100] (1) Sample position and normal vector from texture memory;
[0101] (2) Render the final color based on the material and lighting model (such as Phong or PBR).
[0102] Operation S150 can directly utilize an existing graphics pipeline for rendering, thereby achieving seamless integration of the method provided in this embodiment with an existing rendering engine.
[0103] In some embodiments, after operation S140, the process also includes repairing boundary cracks and contour holes based on a crack repair strategy and a contour recovery strategy. Although the parameter solution and rendering of most surface pixels can be achieved through hardware rasterizers and initial value estimation, two common problems may still occur in the rendering results: boundary cracks (cracks) and contour holes (silhouette holes). The essence of these two problems is that due to parameter estimation errors or insufficient iterative area coverage, some pixels are not correctly classified or calculated, resulting in visual breaks or transparent areas. For this reason, this embodiment also introduces a compensatory recovery operation after operation S140 to process the above two types of anomalies to improve surface continuity and boundary integrity.
[0104] Figure 2 The flowchart of the crack repair strategy according to the embodiment of the present disclosure is schematically shown.
[0105] like Figure 2 As shown in the example, cracks mainly appear at the boundary areas of patches. Since each patch performs parameter estimation and iterative solution independently, pixels at the boundary between patches may be missed due to the following reasons:
[0106] (1) The linear triangulation of the rasterizer does not completely cover the boundary pixels;
[0107] (2) Pixels on the boundary are assigned to the wrong patch;
[0108] (3) After iteration, pixels are deemed invalid (e.g., out of domain or non-convergence) and are discarded.
[0109] These omissions will appear as transparent cracks in the image, especially in models with large curvature or small and dense patches. Therefore, crack detection and repair are necessary, including the following operations:
[0110] In operation S210 , the screen pixels are detected. If crack pixels are detected among the screen pixels, adjacent parametric surface patches of the parametric surface patches corresponding to the crack pixels are obtained.
[0111] For crack pixels, we can no longer attempt to solve the problem using the control points of the original patch (because it has already failed). We must instead find an adjacent patch that better fits the pixel. This search for adjacent parametric surface patches can be accomplished using a predefined adjacency table. This table represents the topological relationships of the parametric surface patches established in operation S110 and stored on the GPU as an SSBO. Each patch edge is associated with an adjacent patch ID. Other patches are accessed along these adjacent edges, and a solution is attempted on adjacent patches (i.e., adjacent parametric surface patches).
[0112] In operation S220 , the crack pixel is back-projected onto a linear segment corresponding to an adjacent parametric surface patch to obtain the centroid coordinates of the crack pixel on the linear segment as the corrected initial parameter position value of the corresponding point of the crack pixel.
[0113] Re-estimate the initial values on adjacent patches (i.e., adjacent parametric surface patches). After finding a candidate adjacent patch, re-estimate the initial values based on that patch. The following strategy is used: Based on the back-projection of the original pixel's screen position, calculate its barycentric coordinates on the linearized triangle patch where the adjacent patch resides; use these barycentric coordinates as the initial parameters to estimate the new initial parameter positions.
[0114] In operation S230, the corrected accurate parameter position of the corresponding point of the crack pixel is iteratively solved based on the corrected initial parameter position value, and the corrected precise position and normal vector of the corresponding point of the crack pixel in world space are calculated based on the corrected accurate parameter position and the parameter expression of the adjacent parametric surface patch.
[0115] The iterative solution step of operation S130 is repeated using the initial parameter position value obtained in operation S220 to obtain a new accurate parameter position (u, v). When the residual meets the conditions, the iteration is considered successful. If the iterative attempt on the adjacent patch still fails, it is recorded as an invalid pixel.
[0116] If the iterative solution is successful, the world coordinates S(u, v) and the normal vector n are recalculated based on the formula in operation S140. The calculation results are written to the position texture, normal texture, and depth texture, and the patch ID texture is updated. The patch ID here represents the number of the corresponding patch after the iterative solution is successful.
[0117] Figure 5 The following schematic diagrams show the effect comparison before and after crack repair according to the embodiment of the present disclosure, wherein (a) is a schematic diagram before crack repair, and (b) is a schematic diagram after crack repair. Figure 5As shown, after the crack repairing operations S210 - S230 , the cracks between the facets in the image are repaired, and there are no transparent cracks between adjacent facets, which shows the effectiveness of the method of the embodiment of the present disclosure.
[0118] Figure 3 The flowchart of the contour restoration strategy according to the embodiment of the present disclosure is schematically shown.
[0119] In the embodiment of the present disclosure, a contour recovery strategy is further proposed to solve the contour hole problem. Silhouette holes are a common and unavoidable rendering defect during the screen-space rasterization of surfaces. The so-called silhouette refers to the geometric boundary lines that appear on the screen when the surface at the edge of the model is almost perpendicular to the line of sight. In traditional triangle mesh rendering, the silhouette is often automatically determined by the vertex shader and boundary detection hardware, but in the method of direct rasterization of parametric surfaces in the embodiment of the present disclosure, the silhouette pixels are not defined by explicit boundary lines, but are indirectly determined by the parameter inversion and projection process. Even if this type of problem affects fewer pixels, it often seriously damages the integrity and spatial coherence of the image because it is in the visually sensitive area (model boundary), so it needs to be specially handled.
[0120] To ensure complete restoration of the contour area, the present disclosure adopts the following multi-step method: Figure 3 Shown, including:
[0121] In operation S310 , contour pixels among screen pixels are identified, the contour pixels are marked, and a contour range is determined.
[0122] Figure 4 A flowchart of contour pixel recognition according to an embodiment of the present disclosure is schematically shown. Figure 4 As shown, identifying outline pixels in screen pixels includes:
[0123] In operation S410, the angle between the sight line direction and the normal direction corresponding to each screen pixel is obtained; wherein the sight line direction is input by a camera parameter required for rendering, indicating the direction the camera faces during rendering;
[0124] In operation S420, when the included angle satisfies a set condition, the corresponding screen pixel is marked as a contour pixel.
[0125] Specifically, in order to efficiently detect the contour area, in some embodiments, the present disclosure designs a calculation method based on the normal and the line of sight angle, and the calculation formula is as follows:
[0126] ;
[0127] in, and Represent the viewing direction and normal direction respectively.
[0128] In this embodiment, when the angle When the angle is less than 80°, the corresponding pixel is considered a contour pixel and marked. The angle requirement between the line of sight and the normal direction is set based on practical experience. The closer the angle is to 90°, the smaller the contour range, and vice versa. In this embodiment, it is set to 80°, which can make the obtained contour area sufficiently complete without significantly affecting calculation efficiency.
[0129] In operation S320, the boundary of the linear segment of the parametric surface patch corresponding to each contour pixel is extended. The boundary extension operation is performed on the linear approximation triangle of each patch. This operation extends the set range outside the original linear approximation triangle patch, i.e., expands the raster area of the patch. For example, a circle is extended. In screen space, each edge of the triangle is moved outward perpendicularly to the edge by a number of unit pixels to obtain a larger area. The length of the movement is set to the distance from the triangle edge to the center point. The initial value estimation is then re-performed within this extended area to cover the contour holes at the edge.
[0130] In operation S330, the linear segment after boundary expansion is iteratively solved again. The iterative parameter solution is performed again according to operation S130, and the iterative calculation is repeated to obtain the new accurate parameter position (u, v). If the residual meets the conditions, the iteration is considered successful. If the iteration attempt on the adjacent patch still fails, it is recorded as an invalid pixel.
[0131] If the iterative solution is successful, the world coordinates S(u, v) and the normal vector n are recalculated based on the formula in operation S140. The calculation results are written to the position texture, normal texture, and depth texture, and the patch ID texture is updated.
[0132] Figure 6 The following schematic diagrams show the effect comparison before and after contour restoration according to an embodiment of the present disclosure, wherein (a) is a schematic diagram before contour restoration, and (b) is a schematic diagram after contour restoration. Figure 6 As shown, after the contour restoration operations S310 - S330 , the missing edge contour in the image is restored, and the edge contour is smooth and complete, indicating the effectiveness of the method of the embodiment of the present disclosure.
[0133] Based on the above-mentioned parametric surface rendering method, the present disclosure also provides a parametric surface rendering device. Figure 7 The device is described in detail.
[0134] Figure 7 The structural block diagram of the parametric surface rendering device according to an embodiment of the present disclosure is schematically shown.
[0135] like Figure 7 As shown, the parametric surface rendering device 700 of this embodiment includes a parameter acquisition module 710 , an initial value generation module 720 , an iterative solution module 730 , a pixel information solution module 740 and a rendering module 750 .
[0136] The parameter acquisition module 710 is used to acquire the control parameters of each parametric surface patch to be rendered. In one embodiment, the parameter acquisition module 710 can be used to perform the operation S110 described above, which will not be repeated here.
[0137] Initial value generation module 720 is configured to linearize the parametric surface patch based on the control parameters to obtain linear segments corresponding to the parametric surface patch; perform hardware rasterization on the linear segments to obtain initial parameter position values for each screen pixel corresponding to the point on the parametric surface patch. In one embodiment, initial value generation module 720 can be configured to perform operation S120 described above and will not be further described here.
[0138] The iterative solution module 730 is used to iteratively solve the accurate parameter position of the corresponding point of each screen pixel on the parametric surface patch based on the initial parameter position value. In one embodiment, the iterative solution module 730 can be used to perform the operation S130 described above, which will not be repeated here.
[0139] Pixel information solving module 740 is used to calculate the precise position and normal vector of the corresponding point of each screen pixel in world space based on the accurate parameter position and the parameter expression of the corresponding parametric surface patch. In one embodiment, pixel information solving module 740 can be used to perform operation S140 described above, which will not be repeated here.
[0140] The rendering module 750 is used to render the parametric surface patch according to the precise position and the normal vector to obtain a target image. In one embodiment, the rendering module 750 can be used to perform the operation S150 described above, which will not be repeated here.
[0141] For the parts not mentioned in the apparatus part, they can be understood with reference to the various embodiments of the above-mentioned method. That is, the apparatus part includes modules for executing the various steps of any one of the method embodiments described above. In addition, the implementation methods, technical problems solved, functions achieved, and technical effects achieved of each module / unit / subunit, etc. in the apparatus part embodiment are respectively the same or similar to the implementation methods, technical problems solved, functions achieved, and technical effects achieved of each corresponding step in the method part embodiment, and will not be repeated here.
[0142] According to an embodiment of the present disclosure, any multiple modules among the parameter acquisition module 710, the initial value generation module 720, the iterative solution module 730, the pixel information solution module 740, and the rendering module 750 can be combined into a single module for implementation, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in a single module.
[0143] According to an embodiment of the present disclosure, at least one of the parameter acquisition module 710, the initial value generation module 720, the iterative solution module 730, the pixel information solution module 740, and the rendering module 750 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging circuits, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in an appropriate combination of any of them. Alternatively, at least one of the parameter acquisition module 710, the initial value generation module 720, the iterative solution module 730, the pixel information solution module 740, and the rendering module 750 may be at least partially implemented as a computer program module, which, when executed, may perform the corresponding function.
[0144] Figure 8 A block diagram of an electronic device suitable for implementing a parametric surface rendering method according to an embodiment of the present disclosure is schematically shown.
[0145] like Figure 8 As shown, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage unit 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0146] Various programs and data required for the operation of the electronic device 800 are stored in the RAM 803. The processor 801, ROM 802, and RAM 803 are connected to each other via a bus 804. The processor 801 executes the various operations of the method flow according to the embodiment of the present disclosure by executing the programs in the ROM 802 and / or RAM 803. It should be noted that the programs may also be stored in one or more memories other than the ROM 802 and RAM 803. The processor 801 may also execute the various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in the one or more memories.
[0147] According to an embodiment of the present disclosure, electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to bus 804. Electronic device 800 may also include one or more of the following components connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 808 including a hard disk; and a communication section 809 including a network interface card such as a LAN card or modem. Communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. Removable media 811, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 810 as needed, so that computer programs read from the removable media can be installed into storage section 808 as needed.
[0148] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when executed, implements the method according to the embodiments of the present disclosure.
[0149] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, and may include, for example, but not limited to: 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), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may 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. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 802 and / or RAM 803 described above, and / or one or more memories other than ROM 802 and RAM 803.
[0150] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiments of the present disclosure.
[0151] The computer program executes the above functions defined in the system / device of the embodiment of the present disclosure when the computer program is executed by the processor 801. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0152] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0153] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 809, and / or installed from a removable medium 811. When the computer program is executed by the processor 801, the above-described functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.
[0154] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).
[0155] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0156] Those skilled in the art will appreciate that the features described in the various embodiments of the present disclosure may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in the present disclosure. In particular, the features described in the various embodiments of the present disclosure may be combined and / or coupled in various ways without departing from the spirit and teachings of the present disclosure. All such combinations and / or couplings fall within the scope of the present disclosure.
[0157] The embodiments of the present disclosure are described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be used in combination to advantage. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A parametric surface rendering method, characterized in that: include: Get the control parameters of each parametric surface patch to be rendered; Linearize the parametric surface patch according to the control parameters to obtain a linear segment corresponding to the parametric surface patch; perform hardware rasterization on the linear segment to obtain an initial parameter position value of a point corresponding to each screen pixel on the parametric surface patch; Iteratively solving the accurate parameter position of the corresponding point of each screen pixel on the parameter surface patch according to the initial value of the parameter position; Calculating the precise position and normal vector of the corresponding point of each screen pixel in world space based on the accurate parameter position and the parameter expression of the corresponding parametric surface patch; The parametric surface patch is rendered according to the precise position and the normal vector to obtain a target image.
2. The method according to claim 1, characterized in that Also includes: If there is a crack pixel among the screen pixels, obtaining an adjacent parametric surface patch of the parametric surface patch corresponding to the crack pixel; Back-projecting the crack pixel onto the linear segment corresponding to the adjacent parametric surface patch to obtain the centroid coordinates of the crack pixel on the linear segment as the corrected parameter position initial value of the corresponding point of the crack pixel; According to the corrected initial parameter position value, the corrected accurate parameter position of the corresponding point of the crack pixel is iteratively solved, and according to the corrected accurate parameter position and the parameter expression of the adjacent parametric surface patch, the corrected precise position and normal vector of the corresponding point of the crack pixel in the world space are calculated.
3. The method according to claim 1, characterized in that Also includes: identifying contour pixels among the screen pixels; Performing boundary extension on a linear segment of a parametric surface patch corresponding to each of the contour pixels; The iterative solution is performed again on the linear segment after the boundary is expanded.
4. The method according to claim 3, characterized in that The identifying contour pixels among the screen pixels comprises: Get the angle between the sight direction and the normal direction corresponding to each screen pixel; When the angle meets the set condition, the corresponding screen pixel is marked as a contour pixel.
5. The method according to claim 1, wherein Each of the parametric surface patches has a determined patch number. The control parameters of the parametric surface patch include control points, weights, and topological relationships. The topological relationship is a boundary connection relationship between each parametric surface patch and an adjacent parametric surface patch.
6. The method according to claim 5, characterized in that After obtaining the initial parameter position value of the corresponding point of each screen pixel on the parametric surface patch, the initial parameter position value of the corresponding point of each screen pixel on the parametric surface patch and the patch sequence number of the parametric surface patch are written into the texture buffer.
7. A parametric surface rendering device, characterized in that: include: A parameter acquisition module is used to obtain the control parameters of each parametric surface patch to be rendered; An initial value generation module is used to linearize the parametric surface patch according to the control parameters to obtain linear segments corresponding to the parametric surface patch; perform hardware rasterization on the linear segments to obtain the initial parameter position value of the corresponding point of each screen pixel on the parametric surface patch; An iterative solution module, configured to iteratively solve the accurate parameter position of the corresponding point of each screen pixel on the parameter surface patch according to the initial value of the parameter position; A pixel information solving module, configured to calculate the precise position and normal vector of the corresponding point of each screen pixel in world space based on the accurate parameter position and the parameter expression of the corresponding parametric surface patch; as well as A rendering module is used to render the parametric surface patch according to the precise position and the normal vector to obtain a target image.
8. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.