Three-dimensional scene generation method and device, electronic equipment and storage medium

By performing grayscale processing and information extraction on the normal maps of 2D scene graphs, and combining lighting and weather information to generate 3D scenes, the problem of the lack of realism in traditional 3D scenes is solved, and a more realistic 3D rendering effect is achieved.

CN115804950BActive Publication Date: 2026-04-14NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2022-12-14
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Current 3D scene production lacks realism, and traditional methods cannot achieve rich physical rendering effects for 3D scenes.

Method used

By acquiring the normal map of the 2D scene map, performing grayscale processing, and extracting depth information and normal direction from the channels that meet the preset color conditions, a 3D scene map is generated by combining it with preset lighting information to simulate physical lighting and weather effects.

Benefits of technology

It achieves realistic and lifelike effects in 3D scenes, enhances image details and physical realism, and has rich rendering effects from a 3D perspective.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115804950B_ABST
    Figure CN115804950B_ABST
Patent Text Reader

Abstract

The application provides a three-dimensional scene generation method and device, electronic equipment and storage medium, wherein the method comprises: obtaining a normal map of a two-dimensional scene graph to be processed, performing grayscale processing on the normal map to obtain a normal map satisfying a preset color condition, obtaining depth information and a normal direction of a virtual object in the two-dimensional scene graph to be processed from a first preset color channel of the normal map satisfying the preset color condition, and generating a three-dimensional scene graph according to the two-dimensional scene graph to be processed, the depth information and the normal direction. Through normal style optimization, the two-dimensional graph has the attribute of the three-dimensional scene, presents rich physical reality of the three-dimensional perspective, and makes the picture details more realistic and lifelike.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of game technology, and more specifically, to a method, apparatus, electronic device, and storage medium for generating three-dimensional scenes. Background Technology

[0002] 3D-to-2D games refer to traditional 2.5D fixed-perspective games, where the game scenes are mostly presented in a fixed 2.5D orthogonal perspective.

[0003] In existing technologies, when creating 3D models in 3D scenes, most structures rely on the number of facets to represent them, usually having a high number of facets. Moreover, most do not split UVs, use continuous texture maps for UV tiling mapping, construct the lighting environment in 3D production software, and use an offline renderer to render and output the final image effect.

[0004] However, the 3D scenes created using the above methods are not good enough and lack realism. Summary of the Invention

[0005] In view of this, embodiments of this application provide a method, apparatus, electronic device, and storage medium for generating three-dimensional scenes, in order to solve the problem of poor effect and lack of realism in the production of three-dimensional scenes.

[0006] In a first aspect, embodiments of this application provide a method for generating a three-dimensional scene, including:

[0007] Obtain the normal map of the 2D scene image to be processed;

[0008] The normal map is processed into grayscale to obtain a normal map that meets the preset color conditions;

[0009] The depth information and normal direction of the virtual object in the two-dimensional scene image to be processed are obtained from the first preset color channel of the normal map that meets the preset color conditions.

[0010] A three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the normal direction.

[0011] Secondly, embodiments of this application also provide a three-dimensional scene generation apparatus, including:

[0012] The acquisition module is used to acquire the normal map of the 2D scene image to be processed;

[0013] The processing module is used to perform grayscale processing on the normal map to obtain a normal map that meets preset color conditions;

[0014] The acquisition module is further configured to acquire the depth information and normal direction of the virtual object in the two-dimensional scene image to be processed from the first preset color channel of the normal map that meets the preset color conditions;

[0015] The generation module is used to generate a three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the normal direction.

[0016] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform any of the three-dimensional scene generation methods described in the first aspect.

[0017] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the three-dimensional scene generation method described in any of the first aspects.

[0018] This application provides a method, apparatus, electronic device, and storage medium for generating a 3D scene. The method includes: acquiring a normal map of a 2D scene image to be processed; performing grayscale processing on the normal map to obtain a normal map that meets preset color conditions; acquiring depth information and normal directions of virtual objects in the 2D scene image to be processed from a first preset color channel of the normal map that meets the preset color conditions; and generating a 3D scene image based on the 2D scene image to be processed, the depth information, and the normal directions. Through normal stylization optimization, the 2D image acquires the attributes of a 3D scene, presenting rich physical realism from a 3D perspective, and making the details of the image more realistic and lifelike.

[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a schematic diagram of the traditional 3D to 2D rendering process.

[0022] Figure 2 This is a schematic diagram of a standard next-generation process;

[0023] Figure 3 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 1 ;

[0024] Figure 4 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 2 ;

[0025] Figure 5 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 3 ;

[0026] Figure 6 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 4 ;

[0027] Figure 7 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 5 ;

[0028] Figure 8 A schematic diagram illustrating the process of creating a normal map provided in an embodiment of this application;

[0029] Figure 9 This is a schematic diagram of the structure of the three-dimensional scene generation device provided in the embodiments of this application;

[0030] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0032] 3D-to-2D games refer to traditional 2.5D fixed-perspective games. Because most games in this category present their scenes in a fixed 2.5D orthogonal perspective, the creation of scene effects requires a combination of 3D and hand-drawn techniques. It has the feel of using 3D technology to create 2D scenes, hence the industry term "3D-to-2D games" rather than games with the currently popular cartoon-rendered art style.

[0033] In traditional 3D-to-2D games, the final map is a flat 2D image. Therefore, the map assets do not all need to be made using 3D modeling. Some image assets are also used for retouching to enrich the visual effects. In order to pursue specific artistic effects, the creation of 3D assets in traditional 3D-to-2D games does not adopt the next-generation workflow. When creating 3D models, most structures rely on the model's polygon count, which usually has a high polygon count. Moreover, most of them do not split UVs and use continuous texture maps for UV tiling. Lighting environment is built in 3D production software (such as 3ds Max), and offline renderers such as V-Ray are used to render and output the final image effect.

[0034] It is evident that in the traditional 3D rendering process for 2D games, normal mapping is not used for 3D scene rendering. Since the map in traditional 2D rendering is just a static 2D image, it cannot achieve the realistic details of a 3D scene. The 3D scene generated in this way does not have physically-based rendering (PBR) effects, lacks realism, and the effect of the 3D scene is not good enough. Based on this, this application provides a 3D scene generation method that uses normal mapping to enable the 3D scene to have PBR effects, giving the 2D image that originally lacked normal details the attributes of a 3D scene, presenting rich physical realism from a 3D perspective, and making the details of the picture more realistic.

[0035] Figure 1 This is a diagram illustrating the traditional 3D-to-2D rendering process, such as... Figure 1 As shown, the traditional 3D-to-2D rendering workflow includes the following steps: creating the medium model, creating the high model, processing existing image resources and using them as textures, setting up the rendering environment and applying textures to the model, and rendering output.

[0036] The creation of medium-sized models, high-sized models, processing existing image resources and using them as textures, and setting up the rendering environment can all be done in 3D modeling software such as 3ds Max and ZNrush, while rendering output can be achieved in offline renderers such as V-Ray.

[0037] It's understandable that "creating a medium-precision model" refers to the creation of a medium-precision model. After selecting a basic model in 3D modeling software, the size, proportions, and outline of the basic model are adjusted to generate a medium-precision model. "Creating a high-precision model" refers to the creation of a high-precision model. Surface textures and other features are added to the medium-precision model to generate a high-precision model. "Using existing image resources for certain processing and creating textures" can be understood as processing a 2D image to generate a 2D texture. "Assigning textures to the model" refers to applying the processed 2D textures to the high-precision model through UV mapping. "Setting the rendering environment" refers to setting the ambient lighting intensity, rendering frame size, etc., according to actual needs. "Rendering output" refers to rendering the model according to the set rendering environment to generate a 3D scene image corresponding to the 2D image. Among these, UV mapping can be understood as the mapping relationship between the processed 2D textures and the high-precision model.

[0038] Figure 2 A schematic diagram of a standard next-generation process, such as Figure 2 As shown, the standard next-generation workflow includes the following steps: creating the mid-poly model, creating the high-poly model, retopologicalizing the low-poly model, unwrapping UVs, creating textures, applying textures to the model, building the scene, and finalizing the visual effects.

[0039] Among them, the creation of medium-poly models, high-poly models, topological low-poly models, and UV unwrapping can be achieved in 3D production software such as 3ds Max and ZNrush, while the creation of textures can be achieved in texture painting software such as Substance Painter. Applying textures to models, building scenes, and the final visual effects can be achieved in game engines through real-time rendering.

[0040] Topological low-poly refers to converting a high-precision model into a low-precision model using topological methods when a high-precision model consumes too many rendering resources. UV splitting refers to splitting a low-precision model into a plane to facilitate texture drawing. Texture creation refers to drawing planar textures based on the split plane. Texture assignment to the model refers to setting textures on the low-precision model using model-specific UVs. Model-specific UVs can be understood as the positional correspondence between the texture and the low-precision model. Scene construction refers to generating the final visual effect through rendering.

[0041] The three-dimensional scene generation method provided in this application will be described below with reference to several specific embodiments.

[0042] Figure 3 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 1 In this embodiment, the executing entity can be an electronic device, such as a mobile phone, computer, game console, etc.

[0043] like Figure 1 As shown, the method may include:

[0044] S101. Obtain the normal map of the 2D scene image to be processed.

[0045] The two-dimensional scene to be processed can be a two-dimensional game scene. The two-dimensional scene to be processed can include multiple virtual objects, such as virtual characters, virtual animals, virtual vehicles, etc. The normal map of the two-dimensional scene to be processed is used to indicate the normal features of the virtual objects in the two-dimensional scene to be processed. The normal features can include depth information and normal direction.

[0046] S102. Perform grayscale processing on the normal map to obtain a normal map that meets the preset color conditions.

[0047] Grayscale processing of a normal map can be understood as stylizing the normal map into a grayscale image. The preset color condition can be an image with three colors: black, white, and gray. In other words, grayscale processing of a normal map results in a normal map with three colors: black, white, and gray. In this way, the first preset color channel of the normal map can be used only to store the depth information and normal information of the virtual object, and not to store the color information of the normal map.

[0048] S103. Obtain the depth information and normal direction of the virtual object in the two-dimensional scene map to be processed from the first preset color channel of the normal map that meets the preset color conditions.

[0049] A normal map that meets the preset color conditions has three color channels: R, G, and B. The first preset color channel can be the R and G channels. The first preset color channel stores the depth information and normal direction of the virtual object in the 2D scene to be processed. Since the first preset color channel of the normal map that meets the preset color conditions is only used to store the depth information and normal information of the virtual object, and not to store color information, it can be determined that the information stored in the first preset color channel of the normal map that meets the preset color conditions is the depth information and normal direction of the virtual object in the 2D scene to be processed. Therefore, the depth information and normal direction of the virtual object can be directly obtained from this first preset color channel.

[0050] The depth information of the virtual object is used to indicate the surface unevenness of the virtual object in the two-dimensional scene image to be processed, and the normal direction of the virtual object is the direction of the normal drawn on the surface of the virtual object in the two-dimensional scene image to be processed.

[0051] S104. Generate a 3D scene map based on the 2D scene map to be processed, depth information, and normal direction.

[0052] Depth information reflects the surface roughness of a virtual object, and the normal direction is the direction of the normal drawn on the surface of the virtual object. Therefore, based on the depth information and normal direction of the virtual object in the two-dimensional scene image to be processed, the two-dimensional scene image to be processed can be rendered to generate a three-dimensional scene image corresponding to the two-dimensional scene image to be processed. In other words, based on the two-dimensional scene image to be processed, a three-dimensional scene image is generated by superimposing normal information, so that the two-dimensional scene image that originally lacked three-dimensional details of normals has the attributes of three-dimensional vision.

[0053] It is worth noting that the electronic device is equipped with a rendering engine. The two-dimensional scene image to be processed and the normal map are imported into the rendering engine, and the depth information and normal direction of the virtual object are extracted from the normal map. Then, based on the two-dimensional scene image to be processed, the depth information and the normal direction, a three-dimensional scene image is rendered and generated.

[0054] In the 3D scene generation method of this embodiment, a normal map of the 2D scene image to be processed is obtained. The normal map is then subjected to grayscale processing to obtain a normal map that meets preset color conditions. From the first preset color channel of the normal map that meets the preset color conditions, the depth information and normal direction of the virtual object in the 2D scene image to be processed are obtained. Based on the 2D scene image to be processed, the depth information, and the normal direction, a 3D scene image is generated. Through normal stylization optimization, the 2D image acquires the attributes of a 3D scene, presenting rich physical realism from a 3D perspective, making the details of the image more realistic and lifelike.

[0055] In one possible implementation of step S102 above, generating a three-dimensional scene map based on the two-dimensional scene map to be processed, depth information, and normal direction includes: generating a three-dimensional scene map based on the two-dimensional scene map to be processed, depth information, normal direction, and preset lighting information.

[0056] The preset lighting information can be the lighting information to be superimposed on the 3D scene map in advance. In other words, the generated 3D scene map has lighting information, and the preset lighting information can include: lighting direction and / or lighting intensity.

[0057] Based on the two-dimensional scene graph to be processed, the depth information and normal direction of the virtual objects are taken into consideration. In order to make the virtual objects in the generated three-dimensional scene graph have better PBR effect, the preset lighting information can be further taken into consideration. That is, the depth information, normal direction and preset lighting information of the virtual objects are taken into consideration together to render the two-dimensional scene graph to be processed, so as to generate the three-dimensional scene graph of the two-dimensional scene graph to be processed.

[0058] Thus, since the 3D scene map takes into account the preset lighting information, the display effect of concave and convex positions in the 3D scene map is also different. If the lighting direction and intensity of the light source are fixed, the concave and convex information determines the distance from the light source. The more concave the position, the farther away from the light source, and the lower the display brightness in the 3D scene map. The more convex the position, the closer to the light source, and the higher the brightness in the 3D scene map.

[0059] For example, the surface of a virtual object has an embossed pattern, and the brightness of the raised part of the embossed pattern is higher than that of the recessed part.

[0060] In this embodiment, through normal stylization optimization, the originally static two-dimensional scene map also has the light occlusion of a three-dimensional scene map, thus simulating the PBR effect of a three-dimensional game in all aspects.

[0061] In step S102 above, after generating a three-dimensional scene map based on the two-dimensional scene map to be processed, depth information, and normal direction, the method may further include: performing weather rendering on the three-dimensional scene map based on preset weather information to generate a three-dimensional scene map with corresponding weather effects.

[0062] The preset weather information is the physical weather information to be superimposed on the 3D scene. For example, it may include snowfall information, rainfall information, and dust information. Snowfall information includes, but is not limited to, snowfall speed, snowfall duration, and snowfall amount. Rainfall information includes, but is not limited to, rainfall speed, rainfall duration, and rainfall amount. Dust information includes, but is not limited to, dustfall speed, dustfall duration, and dustfall amount.

[0063] In other words, after the 3D scene map is rendered, since the 3D scene map has normal information, the 3D scene can also be weather rendered according to the preset weather information to generate a 3D scene map with corresponding weather effects, such as snow, rain, and sandstorms. Since the virtual objects in the 3D scene map have concavity and convexity information, snow accumulation or water accumulation effects can be generated in the concave positions, thereby achieving a realistic dynamic physical effect of snow and rain, and giving the 3D scene a PBR effect.

[0064] Figure 4 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 2 ,like Figure 4 As shown, a 3D scene map is generated based on the 2D scene map to be processed, depth information, normal direction, and preset lighting information, including:

[0065] S201. Determine the light intensity received by the virtual object based on the relative positional relationship between the normal direction and the illumination direction.

[0066] The preset lighting information includes: lighting direction and / or lighting intensity. The normal direction is the direction of the normal drawn on the surface of the virtual object in the two-dimensional scene to be processed. There is a relative positional relationship between the normal direction and the lighting direction. For example, the normal direction deviates from the lighting direction by 45 degrees.

[0067] Based on the relative positional relationship between the normal direction and the illumination direction, the relative positional relationship between the virtual object and the light source corresponding to the preset illumination information can be determined. Then, based on the illumination intensity of the light source and the relative positional relationship between the virtual object and the light source, the illumination intensity received by the virtual object can be calculated. The greater the illumination intensity received by the virtual object, the more the light source shines directly on the virtual object.

[0068] In one possible implementation of step S201 above, determining the illumination intensity received by the virtual object based on the relative positional relationship between the normal direction and the illumination direction includes: obtaining the angle between the line connecting the light source and the virtual object corresponding to the illumination direction and the preset horizontal direction based on the relative positional relationship between the normal direction and the illumination direction; and determining the illumination intensity received by the virtual object based on the illumination intensity and the angle.

[0069] Based on the relative positional relationship between the normal direction and the illumination direction, the angle between the line connecting the light source and the virtual object corresponding to the illumination direction and the preset horizontal direction can be obtained. Then, based on the illumination intensity of the light source corresponding to the preset illumination information and the angle, the illumination intensity received by the virtual object can be determined. The larger the angle, the greater the illumination intensity received by the virtual object; the smaller the angle, the smaller the illumination intensity received by the virtual object. In other words, when the angle is a 90-degree vertical angle, the illumination intensity received by the virtual object is greater, that is, the virtual object is brighter.

[0070] S202. Generate a three-dimensional scene map based on the two-dimensional scene map to be processed, depth information, and the illumination intensity received by the virtual object.

[0071] Based on the two-dimensional scene graph to be processed, the depth information and normal direction of the virtual object are taken into consideration. In order to make the virtual object in the generated three-dimensional scene graph have better PBR effect, the illumination intensity received by the virtual object can be further taken into consideration. That is, the depth information, normal direction and illumination intensity received by the virtual object are taken into consideration as a whole, and the two-dimensional scene graph to be processed is rendered to generate the three-dimensional scene graph of the two-dimensional scene graph to be processed.

[0072] Since the 3D scene graph takes into account the light intensity received by the virtual object, the display effect of concave and convex positions in the 3D scene graph is also different. For the same virtual object, the light intensity received is fixed. The more concave the position, the farther away from the light source, and the lower the display brightness in the 3D scene graph, that is, the darker it is. The more convex the position, the closer to the light source, and the higher the display brightness in the 3D scene graph, that is, the brighter it is. This can produce height effect and light occlusion effect in the 3D scene graph.

[0073] In the three-dimensional scene generation method of this embodiment, through normal stylization optimization, the originally static two-dimensional scene map also has the realistic physical effects of light occlusion and height effect difference changes that a three-dimensional scene map possesses, thus comprehensively simulating the PBR effect of three-dimensional games.

[0074] Figure 5 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 3 ,like Figure 5 As shown, the normal map of the 2D scene to be processed is obtained, including:

[0075] S301. Perform 3D modeling based on the 2D scene image to be processed to obtain a 3D scene model of the 2D scene image to be processed.

[0076] Electronic devices can also be equipped with 3D modeling software, such as 3ds Max and ZNrush. This software provides multiple basic 3D models, which are unrendered initial models, such as box and sphere models. The corresponding basic 3D model is selected according to the style of the 2D scene image to be processed. The basic 3D model is then adjusted according to the actual needs to generate a 3D scene model of the 2D scene image to be processed.

[0077] In the process of generating a 3D scene model, the size ratio and outline of the basic model can be adjusted according to actual needs to generate a medium-precision model, and surface patterns can be set on the medium-precision model to generate a high-precision model. The high-precision model is the 3D scene model.

[0078] S302. Perform normal rendering on the 3D scene model to obtain a normal map.

[0079] 3D modeling software provides a normal map rendering tool. Using this tool, normal maps can be rendered on 3D scene models to obtain normal maps of the 3D scene models.

[0080] In another implementation, obtaining the normal map of the two-dimensional scene image to be processed includes: in response to a normal map drawing instruction, drawing the normal map according to preset lighting information and the two-dimensional scene image to be processed.

[0081] Users can input commands to draw normal maps for a 2D scene image. In response to these commands, the system draws normals on the 2D scene image based on preset lighting information, resulting in a normal map. The normal map indicates the normal characteristics of virtual objects in the 2D scene. These normal characteristics include depth information and normal direction. The preset lighting information includes lighting direction and / or lighting intensity. In the resulting normal map, more concave areas are farther from the light source and have lower brightness, while more convex areas are closer to the light source and have higher brightness. The normal map can be drawn in Photoshop.

[0082] Since the normal map is drawn with the preset lighting information in mind, when rendering the 3D scene map, the depth information and normal direction of the virtual object in the 2D scene map to be processed can be determined from the first preset color channel of the drawn normal map. In this way, the 3D scene map can be generated based on the 2D scene map to be processed, the depth information, and the normal direction.

[0083] Figure 6 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 4 ,like Figure 6 As shown, the method may further include:

[0084] S401. Obtain the roughness information of the virtual object in the two-dimensional scene graph to be processed from the second preset color channel of the normal map that meets the preset color conditions.

[0085] The second preset color channel can be the B channel. The second preset color channel stores the roughness information of the virtual object in the two-dimensional scene image to be processed. The roughness information is used to indicate the surface roughness of the virtual object, that is, the roughness of the surface material of the virtual object. Therefore, the roughness information of the virtual object can be obtained from the second preset color channel of the normal map that meets the preset color conditions.

[0086] It is worth noting that the second preset color channel can store the roughness map of the two-dimensional scene image to be processed. The roughness map is used to reflect the roughness information of virtual objects in the two-dimensional scene to be processed.

[0087] In one optional implementation, a three-dimensional scene graph is generated based on the two-dimensional scene graph to be processed, depth information, and normal directions, including:

[0088] S402. Generate a 3D scene map based on the 2D scene map to be processed, depth information, normal direction, and roughness information.

[0089] Based on the two-dimensional scene graph to be processed, the depth information and normal direction of the virtual objects are considered. In order to make the virtual objects in the generated three-dimensional scene graph have better PBR effect, the roughness information of the virtual objects can be further considered as a factor. That is, the depth information, normal direction and roughness information of the virtual objects are combined as factors to be considered, and the two-dimensional scene graph to be processed is rendered to generate the three-dimensional scene graph of the two-dimensional scene graph to be processed.

[0090] Thus, since roughness information is taken into account in the 3D scene graph, the display effect of virtual objects with different roughnesses in the 3D scene graph is also different, that is, the surface of virtual objects in the 3D scene graph has a roughness presentation.

[0091] Of course, the depth information, normal direction, preset lighting information, and roughness information of the virtual object can also be taken into account to render the two-dimensional scene graph to be processed, so as to generate a three-dimensional scene graph of the two-dimensional scene graph to be processed.

[0092] Figure 7 A flowchart illustrating the three-dimensional scene generation method provided in the embodiments of this application. Figure 5 ,like Figure 7 As shown, normal rendering is performed on the 3D scene model to obtain a normal map, including:

[0093] S501. If the resolution of the normal map is less than the preset resolution threshold, the material information of the 3D scene model is adjusted by using the preset material sphere.

[0094] S502. Perform normal rendering on the adjusted 3D scene model to obtain the adjusted normal map.

[0095] During the rendering process of generating normal maps, if the resolution of the generated normal map is less than the preset resolution threshold, the material information of the 3D scene model can be adjusted by using a preset material ball. Then, the normal map of the adjusted 3D scene model is re-rendered to obtain the adjusted normal map. The resolution of the adjusted normal map is not less than the preset resolution threshold.

[0096] The resolution of the normal map can include, for example, display resolution, image resolution, print resolution, and scan resolution. The preset material sphere is used to adjust the model material parameters of the 3D scene model. That is, if the resolution of the generated normal map is low, the material of the 3D scene model is replaced by the preset material sphere, and then normal rendering is performed so that the resolution of the generated normal map is not less than the preset resolution threshold.

[0097] Based on the above embodiments, the three-dimensional scene generation process provided in this application will be described below with reference to a specific embodiment.

[0098] Figure 8 This is a schematic diagram illustrating the process of creating a normal map as provided in the embodiments of this application, such as... Figure 8 As shown, the process nodes include: creating the medium model, creating the high model, rendering the normal map, refining the normal map, stylizing, storing to the RGB channel, and finalizing the normal map.

[0099] Creating medium-poly models, high-poly models, and rendering normal maps can be done in 3D modeling software such as 3ds Max and ZNrush. Refining normal maps can be done in texture painting software such as Substance Painter. Stylization, RGB channels, and final normal maps can be done in Photoshop.

[0100] In the implementation process, a medium-precision 3D scene model of the 2D scene to be processed is first created. A high-precision 3D scene model is then created based on the medium-precision 3D scene model. A normal map is then rendered and generated. The resolution of the normal map is then refined to ensure that the resolution of the adjusted normal map is not less than a preset resolution threshold. After that, the depth information, normal direction, and roughness information of the virtual objects in the 2D scene to be processed are extracted from the normal map. The depth information and normal direction are stored in the RGB channel, and the roughness information is stored in the B channel.

[0101] It is worth noting that for the solution of drawing normal maps, the normal maps can be drawn in Photoshop software, and the above-mentioned refinement of normal maps and stylization processing can be performed.

[0102] Based on the same inventive concept, this application also provides a three-dimensional scene generation device corresponding to the three-dimensional scene generation method. Since the principle of the device in this application is similar to the three-dimensional scene generation method described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0103] Figure 9 This is a schematic diagram of the structure of a three-dimensional scene generation device provided in an embodiment of this application. This device can be integrated into an electronic device. Figure 9 As shown, the device may include:

[0104] The acquisition module 601 is used to acquire the normal map of the two-dimensional scene image to be processed;

[0105] Processing module 602 is used to perform grayscale processing on the normal map to obtain a normal map that meets preset color conditions;

[0106] The acquisition module 601 is further configured to acquire the depth information and normal direction of the virtual object in the two-dimensional scene image to be processed from the first preset color channel of the normal map that meets the preset color conditions;

[0107] The generation module 603 is used to generate a three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the normal direction.

[0108] In an optional implementation, the generation module 603 is specifically used for:

[0109] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the preset lighting information.

[0110] In an optional implementation, the preset illumination information includes: illumination direction and / or illumination intensity, and the generation module 603 is specifically used for:

[0111] The intensity of light received by the virtual object is determined based on the relative positional relationship between the normal direction and the illumination direction.

[0112] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the light intensity received by the virtual object.

[0113] In an optional implementation, the generation module 603 is specifically used for:

[0114] Based on the relative positional relationship between the normal direction and the illumination direction, obtain the angle between the line connecting the light source and the virtual object corresponding to the illumination direction and the preset horizontal direction;

[0115] The light intensity received by the virtual object is determined based on the light intensity and the included angle.

[0116] In an optional implementation, the acquisition module 601 is specifically used for:

[0117] Based on the two-dimensional scene image to be processed, a three-dimensional scene model is obtained.

[0118] Normal rendering is performed on the 3D scene model to obtain the normal map.

[0119] In an optional implementation, the acquisition module 601 is specifically used for:

[0120] In response to the normal map drawing command, the normal map is drawn according to the preset lighting information and the two-dimensional scene map to be processed.

[0121] In an optional implementation, the acquisition module 601 is further configured to:

[0122] The roughness information of the virtual object in the two-dimensional scene image to be processed is obtained from the second preset color channel of the normal map that meets the preset color conditions. The roughness information is used to indicate the surface roughness of the virtual object.

[0123] Module 603 is generated, specifically for:

[0124] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the roughness information.

[0125] In an optional implementation, the acquisition module 601 is specifically used for:

[0126] If the resolution of the normal map is less than a preset resolution threshold, the material information of the 3D scene model is adjusted by a preset material sphere.

[0127] Normal rendering is performed on the adjusted 3D scene model to obtain the adjusted normal map; the resolution of the adjusted normal map is not less than the preset resolution threshold.

[0128] In an optional embodiment, the device further includes:

[0129] The rendering module 604 is used to perform weather rendering on the three-dimensional scene map according to preset weather information, and generate a three-dimensional scene map with corresponding weather effects.

[0130] In the 3D scene generation apparatus of this embodiment, the acquisition module is used to acquire the normal map of the 2D scene image to be processed. The acquisition module is also used to acquire the depth information and normal direction of the virtual object in the 2D scene image to be processed from the first preset color channel of the normal map. The generation module is used to generate a 3D scene image based on the 2D scene image to be processed, the depth information, and the normal direction. Through normal stylization optimization, the 2D image is endowed with the attributes of a 3D scene, presenting rich physical realism from a 3D perspective, making the details of the image more realistic and lifelike.

[0131] Figure 10 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 10 As shown, the device may include a processor 701, a memory 702, and a bus 703. The memory 702 stores machine-readable instructions executable by the processor 701. When the electronic device is running, the processor 701 communicates with the memory 702 via the bus 703. The processor 701 executes the machine-readable instructions to perform the following steps:

[0132] Obtain the normal map of the 2D scene image to be processed;

[0133] The normal map is processed into grayscale to obtain a normal map that meets the preset color conditions;

[0134] The depth information and normal direction of the virtual object in the two-dimensional scene image to be processed are obtained from the first preset color channel of the normal map that meets the preset color conditions.

[0135] A three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the normal direction.

[0136] In an optional implementation, generating a three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the normal direction includes:

[0137] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the preset lighting information.

[0138] In an optional implementation, the preset lighting information includes: lighting direction and / or lighting intensity; generating the three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the preset lighting information includes:

[0139] The intensity of light received by the virtual object is determined based on the relative positional relationship between the normal direction and the illumination direction.

[0140] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the light intensity received by the virtual object.

[0141] In an optional implementation, determining the illumination intensity received by the virtual object based on the relative positional relationship between the normal direction and the illumination direction includes:

[0142] Based on the relative positional relationship between the normal direction and the illumination direction, obtain the angle between the line connecting the light source and the virtual object corresponding to the illumination direction and the preset horizontal direction;

[0143] The light intensity received by the virtual object is determined based on the light intensity and the included angle.

[0144] In an optional implementation, obtaining the normal map of the two-dimensional scene graph to be processed includes:

[0145] Based on the two-dimensional scene image to be processed, a three-dimensional scene model is obtained.

[0146] Normal rendering is performed on the 3D scene model to obtain the normal map.

[0147] In an optional implementation, obtaining the normal map of the two-dimensional scene graph to be processed includes:

[0148] In response to the normal map drawing command, the normal map is drawn according to the preset lighting information and the two-dimensional scene map to be processed.

[0149] In an optional implementation, the method further includes:

[0150] The roughness information of the virtual object in the two-dimensional scene image to be processed is obtained from the second preset color channel of the normal map that meets the preset color conditions. The roughness information is used to indicate the surface roughness of the virtual object.

[0151] The step of generating a 3D scene map based on the 2D scene map to be processed, the depth information, and the normal direction includes:

[0152] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the roughness information.

[0153] In an optional implementation, the step of performing normal rendering on the 3D scene model to obtain the normal map includes:

[0154] If the resolution of the normal map is less than a preset resolution threshold, the material information of the 3D scene model is adjusted by a preset material sphere.

[0155] Normal rendering is performed on the adjusted 3D scene model to obtain the adjusted normal map; the resolution of the adjusted normal map is not less than the preset resolution threshold.

[0156] In an optional implementation, after generating a three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the normal direction, the method further includes:

[0157] The three-dimensional scene map is rendered with weather information based on preset weather information to generate a three-dimensional scene map with corresponding weather effects.

[0158] In the electronic device of this embodiment, when the electronic device is running, the processor acquires the normal map of the two-dimensional scene image to be processed, performs grayscale processing on the normal map to obtain a normal map that meets preset color conditions, and obtains the depth information and normal direction of the virtual object in the two-dimensional scene image to be processed from the first preset color channel of the normal map that meets the preset color conditions. Based on the two-dimensional scene image to be processed, the depth information, and the normal direction, a three-dimensional scene image is generated. Through normal stylization optimization, the two-dimensional image is endowed with the attributes of a three-dimensional scene, presenting a rich physical realism from a three-dimensional perspective, making the details of the image more realistic and lifelike.

[0159] This application embodiment also provides a computer-readable storage medium storing a computer program, which is executed by a processor, wherein the processor performs the following steps:

[0160] Obtain the normal map of the 2D scene image to be processed;

[0161] The normal map is processed into grayscale to obtain a normal map that meets the preset color conditions;

[0162] The depth information and normal direction of the virtual object in the two-dimensional scene image to be processed are obtained from the first preset color channel of the normal map that meets the preset color conditions.

[0163] A three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the normal direction.

[0164] In an optional implementation, generating a three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the normal direction includes:

[0165] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the preset lighting information.

[0166] In an optional implementation, the preset lighting information includes: lighting direction and / or lighting intensity; generating the three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the preset lighting information includes:

[0167] The intensity of light received by the virtual object is determined based on the relative positional relationship between the normal direction and the illumination direction.

[0168] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the light intensity received by the virtual object.

[0169] In an optional implementation, determining the illumination intensity received by the virtual object based on the relative positional relationship between the normal direction and the illumination direction includes:

[0170] Based on the relative positional relationship between the normal direction and the illumination direction, obtain the angle between the line connecting the light source and the virtual object corresponding to the illumination direction and the preset horizontal direction;

[0171] The light intensity received by the virtual object is determined based on the light intensity and the included angle.

[0172] In an optional implementation, obtaining the normal map of the two-dimensional scene graph to be processed includes:

[0173] Based on the two-dimensional scene image to be processed, a three-dimensional scene model is obtained.

[0174] Normal rendering is performed on the 3D scene model to obtain the normal map.

[0175] In an optional implementation, obtaining the normal map of the two-dimensional scene graph to be processed includes:

[0176] In response to the normal map drawing command, the normal map is drawn according to the preset lighting information and the two-dimensional scene map to be processed.

[0177] In an optional implementation, the method further includes:

[0178] The roughness information of the virtual object in the two-dimensional scene image to be processed is obtained from the second preset color channel of the normal map that meets the preset color conditions. The roughness information is used to indicate the surface roughness of the virtual object.

[0179] The step of generating a 3D scene map based on the 2D scene map to be processed, the depth information, and the normal direction includes:

[0180] The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the roughness information.

[0181] In an optional implementation, the step of performing normal rendering on the 3D scene model to obtain the normal map includes:

[0182] If the resolution of the normal map is less than a preset resolution threshold, the material information of the 3D scene model is adjusted by a preset material sphere.

[0183] Normal rendering is performed on the adjusted 3D scene model to obtain the adjusted normal map; the resolution of the adjusted normal map is not less than the preset resolution threshold.

[0184] In an optional implementation, after generating a three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the normal direction, the method further includes:

[0185] The three-dimensional scene map is rendered with weather information based on preset weather information to generate a three-dimensional scene map with corresponding weather effects.

[0186] In the computer-readable storage medium of this embodiment, when the computer program is executed by the processor, it acquires the normal map of the two-dimensional scene image to be processed, performs grayscale processing on the normal map to obtain a normal map that meets preset color conditions, and obtains the depth information and normal direction of the virtual object in the two-dimensional scene image to be processed from the first preset color channel of the normal map that meets the preset color conditions. Based on the two-dimensional scene image to be processed, the depth information, and the normal direction, a three-dimensional scene image is generated. Through normal stylization optimization, the two-dimensional image is endowed with the attributes of a three-dimensional scene, presenting rich physical realism from a three-dimensional perspective, and making the details of the image more realistic and lifelike.

[0187] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.

[0188] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0189] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0190] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0191] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0192] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0193] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A method for generating a three-dimensional scene, characterized in that, include: Obtain the normal map of the 2D scene image to be processed; The normal map is processed into grayscale to obtain a normal map that meets the preset color conditions; The depth information and normal direction of the virtual object in the two-dimensional scene image to be processed are obtained from the first preset color channel of the normal map that meets the preset color conditions. A three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the normal direction; The step of generating a 3D scene map based on the 2D scene map to be processed, the depth information, and the normal direction includes: The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the preset lighting information; The preset lighting information includes: lighting direction and / or lighting intensity; generating the three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the preset lighting information includes: The intensity of light received by the virtual object is determined based on the relative positional relationship between the normal direction and the illumination direction. The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, and the light intensity received by the virtual object; Determining the illumination intensity received by the virtual object based on the relative positional relationship between the normal direction and the illumination direction includes: Based on the relative positional relationship between the normal direction and the illumination direction, the relative positional relationship between the virtual object and the light source corresponding to the preset illumination information is determined, and the illumination intensity received by the virtual object is calculated based on the illumination intensity and the relative positional relationship between the virtual object and the light source.

2. The method according to claim 1, characterized in that, Determining the relative positional relationship between the virtual object and the light source corresponding to the preset lighting information based on the relative positional relationship between the normal direction and the illumination direction includes: Based on the relative positional relationship between the normal direction and the illumination direction, obtain the angle between the line connecting the light source and the virtual object and the preset horizontal direction; The step of calculating the light intensity received by the virtual object based on the light intensity and the relative positional relationship between the virtual object and the light source includes: The light intensity received by the virtual object is determined based on the light intensity and the included angle.

3. The method according to claim 1, characterized in that, The process of obtaining the normal map of the two-dimensional scene image to be processed includes: Based on the two-dimensional scene image to be processed, a three-dimensional scene model is obtained. Normal rendering is performed on the 3D scene model to obtain the normal map.

4. The method according to claim 1, characterized in that, The process of obtaining the normal map of the two-dimensional scene image to be processed includes: In response to the normal map drawing command, the normal map is drawn according to the preset lighting information and the two-dimensional scene map to be processed.

5. The method according to claim 1, characterized in that, The method further includes: The roughness information of the virtual object in the two-dimensional scene image to be processed is obtained from the second preset color channel of the normal map that meets the preset color conditions. The roughness information is used to indicate the surface roughness of the virtual object. The step of generating a 3D scene map based on the 2D scene map to be processed, the depth information, and the normal direction includes: The three-dimensional scene map is generated based on the two-dimensional scene map to be processed, the depth information, the normal direction, and the roughness information.

6. The method according to claim 3, characterized in that, The step of rendering the normal map of the 3D scene model includes: If the resolution of the normal map is less than a preset resolution threshold, the material information of the 3D scene model is adjusted by a preset material sphere. Normal rendering is performed on the adjusted 3D scene model to obtain the adjusted normal map; the resolution of the adjusted normal map is not less than the preset resolution threshold.

7. The method according to claim 1, characterized in that, After generating a 3D scene map based on the 2D scene map to be processed, the depth information, and the normal direction, the method further includes: The three-dimensional scene map is rendered with weather information based on preset weather information to generate a three-dimensional scene map with corresponding weather effects.

8. A three-dimensional scene rendering device, characterized in that, include: The acquisition module is used to acquire the normal map of the 2D scene image to be processed; The processing module is used to perform grayscale processing on the normal map to obtain a normal map that meets preset color conditions; The acquisition module is further configured to acquire the depth information and normal direction of the virtual object in the two-dimensional scene image to be processed from the first preset color channel of the normal map that meets the preset color conditions; The generation module is used to generate a three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the normal direction; The preset lighting information includes: lighting direction and / or lighting intensity; the generation module is specifically used to determine the relative positional relationship between the virtual object and the light source corresponding to the preset lighting information based on the relative positional relationship between the normal direction and the lighting direction, and to calculate the lighting intensity received by the virtual object based on the lighting intensity and the relative positional relationship between the virtual object and the light source; and to generate the three-dimensional scene map based on the two-dimensional scene map to be processed, the depth information, and the lighting intensity received by the virtual object.

9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the three-dimensional scene generation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the three-dimensional scene generation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image rendering method and device

    CN104268922A

  • Model rendering method and device, computer equipment and computer readable storage medium

    CN115345976A