A method and system for automatically constructing large-scale three-dimensional city night scenes
By building multiple texture libraries and night scene styles, creating sequence frame elves maps and splitting and sequence numbering, building night scene models are built using the three-dimensional model instantiation method, which solves the problem of difficult to balance the diversity and rendering efficiency of the three-dimensional urban night scene models in the existing technology, and achieves efficient rendering performance and realistic night scene effects.
Patent Information
- Application Number
- CN202411570595.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-11-06
AI Technical Summary
The existing technology is difficult to achieve a balance between model diversity and rendering efficiency when building large-scale three-dimensional urban night view models, resulting in too single night view effects or degradation of rendering performance.
By building multiple texture libraries and night scene styles, a sequence frame sprite map of each night scene style is established, and it is split and sequence numbered. The building night scene model is constructed using the three-dimensional model instantiation method, and the index relationship between the component model and the sequence frame sprite map is established, and the sub-element range is mapped to the luminous channel of the material ball.
It effectively reduces the number of triangle faces and vertex data of the model, reduces the amount of model data, improves the scene rendering performance, and increases the diversity and reality of the night scene model.
Smart Images

Figure CN119068097B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an automatic construction method and system for large-scale three-dimensional city night scenes. Background Art
[0002] When constructing a large-scale 3D city virtual night scene, the real visualization state of the city at night is mainly simulated through the window view of the 3D building model and the self-luminescence of the window view. Due to the large number of urban buildings and complex types, manually constructing a large-scale urban building night scene model not only wastes human resources and time costs, but also leads to too much model data, which the 3D map engine cannot handle or has reduced performance.
[0003] In order to balance modeling efficiency, effect and performance when constructing a three-dimensional urban building night scene model, a procedural modeling method is often used. The existing technology often uses architectural procedural modeling to construct a white model of a building, and then uses the wall facade texture for UV mapping to create a pseudo-stereoscopic visual effect. The three-dimensional building model constructed by the procedural modeling method is suitable for daytime environments. Since the night environment is affected by lights and building window views, such models cannot simulate night scene effects.
[0004] In order to solve this problem, the existing technology, under the premise of ensuring the balance between visualization effect and performance, in order to meet the needs of programmatically constructing large-scale three-dimensional city night scenes and improve the richness and realism of three-dimensional city night scenes, the current common technical method in the art direction is to use the basic color texture of the building wall facade to manually process the black and white information of the texture, and combine the basic color texture with the black and white texture to control the luminescence of the window scene, where the black and white texture is placed in the luminous channel, the black part represents the non-luminous area, and the white part represents the luminous area. There are two common texture superposition methods:
[0005] Method 1: One basic color texture corresponds to one black and white texture. This method can effectively save the number of material balls, but in the process of building large-scale building models, textures are usually tiled and reused, and the final night scene effect is too monotonous and lacks the randomness of the window view of a real building at night.
[0006] Method 2: One basic color texture corresponds to multiple black and white textures. This method can effectively solve the problem of too single light in the window scene at night, but the number of material balls cannot be controlled. The total number of material balls is equal to the product of the number of basic color textures and the number of black and white textures. The number of material balls has a direct impact on the DrawCall of the 3D rendering pipeline. The more the number, the slower the rendering speed, which affects the scene performance.
[0007] Therefore, how to quickly and automatically build large-scale urban building night scene models, improve the diversity and realism of the model's rendering effects in the night environment, reduce the number of shaders in the night scene, and improve rendering performance is currently a technical difficulty. Summary of the invention
[0008] Therefore, the technical problem to be solved by the present invention is to overcome the problem in the prior art that the diversity of city night scene modeling and the rendering efficiency cannot be balanced.
[0009] In order to solve the above technical problems, the present invention provides a method for automatically constructing a large-scale three-dimensional city night scene, comprising:
[0010] Build multiple texture libraries, create multiple night scene styles for each texture library, build a black and white random texture library corresponding to each night scene style, and establish a sequence frame sprite map for each night scene style;
[0011] Sequentially number each sub-element of the sequence frame sprite image, and store the sub-element information of the sequence frame sprite image;
[0012] Construct the building white mold and component model, cut and mark the surface of the building white mold according to the size of the component model, and instantiate and reference the component model;
[0013] After completing the instantiation reference of the component model, construct an index relationship between the sub-element information of the sequence frame sprite image corresponding to each component model and its night scene style, obtain the target sub-element information corresponding to each component model according to the index relationship, and then obtain the target sub-element range in the sequence frame sprite image, and map it to the luminous channel in the component model material ball.
[0014] Preferably, the step of constructing a plurality of texture libraries, creating a plurality of night scene styles for each texture library, constructing a black and white random texture library corresponding to each night scene style, and establishing a sequence frame sprite map of each night scene style includes:
[0015] Collect building facade textures of the same building type and the same architectural style to build a texture library, build multiple texture libraries according to the architectural styles of each building type, and use image processing software to correct the perspective and offset of the building facade textures in the texture library;
[0016] Selecting a building facade texture containing windows for each texture library, dividing the night scene styles according to the styles of the windows, creating multiple night scene styles for each texture library, and cutting the building facade texture to obtain a night scene style texture map for each night scene style;
[0017] Mark the black and white areas of the night scene style texture map to obtain multiple black and white texture maps, and build a black and white random texture library for each night scene style;
[0018] Combine the black and white texture images in the black and white random texture library to create a sequence frame sprite image of each night scene style, and use a black and white texture image as a sub-element in the sequence frame sprite image.
[0019] Preferably, the night scene style texture map is marked with black and white areas, wherein the wall range is black and the window range is randomly black and white, to obtain multiple black and white texture maps.
[0020] Preferably, the number of sub-picture elements in the sequence frame sprite image does not exceed 16, and the length and width of the sequence frame sprite image are both powers of 2, and the size is maintained within the range of 8192px*8192px.
[0021] Preferably, the step of serially numbering each sub-element of the sequence frame sprite image and storing the sub-element information of the sequence frame sprite image comprises:
[0022] Establish a Cartesian coordinate system, place the sequence frame sprite in the first quadrant, and use the cropping tool to cut the sequence frame sprite horizontally and vertically to obtain several sub-elements;
[0023] Each sub-element of the sequence frame sprite image is serially numbered, and the sub-element information of the sequence frame sprite image is stored.
[0024] Preferably, the sub-element information of the sequence frame sprite image includes: a sequence number, the position coordinates of the first pixel point in the lower left corner of the sub-element, and the length and width values of the sub-element.
[0025] Preferably, the step of constructing the architectural white mold and the component model, cutting and marking the surface pieces of the architectural white mold according to the size of the component model, and instantiating and referencing the component model comprises:
[0026] Building white molds according to the height information of the vector data in the two-dimensional vector data, and grouping the building white molds according to the architectural style of the building type;
[0027] Under each architectural style, a component model is constructed for each night scene style;
[0028] Under each architectural style, the side face pieces of the architectural white mold of the architectural style are cut horizontally according to the width of the component model, and the cut face pieces are marked as wall faces or initial model spaces;
[0029] For each initial model space, the initial model space is cut longitudinally according to the height of the component model corresponding to the initial model space to obtain a plurality of component model spaces;
[0030] Reference the component model according to the component model space to complete the model instantiation reference.
[0031] Preferably, the step of constructing an index relationship between sub-picture element information of a sequence frame sprite image corresponding to each component model and its night scene style, obtaining target sub-picture element information corresponding to each component model according to the index relationship, and then obtaining the target sub-picture element range in the sequence frame sprite image, and mapping to the luminous channel in the component model material ball comprises:
[0032] Calculate the relative world coordinate position of each component model, and obtain a random number for each component model according to the relative world coordinate position;
[0033] Each component model selects a sequence frame sprite corresponding to its night scene style, and obtains the number of sub-element of the sequence frame sprite; updates the value of the random number of the current component model according to the number of sub-element, so that the updated value is within the range of the number of sub-element; and uses the updated random number value as the target sub-element index value;
[0034] Among the multiple sub-element information of the sequence frame sprite image, select the target sub-element information with the same sequence number as the target sub-element index value;
[0035] The target sub-element range in the sequence frame sprite is obtained according to the target sub-element information, and is mapped to the luminous channel in the component model material ball.
[0036] Preferably, the step of obtaining a random number for each component model according to the relative world coordinate position comprises:
[0037] Add the three coordinate values in the relative world coordinate position of the component model and convert their data types to integers.
[0038] The present invention also provides a large-scale three-dimensional city night scene automatic construction system, comprising:
[0039] A sequence frame sprite image building module is used to build multiple texture libraries, create multiple night scene styles for each texture library, build a black and white random texture library corresponding to each night scene style, and build a sequence frame sprite image for each night scene style;
[0040] The sub-picture element information storage module is used to serially number each sub-picture element of the sequence frame sprite image and store the sub-picture element information of the sequence frame sprite image;
[0041] The 3D modeling module is used to construct the building white mold and component models, cut and mark the surface of the building white mold according to the size of the component model, and instantiate and reference the component model;
[0042] The mapping module is used to complete the instantiation reference of the component model, build the index relationship between the sub-element information of each component model and the sequence frame sprite image corresponding to its night scene style, obtain the target sub-element information corresponding to each component model according to the index relationship, and then obtain the target sub-element range in the sequence frame sprite image, and map it to the luminous channel in the component model material ball.
[0043] The above technical solution of the present invention has the following beneficial effects compared with the prior art:
[0044] The present invention discloses an automated construction method for a large-scale three-dimensional urban night scene. First, the sequence frame sprite map required for the night scene is constructed and split, and then each sub-element is sequence numbered and information is stored; then, the building night scene model is programmatically constructed by using a three-dimensional model instantiation method, effectively reducing the number of model triangles and vertex data, reducing the model data volume, and improving the scene rendering performance; finally, an index relationship between the sequence frame sprite map and the component model is established, and the target sub-element range in the sequence frame sprite map is obtained by using the target sub-element information, and mapped to the luminous channel in the component model material ball. The sequence frame sprite map splitting method of the present invention is simple and accurate, and the sub-element size after the splitting is controlled to be consistent. A single component model can be texture mapped with any sub-element, which not only reduces the sub-element size difference brought about in the human-computer interaction process, but also effectively reduces the number of night scene model maps and material balls, reduces the number of DrawCalls of three-dimensional rendering, and improves the scene rendering frame rate, so that the programmatically constructed night scene can take into account both rendering performance and rendering effect.
[0045] Furthermore, the present invention obtains a random number for each component model based on the relative world coordinate position, and limits the range of the random number according to the number of sub-elements in the sequence frame sprite map, and utilizes the position difference of the component model to randomly index and call the sub-elements of the sequence frame sprite map, thereby simulating the effect of random window scenes in the city, improving the randomness of the window scenes and window scene lighting of the building night scene model, and making the programmatically constructed three-dimensional city night scenes more realistic and diverse. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
[0047] Figure 1 It is a flow chart of an automated construction method of a large-scale three-dimensional city night scene according to the present invention;
[0048] Figure 2 This is an example diagram of dividing the building facade texture into night scene styles in an embodiment of the present invention;
[0049] Figure 3is the first night scene style texture image and its corresponding multiple black and white texture images in the embodiment of the present invention, wherein Figure 3 (a) in the figure is the first night scene style texture map. Figure 3 (b), (c), (d), (e), (f), and (g) are six different black and white texture images of the first night scene style texture image;
[0050] Figure 4 This is an example of a horizontal cut of a patch with a width of 5m;
[0051] Figure 5 This is an example diagram of the longitudinal cutting of the first initial model space with a height of 48m;
[0052] Instruction manual marking instructions: 1. Wall; 2. First initial model space; 3. First component model space. DETAILED DESCRIPTION
[0053] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention. Embodiment 1
[0054] Reference Figure 1 As shown, the present invention provides a method for automatically constructing a large-scale three-dimensional city night scene, the steps comprising:
[0055] Step 1: Build multiple texture libraries, create multiple night scene styles for each texture library, build a black and white random texture library corresponding to each night scene style, and establish a sequence frame sprite map for each night scene style. Specifically, it includes the following sub-steps:
[0056] Step 101, collect building facade textures of the same building type and the same architectural style to build a texture library, build multiple texture libraries according to the architectural styles of each building type, and use image processing software to correct the perspective and offset of the building facade textures in the texture library.
[0057] The building types include commercial buildings, hospital buildings, and residential buildings. Taking residential buildings as an example, their architectural styles include Chinese, Western, and modern. A first residential texture library is constructed for Chinese residential buildings, a second texture library is constructed for Western residential buildings, and a third texture library is constructed for modern residential buildings.
[0058] Step 102, select a building facade texture containing windows for each texture library, divide the night scene styles according to the styles of the windows, create multiple night scene styles for each texture library, and crop the building facade texture to obtain a night scene style texture map for each night scene style.
[0059] In three-dimensional city night scene modeling, a window lighting model is usually used to simulate the nighttime lighting state of a building. Therefore, the present invention divides and cuts the night scene style of the building facade texture according to the window style.
[0060] This embodiment takes the third texture library constructed by modern residential buildings as an example and selects one of the building facade textures including three-story windows. The purpose is to reduce the total number of building white mold cutting lines and referenced component model points, lines and surfaces in subsequent steps. At the same time, it can effectively alleviate the situation of excessive visual repetition in the repeated appearance of component models.
[0061] Reference Figure 2 As shown, the building facade texture including three layers of windows is divided into night scene styles to obtain three night scene styles. Among them, the first night scene style includes a row of single-leaf windows. The second night scene style includes a row of single-leaf windows and a row of double-leaf windows. The third night scene style includes a row of single-leaf windows, a row of double-leaf windows and a row of multiple windows.
[0062] The building facade texture is cut according to the night scene style, and the first night scene style texture map, the second night scene style texture map and the third night scene style texture map are obtained accordingly. Each night scene style texture map includes multiple windows.
[0063] Step 103, marking the black and white areas of the night scene style texture map to obtain multiple black and white texture maps, and constructing a black and white random texture library for each night scene style.
[0064] Each night scene style texture map is marked with black and white areas, where the wall range is black and the window range is randomly black and white, and multiple black and white texture maps are obtained to construct a black and white random texture library for each night scene style. Since each night scene style texture map includes multiple windows, each window is randomly set to black or white, multiple black and white texture maps can be obtained from one night scene style texture map. The corresponding constructed black and white random texture library has the characteristics of random diversity, and the black and white texture maps in the same black and white random texture library have the same size.
[0065] Figure 3 is the first night scene style texture image and its corresponding multiple black and white texture images, among which Figure 3 (a) in the figure is the first night scene style texture map. Figure 3 (b), (c), (d), (e), (f), and (g) are six different black and white texture images of the first night scene style texture image.
[0066] There is no limit on the number of black and white textures in the black and white random texture library.
[0067] Step 104, combining the black and white texture images in the black and white random texture library, creating a sequence frame sprite image of each night scene style, and using a black and white texture image as a sub-element in the sequence frame sprite image.
[0068] Using image stitching software, seamlessly stitch the black and white texture images in the same black and white random texture library to obtain a sequence frame sprite image of each night scene style. The number of sequence frame sprite images of each night scene style is not limited.
[0069] The splicing method of the sequence frame sprite can refer to equal row splicing or equal column splicing, and there is no specific limitation. The number of sub-elements in each sequence frame sprite does not exceed 16, and the length and width of the sequence frame sprite are both powers of 2, and the size is kept within the range of 8192px*8192px.
[0070] Step 2, serially number each sub-element of the sequence frame sprite image, and store the sub-element information of the sequence frame sprite image. Specifically, it includes the following sub-steps:
[0071] Step 201 , cutting the sequence frame sprite image according to the number of rows and columns of sub-picture elements to obtain sub-picture elements.
[0072] Establish a Cartesian coordinate system and place the sequence frame sprite in the first quadrant. Use the cropping tool to cut the sequence frame sprite horizontally and vertically to obtain several sub-elements.
[0073] The cutting method depends on the length and width values of the sequence frame sprite and the number of rows and columns of the sub-element to avoid size differences between sub-element.
[0074] Step 202: sequence number each sub-element of the sequence frame sprite image, and store the sub-element information of the sequence frame sprite image.
[0075] The sub-element information of the sequence frame sprite includes: the sequence number, the position of the first pixel in the lower left corner of the sub-element, and the length and width of the sub-element.
[0076] For a sequence frame sprite, the position coordinates of the first pixel point in the lower left corner of each sub-element in the sequence frame sprite are recorded and stored as (Px, Py), where Px and Py are the horizontal and vertical coordinates of the first pixel point in the lower left corner of the sub-element respectively.
[0077] Because the size of each sub-element is the same, the length and width of each sub-element in the sequence frame sprite can be calculated based on the length and width values of the sequence frame sprite and the number of rows and columns of the sub-element, and stored as (Wx, Hy), where Wx and Hy represent the length and width of the sub-element respectively.
[0078] Number each sub-element in the sequence frame sprite sheet sequentially starting from 1 and store it as Index.
[0079] The information of each sub-element of the sequence frame sprite is stored as (Index, Px, Py, Wx, Hy).
[0080] Step 3: construct the building white mold and component model, cut and mark the surface of the building white mold according to the size of the component model, and instantiate the component model. It specifically includes the following sub-steps:
[0081] Step 301, constructing a building white mold according to the height information of the vector data in the two-dimensional vector data, and grouping the building white molds according to the architectural style of the building type.
[0082] The building white mold is constructed based on the building height information in the building two-dimensional vector data to obtain the automated model base, and the building white molds are grouped according to the architectural style of each building type.
[0083] Step 302: Under each architectural style, a component model is constructed corresponding to each night scene style.
[0084] Step 302-1, setting the size of the component model patch according to the night scene style.
[0085] In this embodiment, the modern residential building includes three night scene styles, and the three component models constructed include:
[0086] Construct a first component model for the first night scene style, where the size of the first component model patch is 3m*12m, with a width of 3m and a height of 12m;
[0087] A second component model is constructed for the second night scene style, and the size of the second component model patch is 8m*12m, wherein the width is 8m and the height is 12m;
[0088] A third component model is constructed for the third night scene style, and the size of the third component model patch is 12m*12m, with a width of 12m and a height of 12m.
[0089] Step 302-2, the center point of each component model is centered, and the UV coordinates of each component model are specified, and each UV coordinate is limited to the first quadrant of the Cartesian coordinate system.
[0090] Step 302-3, construct a component model according to the architectural style of the building type, select a texture library corresponding to the architectural style, and give the component model a basic color texture.
[0091] Step 303, in each architectural style, the side face pieces of the architectural white mold of the architectural style are cut horizontally according to the width of the component model, and the cut face pieces are marked as wall surfaces or initial model spaces.
[0092] Calculate the width of each side face of the building formwork.
[0093] According to the width of the component model, the side face pieces of the architectural white model of the architectural style are cut horizontally, and the cut face pieces are marked as walls or initial model spaces, including:
[0094] If the width of the face is less than the first part model width, it is marked as a wall and not cut.
[0095] If the width of the face piece is between the first component model width and the second component model width, it is horizontally cut according to the preset wall width of the adaptive size, the first component model width, and the preset wall width, wherein the space whose adaptive size after cutting is the first component model width is marked as the first initial model space, and the space whose adaptive size after cutting is the preset wall width is marked as the wall. Figure 4 This is an example of the horizontal cutting of a face with a width of 5m. After cutting, the wall surface and the first initial model space are obtained.
[0096] If the width of the face piece is between the second component model width and the third component model width, it is horizontally cut according to the preset wall width, the second component model width, and the preset wall width of the adaptive size, wherein the space whose adaptive size after cutting is the second component model width is marked as the second initial model space, and the space whose adaptive size after cutting is the preset wall width is marked as the wall.
[0097] If the width of the face piece exceeds the third component model width, it is cut horizontally according to the preset wall width of the adaptive size, the third component model width, and the preset wall width. The space whose adaptive size after cutting is the third component model width is marked as the third initial model space, and the space whose adaptive size after cutting is the preset wall width is marked as the wall. If there is still a piece of the face piece left, the width of the remaining part is determined again, and the cutting is repeated.
[0098] In this embodiment, the preset wall width is 1m.
[0099] Step 304 : for each initial model space, the initial model space is longitudinally cut according to the height of the component model corresponding to the initial model space to obtain a plurality of component model spaces.
[0100] According to the height of the adaptively sized component model, the corresponding initial model space is cut to obtain the component model space.
[0101] In this embodiment, the height of the component models is 12 m, so the size of the longitudinal cutting is adaptive to 12 m.
[0102] The first initial model space is longitudinally cut according to the first component model height of the adaptive size to obtain multiple first component model spaces; the second initial model space is longitudinally cut according to the second component model height of the adaptive size to obtain multiple second component model spaces; the third initial model space is longitudinally cut according to the third component model height of the adaptive size to obtain multiple third component model spaces.
[0103] Figure 5 This is an example diagram of the longitudinal cutting of the first initial model space with a height of 48m. After cutting, four first component model spaces are obtained.
[0104] Step 305, reference the component model according to the component model space correspondence to complete the model instantiation reference.
[0105] According to the type of component model space, the length and width values, center point and normal direction of each component model space are calculated; the normal direction controls the front and back sides of the component model, the length and width values control the length, width and height of the component model, and the center point controls the position of the component model.
[0106] According to the type of component model space, the component model is referenced accordingly. In this embodiment, the first component model space references the first component model, the second component model space references the second component model, and the third component model space references the third component model. The normal direction of the component model is consistent with the normal direction of the component model space, the position of the component model is the center point of the component model space, and the size of the component model is adaptive according to the length and width values of the component model space.
[0107] The present invention utilizes a three-dimensional model instantiation method to programmatically construct a building night scene model, effectively reducing the number of model triangles and the amount of vertex data, reducing the model data volume, and improving scene rendering performance.
[0108] Step 4: After completing the instantiation reference of the component model, construct an index relationship between the sub-element information of each component model and the sequence frame sprite image corresponding to its night scene style, obtain the target sub-element information corresponding to each component model according to the index relationship, and then obtain the target sub-element range in the sequence frame sprite image, and map it to the luminous channel in the component model material ball. Specifically, it includes the following sub-steps:
[0109] Step 401, calculate the relative world coordinate position of each component model, and obtain a random number of each component model according to the relative world coordinate position.
[0110] The relative world coordinate position of the component model refers to the center position (x, y, z) of the component model in the three-dimensional software.
[0111] The present invention does not limit the method for obtaining random numbers according to the relative world coordinate position of the component model. A method is provided herein, specifically: adding the three coordinate values in the relative world coordinate position of the component model, and then converting their data types into integers.
[0112] Step 402, each component model selects a sequence frame sprite image corresponding to its night scene style, and obtains the number of sub-pixels of the sequence frame sprite image; updates the value of the random number of the current component model according to the number of sub-pixels, so that the updated value is within the range of the number of sub-pixels; and uses the updated random number value as the target sub-pixel index value.
[0113] Specifically, a restriction function is used to restrict the value of the random number of the component model to an integer within the range of the number of sub-element numbers, thereby obtaining a target sub-element index value.
[0114] Step 403, among the multiple sub-element information of the sequence frame sprite, select the target sub-element information whose serial number is the same as the target sub-element index value; obtain the target sub-element range in the sequence frame sprite according to the target sub-element information, and map it to the luminous channel in the component model material ball.
[0115] The night scene is realized through the black and white information of the luminous channel in the model material ball, where the black part represents no light and the white part represents light.
[0116] Get all sub-element information (Index, Px, Py, Wx, Hy) of the sequence frame sprite, select the sub-element information whose sequence number is the same as the target sub-element index value in the sub-element information, and get the target sub-element information. Get the target sub-element range in the sequence frame sprite according to the target sub-element information, and map it to the luminous channel in the component model material ball.
[0117] Other component models use the same method to index the sub-element information of the sequence frame sprite.
[0118] Step 404, switching the wall texture and roof style of the component model according to the architectural style.
[0119] Since there are some differences in the same architectural styles, such as building color and wall texture, the model's wall facade texture, roof style, etc. can be switched without changing the sequence frame sprite to complete the night window scene production and improve the production efficiency of the city night scene. Embodiment 2
[0120] Based on the method for automatically constructing a large-scale three-dimensional city night scene described in the first embodiment, this embodiment provides a system for automatically constructing a large-scale three-dimensional city night scene, including:
[0121] A sequence frame sprite image establishment module is used to build multiple texture libraries, create multiple night scene styles for each texture library, and build a black and white random texture library corresponding to each night scene style, and establish a sequence frame sprite image for each night scene style;
[0122] The sub-picture element information storage module is used to serially number each sub-picture element of the sequence frame sprite image and store the sub-picture element information of the sequence frame sprite image. The sequence frame sprite image is cut and the sub-picture element information of the sequence frame sprite image is stored.
[0123] The 3D modeling module is used to construct the building white mold and component models, cut and mark the surface of the building white mold according to the size of the component model, and instantiate and reference the component model;
[0124] A mapping module is used to construct an index relationship between the sub-picture element information of the sequence frame sprite image corresponding to each component model and its night scene style after completing the instantiation reference of the component model, obtain the target sub-picture element information corresponding to each component model according to the index relationship, and then obtain the target sub-picture element range in the sequence frame sprite image, and map it to the luminous channel in the component model material ball. After completing the instantiation reference of the component model, an index relationship between each component model and the sequence frame sprite image corresponding to its night scene style is constructed according to the sub-picture element information of the sequence frame sprite image, and the sub-picture element range in the sequence frame sprite image is obtained, and mapped to the luminous channel in the component model material ball.
[0125] The present invention discloses an automated construction method for a large-scale three-dimensional urban night scene. First, the sequence frame sprite map required for the night scene is constructed and split, and then each sub-element is sequence numbered and information is stored; then, the building night scene model is programmatically constructed by using a three-dimensional model instantiation method, effectively reducing the number of model triangles and vertex data, reducing the model data volume, and improving the scene rendering performance; finally, an index relationship between the sequence frame sprite map and the component model is established, and the target sub-element range in the sequence frame sprite map is obtained by using the target sub-element information, and mapped to the luminous channel in the component model material ball. The sequence frame sprite map splitting method of the present invention is simple and accurate, and the sub-element size after the splitting is controlled to be consistent. A single component model can be texture mapped with any sub-element, which can not only reduce the sub-element size difference brought about in the human-computer interaction process, but also effectively reduce the number of night scene model maps and material balls, reduce the number of DrawCalls of three-dimensional rendering, and improve the scene rendering frame rate, so that the programmatically constructed night scene can take into account both rendering performance and rendering effect.
[0126] Furthermore, the present invention obtains a random number for each component model based on the relative world coordinate position, and limits the range of the random number according to the number of sub-elements in the sequence frame sprite map, and utilizes the position difference of the component model to randomly index and call the sub-elements of the sequence frame sprite map, thereby simulating the effect of random window scenes in the city, improving the randomness of the window scenes and window scene lighting of the building night scene model, and making the programmatically constructed three-dimensional city night scenes more realistic and diverse.
[0127] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0128] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0129] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0131] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.
Claims
1. A method for automatically constructing a large-scale three-dimensional city night scene, characterized in that: include: Build multiple texture libraries, create multiple night scene styles for each texture library, build a black and white random texture library corresponding to each night scene style, and establish a sequence frame sprite map for each night scene style; Sequentially number each sub-element of the sequence frame sprite image, and store the sub-element information of the sequence frame sprite image; Construct the building white mold and component model, cut and mark the surface of the building white mold according to the size of the component model, and instantiate and reference the component model; After completing the instantiation reference of the component model, construct the index relationship between the sub-element information of each component model and the sequence frame sprite corresponding to its night scene style, obtain the target sub-element information corresponding to each component model according to the index relationship, and then obtain the target sub-element range in the sequence frame sprite, and map it to the luminous channel in the component model material ball, including: Calculate the relative world coordinate position of each component model, and obtain a random number for each component model according to the relative world coordinate position; Each component model selects a sequence frame sprite corresponding to its night scene style, and obtains the number of sub-element of the sequence frame sprite; updates the value of the random number of the current component model according to the number of sub-element, so that the updated value is within the range of the number of sub-element; and uses the updated random number value as the target sub-element index value; Among the multiple sub-element information of the sequence frame sprite image, select the target sub-element information with the same sequence number as the target sub-element index value; The target sub-element range in the sequence frame sprite is obtained according to the target sub-element information, and is mapped to the luminous channel in the component model material ball.
2. The method for automatically constructing a large-scale three-dimensional city night scene according to claim 1, characterized in that: The method of constructing multiple texture libraries, creating multiple night scene styles for each texture library, constructing a black and white random texture library corresponding to each night scene style, and establishing a sequence frame sprite map of each night scene style includes: Collect building facade textures of the same building type and the same architectural style to build a texture library, build multiple texture libraries according to the architectural styles of each building type, and use image processing software to correct the perspective and offset of the building facade textures in the texture library; Selecting a building facade texture containing windows for each texture library, dividing the night scene styles according to the styles of the windows, creating multiple night scene styles for each texture library, and cutting the building facade texture to obtain a night scene style texture map for each night scene style; Mark the black and white areas of the night scene style texture map to obtain multiple black and white texture maps, and build a black and white random texture library for each night scene style; Combine the black and white texture images in the black and white random texture library to create a sequence frame sprite image of each night scene style, and use a black and white texture image as a sub-element in the sequence frame sprite image.
3. The method for automatically constructing a large-scale three-dimensional city night scene according to claim 2, characterized in that: The night scene style texture map is marked with black and white areas, where the wall range is black and the window range is random black and white, and multiple black and white texture maps are obtained.
4. The method for automatically constructing a large-scale three-dimensional city night scene according to claim 2, characterized in that: The number of sub-picture elements in the sequence frame sprite image does not exceed 16, and the length and width of the sequence frame sprite image are both powers of 2, and the size is maintained within the range of 8192px*8192px.
5. The method for automatically constructing a large-scale three-dimensional city night scene according to claim 1, characterized in that: The step of sequentially numbering each sub-element of the sequence frame sprite image and storing the sub-element information of the sequence frame sprite image includes: Establish a Cartesian coordinate system, place the sequence frame sprite in the first quadrant, and use the cropping tool to cut the sequence frame sprite horizontally and vertically to obtain several sub-elements; Each sub-element of the sequence frame sprite image is serially numbered, and the sub-element information of the sequence frame sprite image is stored.
6. The method for automatically constructing a large-scale three-dimensional city night scene according to claim 5, characterized in that: The sub-element information of the sequence frame sprite image includes: a sequence number, the position coordinates of the first pixel point in the lower left corner of the sub-element, and the length and width values of the sub-element.
7. The method for automatically constructing a large-scale three-dimensional city night scene according to claim 1, characterized in that: The construction of the building white mold and the component model, cutting and marking the surface pieces of the building white mold according to the size of the component model, and instantiating and referencing the component model include: Building white molds according to the height information of the vector data in the two-dimensional vector data, and grouping the building white molds according to the architectural style of the building type; Under each architectural style, a component model is constructed for each night scene style; Under each architectural style, the side face pieces of the architectural white mold of the architectural style are cut horizontally according to the width of the component model, and the cut face pieces are marked as wall faces or initial model spaces; For each initial model space, the initial model space is cut longitudinally according to the height of the component model corresponding to the initial model space to obtain a plurality of component model spaces; Reference the component model according to the component model space to complete the model instantiation reference.
8. The method for automatically constructing a large-scale three-dimensional city night scene according to claim 1, characterized in that: The step of obtaining a random number for each component model according to the relative world coordinate position includes: Add the three coordinate values in the relative world coordinate position of the component model and convert their data types to integers.
9. An automated construction system for large-scale three-dimensional city night scenes, characterized in that: include: A sequence frame sprite image building module is used to build multiple texture libraries, create multiple night scene styles for each texture library, build a black and white random texture library corresponding to each night scene style, and build a sequence frame sprite image for each night scene style; The sub-picture element information storage module is used to serially number each sub-picture element of the sequence frame sprite image and store the sub-picture element information of the sequence frame sprite image; The 3D modeling module is used to construct the building white mold and component models, cut and mark the surface of the building white mold according to the size of the component model, and instantiate and reference the component model; The mapping module is used to complete the instantiation reference of the component model, build the index relationship between the sub-element information of each component model and the sequence frame sprite corresponding to its night scene style, obtain the target sub-element information corresponding to each component model according to the index relationship, and then obtain the target sub-element range in the sequence frame sprite, and map it to the luminous channel in the component model material ball, including: Calculate the relative world coordinate position of each component model, and obtain a random number for each component model according to the relative world coordinate position; Each component model selects a sequence frame sprite corresponding to its night scene style, and obtains the number of sub-element of the sequence frame sprite; updates the value of the random number of the current component model according to the number of sub-element, so that the updated value is within the range of the number of sub-element; and uses the updated random number value as the target sub-element index value; Among the multiple sub-element information of the sequence frame sprite image, select the target sub-element information with the same sequence number as the target sub-element index value; The target sub-element range in the sequence frame sprite is obtained according to the target sub-element information, and is mapped to the luminous channel in the component model material ball.
Citation Information
Patent Citations
Memory, night scene light texture drawing method, system and device
CN111968196A
Three-dimensional building model construction method and device and storage medium
CN117197390A