A realistic simulation method for knitted fabrics based on ribbon model

By using ribbon model and PBR rendering technology in three-dimensional space, the yarn coil path of knitted fabrics is accurately fitted and rendered, and the problem of insufficient authenticity and accuracy of knitted fabric simulation in the prior art is solved, and efficient and low-cost knitted fabric simulation effect is achieved.

CN118485760BActive Publication Date: 2025-04-08CHANGSHU INSTITUTE OF TECHNOLOGY +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410536823.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-30
Publication Date
2025-04-08
Estimated Expiration
2044-04-30

AI Technical Summary

Technical Problem

Existing knitted fabric simulation technology is difficult to accurately simulate the microstructure of fiber-grade yarns, resulting in insufficient authenticity and accuracy of simulation results. At the same time, high-end technologies such as high cost and complex operation, making it difficult to meet the rapid response and iteration needs of industrial production.

Method used

The real-life simulation method of knitted fabrics based on the ribbon model is used to fit the yarn coil path through a second-order Bezier curve in three-dimensional space, and combined with PBR rendering technology, the yarn texture image is mapped and rendered according to the yarn coil path in the ribbon model, and the simulation accuracy, transparency and shadow are adjusted.

Benefits of technology

It realizes high realistic simulation of knitted fabrics, improves simulation accuracy and speed, reduces data acquisition costs and complexity, expands the types of simulateable yarns, and makes the simulation effects more diverse and detailed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118485760B_ABST
    Figure CN118485760B_ABST
Patent Text Reader

Abstract

The present invention provides a realistic simulation method for knitted fabrics based on a band model, comprising the steps of: fitting the yarn coil path of the knitted fabric by a second-order Bezier curve in a three-dimensional space to construct a band model of the fabric; collecting yarn images, extracting yarn texture information, and making the yarns in the yarn texture continuous from beginning to end to determine the yarn texture image; determining a texture map for fabric rendering by the yarn texture image, inputting the texture map into the band model for mapping and rendering, and obtaining an initial simulation image of the fabric. By establishing a band model, the present invention can more accurately simulate and display the structure and texture of the knitted fabric, and improve the authenticity and accuracy of the knitted fabric simulation; mapping and rendering based on pictures of real yarns can simulate the effects of various types of yarns including segmented colored yarns and fancy yarns, making the simulation effect of the knitted fabric more diversified, achieving more detailed and rich texture effects, and providing a powerful support means for knitting design and manufacturing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to realistic simulation of knitted fabrics, and in particular to a realistic simulation method of knitted fabrics based on a belt-shaped model. Background Art

[0002] Compared with woven fabrics, knitted fabrics have a more flexible and relaxed yarn state, which gives knitted fabrics unique elasticity and breathability, but also places higher demands on their simulation technology. A highly accurate yarn model can capture the key characteristics of knitted fabrics, thereby ensuring the authenticity of the simulation results. However, this highly accurate simulation is often accompanied by a high computational cost, which may slow down the simulation speed.

[0003] In the existing knitted fabric simulation technology, a two-dimensional coil model is generally used for texture mapping. However, this model is only suitable for processing ordinary yarns with relatively simple structures. In order to match different types of fibers, a tubular model is also used to simulate the microstructure of the yarn. However, the tubular model will lead to oversimplification of the visual effect when processing yarn mapping, and its limitations are particularly prominent in more complex and detailed simulation requirements.

[0004] In order to accurately simulate fiber-level yarns, highly detailed yarn data is required. Existing technologies usually rely on high-end technologies such as CT scanning, which are often costly and complex to operate. In addition, a large number of experiments are required to achieve the simulation effect of a specific type of yarn, which greatly reduces the simulation speed.

[0005] Therefore, it is urgent to develop a yarn model that can accurately simulate the key properties of knitted fabrics and meet the needs of rapid response and iteration in industrial production, which will help improve the efficiency of design and production and significantly enhance the market competitiveness of knitted products. Summary of the invention

[0006] The purpose of the present invention is to provide a method for realistic simulation of knitted fabrics based on a strip model, to establish a strip model of knitted fabrics in three-dimensional space, to map and render the yarn texture image according to the yarn coil path in the strip model through PBR rendering, and then to continue to adjust the accuracy, transparency and shadow of the knitted fabric simulation to achieve realistic simulation of the knitted fabric.

[0007] The technical solution of the present invention is: a method for realistic simulation of knitted fabrics based on a band model, comprising the following steps:

[0008] S100, fitting the yarn coil path of the knitted fabric by a second-order Bezier curve in a three-dimensional space to construct a ribbon model of the knitted fabric;

[0009] S200, collecting yarn images, extracting yarn texture information, and connecting the beginning and the end of the yarn in the yarn texture to determine the yarn texture image;

[0010] S300, determining a texture map for fabric rendering from the yarn texture image, and inputting the texture map into the strip model for mapping and rendering based on the UV coordinate value of the strip model to obtain an initial simulation image of the fabric;

[0011] S400, performing precision, transparency and shadow processing on the initial simulation image of the fabric, obtaining a fabric simulation effect image, and achieving a realistic sense of knitted fabric simulation.

[0012] Preferably, step S100 also includes: based on the second-order Bezier curve, determining the coordinates of the value points and control points on the yarn coil path in the strip model from the actual measurement points on the yarn coil structure; determining the distribution of the interpolation points on the yarn coil path in the strip model through the second-order Bezier curve; and determining the edge contour points of the yarn coil path in the strip model based on the interpolation points.

[0013] Preferably, in step S200, the collected yarn image is binarized to extract information about the main body of the yarn and the hairiness.

[0014] Preferably, in step S200, after the yarn texture information is extracted, the minimum repeating unit of the yarn texture is intercepted, and a two-way continuous process is performed on it to determine a two-way continuous pattern, thereby achieving the continuity of the minimum repeating unit in the horizontal direction.

[0015] Preferably, the maps include a color map, a roughness map, a metalness map, a height map, an ambient occlusion map and a normal map.

[0016] Preferably, in step S300, when mapping the map to the model, a row of coils in the strip model is taken as a unit, the yarn diameter direction is the U coordinate, and the yarn length direction is the V coordinate. The UV coordinate value of each row of coils in the strip model is determined, and the calculation formula is as follows:

[0017] u=i′ / d,(i′∈K)

[0018] v=Len×a

[0019] a=L / l′

[0020] Where L is the length of a row of coils, l' is the yarn length, i' is the i'th interpolation point on the yarn diameter in the model, d is the yarn diameter, K is the total number of interpolation points on a section in the model, Len is the curve length from the starting point to the current position of the yarn, u is the yarn diameter direction, v is the yarn length direction, and a is the scale factor of texture stretching.

[0021] Preferably, step 300 further includes performing illumination processing on the mapped fabric surface using a bidirectional reflectance distribution function.

[0022] Preferably, step S400 is specifically as follows:

[0023] Step 1: Determine the position occlusion relationship of yarn pixels to achieve the continuity of transition between yarn coils;

[0024] Step 2: Based on the position occlusion relationship, the transparency of the yarn pixels is determined using the Alpha blending mode to achieve a natural and coherent transition of the yarn color;

[0025] Step 3: Based on the position occlusion relationship and the transparency of the yarn pixels, the shadow relationship of the yarn pixels is determined using variance shadow mapping to achieve smooth, natural and realistic fabric shadows.

[0026] Compared with the prior art, the present invention has the following beneficial effects: (1) by establishing a band model of a knitted fabric in three-dimensional space, compared with the traditional method of using shadow elimination in two-dimensional space, the problem of interlacing and covering relationship between yarns is solved more effectively, and the structure and texture of the knitted fabric can be simulated and displayed more accurately, thereby improving the authenticity and accuracy of the knitted fabric simulation; (2) by using a mobile phone to capture and collect yarn images, compared with images based on micro CT scanning, the acquisition of original data is faster, more convenient and less costly. The low-cost and high-efficiency data collection method is more valuable for enterprises and is conducive to the promotion and application of technology; (3) by mapping and rendering simulation based on real yarn pictures, various types of yarn effects including segmented colored yarn and fancy yarn can be simulated, which greatly expands the types of yarns that can be simulated, making the simulation effect of knitted fabrics more diversified, more realistic, more in line with the appearance and characteristics of actual knitted products, and achieving more delicate and rich knitted texture effects, providing a more powerful support means for knitting design and manufacturing. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 This is a band-shaped model coil path diagram of a plain knitted fabric according to Example 1 of the present invention.

[0028] in, Figure 1 (a) is a diagram showing the yarn loop structure of a plain knitted fabric; Figure 1 (b) is a front view of the yarn coil path based on the second-order Bezier curve; Figure 1 (c) is the left view of the yarn coil path based on the second-order Bezier curve;

[0029] Figure 2 It is a schematic diagram of the second-order Bezier curve of the present invention;

[0030] Figure 3is a schematic diagram of the yarn ribbon structure of Example 1 of the present invention,

[0031] in, Figure 3 (a) is the front view of the strip structure; Figure 3 (b) is the left view of the strip structure;

[0032] Figure 4 This is a schematic diagram of the band-shaped model structure of a plain knitted fabric according to Example 1 of the present invention.

[0033] in, Figure 4 (a) A front view of a flat needle coil. Figure 4 (b) is a front view of a plain knitted fabric loop, Figure 4 (c) is a side view of a plain knitted fabric loop;

[0034] Figure 5 This is a schematic diagram of the process of extracting yarn texture images in the present invention.

[0035] in, Figure 5 (a) is the yarn diagram after cutting. Figure 5 (b) is the yarn image after adjusting the brightness; Figure 5 (c) is the yarn image after binarization and background removal; Figure 5 (d) is the texture image of the yarn after two-way continuity;

[0036] Figure 6 This is a schematic diagram of the texture required for PBR rendering of the present invention.

[0037] in, Figure 6 (a) is the color map of the yarn, Figure 6 (b) is the height map of the yarn, Figure 6 (c) is the normal map of the yarn, Figure 6 (d) is the metallic map of the yarn; Figure 6 (e) is the ambient occlusion map of the yarn, Figure 6 (f) is the roughness map of the yarn;

[0038] Figure 7 This is a simulation effect diagram of a plain knitted fabric according to Example 1 of the present invention;

[0039] Figure 8 This is a simulation effect diagram of a feather yarn plain knitted fabric based on the ribbon model of Example 1 of the present invention.

[0040] in, Figure 8 (a) is the yarn diagram of the feather yarn after cutting. Figure 8 (b) is the simulation effect diagram;

[0041] Fig. 9 This is a simulation effect diagram of a squirrel wool plain knitted fabric based on the ribbon model of Example 1 of the present invention.

[0042] in, Fig. 9 (a) is the yarn diagram of the squirrel wool yarn after cutting. Fig. 9 (b) is the simulation effect diagram;

[0043] Fig.10 Schematic diagram of the belt-shaped model structure of the cable knit fabric according to Example 2 of the present invention;

[0044] Fig.11 This is a simulation effect diagram of the cable knit fabric according to Example 2 of the present invention;

[0045] in, Fig.11 (a) is the yarn diagram after cutting. Fig.11 (b) is the simulation effect diagram. Fig.11 (c) is an enlarged view of the twisted structure part in the simulation effect diagram. DETAILED DESCRIPTION

[0046] The technical solution of the present invention is described in detail below, but the protection scope of the present invention is not limited to the embodiments.

[0047] To make the content of the present invention more clearly move, the following is combined with the attached Figure 1-11 The specific implementation manner is further described.

[0048] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0049] Example 1: Simulation of a plain knitted fabric, such as Figure 1-9 As shown:

[0050] like Figure 1-3 As shown, the present invention discloses a realistic simulation method for knitted fabrics based on a band model, comprising the following steps:

[0051] S100, fitting the yarn loop path of the plain knitted fabric by a second-order Bezier curve in three-dimensional space to construct a ribbon model of the plain knitted fabric.

[0052] In this embodiment, the yarn is represented by a strip shape, and the yarn coil path of the fabric is fitted by a second-order Bezier curve in three-dimensional space, and a strip model of the plain knitted fabric is constructed by the coil path.

[0053] like Figure 1 (a) shows the yarn loop structure of a plain knitted fabric, Q 1 -Q 13 is the actual measuring point on the yarn coil structure, such as Figure 2As shown, there are three points A on the second-order Bezier curve 0 -A 2 , where A 0 As the starting point, A 2 As the end point, A 1 is the middle control point, and the curve passes through point A 0 and A 2 , point A 1 Determines the trend and direction of the curve (i.e. the shape of the curve). The curve does not pass through point A. 1 .

[0054] The second-order Bezier curve A(t) is calculated by the following formula:

[0055] A(t)=(1-t) 2 A 0 +2t(1-t)A 1 +t 2 A 2 ,t∈[1,0]

[0056] Where: t is the parameter of the curve.

[0057] like Figure 1 (b) Figure 1 (c) shows that at point B in the model 1 -B 10 is the shape value point on the yarn coil path, point M 1 -M 7 The coordinates of the shape value points and control points on the yarn coil path in the model are determined by the actual measurement points on the yarn coil structure.

[0058] For example: Click M 1 Type value point B 2 and B 3 The first curve on the yarn loop path is the midpoint of B. 1 , B 2 and M 1 Control, where B 1 、M 1 is the starting point, B 2 is the middle control point, controlling the shape of the curve; point M 2 Type value point B 3 and B 4 The second curve on the yarn coil path is the midpoint of M 1 , B 2 and M 2 Control, M 1 and M 2 is the starting point, B 3 is the control point, and so on, the coil path consists of eight suspended arcs.

[0059] Point B on the yarn loop path 1 、M 1 、M 2 The coordinates of the coil structure midpoint Q 1 , Q 2 , Q 4 The coordinates of point B on the yarn coil path are the same. 3 The Y-axis coordinate of the coil structure midpoint Q 3 The Y-axis coordinates of point M are the same, so we can determine 1 、M 2 The coordinates of point B in the model 3 The Y-axis coordinate in the model is expressed as follows:

[0060] M 1 (y) = Q 2 (y)

[0061] M 1 (x) = Q 2 (x)

[0062] B 3 (y) = Q 3 (y)

[0063] M 2 (y) = Q 4 (y)

[0064] M 2 (x) = Q 4 (x)

[0065] Among them, Q 1 (x), Q 1 (y) is point Q 1 The coordinates of Q 2 (x), Q 2 (y) is point Q 2 The coordinates of M 1 (x), M 1 (y) is point M 1 The coordinates of M 2 (x), M 2 (y) is point M 2 The coordinates of B 3 (y) is point B 3 The Y-axis coordinate of .

[0066] Click M 1 、M 2 , B 3 The second-order Bezier curve passes through point Q 3 The coordinates of point M 1 、M 2 , B 3Substitute the coordinates into the calculation formula of the second-order Bezier curve, and we get:

[0067] Q 3 (y) = (1-t 1 ) 2 M 1 (y)+2t 1 (1-t 1 )B 3 (y)+t 1 2 M 2 (y)

[0068] Among them, t 1 is the parameter of the first curve on the yarn coil path

[0069] but:

[0070]

[0071] t 1 Substituting into the calculation formula of the second-order Bezier curve, we can get point B 3 The X-axis coordinate is:

[0072]

[0073] Because point M 1 Point B 2 , B 3 The midpoint of , we can get point B 2 The X-axis coordinate is calculated as follows:

[0074] B 2 (x) = 2M 1 (x)-B 3 (x)

[0075] Therefore, point B is determined 2 , B 3 The coordinates of point B in the model 9 , B 8 and point B 2 , B 3 Axisymmetric, point B 9 , B 8 The coordinates of point B 2 , B 3 Horizontal mirroring available.

[0076] In order to achieve a better simulation effect of the generated yarn, a number of interpolation points are distributed on the coil path. The distribution of the interpolation points is determined by the value of t in the second-order Bezier curve formula, and the spacing between the interpolation points is as consistent as possible.

[0077] Set L 1is the length of the first curve of the coil, k 1 is the number of segments of the first segment of the coil, l is the distance between two adjacent interpolation points on the coil path, then:

[0078]

[0079]

[0080]

[0081] Among them, L i is the i-th section curve of the coil, k i is the number of segments divided into the i-th segment of the coil, t i is the value of the i-th curve of the coil, n is the interpolation point index in the i-th curve, and N is a natural number set.

[0082] t i Substitute into the calculation formula of the second-order Bezier curve to get the value of the interpolation point on the coil; when k i The larger the value of i The smaller the value of is, the more segments each coil curve is divided into, the more interpolation points on the coil path are obtained, and the smoother the coil path is.

[0083] like Figure 3-4 As shown, the local reference frame of the coil path is determined according to the Frenet-Serret formula, and the reference frame includes a tangent vector T, a Z-axis vector (i.e., a binormal vector) and a normal vector N. The normal vector N perpendicular to the tangent and the Z-axis is obtained by the cross product of the interpolation point tangent vector T and the Z-axis vector (0,0,1).

[0084] According to the yarn diameter, along the coil path, the edge contour points of the yarn coil path in the model are calculated by the tangent perpendicular to the coil path and the normal vector N, and the edge contour points are triangulated to form the surface of the strip fabric model, thus completing the construction of the strip fabric model.

[0085] S200, collecting yarn images, extracting yarn texture information, and connecting the beginning and the end of the yarn in the yarn texture to determine the yarn texture image.

[0086] In order to lower the threshold of image acquisition and speed up the image acquisition, in this embodiment, the yarn is mohair yarn, and the yarn is photographed by a mobile phone to obtain a yarn collection image. The photographed yarn collection image contains at least one cycle of the yarn. The yarn collection image is cropped to remove unnecessary background elements or yarn edge parts, and the image area of ​​the yarn body and its hairiness details is retained to obtain the original image I of the yarn, as shown in FIG. Figure 5 (a) shown.

[0087] Adjust the brightness and contrast of the initial image of the yarn to make the yarn color, yarn body and hairiness details clearer, such as Figure 5 As shown in (b), the main body of the yarn and its hairiness details are highlighted by binarization processing. Specifically, the original image I of the yarn is converted into a grayscale image, a threshold T is set, and all pixels with pixel values ​​greater than or equal to T in the color channel of the yarn image are set to 1, and all pixels with pixel values ​​less than T are set to 0, thereby obtaining a binary image B of the yarn.

[0088] For each pixel position (x, y) and the corresponding color channel z, the original yarn image I and the binary image B are combined by dot multiplication to generate a new yarn image Y, specifically:

[0089] Y(x,y,z)=B(x,y)·I(x,y,z)

[0090] Among them, I(x,y,z) represents the pixel value of the color channel of the original image I at the (x,y) coordinate system, and B(x,y) is the pixel value of the color channel of the binary image B in the same coordinate system.

[0091] The yarn image Y contains both the pixels of the original image I corresponding to the non-zero value in the binary image B and the pixels of zero value. The pixel values ​​corresponding to the background color channel are also set to zero. Finally, the pixels of zero value in the yarn image Y are removed and the non-zero value pixels are extracted to obtain the initial image of the yarn texture, as shown in FIG. Figure 5 (c) as shown.

[0092] In order to make the yarn in the simulation effect diagram continuous, the initial image of the yarn texture needs to be processed by bilinear continuity in graphics. Specifically, a section of the yarn texture is intercepted from the initial image of the yarn texture as the minimum repeating unit of the yarn texture. To ensure the continuity of the minimum repeating unit in the horizontal direction, the yarn in the minimum repeating unit needs to be continuous from beginning to end, and the bilinear continuous pattern is determined to obtain the yarn texture image, such as Figure 5 (d) as shown.

[0093] S300, determining a texture map for fabric rendering from the yarn texture image, inputting the texture map into the strip model for mapping and rendering based on the UV coordinate value of the strip model, and obtaining an initial simulation image of the fabric.

[0094] According to the yarn texture image, Materialize software is used to convert the textures required for physical based rendering (PBR rendering), including color map, roughness map, metalness map, height map, ambient occlusion map and normal map, as shown in Figure 6As shown. The color map is used to simulate the appearance of the basic color and texture of the model, the roughness map is used to simulate the smoothness of the model surface, and the metalness map can distinguish whether the yarn is non-metal or metal, and is used to simulate the metal properties of the yarn, thereby affecting the color and highlight performance of the model. The height map is used to simulate the microstructure of the yarn surface and enhance the three-dimensional sense of the yarn texture; the ambient occlusion map is used to enhance the local shadow effect of the model and provide a more natural shadow performance for the geometric shape of the model. The normal map is used to simulate more complex surface details without increasing the number of polygons on the model surface. The six maps participate in the PBR rendering process together, which can improve the realism of the yarn's response to light and shadow, thereby enhancing the realism of the fabric.

[0095] When mapping the six maps to the model, a row of coils in the model is taken as a unit, the yarn diameter direction is the U coordinate, and the yarn length direction is the V coordinate. The UV coordinate value of each row of coils in the model is determined by the following calculation formula:

[0096] u=i′ / d,(i′∈K)

[0097] v=Len×a

[0098] a=L / l′

[0099] Where L is the length of a row of coils, l' is the yarn length, i' is the i'th interpolation point on the yarn diameter in the model, d is the yarn diameter, K is the total number of interpolation points on a section in the model, Len is the curve length from the starting point to the current position of the yarn, u is the yarn diameter direction, v is the yarn length direction, and a is the scale factor of texture stretching.

[0100] The color map, roughness map, metalness map, height map, ambient occlusion map and normal map are mapped in the model based on the UV coordinates of each row of coils, and then the mapped plain knitted fabric surface is illuminated using a bidirectional reflectance distribution function.

[0101] The consistency of the illumination on the surface of a plain knitted fabric depends on the smoothness of the model surface, which is determined by the average value of the normal vectors of two adjacent model value points on the loop path, specifically:

[0102] Direct the normals of all the shape value points in the model toward the positive direction of the Z axis and calculate the average value of the normal vectors of adjacent shape value points. The formula is as follows:

[0103]

[0104] in, It is the average value of the normal vectors of two adjacent shape value points, prevNormal is the normal vector of the previous shape value point, and currentNormal is the normal vector of the current shape value point.

[0105] when The smaller the value, the smaller the change in the normal direction on the model surface is, the normal direction is more consistent, the change on the model surface is gentler, the model is smoother and more natural, the mapping is more natural, and the lighting of the flat knitted fabric is more coherent.

[0106] In PBR rendering, the bidirectional reflectance distribution function (BRDF) is the most core function for lighting processing on the surface of a plain knitted fabric. It expresses how light is reflected and scattered by the surface of a plain knitted fabric under different viewing angles and lighting conditions.

[0107] BRDF is generally divided into two parts: specular reflection and diffuse reflection.

[0108] The specular reflection is expressed as follows:

[0109] F(θ)·G(L,V,H)·D(H)

[0110] The diffuse reflection (diffuse) is expressed as follows:

[0111]

[0112] Among them, F(θ) is the reflectivity of light at different angles, G(L, V, H) is the geometric occlusion function, D(H) is the normal distribution function, Albedo is the reflectivity of light, and kd is the diffuse reflectivity.

[0113] Specular reflection is used to determine the appearance, lighting direction and intensity of the plain knitted fabric, and to produce highlights; diffuse reflection is used to scatter light to make the surface of the plain knitted fabric evenly illuminated. At the same time, it can determine the basic tone and texture of the plain knitted fabric, and make the surface of the plain knitted fabric present light and dark changes, forming shadows. BRDF expresses different optical properties through different parameters and components to achieve real lighting simulation, thereby rendering the initial simulation image of the plain knitted fabric.

[0114] S400, performing precision, transparency and shadow processing on the initial simulation image of the fabric, obtaining a fabric simulation effect image, and achieving a realistic sense of knitted fabric simulation.

[0115] The first step is to determine the position occlusion relationship of the yarn pixels and perform precision processing on the initial simulation image of the fabric.

[0116] In the model, the precision processing mainly involves rendering the occlusion relationship between the upper and lower adjacent rows of coils of a plain knitted fabric. Specifically, the coil column of the upper row of coils will cover the sinking arc of the lower row of coils. The occlusion relationship is determined by the Z-axis coordinate value of the yarn pixel in three-dimensional space to determine whether the yarn pixel is a visible object or an occluded object.

[0117] In the PBR rendering process, the color information of the yarn pixel is written into the frame buffer, and the Z-axis coordinate value of the yarn pixel is recorded in the depth buffer. When the yarn pixel is updated and tried to be rendered at the same screen position, the rendering engine will compare the Z-axis coordinate value of the updated yarn pixel with the Z-axis coordinate value already in the depth buffer. If the Z-axis coordinate value of the updated yarn pixel is smaller, it indicates that the updated yarn pixel is closer to the observer, so the updated yarn pixel is a visible object and will be rendered at the same screen position; otherwise, the updated yarn pixel is an occluded object and will not be rendered. In this way, the correct occlusion relationship between yarn coils is achieved, and the accuracy and visual continuity of the fabric simulation effect map are improved.

[0118] In the second step, based on the position occlusion relationship, the transparency of the yarn pixels is determined using the Alpha blending mode.

[0119] In the model, the transparency processing is mainly to determine the rendering of the yarn foreground color and the background color, and to use the Alpha blending mode to determine the transparency of the yarn pixel and the final color of the yarn pixel.

[0120] The calculation formula for the Alpha blending mode is as follows:

[0121] C final =αC src +(1-α)C dst

[0122] Among them, C final is the final color value, C src is the source color value (i.e. foreground color), C dst is the target color value (i.e. background color), and α is the alpha value of the source color.

[0123] An Alpha threshold is set to determine the transparency state of the yarn pixel. The Alpha threshold value range is [0, 1]. If the value of α is greater than the Alpha threshold and close to 1, it indicates that the foreground color accounts for a larger proportion in the final color, and the yarn pixel is determined to be opaque and should be rendered; if the value of α is close to 0, it indicates that the background color accounts for a larger proportion in the final color, and the yarn pixel is determined to be transparent and can be ignored, thereby achieving a smooth combination of the yarn foreground color and its background color or other background colors, making the yarn color transition natural and coherent.

[0124] In the third step, based on the position occlusion relationship and the transparency of the yarn pixels, the shadow relationship of the yarn pixels is determined by using variance shadow mapping.

[0125] Due to the volumeless characteristics of the strip geometry, ripples and rendering artifacts are easily generated when processing shadows. In this embodiment, variance shadow mapping is used to determine whether the yarn pixel is in the shadow, and then a smooth and natural shadow of the plain knitted fabric is generated. At the same time, a more natural gradient effect is also achieved on the shadow edge. At this point, the simulation effect diagram of the plain knitted fabric is completed, and the simulation realism of the plain knitted fabric is achieved. Figure 7 shown.

[0126] First, variance shadow mapping renders the plain fabric from the perspective of the light source and generates a depth map. The distance of each yarn pixel from the light source, i.e. the depth value d, is collected, and the depth square d is calculated and stored. 2 , and generate a depth square map; then, smooth the depth value and the depth square through a filter, reduce the high-frequency noise in the depth value and the depth square, and blur the depth map and the depth square map; finally, sample the blurred depth map and depth square map to obtain the expected depth E[d] and the expected depth square E[d 2 ], and then further calculate the variance Var[d], the calculation formula is as follows:

[0127] Var[d]=E[d 2 ]-(E[d]) 2

[0128] Collect the visual depth d of the yarn pixel from the observer's perspective frag , and calculate the depth threshold light depth , the calculation formula is as follows:

[0129]

[0130] If d frag >light depth , it is determined that the yarn pixel is in the shadow, and the pixel color value of the yarn pixel in the shadow is recalculated to make the shadow effect smoother and more natural.

[0131] If d frag >light depth , it is determined that the yarn pixel is not in the shadow and no operation is required.

[0132] Example 2: Simulation of cable knitted fabrics, such as Figure 10-11 As shown:

[0133] Based on step S100 of embodiment 1 of the present invention, a yarn coil path of the cable knitted fabric is fitted by a second-order Bezier curve in a three-dimensional space to construct a ribbon model of the cable knitted fabric, such as Fig.10 shown.

[0134] The subsequent steps are the same as those in Example 1, and the simulation effect diagram of the cable knitted fabric is completed. Fig.11 The parts not involved in the present invention are the same as the prior art or can be implemented by using the prior art.

[0135] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the present invention itself. Various changes in form and details may be made without departing from the spirit and scope of the present invention as defined in the appended claims.

Claims

1. A realistic simulation method for knitted fabrics based on a ribbon model, characterized in that: The steps include: S100, fitting the yarn coil path of the knitted fabric in three-dimensional space by a second-order Bezier curve to construct a band model of the knitted fabric, specifically: based on the second-order Bezier curve, determining the coordinates of the value points and the control points on the yarn coil path in the band model by actual measurement points on the yarn coil structure; determining the distribution of the interpolation points on the yarn coil path in the band model by the second-order Bezier curve; determining the edge contour points of the yarn coil path in the band model based on the interpolation points; Determine the local reference frame of the coil path according to Frenet-Serret, the local reference frame includes a tangent vector T, a Z-axis vector and a normal vector N; obtain a normal vector N perpendicular to the tangent and the Z-axis by the cross product of the interpolation point tangent vector T and the Z-axis vector (0,0,1); calculate the edge contour points of the yarn coil path in the model according to the yarn diameter along the coil path by the tangent perpendicular to the coil path and the normal vector N, and triangulate the edge contour points to form the surface of the strip fabric model, thereby completing the construction of the strip fabric model; S200, collecting yarn images, extracting yarn texture information, and connecting the beginning and the end of the yarn in the yarn texture to determine the yarn texture image; S300, determining a texture map for fabric rendering from the yarn texture image, and inputting the texture map into the strip model for mapping and rendering based on the UV coordinate value of the strip model to obtain an initial simulation image of the fabric; When mapping the map to the model, a row of coils in the strip model is taken as a unit, the yarn diameter direction is the U coordinate, and the yarn length direction is the V coordinate. The UV coordinate value of each row of coils in the strip model is determined by the following calculation formula: u=i′ / d,(i′∈K) v=Len×a a=L / l′ Where L is the length of a row of coils, l' is the yarn length, i' is the i'th interpolation point on the yarn diameter in the model, d is the yarn diameter, K is the total number of interpolation points on a section in the model, Len is the curve length from the starting point to the current position of the yarn, u is the yarn diameter direction, v is the yarn length direction, and a is the scale factor of texture stretching; S400, performing precision, transparency and shadow processing on the initial simulation image of the fabric, obtaining a fabric simulation effect image, and achieving a realistic sense of knitted fabric simulation.

2. The method for realistic simulation of knitted fabrics based on a ribbon model according to claim 1, characterized in that: In step S200, the collected yarn image is binarized to extract the yarn main body and hairiness information.

3. The method for realistic simulation of knitted fabrics based on a ribbon model according to claim 1, characterized in that: In step S200, after the yarn texture information is extracted, the minimum repeating unit of the yarn texture is intercepted and subjected to a two-way continuous process to determine a two-way continuous pattern and realize the continuity of the minimum repeating unit in the horizontal direction.

4. The method for realistic simulation of knitted fabrics based on a belt-shaped model according to claim 1, characterized in that: The maps include color map, roughness map, metalness map, height map, ambient occlusion map and normal map.

5. The method for realistic simulation of knitted fabrics based on a ribbon model according to claim 1, characterized in that: Step 300 also includes performing illumination processing on the mapped fabric surface using the bidirectional reflectance distribution function.

6. The method for realistic simulation of knitted fabrics based on a ribbon model according to claim 1, characterized in that: Step S400 is specifically as follows: Step 1: Determine the position occlusion relationship of yarn pixels to achieve the continuity of transition between yarn coils; Step 2: Based on the position occlusion relationship, the transparency of the yarn pixels is determined using the Alpha blending mode to achieve a natural and coherent transition of the yarn color; Step 3: Based on the position occlusion relationship and the transparency of the yarn pixels, the shadow relationship of the yarn pixels is determined using variance shadow mapping to achieve smooth, natural and realistic fabric shadows.

Citation Information

Patent Citations

  • Three-dimensional simulating method for Texgen-based weft-knitted fabric model

    CN106709203A

  • Fabric computer simulation method based on color separation and color change of colored spun yarn

    CN114386295A