A shadow adjustment method, device, apparatus and storage medium

By comparing the adjustment map and the outline map, and adjusting the parameters of the shadow pixels, the problem of pure black shadows was solved, the user experience was improved, and the shadow effect became closer to the real world.

CN115619840BActive Publication Date: 2025-12-09SHANGHAI MIHAYOULIYUE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110796865.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-14
Publication Date
2025-12-09
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 comparing the texture to be adjusted with the outline texture, the pixels of the illuminated object covered by the generated shadow are identified and adjusted, including parameters such as brightness, density, saturation and color, to render a shadow effect that is closer to the real world.

Benefits of technology

It solves the problem of pure black parts of the illuminated object being covered by the generated shadow, improves the user experience, and makes the shadow rendering effect more similar to the real world.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115619840B_ABST
    Figure CN115619840B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a shadow adjustment method, device and equipment and a storage medium. The method comprises: when a shadow adjustment event is detected, obtaining a to-be-adjusted map in which a generated shadow and an irradiated object irradiated by a light source correspond to the shadow adjustment event; obtaining an outline map obtained by rendering an object outline of the irradiated object extracted from the to-be-adjusted map, and comparing the to-be-adjusted map and the outline map to obtain to-be-adjusted pixel points of the irradiated object covered by the generated shadow in the to-be-adjusted map; adjusting the to-be-adjusted pixel points, and rendering an adjusted map according to a pixel point adjustment result. The technical solution of the embodiments of the present application can present the irradiated object covered by the generated shadow.
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 to-be-adjusted map in which the generated shadow and the illuminated object illuminated by the light source are stored, corresponding to the shadow adjustment event;

[0007] Obtaining an outline map obtained by rendering the object outline of the illuminated object extracted from the to-be-adjusted map, and comparing the to-be-adjusted map and the outline map to obtain the to-be-adjusted pixel points of the illuminated object covered by the generated shadow in the to-be-adjusted map;

[0008] Adjusting the to-be-adjusted pixel points, and rendering an adjusted map according to the pixel point adjustment result.

[0009] Optionally, comparing the to-be-adjusted map and the outline map to obtain the to-be-adjusted pixel points of the illuminated object covered by the generated shadow in the to-be-adjusted map can include:

[0010] Sampling the shadow pixel points located on the generated shadow from the to-be-adjusted map, and sampling the object pixel points located on the illuminated object from the outline map;

[0011] Taking the object pixel points that coincide with the shadow pixel points in space as the to-be-adjusted pixel points of the illuminated object covered by the generated shadow in the to-be-adjusted map.

[0012] Optionally, adjusting the to-be-adjusted pixel points can include:

[0013] The parameter adjustment target of the pixel point display parameter of the pixel point to be adjusted is obtained, and the pixel point display parameter is adjusted based on the parameter adjustment target, wherein the pixel point display parameter comprises at least one of brightness, density, saturation and color.

[0014] On this basis, the parameter adjustment target comprises at least one of a parameter value of the pixel point display parameter which is pre-set, calculated based on a ray tracing algorithm and obtained according to a calculation result of the ray tracing algorithm.

[0015] Optionally, the obtaining of the to-be-adjusted map which stores the generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event can comprise:

[0016] The parameter adjustment tool comprises a parameter adjustment function and / or a parameter adjustment map, wherein the parameter adjustment function takes the pixel point display parameter of the pixel point to be adjusted as input data and takes the parameter adjustment result as output data.

[0017] Correspondingly, the pixel point to be adjusted is adjusted, and the adjusted map is rendered according to the pixel point adjustment result.

[0018] The pixel point display parameter of the pixel point to be adjusted is input into the parameter adjustment tool, and the adjusted map is rendered according to the parameter adjustment result output by the parameter adjustment tool.

[0019] Optionally, the obtaining of the to-be-adjusted map which stores the generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event can comprise:

[0020] The generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event are obtained.

[0021] The generated shadow and the irradiated object are rendered respectively to obtain the to-be-adjusted map which stores the generated shadow and the irradiated object.

[0022] Optionally, the obtaining of the to-be-adjusted map which stores the generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event can comprise:

[0023] The irradiated object irradiated by the light source corresponding to the shadow adjustment event is obtained, and the irradiated object is rendered to obtain the object map which stores the irradiated object.

[0024] The relative position between the light source and the irradiated object is obtained, the generated shadow generated after the irradiated object is irradiated by the light source is rendered in the object map according to the relative position, and the to-be-adjusted map which stores the generated shadow and the irradiated object is obtained.

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

[0026] The to-be-adjusted map obtaining module is configured to, when the shadow adjustment event is detected, obtain a to-be-adjusted map in which the generated shadow and the irradiated object irradiated by the light source are stored, the to-be-adjusted map corresponding to the shadow adjustment event;

[0027] The to-be-adjusted pixel point obtaining module is configured to obtain a contour map obtained by rendering an object contour of the irradiated object extracted from the to-be-adjusted map, and compare the to-be-adjusted map and the contour map to obtain to-be-adjusted pixel points of the irradiated object covered by the generated shadow in the to-be-adjusted map.

[0028] The adjusted map rendering module is configured to adjust the to-be-adjusted pixel points, and render an adjusted map according to the pixel point adjustment result.

[0029] In a third aspect, the embodiments of the present application further provide a shadow adjustment device, which can include:

[0030] One or more processors;

[0031] A memory configured to store one or more programs;

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

[0033] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the shadow adjustment method provided by any of the embodiments of the present application.

[0034] The technical solution of the embodiments of the present application can extract an object contour of an irradiated object from a to-be-adjusted map in which the generated shadow and the irradiated object irradiated by the light source are stored, and compare the to-be-adjusted map and a contour map obtained by rendering the object contour, thereby obtaining to-be-adjusted pixel points of the irradiated object covered by the generated shadow in the to-be-adjusted map, which can be pixel points that make the irradiated object appear very black. Furthermore, the to-be-adjusted pixel points are adjusted, and an adjusted map is rendered according to the pixel point adjustment result. The above technical solution first renders the to-be-adjusted map in which the generated shadow and the irradiated object are stored, then adjusts the to-be-adjusted pixel points existing on the irradiated object and the generated shadow in the to-be-adjusted map, and then renders the pixel point adjustment result, thereby solving the problem of the part of the irradiated object covered by the generated shadow being pure black, and achieving the effect of presenting the irradiated object covered by the generated shadow. 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 the present 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, that is, from the observer's perspective, the tree itself can still be observed through the shadow covering it. However, the shadows determined by the computer are pure black, whether they are covering the tree or falling on the ground. This does not match the real world and results in a poor user experience.

[0042] In order to solve the problem of the pure black shadow covering the tree, an optional solution is to determine the shadow based on a ray tracing algorithm (hereinafter referred to as light tracking). Specifically, the human eye can see an object because the light source is just reflected into the human eye after shining on the object, at this time, the human eye is similar to a camera that can receive light. Similarly, in the computer light tracking, the light emitted by the camera hits an object, and after multiple reflections and refractions, the shadow in the real world can be simulated, at this time, the camera, the object that reflects and refracts the light after being hit by the light, etc. can be called a light source. However, the above-mentioned ray tracing algorithm consumes a lot of computer computing power, and it is not suitable for application in electronic devices with limited computing power, such as terminal devices running mobile games. Therefore, how to solve the problem of the pure black shadow covering the tree while saving computing power is the focus of the following embodiments.

[0043] Embodiment one

[0044] Figure 1 is a flowchart of a shadow adjustment method provided in the embodiment one of the present application. The present embodiment can be applied to the case of adjusting the generated shadow covering the irradiated object. The method can be executed by the shadow adjustment device provided in the embodiment of the present application, which can be realized by software and / or hardware, and can be integrated on the shadow adjustment device, which can be various user terminals or servers.

[0045] Referring to Figure 1 , the method of the embodiment of the present application specifically includes the following steps:

[0046] S110, when detecting a shadow adjustment event, acquiring a to-be-adjusted map in which the generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event are stored.

[0047] The shadow adjustment event can be triggered when the generated shadow overlaid on the irradiated object needs to be adjusted. The irradiated object can be an object irradiated by a light source. The generated shadow can be a shadow generated by the irradiated object after being irradiated by the light source and / or blocked by a blocking object. The blocking object can be an object that blocks part of the light emitted by the light source from reaching the irradiated object. In actual applications, the generated shadow can be a to-be-adjusted shadow (which can also be referred to as a self-shadow) falling on the irradiated object, or a shadow projected on an object other than the irradiated object (such as the ground, a wall, a building, etc.), and the like, which are not limited herein. In other words, the to-be-adjusted shadow can be a shadow generated by the irradiated object after being irradiated by the light source, or a shadow projected by a blocking object, and the like, which are not limited herein. The to-be-adjusted map can be a map in which the generated shadow and the irradiated object are stored. In actual applications, the to-be-adjusted map can be obtained by real-time calculation or pre-stored, which is not limited herein. In addition, in a computer, a map can be understood as a buffer similar to a mask or a memory, that is, the to-be-rendered object existing in the rendering requirement can be drawn on the buffer first, and then the buffer is output to the display screen. Therefore, in the to-be-adjusted map, the generated shadow and the irradiated object can be to-be-rendered objects.

[0048] In actual applications, the shadow adjustment event can be triggered before, during or after the rendering of the to-be-rendered interface containing the irradiated object and the generated shadow, which means that when the shadow adjustment event is detected, it can be determined which to-be-adjusted map the generated shadow overlaid on the irradiated object needs to be adjusted according to the shadow adjustment event, so as to obtain the to-be-adjusted map corresponding to the shadow adjustment event. The generated shadow in the to-be-adjusted map at this time can be black.

[0049] S120, obtaining a contour map obtained after rendering the object contour of the irradiated object extracted from the to-be-adjusted map, and comparing the to-be-adjusted map and the contour map to obtain the to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map.

[0050] The object contour can be a contour extracted from the to-be-adjusted map and capable of reflecting an object shape of the irradiated object. After rendering the object contour, a contour map storing the object contour can be obtained. The contour map can be understood as a result of drawing the object contour on a buffer. Since the to-be-adjusted map can indicate positions where the generated shadow exists, and the contour map can indicate positions where the irradiated object exists, the to-be-adjusted map and the contour map can be compared to obtain to-be-adjusted pixel points of the irradiated object covered by the generated shadow in the to-be-adjusted map. The to-be-adjusted pixel points can be pixel points in the to-be-adjusted map that exist in the generated shadow and the irradiated object at the same time and need to be adjusted. The to-be-adjusted pixel points can be black at this time. The shadow formed by the to-be-adjusted pixel points can be the to-be-adjusted shadow described above.

[0051] S130, adjusting the to-be-adjusted pixel points, and rendering an adjusted map according to a pixel point adjustment result.

[0052] As described above, since the to-be-adjusted pixel points of the overlapping part of the generated shadow and the irradiated object are black, the irradiated object covered by the generated shadow cannot be presented, which is not consistent with the real world and the user experience is poor. Therefore, in order to present the irradiated object covered by the generated shadow, so that the display effect of the irradiated object is similar to that in the real world, the to-be-adjusted pixel points can be adjusted after being obtained, such as removing some to-be-adjusted pixel points, adjusting pixel point display parameters of the to-be-adjusted pixel points, and the like, which are not limited specifically herein. The pixel point display parameters can be parameters related to the display effect of the to-be-adjusted pixel points, such as brightness, density, saturation, color, and the like. Thus, compared with the to-be-adjusted pixel points, the adjusted pixel points (i.e., the pixel point adjustment result) obtained after adjusting the to-be-adjusted pixel points are lighter in display effect. Therefore, in the adjusted map rendered according to the pixel point adjustment result, the irradiated object covered by the generated shadow can be presented, which is similar to the display effect in the real world, and the user experience is better. It should be noted that the drawing process of the adjusted map can be understood as a process of redrawing the irradiated object covered by the generated shadow in the to-be-adjusted map. The adjustment process of the to-be-adjusted pixel points can be understood as an adjustment process of the to-be-adjusted shadow formed by the to-be-adjusted pixel points.

[0053] In actual application, for the pixel points of the generated shadow falling on the remaining objects other than the irradiated object, it can be adjusted as the pixel points to be adjusted, or can not be adjusted, which is not limited here. Exemplarily, the pixel points of the generated shadow other than the pixel points to be adjusted are taken as the unadjusted pixel points, thereby distinguishing the pixel points of the generated shadow covering the irradiated object and the pixel points of the generated shadow covering the remaining objects other than the irradiated object; the unadjusted pixel points and the adjusted pixel points are rendered, thereby weakening the pixel points to be adjusted and retaining the unadjusted pixel points in the adjusted map rendered compared with the map to be adjusted, which can ensure that the irradiated object covered by the generated shadow can be presented, and will not affect the presentation effect of the remaining objects covered by the generated shadow. In order to better understand the technical effect brought by the above exemplary scheme, the following will continue to take the light source irradiating on the tree as an example for brief description. Since there are shadows (i.e. the adjusted shadow) between the leaves of the tree and the leaves, in order to avoid the tree appearing very black, the shadows between the leaves and the shadows of the whole tree projected on the ground (i.e. the unadjusted shadow) can be distinguished by adjusting the pixel points to be adjusted of the adjusted shadow, i.e. weakening the adjusted shadow and retaining the unadjusted shadow, thereby rendering the rendered interface similar to the real world.

[0054] The technical scheme of the embodiment of the present application can obtain the adjusted map of the generated shadow and the irradiated object irradiated by the light source corresponding to the detected shadow adjustment event, extract the object contour of the irradiated object from the adjusted map, and compare the adjusted map with the contour map obtained by rendering the object contour, thereby obtaining the pixel points to be adjusted of the irradiated object covered by the generated shadow in the adjusted map, which can make the irradiated object appear very black. Further, the pixel points to be adjusted are adjusted, and the adjusted map is rendered according to the pixel point adjustment result. The above technical scheme first renders the adjusted map storing the generated shadow and the irradiated object, then adjusts the pixel points to be adjusted existing in the irradiated object and the generated shadow in the adjusted map, and then renders the pixel point adjustment result, thereby solving the problem of the pure black part of the irradiated object covered by the generated shadow, and achieving the effect of presenting the irradiated object covered by the generated shadow.

[0055] An optional technical solution compares the to-be-adjusted map and the contour map to obtain to-be-adjusted pixel points of the irradiated object covered by the generated shadow in the to-be-adjusted map, which can include: sampling a shadow pixel point on the generated shadow from the to-be-adjusted map and sampling an object pixel point on the irradiated object from the contour map; and taking each object pixel point that coincides in space with the shadow pixel point as a to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map. The shadow pixel point can be a pixel point on the generated shadow in the to-be-adjusted map, and the object pixel point can be a pixel point on the irradiated object in the contour map. Further, each object pixel point that coincides in space with the shadow pixel point can be taken as a to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map, or each shadow pixel point that coincides in space with the object pixel point can be taken as a to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map. The above technical solution obtains the to-be-adjusted pixel points that belong to both the generated shadow and the irradiated object through pixel point sampling, thereby achieving the effect of accurate determination of the to-be-adjusted pixel points.

[0056] In another alternative technical solution, the obtaining of the to-be-adjusted map stored with the generated shadow and the illuminated object illuminated by the light source corresponding to the shadow adjustment event can include: obtaining the to-be-adjusted map stored with the generated shadow and the illuminated object illuminated by the light source corresponding to the shadow adjustment event, and a parameter adjustment tool, wherein the parameter adjustment tool includes a parameter adjustment function and / or a parameter adjustment map taking the pixel display parameter of the to-be-adjusted pixel point as input data and outputting a parameter adjustment result; and correspondingly, the adjusting of the to-be-adjusted pixel point and the rendering of the adjusted map according to the pixel adjustment result can include: inputting the pixel display parameter of the to-be-adjusted pixel point into the parameter adjustment tool, and rendering the adjusted map according to the parameter adjustment result output by the parameter adjustment tool. As described above, the pixel display parameter can be a parameter related to the display effect of the to-be-adjusted pixel point, such as brightness, density, saturation, color, etc.; the parameter adjustment tool can be a tool for adjusting the pixel display parameter, which can be displayed in the form of a parameter adjustment function, a parameter adjustment map, etc., and is not limited here. In actual application, the parameter adjustment tool can be understood as a tool storing a parameter adjustment target, which can adjust the pixel display parameter based on the stored parameter adjustment target after inputting the pixel display parameter of the to-be-adjusted pixel point into the parameter adjustment tool, and then output the adjusted pixel display parameter (i.e. the parameter adjustment result), so that the adjusted map can be rendered according to the parameter adjustment result output by the parameter adjustment tool; alternatively, the parameter adjustment map can be a map storing a parameter adjustment function, and can also be other maps capable of realizing the parameter adjustment function, which is not limited here; and in different situations (such as different light source directions, different shapes of illuminated objects, etc.), the parameter adjustment tool of the to-be-adjusted pixel point can be the same or different, which is also not limited here. The above technical solution realizes the adjustment process of the to-be-adjusted pixel point based on the parameter adjustment tool, thereby achieving the effect of quickly and accurately adjusting the pixel point.

[0057] Embodiment Two

[0058] Figure 2 is a flowchart of a shadow adjustment method provided in Embodiment Two of the present application. This embodiment is optimized based on the above technical solutions. In this embodiment, the adjusting of the to-be-adjusted pixel point can include: obtaining a parameter adjustment target of the pixel display parameter of the to-be-adjusted pixel point, and adjusting the pixel display parameter based on the parameter adjustment target, wherein the pixel display parameter includes at least one of brightness, density, saturation and color. The explanations of the same or corresponding terms as in the above embodiments are not repeated here.

[0059] Reference is made to Figure 2The method of the embodiment can specifically include the following steps:

[0060] S210, when a shadow adjustment event is detected, a to-be-adjusted map in which the generated shadow and the irradiated object irradiated by the light source are stored is acquired corresponding to the shadow adjustment event.

[0061] S220, a contour map obtained after rendering an object contour of the irradiated object extracted from the to-be-adjusted map is acquired, and the to-be-adjusted map and the contour map are compared to obtain a to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map.

[0062] S230, a parameter adjustment target of a pixel point display parameter of the to-be-adjusted pixel point is acquired, and the pixel point display parameter is adjusted based on the parameter adjustment target, wherein the pixel point display parameter includes at least one of brightness, concentration, saturation, and color.

[0063] The parameter adjustment target can be a target for adjusting the pixel point display parameter, such as increasing, decreasing, or keeping the same, and the pixel point display parameter can be a parameter related to the display effect of the to-be-adjusted pixel point, such as brightness, concentration, saturation, color, etc. Thus, after adjusting the pixel point display parameter based on the parameter adjustment target, the adjusted pixel point obtained thereby is improved in at least one of brightness, concentration, saturation, and color compared to the to-be-adjusted pixel point, thereby achieving the effect of better revealing the irradiated object covered by the generated shadow.

[0064] In actual application, the parameter adjustment target can be at least one of a parameter value of the pixel point display parameter pre-set, calculated based on a ray tracing algorithm, and obtained according to the calculation result of the ray tracing algorithm. The parameter value can be a target value of the adjusted pixel point display parameter, and the technical solution provides a determination process of the parameter adjustment target, thereby ensuring the parameter adjustment effect of the pixel point display parameter.

[0065] S240, an adjusted map is rendered according to the pixel point adjustment result.

[0066] The technical solution of the embodiment of the application adjusts the pixel point display parameter based on the parameter adjustment target of the pixel point display parameter of the to-be-adjusted pixel point, and the adjusted pixel point obtained thereby is improved in at least one of brightness, concentration, saturation, and color compared to the to-be-adjusted pixel point, thereby achieving the effect of better revealing the irradiated object covered by the generated shadow.

[0067] Embodiment three

[0068] Figure 3is a flowchart of a shadow adjustment method provided in Embodiment Three of the present application. The present embodiment is optimized on the basis of the technical solutions in the above embodiments. In the present embodiment, optionally, obtaining the to-be-adjusted map storing the generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event can include: obtaining the generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event, and rendering the generated shadow and the irradiated object respectively to obtain the to-be-adjusted map storing the generated shadow and the irradiated object simultaneously; or obtaining the irradiated object irradiated by the light source corresponding to the shadow adjustment event, rendering the irradiated object to obtain the object map storing the irradiated object, and obtaining the relative position between the light source and the irradiated object, rendering the generated shadow generated after the irradiated object is irradiated by the light source in the object map according to the relative position to obtain the to-be-adjusted map storing the generated shadow and the irradiated object. The explanations of the same or corresponding terms as in the above embodiments are not repeated here.

[0069] Referring to Figure 3 The method of the present embodiment can specifically include the following steps:

[0070] S310, obtaining the generated shadow and the irradiated object irradiated by the light source corresponding to the shadow adjustment event, and rendering the generated shadow and the irradiated object respectively to obtain the to-be-adjusted map storing the generated shadow and the irradiated object simultaneously.

[0071] The generated shadow and the irradiated object can be rendered in the same buffer (i.e. the to-be-adjusted map), and the rendering order of the two can be one before the other, in which case the priority of the two can be determined to determine who renders first and who renders last; or the two can be rendered simultaneously, etc., which is not specifically limited here. In fact, each part of the irradiated object can also have a rendering order. Taking the irradiated object including a tree as an example, the vertices, leaves and veins of the tree can be drawn in turn; of course, each part can also be rendered simultaneously, which is not specifically limited here.

[0072] In actual applications, optionally, the rendering processes of the generated shadow and the irradiated object can both be based on data calculation first and then rendering the calculation results, such as calculating the generated shadow (i.e. the calculation result) based on the shadow data of the generated shadow first and then rendering the generated shadow; the rendering process of the irradiated object is similar, i.e. calculating the irradiated object (i.e. the calculation result) based on the object data of the irradiated object first and then rendering the irradiated object, i.e. the rendering process of the generated shadow and the rendering process of the irradiated object are independent of each other.

[0073] S320, obtaining the irradiated object irradiated by the light source corresponding to the shadow adjustment event, and rendering the irradiated object to obtain the object map storing the irradiated object.

[0074] S330, acquire the relative position between the light source and the irradiated object, render the generated shadow generated after the irradiated object is irradiated by the light source in the object map according to the relative position, and obtain the to-be-adjusted map in which the generated shadow and the irradiated object are stored.

[0075] The relative position can be the relative position of the light source and the irradiated object in space, which can be represented by the relative distance, the relative direction, i.e., the irradiation direction of the light source, and the like. Thus, the generated shadow generated after the irradiated object is irradiated by the light source can be calculated according to the relative position, or the generated shadow generated after the irradiated object is irradiated by the light source can be calculated according to the relative position and the object shape of the irradiated object, and then the generated shadow is rendered in the object map, so that the to-be-adjusted map in which the generated shadow and the irradiated object are stored is obtained. That is, the rendering process of the generated shadow can depend on the rendering result of the irradiated object.

[0076] It should be noted that S310 describes a determination scheme of the to-be-adjusted map, and S320 and S330 describe another determination scheme of the to-be-adjusted map. In actual application, one of the two determination schemes can be selected for execution, and the specific limitation is not made herein.

[0077] S340, acquire the contour map obtained after the object contour of the irradiated object extracted from the to-be-adjusted map is rendered, and compare the to-be-adjusted map and the contour map to obtain the to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map.

[0078] S350, adjust the to-be-adjusted pixel point, and render the adjusted map according to the pixel point adjustment result.

[0079] The technical scheme of the embodiment of the present application realizes the effective acquisition of the to-be-adjusted map by independently rendering the generated shadow and the irradiated object, or rendering the generated shadow based on the rendering result of the irradiated object after the irradiated object is rendered.

[0080] Embodiment four

[0081] Figure 4 The structure block diagram of the shadow adjustment device provided in the fourth embodiment of the present application is used to execute the shadow adjustment method provided in any of the above embodiments. The device and the shadow adjustment method of each of the above embodiments belong to the same inventive concept, and the details not described in the embodiment of the shadow adjustment device can be referred to the above embodiments of the shadow adjustment method. For example, Figure 4As shown, the apparatus can specifically include: a to-be-adjusted map obtaining module 410, a to-be-adjusted pixel point obtaining module 420, and an adjusted map rendering module 430. Among them,

[0082] The to-be-adjusted map obtaining module 410 is configured to, when detecting a shadow adjustment event, obtain a to-be-adjusted map in which a generated shadow and an irradiated object irradiated by a light source are stored, corresponding to the shadow adjustment event;

[0083] The to-be-adjusted pixel point obtaining module 420 is configured to obtain an outline map obtained after rendering an object outline of the irradiated object extracted from the to-be-adjusted map, and compare the to-be-adjusted map and the outline map to obtain to-be-adjusted pixel points of the irradiated object covered by the generated shadow in the to-be-adjusted map.

[0084] The adjusted map rendering module 430 is configured to adjust the to-be-adjusted pixel points, and render an adjusted map according to the pixel point adjustment result.

[0085] Optionally, the to-be-adjusted pixel point obtaining module 420 can include:

[0086] The pixel point sampling unit is configured to sample a shadow pixel point located on the generated shadow from the to-be-adjusted map, and sample an object pixel point located on the irradiated object from the outline map.

[0087] The to-be-adjusted pixel point obtaining unit is configured to take an object pixel point that spatially coincides with the shadow pixel point among the object pixel points as a to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map.

[0088] Optionally, the adjusted map rendering module 430 can include:

[0089] The to-be-adjusted pixel point adjustment unit is configured to obtain a parameter adjustment target of a pixel point display parameter of the to-be-adjusted pixel point, and adjust the pixel point display parameter based on the parameter adjustment target, wherein the pixel point display parameter includes at least one of brightness, density, saturation, and color.

[0090] On this basis, optionally, the parameter adjustment target includes at least one of a parameter value of the pixel point display parameter calculated based on a ray tracing algorithm and obtained according to a calculation result of the ray tracing algorithm.

[0091] Optionally, the to-be-adjusted map obtaining module 410 can include:

[0092] The parameter adjustment tool obtaining unit is configured to obtain a parameter adjustment tool corresponding to the shadow adjustment event, and the parameter adjustment tool comprises a parameter adjustment function and / or a parameter adjustment map, wherein the parameter adjustment function takes the pixel display parameter of the to-be-adjusted pixel point as input data and takes a parameter adjustment result as output data, and the parameter adjustment map stores the generated shadow and the illuminated object illuminated by the light source.

[0093] Correspondingly, the adjusted map rendering module 430 can be specifically configured to:

[0094] input the pixel display parameter of the to-be-adjusted pixel point into the parameter adjustment tool, and render the adjusted map according to the parameter adjustment result output by the parameter adjustment tool.

[0095] Optionally, the to-be-adjusted map obtaining module 410 can comprise:

[0096] The illuminated object obtaining unit is configured to obtain the generated shadow corresponding to the shadow adjustment event and the illuminated object illuminated by the light source.

[0097] The first to-be-adjusted map obtaining unit is configured to render the generated shadow and the illuminated object respectively, and obtain the to-be-adjusted map which simultaneously stores the generated shadow and the illuminated object.

[0098] Optionally, the to-be-adjusted map obtaining module 410 can comprise:

[0099] The object map obtaining unit is configured to obtain the illuminated object illuminated by the light source corresponding to the shadow adjustment event, render the illuminated object, and obtain the object map which stores the illuminated object.

[0100] The second to-be-adjusted map obtaining unit is configured to obtain the relative position between the light source and the illuminated object, and render the generated shadow generated after the illuminated object is illuminated by the light source in the object map according to the relative position, and obtain the to-be-adjusted map which stores the generated shadow and the illuminated object.

[0101] The shadow adjusting device provided in the fourth embodiment of the present application is capable of obtaining the object contour of the irradiated object from the to-be-adjusted map by cooperation of the to-be-adjusted map obtaining module and the to-be-adjusted pixel point obtaining module, comparing the to-be-adjusted map and the contour map obtained by rendering the object contour, and thus obtaining the to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map, which is likely to make the irradiated object appear very black. Then, the to-be-adjusted pixel point is adjusted by the adjusted map rendering module, and the adjusted map is rendered according to the pixel point adjustment result. The above device renders the to-be-adjusted map storing the generated shadow and the irradiated object, adjusts the to-be-adjusted pixel point existing on the irradiated object and the generated shadow in the to-be-adjusted map, and then renders the pixel point adjustment result, thereby solving the problem of the black part of the irradiated object covered by the generated shadow and achieving the effect of presenting the irradiated object covered by the generated shadow.

[0102] The shadow adjusting device provided in the embodiments of the present application can execute the shadow adjusting method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.

[0103] It should be noted that in the embodiments of the above shadow adjusting device, each unit and module included is only divided according to the function logic, but is not limited to the above division, as long as the corresponding function can be realized; in addition, the specific name of each functional unit is only for the convenience of mutual differentiation, and is not used to limit the protection scope of the present application.

[0104] Embodiment five

[0105] Figure 5 The structural schematic diagram of a shadow adjusting device provided in the fifth embodiment of the present application is shown in 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 and the processor 520 in the above is taken as an example; the memory 510, the processor 520, the input device 530, and the output device 540 in the device can be connected through a bus or other means, Figure 5 and the connection through the bus 550 is taken as an example.

[0106] The memory 510, as a computer readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the shadow adjusting method in the embodiment of the present application (for example, the to-be-adjusted map obtaining module 410, the to-be-adjusted pixel point obtaining module 420 and the adjusted map rendering module 430 in the shadow adjusting device). The processor 520 executes the software programs, instructions and modules stored in the memory 510, thereby performing various function applications and data processing of the device, that is, implementing the shadow adjusting method described above.

[0107] The memory 510 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and application programs required by at least one function; the data storage area can store data created according to the use of the device, etc. In addition, the memory 510 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state memory device. In some examples, the memory 510 can further include a memory remotely arranged with respect to the processor 520, which can be connected to the device through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0108] The input device 530 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device 540 can include a display device such as a display screen.

[0109] Embodiment six

[0110] The embodiment six of the present application provides a storage medium containing computer executable instructions, which when executed by a computer processor, are used to perform a shadow adjusting method, the method comprising:

[0111] When a shadow adjusting event is detected, a to-be-adjusted map in which a generated shadow and an irradiated object irradiated by a light source are stored is obtained corresponding to the shadow adjusting event;

[0112] A contour map obtained after rendering an object contour of the irradiated object extracted from the to-be-adjusted map is obtained, and the to-be-adjusted map and the contour map are compared to obtain a to-be-adjusted pixel point of the irradiated object covered by the generated shadow in the to-be-adjusted map;

[0113] The to-be-adjusted pixel point is adjusted, and an adjusted map is rendered according to the pixel point adjustment result.

[0114] Of course, the storage medium provided by the embodiments of the present application contains computer executable instructions, which are not limited to the method operations described above, but can also perform the related operations in the shadow adjustment method provided by any embodiment of the present application.

[0115] Through the above description of the embodiments, those skilled in the art can clearly understand that the present application can be realized by software and necessary general hardware, and of course can also be realized by hardware, but in many cases the former is a better embodiment. According to such understanding, the technical solutions of the present application or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a floppy disk, a read-only memory (ROM), a random access memory (RAM), a FLASH, a hard disk or an optical disk, etc., including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the method described in each embodiment of the present application.

[0116] Note that the above is only the preferred embodiment of the present application and the technical principle applied. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and those skilled in the art can make various obvious changes, readjustments and substitutions without departing from the scope of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims

1. A method of shadow adjustment, characterized by, The method comprises the following steps: Upon detecting a shadow adjustment event, obtaining a to-be-adjusted map corresponding to the shadow adjustment event, the to-be-adjusted map storing a generated shadow and an illuminated object illuminated by a light source; obtaining an outline map obtained by rendering an object outline of the illuminated object extracted from the to-be-adjusted map, and sampling a shadow pixel point located on the generated shadow from the to-be-adjusted map and an object pixel point located on the illuminated object from the outline map; wherein the object outline is an outline capable of reflecting an object shape of the illuminated object extracted from the to-be-adjusted map; taking the object pixel point that spatially coincides with the shadow pixel point as a to-be-adjusted pixel point of the illuminated object covered by the generated shadow in the to-be-adjusted map; obtaining a parameter adjustment target of a pixel point display parameter of the to-be-adjusted pixel point, adjusting the pixel point display parameter based on the parameter adjustment target, and rendering an adjusted map according to a pixel point adjustment result; wherein the pixel point display parameter comprises at least one of brightness, density, saturation, and color.

2. The method of claim 1, wherein, The parameter adjustment target comprises at least one of a parameter value of the pixel point display parameter calculated based on a ray tracing algorithm and obtained according to a calculation result of the ray tracing algorithm.

3. The method of claim 1, wherein, The method comprises the following steps: obtaining a to-be-adjusted map corresponding to the shadow adjustment event, the to-be-adjusted map storing a generated shadow and an illuminated object illuminated by a light source, and a parameter adjustment tool, wherein the parameter adjustment tool comprises a parameter adjustment function and / or a parameter adjustment map taking the pixel point display parameter of the to-be-adjusted pixel point as input data and outputting a parameter adjustment result; The method comprises the following steps: inputting the pixel point display parameter of the to-be-adjusted pixel point into the parameter adjustment tool, and rendering an adjusted map according to the parameter adjustment result output by the parameter adjustment tool.

4. The method of claim 1, wherein, The method comprises the following steps: obtaining a generated shadow corresponding to the shadow adjustment event and an illuminated object illuminated by a light source; rendering the generated shadow and the illuminated object respectively to obtain a to-be-adjusted map storing the generated shadow and the illuminated object.

5. The method of claim 1, wherein, The method comprises the following steps: obtaining an illuminated object illuminated by a light source corresponding to the shadow adjustment event, and rendering the illuminated object to obtain an object map storing the illuminated object. Obtaining a relative position between the light source and the illuminated object, rendering a generated shadow generated after the illuminated object is illuminated by the light source in the object map according to the relative position, and obtaining a to-be-adjusted map in which the generated shadow and the illuminated object are stored.

6. A shadow adjustment device, characterized by The method comprises the steps of: a to-be-adjusted map obtaining module, configured to obtain a to-be-adjusted map in which a generated shadow and an illuminated object illuminated by a light source are stored when a shadow adjustment event is detected; a to-be-adjusted pixel obtaining module, configured to obtain a contour map obtained after rendering an object contour of the illuminated object extracted from the to-be-adjusted map, sample a shadow pixel point located on the generated shadow from the to-be-adjusted map, and sample an object pixel point located on the illuminated object from the contour map; wherein the object contour is an outline extracted from the to-be-adjusted map and capable of reflecting an object shape of the illuminated object; and the object pixel point in each object pixel point that coincides with the shadow pixel point in space is taken as a to-be-adjusted pixel point of the illuminated object covered by the generated shadow in the to-be-adjusted map; an adjusted map rendering module, configured to obtain a parameter adjustment target of a pixel point display parameter of the to-be-adjusted pixel point, adjust the pixel point display parameter based on the parameter adjustment target, and render an adjusted map according to a pixel point adjustment result; wherein the pixel point display parameter comprises at least one of brightness, density, saturation, and color.

7. A shadow adjustment device, characterized by The method comprises the steps of: one or more processors; a memory configured 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 according to any one of claims 1-5.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the shadow adjustment method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Identifying and modifying cast shadows in an image

    US9430715B1