A shadow adjustment method, device, apparatus and storage medium

By acquiring and separating the shadow to be adjusted in the shadow adjustment event and adjusting its display parameters, the problem of large differences between shadows and the real world is solved, resulting in a better user experience and saving computing power.

CN115619839BActive Publication Date: 2026-02-03SHANGHAI MIHAYOULIYUE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110795690.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-14
Publication Date
2026-02-03
Estimated Expiration
2041-07-14

AI Technical Summary

Technical Problem

The shadows generated by existing technologies differ significantly from those in the real world, resulting in a poor user experience.

Method used

By detecting shadow adjustment events, the positional relationship between the generated shadow and the illuminated object is obtained, thereby separating the shadow to be adjusted on the illuminated object and adjusting it, including removing target pixels or adjusting shadow display parameters such as brightness, density, saturation and color.

Benefits of technology

Adjusting shadows before rendering reduces computational resource consumption, improves user experience, and makes shadow display effects more similar to the real world.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115619839B_ABST
    Figure CN115619839B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a shadow adjustment method, device, equipment and storage medium. The method comprises: when a shadow adjustment event is detected, obtaining a generated shadow corresponding to the shadow adjustment event and an irradiated object irradiated by a light source; according to a positional relationship between the generated shadow and the irradiated object, separating a to-be-adjusted shadow located on the irradiated object from the generated shadow; and adjusting the to-be-adjusted shadow to obtain an adjusted shadow. The technical solution of the embodiments of the present application separates the to-be-adjusted shadow that may make the irradiated object appear very black from the generated shadow, and adjusts the to-be-adjusted shadow, thereby solving the problem that the generated shadow covering the irradiated object is greatly different from the real world. Meanwhile, the shadow adjustment process can be completed before rendering, thereby achieving the effect of saving computing power.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer technology, and particularly relate to a shadow adjustment method, device, equipment and storage medium. BACKGROUND

[0002] The development process of many application programs (APPs) usually involves interface development. Since there can be shadows in places where light sources exist, shadows are an important content in interface development.

[0003] In the process of implementing the present application, the inventors have found that the prior art has the following technical problems: the generated shadows differ greatly from shadows in the real world, and the user experience is poor. SUMMARY

[0004] Embodiments of the present application provide a shadow adjustment method, device, equipment and storage medium to achieve the effect of shadow adjustment.

[0005] In a first aspect, embodiments of the present application provide a shadow adjustment method, which can include:

[0006] Upon detecting a shadow adjustment event, obtaining a generated shadow corresponding to the shadow adjustment event and an irradiated object irradiated by a light source;

[0007] According to a positional relationship between the generated shadow and the irradiated object, separating a to-be-adjusted shadow located on the irradiated object from the generated shadow;

[0008] Adjusting the to-be-adjusted shadow to obtain an adjusted shadow.

[0009] Optionally, obtaining the generated shadow corresponding to the shadow adjustment event and the irradiated object irradiated by the light source can include:

[0010] Obtaining a shadow map in which the generated shadow is stored and an outline map in which an object outline of the irradiated object irradiated by the light source is stored;

[0011] Comparing the shadow map and the outline map to obtain the positional relationship between the generated shadow and the irradiated object.

[0012] On this basis, optionally, comparing the shadow map and the outline map to obtain the positional relationship between the generated shadow and the irradiated object can include:

[0013] Sampling a shadow pixel point located on the generated shadow from the shadow map, and sampling an object pixel point located on the irradiated object from the outline map;

[0014] According to the shadow position of each shadow pixel and the object position of each object pixel, a position relationship between the generated shadow and the irradiated object is obtained.

[0015] Optionally, adjusting the to-be-adjusted shadow to obtain the adjusted shadow can include:

[0016] A parameter adjustment target of a shadow display parameter of the to-be-adjusted shadow is obtained, and the shadow display parameter is adjusted based on the parameter adjustment target to obtain the adjusted shadow, wherein the shadow display parameter includes at least one of brightness, concentration, saturation, and color.

[0017] Optionally, the parameter adjustment target includes at least one of a parameter value of the shadow display parameter that is pre-set, calculated based on a ray tracing algorithm, and obtained according to a calculation result of the ray tracing algorithm.

[0018] Optionally, obtaining the generated shadow corresponding to the shadow adjustment event and the irradiated object irradiated by the light source can include:

[0019] The generated shadow corresponding to the shadow adjustment event, the parameter adjustment tool, and the irradiated object irradiated by the light source are obtained, the parameter adjustment tool includes a parameter adjustment function and / or a parameter adjustment map that takes the shadow display parameter of the to-be-adjusted shadow as input data and outputs a parameter adjustment result.

[0020] Adjusting the to-be-adjusted shadow to obtain the adjusted shadow can include:

[0021] The shadow display parameter of the to-be-adjusted shadow is input into the parameter adjustment tool, and the adjusted shadow is obtained based on the parameter adjustment result output by the parameter adjustment tool.

[0022] Optionally, the shadow adjustment method can further include:

[0023] Separating the unadjusted shadow not located on the irradiated object from the generated shadow;

[0024] Rendering the unadjusted shadow and the adjusted shadow.

[0025] In a second aspect, an embodiment of the present application further provides a shadow adjustment device, which can include:

[0026] A generated shadow acquisition module is configured to, when a shadow adjustment event is detected, acquire the generated shadow corresponding to the shadow adjustment event and the irradiated object irradiated by the light source.

[0027] A to-be-adjusted shadow separation module is configured to separate the to-be-adjusted shadow located on the irradiated object from the generated shadow according to the position relationship between the generated shadow and the irradiated object.

[0028] The Adjusted Shadow module is used to adjust the shadow to be adjusted, resulting in the adjusted shadow.

[0029] Thirdly, embodiments of the present invention also provide a shadow adjustment device, which may include:

[0030] One or more processors;

[0031] Memory, used to store one or more programs;

[0032] When one or more programs are executed by one or more processors, the one or more processors implement the shadow adjustment method provided in any embodiment of the present invention.

[0033] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the shadow adjustment method provided in any embodiment of the present invention.

[0034] The technical solution of this invention, by acquiring the generated shadow corresponding to the detected shadow adjustment event and the illuminated object, can separate the shadow to be adjusted on the illuminated object from the generated shadow based on the positional relationship between the generated shadow and the illuminated object. This shadow may make the illuminated object appear very dark. Then, the shadow to be adjusted is obtained to obtain the adjusted shadow. This technical solution, by separating the shadow to be adjusted from the generated shadow that may make the illuminated object appear very dark, and then adjusting the shadow to be adjusted, solves the problem of significant differences between the generated shadow on the illuminated object and the real world. Simultaneously, the shadow adjustment process can be completed before rendering, thereby saving computational power. Attached Figure Description

[0035] Figure 1 This is a flowchart of a shadow adjustment method according to Embodiment 1 of the present invention;

[0036] Figure 2 This is a flowchart of a shadow adjustment method according to Embodiment 2 of the present invention;

[0037] Figure 3 This is a flowchart of a shadow adjustment method according to Embodiment 3 of the present invention;

[0038] Figure 4 This is a structural block diagram of a shadow adjustment device according to Embodiment 4 of the present invention;

[0039] Figure 5 This is a schematic diagram of the structure of a shadow adjustment device according to Embodiment 5 of the present invention. Detailed Implementation

[0040] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0041] Before introducing the various embodiments of this invention, let's briefly explain their research and development ideas: Taking a light source shining on a tree as an example, in the real world, shadows can appear in places where the light source cannot reach. It should be noted that, due to the multiple reflections and refractions of light among the leaves, the shadow covering the tree is not pure black. It can present an effect where both shadow and projected light exist, meaning that from the observer's perspective, the tree itself can still be observed through the shadow covering it. However, in a computer, shadows can be determined based on the relative position between the light source and the tree (such as relative distance, relative direction, i.e., the direction of the light source), the shape of the tree, etc. The shadow determined in this way is pure black, whether it is the shadow covering the tree or the shadow falling on the ground. Obviously, this does not match the real world, resulting in a poor user experience.

[0042] To address the issue of completely black shadows cast by trees, one possible solution is to determine shadows using ray tracing algorithms (hereinafter referred to as ray tracing). Specifically, the human eye sees an object because light from a source is reflected off the object and into the eye; in this case, the human eye is similar to a camera that receives light. Similarly, in ray tracing in computers, light emitted from a camera strikes an object, and after multiple reflections and refractions, it can simulate shadows in the real world. The camera, the object reflecting and refracting the light, and other elements can be considered light sources. However, ray tracing algorithms are extremely computationally intensive and unsuitable for use on electronic devices with limited computing power, such as devices running mobile games.

[0043] Therefore, how to solve the problem of pure black shadows covering trees while saving computing power is the focus of the following embodiments.

[0044] Example 1

[0045] Figure 1 This is a flowchart of a shadow adjustment method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where shadows to be adjusted are applied to an object being illuminated. The method can be executed by the shadow adjustment device provided in this embodiment of the invention. This device can be implemented in software and / or hardware and can be integrated into a shadow adjustment device, which can be various user terminals or servers.

[0046] See Figure 1 The method of this invention specifically includes the following steps:

[0047] S110. When a shadow adjustment event is detected, obtain the generated shadow corresponding to the shadow adjustment event and the illuminated object illuminated by the light source.

[0048] The shadow adjustment event can be triggered when an adjustment is needed for a shadow to be adjusted. The shadow to be adjusted can be a shadow on an illuminated object, which may be a shadow cast by the illuminated object after being illuminated by a light source, or a shadow cast by an occluding object, etc., without specific limitations. The illuminated object can be an object illuminated by a light source, and the occluding object can be an object that blocks part of the light emitted by the light source from the illuminated object. For example, the shadow adjustment event is triggered before, during, or after rendering an interface containing the shadow to be adjusted (or containing the illuminated object). The generated shadow can be a shadow cast by the illuminated object after being illuminated by a light source and / or after being occluded by an occluding object. It can be the shadow to be adjusted falling on the illuminated object (which can also be called a self-shadow), or a shadow cast on other objects besides the illuminated object (such as the ground, walls, buildings, etc.), etc., without specific limitations. Therefore, when a shadow adjustment event is detected, it can be determined which illuminated object the shadow to be adjusted is being adjusted based on the shadow adjustment event. Thus, the illuminated object corresponding to the shadow adjustment event can be obtained, and the generated shadow associated with the illuminated object can be obtained.

[0049] S120. Based on the positional relationship between the generated shadow and the illuminated object, separate the shadow to be adjusted located on the illuminated object from the generated shadow.

[0050] Among them, the positional relationship can be the spatial relationship between the generated shadow and the illuminated object, such as complete overlap, partial overlap, no overlap, adjacent, far apart, etc. As mentioned above, the generated shadow may fall on the illuminated object or on other objects besides the illuminated object. Therefore, based on the positional relationship between the generated shadow and the illuminated object, the shadow to be adjusted located on the illuminated object can be separated from the generated shadow. For example, the generated shadow may include at least two generated sub-shadows. Based on the positional relationship between the generated shadow and the illuminated object, the positional relationship between each generated sub-shadow and the illuminated object can be determined, such as whether they overlap or not. Then, the generated sub-shadows that overlap with the illuminated object in positional relationship can be taken as the shadow to be adjusted. Another example is to obtain each shadow pixel in the generated shadow. Based on the positional relationship between the generated shadow and the illuminated object, the positional relationship between each shadow pixel and the illuminated object can be determined, such as whether the shadow pixel is on the illuminated object or not. Then, the shadow pixels that are on the illuminated object in positional relationship can be taken as target pixels. That is, the target pixels can be pixels that are simultaneously on the generated shadow and the illuminated object, and the shadow formed by each target pixel is taken as the shadow to be adjusted. And so on, without specific limitations.

[0051] S130. Adjust the shadow to be adjusted to obtain the adjusted shadow.

[0052] As mentioned above, the shadow to be adjusted in a computer can be determined based on the relative position between the light source and the illuminated object (such as relative distance, relative direction, i.e., the direction of the light source), the shape of the illuminated object, etc. Because it is pure black in display, the illuminated object covered by the shadow to be adjusted cannot be displayed, which does not match the real world and results in a poor user experience. Therefore, in order to display the illuminated object covered by the shadow to be adjusted and make the display effect of the illuminated object similar to the real world, after obtaining the shadow to be adjusted, it can be adjusted. For example, certain target pixels in the shadow to be adjusted can be removed, and the shadow display parameters of the shadow to be adjusted can be adjusted, etc., without specific limitations. The aforementioned shadow display parameters can be parameters related to the display effect of the shadow to be adjusted, such as brightness, density, saturation, color, etc. Thus, compared to the shadow to be adjusted, the adjusted shadow obtained after adjusting the shadow to be adjusted is lighter in display effect, which allows the user to observe the illuminated object covered by the adjusted shadow, which is closer to the display effect in the real world and provides a better user experience.

[0053] In practical applications, optionally, all the above steps can be completed before rendering the interface to be rendered. That is, the steps of separating and adjusting the shadows to be adjusted can be performed first, and then the step of rendering based on the adjusted shadows can be performed. This achieves the effect of saving computing power while solving the problem of the shadows to be adjusted being pure black. Alternatively, for the shadows that fall on objects other than the illuminated object in the generated shadows, they can be adjusted like the shadows to be adjusted, or they can remain unchanged; no specific limitation is made here. For example, unadjusted shadows that are not located on the illuminated object can be separated from the generated shadows. That is, unadjusted shadows can be shadows that fall on objects other than the illuminated object and do not require any adjustment. This distinguishes the generated shadows on the illuminated object from the generated shadows on other objects. Rendering is then performed on both the unadjusted and adjusted shadows, i.e., rendering is performed after all the generated shadows that need adjustment have been adjusted, thus achieving the effect of saving computing power. To better understand the technical effects of this exemplary solution, the following is a brief explanation using the example of light illuminating trees. Because there are shadows cast between the leaves on the trees (i.e., shadows to be adjusted), in order to avoid the trees appearing too dark, these shadows to be adjusted can be made to distinguish them from the shadows cast by the entire tree on the ground (i.e., unadjusted shadows). That is, the shadows to be adjusted are reduced while the unadjusted shadows are retained, thereby rendering a rendered interface that is more similar to the real world.

[0054] The technical solution of this invention, by acquiring the generated shadow corresponding to the detected shadow adjustment event and the illuminated object, can separate the shadow to be adjusted on the illuminated object from the generated shadow based on the positional relationship between the generated shadow and the illuminated object. This shadow may make the illuminated object appear very dark. Then, the shadow to be adjusted is obtained to obtain the adjusted shadow. This technical solution, by separating the shadow to be adjusted from the generated shadow that may make the illuminated object appear very dark, and then adjusting the shadow to be adjusted, solves the problem of significant differences between the generated shadow on the illuminated object and the real world. Simultaneously, the shadow adjustment process can be completed before rendering, thereby saving computational power.

[0055] An optional technical solution for obtaining the generated shadow corresponding to a shadow adjustment event and the illuminated object being lit by a light source may include: obtaining the generated shadow corresponding to the shadow adjustment event, a parameter adjustment tool, and the illuminated object being lit by a light source. The parameter adjustment tool may include a parameter adjustment function and / or a parameter adjustment map that takes the shadow display parameters of the shadow to be adjusted as input data and the parameter adjustment result as output data. Correspondingly, adjusting the shadow to obtain the adjusted shadow may include: inputting the shadow display parameters of the shadow to be adjusted into the parameter adjustment tool, and obtaining the adjusted shadow based on the parameter adjustment result output by the parameter adjustment tool. As mentioned above, the shadow display parameters may be parameters related to the display effect of the shadow to be adjusted, such as brightness, density, saturation, color, etc.; the parameter adjustment tool may be a tool for adjusting the shadow display parameters, which can be displayed through parameter adjustment functions, parameter adjustment maps, etc., without specific limitations. In practical applications, optionally, the aforementioned parameter adjustment tool can be understood as a tool that stores parameter adjustment targets. After the shadow display parameters of the shadow to be adjusted are input into the parameter adjustment tool, the tool can adjust the shadow display parameters based on its stored parameter adjustment targets, and then output the adjusted shadow display parameters (i.e., the parameter adjustment result). Thus, the adjusted shadow can be obtained from the parameter adjustment result output by the parameter adjustment tool; that is, the shadow display parameters of the adjusted shadow are the parameter adjustment result. Alternatively, the aforementioned parameter adjustment texture can be a texture that stores parameter adjustment functions; of course, it can also be any other texture capable of implementing parameter adjustment functions, without specific limitations. Furthermore, the parameter adjustment tool for the shadow to be adjusted obtained under different conditions (such as different light source directions, different shapes of illuminated objects, etc.) can be the same or different, again without specific limitations. The above technical solution, based on the parameter adjustment tool, realizes the adjustment process of the shadow to be adjusted, thereby achieving the effect of fast and accurate shadow adjustment.

[0056] Example 2

[0057] Figure 2 This is a flowchart of a shadow adjustment method provided in Embodiment 2 of the present invention. This embodiment is based on and optimized from the above-described technical solutions. In this embodiment, optionally, obtaining the generated shadow corresponding to the shadow adjustment event and the illuminated object illuminated by the light source may include: obtaining a shadow map storing the generated shadow and a contour map storing the object outline of the illuminated object corresponding to the shadow adjustment event; comparing the shadow map and the contour map to obtain the positional relationship between the generated shadow and the illuminated object. The explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.

[0058] SeeFigure 2 The method in this embodiment may specifically include the following steps:

[0059] S210. When a shadow adjustment event is detected, obtain the shadow map corresponding to the shadow adjustment event, which stores the shadow that has been generated, and the outline map, which stores the outline of the object being illuminated by the light source.

[0060] The shadow map can be a map storing generated shadows, and the outline map can be a map storing the outline of the illuminated object. The object outline can be an outline that reflects the shape of the illuminated object. In practical applications, the shadow map and outline map can optionally be obtained through real-time calculation or pre-storage. Taking the shadow map as an example, real-time calculation can be used to first calculate the generated shadow based on the shadow data of the generated shadow (i.e., the calculation result), and then render the generated shadow to obtain the shadow map. Pre-storage can be used to store the shadow map rendered based on the calculation result before detecting a shadow adjustment event, and then directly retrieve the shadow map after detecting the shadow adjustment event; and so on, without specific limitations. In addition, in a computer, these maps can be understood as buffers similar to masks or memory, that is, the objects to be rendered that have rendering requirements can be drawn on the buffer first, and then the buffer can be output to the display screen. The illuminated objects and shadows mentioned above can all be objects to be rendered. Different objects to be rendered can be drawn on the same buffer or on different buffers; no specific limitation is made here. When a rendering interface corresponds to at least two buffers, the display effect of these buffers being superimposed is the rendering effect of the rendering interface.

[0061] S220. Compare the shadow map and the outline map to obtain the positional relationship between the generated shadow and the illuminated object.

[0062] Since the shadow map can indicate where the generated shadow exists and the contour map can indicate where the illuminated object exists, the shadow map and the contour map can be compared to obtain the positional relationship between the generated shadow and the illuminated object.

[0063] S230. Based on the positional relationship between the generated shadow and the illuminated object, separate the shadow to be adjusted located on the illuminated object from the generated shadow.

[0064] S240. Adjust the shadow to be adjusted to obtain the adjusted shadow.

[0065] The technical solution of this invention obtains the positional relationship between the generated shadow and the illuminated object by comparing the obtained shadow map that can indicate where the generated shadow exists, and in particular the outline map that can indicate where the illuminated object exists. This achieves the effect of obtaining the positional relationship quickly and accurately.

[0066] An optional technical solution involves comparing a shadow map and a contour map to obtain the positional relationship between the generated shadow and the illuminated object. This can include: sampling shadow pixels located on the generated shadow from the shadow map, and sampling object pixels located on the illuminated object from the contour map; and obtaining the positional relationship between the generated shadow and the illuminated object based on the shadow positions of each shadow pixel and the object positions of each object pixel. Here, a shadow pixel can be a pixel in the shadow map where the generated shadow is located, and the shadow position can be the position of that shadow pixel in the shadow map; similarly, an object pixel can be a pixel in the contour map where the illuminated object is located, and the object position can be the position of that object pixel in the contour map. Since there is a one-to-one correspondence between the positions in the shadow map and the positions in the contour map, the positional relationship between the generated shadow and the illuminated object can be obtained based on the positions of each shadow and each object. For example, if all shadow positions and object positions completely overlap, the generated shadow and the illuminated object will also completely overlap in space; conversely, if some shadow positions and object positions partially overlap, the generated shadow and the illuminated object will also partially overlap in space, and the overlapping portion is also the portion where the shadow position and object position overlap. This technical solution obtains pixels that belong to both the generated shadow and the illuminated object through pixel sampling, and further accurately determines the positional relationship between the illuminated object and the generated shadow based on these pixels.

[0067] Example 3

[0068] Figure 3 This is a flowchart of a shadow adjustment method provided in Embodiment 3 of the present invention. This embodiment is an optimization based on the above-described technical solutions. In this embodiment, optionally, adjusting the shadow to be adjusted to obtain an adjusted shadow may include: obtaining a parameter adjustment target for the shadow display parameters of the shadow to be adjusted, adjusting the shadow display parameters based on the parameter adjustment target to obtain the adjusted shadow, wherein the shadow display parameters include at least one of brightness, density, saturation, and color. The explanations of terms that are the same as or corresponding to those in the above embodiments will not be repeated here.

[0069] See Figure 3 The method in this embodiment may specifically include the following steps:

[0070] S310. When a shadow adjustment event is detected, obtain the shadows generated corresponding to the shadow adjustment event and the illuminated object illuminated by the light source.

[0071] S320. Based on the positional relationship between the generated shadow and the illuminated object, separate the shadow to be adjusted located on the illuminated object from the generated shadow.

[0072] S330. Obtain the parameter adjustment target of the shadow display parameters of the shadow to be adjusted, and adjust the shadow display parameters based on the parameter adjustment target to obtain the adjusted shadow, wherein the shadow display parameters include at least one of brightness, density, saturation and color.

[0073] The parameter adjustment target can be the objective when adjusting shadow display parameters, such as increasing, decreasing, or maintaining a certain shadow display parameter. This shadow display parameter can be a parameter related to the display effect of the shadow to be adjusted, such as brightness, density, saturation, color, etc. Therefore, after adjusting the shadow display parameters based on the parameter adjustment target, the resulting adjusted shadow will have improved brightness, density, saturation, and color in at least one aspect, thereby achieving a better effect of revealing the illuminated object covered by the generated shadow.

[0074] In practical applications, optionally, the aforementioned parameter adjustment target can be at least one of the following: a pre-set parameter value, a parameter value calculated based on a ray tracing algorithm, or a parameter value obtained from the calculation results of a ray tracing algorithm. The parameter value can be the target value of the adjusted shadow display parameter. This technical solution provides a process for determining the parameter adjustment target, thereby ensuring the effectiveness of subsequent shadow display parameter adjustment.

[0075] The technical solution of this invention adjusts the shadow display parameters by obtaining the parameter adjustment target of the shadow display parameters to be adjusted, thereby improving at least one aspect of the adjusted shadow in terms of brightness, density, saturation and color, and thus achieving the effect of better displaying the illuminated object covered by the generated shadow.

[0076] Example 4

[0077] Figure 4 This is a structural block diagram of a shadow adjustment device provided in Embodiment 4 of the present invention. This device is used to execute the shadow adjustment method provided in any of the above embodiments. This device and the shadow adjustment methods of the above embodiments belong to the same inventive concept. Details not described in detail in the embodiments of the shadow adjustment device can be found in the embodiments of the shadow adjustment methods described above. See also... Figure 4The device may specifically include: a shadow acquisition module 410, a shadow separation module 420 to be adjusted, and a shadow acquisition module 430.

[0078] Among them, the shadow acquisition module 410 is used to acquire the shadow already generated corresponding to the shadow adjustment event and the illuminated object illuminated by the light source when a shadow adjustment event is detected;

[0079] The shadow separation module 420 is used to separate the shadow to be adjusted from the shadow on the illuminated object based on the positional relationship between the generated shadow and the illuminated object.

[0080] The adjusted shadow module 430 is used to adjust the shadow to be adjusted, thus obtaining the adjusted shadow.

[0081] Optionally, the generated shadow acquisition module 410 may include:

[0082] The texture acquisition unit is used to acquire the shadow texture that stores the shadows that have been generated, and the outline texture that stores the outline of the object illuminated by the light source, corresponding to the shadow adjustment event.

[0083] The positional relationship unit is used to compare the shadow map and the outline map to obtain the positional relationship between the generated shadow and the illuminated object.

[0084] Based on this, optionally, the positional relationship yields the element, which can be specifically used for:

[0085] The shadow pixels located on the generated shadows are sampled from the shadow map, and the object pixels located on the illuminated object are sampled from the contour map;

[0086] Based on the shadow position of each shadow pixel and the object position of each object pixel, the positional relationship between the generated shadow and the illuminated object is obtained.

[0087] Optionally, the shading has been adjusted to obtain module 430, which can be used specifically for:

[0088] Obtain the parameter adjustment target of the shadow display parameters to be adjusted, and adjust the shadow display parameters based on the parameter adjustment target to obtain the adjusted shadow, wherein the shadow display parameters include at least one of brightness, density, saturation and color.

[0089] In this regard, optionally, the parameter adjustment target includes at least one of the following: a pre-set parameter value, a parameter value calculated based on the ray tracing algorithm, and a parameter value obtained from the calculation results of the ray tracing algorithm.

[0090] Optionally, the generated shadow acquisition module 410 may include:

[0091] The shadow acquisition unit is used to acquire the generated shadow, parameter adjustment tool, and illuminated object illuminated by the light source corresponding to the shadow adjustment event. The parameter adjustment tool includes a parameter adjustment function and / or parameter adjustment map that takes the shadow display parameters of the shadow to be adjusted as input data and the parameter adjustment result as output data.

[0092] Accordingly, the shading has been adjusted to obtain module 430, which can be used specifically for:

[0093] Input the shadow display parameters of the shadow to be adjusted into the parameter adjustment tool, and obtain the adjusted shadow based on the parameter adjustment results output by the parameter adjustment tool.

[0094] Optionally, the above-mentioned shadow adjustment device may further include:

[0095] Unadjusted shadow separation module is used to separate unadjusted shadows that are not located on the illuminated object from the generated shadows;

[0096] The shadow rendering module is used to render both unadjusted and adjusted shadows.

[0097] The shadow adjustment device provided in Embodiment 4 of the present invention, through the cooperation of a generated shadow acquisition module and a shadow to be adjusted separation module, after acquiring the generated shadow corresponding to the detected shadow adjustment event and the illuminated object, can separate the shadow to be adjusted located on the illuminated object from the generated shadow based on the positional relationship between the generated shadow and the illuminated object. This shadow may be a shadow that makes the illuminated object appear very dark. Then, the adjusted shadow acquisition module adjusts the shadow to be adjusted to obtain the adjusted shadow. The above device, by separating the shadow to be adjusted that may make the illuminated object appear very dark from the generated shadow and then adjusting the shadow to be adjusted, solves the problem of large differences between the generated shadow covering the illuminated object and the real world. At the same time, the shadow adjustment process can be completed before rendering, thereby achieving the effect of saving computing power.

[0098] The shadow adjustment device provided in the embodiments of the present invention can execute the shadow adjustment method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method.

[0099] It is worth noting that in the embodiments of the above-mentioned shadow adjustment device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0100] Example 5

[0101] Figure 5 This is a schematic diagram of the structure of a shadow adjustment device provided in Embodiment 5 of the present invention. See also... Figure 5 The device includes a memory 510, a processor 520, an input device 530, and an output device 540. The number of processors 520 in the device can be one or more. Figure 5 Taking a processor 520 as an example; the memory 510, processor 520, input device 530, and output device 540 in the device can be connected via a bus or other means. Figure 5 Taking the connection via bus 550 as an example.

[0102] The memory 510, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the shadow adjustment method in this embodiment of the invention (e.g., the shadow acquisition module 410, the shadow separation module 420, and the shadow acquisition module 430 in the shadow adjustment device). The processor 520 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 510, thereby implementing the shadow adjustment method described above.

[0103] The memory 510 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on device usage. Furthermore, the memory 510 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 510 may further include memory remotely located relative to the processor 520, which can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0104] Input device 530 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 540 may include display devices such as a display screen.

[0105] Example 6

[0106] Embodiment 6 of the present invention provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a shadow adjustment method, the method comprising:

[0107] When a shadow adjustment event is detected, obtain the generated shadow corresponding to the shadow adjustment event, as well as the illuminated object illuminated by the light source;

[0108] Based on the positional relationship between the generated shadows and the illuminated object, separate the shadow to be adjusted located on the illuminated object from the generated shadows;

[0109] Adjust the shadow to be adjusted to obtain the adjusted shadow.

[0110] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the method operations described above, but can also perform related operations in the shadow adjustment method provided in any embodiment of the present invention.

[0111] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. According to this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0112] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A shadow adjustment method, characterized in that, include: When a shadow adjustment event is detected, the generated shadow corresponding to the shadow adjustment event and the illuminated object illuminated by the light source are obtained. The generated shadow is the shadow generated by the illuminated object after being illuminated by the light source and / or after being blocked by an occluded object. The occluded object is an object that blocks part of the light emitted by the light source from the illuminated object. The generated shadow includes the shadow to be adjusted located on the illuminated object and the shadows located on other objects besides the illuminated object. Based on the positional relationship between the generated shadow and the illuminated object, separate the shadow to be adjusted located on the illuminated object from the generated shadow; The shadow to be adjusted is adjusted to obtain an adjusted shadow, wherein the adjusted shadow is lighter in display effect compared to the shadow to be adjusted.

2. The method according to claim 1, characterized in that, The step of obtaining the generated shadow corresponding to the shadow adjustment event and the illuminated object illuminated by the light source includes: Obtain the shadow map corresponding to the shadow adjustment event, which stores the shadows that have been generated, and the outline map, which stores the outline of the object being illuminated by the light source. By comparing the shadow map and the contour map, the positional relationship between the generated shadow and the illuminated object is obtained.

3. The method according to claim 2, characterized in that, The step of comparing the shadow map and the contour map to obtain the positional relationship between the generated shadow and the illuminated object includes: The shadow pixels located on the generated shadow are sampled from the shadow map, and the object pixels located on the illuminated object are sampled from the contour map; The positional relationship between the generated shadow and the illuminated object is obtained based on the shadow position of each shadow pixel and the object position of each object pixel.

4. The method according to claim 1, characterized in that, The process of adjusting the shadow to obtain the adjusted shadow includes: Obtain the parameter adjustment target of the shadow display parameters of the shadow to be adjusted, and adjust the shadow display parameters based on the parameter adjustment target to obtain the adjusted shadow, wherein the shadow display parameters include at least one of brightness, density, saturation and color.

5. The method according to claim 4, characterized in that, The parameter adjustment target includes at least one of the following: a pre-set parameter value, a parameter value calculated based on a ray tracing algorithm, and a parameter value obtained based on the calculation result of the ray tracing algorithm.

6. The method according to claim 1, characterized in that, The step of obtaining the generated shadow corresponding to the shadow adjustment event and the illuminated object illuminated by the light source includes: Obtain the generated shadow, parameter adjustment tool, and illuminated object illuminated by the light source corresponding to the shadow adjustment event. The parameter adjustment tool includes a parameter adjustment function and / or a parameter adjustment map that takes the shadow display parameters of the shadow to be adjusted as input data and the parameter adjustment result as output data. The process of adjusting the shadow to obtain the adjusted shadow includes: The shadow display parameters of the shadow to be adjusted are input into the parameter adjustment tool, and the adjusted shadow is obtained based on the parameter adjustment result output by the parameter adjustment tool.

7. The method according to claim 1, characterized in that, Also includes: Separate the unadjusted shadows that are not located on the illuminated object from the generated shadows; Render the unadjusted shadows and the adjusted shadows.

8. A shadow adjustment device, characterized in that, include: The generated shadow acquisition module is used to acquire, when a shadow adjustment event is detected, the generated shadow corresponding to the shadow adjustment event and the illuminated object illuminated by the light source. The generated shadow is the shadow generated by the illuminated object after being illuminated by the light source and / or after being blocked by an occluded object. The occluded object is an object that blocks part of the light emitted by the light source from the illuminated object. The generated shadow includes the shadow to be adjusted located on the illuminated object and the shadows located on other objects besides the illuminated object. The shadow separation module is used to separate the shadow to be adjusted from the shadow on the illuminated object based on the positional relationship between the generated shadow and the illuminated object. The adjusted shadow module is used to adjust the shadow to be adjusted to obtain the adjusted shadow, wherein the adjusted shadow is lighter in display effect compared to the shadow to be adjusted.

9. A shading adjustment device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the shadow adjustment method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the shadow adjustment method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Identifying and modifying cast shadows in an image

    US9430715B1