Method and electronic device for generating material mapping by shooting with multi-angle lighting
Through multi-angle lighting shooting environment and multi-angle light source technology, high-quality material maps are generated, which solves the problems of material color interference, insufficient highlight analysis and incomplete map types in the existing technology, and realizes efficient material map generation suitable for PBR rendering systems.
Patent Information
- Application Number
- CN202111271818.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2041-10-29
AI Technical Summary
When generating material maps, existing material scanning technology is affected by the material color, insufficient highlight analysis, and incomplete or incorrect types of maps, so it cannot be adapted to a high-quality PBR rendering system.
By building a multi-angle lighting shooting environment, using multi-angle light sources to illuminate the test platform from different angles, taking pictures of colorimetric cards, white paper and objects to be scanned, applying color correction matrix and light intensity correction coefficients to generate basic color maps, normal maps, metallicity maps, roughness maps and transparency maps.
The generated material maps are of higher quality, allowing for more accurate analysis of highlights and roughness, suitable for high-quality PBR rendering systems, providing more realistic rendering results.
Smart Images

Figure CN114119779B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer graphics, and in particular to a method, a storage medium and an electronic device for generating a material map through multi-angle lighting and shooting. Background Art
[0002] The patent specification with announcement number CN 105262927 B discloses a FSM3D fabric high-definition scanner, which consists of a chassis cover, a SLR camera, a chassis frame, a chassis side panel, a push-pull drawer for placing the scanned fabric, and a plug-in scanner control host. The chassis frame is equipped with six groups of LED light sources and cold light source. The 3D material map combination file generated and output by this patented technology includes diffuse reflection map, normal map, displacement map, highlight map, and transparency map.
[0003] The patent specification with announcement number CN 107146264 B discloses a method for extracting the geometric and physical properties of material surface and illumination, comprising the following steps: step 1, setting up a shooting environment; step 2, taking a picture for light compensation; step 3, taking a picture of the material; step 4, calculating the geometric surface shape of the material surface; step 5, calculating the diffuse reflection coefficient of the material surface; step 6, calculating the specular reflection coefficient of the material surface; step 7, calculating the displacement information of the material surface; step 8, calculating the transparency value of the material.
[0004] With the development of rendering technology and the growing demand for high-quality modeling, more and more 3D applications are beginning to support physically based rendering (PBR) technology, and realistic rendering results require the support of high-quality material maps. For a typical PBR rendering system, the required maps mainly include base color maps, normal maps, metalness maps, roughness maps, and transparency maps. Existing material scanning technology mainly uses image processing methods to obtain material maps by superimposing, subtracting, inverting, blurring, and filtering photos of materials under different lighting conditions. The main shortcomings of the existing methods are:
[0005] 1. Affected by the color of the material itself, the generated texture tends to be divided by color;
[0006] 2. Insufficient analysis of highlights, resulting in inaccurate metalness and roughness;
[0007] 3. The generated texture types are incomplete or incorrect, and cannot be adapted to high-quality PBR rendering systems. Summary of the invention
[0008] In response to the above-mentioned technical problems and the shortcomings in the field, the present invention provides a method for generating material maps through multi-angle lighting shooting, which can generate high-quality basic color maps, normal maps, metalness maps, roughness maps and transparency maps, and is particularly suitable for PBR rendering.
[0009] A method for generating a material map by shooting with multi-angle lighting, comprising the steps of:
[0010] 1) Construct a multi-angle lighting shooting environment;
[0011] The multi-angle lighting shooting environment includes a box body, a test platform, a shooting device and a detachable multi-angle light source are arranged inside the box body, the shooting device is arranged directly above the test platform, and the multi-angle light source is located below the shooting device, which is used to illuminate the test platform from different angles, including a top light source, an upper light source, a lower light source and a bottom light source as a backlight arranged in sequence from top to bottom, and the top light source, the upper light source and the lower light source are located above the test platform; the top light source, the upper light source, the lower light source and the bottom light source are independently composed of at least one group of lights;
[0012] 2) Place a colorimetric card on the test platform, and always photograph the colorimetric card with only one set of lights turned on, traverse all lower light sources, upper light sources, and top light sources, and use a standard color calibration program to generate a color correction matrix corresponding to the lighting direction for the photographed pictures;
[0013] 3) Place a flat white paper on the test platform, and always photograph the white paper with only one set of lights turned on, traversing all lower light sources, upper light sources, and top light sources; for the white paper image taken from any lighting direction, apply the color correction matrix of the same lighting direction to generate a color-calibrated white paper image, and further process to generate the light intensity correction coefficient for the corresponding lighting direction;
[0014] 4) Without placing any objects on the test platform, take a calibration picture for transparency calculation: turn on all lower light sources and take a picture without backlight ImageAlpha0; turn on all bottom light sources and lower light sources and take a picture with backlight ImageAlpha1;
[0015] 5) Place the object to be scanned on the test platform;
[0016] Always keep photographing the object to be scanned with only one set of lights turned on, traversing all lower light sources, upper light sources and top light sources; for the image of the object to be scanned taken in any lighting direction, apply the color correction matrix of the same lighting direction to generate a color-calibrated image of the object to be scanned, multiply the R (red), G (green), and B (blue) values of each pixel of the color-calibrated image of the object to be scanned by the light intensity correction coefficient generated by the corresponding pixel in the same lighting direction, and generate the final corrected image of the lighting direction;
[0017] Turn on all lower light sources, and photograph the object to be scanned to obtain a backlight-free image ImageBlend0;
[0018] Turn on all bottom light sources and lower light sources, and photograph the object to be scanned to obtain a backlit image ImageBlend1;
[0019] 6) Generate basic color map;
[0020] 7) Generate roughness map;
[0021] 8) Generate metalness map;
[0022] 9) Generate normal map;
[0023] 10) Generate transparency map.
[0024] In the multi-angle lighting shooting environment, the detachable multi-angle light source can be quickly repaired and replaced when an abnormality occurs in the light source.
[0025] The method for generating a material map by shooting with multi-angle lighting described in the present invention can specifically adopt the following preferred technical solutions:
[0026] In step 1):
[0027] The top light source is a light source board, which is provided with through holes and / or transparent areas (glass or other transparent materials may be used) for the shooting light path of the shooting device to pass through and / or transmit. The top light source is directly facing or equivalently directly facing the test platform, and may be composed of one or more LED lights. Compared with multiple light strips or multiple groups of lights, the present invention uses a whole light source board as the top plate, and the light source is more uniform, which can effectively improve the simulation effect.
[0028] The upper light source comprises a plurality of groups of upper lamps which are circumferentially arranged on the inner wall of the box body near the top and can be tilted to illuminate the test platform.
[0029] The lower light source comprises a plurality of groups of lower lamps which are circumferentially arranged on the inner wall of the box body near the bottom.
[0030] The present invention divides the lateral light source into two groups of upper and lower lights, which can provide more lighting angles, increase simulation samples, and improve simulation accuracy.
[0031] Preferably, the lower lamp is perpendicular to the test platform or obliquely downward toward the test platform.
[0032] The bottom light source is installed by being embedded in the test platform, or being arranged below the test platform, or a combination of the above methods.
[0033] The top light source, the upper light source and the lower light source are all equipped with light homogenizing sheets, which can make the light distribution more uniform and achieve better effects when shooting smooth objects.
[0034] Further preferably, the top light source and the bottom light source are each composed of a group of lights, and the upper light source and the lower light source are each composed of at least four groups of lights. The rich design of the multi-angle light source of the present invention can provide more simulation samples and improve the simulation accuracy.
[0035] Preferably, in step 3), the R, G, B values of each pixel of the calibrated white paper image are divided by 225 to obtain a light intensity correction coefficient of the R, G, B values of each pixel in the corresponding lighting direction.
[0036] In a preferred embodiment, step 6) specifically includes:
[0037] Sum the R, G, and B values of the pixels at the same position of each corrected image in step 5) respectively, and take the pixel at the position on the corrected image corresponding to the second smallest sum of the R, G, and B values as the basic color of the corresponding position of the basic color map;
[0038] All position pixels are traversed and calculated to generate the basic color map.
[0039] In a preferred embodiment, step 7) specifically includes:
[0040] The R, G, B values of the pixels at the same position on each corrected image in step 5) are subtracted from the R, G, B values of the pixels at the same position on the basic color map. The differences ≤ 0 are recorded as 10, and the others remain unchanged. Then, the variance and range of all the differences are calculated. The roughness of the roughness map at the corresponding position is calculated as follows:
[0041] roughness=6.5*variance–0.3*range;
[0042] All position pixels are traversed and calculated to generate the roughness map.
[0043] In a preferred embodiment, in step 8), for any pixel at a position on the metalness map, the metalness is calculated according to the following method:
[0044] First, sum the R, G, and B values of the pixel at the position on the basic color map;
[0045] If condition I is met: the sum of the R, G, and B values is less than 390, the metalness of the pixel at that position on the metalness map is 0;
[0046] If condition I is not met, the R, G, B values of the pixels at the same position on each corrected image in step 5) are subtracted from the R, G, B values of the pixels at the same position on the basic color map to obtain the maximum difference r, g, b of the R, G, B channels, and calculate the deviation:
[0047] deviation=|rg|+|gb|;
[0048] At this time, if condition II is met: the sum of r, g, and b is less than 300 and the deviation is less than 30, the metalness of the pixel at this position on the metalness map is still 0;
[0049] If neither condition I nor condition II is satisfied, the sum of r, g, and b is divided by 2 as the metalness of the pixel at that position on the metalness map;
[0050] All position pixels are traversed and calculated to generate the metalness map.
[0051] In a preferred embodiment, step 9) specifically includes the steps of:
[0052] 9-1) Convert all the corrected images corresponding to the lower light source in step 5) into grayscale images, apply Butterworth high-pass filtering with D0=20 and n=2 to remove the influence of light field imbalance, shadows and basic colors, and linearly map the R, G, and B values of all pixels to 0 to 255 for contrast enhancement;
[0053] 9-2) Establish a three-dimensional coordinate system with the center of the test platform as the origin. For any calibrated image processed in step 9-1) and any position pixel P on it xy , x and y represent the two-dimensional coordinates of the plane where the image is located, the center position of the image is set to O, and the center position of the light source corresponding to the lighting direction of the image is set to P i , then the incident direction of light V=(OP i )+0.2*(P xy -P i );
[0054] Pixel P xy Lumin = R xy *0.299+G xy *0.587+B xy *0.114, Rxy , G xy , B xy Represents pixel P xy R, G, B values;
[0055] Multiply the brightness Lumin of the pixel at the same position of the corrected image processed by step 9-1) and the corresponding light incident direction V and then sum them to obtain the normal value of the pixel at the position;
[0056] Traverse and calculate all position pixels to generate a normal map.
[0057] In a preferred embodiment, in step 10), for any pixel at a position on the transparency map, the transparency alpha is calculated according to the following method:
[0058]
[0059] Among them, C d Represents the color of the pixel at that position on the image ImageAlpha0, C e Represents the color of the pixel at that position on the image ImageAlpha1, C0 represents the color of the pixel at that position on the image ImageBlend0, and C1 represents the color of the pixel at that position on the image ImageBlend1;
[0060] All position pixels are traversed and calculated to generate the transparency map.
[0061] The present invention also provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method of generating a material map through multi-angle lighting photography when running.
[0062] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method of generating a material map through multi-angle lighting photography.
[0063] Compared with the prior art, the present invention has the following main advantages:
[0064] 1. The present invention is based on the PBR (Physically Based Rendering) principle for calculation, and has a full range of texture generation types, which is applicable to most of the currently popular rendering systems, and has simple calculations and fast texture generation speed.
[0065] 2. The present invention uses a method of subtracting image color from base color to maximize the elimination of the influence of the object's own color on the calculation of texture attributes. The roughness and metalness calculations are more accurate, and the generated texture quality is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 is a schematic diagram of the overall structure of a multi-angle lighting shooting environment of an embodiment;
[0067] Figure 2 A schematic diagram of the internal structure of a multi-angle lighting shooting environment of an embodiment;
[0068] Figure 3 A correction picture generated by photographing an object to be scanned in the method of generating a material map by photographing with multi-angle lighting in the embodiment;
[0069] Figure 4 It is a difference picture between a correction picture generated by shooting an object to be scanned and a basic color map in the method of generating a material map by shooting with multi-angle lighting in the embodiment;
[0070] Figure 5 The basic color map, roughness map, metalness map, normal map and transparency map generated by the method of generating material maps by shooting with multi-angle lighting in the embodiment;
[0071] In the figure:
[0072] 1-1, lower LED light 1-2, upper LED light 3, light source board
[0073] 4. Bottom LED light 5. Test platform 6. Photographing equipment
[0074] 7. Main control board 10. Box 11. Door
[0075] 12. Upper cover 13. Sensor 14. Multi-angle light source. DETAILED DESCRIPTION
[0076] The present invention will be further described below in conjunction with the accompanying drawings and specific examples. It should be understood that these examples are only intended to illustrate the present invention and are not intended to limit the scope of the present invention. The operating methods in the following examples without specifying specific conditions are usually carried out under conventional conditions or under conditions recommended by the manufacturer.
[0077] The method of generating a material map by shooting with multi-angle lighting in this embodiment includes the following steps:
[0078] 1) Create a multi-angle lighting shooting environment.
[0079] like Figure 1 , 2 As shown, the multi-angle lighting shooting environment includes a box 10. The interior of the box 10 is made of light-absorbing material to reduce light reflection, and the box 10 is about 60 cm long and 60 cm wide, and about 45 cm high.
[0080] A main control board 7 , a test platform 5 , a shooting device 6 and a detachable multi-angle light source 14 are arranged inside the box 10 .
[0081] The photographing device 6 is arranged directly above the test platform 5 and located at the top center of the box 10 to shoot directly downward. It can be composed of one or more SLR cameras or cameras and is used to take pictures of objects on the test platform 5 under lighting at different angles.
[0082] The multi-angle light source 14 is located below the shooting device 6 and is used to illuminate the test platform 5 from different angles. It includes a top light source, an upper light source, a lower light source and a bottom light source serving as a backlight arranged in sequence from top to bottom, and the top light source, the upper light source and the lower light source are located above the test platform 5.
[0083] The top light source is a square light source board 3, which is an integrally luminous LED lamp and has through holes for the shooting light path of the shooting device 6 to pass through and / or transmit. The definition of top represents the picture taken by the light source board 3.
[0084] The upper light source includes four groups of rectangular upper LED lights 1-2 which are arranged circumferentially around the four inner side walls of the box 10 near the top and can be tilted to illuminate the test platform 5. The tilt angle of the upper LED lights 1-2 is adjustable, such as being able to tilt at 45° to illuminate the test platform 5. The pictures taken by lighting the four groups of upper LED lights 1-2 are named upfront (the picture taken with the light at the upper front position as the light source), upback (the picture taken with the light at the upper back position as the light source), upleft (the picture taken with the light at the upper left position as the light source), and upright (the picture taken with the light at the upper right position as the light source).
[0085] The lower light source includes four groups of rectangular lower LED lights 1-1 which are circumferentially arranged on the four inner walls of the box 10 near the bottom and perpendicular to the test platform 5. The pictures obtained by lighting the four groups of lower LED lights 1-1 separately are named downfront (the picture taken with the light at the lower front position as the light source), downback (the picture taken with the light at the lower rear position as the light source), downleft (the picture taken with the light at the lower left position as the light source), and downright (the picture taken with the light at the lower right position as the light source).
[0086] The bottom light source is a cold light sheet light source, specifically a group of bottom LED lights 4, which are installed in a way that they are embedded in the test platform 5 and can illuminate upward the object to be photographed placed on the test platform 5. Cold light sheets have stronger penetration and are suitable for calculating transparent image mapping.
[0087] The top light source, the upper light source and the lower light source are all equipped with light homogenizing sheets.
[0088] The main control board 7 can control all LED lights in the multi-angle light source 14 to independently adjust the brightness and switch them on and off.
[0089] One side of the box 10 is a door 11 that can be opened and closed, and a sensor 13 is provided on the side corresponding to the door 11 to feedback the opening and closing state of the door 11. The entire side is set as the door 11. When the door 11 is open, the test platform 5 is fully exposed to the operator, providing a spacious operating space for placing and arranging the objects to be photographed; when the door 11 is closed, a complete test environment can be provided. If the operator fails to close the door 11 or fails to completely close the door 11 during the operation, the sensor 13 will remind the operator to close the door after detecting it.
[0090] The top surface of the box body 10 is an openable upper cover 12. When the upper cover 12 is closed, it provides physical protection for the shooting device 6 to prevent damage; when the upper cover 12 is opened, it provides convenience for the replacement and maintenance of the shooting device 6.
[0091] The multi-angle lighting shooting environment of this embodiment has an open test platform 5 with a large operating space, which ensures that the placement state of the object to be photographed is consistent with the final shooting state, thereby improving the authenticity of the collected data. The multi-angle light source 14 includes an 8-directional side LED light + bottom LED light + top LED light layout, which can take a total of 10 groups of sample photos, provide 10 groups of simulation samples, and improve simulation accuracy.
[0092] 2) A colorimetric card is placed on the test platform 5, and the colorimetric card is photographed while only one set of lights is turned on. All lower light sources, upper light sources and top light sources are traversed, and the photographed pictures are all used to generate a color correction matrix corresponding to the lighting direction using a standard color calibration program.
[0093] 3) Place a flat white paper on the test platform 5, and always photograph the white paper with only one set of lights turned on, traversing all lower light sources, upper light sources and top light sources; for the white paper picture taken in any lighting direction, apply the color correction matrix of the same lighting direction to generate a calibrated white paper picture, divide the R, G, B values of each pixel of the calibrated white paper picture by 225, and obtain the light intensity correction coefficient of the R, G, B values of each pixel in the corresponding lighting direction.
[0094] Steps 2) and 3) only need to be performed when the device is used for the first time. The color correction matrix and light intensity correction coefficient can be reused. Color correction can obtain more accurate color expression, and light intensity correction can offset the influence of the distance and angle of the light source on the reflection intensity of the object.
[0095] 4) Without placing any objects on the test platform 5, take a correction picture for transparency calculation: turn on all lower light sources to obtain a non-backlit picture ImageAlpha0; turn on all bottom light sources and lower light sources to obtain a backlit picture ImageAlpha1.
[0096] 5) The object to be scanned is placed on the test platform 5.
[0097] Always keep shooting the object to be scanned with only one set of lights turned on, traversing all lower light sources, upper light sources and top light sources; for the image of the object to be scanned taken from any lighting direction, apply the color correction matrix of the same lighting direction to generate a color-calibrated image of the object to be scanned, multiply the R, G, B values of each pixel of the color-calibrated image of the object to be scanned by the light intensity correction coefficient generated by the corresponding pixel in the same lighting direction, and generate the final corrected image of the lighting direction; the corrected images of the 9 lighting directions finally generated are as follows: Figure 3 As shown, after color correction + light intensity correction, the diffuse reflection is evenly distributed and the color is more restored.
[0098] All lower light sources are turned on, and the object to be scanned is photographed to obtain a backlight-free image ImageBlend0.
[0099] All bottom light sources and lower light sources are turned on, and the object to be scanned is photographed to obtain a backlit image ImageBlend1.
[0100] 6) Generate a basic color map, including:
[0101] The R, G, and B values of the pixels at the same position of each corrected image in step 5) are summed respectively, and the pixel at the position on the corrected image corresponding to the second smallest sum of the R, G, and B values is taken as the basic color of the corresponding position of the basic color map; the advantage of taking the second smallest number is that the influence of shadows and highlights on the basic color can be reduced.
[0102] All position pixels are traversed and calculated to generate the basic color map.
[0103] 7) Generate a roughness map, including:
[0104] Subtract the R, G, B values of the pixels at the same position on each corrected image in step 5) from the R, G, B values of the pixels at the same position on the basic color map (9 difference maps can be obtained, such as Figure 4 As shown, the data after difference is visualized to capture highlight information), the difference value ≤ 0 is recorded as 10, and the rest remain unchanged, and then the variance and range are calculated for all the differences. The roughness of the roughness map at the corresponding position is calculated as follows:
[0105] roughness=6.5*variance–0.3*range;
[0106] All position pixels are traversed and calculated to generate the roughness map.
[0107] 8) Generate a metalness map.
[0108] For any pixel at any position on the metalness map, the metalness is calculated as follows:
[0109] First, sum the R, G, and B values of the pixel at the position on the basic color map;
[0110] If condition I is met: the sum of the R, G, and B values is less than 390, the metalness of the pixel at that position on the metalness map is 0;
[0111] If condition I is not met, the R, G, and B values of the pixels at the same position on each corrected image in step 5) are subtracted from the R, G, and B values of the pixels at the same position on the basic color map (9 difference maps can be obtained, such as Figure 4 As shown, the data after difference is visualized to capture highlight information), the maximum difference r, g, b of each channel of R, G, and B is obtained, and the deviation degree is calculated:
[0112] deviation=|rg|+|gb|;
[0113] At this time, if condition II is met: the sum of r, g, and b is less than 300 and the deviation is less than 30, the metalness of the pixel at this position on the metalness map is still 0;
[0114] If neither condition I nor condition II is satisfied, the sum of r, g, and b is divided by 2 as the metalness of the pixel at that position on the metalness map;
[0115] All position pixels are traversed and calculated to generate the metalness map.
[0116] 9) Generate a normal map, including the following steps:
[0117] 9-1) Convert all the corrected images corresponding to the lower light source in step 5) into grayscale images, apply Butterworth high-pass filtering with D0=20 and n=2 to remove the influence of light field imbalance, shadows and basic colors, and linearly map the R, G, and B values of all pixels to 0 to 255 for contrast enhancement;
[0118] 9-2) Establish a three-dimensional coordinate system with the center of the test platform 5 as the origin. For any calibrated image processed in step 9-1) and any position pixel P on it xy, x and y represent the two-dimensional coordinates of the plane where the image is located, the center position of the image is set to O, and the center position of the light source corresponding to the lighting direction of the image is set to P i , then the incident direction of light V=(OP i )+0.2*(P xy -P i );
[0119] Pixel P xy Lumin = R xy *0.299+G xy *0.587+B xy *0.114, R xy , G xy , B xy Represents pixel P xy R, G, B values;
[0120] Multiply the brightness Lumin of the pixel at the same position of the corrected image processed by step 9-1) and the corresponding light incident direction V and then sum them to obtain the normal value of the pixel at the position;
[0121] Traverse and calculate all position pixels to generate a normal map.
[0122] 10) Generate transparency map.
[0123] For any pixel at any position on the transparency map, the transparency alpha is calculated as follows:
[0124]
[0125] Among them, C d Represents the color of the pixel at that position on the image ImageAlpha0, C e Represents the color of the pixel at that position on the image ImageAlpha1, C0 represents the color of the pixel at that position on the image ImageBlend0, and C1 represents the color of the pixel at that position on the image ImageBlend1;
[0126] All position pixels are traversed and calculated to generate the transparency map.
[0127] The high-quality basic color map, normal map, metalness map, roughness map and transparency map generated by the method of generating material maps through multi-angle lighting shooting in this embodiment are as follows: Figure 5 shown.
[0128] In addition, it should be understood that after reading the above description of the present invention, those skilled in the art may make various changes or modifications to the present invention, and these equivalent forms also fall within the scope defined by the claims attached to this application.
Claims
1. A method for generating a material map by shooting with multi-angle lighting, characterized in that: Includes steps: 1) Construct a multi-angle lighting shooting environment; The multi-angle lighting shooting environment comprises a box (10), wherein a test platform (5), a shooting device (6) and a detachable multi-angle light source (14) are arranged inside the box (10), wherein the shooting device (6) is arranged directly above the test platform (5), and the multi-angle light source (14) is located below the shooting device (6) and is used to illuminate the test platform (5) from different angles, and comprises a top light source, an upper light source, a lower light source and a bottom light source as a backlight arranged in sequence from top to bottom, wherein the top light source, the upper light source and the lower light source are located above the test platform (5); and the top light source, the upper light source, the lower light source and the bottom light source are each independently composed of at least one group of lights; 2) placing a colorimetric card on the test platform (5), and photographing the colorimetric card while only one set of lights is turned on, traversing all lower light sources, upper light sources, and top light sources, and using a standard color calibration program to generate a color correction matrix corresponding to the lighting direction for the photographed pictures; 3) Place a flat white paper on the test platform (5), and always photograph the white paper with only one set of lights turned on, traversing all lower light sources, upper light sources, and top light sources; for the white paper image taken from any lighting direction, apply the color correction matrix of the same lighting direction to generate a color-calibrated white paper image, and further process to generate a light intensity correction coefficient for the corresponding lighting direction; 4) Without placing any objects on the test platform (5), take a calibration image for transparency calculation: turn on all lower light sources and take a backlight-free image ImageAlpha0; Turn on all bottom light sources and lower light sources to capture a backlit image ImageAlpha1; 5) Placing the object to be scanned on the test platform (5); Always keep photographing the object to be scanned with only one set of lights turned on, traversing all lower light sources, upper light sources and top light sources; for the image of the object to be scanned taken in any lighting direction, apply the color correction matrix of the same lighting direction to generate a color-calibrated image of the object to be scanned, multiply the R, G, B values of each pixel of the color-calibrated image of the object to be scanned by the light intensity correction coefficient generated by the corresponding pixel in the same lighting direction, and generate the final corrected image of the lighting direction; Turn on all lower light sources, and photograph the object to be scanned to obtain a backlight-free image ImageBlend0; Turn on all bottom light sources and lower light sources, and photograph the object to be scanned to obtain a backlit image ImageBlend1; 6) Generate basic color map; 7) Generate a roughness map, including: The R, G, B values of the pixels at the same position on each corrected image in step 5) are subtracted from the R, G, B values of the pixels at the same position on the basic color map. The differences ≤ 0 are recorded as 10, and the others remain unchanged. Then, the variance and range of all the differences are calculated. The roughness of the roughness map at the corresponding position is calculated as follows: roughness=6.5*variance–0.3*range; Traversing and calculating all position pixels to generate the roughness map; 8) Generate metalness map; 9) Generate normal map; 10) Generate transparency map.
2. The method according to claim 1, characterized in that In step 1): The top light source is a light source plate (3) which is provided with through holes and / or transparent areas for the shooting light path of the shooting device (6) to pass through and / or transmit; The upper light source comprises a plurality of groups of upper lights which are arranged circumferentially on the inner wall of the box (10) near the top and can be tilted to illuminate the test platform (5); The lower light source comprises a plurality of groups of lower lights which are arranged circumferentially around the inner wall of the box (10) near the bottom, and the lower lights are perpendicular to the test platform (5) or obliquely downward toward the test platform (5); The bottom light source is installed by being embedded in the test platform (5), or being arranged below the test platform (5), or a combination of the above methods; The top light source, the upper light source and the lower light source are all equipped with light homogenizing sheets.
3. The method according to claim 1, characterized in that In step 3), the R, G, and B values of each pixel of the calibrated white paper image are divided by 225 to obtain the light intensity correction coefficient of the R, G, and B values of each pixel in the corresponding lighting direction.
4. The method according to claim 1, characterized in that: Step 6) specifically includes: Sum the R, G, and B values of the pixels at the same position of each corrected image in step 5) respectively, and take the pixel at the position on the corrected image corresponding to the second smallest sum of the R, G, and B values as the basic color of the corresponding position of the basic color map; All position pixels are traversed and calculated to generate the basic color map.
5. The method according to claim 1 or 4, characterized in that: In step 8), for any pixel at a position on the metalness map, the metalness is calculated according to the following method: First, sum the R, G, and B values of the pixel at the position on the basic color map; If condition I is met: the sum of the R, G, and B values is less than 390, the metalness of the pixel at that position on the metalness map is 0; If condition I is not met, the R, G, B values of the pixels at the same position on each corrected image in step 5) are subtracted from the R, G, B values of the pixels at the same position on the basic color map to obtain the maximum difference r, g, b of the R, G, B channels, and calculate the deviation: deviation=|rg|+|gb|; At this time, if condition II is met: the sum of r, g, and b is less than 300 and the deviation is less than 30, the metalness of the pixel at this position on the metalness map is still 0; If neither condition I nor condition II is satisfied, the sum of r, g, and b is divided by 2 as the metalness of the pixel at that position on the metalness map; All position pixels are traversed and calculated to generate the metalness map.
6. The method according to claim 1, characterized in that Step 9) specifically includes the steps of: 9-1) Convert all the corrected images corresponding to the lower light source in step 5) into grayscale images, apply Butterworth high-pass filtering with D0=20 and n=2 to remove the influence of light field imbalance, shadows and basic colors, and linearly map the R, G, and B values of all pixels to 0 to 255 for contrast enhancement; 9-2) A three-dimensional coordinate system is established with the center of the test platform (5) as the origin. For any calibrated image processed in step 9-1) and any pixel P at any position on it, xy , x and y represent the two-dimensional coordinates of the plane where the image is located, the center position of the image is set to O, and the center position of the light source corresponding to the lighting direction of the image is set to P i , then the incident direction of light V=(OP i )+0.2*(P xy -P i ); Pixel P xy Lumin = R xy *0.299+G xy *0.587+B xy *0.114, R xy , G xy , B xy Represents pixel P xy R, G, B values; Multiply the brightness Lumin of the pixel at the same position of the corrected image processed by step 9-1) and the corresponding light incident direction V and then sum them to obtain the normal value of the pixel at the position; Traverse and calculate all position pixels to generate a normal map.
7. The method according to claim 1, characterized in that In step 10), for any pixel at a position on the transparency map, the transparency alpha is calculated according to the following method: Among them, C d Represents the color of the pixel at that position on the image ImageAlpha0, C e Represents the color of the pixel at that position on the image ImageAlpha1, C0 represents the color of the pixel at that position on the image ImageBlend0, and C1 represents the color of the pixel at that position on the image ImageBlend1; All position pixels are traversed and calculated to generate the transparency map.
8. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
A fsm3d fabric high-definition scanner and its automatic control system
CN105262927B
A method for extracting the geometric and light physical properties of a material surface
CN107146264B
Method of extracting geometric and illumination physical attributes on surface of material
CN107146264A
PBR material map generation method and device
CN112562053A