A method, apparatus, device, and storage medium for model baking
By generating and configuring target patches, the virtual scene model is baked, which solves the light and shadow problems of complex scenes of light sources and narrow areas, simplifies user operations and improves the baking efficiency of the model.
Patent Information
- Application Number
- CN202111630029.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-12-28
AI Technical Summary
When solving the problem of excessive brightness in virtual scene models, the prior art is difficult to apply to complex light sources and narrow areas, and the user operations are complex and difficult to reuse.
By generating the target patch, the dot is configured as the first patch display mode according to the display information and material configuration requirements of the target rendering area, and bake the first model according to the material information of the patch to obtain the target model with normal light and shadow effects.
On the premise of reducing the influence of light and shadow effects by distance factors, the problem of complex scenes and narrow areas of light sources is solved, and the user's light and shadow effects control operation of the virtual scene model is simplified.
Smart Images

Figure CN114299229B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of model processing. Specifically, it relates to a method, device, equipment and storage medium for model baking. Background Art
[0002] During the process of making virtual scene models, due to various possible influencing factors, there are often problems of over-bright or over-dark light levels in some areas after baking. Among them, the problem of over-bright light level is much more difficult to solve than the problem of over-dark light level.
[0003] Currently, when solving the above problem of over-bright light level, a shading cube / creating a hand-drawn light map can be used to add a shadow effect to the over-bright area to improve the light and shadow display effect after baking in the over-bright area. However, since the creation steps of the shading cube are greatly affected by the position and number of light sources in the virtual scene model, and the manual drawing operation is difficult to ensure the naturalness and accuracy of the drawn light, therefore, the above two solutions: on the one hand, are not suitable for iteration and are difficult to reuse; on the other hand, the cube shading is prone to intersect with the normal model in narrow areas, causing more serious artifacts, making the existing solutions not applicable to the case where the light source is complex or the abnormal area is a narrow area. Summary of the Invention
[0004] In view of this, the purpose of the present application is to provide a method, device, equipment and storage medium for model baking, which can solve the problem that the existing solutions are not applicable to complex light source scenarios / narrow abnormal areas while reducing the influence of distance factors on the light and shadow effect, and can also simplify the user's control operation of the light and shadow effects in each area of the virtual scene model.
[0005] In a first aspect, an embodiment of the present application provides a method for model baking, the method comprising:
[0006] Generating a target patch according to the display information of the target rendering area and the target material configuration requirement; wherein, the target rendering area represents an area where the light and shadow effect of the first model appears abnormal; the target material configuration requirement is determined according to the abnormal light and shadow effect on the target rendering area;
[0007] When the target patch is configured in the first patch display mode, baking the first model with the target patch superimposed according to the material information of the target patch to obtain a target model with a normal light and shadow effect display; wherein, the first patch display mode is a model display mode used to represent generating a projection but not participating in rendering.
[0008] In an alternative embodiment, the target patch is located within the target virtual scene where the first model is located; wherein, the target virtual scene is used to represent an area where the distance from the first model is within a preset radius distance range; wherein, the light and shadow effects corresponding to any point within the target virtual scene are the same as those of the first model.
[0009] In an alternative embodiment, generating the target patch according to the display information of the target rendering area and the target material configuration requirements includes:
[0010] Generating a first patch that matches the display information according to the display information of the target rendering area;
[0011] Configuring the material information of the first patch according to the target material configuration requirements to obtain a target patch that matches the target material configuration requirements.
[0012] In an alternative embodiment, the abnormal light and shadow effects of the first model include: the abnormal physical light and shadow effects of the first model, and / or, the abnormal visual light and shadow effects of the first model; wherein, the abnormal physical light and shadow effects are used to represent that the light and shadow effects of the first model in the target virtual scene do not conform to the preset lighting rules; the abnormal visual light and shadow effects are used to represent that the light and shadow effects of the first model in the target virtual scene do not conform to the preset visual display effects.
[0013] In an alternative embodiment, the abnormal light and shadow effects of the first model further include: the abnormal lighting effect of the first model, or, the abnormal shadow effect of the first model; wherein, the abnormal lighting effect is used to represent that the display brightness of the first model in the target virtual scene is lower than the display brightness of the first model under normal light and shadow effects; the abnormal shadow effect is used to represent that the display brightness of the first model in the target virtual scene is higher than the display brightness of the first model under normal light and shadow effects.
[0014] In an alternative embodiment, generating a first patch that matches the display information according to the display information of the target rendering area includes:
[0015] Determining, from the target virtual scene, an area that matches the display position of the target rendering area as the patch generation area according to the display position of the target rendering area;
[0016] Generating a patch that matches the display shape and display size within the patch generation area according to the display shape and display size of the target rendering area to obtain the first patch.
[0017] In an alternative embodiment, configuring the material information of the first patch according to the target material configuration requirements includes:
[0018] When the light and shadow effect of the target rendering area belongs to the abnormal physical light and shadow effect, configure the density distribution information of the surface texture of the first patch according to the first material configuration requirements associated with the abnormal physical light and shadow effect; wherein, the first material configuration requirements are determined according to the preset lighting rules corresponding to the target rendering area in the target virtual scene.
[0019] In an alternative embodiment, configuring the material information of the first patch according to the target material configuration requirements further includes:
[0020] When the light and shadow effect of the target rendering area belongs to the abnormal visual light and shadow effect, configure the density distribution information of the surface texture of the first patch according to the second material configuration requirements associated with the abnormal visual light and shadow effect; wherein, the second material configuration requirements are determined according to the difference in display brightness between the light and shadow effect of the target rendering area and the visual display effect.
[0021] In an alternative embodiment, configuring the material information of the first patch according to the target material configuration requirements further includes:
[0022] When the light and shadow effect of the target rendering area belongs to the target abnormal type, perform a first configuration on the density distribution information of the surface texture of the first patch according to the preset lighting rules corresponding to the target rendering area in the target virtual scene; wherein, the target abnormal type is used to represent the abnormal physical light and shadow effect and the abnormal visual light and shadow effect;
[0023] Obtain the first light and shadow effect corresponding to the target rendering area with the second patch superimposed thereon in the target virtual scene; wherein, the second patch represents the first patch after the first configuration;
[0024] When the first light and shadow effect does not match the visual display effect, perform a second configuration on the density distribution information of the surface texture of the second patch according to the difference in display brightness between the first light and shadow effect and the visual display effect to obtain the target patch.
[0025] In an alternative embodiment, configuring the material information of the first patch according to the target material configuration requirements includes:
[0026] When the light and shadow effect of the target rendering area belongs to the abnormal shadow effect, obtain the solid color map and store the solid color map in the solid color channel of the first patch;
[0027] Obtain a noise grayscale image and store the noise grayscale image in the transparency channel of the first patch, thereby completing the configuration of the texture material of the first patch.
[0028] In an alternative embodiment, during the process of baking the first model with the target patch superimposed thereon according to the material information of the target patch, the method further includes:
[0029] When the lighting effect of the target rendering area belongs to the abnormal shadow effect, obtain a first control parameter for controlling the transparency display effect of the target patch from the material information of the target patch;
[0030] Adjust the lighting effect of the first model with the target patch superimposed thereon in the target virtual scene by controlling the change of the first control parameter.
[0031] In an alternative embodiment, during the process of baking the first model with the target patch superimposed thereon according to the material information of the target patch, the method further includes:
[0032] When the lighting effect of the target rendering area belongs to the abnormal lighting effect, obtain a second control parameter for controlling the material emission intensity of the target patch from the material information of the target patch;
[0033] Adjust the lighting effect of the first model with the target patch superimposed thereon in the target virtual scene by controlling the change of the second control parameter.
[0034] In a second aspect, an embodiment of the present application further provides a model baking device, where the device includes:
[0035] A configuration module, configured to generate a target patch according to the display information of the target rendering area and the target material configuration requirement; wherein, the target rendering area represents an area where the lighting effect of the first model is abnormal; the target material configuration requirement is determined according to the abnormal lighting effect on the target rendering area;
[0036] A baking module, configured to bake the first model with the target patch superimposed thereon according to the material information of the target patch to obtain a target model with a normal lighting effect display in the case of configuring the target patch as the first patch display mode; wherein, the first patch display mode is used to represent a model display mode that generates a projection but does not participate in rendering.
[0037] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the method for model baking described above are implemented.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the steps of the method for model baking described above are executed.
[0039] The technical solutions provided by the embodiments of the present application may include the following beneficial effects:
[0040] A method, device, equipment, and storage medium for model baking provided by an embodiment of the present application generate a target patch according to the display information of a target rendering area and the target material configuration requirements. When the target patch is configured in the first patch display mode, the first model with the target patch superimposed is baked according to the material information of the target patch to obtain a target model with normal light and shadow effects displayed. In this way, on the premise of reducing the influence of the distance factor on the light and shadow effects, the present application can not only solve the problems that the existing solutions are not applicable to complex light source scenarios / abnormal areas belonging to narrow areas, but also simplify the control operation of the user for the light and shadow effects in each area of the virtual scene model.
[0041] To make the above objects, features, and advantages of the present application more obvious and understandable, the following specific preferred embodiments are given and described in detail in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] To more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without creative efforts.
[0043] Figure 1 Shows a schematic flowchart of a method for model baking provided by an embodiment of the present application;
[0044] Figure 2 Shows a schematic flowchart of a method for generating a target patch provided by an embodiment of the present application;
[0045] Figure 3 Shows a schematic structural diagram of a target rendering area provided by an embodiment of the present application;
[0046] Figure 4The figure shows a schematic flowchart of a method for generating a first patch provided by an embodiment of the present application;
[0047] Figure 5 The figure shows a schematic flowchart of a method for configuring the material information of a first patch in the case of abnormal physical light and shadow effects provided by an embodiment of the present application;
[0048] Figure 6 The figure shows a schematic flowchart of a method for configuring the material information of a first patch in the case of abnormal visual light and shadow effects provided by an embodiment of the present application;
[0049] Figure 7 The figure shows a schematic flowchart of a method for configuring the material information of a first patch in the case where the light and shadow effects belong to a target abnormal type provided by an embodiment of the present application;
[0050] Figure 8 The figure shows a schematic flowchart of a method for configuring the material information of a first patch in the case of abnormal shadow effects provided by an embodiment of the present application;
[0051] Figure 9 The figure shows a schematic flowchart of a method for configuring the material information of a first patch in the case of abnormal lighting effects provided by an embodiment of the present application;
[0052] Figure 10 The figure shows a schematic flowchart of a method for baking a first model with the target patch superimposed thereon in the case of abnormal shadow effects provided by an embodiment of the present application;
[0053] Figure 11a The figure shows a schematic diagram of the display result of a first model before superimposing a target patch in the case of abnormal shadow effects provided by an embodiment of the present application;
[0054] Figure 11b The figure shows a schematic diagram of the baking result of a first model after superimposing a target patch in the case of abnormal shadow effects provided by an embodiment of the present application;
[0055] Figure 12a The figure shows a schematic diagram of the display result of a target glass model before superimposing a target patch in a virtual scene provided by an embodiment of the present application;
[0056] Figure 12b The figure shows a schematic diagram of the baking result of a target glass model after superimposing a target patch in a virtual scene provided by an embodiment of the present application;
[0057] Figure 13 The figure shows a schematic flowchart of a method for baking a first model with the target patch superimposed thereon in the case of abnormal lighting effects provided by an embodiment of the present application;
[0058] Figure 14 It shows a schematic structural diagram of an apparatus for model baking provided by an embodiment of the present application;
[0059] Figure 15 It is a schematic structural diagram of a computer device 1500 provided by an embodiment of the present application. Detailed implementation manners
[0060] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It should be understood that the accompanying drawings in the present application are only for the purposes of illustration and description, and are not used to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in the present application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical context relationships may be reversed in order or implemented simultaneously. In addition, those skilled in the art may add one or more other operations to the flowchart or remove one or more operations from the flowchart under the guidance of the content of the present application.
[0061] In addition, the described embodiments are only some embodiments of the present application, rather than all embodiments. The components of the embodiments of the present application usually described and illustrated in the accompanying drawings here may be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application claimed, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts fall within the protection scope of the present application.
[0062] It should be noted that the term "including" will be used in the embodiments of the present application to indicate the existence of the features stated thereafter, but does not exclude adding other features.
[0063] It should be noted that the "virtual scene" and the "virtual scene model" used in the embodiments of the present application belong to the same concept, and both are used to represent scene models created in 3D (Three Dimensions) software, and the two can be used interchangeably.
[0064] In the process of making a virtual scene model, due to various possible influencing factors, problems such as over-bright or over-dark brightness often occur in some areas after baking. Among them, the difficulty of solving the problem of over-bright brightness is much greater than that of solving the problem of over-dark brightness.
[0065] Specifically, when solving the problem of excessive brightness, the following two solutions are usually used:
[0066] Existing solution 1. Create a block to block the overly bright area and participate in baking to block the incoming light;
[0067] Existing solution 2: Paint directly on the light map. Manually apply shadows to the areas on the light map that are too bright.
[0068] At present, the problem with the above-mentioned existing solution 1 is that the shading block mainly affects the shadow display effect of the over-bright area based on the distance factor. On the one hand, due to the uncertain number and position of light sources in the virtual scene model, the distance factor fluctuates greatly and is uncontrolled, making the relevant control operations very complicated and prone to errors. In addition, due to the excessive influence of the distance factor, it is not suitable for iteration and is difficult to reuse. On the other hand, the block shading is easy to intersperse with the normal model in a narrow area, causing more serious artifacts. That is, the existing solution 1 is not suitable for the situation where the over-bright area is a narrow area.
[0069] However, the problems with the above existing solution 2 are: it is difficult to ensure the naturalness and correctness of the lighting by hand-painting, and the operation is also very difficult. It will become invalid after each baking, and it is completely unsuitable for iteration and cannot be reused.
[0070] From the above specific description of the existing solutions, it can be seen that the two existing solutions, on the one hand, are not suitable for iteration and are difficult to reuse because the light and shadow effects are too greatly affected by the distance factor / the manual drawing operation is too difficult; on the other hand, the block shading is easy to intersperse with the normal model in a narrow area, causing more serious artifacts, making the existing solutions unsuitable for scenes with complex light sources / the abnormal area is a narrow area.
[0071] Based on this, the embodiment of the present application provides a method, device, equipment and storage medium for model baking, which generates a target patch according to the display information of the target rendering area and the target material configuration requirements; when the target patch is configured as the first patch display mode, the first model superimposed with the target patch is baked according to the material information of the target patch to obtain a target model with normal light and shadow effects. In this way, the present application can solve the problem that the existing solution is not suitable for scenes with complex light sources / abnormal areas belong to narrow areas, while reducing the influence of distance factors on light and shadow effects, and can also simplify the user's control operation of light and shadow effects in various areas of the virtual scene model.
[0072] The following is a detailed introduction to a model baking method, device, equipment and storage medium provided in an embodiment of the present application.
[0073] First of all, it should be noted that some nouns or terms that appear in the process of describing the embodiments of this application in detail are applicable to the following explanations:
[0074] Unity3D: It is a development platform for real-time 3D interactive content creation and operation.
[0075] Texture: In Unity3D, pictures are wrapped on the surface of 3D models in a certain mathematical way, forming the surface texture and color changes of 3D models visually; such pictures used to simulate the surface information of real objects are called textures.
[0076] Alpha channel: It is the transparency channel in the texture, which can store the transparency texture representing the transparency display effect of the model; among them, when the Alpha channel is in the cutoff mode, the display effect of the model has only two switchable types: transparent / opaque (equivalent to the transparency having no gray value, only two optional types: black / white).
[0077] Diffuse color channel: It is the RGB (the English initials of red, green, and blue, representing the three primary colors of light) color channel in the texture (i.e., the R channel, G channel, and B channel), which can store the image representing the surface color information of the model; among them, the images stored in the diffuse color channel and the Alpha channel together constitute the diffuse texture of the model material.
[0078] Baking: It is a method of rendering the lighting information in a virtual scene into a texture, and then pasting the baked texture back into the virtual scene.
[0079] shadow only mode: A model display mode. Among them, when the object model is configured in the shadow only mode, the object model will only generate corresponding projections in the virtual scene and will not participate in the model rendering process; among them, when the patch is configured in the shadow only mode, after baking, the same display effect as "hiding the patch" can be achieved without hiding the patch, which is convenient for iterative use.
[0080] Secondly, for the "complex light source scene" where the existing solutions are not applicable, it should be noted that in the embodiments of this application, the "complex light source scene" is used to refer to a virtual scene model that satisfies at least one of the following conditions:
[0081] (1). Condition 1: The number of light sources included in the virtual scene exceeds the preset rated threshold;
[0082] (2). Condition 2: The target rendering area where the light and shadow effects are abnormal in the virtual scene belongs to a non-planar area (such as an uneven curved surface area, etc.) where the calculation of light reflection information is difficult.
[0083] Regarding the situation where the existing solutions are not applicable to the case where "the abnormal area belongs to a narrow area", it should be noted that in the embodiments of the present application, "the abnormal area belongs to a narrow area" is used to refer to that the target rendering area with abnormal lighting effects satisfies at least one of the following conditions:
[0084] (1), Condition 1: The width of the target rendering area is less than or equal to the set narrow width threshold;
[0085] (2), Condition 2: The length of the target rendering area is less than or equal to the set narrow length threshold;
[0086] (3), Condition 3: The height of the target rendering area is less than or equal to the set narrow height threshold.
[0087] Refer to Figure 1 as shown Figure 1 which shows a schematic flowchart of a method for model baking provided by the embodiments of the present application. The method includes steps S101 - S102; specifically:
[0088] S101, generate a target patch according to the display information of the target rendering area and the target material configuration requirements.
[0089] Here, the target rendering area is the area where the lighting effect of the first model is abnormal. The display information of the target rendering area at least includes: the display position, display shape, and display size of the target rendering area; among them, the target patch is located in the target virtual scene where the first model is located.
[0090] It should be noted that the first model is used to represent the virtual object with abnormal lighting effects in the virtual scene model, while the target virtual scene is used to represent the area within the preset radius distance from the first model, that is, the target virtual scene does not represent the entire virtual scene model where the first model is located.
[0091] Here, the virtual scene model can be a virtual game scene model in the game field or a virtual building scene model in the interior decoration field. The specific scene type to which the virtual scene model belongs is not limited in the embodiments of the present application.
[0092] Specifically, any point in the target virtual scene has the same lighting effect as the first model, that is, the target virtual scene is used to refer to a three-dimensional scene area that forms a 360° all-round surrounding of the first model according to the preset radius distance, where the specific value of the radius distance depends on the lighting effect corresponding to the first model.
[0093] In the embodiments of the present application, as Figure 2 shown Figure 2The flowchart shows a method for generating a target patch provided by an embodiment of the present application. The method includes steps S201 - S202; specifically:
[0094] S201, generate a first patch that matches the display information according to the display information of the target rendering area.
[0095] Specifically, the first patch can be a thin sheet that matches the display information of the target rendering area and whose thickness can be ignored. That is, the generated first patch is equivalent to "covering" (i.e., being close but not intersecting) the surface of the target rendering area.
[0096] Based on this, compared with the existing solution 1, since the generated first patch is located within the target virtual scene (equivalent to having the same lighting effect as the target rendering area corresponding to the first model), and the thickness of the first patch can be ignored (equivalent to the extra interference caused by the light refraction of the thickness of the first patch to the lighting effect of the target rendering area being negligible), therefore, in the embodiment of the present application, when performing any processing operation on the generated first patch, there is no need to consider too much the number and position of light sources in the entire virtual scene model (equivalent to the complete virtual scene model to which the first model belongs) (i.e., no numerical calculation of specific distances) is involved, which is beneficial to reducing the influence of distance factors on the lighting effect of the target rendering area and is applicable to virtual scene models with complex light source situations (such as including multiple light sources at different positions and of different types).
[0097] S202, configure the material information of the first patch according to the target material configuration requirements to obtain a target patch that matches the target material configuration requirements.
[0098] Here, the target material configuration requirements are determined according to the abnormal lighting effect that appears on the target rendering area.
[0099] In the embodiment of the present application, the first model is a model with an abnormal lighting effect. The first model can be various objects in the virtual scene model. For example, rocks, walls, objects placed on the table, etc.; among them, when defining the concept of abnormal lighting effect from different angles, the abnormal lighting effect that appears on the first model can be at least divided into the following 5 different types. Specifically:
[0100] When defining the concept of abnormal lighting effect from the perspective of the user's display requirements for the lighting effect, the abnormal lighting effect that appears on the first model (equivalent to the abnormal lighting effect that appears on the target rendering area) can be at least divided into the following 3 different types:
[0101] (1) Type 1: The physical light and shadow effect of the first model is abnormal, where the abnormal physical light and shadow effect is used to represent that the light and shadow effect of the first model in the target virtual scene does not conform to the preset lighting rules.
[0102] Here, the preset lighting rules can be formulated according to the physical lighting laws under normal circumstances, where the above physical lighting laws are determined based on the relative orientation information between the first model and each light source in the virtual scene model.
[0103] It should be noted that the above relative orientation information is used to represent the relative direction information and relative distance relationship between the first model and each light source in the virtual scene model, and does not involve the specific numerical calculation of the relative distance.
[0104] Exemplarily, taking the virtual scene model as a game scene model as an example, Figure 3 shows a schematic structural diagram of a target rendering area provided by an embodiment of the present application. As Figure 3 shown, in addition to natural light, the game scene model also includes multiple light sources 301 at different positions. Among them, for the pillar model 300 on the left side of the floor-to-ceiling window in the game scene model, since all the light sources 301 in the game scene model are located in front of the pillar model 300 (i.e., on the side away from the floor-to-ceiling window), and the 2 light sources 301 closest to the pillar model 300 are located above the pillar model 300. Therefore, according to the relative orientation information between the pillar model 300 and each light source 301 in the game scene, the physical lighting law corresponding to the pillar model 300 in the game scene can be determined as: the upper area of the pillar model 300 is brighter than the lower area, and the front area of the pillar model is brighter than the side area and the back area; at this time, if it is detected that the side area 302 on the pillar model 300 is brighter than the front area of the pillar model 300 (i.e., the brightness of the side area 302 on the pillar model 300 is too high), it can be determined that the pillar model 300 is the first model with abnormal physical light and shadow effects in the game scene, where the side area 302 on the pillar model 300 is the target rendering area with abnormal physical light and shadow effects, and a first patch 100 consistent with the display information of the side area 302 on the pillar model 300 is generated according to the display information of the side area 302 on the pillar model 300.
[0105] (2) Type 2: The visual light and shadow effect of the first model is abnormal, where the abnormal visual light and shadow effect is used to represent that the light and shadow effect of the first model in the target virtual scene does not conform to the preset visual display effect.
[0106] It should be noted that the visual display effect is used to represent a visual light and shadow display effect that meets the user's aesthetic expectations. The visual display effect can be a light and shadow effect that conforms to the above physical lighting laws, or a light and shadow effect that does not conform to the above physical lighting laws. The embodiments of the present application do not make any limitations in this regard.
[0107] (3) Type 3: Both the above physical light and shadow effects and the above visual light and shadow effects of the first model are abnormal.
[0108] When defining the concept of abnormal light and shadow effects from the perspective that the target rendering area with abnormal light and shadow effects on the first model belongs to the situation of over-bright or over-dark brightness, the abnormal light and shadow effects on the first model can be at least divided into the following 2 different types:
[0109] (4) Type 4: The lighting effect of the first model is abnormal, where the abnormal lighting effect is used to characterize that the display brightness of the first model in the target virtual scene is lower than the display brightness of the first model under normal light and shadow effects.
[0110] Here, the abnormal lighting effect corresponds to the situation of over-dark brightness on the target rendering area (equivalent to the current lighting effect not reaching the lighting brightness under the original normal light and shadow effects).
[0111] (5) Type 5: The shadow effect of the first model is abnormal, where the abnormal shadow effect is used to characterize that the display brightness of the first model in the target virtual scene is higher than the display brightness of the first model under normal light and shadow effects.
[0112] Here, the abnormal shadow effect corresponds to the situation of over-bright brightness on the target rendering area (equivalent to the current shadow effect not reaching the shadow intensity under the original normal light and shadow effects).
[0113] Regarding the above 5 different abnormal types, it should be noted that there is an overlap between Type 4 and Type 5 and Type 1 - 3 in the specific implementation process. For example, the "normal light and shadow effects" in Type 4 and Type 5 can be used to characterize both the "light and shadow effects that conform to the preset lighting rules (i.e., physical lighting laws)" in Type 1, the "light and shadow effects that conform to the pre-set visual display effects" in Type 2, and the "light and shadow effects that simultaneously conform to the preset lighting rules and visual display effects" in Type 3.
[0114] Based on this, in the embodiments of the present application, the abnormal light and shadow effects that appear on the target rendering area at least correspond to one of the above types 1-3 and one of the above types 4-5. Since the target material configuration requirements depend on the abnormal light and shadow effects that appear on the target rendering area, in the specific implementation process of step S202, it is necessary to determine the first type of parameters that need to be configured in the target material configuration requirements according to the specific type corresponding to the abnormal light and shadow effects that appear on the target rendering area among the above types 1-3; it is also necessary to determine the second type of parameters that need to be configured in the target material configuration requirements according to the specific type corresponding to the abnormal light and shadow effects that appear on the target rendering area among the above types 4-5; so that the target patch obtained after configuration can assist the light and shadow effects of the target rendering area to return to normal from the above two angles.
[0115] S102. In the case of configuring the target patch into the first patch display mode, bake the first model with the target patch superimposed according to the material information of the target patch to obtain a target model with normal light and shadow effects displayed; wherein, the first patch display mode is used to represent a model display mode that generates projections but does not participate in rendering.
[0116] Here, the first patch display mode is used to represent a model display mode that generates projections but does not participate in rendering; the material information of the target patch at least includes the material information of the target surface texture, wherein the target surface texture is used to represent the surface texture of the target patch.
[0117] Specifically, taking Unity3D as the implementation environment of steps S101-S102 as an example, the first patch display mode can be the shadow only mode in Unity3D. In the case of configuring the target patch into the shadow only mode, when baking the first model with the target patch superimposed according to the material information of the target surface texture, the target patch only generates corresponding projections / generates corresponding lighting on the target rendering area, and will not have any impact on the rendering of the target rendering area. At this time, the material information of the target surface texture can be saved so that when encountering the same abnormal light and shadow effect problem later, it can be iteratively used, and the baking process of step S103 can be directly executed without repeating the generation and configuration process of the target patch in the previous steps S101 / S201-S202, nor separately configuring the hidden option of the target patch. Thus, the reuse rate of the target surface texture is improved, which is beneficial to improving the baking efficiency of the model and the reuse rate of the model material resources.
[0118] Next, the specific implementation processes of the above steps in the embodiments of the present application will be described in detail respectively:
[0119] Regarding the specific implementation process of step S201 under the above-mentioned step S101, as Figure 4 shown, Figure 4 FIG. shows a schematic flow chart of a method for generating a first patch provided by an embodiment of the present application. Among them, the method includes steps S401-S402; specifically:
[0120] S401, according to the display position of the target rendering area, in the target virtual scene, determine an area that matches the display position of the target rendering area as the patch generation area.
[0121] Here, according to the analysis content in step S101, the target virtual scene is used to refer to a three-dimensional scene area that surrounds the first model in a 360° all-round manner according to a preset radius distance with the first model as the center. Among them, the specific value of the radius distance depends on the lighting effect corresponding to the first model.
[0122] In particular, when the virtual scene model includes multiple light sources of different types and / or different positions, the above radius distance can usually be selected from multiple positive numbers approaching 0. That is, multiple candidate display areas determined from the target virtual scene are equivalent to multiple parallel display areas that are infinitely close to the target rendering area.
[0123] At this time, one of the multiple parallel display areas parallel to the target rendering area can be arbitrarily selected as the above patch generation area.
[0124] Exemplarily, taking Figure 3 the shown pillar model 300 as the first model, and the side area 302 on the pillar model 300 as the target rendering area where the lighting effect on the first model is abnormal as an example. If the target virtual scene is a three-dimensional scene area that surrounds the pillar model 300 in a 360° all-round manner with a display radius of 5 cm in the game scene with the pillar model 300 as the center; then according to the display position of the side area 302, multiple display areas parallel to the side area 302 are determined from the target virtual scene as candidate display areas. Among them, the distance between each candidate display area and the side area 302 is within the distance interval of (0, 5 cm], and the lighting effects of each candidate display area and the side area 302 in the game scene affected by light sources at different positions in the scene are the same. That is, the lighting effects corresponding to each candidate display area and the side area 202 in the game scene are the same.
[0125] S402, in the patch generation area, according to the display shape and display size of the target rendering area, generate a patch that matches the display shape and display size to obtain the first patch.
[0126] Exemplary illustration, still taking Figure 3 The pillar model 300 shown as the first model, and the side area 302 on the pillar model 300 as the target rendering area where the light and shadow effect appears abnormally as an example. If, from multiple candidate display areas, any one candidate display area is determined to be: candidate display area A that is 2 centimeters away from the side area 202; then candidate display area A can be used as the patch generation area.
[0127] Exemplary illustration, still taking the above example as an example. After determining candidate display area A as the patch generation area, within candidate display area A, according to the display shape (such as Figure 3 the rectangle shown) and display size (refer to Figure 3 shown) of the side area 302, a first patch 100 that conforms to the display shape and display size is generated. Among them, the first patch 100 is 2 centimeters away from the side area 302, and the light and shadow effects corresponding to the first patch 100 and the side area 302 in the game scene are the same (equivalent to being affected by the light sources at different positions in the scene in the same way).
[0128] Regarding the specific implementation process of step S202 under the above step S101, in the specific implementation process of step S202, it is necessary to first determine the first type of parameters that need to be configured in the target material configuration requirements according to the specific type corresponding to the abnormal light and shadow effect on the target rendering area among the above types 1-3. Specifically:
[0129] Such as Figure 5 shown, Figure 5 shows a schematic flowchart of a method for configuring the material information of the first patch in the case of abnormal physical light and shadow effects provided by an embodiment of the present application. Among them, when executing step S202, the method includes step S501; specifically:
[0130] S501, when the light and shadow effect of the target rendering area belongs to the abnormal physical light and shadow effect, configure the surface texture density distribution information of the first patch according to the first material configuration requirements associated with the abnormal physical light and shadow effect.
[0131] Here, the first material configuration requirements are determined according to the preset lighting rules corresponding to the target rendering area in the target virtual scene, that is, the first material configuration requirements are determined according to the physical lighting rules corresponding to the target rendering area in the target virtual scene.
[0132] Here, the surface texture density distribution information is used to characterize the surface texture distribution of the first surface map, where the first surface map is used to characterize the surface map of the first patch.
[0133] Exemplary illustration. Taking the example of type 1 in step S202, when the lateral region 302 on the strut model 300 is the target rendering area with abnormal physical light and shadow effects, as Figure 3 shown, according to the relative orientation information between the lateral region 302 and each light source 301 in the game scene, the preset lighting rule (i.e., the physical lighting law) corresponding to the lateral region 302 in the game scene can be determined as follows: the upper half region of the lateral region 302 is brighter than the lower half region, and the front half region of the lateral region 302 is brighter than the rear half region (i.e., the brightness of the area closer to the light source is greater than that of the area farther from the light source); at this time, according to the preset lighting rule corresponding to the lateral region 302 in the game scene, the first material configuration requirement can be determined as: "The distribution density of the surface texture of the first surface map in the upper half region is lower than that in the lower half region, and the distribution density in the front half region is lower than that in the rear half region" (i.e., the surface texture distribution is sparser in the area closer to the light source).
[0134] In this way, for the lateral region 302 with abnormal physical light and shadow effects (equivalent to the upper half region of the lateral region 302 being darker than the lower half region, and the front half region of the lateral region 302 being darker than the rear half region), after superimposing the target patch that conforms to the first material configuration requirement on the lateral region 302, it can assist the light and shadow effect of the lateral region 302 to return to normal (i.e., assist the light and shadow effect of the lateral region 302 to conform to the preset lighting rule corresponding to the lateral region 302 in the game scene).
[0135] As Figure 6 shown, Figure 6 shows a schematic flowchart of a method for configuring the material information of the first patch in the case of abnormal visual light and shadow effects provided by an embodiment of the present application. Among them, when executing step S202, the method includes step S601; specifically:
[0136] S601, when the light and shadow effect of the target rendering area belongs to the abnormal visual light and shadow effect, configure the surface texture density distribution information of the first patch according to the second material configuration requirement associated with the abnormal visual light and shadow effect.
[0137] Here, the second material configuration requirement is determined according to the difference in display brightness between the light and shadow effect of the target rendering area and the visual display effect.
[0138] Here, the same as step S501 above, the surface texture density distribution information can also be used to characterize the surface texture distribution of the first surface map.
[0139] Exemplary illustration. Still taking Figure 3Taking the side area 302 shown as the target rendering area as an example, if the user pre-sets the visual display effect of the side area 302: the visual distribution of the display brightness on the side area 302 is: upper area> front area> lower area> back area; and the actual distribution of the display brightness corresponding to the light and shadow effect of the side area 302 is: upper area> back area> front area> lower area; it can be determined that the difference in display brightness between the light and shadow effect and the visual display effect of the side area 302 is: the display brightness of the back area is too high (that is, higher than the display brightness of the front area). At this time, based on the above difference, the second material configuration requirement can be determined as: "Increase the distribution density of the surface texture of the first surface map in the back area".
[0140] In this way, for the side area 302 with abnormal visual light and shadow effects, after superimposing the target surface patch that meets the second material configuration requirements on the side area 302, the light and shadow effects of the side area 302 can be restored to normal (that is, the light and shadow effects of the side area 302 are restored to the visual display effects pre-set by the user for the side area 302).
[0141] like Figure 7 As shown, Figure 7 A flow chart of a method for configuring material information of a first facet when the light and shadow effect belongs to a target abnormal type provided by an embodiment of the present application is shown, wherein when executing step S202, the method includes steps S701-S703; specifically:
[0142] S701, when the light and shadow effect of the target rendering area belongs to a target abnormal type, according to a preset lighting rule corresponding to the target rendering area in the target virtual scene, the surface texture density distribution information of the first face piece is configured for the first time.
[0143] Here, the target anomaly type is used to characterize the physical light and shadow effect anomaly and the visual light and shadow effect anomaly.
[0144] Specifically, the implementation of step S701 is the same as step S501, and the repeated parts are not repeated here.
[0145] S702: Obtain a first light and shadow effect corresponding to a target rendering area superimposed with a second surface patch in the target virtual scene.
[0146] Here, the second patch represents the first patch after the first configuration; the first light and shadow effect is equivalent to the light and shadow effect of the target rendering area after the physical light and shadow effect returns to normal, that is, the first light and shadow effect conforms to the preset lighting rule corresponding to the target rendering area in the target virtual scene.
[0147] S703. When the first light and shadow effect does not match the visual display effect, according to the difference in display brightness between the first light and shadow effect and the visual display effect, the density distribution information of the surface texture of the second patch is reconfigured to obtain the target patch.
[0148] Here, similar to the above step S501, the density distribution information of the surface texture can be used to characterize the surface texture distribution of the second surface map, where the second surface map is used to characterize the surface map of the second patch.
[0149] Specifically, the implementation manner of step S703 is the same as that of step S601, and the repeated parts will not be elaborated here.
[0150] Regarding the specific implementation process of the above step S202, in the specific implementation process of step S202, in addition to the above steps, it is also necessary to determine the second type of parameters that need to be configured in the target material configuration requirements according to the specific type corresponding to the abnormal light and shadow effect on the target rendering area in the above types 4-5. Specifically:
[0151] As Figure 8 shown, Figure 8 FIG. shows a flowchart of a method for configuring the material information of the first patch in the case of abnormal shadow effect provided by an embodiment of the present application. When performing step S202, the method includes steps S801-S802; specifically:
[0152] S801. When the light and shadow effect of the target rendering area belongs to the abnormal shadow effect, obtain the base color map and store the base color map in the base color channel of the first patch.
[0153] Here, since the light and shadow effect of the target rendering area belongs to the abnormal shadow effect, that is, the purpose after superimposing the target patch on the target rendering area is to reduce the display brightness of the target rendering area in the target virtual scene; therefore, the texture material of the first patch (equivalent to the material of the first surface map) needs to be configured as a common type of material without a light-emitting function.
[0154] Here, it should be noted that the first patch is essentially equivalent to a model in the shape of a patch, and the material of the model can include various different types of maps, such as BaseColor (base color map) map, Normal normal map, Mixed mixed map, etc.; among them, the base color map includes: Alpha channel, R channel, G channel, B channel; the Alpha channel represents the transparency channel and is used to store the image representing the transparency display effect of the model; the R channel, G channel, and B channel are collectively referred to as the base color channels and are used to store the image representing the surface color information of the model.
[0155] Specifically, the above-mentioned solid color map can be obtained from the above-mentioned ordinary type of material. Among them, the ordinary type of material is used to represent a texture material without translucency, without luminescence, and with the transparency channel (i.e., the Alpha channel) in the clipping mode (equivalent to not storing any image in the Alpha channel), such as a material similar to a wall, etc.
[0156] S802. Obtain a noise grayscale map and store the noise grayscale map in the transparency channel of the first patch to complete the configuration of the texture material of the first patch.
[0157] Here, the noise grayscale map at least includes: a noise image with a black-and-white surface texture and uniformly randomly distributed grayscale, such as a noise image of the perlin noise type, etc.; on the basis of the completion of the above-mentioned solid color channel configuration (equivalent to the completion of the configuration of the surface color information of the model), continue to configure the remaining Alpha channel in the solid color map to further optimize the light and shadow effect presented after the target rendering area is superimposed with the target patch, so that the presented light and shadow effect is more natural and soft.
[0158] Specifically, the noise grayscale map can be obtained from a pre-stored material resource library, and the present application embodiment does not limit the acquisition method of the noise grayscale map.
[0159] It should be noted that in addition, other types of noise images can also be stored in the Alpha channel according to the actual usage requirements of the user; in this regard, the present application embodiment does not make any limitation.
[0160] In addition, it should also be noted that steps S801 - S802 can be executed either before steps S501 / S601 / S701 - S703 or simultaneously with steps S501 / S601 / S701 - S703, and the present application embodiment does not make any limitation on the execution order of the steps.
[0161] As Figure 9 shown, Figure 9 shows a schematic flowchart of a method for configuring the material information of the first patch in the case of abnormal lighting effects provided by the embodiments of the present application. Among them, when executing step S202, the method includes steps S901 - S902; specifically:
[0162] S901. When the light and shadow effect of the target rendering area belongs to the abnormal lighting effect, randomly select a luminescent type of material from a pre-stored material resource library as the target material.
[0163] S902. Configure the target material as the texture material of the first patch.
[0164] Here, different from the above steps S801 - S802, since the lighting effect of the target rendering area is an abnormal lighting effect, that is, the purpose of overlaying the target patch on the target rendering area is to increase the display brightness of the target rendering area in the virtual scene. Therefore, the texture material of the first patch needs to be configured as a luminous type of material.
[0165] At this time, it should be noted that steps S901 - S902 can be executed either before steps S501 / S601 / S701 - S703 or simultaneously with steps S501 / S601 / S701 - S703. The embodiments of the present application do not make any limitation on the execution order of the steps.
[0166] Regarding the specific implementation process of the above step S102, it should be noted that since the purpose of baking is to change the lighting information received by the first model in the target virtual scene, therefore, regardless of which abnormal type among the above types 1 - 5 the lighting effect of the first model specifically belongs to, when baking the first model overlaid with the target patch, it will be baked in the following two different ways only according to whether it is necessary to change the lighting effect or the shadow effect of the first model during the baking process. Specifically:
[0167] In the first alternative implementation manner, as Figure 10 shown, Figure 10 FIG. shows a schematic flowchart of a method for baking a first model overlaid with the target patch in the case of abnormal shadow effect provided by the embodiments of the present application. Among them, when executing step S102, the method includes steps S1001 - S1002; specifically:
[0168] S1001, when the lighting effect of the target rendering area belongs to the abnormal shadow effect, obtain a first control parameter for controlling the transparency display effect of the target patch from the material information of the target patch.
[0169] In the embodiments of the present application, taking Unity3D as the implementation environment for steps S101 - S102 as an example, during the baking process of baking the first model overlaid with the target patch in the baking plug-in of Unity3D, the transparency threshold for controlling the transparency display effect of the target patch can be obtained from the material information of the target patch as the above first control parameter.
[0170] Here, the above transparency threshold is used to represent the gray value limit threshold for each pixel of the target surface texture (i.e., the surface texture of the target patch). That is, the above transparency threshold is used to control the appearance frequency and the number of opaque pixels in the target surface texture.
[0171] Specifically, in the cutoff mode (i.e., the cutting mode), usually the above transparency threshold can be configured to 0.5. At this time, taking the pixel point x on the target surface map as an example, if the gray value of the pixel point x (the gray value information is stored in the Alpha channel) is higher than or equal to the above transparency threshold, it is determined to render the pixel point x, and the transparency display effect of the pixel point x is configured to be opaque; if the gray value of the pixel point x is lower than the above transparency threshold, it is determined not to render the pixel point x, and the transparency display effect of the pixel point x is configured to be transparent.
[0172] Based on the above example content, it should be noted that the higher the value of the configured transparency threshold, the more pixel points are filtered out (i.e., do not need to be rendered) in the target surface map, and the more transparent the display effect of the target surface map is. By controlling the change of the value of the transparency threshold (equivalent to the first control parameter), the transparency display effect of the target surface map (i.e., the transparency display effect of the target patch) can be changed.
[0173] S1002, adjust the lighting effect of the first model with the target patch superimposed thereon in the target virtual scene by controlling the change of the first control parameter.
[0174] Specifically, in the embodiment of the present application, the first control parameter is used as a replacement control parameter for the target baking parameter. By controlling the change of the first control parameter, during the baking process of the first model with the target patch superimposed thereon, the lighting effect of the first model in the target virtual scene is adaptively adjusted so that the lighting effect on the adjusted first model returns to normal.
[0175] Here, the target baking parameter is used to control the change of the light input amount during light baking.
[0176] Specifically, in the case where the lighting effect in the target rendering area belongs to abnormal shadow effect, it should be noted that in step S202, after the implementation of steps S801 - S802, the first-step configuration of the texture material of the target patch is completed; after the implementation of steps S501 / S601 / S701 - S703, the second-step configuration of the density distribution of the surface texture on the target patch is completed; that is, the implementation of step S202 is equivalent to having clarified the form of the corresponding shadow effect after the first model is superimposed with the target patch.
[0177] Based on this, when the target patch participates in the baking process in the first patch display mode, when controlling the change of the first control parameter according to steps S1001 - S1002, the form of the shadow effect corresponding to the first model with the target patch superimposed will not change (for example, if the surface texture distribution of area a on the target patch is denser than that of area b, after superimposing the target patch, area A on the target rendering area where area a is superimposed becomes darker, and area B where area b is superimposed becomes brighter; this change will not be affected by the change of the first control parameter), but only changes the display intensity of the shadow effect corresponding to the first model with the target patch superimposed.
[0178] Exemplarily, taking the first control parameter as the above transparency threshold as an example, before the transparency threshold changes, if after superimposing the target patch, area A on the target rendering area becomes darker and area B becomes brighter; then when controlling the transparency threshold to become higher, compared with before the transparency threshold changes, both area A and area B will become brighter (equivalent to the transparency display effect being enhanced), which is equivalent to the change of the first control parameter changing the display intensity of the shadow effect corresponding to the first model with the target patch superimposed.
[0179] Here, the adjusted normal light and shadow effect corresponds to the "display brightness of the first model under the normal light and shadow effect" in type 4 in the above step S202.
[0180] It should be noted that as described in the description content at step S202 above, the "normal light and shadow effect" in type 4 can be used to represent the "light and shadow effect that conforms to the preset lighting rules" in type 1; it can also be used to represent the "light and shadow effect that conforms to the pre - set visual display effect" in type 2; it can also be used to represent the "light and shadow effect that simultaneously conforms to the preset lighting rules and visual display effect" in type 3; the embodiments of the present application do not make any limitations on this.
[0181] Exemplarily, Figure 11a shows a schematic diagram of the display result of the first model before superimposing the target patch in the case of abnormal shadow effect provided by the embodiment of the present application; as Figure 11a shown, the first model 1100 with abnormal light and shadow effect is the pillar model on the left side of the floor - to - ceiling window. Among them, the target rendering area 1101 is the area on the first model 1100 where the shadow effect is abnormal, that is, the display brightness of the target rendering area 1101 in the virtual scene is higher than the display brightness of the target rendering area 1101 under the normal light and shadow effect.
[0182] Correspondingly, Figure 11b shows a schematic diagram of the baking result of the first model after superimposing the target patch in the case of abnormal shadow effect provided by the embodiment of the present application; as Figure 11bAs shown, after baking the first model 1100 with the target patch superimposed according to the method described in steps S1001 - S1002, the display brightness of the target rendering area 1101 in the target virtual scene is significantly lower than Figure 11a the display brightness before superimposing the target patch in Figure 11a , that is, according to the method described in steps S1001 - S1002, after superimposing the target patch, the shadow effect of the target rendering area 1101 has returned to normal.
[0183] Based on this, it should be noted that since the target patch does not participate in the model rendering process in the first patch display mode, that is, it will not interfere with the model rendering process of the first model 1100. Therefore, as Figure 11b shown in the obtained baking result diagram, the specific contour of the target patch will not be visually displayed. At this time, there is no need to hide the target patch after baking, which is beneficial to simplifying the user's control operation of the light and shadow effects in each area of the virtual scene model and facilitating iterative use.
[0184] In the embodiments of the present application, the above-mentioned light and shadow effect adjustment method described in steps S1001 - S1002 can not only help the shadow effect of the target rendering area return to normal, but also, particularly for the target glass model that belongs to semi-transparent glass (that is, it cannot transmit light completely and should produce shadow projection effects under the physical light law) in the virtual scene model, according to the above-mentioned light and shadow effect adjustment method described in steps S1001 - S1002, it can also help the target glass model display the corresponding shadow projection effect in the virtual scene model, solving the problem that the prior art cannot bake the shadow projection of semi-transparent glass in Unity3D.
[0185] Specifically, Figure 12a shows a schematic diagram of the display result before superimposing the target patch on the target glass model provided by the embodiments of the present application in a virtual scene; as Figure 12a shown, the target glass model 1200 is a semi-transparent glass in the virtual scene. Currently, in the baking plug-in of Unity3D, it is impossible to bake the shadow of semi-transparent glass objects. Usually, the baking result is directly without shadows, or even if there are shadows, they are shadows with the same transparency as other objects, resulting in a high degree of distortion of the light and shadow effects of the target glass model 1200 in the virtual scene.
[0186] Correspondingly, Figure 12b shows a schematic diagram of the baking result after superimposing the target patch on the target glass model in the virtual scene model provided by the embodiments of the present application; as Figure 12bAs shown, after baking the target glass model 1200 with the target patch superimposed thereon (or directly using the light-facing surface of the target glass model as the target patch in the embodiments of the present application for processing) according to the method described in steps S1001 - S1002, since the target patch does not cause any interference to the rendering of the target glass model 1200 in the first patch display mode. However, the target patch can generate a projection in the first patch display mode, and the projection generated is Figure 12b the shadow projection 1201 shown by the target glass model 1200 in the virtual scene; therefore, according to the light and shadow effect adjustment method described in the above steps S1001 - S1002, it can help the target glass model 1200 to display the corresponding shadow projection effect in the virtual scene model, and solve the problem that the prior art cannot bake the shadow projection of translucent glass in Unity3D.
[0187] In the second optional implementation manner, as Figure 13 shown, Figure 13 shows a flowchart of a method for baking a first model with the target patch superimposed thereon in the case of abnormal lighting effects provided by the embodiments of the present application. Among them, when performing step S102, the method includes steps S1301 - S1302; specifically:
[0188] S1301, when the light and shadow effect of the target rendering area belongs to the abnormal lighting effect, obtain a second control parameter for controlling the material light emission intensity of the target patch from the material information of the target patch.
[0189] Exemplarily, when the display brightness of the target rendering area A is lower than the display brightness of the target rendering area A under normal light and shadow effects, that is, when the light and shadow effect of the target rendering area A belongs to the abnormal lighting effect; at this time, a light emission intensity value for controlling the material light emission intensity (equivalent to the pixel display brightness) of the target patch can be obtained from the material information of the target patch as the above second control parameter.
[0190] S1302, by controlling the change of the second control parameter, adjust the light and shadow effect of the first model with the target patch superimposed thereon in the target virtual scene.
[0191] Here, similar to the change of the first control parameter in the above step S1002, when the target patch participates in baking in the first patch display mode, when controlling the change of the second control parameter according to step S1301, the form of the light and shadow effect corresponding to the first model with the target patch superimposed thereon will not be changed.
[0192] Exemplary illustration, taking the above example as an example, before the second control parameter changes, the surface texture distribution of area a on the target patch is sparser than that of area b. If the target patch is superimposed, area A on the target rendering area becomes brighter and area B becomes darker; then after the second control parameter increases (i.e., the material emission intensity increases), compared with before the change of the second control parameter, both area A and area B will become brighter. It is equivalent to that the change of the second control parameter changes the display intensity of the lighting effect corresponding to the first model superimposed with the target patch.
[0193] Here, the adjusted normal lighting effect corresponds to the "display brightness of the first model under the normal lighting effect" in type 5 under the above step S202.
[0194] It should be noted that, as described in the description content at step S202 above, the "normal lighting effect" in type 5 can be used to represent the "lighting effect that conforms to the preset lighting rules" in type 1; it can also be used to represent the "lighting effect that conforms to the preset visual display effect" in type 2; it can also be used to represent the "lighting effect that simultaneously conforms to the preset lighting rules and visual display effect" in type 3; the embodiments of the present application do not make any limitations on this.
[0195] Through the model baking method provided by the embodiments of the present application, a target patch is generated according to the display information of the target rendering area and the target material configuration requirements; when the target patch is configured in the first patch display mode, according to the material information of the target patch, the first model superimposed with the target patch is baked to obtain a target model with normal lighting effect display. In this way, on the premise of reducing the influence of the lighting effect by the distance factor, the present application can not only solve the problem that the existing solutions are not applicable to complex light source scenarios / narrow areas of abnormal areas, but also simplify the control operation of the lighting effects of each area in the virtual scene model by the user.
[0196] Based on the same inventive concept, the embodiments of the present application also provide a model baking device corresponding to the model baking method in the above embodiments. Since the principle of solving problems by the model baking device in the embodiments of the present application is similar to that of the model baking method in the above embodiments of the present application, therefore, the implementation of the model baking device can refer to the implementation of the foregoing model baking method, and the repeated parts will not be described again.
[0197] Refer to Figure 14 as shown Figure 14 shows a schematic structural diagram of a model baking device provided by an embodiment of the present application; wherein, the device is used for baking a first model with abnormal lighting effects in a virtual scene; the device includes:
[0198] A configuration module 1401, configured to generate a target patch according to the display information of a target rendering area and the target material configuration requirement; wherein, the target rendering area represents an area where the lighting effect of a first model is abnormal; the target material configuration requirement is determined according to the abnormal lighting effect on the target rendering area.
[0199] A baking module 1402, configured to bake the first model with the target patch superimposed thereon according to the material information of the target patch when the target patch is configured in a first patch display mode, to obtain a target model with a normal lighting effect display; wherein, the first patch display mode is used to represent a model display mode that generates a projection but does not participate in rendering.
[0200] In an optional implementation manner, the target patch is located in a target virtual scene where the first model is located; wherein, the target virtual scene is used to represent an area where the distance from the first model is within a preset radius distance range; wherein, the lighting effect of any point in the target virtual scene is the same as that of the first model.
[0201] In an optional implementation manner, the configuration module 1401 is configured to:
[0202] Generate a first patch that matches the display information according to the display information of the target rendering area;
[0203] Configure the material information of the first patch according to the target material configuration requirement to obtain a target patch that matches the target material configuration requirement.
[0204] In an optional implementation manner, the abnormal lighting effect of the first model includes: the physical lighting effect of the first model is abnormal, and / or, the visual lighting effect of the first model is abnormal; wherein, the abnormal physical lighting effect is used to represent that the lighting effect of the first model in the target virtual scene does not conform to the preset lighting rules; the abnormal visual lighting effect is used to represent that the lighting effect of the first model in the target virtual scene does not conform to the preset visual display effect.
[0205] In an optional implementation manner, the abnormal lighting effect of the first model further includes: the lighting effect of the first model is abnormal, or, the shadow effect of the first model is abnormal; wherein, the abnormal lighting effect is used to represent that the display brightness of the first model in the target virtual scene is lower than the display brightness of the first model under normal lighting effects; the abnormal shadow effect is used to represent that the display brightness of the first model in the target virtual scene is higher than the display brightness of the first model under normal lighting effects.
[0206] In an alternative embodiment, when generating a first patch that matches the display information according to the display information of the target rendering area, the configuration module 1401 is configured to:
[0207] Determine, from the target virtual scene, an area that matches the display position of the target rendering area as a patch generation area according to the display position of the target rendering area;
[0208] Generate a patch that matches the display shape and display size within the patch generation area to obtain the first patch.
[0209] In an alternative embodiment, when configuring the material information of the first patch according to the target material configuration requirement, the configuration module 1401 is configured to:
[0210] When the light and shadow effect of the target rendering area belongs to the abnormal physical light and shadow effect, configure the density distribution information of the surface texture of the first patch according to the first material configuration requirement associated with the abnormal physical light and shadow effect; wherein, the first material configuration requirement is determined according to the preset lighting rule corresponding to the target rendering area in the target virtual scene.
[0211] In an alternative embodiment, when configuring the material information of the first patch according to the target material configuration requirement, the configuration module 1401 is configured to:
[0212] When the light and shadow effect of the target rendering area belongs to the abnormal visual light and shadow effect, configure the density distribution information of the surface texture of the first patch according to the second material configuration requirement associated with the abnormal visual light and shadow effect; wherein, the second material configuration requirement is determined according to the difference in display brightness between the light and shadow effect of the target rendering area and the visual display effect.
[0213] In an alternative embodiment, when configuring the material information of the first patch according to the target material configuration requirement, the configuration module 1401 is configured to:
[0214] When the light and shadow effect of the target rendering area belongs to the target abnormal type, perform a first configuration on the density distribution information of the surface texture of the first patch according to the preset lighting rule corresponding to the target rendering area in the target virtual scene; wherein, the target abnormal type is used to represent the abnormal physical light and shadow effect and the abnormal visual light and shadow effect;
[0215] Obtain the first lighting effect corresponding to the target rendering area with the second patch superimposed thereon in the target virtual scene; wherein, the second patch represents the first patch after the first configuration.
[0216] When the first lighting effect does not match the visual display effect, according to the difference in display brightness between the first lighting effect and the visual display effect, perform a second configuration on the surface texture density distribution information of the second patch to obtain the target patch.
[0217] In an alternative implementation, when configuring the material information of the first patch according to the target material configuration requirements, the configuration module 1401 is used for:
[0218] When the lighting effect of the target rendering area belongs to the abnormal shadow effect, obtain the solid color map and store the solid color map in the solid color channel of the first patch.
[0219] Obtain the noise grayscale map and store the noise grayscale map in the transparency channel of the first patch to complete the configuration of the texture material of the first patch.
[0220] In an alternative implementation, during the baking process of the first model with the target patch superimposed thereon according to the material information of the target patch, the baking module 1402 is used for:
[0221] When the lighting effect of the target rendering area belongs to the abnormal shadow effect, obtain the first control parameter for controlling the transparency display effect of the target patch from the material information of the target patch.
[0222] By controlling the change of the first control parameter, adjust the lighting effect of the first model with the target patch superimposed thereon in the target virtual scene.
[0223] In an alternative implementation, during the baking process of the first model with the target patch superimposed thereon according to the material information of the target patch, the baking module 1402 is used for:
[0224] When the lighting effect of the target rendering area belongs to the abnormal lighting effect, obtain the second control parameter for controlling the material emission intensity of the target patch from the material information of the target patch.
[0225] By controlling the change of the second control parameter, adjust the lighting effect of the first model with the target patch superimposed thereon in the target virtual scene.
[0226] Through the above-described model baking device provided by the embodiments of the present application, according to the display information of the target rendering area and the target material configuration requirements, a target patch is generated; when the target patch is configured in the first patch display mode, according to the material information of the target patch, the first model superimposed with the target patch is baked to obtain a target model with normal light and shadow effect display. In this way, on the premise of reducing the influence of the light and shadow effect by the distance factor, the present application can not only solve the problem that the existing solutions are not applicable to complex light source scenarios / abnormal areas belonging to narrow areas, but also simplify the user's control operation of the light and shadow effects in each area of the virtual scene model.
[0227] As Figure 15 shown, the embodiments of the present application provide a computer device 1500 for executing the steps of any of the model baking methods in the present application. The device includes a memory 1501, a processor 1502, and a computer program stored on the memory 1501 and executable on the processor 1502. Among them, when the above-mentioned processor 1502 executes the above-mentioned computer program, it implements the steps of any of the above-mentioned model baking methods.
[0228] Specifically, the above-mentioned memory 1501 and processor 1502 can be general memories and processors, which are not specifically limited here. When the processor 1502 runs the computer program stored in the memory 1501, it can execute the steps of any of the above-mentioned model baking methods.
[0229] Corresponding to the model baking method in the present application, the embodiments of the present application also provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, it executes the steps of any of the above-mentioned model baking methods.
[0230] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, it can execute the steps of any of the above-mentioned model baking methods.
[0231] In the embodiments provided by the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. The above-described system embodiments are merely illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the systems or units can be in electrical, mechanical or other forms.
[0232] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed across multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0233] In addition, each functional unit in the embodiments provided in this application may be integrated into a processing unit, may exist physically separately for each unit, or two or more units may be integrated into one unit.
[0234] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this 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 enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0235] It should be noted that: Similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. In addition, the terms "first", "second", "third", etc. are only used for descriptive distinction and cannot be understood as indicating or implying relative importance.
[0236] Finally, it should be noted that: The above-described embodiments are only specific implementation manners of this application, used to illustrate the technical solution of this application, rather than limiting it. 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 of ordinary skill in the art should understand that: Any person skilled in the art within the technical scope disclosed in this application can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements for some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions 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 subject to the protection scope of the claims.
Claims
1. A method for model baking, characterized in that, the method includes: generating a target patch according to the display information of a target rendering area and the target material configuration requirement; wherein, the target rendering area represents an area where the light and shadow effect of a first model is abnormal; the target material configuration requirement is determined according to the abnormal light and shadow effect appearing on the target rendering area; when the target patch is configured in a first patch display mode, baking the first model with the target patch superimposed thereon according to the material information of the target patch to obtain a target model with a normal light and shadow effect display; wherein, the first patch display mode is used to represent a model display mode that generates a projection but does not participate in rendering; wherein, the abnormal light and shadow effect of the first model includes at least one of the following: the physical light and shadow effect of the first model is abnormal, and the abnormal physical light and shadow effect is used to represent that the light and shadow effect of the first model in the target virtual scene does not conform to the preset lighting rules, and the target virtual scene is used to represent an area where the distance from the first model is within the preset radius distance range; the visual light and shadow effect of the first model is abnormal, and the abnormal visual light and shadow effect is used to represent that the light and shadow effect of the first model in the target virtual scene does not conform to the preset visual display effect; the lighting effect of the first model is abnormal, and the abnormal lighting effect is used to represent that the display brightness of the first model in the target virtual scene is lower than the display brightness of the first model under normal light and shadow effects; the shadow effect of the first model is abnormal, and the abnormal shadow effect is used to represent that the display brightness of the first model in the target virtual scene is higher than the display brightness of the first model under normal light and shadow effects.
2. The method according to claim 1, characterized in that, the target patch is located within the target virtual scene; wherein, the light and shadow effect corresponding to any point within the target virtual scene is the same as that of the first model.
3. The method according to claim 1, characterized in that, the generating a target patch according to the display information of the target rendering area and the target material configuration requirement includes: generating a first patch that matches the display information according to the display information of the target rendering area; configuring the material information of the first patch according to the target material configuration requirement to obtain a target patch that matches the target material configuration requirement.
4. The method according to claim 3, characterized in that, the generating a first patch that matches the display information according to the display information of the target rendering area includes: determining, from the target virtual scene, an area that matches the display position of the target rendering area as a patch generation area according to the display position of the target rendering area; within the patch generation area, generating a patch that matches the display shape and display size according to the display shape and display size of the target rendering area to obtain the first patch.
5. The method according to claim 1, characterized in that, Configuring the material information of the first patch according to the target material configuration requirements includes: When the light and shadow effect of the target rendering area belongs to the abnormal physical light and shadow effect, configuring the density distribution information of the surface texture of the first patch according to the first material configuration requirements associated with the abnormal physical light and shadow effect; wherein, the first material configuration requirements are determined according to the preset lighting rules corresponding to the target rendering area in the target virtual scene.
6. The method according to claim 1, characterized in that, Configuring the material information of the first patch according to the target material configuration requirements further includes: When the light and shadow effect of the target rendering area belongs to the abnormal visual light and shadow effect, configuring the density distribution information of the surface texture of the first patch according to the second material configuration requirements associated with the abnormal visual light and shadow effect; wherein, the second material configuration requirements are determined according to the difference in display brightness between the light and shadow effect of the target rendering area and the visual display effect.
7. The method according to claim 1, characterized in that, Configuring the material information of the first patch according to the target material configuration requirements further includes: When the light and shadow effect of the target rendering area belongs to the target abnormal type, performing a first configuration on the density distribution information of the surface texture of the first patch according to the preset lighting rules corresponding to the target rendering area in the target virtual scene; wherein, the target abnormal type is used to characterize the abnormal physical light and shadow effect and the abnormal visual light and shadow effect; Obtaining the first light and shadow effect corresponding to the target rendering area with the second patch superimposed thereon in the target virtual scene; wherein, the second patch represents the first patch after the first configuration; When the first light and shadow effect does not match the visual display effect, performing a second configuration on the density distribution information of the surface texture of the second patch according to the difference in display brightness between the first light and shadow effect and the visual display effect to obtain the target patch.
8. The method according to claim 1, characterized in that, Configuring the material information of the first patch according to the target material configuration requirements includes: When the light and shadow effect of the target rendering area belongs to the abnormal shadow effect, obtaining a solid color map and storing the solid color map in the solid color channel of the first patch; Obtaining a noise grayscale map and storing the noise grayscale map in the transparency channel of the first patch to complete the configuration of the texture material of the first patch.
9. The method according to claim 1, characterized in that, In the process of baking the first model with the target patch superimposed thereon according to the material information of the target patch, the method further includes: When the light and shadow effect of the target rendering area belongs to the abnormal shadow effect, obtaining a first control parameter for controlling the transparency display effect of the target patch from the material information of the target patch; Adjust the lighting effect of the first model with the target patch superimposed thereon in the target virtual scene by controlling the change of the first control parameter.
10. The method according to claim 1, wherein, during the baking of the first model with the target patch superimposed thereon according to the material information of the target patch, the method further includes: when the lighting effect of the target rendering area belongs to the abnormal lighting effect, obtain a second control parameter for controlling the material light emission intensity of the target patch from the material information of the target patch; Adjust the lighting effect of the first model with the target patch superimposed thereon in the target virtual scene by controlling the change of the second control parameter.
11. A model baking device, wherein, the device includes: a configuration module, configured to generate a target patch according to the display information of the target rendering area and the target material configuration requirement; wherein, the target rendering area represents an area where the lighting effect of the first model appears abnormal; the target material configuration requirement is determined according to the abnormal lighting effect appearing on the target rendering area; a baking module, configured to bake the first model with the target patch superimposed thereon according to the material information of the target patch to obtain a target model with a normal lighting effect display in the case of configuring the target patch as the first patch display mode; wherein, the first patch display mode is used to represent a model display mode that generates a projection but does not participate in rendering; wherein, the abnormal lighting effect of the first model includes at least one of the following: the physical lighting effect of the first model is abnormal, and the abnormal physical lighting effect is used to represent that the lighting effect of the first model in the target virtual scene does not conform to the preset lighting rules, and the target virtual scene is used to represent an area where the distance from the first model is within the preset radius distance range; the visual lighting effect of the first model is abnormal, and the abnormal visual lighting effect is used to represent that the lighting effect of the first model in the target virtual scene does not conform to the preset visual display effect; the lighting effect of the first model is abnormal, and the abnormal lighting effect is used to represent that the display brightness of the first model in the target virtual scene is lower than the display brightness of the first model under the normal lighting effect; the shadow effect of the first model is abnormal, and the abnormal shadow effect is used to represent that the display brightness of the first model in the target virtual scene is higher than the display brightness of the first model under the normal lighting effect.
12. An electronic device, wherein, includes: a processor, a memory and a bus, the memory stores machine-readable instructions executable by the processor, when the electronic device runs, the processor communicates with the memory through the bus, and when the machine-readable instructions are executed by the processor, the steps of the model baking method according to any one of claims 1 to 10 are executed.
13. A computer-readable storage medium, wherein, A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, it executes the steps of the method for model baking as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Shadow map baking method, device, equipment and computer readable storage medium
CN112734900A
Virtual model rendering method and device, storage medium and electronic equipment
CN113648655A