Pseudo-indoor rendering method, device, medium and equipment supporting lighting
By importing the facade model and interior projection diagram, combining lighting calculation and color mixing, the problem of lack of lighting effects in the existing technology of indoor models is solved, and a more realistic and dynamic pseudo-interior rendering effect is achieved.
Patent Information
- Application Number
- CN202210611004.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-05-31
AI Technical Summary
In the prior art, static maps or cube textures are not allowed to form shadows based on scene lighting, resulting in the lack of dynamic effects and authenticity of the indoor model.
Using a pseudo-interior rendering method that supports lighting, converts the camera direction and parallel light direction to the tangent coordinate system by importing the facade model, indoor isometric columnar projection and facade window map in the shader, using ray-plane The algorithm calculates the location of the virtual indoor model, and samples the projection map and window map in the spherical coordinate system, judges the lighting range and intensity, performs lighting calculations and color mixing, and generates the final pseudo-interior color.
The lighting effects and shadow rendering of the indoor model are realized, improving the authenticity and dynamicity of the scene, making the resource occupancy smaller and easier to produce.
Smart Images

Figure CN114820904B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a pseudo indoor rendering method, device, medium and equipment supporting lighting. Background Art
[0002] In the city model of the digital twin scene, due to the speed of computer rendering, users cannot observe the indoor model from the outside, and the amount of indoor modeling is huge. In order to observe the details of the interior from the outside and improve the realism of the scene, the existing solution will paste static textures on the facade model, which has no 3D effect, or use cube textures to simulate the interior, but cube textures are also static images. Although they have 3D effects, they cannot form shadows indoors according to the scene lighting, and the corresponding effects change with the timeline.
[0003] For this reason, this field is in urgent need of a method that can solve the above-mentioned technical problems. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a pseudo-indoor rendering method, device, medium and equipment supporting lighting in response to the shortcomings of the prior art, which is used to solve the technical problem that in the prior art, static textures are pasted on the facade model, the textures have no 3D effect, or although there are 3D effects, shadows cannot be formed indoors according to the scene lighting, and the corresponding effects change with the timeline.
[0005] The technical solution of the present invention to solve the above technical problems is as follows:
[0006] A pseudo indoor rendering method supporting illumination, the method comprising:
[0007] Import facade models, interior equirectangular projections and facade window textures;
[0008] In the shader, set the camera direction D C , scene parallel light direction D L Convert from world coordinate system to tangent coordinate system;
[0009] In the tangent coordinate system, the indoor model is reconstructed using the ray-plane algorithm based on the facade model, the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system is calculated, and the position Po is converted to the spherical coordinate system to obtain the position Ps. s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n ;
[0010] Based on the light source position P L, sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I;
[0011] Based on the unilluminated indoor color C n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , the indoor model color and the facade model color are mixed using the window map transparency to obtain the final pseudo indoor color C.
[0012] Furthermore, the facade model includes UV layout data, surface normal N and surface tangent T;
[0013] The indoor equirectangular projection image is a 2D texture with a length-width ratio of 2:1 that is obtained by unfolding the 3D panoramic image in a spherical form;
[0014] The facade window map has a transparent channel value for indicating the light transmittance of the window.
[0015] Furthermore, the camera direction D is set in the shader C , scene parallel light direction D L The conversion from the world coordinate system to the tangent coordinate system specifically includes:
[0016] The secondary tangent BiT is calculated by using the surface normal N and the surface tangent T in the facade model through the cross product;
[0017] BiT=cross(N,T)
[0018] Constructing a tangent coordinate system conversion matrix TBN using the surface normal N, the surface tangent T and the bitangent BiT;
[0019]
[0020] In the shader, set the camera direction D C , scene parallel light direction D L Use matrix multiplication to transform to the tangent coordinate system.
[0021] Furthermore, the UV reconstruction of the indoor model using a ray-plane algorithm in the tangent coordinate system based on the facade model, calculating the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system, and converting the position Po to the spherical coordinate system to obtain the position Ps specifically includes:
[0022] In the tangent coordinate system based on the UV layout data in the facade model and the camera direction D C The ray-plane algorithm is used to calculate the distance L from the facade to a certain plane in the indoor model, where the distance along the camera direction DC The intersection point Ro of the emitted ray and the facade, Ro coordinates are (UV.x, UV.y, 0), and the intersection point of the ray and a plane is position Po;
[0023]
[0024] P o =R o +D c *L;
[0025] Move the center point of the tangent coordinate system to the center of the spherical coordinate system, and offset all intersection positions Po by (-0.5, -0.5, -0.5) units;
[0026] Use dot multiplication to calculate the angle θ between the normalized Po.x and the surface normal N. The angle θ is the angle between the position Po and the position P in the spherical coordinate system. s The x-coordinate value of
[0027] θ=dot(normalize(Po.x,0,0),N)
[0028] Use dot product to calculate the angle β between the normalized Po.yz and the secondary tangent BiT. The angle β is the angle between the position Po and the position P in the spherical coordinate system. s The y coordinate value of
[0029] β=dot(normalize(0,Po.yz),BiT)
[0030] Using coordinates P s The x and y values of the position Po are the position P in the spherical coordinate system. s , P s =(θ,β).
[0031] Further, the use of the spherical coordinates P s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n include:
[0032] The mipmap of the indoor equirectangular projection image is sampled using random integers to obtain different indoor colors C without illumination. n .
[0033] Furthermore, the light source position P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I, including:
[0034] Calculate the position Po in the tangent coordinate system to the light source position P Ldirection Ds, and calculate whether the position Po is on the light-facing surface E L ; Among them, if E L Less than 0, indicating that the position Po is on the light-facing side; if E L If it is greater than or equal to 0, it means that the position Po is on the backlit side and the position Po cannot receive light;
[0035] D s =normalize(P L -P o )
[0036] E L =dot(D s ,D l )
[0037] For the position Po on the light-facing side, the position Po intersects with the facade along the direction Ds. F , calculate P F The position and position Po and position P F The distance between F ;
[0038]
[0039] P F =P o +D s *L F
[0040] Using P F .xy samples the facade window map to obtain the transparent channel A, where the illumination intensity coefficient I is equal to the transparent channel A;
[0041] Among them, if the A value is 0, it means it is completely transparent and can accept light;
[0042] If the A value is 1, it means it is opaque and is within the shadow range;
[0043] If the A value is between 0 and 1, it means semi-transparent, and the light intensity it receives is reduced.
[0044] Furthermore, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination. L , using the transparency of the window map to mix the indoor model color with the facade model color, the final pseudo indoor color C is obtained, including:
[0045] Perform illumination calculation on the pixels within the illumination range to obtain the color C after illumination L ;
[0046] C L =C n *(I+1)
[0047] Use the UV layout data in the facade model to sample the facade window map to get color C F , using C F The transparent channel A is mixed with the interior model color C L Get the final result;
[0048] C=C F *A+C L *(1-A).
[0049] The beneficial effects of the invention of the method are as follows: a pseudo-indoor rendering method supporting illumination is proposed, including importing an exterior facade model, an interior equidistant cylindrical projection map and an exterior facade window map; in the shader, the camera direction D C , scene parallel light direction D L Convert from the world coordinate system to the tangent coordinate system; in the tangent coordinate system, perform UV reconstruction on the indoor model using the ray-plane algorithm based on the facade model, calculate the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system, and convert the position Po to the spherical coordinate system to obtain the spherical coordinate P s , using the spherical coordinates P s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n ; Based on the light source position P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I; based on the unilluminated indoor color C n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , and the indoor model color and the facade model color are mixed by using the transparency of the window map to obtain the final pseudo indoor color C. The present invention establishes a virtual indoor structure through a ray-plane algorithm to facilitate parallel illumination, and then superimposes equirectangular projection graphics (this resource occupies less space than cubic textures and is easier to produce) into a pseudo indoor, and can produce multiple layers of mipmap for equirectangular projection graphics to achieve different indoor effects.
[0050] Another technical solution of the present invention to solve the above technical problem is as follows:
[0051] A pseudo indoor rendering device supporting illumination, the device comprising:
[0052] Data import module, used to import facade models, interior equirectangular projections and facade window maps;
[0053] Data switching module, used to set the camera direction D in the shader C , scene parallel light direction DL Convert from world coordinate system to tangent coordinate system;
[0054] The color calculation module performs UV reconstruction on the indoor model based on the facade model using the ray-plane algorithm in the tangent coordinate system, calculates the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system, and converts the position Po into the spherical coordinate system to obtain the position Ps. s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n ;
[0055] Lighting judgment module, used to determine the position of the light source P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I;
[0056] A color mixing module is used to adjust the indoor color C based on the unilluminated indoor color C. n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , the indoor model color and the facade model color are mixed using the window map transparency to obtain the final pseudo indoor color C.
[0057] In addition, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the pseudo-indoor rendering method supporting lighting described in any one of the above technical solutions.
[0058] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the pseudo-indoor rendering method supporting lighting as described in any one of the above technical solutions are implemented.
[0059] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments of the present invention or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0061] Figure 1 A schematic diagram of a flow chart of a pseudo-indoor rendering method supporting lighting according to an embodiment of the present invention;
[0062] Figure 2 A schematic diagram of modules of a pseudo indoor rendering device supporting lighting according to another embodiment of the present invention. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0064] like Figure 1 A pseudo indoor rendering method supporting illumination according to an embodiment of the present invention includes the following steps:
[0065] 110. Import facade models, interior equirectangular projections and facade window maps;
[0066] 120. In the shader, set the camera direction D C , scene parallel light direction D L Convert from world coordinate system to tangent coordinate system;
[0067] 130. In the tangent coordinate system, based on the facade model, the indoor model is reconstructed using a ray-plane algorithm, the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system is calculated, and the position Po is converted into the spherical coordinate system to obtain the position Ps. s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n ;
[0068] 140. Based on the light source position P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I;
[0069] 150. Based on the unilluminated indoor color C n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , the indoor model color and the facade model color are mixed using the window map transparency to obtain the final pseudo indoor color C.
[0070] Furthermore, the facade model in step 110 includes correct UV layout data, surface normal N and surface tangent T, and the facade model is made by professionals. The indoor equirectangular projection map is a 2D texture with a length and width of 2:1 that is expanded into a spherical form by the 3D panoramic image. The indoor equirectangular projection map can be recorded by a panoramic camera or spliced by artists. The facade window map has a correct transparent channel value to indicate the light transmittance of the window and to calculate whether the indoor light is acceptable and the light intensity.
[0071] Furthermore, in step 120, the camera direction D is set in the shader. C , scene parallel light direction D L The conversion from the world coordinate system to the tangent coordinate system (TBN) specifically includes:
[0072] 121. Calculate the minor tangent BiT by using the surface normal N and the surface tangent T in the facade model through the cross product;
[0073] BiT=cross(N,T)
[0074] 122. Construct a tangent coordinate system conversion matrix TBN using the surface normal N, the surface tangent T and the bitangent BiT;
[0075]
[0076] 123. In the shader, set the camera direction D C , scene parallel light direction D L Use matrix multiplication to transform to the tangent coordinate system.
[0077] Furthermore, in step 130, UV reconstruction of the indoor model using a ray-plane algorithm in the tangent coordinate system based on the facade model is performed, the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system is calculated, and the position Po is converted into the spherical coordinate system to obtain the position Ps, which specifically includes:
[0078] 131. Use the ray-plane algorithm to reconstruct the UV of the five planes in the room, including the ceiling, floor and three walls, and calculate the coordinate Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system; the calculation principle of different planes is the same, only the input parameters are different. The following takes the floor as an example to illustrate how to convert the position Po in the tangent coordinate to the position P in the spherical coordinate s , specifically including the following steps:
[0079] 1311. Based on the UV layout data and the camera direction D in the facade model C Calculate the distance L from the facade to the floor in the indoor model, where the distance along the camera direction DC The intersection point Ro of the emitted ray and the facade, Ro coordinates are (UV.x, UV.y, 0), and the intersection point of the ray and the floor is position Po;
[0080]
[0081] 1312. Calculate the intersection point Po between the ray emitted by the camera and the floor. Po is also the sampling coordinate of the current point, because the calculation parameter range in the tangent coordinate system is [0,1];
[0082] P o =R o +D c *L;
[0083] 132. Move the center point of the tangent coordinate system to the center of the spherical coordinate system, and offset all intersection positions Po by (-0.5, -0.5, -0.5) units;
[0084] 133. Use dot product to calculate the angle θ between the normalized Po.x and the surface normal N. The angle θ is the angle between the position Po and the position P in the spherical coordinate system. s The x-coordinate value of
[0085] θ=dot(normalize(Po.x,0,0),N)
[0086] 134. Use dot product to calculate the angle β between the normalized Po.yz and the secondary tangent BiT. The angle β is the angle between the position Po and the position P in the spherical coordinate system. s The y coordinate value of
[0087] β=dot(normalize(0,Po.yz),BiT)
[0088] 135. Using coordinates P s The x and y values of the position Po are the position P in the spherical coordinate system. s , P s =(θ,β).
[0089] Further, the spherical coordinate P in step 130 is used s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n include:
[0090] 136. Sample the mipmap of the indoor equirectangular projection image using random integers to obtain different indoor colors C without illumination. n .
[0091] It should be noted that the ceiling and three walls can also use the above steps 131 to 136 to calculate the spherical coordinates, and sample the indoor equidistant cylindrical projection map to obtain the unilluminated indoor color C n .
[0092] Furthermore, the light source position P in step 140 is based on L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I, including:
[0093] 141. Calculate the position Po in the tangent coordinate system to the light source position P L direction Ds, and calculate whether the position Po is on the light-facing surface E L ;
[0094] D s =normalize(P L -P o )
[0095] E L =dot(D S ,D L )
[0096] Among them, E L Less than 0, indicating that the position Po is on the light-facing side; if E L If it is greater than or equal to 0, it means that the position Po is on the backlit side and the position Po cannot receive light;
[0097] 142. For the position Po on the light-facing side, the position Po intersects with the facade along the direction Ds. F , calculate P F The position and position Po and position P F The distance between F ;
[0098]
[0099] P F =P o +D s *L F
[0100] 143. Using P F .xy samples the facade window map to obtain the transparent channel A, where the illumination intensity coefficient I is equal to the transparent channel A;
[0101] Among them, if the A value is 0, it means it is completely transparent and can accept light;
[0102] If the A value is 1, it means it is opaque and is within the shadow range;
[0103] If the A value is between 0 and 1, it means semi-transparent, and the light intensity it receives is reduced.
[0104] Furthermore, in step 150, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination. L , using the transparency of the window map to mix the indoor model color with the facade model color, the final pseudo indoor color C is obtained, which specifically includes:
[0105] Perform illumination calculation on the pixels within the illumination range to obtain the color C after illumination L ;
[0106] C L =C n *(I+1)
[0107] Use the UV layout data in the facade model to sample the facade window map to get color C F , using color C F The transparent channel A is mixed with the interior model color C L Get the final pseudo indoor color C;
[0108] C=C F *A+C L *(1-A).
[0109] The beneficial effects of the invention of the method are as follows: a pseudo-indoor rendering method supporting illumination is proposed, including importing an exterior facade model, an interior equidistant cylindrical projection map and an exterior facade window map; in the shader, the camera direction D C , scene parallel light direction D L Convert from the world coordinate system to the tangent coordinate system; in the tangent coordinate system, perform UV reconstruction on the indoor model using the ray-plane algorithm based on the facade model, calculate the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system, and convert the position Po to the spherical coordinate system to obtain the spherical coordinate P s , using the spherical coordinates P s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n ; Based on the light source position P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I; based on the unilluminated indoor color C n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , the indoor model color and the facade model color are mixed using the window map transparency to obtain the final pseudo indoor color C.
[0110] The present invention proposes a solution based on ray stepping, which establishes a virtual indoor structure through a ray-plane algorithm to facilitate parallel lighting, and then superimposes equidistant cylindrical projection graphics (this resource occupies less space than cubic textures and is easier to produce) into a pseudo indoor, and can produce multiple layers of mipmap for the equidistant cylindrical projection graphics to achieve different indoor effects.
[0111] The present invention adopts a ray-stepping calculation method to reconstruct the indoor model, so that the pseudo-indoor can receive parallel scene illumination, and utilizes an equirectangular projection image (3D panoramic image format) to optimize the cube texture in the traditional solution, which occupies less space and has greater versatility.
[0112] Another technical solution of the present invention to solve the above technical problem is as follows:
[0113] like Figure 2 As shown, a pseudo indoor rendering device supporting lighting, the device comprising:
[0114] Data import module, used to import facade models, interior equirectangular projections and facade window maps;
[0115] Data switching module, used to set the camera direction D in the shader C , scene parallel light direction D L Convert from world coordinate system to tangent coordinate system;
[0116] The color calculation module performs UV reconstruction on the indoor model based on the facade model using the ray-plane algorithm in the tangent coordinate system, calculates the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system, and converts the position Po into the spherical coordinate system to obtain the spherical coordinate P s , using the spherical coordinates P s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n ;
[0117] Lighting judgment module, used to determine the position of the light source P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I;
[0118] A color mixing module is used to adjust the indoor color C based on the unilluminated indoor color C. n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , the indoor model color and the facade model color are mixed using the window map transparency to obtain the final pseudo indoor color C.
[0119] The present invention uses a ray-stepping algorithm to establish a virtual indoor structure, reconstruct the indoor structure UV, convert the UV layout data to a spherical coordinate system, sample the equidistant cylindrical projection map to obtain the unilluminated indoor color, and then use reverse ray-stepping to detect the visibility of the light source to render the illuminated indoor effect (with shadow effect).
[0120] In addition, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the pseudo-indoor rendering method supporting lighting described in any one of the above technical solutions.
[0121] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the pseudo-indoor rendering method supporting lighting as described in any one of the above technical solutions are implemented.
[0122] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0123] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0124] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0127] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0128] Based on such understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0129] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
[0130] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A pseudo-indoor rendering method supporting illumination, characterized in that: The method comprises: importing an exterior facade model, an indoor equidistant cylindrical projection map and an exterior facade window map; The facade model includes UV layout data; In the shader, set the camera direction D C , scene parallel light direction D L Convert from world coordinate system to tangent coordinate system; In the tangent coordinate system, the indoor model is reconstructed using the ray-plane algorithm based on the facade model, the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system is calculated, and the position Po is converted to the spherical coordinate system to obtain the position Ps, and the indoor equidistant cylindrical projection image is sampled using the position Ps to obtain the unilluminated indoor color C n ; Based on the light source position P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I; Based on the unilluminated indoor color C n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , using the transparency of the window map to mix the indoor model color with the facade model color to obtain the final pseudo indoor color C; In the tangent coordinate system, UV reconstruction is performed on the indoor model based on the facade model using a ray-plane algorithm, the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system is calculated, and the position Po is converted into the spherical coordinate system to obtain the position Ps, which specifically includes: In the tangent coordinate system based on the UV layout data in the facade model and the camera direction D C The ray-plane algorithm is used to calculate the distance L from the facade to a certain plane in the indoor model, where the distance along the camera direction D C The intersection point Ro of the emitted ray and the facade, Ro coordinates are (UV.x, UV.y, 0), and the intersection point of the ray and a certain plane is position Po; P o =R o +D c *L; Move the center point of the tangent coordinate system to the center of the spherical coordinate system, and offset all intersection positions Po by (-0.5, -0.5, -0.5) units; Use dot multiplication to calculate the angle θ between the normalized Po.x and the surface normal N. The angle θ is the angle between the position Po and the position P in the spherical coordinate system. s The x-coordinate value of θ=dot(normalize(Po.x,0,0),N) Use dot product to calculate the angle β between the normalized Po.yz and the secondary tangent BiT. The angle β is the angle between the position Po and the position P in the spherical coordinate system. s The y coordinate value of β=dot(normalize(0,Po.yz),BiT) Using coordinates P s The x and y values of the position Po are the position P in the spherical coordinate system. s , P s =(θ,β).
2. The pseudo-indoor rendering method supporting illumination according to claim 1, characterized in that: The facade model also includes a surface normal N and a surface tangent T; The indoor equirectangular projection image is a 2D texture with a length-width ratio of 2:1 that is obtained by unfolding the 3D panoramic image in a spherical form; The facade window map has a transparent channel value for indicating the light transmittance of the window.
3. The pseudo-indoor rendering method supporting illumination according to claim 2, characterized in that: In the shader, the camera direction D C , scene parallel light direction D L The conversion from the world coordinate system to the tangent coordinate system specifically includes: The secondary tangent BiT is calculated by using the surface normal N and the surface tangent T in the facade model through the cross product; BiT=cross(N,T) Constructing a tangent coordinate system conversion matrix TBN using the surface normal N, the surface tangent T and the bitangent BiT; In the shader, set the camera direction D C , scene parallel light direction D L Use matrix multiplication to transform to the tangent coordinate system.
4. The pseudo-indoor rendering method supporting illumination according to claim 1, characterized in that: The use of the spherical coordinates P s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n include: The mipmap of the indoor equirectangular projection image is sampled using random integers to obtain different indoor colors C without illumination. n .
5. The pseudo-indoor rendering method supporting illumination according to claim 3, characterized in that: Based on the light source position P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I, including: Calculate the position Po in the tangent coordinate system to the light source position P L direction Ds, and calculate whether the position Po is on the light-facing surface E L ; Among them, if E L Less than 0, indicating that the position Po is on the light-facing side; if E L If it is greater than or equal to 0, it means that the position Po is on the backlit side and the position Po cannot receive light; D s =normalize(P L -P o ) E L =dot(D s ,D l ) For the position Po on the light-facing side, the position Po intersects with the facade along the direction Ds. F , calculate P F The position and position Po and position P F The distance between F ; P F =P o +D s *L F Using P F .xy samples the facade window map to obtain the transparent channel A, where the illumination intensity coefficient I is equal to the transparent channel A; Among them, if the A value is 0, it means it is completely transparent and can accept light; If the A value is 1, it means it is opaque and is within the shadow range; If the A value is between 0 and 1, it means semi-transparent, and the light intensity it receives is reduced.
6. The pseudo-indoor rendering method supporting illumination according to claim 5, characterized in that: The illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination. L , using the transparency of the window map to mix the indoor model color with the facade model color, the final pseudo indoor color C is obtained, including: Perform illumination calculation on the pixels within the illumination range to obtain the color C after illumination L ; C L =C n *(I+1) Use the UV layout data in the facade model to sample the facade window map to obtain color C F , using C F The transparent channel A is mixed with the interior model color C L Get the final result; C=C F *A+C L *(1-A)。 7. A pseudo-indoor rendering device supporting illumination, used to implement the rendering method according to any one of claims 1 to 6, characterized in that: The device comprises: Data import module, used to import facade models, interior equirectangular projections and facade window maps; Data switching module, used to set the camera direction D in the shader C , scene parallel light direction D L Convert from world coordinate system to tangent coordinate system; The color calculation module is used to perform UV reconstruction on the indoor model based on the facade model using the ray-plane algorithm in the tangent coordinate system, calculate the position Po of the virtual indoor model corresponding to the current pixel in the tangent coordinate system, and convert the position Po to the spherical coordinate system to obtain the position Ps, and use the spherical coordinate P s Sample the indoor equidistant cylindrical projection image to obtain the unilluminated indoor color C n ; Lighting judgment module, used to determine the position of the light source P L , sampling the facade window map at the position Po, determining whether the position Po is within the illumination range, and obtaining the illumination intensity coefficient I; A color mixing module is used to adjust the indoor color C based on the unilluminated indoor color C. n With the illumination intensity coefficient I, the illumination calculation is performed on the pixels within the illumination range to obtain the color C after illumination L , the indoor model color and the facade model color are mixed using the window map transparency to obtain the final pseudo indoor color C.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the pseudo-indoor rendering method supporting lighting described in any one of claims 1 to 6 are implemented.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the pseudo indoor rendering method supporting lighting are implemented as described in any one of claims 1 to 6.
