Ambient light shielding implementation method and device, computer storage medium, and electronic device

By calculating the relative position of the target model with respect to the bounding box range and generating a masking map, the problem of the insulating effect of the model in the game screen cannot be adjusted separately in the prior art, and efficient adjustment of the overall and detailed ambient light occlusion effect of the model is achieved.

CN115430144BActive Publication Date: 2025-04-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211111863.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-13
Publication Date
2025-04-25
Estimated Expiration
2042-09-13

AI Technical Summary

Technical Problem

The prior art cannot adjust the masking effect separately on the models in the game screen, resulting in the failure to meet the masking needs of characters and scenes at the same time.

Method used

By obtaining the bounding box range of the target model and the relative position of the cells, the height variation range of the cells is calculated and inputted into the masking channel to achieve overall ambient occlusion. Additionally, occlusion maps are generated and processed to achieve detailed ambient occlusion.

Benefits of technology

The overall and detailed ambient light shading effect of the target model is adjusted, and the three-dimensional sense and shading effect of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115430144B_ABST
    Figure CN115430144B_ABST
Patent Text Reader

Abstract

The present disclosure is about an ambient light occlusion implementation method and device, a computer storage medium, and an electronic device, and relates to the field of computer technology. The method includes: obtaining a target model and a bounding box range of the target model, determining the relative position of the fragment of the target model relative to the bounding box range; obtaining the height variation range of the fragment based on the relative position of the fragment relative to the bounding box range, inputting the height variation range of the fragment into an occlusion channel, and implementing overall ambient light occlusion of the target model through the occlusion channel; generating an occlusion map of the target model, gray-processing the occlusion map, and obtaining a target occlusion map, and implementing detailed ambient light occlusion of the target model through the target occlusion map. The present disclosure implements the adjustment of the overall ambient light occlusion effect and the detailed ambient light occlusion effect of the target model.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] As players have higher and higher requirements for in-game graphics, game production is no longer satisfied with using only direct lighting to draw in-game scenes. Currently, game engines begin to consider indirect lighting while calculating direct lighting, thereby achieving more realistic effects.

[0003] In the related technology, the game engine mainly realizes the three-dimensional sense of the picture through the post-processing screen space ambient occlusion technology. However, the post-processing screen space ambient occlusion technology is built based on the three-dimensional sense of the entire picture, and it is impossible to individually adjust the occlusion effect of the model in the picture, that is, it is impossible to meet the occlusion requirements of the characters and the scenes at the same time.

[0004] Therefore, it is necessary to provide a new method for implementing ambient light occlusion.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention

[0006] The purpose of the present disclosure is to provide an ambient light occlusion implementation method, an ambient light occlusion implementation device, a computer-readable storage medium and an electronic device, thereby at least to a certain extent overcoming the problem in the related art that the occlusion effect of the picture and the model in the picture cannot be adjusted simultaneously due to the limitations and defects of the related art.

[0007] According to one aspect of the present disclosure, a method for implementing ambient light occlusion is provided, comprising:

[0008] Acquire a target model and a bounding box range of the target model, and determine a relative position of a fragment of the target model with respect to the bounding box range;

[0009] Based on the relative position of the fragment with respect to the bounding box range, a height variation range of the fragment is obtained, and the height variation range of the fragment is input into an occlusion channel, so as to achieve overall ambient light occlusion of the target model through the occlusion channel;

[0010] An occlusion map of the target model is generated, and grayscale processing is performed on the occlusion map to obtain a target occlusion map, and detailed ambient light occlusion of the target model is achieved through the target occlusion map.

[0011] In an exemplary embodiment of the present disclosure, determining the relative position of the fragment of the target model with respect to the bounding box range includes:

[0012] Determine the world coordinates of the target model, and obtain the object space coordinates of the target model through the world coordinates of the target model;

[0013] The relative position of the fragment of the target model with respect to the bounding box is obtained by dividing the object space coordinates of the target model by the bounding box range of the target model.

[0014] In an exemplary embodiment of the present disclosure, obtaining the height variation range of the fragment based on the relative position of the fragment with respect to the bounding box range includes:

[0015] Based on the relative position of the fragment with respect to the bounding box range, acquiring data of the target channel of the fragment;

[0016] The height variation range of the fragment is obtained by using the data of the target channel of the fragment.

[0017] In an exemplary embodiment of the present disclosure, after inputting the height variation range of the fragment into the occlusion channel, the ambient light occlusion implementation method further includes:

[0018] Obtaining a first masking parameter corresponding to a height variation range of the fragment;

[0019] generating and displaying a visible shielding intensity parameter corresponding to the first shielding parameter;

[0020] In response to a setting operation for the visible shielding intensity parameter, a first parameter value is obtained, wherein the first parameter value is used to adjust the shielding height of the target model.

[0021] In an exemplary embodiment of the present disclosure, generating an occlusion map of the target model includes:

[0022] The target model is imported into a texture synthesizer, and an occlusion map of the target model is generated by the texture synthesizer.

[0023] In an exemplary embodiment of the present disclosure, grayscale processing is performed on the occlusion map to obtain a target occlusion map, including:

[0024] Obtaining a pixel matrix of the occlusion map, and performing normalization processing on the pixel matrix of the occlusion map;

[0025] Performing an exponential transformation on the normalized pixel matrix using a contrast algorithm;

[0026] The pixel matrix that has undergone the exponential transformation is denormalized, the denormalized pixel matrix is ​​determined as a target pixel matrix, and the target occlusion map is obtained through the target pixel matrix.

[0027] In an exemplary embodiment of the present disclosure, after obtaining the target occlusion map, the ambient light occlusion implementation method further includes:

[0028] Acquire a second masking parameter corresponding to the target pixel matrix, and generate and display a detail masking intensity parameter corresponding to the second masking parameter;

[0029] In response to the setting operation on the detail masking strength parameter, a second parameter value is obtained, wherein the second parameter value is used to adjust the detail masking strength of the target model.

[0030] According to one aspect of the present disclosure, there is provided an ambient light shielding implementation device, comprising:

[0031] A relative position determination module, used to obtain a target model and a bounding box range of the target model, and determine a relative position of a fragment of the target model relative to the bounding box range;

[0032] An overall ambient light occlusion implementation module, used to obtain a height variation range of the fragment based on a relative position of the fragment relative to the bounding box range, input the height variation range of the fragment into an occlusion channel, and implement overall ambient light occlusion of the target model through the occlusion channel;

[0033] The detailed ambient occlusion realization module is used to generate an occlusion map of the target model, perform grayscale processing on the occlusion map to obtain a target occlusion map, and realize detailed ambient occlusion of the target model through the target occlusion map.

[0034] According to one aspect of the present disclosure, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for implementing ambient light occlusion described in any of the above exemplary embodiments is implemented.

[0035] According to one aspect of the present disclosure, there is provided an electronic device, including:

[0036] Processor; and

[0037] A memory, configured to store executable instructions of the processor;

[0038] The processor is configured to execute the ambient light occlusion implementation method described in any of the above exemplary embodiments by executing the executable instructions.

[0039] The disclosed embodiment provides a method for realizing ambient light occlusion, which comprises the following steps: obtaining a target model and a bounding box range of the target model, determining a relative position of a fragment of the target model relative to the bounding box range; obtaining a height variation range of the fragment based on the relative position of the fragment relative to the bounding box range, inputting the height variation range of the fragment into an occlusion channel, and realizing overall ambient light occlusion of the target model through the occlusion channel; generating an occlusion map of the target model, performing grayscale processing on the occlusion map, and realizing detailed ambient light occlusion of the target model through the target occlusion map. On the one hand, the relative position of the fragment of the target model relative to the bounding box range is first calculated. The relative position of the fragment is obtained to obtain the height variation range of the fragment, and the height variation range of the fragment is input into the occlusion channel. The overall ambient light occlusion effect of the target model is adjusted through the occlusion channel, which solves the problem that the occlusion effect of the model in the picture cannot be adjusted separately in the related technology, and improves the efficiency of realizing the overall ambient light occlusion effect of the model; on the other hand, after realizing the overall ambient light occlusion effect of the target model, the occlusion map of the target model is generated, and the occlusion map is processed to obtain the target occlusion map. The target occlusion map is used to realize the detail ambient light occlusion effect of the target model, and further enhances the three-dimensional sense of the target model.

[0040] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0042] Figure 1 A flowchart of a method for implementing ambient occlusion according to an exemplary embodiment of the present invention is schematically shown.

[0043] Figure 2 A schematic diagram schematically shows a bounding box of a target model according to an exemplary embodiment of the present invention.

[0044] Figure 3 A flowchart of a method for determining the relative position of a fragment of a target model relative to the bounding box range according to an exemplary embodiment of the present invention is schematically shown.

[0045] Figure 4 A flowchart schematically illustrates a method for obtaining a height variation range of a fragment based on a relative position of the fragment relative to a bounding box range according to an exemplary embodiment of the present invention.

[0046] Figure 5 A flowchart of a method for implementing ambient occlusion after inputting a height variation range of a fragment into an occlusion channel according to an exemplary embodiment of the present invention is schematically shown.

[0047] Figure 6 A schematic diagram schematically illustrates a method of realizing an overall ambient light occlusion effect of a target model through an occlusion channel of a material according to an exemplary embodiment of the present invention.

[0048] Figure 7 A schematic diagram schematically illustrates an artist adjusting the overall ambient occlusion effect of a target model through a visible occlusion intensity parameter according to an exemplary embodiment of the present invention.

[0049] Figure 8 A flowchart of a method for performing grayscale processing on an occlusion map to obtain a target occlusion map according to an exemplary embodiment of the present disclosure is schematically shown.

[0050] Fig. 9 A schematic diagram of realizing a detailed ambient occlusion effect of a target model by using a target occlusion map according to an exemplary embodiment of the present disclosure is schematically shown.

[0051] Fig.10 A flowchart of a method for implementing ambient occlusion after obtaining a target occlusion map according to an exemplary embodiment of the present disclosure is schematically shown.

[0052] Fig.11 A block diagram schematically shows a device for implementing ambient light occlusion according to an exemplary embodiment of the present invention.

[0053] Fig.12 An electronic device for implementing the above ambient light shielding method according to an exemplary embodiment of the present invention is schematically shown. DETAILED DESCRIPTION

[0054] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solutions of the present invention may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present invention.

[0055] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0056] Currently, only direct lighting is used to draw scenes in games, which can no longer meet the requirements of players for game images. Direct lighting refers to the light source directly hitting the object, which reflects the light into the human eye. Now the game engine will consider indirect lighting while calculating direct lighting, thereby achieving global illumination and obtaining a more realistic effect.

[0057] At present, the construction of the three-dimensional sense of the game screen in the game engine is mainly achieved through the post-processing screen space ambient occlusion technology. The parameters for implementing screen space ambient occlusion in the NeoX engine include: intensity, radius, offset, sharpness, and screen space ambient occlusion type. Screen space ambient occlusion is built based on the three-dimensional sense of the entire game screen. When the screen space ambient occlusion effect suitable for the game scene is used, the effect on the model is not obvious; if the parameters of the screen space ambient occlusion are adjusted according to the effect of the model, the ideal occlusion effect cannot be achieved for the game scene.

[0058] Based on one or more of the above problems, this exemplary embodiment first provides an ambient light shielding implementation method, which can be run on a device terminal, which can include a desktop computer, a portable computer, a smart phone, a tablet computer, etc. Of course, those skilled in the art can also run the method of the present invention on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the ambient light occlusion implementation method may include the following steps:

[0059] Step S110: Obtain a target model and a bounding box range of the target model, and determine a relative position of a fragment of the target model with respect to the bounding box range;

[0060] Step S120. Based on the relative position of the fragment with respect to the bounding box range, the height variation range of the fragment is obtained, and the height variation range of the fragment is input into the occlusion channel, and the overall ambient light occlusion of the target model is achieved through the occlusion channel;

[0061] Step S130: Generate an occlusion map of the target model, perform grayscale processing on the occlusion map to obtain a target occlusion map, and implement detailed ambient light occlusion of the target model through the target occlusion map.

[0062] The above-mentioned ambient light occlusion implementation method obtains the target model and the bounding box range of the target model, determines the relative position of the fragment of the target model with respect to the bounding box range; obtains the height variation range of the fragment based on the relative position of the fragment with respect to the bounding box range, inputs the height variation range of the fragment into the occlusion channel, and implements the overall ambient light occlusion of the target model through the occlusion channel; generates an occlusion map of the target model, performs grayscale processing on the occlusion map, obtains the target occlusion map, and implements the detailed ambient light occlusion of the target model through the target occlusion map. On the one hand, the relative position of the fragment of the target model with respect to the bounding box range is first calculated. , the height variation range of the fragment is obtained, and the height variation range of the fragment is input into the occlusion channel. The overall ambient light occlusion effect of the target model is adjusted through the occlusion channel, which solves the problem that the occlusion effect of the model in the picture cannot be adjusted separately in the related technology, and improves the efficiency of realizing the overall ambient light occlusion effect of the model; on the other hand, after realizing the overall ambient light occlusion effect of the target model, the occlusion map of the target model is generated, and the occlusion map is processed to obtain the target occlusion map. The target occlusion map is used to realize the detail ambient light occlusion effect of the target model, and the three-dimensional sense of the target model is further enhanced.

[0063] Hereinafter, each step involved in the method for implementing ambient light occlusion according to the exemplary embodiment of the present disclosure is explained and illustrated in detail.

[0064] In step S110, a target model and a bounding box range of the target model are obtained, and a relative position of a fragment of the target model with respect to the bounding box range is determined.

[0065] Among them, the bounding box is an algorithm for solving the optimal bounding space of a discrete point set. The basic idea is to use a geometric body (called a bounding box) with a slightly larger volume and simpler characteristics to approximately replace complex geometric objects. In this example embodiment, the bounding box of the target model can be calculated by a bounding box algorithm. The bounding box algorithm can be an aabb (axis-aligned bounding box, axis-aligned rectangular bounding box) bounding box, a bounding sphere, or an oriented bounding box obb (oriented bounding box, oriented bounding box). In this example embodiment, the bounding box algorithm is not specifically limited. Those skilled in the art can select the corresponding bounding box algorithm to generate a bounding box as needed.

[0066] In this example embodiment, after the target model and the bounding box of the target model are obtained, the range of the bounding box of the target model can be determined. After the range of the bounding box of the target model is determined, the coordinates of the target model and the bounding box range of the target model can be used to calculate the bounding box range of the target model. Figure 2 The bounding box of the target model is shown. Figure 2 Taking the bounding box of the target model shown in FIG. 1 as an example, the bounding box range of the target model may be the three-dimensional coordinate range of the bounding box of the target model. When obtaining the range of the bounding box of the target model, Figure 2 The point in the lower left corner is used as the origin (0,0,0) to establish a three-dimensional coordinate system, and then obtain the range of the bounding box of the target model. The relative position of the fragment of the target model relative to the bounding box range of the target model is determined according to the range of the bounding box of the target model. Figure 3 As shown, determining the relative position of the fragment of the target model with respect to the bounding box range may include step S310 and step S320:

[0067] Step S310. Determine the world coordinates of the target model, and obtain the object space coordinates of the target model through the world coordinates of the target model;

[0068] Step S320: Divide the object space coordinates of the target model by the bounding box range of the target model to obtain the relative position of the fragment of the target model with respect to the bounding box.

[0069] In the following, step S310 and step S320 will be further explained and illustrated. Specifically, first, the target model is obtained, and the world coordinates of the target model are determined. The world coordinates are the objective space that defines the position of the physical world. They are the three-dimensional space coordinates of the real world and are three-dimensional coordinate systems. After obtaining the world coordinates of the target model, the world coordinates of the target model can be multiplied by the inverse transformation matrix to obtain the object space coordinates of the target model, wherein the object space coordinates of the target model are the coordinate system of the target model. After obtaining the object space coordinates of the target model, the object space coordinates of the target model can be divided by the bounding box range of the target model, that is, the object space coordinates of the target model can be divided by the three-dimensional coordinates of the bounding box of the target model to obtain the relative position of the fragment of the target model relative to the bounding box. Among them, the dimension of the value of the relative position of the fragment of the target model relative to the bounding box is the same as the dimension of the coordinate value of the bounding box of the target model or the dimension of the object space coordinates of the target model, and the range of the value of the relative position of the fragment of the target model relative to the bounding box is [0,1]. The fragment of the target model may include the depth value, normal and texture coordinates of the model midpoint. After the fragment passes the test, the normal, texture coordinates and other unnecessary information are discarded to become a pixel. The pixel is the smallest unit of the image presented on the screen containing R (Red), G (Green), B (Blue) and A (Alpha) values.

[0070] In step S120, based on the relative position of the fragment with respect to the bounding box range, the height variation range of the fragment is obtained, and the height variation range of the fragment is input into the occlusion channel, and the overall ambient light occlusion of the target model is achieved through the occlusion channel.

[0071] In this exemplary embodiment, after the relative position of the fragment of the target model relative to the bounding box range of the target model is obtained, the height variation range of the fragment of the target model can be obtained according to the relative position of the fragment of the target model relative to the bounding box range of the target model. Figure 4 As shown, based on the relative position of the fragment relative to the bounding box range, obtaining the height variation range of the fragment may include step S410 and step S420:

[0072] Step S410. Based on the relative position of the fragment with respect to the bounding box range, obtain the data of the target channel of the fragment;

[0073] Step S420: Using the data of the target channel of the fragment, obtain the height variation range of the fragment.

[0074] In the following, step S410 and step S420 will be further explained and illustrated. Specifically, after the relative position of the target model's fragment relative to the target model's bounding box range is obtained, since the relative position of the target model's fragment relative to the target model's bounding box range is a three-dimensional position, the target channel data of the target model's fragment can be obtained based on the relative position. Since the brightness of the character in the game gradually decreases from top to bottom, the shielding effect at the point of contact with the ground should be the strongest, the target channel can be the y channel; after the y channel data is obtained, based on the obtained y channel data, the gradual change of the upper and lower heights of the target model can be obtained, that is, the height variation range of the target model's fragment can be obtained.

[0075] Furthermore, in this exemplary embodiment, after obtaining the height variation range of the target model's fragments, the height variation range of the target model's fragments can be input into the occlusion channel of the target model material, and the overall ambient light occlusion effect of the target model can be achieved through the height variation range in the occlusion channel. Figure 5 As shown, after the height variation range of the fragment is input into the occlusion channel, the ambient light occlusion implementation method may further include step S510 and step S520:

[0076] Step S510: acquiring a first shielding parameter corresponding to the height variation range of the fragment, and generating and displaying a shielding intensity parameter corresponding to the first shielding parameter;

[0077] Step S520: In response to the setting operation for the shielding intensity parameter, a first parameter value is obtained, wherein the first parameter value is used to adjust the shielding height of the target model.

[0078] In the following, step S510 and step S520 will be further explained and illustrated. Specifically, after the overall ambient light occlusion effect of the target model is realized in the material, a visual overall ambient light occlusion effect adjustment scheme can also be generated for the artist to adjust the overall ambient light occlusion effect. First, a first occlusion parameter corresponding to the height variation range of the fragment of the target model is obtained, and the value range of the first occlusion parameter is [0,1]. A occlusion intensity parameter corresponding to the first occlusion parameter is generated. The occlusion intensity parameter is visible. The visible occlusion intensity parameter is located in the game engine. The artist can adjust the visible occlusion intensity parameter as needed to adjust the overall ambient light occlusion effect of the target model; when the artist adjusts the occlusion intensity parameter, in response to the artist's setting operation for the occlusion intensity parameter, a first parameter value is obtained based on the setting operation, and the first parameter value is used to adjust the occlusion height of the target model. Figure 6The overall ambient occlusion effect of the target model achieved through the occlusion channel of the material is shown. It can be seen that Figure 6 In the figure, the brightness of the target model's fragments gradually decreases from top to bottom, and the shielding effect is strongest at the point where it contacts the ground. Figure 7 The figure shows the overall ambient light occlusion effect of the fragment of the target model after the artist adjusts the visible occlusion strength parameter to 0.5 in the game engine. When the artist adjusts the visible occlusion strength parameter, the larger the occlusion strength parameter is set, the higher the occlusion height of the target model from the ground contact point. In this example embodiment, by generating a visible occlusion strength parameter corresponding to the first occlusion parameter, the artist can adjust the occlusion effect of the target model without modifying the map, saving time and labor costs.

[0079] In step S130, an occlusion map of the target model is generated, and grayscale processing is performed on the occlusion map to obtain a target occlusion map, and detailed ambient light occlusion of the target model is achieved through the target occlusion map.

[0080] In this example embodiment, in addition to inputting the height variation range of the target model's fragment into the material's occlusion channel to achieve the overall ambient light occlusion effect of the target model through the occlusion channel, the detailed ambient light occlusion effect of the target model can also be achieved. When achieving the detailed ambient light occlusion effect of the target model, first, an occlusion map of the target model is generated. The generating of the occlusion map of the target model includes:

[0081] The target model is imported into a texture synthesizer, and an occlusion map of the target model is generated by the texture synthesizer.

[0082] Specifically, the target model can be imported into a texture synthesizer, and the occlusion map of the target model can be generated by the texture synthesizer. The texture synthesizer can be Substance Designer or other texture synthesizers, and the texture synthesizer is not specifically limited in this exemplary embodiment.

[0083] In this example embodiment, after the occlusion map of the target model is generated, the occlusion map of the target model can be processed to obtain a target occlusion map. Figure 8 As shown, grayscale processing is performed on the occlusion map to obtain a target occlusion map, which may include steps S810 to S830:

[0084] Step S810: Obtain the pixel matrix of the occlusion map, and perform normalization processing on the pixel matrix of the occlusion map;

[0085] Step S820: performing exponential transformation on the normalized pixel matrix using a contrast algorithm;

[0086] Step S830: Denormalize the pixel matrix that has undergone the exponential transformation, determine the denormalized pixel matrix as the target pixel matrix, and obtain the target occlusion map through the target pixel matrix.

[0087] The following will further explain and illustrate step S810-step S830. Specifically, first, the pixel matrix of the occlusion map is obtained, and after the pixel matrix of the occlusion map is obtained, the pixel matrix of the occlusion map is normalized to obtain a normalized pixel matrix; then, the normalized pixel matrix is ​​exponentially transformed using a contrast algorithm, wherein the equation for the exponential transformation can be: f = c*R γ , where c is a constant, R is the grayscale of the occlusion map, and γ is the gamma coefficient. After the normalized pixel matrix is ​​exponentially transformed by the contrast algorithm, the exponentially transformed pixel matrix is ​​denormalized, and the denormalized pixel matrix is ​​determined as the target pixel matrix; finally, the target occlusion map is obtained by the target pixel matrix.

[0088] After the target occlusion map is obtained, the target occlusion map can be used to achieve the detailed ambient occlusion effect of the target model. Fig. 9 It shows that the detailed ambient light occlusion effect of the target model is achieved through the target occlusion map. The target occlusion map can simulate the shadows between objects. When there is no lighting, the volume of the target model is increased, and the three-dimensional sense of the target model is further enhanced.

[0089] In this example embodiment, reference Fig.10 As shown, after obtaining the target occlusion map, the ambient light occlusion implementation method may further include step S1010 and step S1020:

[0090] Step S1010. Acquire a second masking parameter corresponding to the target pixel matrix, and generate and display a detail masking intensity parameter corresponding to the second masking parameter;

[0091] Step S1020: In response to the setting operation of the detail masking strength parameter, a second parameter value is obtained, wherein the second parameter value is used to adjust the detail masking strength of the target model.

[0092] In the following, step S1010 and step S1020 will be further explained and illustrated. Specifically, after the detail ambient occlusion effect of the target model is realized in the material, a visual detail ambient occlusion effect adjustment scheme can also be generated for the artist to adjust the detail ambient occlusion effect of the target model. First, a second occlusion parameter corresponding to the target pixel matrix is ​​obtained, wherein the value range of the second occlusion parameter is [0,1], and a detail occlusion intensity parameter corresponding to the second occlusion parameter is generated and displayed, wherein the detail occlusion intensity parameter is visible, and the visible detail occlusion intensity parameter is located in the game engine, and the artist can adjust the visible detail occlusion intensity parameter as needed to adjust the detail ambient occlusion effect of the target model. When the artist adjusts the detail occlusion intensity parameter, in response to the artist's setting operation for the detail occlusion intensity parameter, a second parameter value is obtained according to the setting operation, wherein the second parameter value is used to adjust the detail occlusion intensity of the target model. When an artist adjusts the visible detail occlusion intensity parameter, the larger the detail occlusion intensity parameter is set, the greater the detail ambient occlusion intensity of the target model.

[0093] The ambient light occlusion implementation method provided by the exemplary embodiment of the present disclosure has at least the following advantages: on the one hand, the relative position of the fragment of the target model with respect to the bounding box range is first calculated to obtain the height variation range of the fragment, and the height variation range of the fragment is input into the occlusion channel. The overall ambient light occlusion effect of the target model is adjusted through the occlusion channel, which solves the problem that the occlusion effect of the model in the picture cannot be adjusted separately in the related art, and improves the efficiency of realizing the overall ambient light occlusion effect of the model; on the other hand, after achieving the overall ambient light occlusion effect of the target model, an occlusion map of the target model is generated, and the occlusion map is applied to the occlusion map. After processing is performed, a target occlusion map is obtained, through which the effect of detailed ambient occlusion of the target model is achieved, thereby further enhancing the three-dimensional sense of the target model; on the other hand, after the overall ambient occlusion effect of the target model and the detailed ambient occlusion effect of the target model are achieved through the material, a visible occlusion intensity parameter and a detailed occlusion intensity parameter are generated, so that the artist does not need to modify the map, but only needs to adjust the occlusion intensity parameter and the detailed occlusion intensity parameter to achieve the adjustment of the overall ambient occlusion effect of the target model and the detailed ambient occlusion effect of the target model, thereby saving time and labor costs.

[0094] The exemplary embodiment of the present disclosure also provides an ambient light shielding implementation device, referring to Fig.11 As shown, it may include: a relative position determination module 1110, an overall ambient light occlusion implementation module 1120, and a detail ambient light occlusion implementation module 1130. Among them:

[0095] A relative position determination module 1110 is used to obtain a target model and a bounding box range of the target model, and determine a relative position of a fragment of the target model relative to the bounding box range;

[0096] The overall ambient light occlusion realization module 1120 is used to obtain the height variation range of the fragment based on the relative position of the fragment relative to the bounding box range, input the height variation range of the fragment into the occlusion channel, and realize the overall ambient light occlusion of the target model through the occlusion channel;

[0097] The detailed ambient occlusion implementation module 1130 is used to generate an occlusion map of the target model, perform grayscale processing on the occlusion map to obtain a target occlusion map, and implement detailed ambient occlusion of the target model through the target occlusion map.

[0098] The specific details of each module in the above-mentioned ambient light shielding implementation device have been described in detail in the corresponding ambient light shielding implementation method, so they will not be repeated here.

[0099] In an exemplary embodiment of the present disclosure, determining the relative position of the fragment of the target model with respect to the bounding box range includes:

[0100] Determine the world coordinates of the target model, and obtain the object space coordinates of the target model through the world coordinates of the target model;

[0101] The relative position of the fragment of the target model with respect to the bounding box is obtained by dividing the object space coordinates of the target model by the bounding box range of the target model.

[0102] In an exemplary embodiment of the present disclosure, obtaining the height variation range of the fragment based on the relative position of the fragment with respect to the bounding box range includes:

[0103] Based on the relative position of the fragment with respect to the bounding box range, acquiring data of the target channel of the fragment;

[0104] The height variation range of the fragment is obtained by using the data of the target channel of the fragment.

[0105] In an exemplary embodiment of the present disclosure, after inputting the height variation range of the fragment into the occlusion channel, the ambient light occlusion implementation method further includes:

[0106] Acquire a first shielding parameter corresponding to the height variation range of the fragment, and generate and display a visible shielding intensity parameter corresponding to the first shielding parameter;

[0107] In response to the setting operation for the shielding intensity parameter, a first parameter value is obtained, wherein the first parameter value is used to adjust the shielding height of the target model.

[0108] In an exemplary embodiment of the present disclosure, generating an occlusion map of the target model includes:

[0109] The target model is imported into a texture synthesizer, and an occlusion map of the target model is generated by the texture synthesizer.

[0110] In an exemplary embodiment of the present disclosure, grayscale processing is performed on the occlusion map to obtain a target occlusion map, including:

[0111] Obtaining a pixel matrix of the occlusion map, and performing normalization processing on the pixel matrix of the occlusion map;

[0112] Performing an exponential transformation on the normalized pixel matrix using a contrast algorithm;

[0113] The pixel matrix that has undergone the exponential transformation is denormalized, the denormalized pixel matrix is ​​determined as a target pixel matrix, and the target occlusion map is obtained through the target pixel matrix.

[0114] In an exemplary embodiment of the present disclosure, after obtaining the target occlusion map, the ambient light occlusion implementation method further includes:

[0115] Acquire a second masking parameter corresponding to the target pixel matrix, and generate and display a detail masking intensity parameter corresponding to the second masking parameter;

[0116] In response to a setting operation on the detail masking strength parameter, a second parameter value is obtained, wherein the second parameter value adjusts the detail masking strength for the target model.

[0117] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0118] In addition, although the steps of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0119] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above method is also provided.

[0120] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".

[0121] Refer to the following Fig.12 The electronic device 1200 according to this embodiment of the present invention is described. Fig.12 The electronic device 1200 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0122] like Fig.12 As shown, the electronic device 1200 is in the form of a general computing device. The components of the electronic device 1200 may include, but are not limited to: the at least one processing unit 1210, the at least one storage unit 1220, a bus 1230 connecting different system components (including the storage unit 1220 and the processing unit 1210), and a display unit 1240.

[0123] The storage unit stores program codes, which can be executed by the processing unit 1210, so that the processing unit 1210 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1210 can perform the following steps: Figure 1 The steps S110 shown in the figure are as follows: obtaining a target model and a bounding box range of the target model, and determining a relative position of a fragment of the target model relative to the bounding box range; S120: obtaining a height variation range of the fragment based on the relative position of the fragment relative to the bounding box range, inputting the height variation range of the fragment into an occlusion channel, and implementing overall ambient light occlusion of the target model through the occlusion channel; S130: generating an occlusion map of the target model, performing grayscale processing on the occlusion map, and obtaining a target occlusion map, and implementing detailed ambient light occlusion of the target model through the target occlusion map.

[0124] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 12201 and / or a cache storage unit 12202 , and may further include a read-only storage unit (ROM) 12203 .

[0125] The storage unit 1220 may also include a program / utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0126] Bus 1230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0127] The electronic device 1200 may also communicate with one or more external devices 1300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1200, and / or communicate with any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1250. In addition, the electronic device 1200 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0128] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present invention.

[0129] In an exemplary embodiment of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of this specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.

[0130] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0131] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0132] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0133] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0134] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0135] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0136] Other embodiments of the invention will readily occur to those skilled in the art after considering the specification and practicing the invention invented herein. This application is intended to cover any variations, uses or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art that are not invented by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.

Claims

1. A method for implementing ambient light occlusion, characterized in that: include: Acquire a target model and a bounding box range of the target model, and determine a relative position of a fragment of the target model with respect to the bounding box range; Based on the relative position of the fragment with respect to the bounding box range, a height variation range of the fragment is obtained, and the height variation range of the fragment is input into an occlusion channel, so as to achieve overall ambient light occlusion of the target model through the occlusion channel; An occlusion map of the target model is generated, and grayscale processing is performed on the occlusion map to obtain a target occlusion map, and detailed ambient light occlusion of the target model is achieved through the target occlusion map.

2. The method for implementing ambient light occlusion according to claim 1, characterized in that: Determining the relative position of the fragment of the target model with respect to the bounding box range includes: Determine the world coordinates of the target model, and obtain the object space coordinates of the target model through the world coordinates of the target model; The relative position of the fragment of the target model with respect to the bounding box is obtained by dividing the object space coordinates of the target model by the bounding box range of the target model.

3. The method for implementing ambient light occlusion according to claim 2, characterized in that: Based on the relative position of the fragment with respect to the bounding box range, the height variation range of the fragment is obtained, including: Based on the relative position of the fragment with respect to the bounding box range, acquiring data of the target channel of the fragment; The height variation range of the fragment is obtained by using the data of the target channel of the fragment.

4. The method for implementing ambient light occlusion according to claim 3, characterized in that: After inputting the height variation range of the fragment into the occlusion channel, the ambient light occlusion implementation method further includes: Acquire a first shielding parameter corresponding to the height variation range of the fragment, and generate and display a shielding intensity parameter corresponding to the first shielding parameter; In response to the setting operation for the shielding intensity parameter, a first parameter value is obtained, wherein the first parameter value is used to adjust the shielding height of the target model.

5. The method for implementing ambient light occlusion according to claim 1, characterized in that: Generating an occlusion map of the target model, comprising: The target model is imported into a texture synthesizer, and an occlusion map of the target model is generated by the texture synthesizer.

6. The method for implementing ambient light occlusion according to claim 5, characterized in that: Grayscale processing is performed on the occlusion map to obtain a target occlusion map, including: Obtaining a pixel matrix of the occlusion map, and performing normalization processing on the pixel matrix of the occlusion map; Performing an exponential transformation on the normalized pixel matrix using a contrast algorithm; The pixel matrix that has undergone the exponential transformation is denormalized, the denormalized pixel matrix is ​​determined as a target pixel matrix, and the target occlusion map is obtained through the target pixel matrix.

7. The method for implementing ambient light occlusion according to claim 6, characterized in that: After obtaining the target occlusion map, the ambient light occlusion implementation method further includes: Acquire a second masking parameter corresponding to the target pixel matrix, and generate and display a detail masking intensity parameter corresponding to the second masking parameter; In response to the setting operation on the detail masking strength parameter, a second parameter value is obtained, wherein the second parameter value is used to adjust the detail masking strength of the target model.

8. An ambient light shielding implementation device, characterized in that: include: A relative position determination module, used to obtain a target model and a bounding box range of the target model, and determine a relative position of a fragment of the target model relative to the bounding box range; An overall ambient light occlusion implementation module, used to obtain a height variation range of the fragment based on a relative position of the fragment relative to the bounding box range, input the height variation range of the fragment into an occlusion channel, and implement overall ambient light occlusion of the target model through the occlusion channel; The detailed ambient occlusion realization module is used to generate an occlusion map of the target model, perform grayscale processing on the occlusion map to obtain a target occlusion map, and realize detailed ambient occlusion of the target model through the target occlusion map.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for realizing ambient occlusion light according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the ambient occlusion light implementation method according to any one of claims 1 to 7 by executing the executable instructions.

Citation Information

Patent Citations

  • Dynamic map adjustment method and device

    CN109985384A

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

    CN111210497A