A method and device for determining a shadow map

By obtaining and comparing video frames of 3D game scenes in the terminal and dynamically drawing shadow maps of objects, the problem of fixed shadows in the prior art is solved, and the authenticity and user experience of 3D games are improved.

CN114283267BActive Publication Date: 2025-02-07JINGCAI ON LINE TECH DALIAN CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111596378.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-02-11
Publication Date
2025-02-07
Estimated Expiration
2038-02-11

AI Technical Summary

Technical Problem

In the prior art, the shadow of an object in a terminal simulates the 3D game scene is fixed and cannot change with the change of light, resulting in the shadow being not realistic enough, reducing the authenticity and user experience of the 3D game.

Method used

By obtaining the current video frame and the previous video frame of the application scene, it is determined whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object already displayed in the previous video frame. If different, draw a shadow map of the object to be displayed in the current video frame to make the shadow more realistic.

Benefits of technology

It realizes dynamic updates of object shadows in application scenarios, making the shadows more realistic and improving the user experience in application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114283267B_ABST
    Figure CN114283267B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a shadow map determination method and device, which obtains a current video frame of an application scene and a previous video frame of the current video frame; obtains a first 3D view cone of the current video frame and a second 3D view cone of the previous video frame respectively; divides the first 3D view cone and the second 3D view cone respectively to obtain a first type of sub-3D view cone and a second type of sub-3D view cone; sorts the segmentation results, and determines the first type of sub-3D view cone and the second type of sub-3D view cone with the same sequence number as a sub-3D view cone pair; calculates the change value of the coordinate of the center point of the sub-3D view cone of the sub-3D view cone pair in a preset coordinate system; if there is no change value greater than the preset value, determines the shadow map of the object displayed in the previous video frame as the shadow map of the object to be displayed in the current video frame; if there is a shadow map of the object to be displayed in the current video frame, the shadow of the object in the application scene can be made more realistic, thereby improving the user experience of the user in the application scene.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a Chinese patent application filed with the China Patent Office on February 11, 2018, with application number 201810140973.3 and invention name “A method and device for determining a shadow map”. Technical Field

[0002] The present invention relates to the technical field of image processing, and in particular to a shadow map determination method and device. Background Art

[0003] In order to improve the user experience in the application scene, the shadow of the object will be displayed in the application scene, wherein the application scene can be: 3D animation scene, 3D movie scene, 3D game scene, etc.

[0004] The following is an example of a 3D game scene. When the terminal is running a 3D game, in order to allow the user to have a more realistic experience in the game that is closer to the real environment, the terminal will simulate the shadow of the object in the 3D game scene. The specific implementation method of the terminal simulating the shadow of the object in the 3D game scene is to draw a shadow map of the object in the 3D game scene, and determine the drawn shadow map of the object in the 3D game scene as the shadow of the object in the 3D game scene.

[0005] In the prior art, when a terminal simulates the shadow of an object in a 3D game scene, a shadow map that has been drawn is generally stored in the terminal in advance. When the terminal runs a 3D game, the pre-stored shadow map is directly determined as the shadow map of the object in the 3D game scene.

[0006] In the above method, the shadows of objects in the 3D game scene simulated by the terminal are fixed and cannot change with the change of light in the 3D game scene. Therefore, the shadows of objects in the simulated 3D game scene are not realistic enough, which reduces the authenticity of the 3D game and poor user experience. Summary of the invention

[0007] The purpose of the embodiment of the present invention is to provide a shadow map determination method and device, so as to make the shadow of an object in an application scene more realistic and improve the user experience of the user in the application scene. The specific technical solution is as follows:

[0008] In a first aspect, an embodiment of the present invention provides a shadow map determination method, the method comprising:

[0009] Acquire a current video frame of the application scene and a video frame previous to the current video frame;

[0010] Determining whether a shadow map of an object to be displayed in the current video frame is the same as a shadow map of an object displayed in the previous video frame;

[0011] If they are the same, determining the shadow map of the object displayed in the previous video frame as the shadow map of the object to be displayed in the current video frame;

[0012] If they are not the same, a shadow map of the object to be displayed in the current video frame is drawn.

[0013] Optionally, the determining whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame includes:

[0014] Obtaining a 3D view cone of the current video frame as a first 3D view cone, and obtaining a 3D view cone of the previous video frame as a second 3D view cone;

[0015] The first 3D viewing cone and the second 3D viewing cone are used to determine whether a shadow map of an object to be displayed in the current video frame is the same as a shadow map of an object displayed in the previous video frame.

[0016] Optionally, the using the first 3D viewing cone and the second 3D viewing cone to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame includes:

[0017] Obtaining coordinates of a center point of the first 3D view cone in a preset coordinate system as first coordinates, and obtaining coordinates of a center point of the second 3D view cone in a preset coordinate system as second coordinates;

[0018] Compare the first coordinate with the second coordinate to obtain a coordinate change value;

[0019] Determining whether the coordinate change value is greater than a preset change value;

[0020] If it is greater than, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0021] If it is less than, it is determined that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0022] Optionally, the using the first 3D viewing cone and the second 3D viewing cone to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame includes:

[0023] According to a preset segmentation rule, the first 3D view cone is segmented to obtain a first type of sub-3D view cones, and the second 3D view cone is segmented to obtain a second type of sub-3D view cones;

[0024] Sort the sub-3D view cones in the segmentation result corresponding to the segmentation rule, and determine the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number as a sub-3D view cone pair;

[0025] Calculate the change in coordinates of the center points of two sub-3D view cones in the sub-3D view cone pair in the preset coordinate system;

[0026] Determine whether there is a change value greater than a preset value among the obtained change values;

[0027] If so, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0028] If not, determining that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame;

[0029] The step of drawing a shadow map of the object to be displayed in the current video frame includes:

[0030] Draw a shadow map of an object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame, and determine the shadow map of an object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of an object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame, wherein the third type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value greater than the preset value in the obtained change value, the fourth type of sub-3D visual cone is: a sub-3D visual cone with the same order as the fifth type of sub-3D visual cone, the fifth type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value less than the preset value in the obtained change value, the third type of sub-3D visual cone is a sub-3D visual cone in the first type of sub-3D visual cone, the fourth type of sub-3D visual cone is a sub-3D visual cone in the second type of sub-3D visual cone, and the fifth type of sub-3D visual cone is a sub-3D visual cone in the first type of sub-3D visual cone except the third type of sub-3D visual cone.

[0031] Optionally, before drawing the shadow map of the object in the corresponding area of ​​the third type of sub-3D view cone in the current video frame, the method further includes:

[0032] Determine whether there is an object in the corresponding area of ​​the third type of sub-3D visual cone in the current video frame;

[0033] If so, executing the step of drawing a shadow map of the object in the corresponding area of ​​the third type of sub-3D viewing cone in the current video frame;

[0034] Accordingly, before determining the shadow map of the object of the fourth type of sub-3D view cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D view cone in the corresponding area of ​​the current video frame, the method further includes:

[0035] Determine whether there is an object in the corresponding area of ​​the fifth type of sub-3D visual cone in the current video frame;

[0036] If so, the step of determining the shadow map of the object in the corresponding area of ​​the fourth type of sub-3D viewing cone in the previous video frame as the shadow map of the object in the corresponding area of ​​the fifth type of sub-3D viewing cone in the current video frame is performed.

[0037] Optionally, after drawing the shadow map of the object to be displayed in the current video frame, the method further includes:

[0038] The drawn shadow map of the object to be displayed in the current video frame is saved.

[0039] Optionally, after drawing the shadow map of the object to be displayed in the current video frame, the method further includes:

[0040] The shadow map of the object displayed in the previous video frame is deleted.

[0041] Optionally, drawing a shadow map of the object to be displayed in the current video frame includes:

[0042] Determine the illumination angle of each object in the current video frame, wherein the illumination angle of an object is the angle of the light source in the current video frame relative to the object;

[0043] A shadow map of the object to be displayed in the current video frame is drawn according to the determined illumination angle.

[0044] Optionally, drawing a shadow map of the object to be displayed in the current video frame according to the determined illumination angle includes:

[0045] Determining the light intensity of the light source in the current video frame;

[0046] A shadow map of the object to be displayed in the current video frame is drawn according to the illumination intensity and the determined illumination angle.

[0047] In a second aspect, an embodiment of the present invention further provides a shadow map determination device, the device comprising:

[0048] A video frame acquisition module, used to acquire a current video frame of an application scene and a video frame previous to the current video frame;

[0049] A shadow map judgment module is used to judge whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame, and if they are the same, trigger the shadow map determination module; if they are not the same, trigger the shadow map judgment module;

[0050] A shadow map determining module, used to determine the shadow map of the object displayed in the previous video frame as the shadow map of the object to be displayed in the current video frame;

[0051] The shadow map drawing module is used to draw the shadow map of the object to be displayed in the current video frame.

[0052] Optionally, the shadow map judgment module includes:

[0053] a 3D view cone acquisition unit, configured to acquire the 3D view cone of the current video frame as a first 3D view cone, and acquire the 3D view cone of the previous video frame as a second 3D view cone;

[0054] A shadow map determination unit is used to use the first 3D viewing cone and the second 3D viewing cone to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0055] Optionally, the shadow map judgment unit is specifically used to:

[0056] Obtaining coordinates of a center point of the first 3D view cone in a preset coordinate system as first coordinates, and obtaining coordinates of a center point of the second 3D view cone in a preset coordinate system as second coordinates;

[0057] Compare the first coordinate with the second coordinate to obtain a coordinate change value;

[0058] Determining whether the coordinate change value is greater than a preset change value;

[0059] If it is greater than, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0060] If it is less than, it is determined that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0061] Optionally, the shadow map judgment unit is specifically used to:

[0062] According to a preset segmentation rule, the first 3D view cone is segmented to obtain a first type of sub-3D view cones, and the second 3D view cone is segmented to obtain a second type of sub-3D view cones;

[0063] Sort the sub-3D view cones in the segmentation result corresponding to the segmentation rule, and determine the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number as a sub-3D view cone pair;

[0064] Calculate the change in coordinates of the center points of two sub-cones in the sub-3D cone pair in the preset coordinate system;

[0065] Determine whether there is a change value greater than a preset value among the obtained change values;

[0066] If so, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0067] If not, determining that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame;

[0068] The shadow map drawing module is specifically used for:

[0069] Draw a shadow map of an object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame, and determine the shadow map of an object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of an object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame, wherein the third type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value greater than the preset value in the obtained change value, the fourth type of sub-3D visual cone is: a sub-3D visual cone with the same order as the fifth type of sub-3D visual cone, the fifth type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value less than the preset value in the obtained change value, the third type of sub-3D visual cone is a sub-3D visual cone in the first type of sub-3D visual cone, the fourth type of sub-3D visual cone is a sub-3D visual cone in the second type of sub-3D visual cone, and the fifth type of sub-3D visual cone is a sub-3D visual cone in the first type of sub-3D visual cone except the third type of sub-3D visual cone.

[0070] Optionally, the device further comprises:

[0071] A first object determination module is configured to determine whether there is an object in the corresponding area of ​​the current video frame of the third type of sub-3D visual cone before drawing the shadow map of the object in the corresponding area of ​​the current video frame; if so, trigger the shadow map drawing module to execute the step of drawing the shadow map of the object in the corresponding area of ​​the current video frame of the third type of sub-3D visual cone;

[0072] The second object judgment module is used to judge whether there is an object in the corresponding area of ​​the current video frame of the fifth type of sub-3D visual cone before determining the shadow map of the object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame; if so, trigger the shadow map drawing module to execute the step of determining the shadow map of the object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame.

[0073] Optionally, the device further comprises:

[0074] The shadow map saving module is used to save the drawn shadow map of the object to be displayed in the current video frame after drawing the shadow map of the object to be displayed in the current video frame.

[0075] Optionally, the device further comprises:

[0076] The shadow map deletion module is used to delete the shadow map of the object displayed in the previous video frame after drawing the shadow map of the object to be displayed in the current video frame.

[0077] Optionally, the shadow map drawing module includes:

[0078] an illumination angle determination unit, configured to determine an illumination angle of each object in the current video frame, wherein the illumination angle of an object is an angle of a light source in the current video frame relative to the object;

[0079] The shadow map drawing unit is used to draw a shadow map of the object to be displayed in the current video frame according to the determined illumination angle.

[0080] Optionally, the shadow map drawing unit specifically includes:

[0081] Determining the light intensity of the light source in the current video frame;

[0082] A shadow map of the object to be displayed in the current video frame is drawn according to the illumination intensity and the determined illumination angle.

[0083] In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0084] Memory, used to store computer programs;

[0085] The processor is used to implement any shadow map determination method described in the first aspect when executing the program stored in the memory.

[0086] In a fourth aspect, an implementation path of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any shadow map determination method described in the first aspect.

[0087] Compared with the prior art, the technical solution provided by the embodiment of the present invention first obtains the current video frame of the application scene and the previous video frame of the current video frame; then determines whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame; if the shadow map of the current video frame is the same as the shadow map of the previous video frame, the shadow map of the object in the previous video frame is directly determined as the shadow map of the object in the current video frame; if the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, in order to make the shadow of the object in the application scene more realistic, the shadow map of the object in the current video frame is drawn. It can be seen that the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, and improve the user experience of the user in the application scene. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0089] Figure 1 A flowchart of a shadow map determination method provided by an embodiment of the present invention;

[0090] Figure 2 A flowchart of “determining whether a shadow map of an object in a current video frame is the same as a shadow map of an object in a previous video frame” provided by an embodiment of the present invention;

[0091] Figure 3 Another flowchart of “determining whether a shadow map of an object in a current video frame is the same as a shadow map of an object in a previous video frame” provided by an embodiment of the present invention;

[0092] Figure 4 A schematic diagram of the structure of a shadow map determination device provided by an embodiment of the present invention;

[0093] Figure 5 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0094] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0095] In order to make the shadows of objects in application scenarios more realistic and improve the user experience in application scenarios, an embodiment of the present invention provides a shadow map determination method and device. The shadow map determination method can be applied to different application scenarios, wherein the application scenarios may be 3D animation scenes, 3D movie scenes, 3D game scenes, etc. The embodiment of the present invention does not specifically limit the application scenarios.

[0096] The executor of the above-mentioned shadow map determination method is an electronic device, which can be installed with a virtual camera. The virtual camera can obtain the current video frame of the application scene and the previous video frame of the current video frame. The electronic device can be a mobile phone, a computer, a game console, etc., which is all reasonable.

[0097] A shadow map determination method provided by an embodiment of the present invention includes:

[0098] Obtain the current video frame of the application scene and the video frame before the current video frame;

[0099] Determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame;

[0100] If the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame, the shadow map of the object displayed in the previous video frame is determined as the shadow map of the object to be displayed in the current video frame;

[0101] If the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, the shadow map of the object to be displayed in the current video frame is drawn.

[0102] Compared with the prior art, the technical solution provided by the embodiment of the present invention first obtains the current video frame of the application scene and the previous video frame of the current video frame; then determines whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame; if the shadow map of the current video frame is the same as the shadow map of the previous video frame, the shadow map of the object in the previous video frame is directly determined as the shadow map of the object in the current video frame; if the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, in order to make the shadow of the object in the application scene more realistic, the shadow map of the object in the current video frame is drawn. It can be seen that the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, and improve the user experience of the user in the application scene.

[0103] In the first aspect, a shadow map determination method provided by an embodiment of the present invention is first introduced. Figure 1 As shown, a shadow map determination method provided by an embodiment of the present invention may include the following steps:

[0104] S110, obtaining a current video frame of the application scene and a video frame previous to the current video frame;

[0105] Among them, the application scenario is the scene displayed to the user when the embodiment of the present invention is applied. For example, in a 3D game scene, the 3D game scene may be a game character walking on a lawn. At this time, the scene displayed to the user is the game character walking on the lawn.

[0106] It should be noted that the above-mentioned application scenario is usually a 3D scene, and a method for obtaining the current video frame of the application scenario and the previous video frame of the current video frame can be: converting the 3D scene into a 2D image through a conversion algorithm to obtain the current video frame and the previous video frame of the current video frame, wherein the conversion algorithm is any algorithm in the prior art that can convert a 3D scene into a 2D image, and the embodiment of the present invention does not elaborate on the conversion algorithm in detail.

[0107] S120, determining whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame; if the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame, executing step S130; if the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, executing step S140;

[0108] In this step, the shadow map of the object to be displayed is: the shadow map of the object in the current video frame displayed to the user when the current video frame is displayed; the shadow map of the object already displayed is: the shadow map of the object in the previous video frame of the current video frame that has been displayed to the user when the previous video frame of the current video frame is displayed.

[0109] For the same object in the application scene, the shadow images of the object displayed in different video frames may be the same or different, that is, in different video frames, the shadow images of the object seen by the user may be the same or different.

[0110] Taking a 3D game scene as an example, for a game character in the 3D game scene, the game user has different perspectives in the current video frame and the previous video frame. In the previous video frame, the game user sees the complete shadow of the object in the game scene, but in the current video frame, the game user sees a partial shadow of the object in the game scene.

[0111] In order to determine whether it is necessary to draw the shadow map of the object in the current video frame in the next step, it is necessary to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0112] The 3D view cone can more accurately reflect the position of objects in the application scene and the angle of objects relative to the light source, which are important factors affecting the shadow map of objects in the application scene. Therefore, the 3D view cone of the current video frame and the 3D view cone of the previous video frame can be used to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0113] In one implementation, determining whether a shadow image of an object to be displayed in a current video frame is the same as a shadow image of an object displayed in a previous video frame may include the following steps:

[0114] Obtaining a 3D view cone of a current video frame as a first 3D view cone, and obtaining a 3D view cone of a previous video frame as a second 3D view cone;

[0115] The first 3D viewing cone and the second 3D viewing cone are used to determine whether a shadow map of an object to be displayed in a current video frame is the same as a shadow map of an object displayed in a previous video frame.

[0116] The first 3D visual cone and the second 3D visual cone may be obtained by using a virtual camera in an electronic device of an execution subject to shoot an application scene to obtain the first 3D visual cone and the second 3D visual cone.

[0117] Specifically, the scene displayed by the first 3D view cone is: the application scene displayed to the user in the display of the current video frame; the scene displayed by the second 3D view cone is: the application scene displayed to the user in the video frame before the display of the current video frame. Therefore, by using the first 3D view cone and the second 3D view cone, it can be determined whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the video frame before the current video frame.

[0118] In order to describe the scheme clearly, Figure 2 and Figure 3 The illustrated embodiment describes in detail “how to use the first 3D viewing cone and the second 3D viewing cone to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame”.

[0119] S140, drawing a shadow map of the object to be displayed in the current video frame;

[0120] When it is determined that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, in order to make the shadow map of the object to be displayed in the current video frame more realistic, it is necessary to draw the shadow map of the object to be displayed in the current video frame.

[0121] In one implementation, drawing a shadow map of an object to be displayed in a current video frame includes:

[0122] Determine the illumination angle of each object in the current video frame, wherein the illumination angle of an object is the angle of the light source in the current video frame relative to the object;

[0123] Draw a shadow map of the object in the current video frame according to the determined lighting angle.

[0124] In the application scenario, the direction and size of an object's shadow map are closely related to the object's illumination angle. In order to make the drawn shadow map more realistic, when drawing the shadow map of each object in the current video frame, it is necessary to first determine the illumination angle of each object in the current video frame.

[0125] The following will take a 3D game scene as an example for explanation.

[0126] In one case, suppose that when a game player is playing a 3D game, the weather mode selected is sunny and the light source is the sun. In the 3D game scene, from morning to afternoon, the sun rises from the east and sets in the west. As the sun moves from east to west, the illumination angle of the object changes, and the shadow of the object also changes, that is, the shadow map of the object also changes.

[0127] Specifically, in the morning, the sun is in the east, and the direction of the object's shadow should be towards the west. Therefore, in order to make the object's shadow more realistic, the direction of the object's shadow map is also towards the west when drawing the object's shadow map. In the afternoon, the sun is in the west, and the direction of the object's shadow should be towards the east. Therefore, in the process of drawing the object's shadow map, the direction of the object's shadow map is also towards the east.

[0128] Moreover, for an object in a 3D game scene, from morning to noon, the illumination angle of the object gradually decreases (which can be approximately regarded as changing from 90 degrees to 0 degrees), and the shadow image of the object changes from large to small; from noon to night, the illumination angle of the object gradually increases (which can be approximately regarded as changing from 0 degrees to 90 degrees), and the shadow image of the object changes from small to large.

[0129] In another case, suppose the game player selects night as the weather mode when playing a 3D game, and the light source is a street lamp. At this time, the objects located in the east, south, west, and north of the street lamp have different lighting angles, and the shadow maps of the objects in these four directions are also different.

[0130] Specifically, the shadow of an object located to the east of the street lamp should be oriented to the east, so when drawing the shadow map of the object, the shadow map of the object is also oriented to the east; similarly, the shadow of an object located to the south of the street lamp should be oriented to the south, so when drawing the shadow map of the object, the shadow map of the object is also oriented to the south; the shadow of an object located to the west of the street lamp should be oriented to the west, so when drawing the shadow map of the object, the shadow map of the object is also oriented to the west; the shadow of an object located to the north of the street lamp should be oriented to the north, so when drawing the shadow map of the object, the shadow map of the object is also oriented to the north. Of course, there are objects located in other directions of the street lamp, which are not listed one by one in the embodiments of the present invention.

[0131] Moreover, for an object in a 3D game scene, the closer it is to a street lamp, the smaller the illumination angle of the object is, and the smaller the shadow image of the object is; similarly, the farther it is from the street lamp, the greater the illumination angle of the object is, and the larger the shadow image of the object is.

[0132] In one implementation, in order to make the shadow map of the object in the current frame drawn more realistic, drawing the shadow map of the object to be displayed in the current video frame according to the determined illumination angle may include:

[0133] Determine the light intensity of the light source in the current video frame;

[0134] A shadow map of the object to be displayed in the current video frame is drawn according to the light intensity and the determined light angle.

[0135] Specifically, the shadow map of the object in the current video frame is not only related to the illumination angle of the object, but also related to the illumination intensity of the light source in the current video frame.

[0136] Still taking the 3D game scene as an example, in the same 3D game scene, in one case, the weather mode selected by the game player is sunny; in another case, the weather mode selected by the game player is cloudy. Obviously, when the weather mode is sunny, the sun's light intensity is high, and the shadow of the object is clearer, so the shadow map of the object in the current frame drawn at this time should also be clearer; when the weather mode is cloudy, the sun's light intensity is low, and the shadow of the object is fuzzy, so the shadow map of the object in the current frame drawn at this time should also be fuzzy.

[0137] It should be noted that lighting angle and lighting intensity are two important factors that affect the shadow map of objects in the application scene. When drawing the shadow map of objects in the application scene, according to the actual situation, you can only consider the impact of lighting intensity on the shadow map of objects in the application scene, or you can only consider the impact of lighting angle on the shadow map of objects in the application scene. Of course, you can also consider the impact of both lighting intensity and lighting angle on the shadow map of objects in the application scene, which is reasonable.

[0138] S130: Determine the shadow map of the object displayed in the previous video frame as the shadow map of the object to be displayed in the current video frame.

[0139] If the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame, it means that the shadow map of the object displayed in the previous video frame can accurately represent the shadow map of the object to be displayed in the current video frame. In order to avoid high energy consumption of electronic equipment due to repeated drawing of the shadow map of the object, the shadow map of the object displayed in the previous video frame can be directly determined as the shadow map of the object to be displayed in the current video frame.

[0140] Compared with the prior art, the technical solution provided by the embodiment of the present invention first obtains the current video frame of the application scene and the previous video frame of the current video frame; then determines whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame; if the shadow map of the current video frame is the same as the shadow map of the previous video frame, the shadow map of the object in the previous video frame is directly determined as the shadow map of the object in the current video frame; if the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, in order to make the shadow of the object in the application scene more realistic, the shadow map of the object in the current video frame is drawn. It can be seen that the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, and improve the user experience of the user in the application scene.

[0141] exist Figure 1 On the basis of the illustrated embodiment, after drawing the shadow map of the object to be displayed in the current video frame, the shadow map determination method provided by the embodiment of the present invention may further include the following steps:

[0142] The drawn shadow map of the object to be displayed in the current video frame is saved.

[0143] Specifically, in order to facilitate the use of the shadow map of the object in the current video frame in the video frame after the current video frame, after the shadow map of the object to be displayed in the current video frame is drawn, the shadow map of the object in the current video frame is saved. In this way, when the shadow map of the object to be displayed in the video frame after the current video frame is the same as the shadow map of the object in the current video frame, the shadow map of the object in the current video frame can be directly determined as the shadow map of the object to be displayed in the video frame after the current video frame, without the need to redraw the shadow map of the object to be displayed in the video frame after the current video frame, thereby avoiding the increase in energy consumption of electronic devices due to repeated drawing of shadow maps of objects.

[0144] It should be noted that the drawn shadow map of the object to be displayed in the current video frame can be stored in the execution subject electronic device, or in other electronic devices that communicate with the execution subject electronic device, which is reasonable.

[0145] Compared with the prior art, the technical solution provided by the embodiment of the present invention can make the shadows of objects in the application scene more realistic, thereby improving the user experience of users in the application scene; moreover, it can also avoid the increase in energy consumption of electronic devices caused by repeatedly drawing the shadow images of objects.

[0146] exist Figure 1 On the basis of the illustrated embodiment, after drawing the shadow map of the object to be displayed in the current video frame, the shadow map determination method provided by the embodiment of the present invention may further include the following steps:

[0147] Delete the shadow map of the object that was displayed in the video frame before the current video frame.

[0148] Specifically, after drawing the shadow map of the object in the current video frame, the electronic device may use the shadow map of the object in the current video frame when determining the shadow map of the object in the subsequent video frame of the current video frame. It does not need to use the shadow map of the object in the previous video frame of the current video frame. Therefore, in order to save storage space, the shadow map of the object displayed in the previous video frame of the current video frame is deleted.

[0149] Compared with the prior art, the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, thereby improving the user experience of the user in the application scene; moreover, it can also save storage space.

[0150] Figure 2 As shown, an implementation method of "using the first 3D viewing cone and the second 3D viewing cone to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame" provided by an embodiment of the present invention mainly includes the following steps:

[0151] S201, obtaining coordinates of a center point of a first 3D view cone in a preset coordinate system as first coordinates, and obtaining coordinates of a center point of a second 3D view cone in the preset coordinate system as second coordinates;

[0152] Among them, the center point of the first 3D view cone can be the geometric center of the first 3D view cone, and the center point of the second 3D view cone can be the geometric center of the second 3D view cone; the preset coordinate system can be a pre-established coordinate system, or it can be a reference coordinate system determined when determining the first coordinate and the second coordinate, which is reasonable.

[0153] After obtaining the first 3D view cone and the second 3D view cone, in order to accurately determine whether the application scenario displayed by the first 3D view cone is the same as the application scenario displayed by the second 3D view cone, first obtain the coordinates of the center point of the first 3D view cone in the preset coordinate system and the coordinates of the center point of the second 3D view cone in the preset coordinate system.

[0154] S202, comparing the first coordinate with the second coordinate to obtain a coordinate change value;

[0155] The coordinate change value may be a change value of the horizontal coordinate X, a change value of the vertical coordinate Y, or a change value of the vertical coordinate Z. Of course, it may also be the distance between the center point of the first 3D viewing cone and the center point of the second 3D viewing cone, which are all reasonable.

[0156] S203, determining whether the coordinate change value is greater than a preset change value;

[0157] For different application scenarios, the preset change values ​​can be the same or different;

[0158] For the same application scenario, the preset change value can be the same, or different preset change values ​​can be set according to the performance of the electronic device and the needs of the user, which is reasonable.

[0159] After obtaining the coordinate change values ​​of the first coordinate and the second coordinate, by comparing the coordinate change values ​​with the preset change values, it can be determined whether the application scene displayed by the first 3D visual cone is the same as the application scene displayed by the second 3D visual cone.

[0160] S204, if the coordinate change value is greater than a preset change value, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0161] When the coordinate change value is greater than the preset change value, it means that the application scene displayed by the first 3D visual cone is different from the application scene displayed by the second 3D visual cone. Therefore, it can be determined that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame.

[0162] S205: If the coordinate change value is less than the preset change value, it is determined that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0163] When the coordinate change value is less than the preset change value, it means that the application scene displayed by the first 3D visual cone is the same as the application scene displayed by the second 3D visual cone. Therefore, it can be determined that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame.

[0164] Compared with the prior art, the technical solution provided by the embodiment of the present invention can determine whether the application scene displayed by the first 3D visual cone is the same as the application scene displayed by the second 3D visual cone.

[0165] Figure 3 As shown, another implementation method of "using the first 3D viewing cone and the second 3D viewing cone to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame" provided by an embodiment of the present invention mainly includes the following steps:

[0166] S301, segmenting the first 3D view cone according to a preset segmentation rule to obtain a first type of sub-3D view cones, and segmenting the second 3D view cone to obtain a second type of sub-3D view cones;

[0167] There may be multiple preset segmentation rules. For example, the segmentation rule may be to divide the first 3D view cone into a preset number of sub-3D view cones according to the distance from the view cone vertex from near to far, so as to obtain a first type of 3D sub-view cones. The preset number may be large or small, and the embodiment of the present invention does not specifically limit the preset number.

[0168] The scene displayed by each sub-3D cone in the first type of sub-3D cone is a part of the application scene displayed by the current video frame. Therefore, after obtaining the first 3D cone, segmenting the first 3D cone according to the preset segmentation rule is conducive to determining whether each part of the application scene displayed by the current video frame has changed compared with the corresponding part of the application scene displayed by the previous video frame. It can be seen that segmenting the first 3D cone and the second 3D cone is conducive to more accurately determining whether the application scene displayed by the first 3D cone is the same as the application scene displayed by the second 3D cone.

[0169] S302, sorting the sub-3D view cones in the segmentation result corresponding to the segmentation rule, and determining the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number as a sub-3D view cone pair;

[0170] Specifically, after the first 3D visual cone is divided into the first type of sub-3D visual cones and the second 3D visual cone is divided into the second type of sub-3D visual cones, the first type of sub-3D visual cones and the second type of sub-3D visual cones may be sorted.

[0171] For example, assuming that the above segmentation rule is to segment the 3D view cone from near to far from the view cone vertex. Then, when sorting the first type of sub-3D view cones, the sequence number of the sub-3D view cone closest to the view cone vertex of the first 3D view cone in the first type of sub-3D view cone can be set to 1, and the sequence numbers of the other sub-3D view cones in the first type of sub-3D view cones can be set to 2, 3, 4, 5, ... in sequence; similarly, the second type of sub-3D view cones can be sorted in the same way, starting from the sub-3D view cone closest to the second view cone vertex, and the sequence numbers of the second type of sub-3D view cones can be set to 1, 2, 3, 4, 5, ...

[0172] After the first type of sub-3D view cones and the second type of sub-3D view cones are sorted, the sub-3D view cones with the same sorting in the first type of sub-3D view cones and the second type of sub-3D view cones are taken as a sub-3D view cone pair.

[0173] S303, calculating the change values ​​of the coordinates of the center points of the two cones in the sub-3D cone pair in the preset coordinate system;

[0174] After obtaining the sub-3D view cone pair, the coordinate change values ​​of the center points of the two sub-3D view cones in each sub-3D view cone pair in the preset coordinate system are calculated.

[0175] Among them, the center point of the sub-3D view cone can be the geometric center of the sub-3D view cone, and the change value of the coordinate can be: the change value of the horizontal coordinate of the center points of the two sub-3D view cones when the sub-3D view cones are centered, or the change value of the vertical coordinate of the center points of the two sub-3D view cones when the sub-3D view cones are centered, or the change value of the vertical coordinate of the center points of the two sub-3D view cones when the sub-3D view cones are centered; it can also be: the distance between the center points of the two sub-3D view cones when the sub-3D view cones are centered, all of which are reasonable.

[0176] S304, determine whether there is a change value greater than the preset value in the obtained change values. If there is a change value greater than the preset value in the obtained change values, execute step S305; if there is no change value greater than the preset value in the obtained change values, execute step S306.

[0177] After calculating the change values ​​of the coordinates of the center points of the two sub-3D view cones in each sub-3D view cone pair in the preset coordinate system, in order to accurately determine whether the application scene displayed by the first 3D view cone and the application scene displayed by the second 3D view cone are the same, it is necessary to determine whether there is a change value greater than the preset value in the obtained coordinate change values.

[0178] Among them, for different application scenarios, the preset values ​​can be the same or different;

[0179] For the same application scenario, the preset values ​​may be the same, or different preset values ​​may be set according to the performance of the electronic device and the needs of the user, which is reasonable.

[0180] S305, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0181] If there is a change value greater than the preset value among the obtained change values, it means that among the multiple sub-3D view cone pairs, there are two sub-3D view cone pairs that display different application scenarios, which further indicates that the application scenario displayed by the first 3D view cone is different from the application scenario displayed by the second 3D view cone. Therefore, it can be determined that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the video frame before the current video frame.

[0182] S306, determining whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame;

[0183] If there is no change value greater than the preset value among the obtained change values, it means that among the multiple sub-3D view cone pairs, there are no sub-3D view cone pairs in which the two sub-3D view cones display different application scenarios, and it can be further explained that the application scenario displayed by the first 3D view cone is the same as the application scenario displayed by the second 3D view cone. Therefore, it can be determined that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the video frame before the current video frame.

[0184] It should be noted that, in this implementation, drawing a shadow map of an object to be displayed in the current video frame may include the following steps:

[0185] A shadow map of an object in the corresponding area of ​​the third type of sub-3D visual cone in the current video frame is drawn, and a shadow map of an object in the corresponding area of ​​the fourth type of sub-3D visual cone in the previous video frame is determined as a shadow map of an object in the corresponding area of ​​the fifth type of sub-3D visual cone in the current video frame.

[0186] The third type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value greater than the preset value among the obtained change values, the fourth type of sub-3D visual cone is: a sub-3D visual cone with the same order as the fifth type of sub-3D visual cone, the fifth type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value less than the preset value among the obtained change values, the third type of sub-3D visual cone is a sub-3D visual cone among the first type of sub-3D visual cone, the fourth type of sub-3D visual cone is a sub-3D visual cone among the second type of sub-3D visual cone, and the fifth type of sub-3D visual cone is a sub-3D visual cone among the first type of sub-3D visual cone except the third type of sub-3D visual cone. In other words, according to the size relationship between the obtained change value and the preset value, the first type of sub-3D visual cone can be divided into the third type of sub-3D visual cone and the fifth type of sub-3D visual cone, and the sub-3D visual cone with the same order as the fifth type of sub-3D visual cone among the second type of sub-3D visual cone is the fourth type of sub-3D visual cone.

[0187] Specifically, among multiple sub-3D view cone pairs, the change value of the coordinates of the center points of two sub-3D view cones in a part of the sub-3D view cone pairs in the preset coordinate system is greater than the preset value, indicating that the 3D scenes displayed by the two sub-3D view cones in this part of the sub-3D view cone pairs are different. Therefore, it is necessary to draw a shadow map of the object in the corresponding area of ​​the third type of sub-3D view cone included in this part of the sub-3D view cone pairs in the current video frame; while the change value of the coordinates of the center points of the two sub-3D view cones in another part of the sub-3D view cone pairs in the preset coordinate system is less than the preset value, indicating that the 3D scenes displayed by the two sub-3D view cones in this part of the sub-3D view cone pairs are the same. Therefore, the shadow map of the object in the corresponding area of ​​the fourth type of sub-3D view cone in the previous video frame can be determined as the shadow map of the object in the corresponding area of ​​the fifth type of sub-3D view cone in the current video frame.

[0188] It is understandable that there may be no object in the corresponding area of ​​the third type of sub-3D view cone in the current video frame. In this case, there is no need to draw the shadow map of the object in the corresponding area of ​​the third type of sub-3D view cone in the current video frame.

[0189] In one embodiment, before drawing the shadow map of the object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame, it can also be determined whether there is an object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame; if there is an object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame, the step of drawing the shadow map of the object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame is performed; similarly, before determining the shadow map of the object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame, it can also be determined whether there is an object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame; if there is an object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame, the step of determining the shadow map of the object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame is performed.

[0190] Compared with the prior art, the technical solution provided by the embodiment of the present invention can more accurately determine whether the application scenario displayed by the first 3D visual cone is the same as the application scenario displayed by the second 3D visual cone; and when it is determined that the application scenario displayed by the first 3D visual cone is different from the application scenario displayed by the second 3D visual cone, only the shadow map of the object in the corresponding area of ​​the third type of sub-3D visual cone in the current video frame can be drawn, and there is no need to draw the shadow map of each object in the current video frame, thereby reducing the energy consumption of the electronic device.

[0191] In a second aspect, an embodiment of the present invention further provides a shadow map determining device, such as Figure 4 As shown, the shadow map determining device comprises:

[0192] The video frame acquisition module 410 is used to acquire a current video frame of the application scene and a video frame previous to the current video frame;

[0193] A shadow map determination module 420 is used to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame, and if so, trigger the shadow map determination module; if not, trigger the shadow map determination module;

[0194] The shadow map determining module 430 is used to determine the shadow map of the object displayed in the previous video frame as the shadow map of the object to be displayed in the current video frame.

[0195] The shadow map drawing module 440 is used to draw a shadow map of the object to be displayed in the current video frame.

[0196] Optionally, the shadow map determination module 420 includes:

[0197] a 3D view cone acquisition unit, configured to acquire the 3D view cone of the current video frame as a first 3D view cone, and acquire the 3D view cone of the previous video frame as a second 3D view cone;

[0198] A shadow map determination unit is used to use the first 3D viewing cone and the second 3D viewing cone to determine whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0199] Optionally, the shadow map drawing module includes:

[0200] an illumination angle determination unit, configured to determine an illumination angle of each object in the current video frame, wherein the illumination angle of an object is an angle of a light source in the current video frame relative to the object;

[0201] The shadow map drawing unit is used to draw a shadow map of the object to be displayed in the current video frame according to the determined illumination angle.

[0202] Optionally, the shadow map drawing unit specifically includes:

[0203] Determining the light intensity of the light source in the current video frame;

[0204] A shadow map of the object to be displayed in the current video frame is drawn according to the illumination intensity and the determined illumination angle.

[0205] Compared with the prior art, the technical solution provided by the embodiment of the present invention first obtains the current video frame of the application scene and the previous video frame of the current video frame; then determines whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame; if the shadow map of the current video frame is the same as the shadow map of the previous video frame, the shadow map of the object in the previous video frame is directly determined as the shadow map of the object in the current video frame; if the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, in order to make the shadow of the object in the application scene more realistic, the shadow map of the object in the current video frame is drawn. It can be seen that the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, and improve the user experience of the user in the application scene.

[0206] Optionally, the shadow map judgment unit is specifically used to:

[0207] Obtaining coordinates of a center point of the first 3D view cone in a preset coordinate system as first coordinates, and obtaining coordinates of a center point of the second 3D view cone in a preset coordinate system as second coordinates;

[0208] Compare the first coordinate with the second coordinate to obtain a coordinate change value;

[0209] Determining whether the coordinate change value is greater than a preset change value;

[0210] If it is greater than, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0211] If it is less than, it is determined that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame.

[0212] Compared with the prior art, the technical solution provided by the embodiment of the present invention can determine whether the application scene displayed by the first 3D visual cone is the same as the application scene displayed by the second 3D visual cone.

[0213] Optionally, the shadow map judgment unit is specifically used to:

[0214] According to a preset segmentation rule, the first 3D view cone is segmented to obtain a first type of sub-3D view cones, and the second 3D view cone is segmented to obtain a second type of sub-3D view cones;

[0215] Sort the sub-3D view cones in the segmentation result corresponding to the segmentation rule, and determine the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number as a sub-3D view cone pair;

[0216] Calculate the change in coordinates of the center points of two sub-cones in the sub-3D cone pair in the preset coordinate system;

[0217] Determine whether there is a change value greater than a preset value among the obtained change values;

[0218] If so, determining that the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame;

[0219] If not, determining that the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame;

[0220] The shadow map drawing module is specifically used for:

[0221] Draw a shadow map of the object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame, and determine the shadow map of the object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame, wherein the third type of sub-3D visual cone is: the sub-3D visual cone corresponding to the change value greater than the preset value in the obtained change value, the fourth type of sub-3D visual cone is: the sub-3D visual cone with the same order as the fifth type of sub-3D visual cone, the fifth type of sub-3D visual cone is: the sub-3D visual cone corresponding to the change value less than the preset value in the obtained change value, the third type of sub-3D visual cone is the sub-3D visual cone in the first type of sub-3D visual cone, the fourth type of sub-3D visual cone is the sub-3D visual cone in the second type of sub-3D visual cone, and the fifth type of sub-3D visual cone is the sub-3D visual cone in the first type of sub-3D visual cone except the third type of sub-3D visual cone. Optionally, the device may also include:

[0222] A first object determination module is configured to determine whether there is an object in the corresponding area of ​​the current video frame of the third type of sub-3D visual cone before drawing the shadow map of the object in the corresponding area of ​​the current video frame; if so, trigger the shadow map drawing module to execute the step of drawing the shadow map of the object in the corresponding area of ​​the current video frame of the third type of sub-3D visual cone;

[0223] The second object judgment module is used to judge whether there is an object in the corresponding area of ​​the current video frame of the fifth type of sub-3D visual cone before determining the shadow map of the object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame; if so, trigger the shadow map drawing module to execute the step of determining the shadow map of the object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame.

[0224] Compared with the prior art, the technical solution provided by the embodiment of the present invention can more accurately determine whether the 3D scene displayed by the first 3D visual cone is the same as the application scene displayed by the second 3D visual cone; and when it is determined that the application scene displayed by the first 3D visual cone is different from the application scene displayed by the second 3D visual cone, only the shadow map of the objects in the corresponding area of ​​the third type of sub-3D visual cone in the current video frame can be drawn, and there is no need to draw the shadow maps of each object in the current video frame, thereby reducing the energy consumption of the electronic device.

[0225] Optionally, the device may further include:

[0226] The shadow map saving module is used to save the drawn shadow map of the object to be displayed in the current video frame after drawing the shadow map of the object to be displayed in the current video frame.

[0227] Compared with the prior art, the technical solution provided by the embodiment of the present invention can make the shadows of objects in the application scene more realistic, thereby improving the user experience of users in the application scene; moreover, it can also avoid the increase in energy consumption of electronic devices caused by repeatedly drawing the shadow images of objects.

[0228] Optionally, the device may further include:

[0229] The shadow map deletion module is used to delete the shadow map of the object displayed in the previous video frame after drawing the shadow map of the object to be displayed in the current video frame.

[0230] Compared with the prior art, the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, thereby improving the user experience of the user in the application scene; moreover, it can also save storage space.

[0231] In a third aspect, an embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.

[0232] Memory 503, used for storing computer programs;

[0233] The processor 501 is used to implement any shadow map determination method described in the first aspect of the method embodiment when executing the program stored in the memory 503.

[0234] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0235] The communication interface is used for communication between the above electronic device and other devices.

[0236] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0237] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0238] Compared with the prior art, the technical solution provided by the embodiment of the present invention first obtains the current video frame of the application scene and the previous video frame of the current video frame; then determines whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame; if the shadow map of the current video frame is the same as the shadow map of the previous video frame, the shadow map of the object in the previous video frame is directly determined as the shadow map of the object in the current video frame; if the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, in order to make the shadow of the object in the application scene more realistic, the shadow map of the object in the current video frame is drawn. It can be seen that the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, and improve the user experience of the user in the application scene.

[0239] In a fourth aspect, in another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which instructions are stored, and when the computer-readable storage medium is executed on a computer, the computer implements any shadow map determination method described in the method embodiment of the first aspect.

[0240] Compared with the prior art, the technical solution provided by the embodiment of the present invention first obtains the current video frame of the application scene and the previous video frame of the current video frame; then determines whether the shadow map of the object to be displayed in the current video frame is the same as the shadow map of the object displayed in the previous video frame; if the shadow map of the current video frame is the same as the shadow map of the previous video frame, the shadow map of the object in the previous video frame is directly determined as the shadow map of the object in the current video frame; if the shadow map of the object to be displayed in the current video frame is different from the shadow map of the object displayed in the previous video frame, in order to make the shadow of the object in the application scene more realistic, the shadow map of the object in the current video frame is drawn. It can be seen that the technical solution provided by the embodiment of the present invention can make the shadow of the object in the application scene more realistic, and improve the user experience of the user in the application scene.

[0241] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0242] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0243] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A shadow map determination method, characterized in that: The method comprises: Acquire a current video frame of the application scene and a video frame previous to the current video frame; Obtaining a 3D view cone of the current video frame as a first 3D view cone, and obtaining a 3D view cone of the previous video frame as a second 3D view cone; Segmenting the first 3D visual cone to obtain a first type of sub-3D visual cones, and segmenting the second 3D visual cone to obtain a second type of sub-3D visual cones; Sort the sub-3D view cones in the segmentation result, and determine the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number as a sub-3D view cone pair; Calculate the change in coordinates of the center points of two sub-3D view cones in the sub-3D view cone pair in the preset coordinate system; Determine whether there is a change value greater than a preset value among the obtained change values; If not present, the shadow map of the object displayed in the previous video frame is determined as the shadow map of the object to be displayed in the current video frame; wherein the shadow map of the object to be displayed is: the shadow map of the object in the current video frame displayed to the user when the current video frame is displayed; the shadow map of the object already displayed is: the shadow map of the object in the previous video frame of the current video frame displayed to the user when the previous video frame of the current video frame is displayed; If it exists, draw a shadow map of the object to be displayed in the current video frame.

2. The method according to claim 1, characterized in that The step of drawing a shadow map of the object to be displayed in the current video frame includes: Draw a shadow map of an object of the third type of sub-3D visual cone in the corresponding area of ​​the current video frame, and determine the shadow map of an object of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of an object of the fifth type of sub-3D visual cone in the corresponding area of ​​the current video frame, wherein the third type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value greater than the preset value in the obtained change value, the fourth type of sub-3D visual cone is: a sub-3D visual cone with the same order as the fifth type of sub-3D visual cone, the fifth type of sub-3D visual cone is: a sub-3D visual cone corresponding to a change value less than the preset value in the obtained change value, the third type of sub-3D visual cone is a sub-3D visual cone in the first type of sub-3D visual cone, the fourth type of sub-3D visual cone is a sub-3D visual cone in the second type of sub-3D visual cone, and the fifth type of sub-3D visual cone is a sub-3D visual cone in the first type of sub-3D visual cone except the third type of sub-3D visual cone.

3. The method according to claim 2, characterized in that Before drawing the shadow map of the object in the corresponding area of ​​the third type of sub-3D view cone in the current video frame, the method further includes: Determine whether there is an object in the corresponding area of ​​the third type of sub-3D visual cone in the current video frame; If so, executing the step of drawing a shadow map of the object in the corresponding area of ​​the third type of sub-3D viewing cone in the current video frame; Accordingly, before determining the shadow map of the object of the fourth type of sub-3D view cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D view cone in the corresponding area of ​​the current video frame, the method further includes: Determine whether there is an object in the corresponding area of ​​the fifth type of sub-3D visual cone in the current video frame; If so, the step of determining the shadow map of the object in the corresponding area of ​​the fourth type of sub-3D viewing cone in the previous video frame as the shadow map of the object in the corresponding area of ​​the fifth type of sub-3D viewing cone in the current video frame is performed.

4. The method according to claim 1, characterized in that: After drawing the shadow map of the object to be displayed in the current video frame, the method further includes: The drawn shadow map of the object to be displayed in the current video frame is saved.

5. The method according to claim 1, characterized in that: After drawing the shadow map of the object to be displayed in the current video frame, the method further includes: The shadow map of the object displayed in the previous video frame is deleted.

6. The method according to claim 1, characterized in that The step of drawing a shadow map of the object to be displayed in the current video frame includes: Determine the illumination angle of each object in the current video frame, wherein the illumination angle of an object is the angle of the light source in the current video frame relative to the object; A shadow map of the object to be displayed in the current video frame is drawn according to the determined illumination angle.

7. The method according to claim 6, characterized in that Drawing a shadow map of the object to be displayed in the current video frame according to the determined illumination angle includes: Determining the light intensity of the light source in the current video frame; A shadow map of the object to be displayed in the current video frame is drawn according to the illumination intensity and the determined illumination angle.

8. The method according to claim 1, characterized in that The step of segmenting the first 3D visual cone to obtain a first type of sub-3D visual cones, and segmenting the second 3D visual cone to obtain a second type of sub-3D visual cones, includes: According to a preset segmentation rule, the first 3D view cone is segmented to obtain a first type of sub-3D view cones, and the second 3D view cone is segmented to obtain a second type of sub-3D view cones; The step of sorting the sub-3D view cones in the segmentation result and determining the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number as a sub-3D view cone pair includes: The sub-3D view cones in the segmentation results corresponding to the segmentation rule are sorted, and the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number are determined as a sub-3D view cone pair.

9. A shadow map determination device, characterized in that: The device comprises: A video frame acquisition module, used to acquire a current video frame of an application scene and a video frame previous to the current video frame; A 3D view cone acquisition module, used to acquire the 3D view cone of the current video frame as a first 3D view cone, and acquire the 3D view cone of the previous video frame as a second 3D view cone; a 3D view cone segmentation module, configured to segment the first 3D view cone to obtain a first type of sub-3D view cones, and segment the second 3D view cone to obtain a second type of sub-3D view cones; A sub-3D view cone sorting module is used to sort the sub-3D view cones in the segmentation result, and determine the first type of sub-3D view cones and the second type of sub-3D view cones with the same sorting sequence number as a sub-3D view cone pair; A determination module, used to calculate the change value of the coordinates of the center points of two sub-3D view cones in the sub-3D view cone pair in a preset coordinate system; A shadow map judgment module is used to judge whether there is a change value greater than a preset value in the obtained change value; A shadow map determining module, for determining the shadow map of the object displayed in the previous video frame as the shadow map of the object to be displayed in the current video frame if it does not exist; wherein the shadow map of the object to be displayed is: the shadow map of the object in the current video frame displayed to the user when the current video frame is displayed; the shadow map of the object already displayed is: the shadow map of the object in the previous video frame of the current video frame displayed to the user when the previous video frame of the current video frame is displayed; A shadow map drawing module is used to draw a shadow map of the object to be displayed in the current video frame, if any.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the shadow map determination method described in any one of claims 1-8 when executing the program stored in the memory.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the shadow map determination method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Shadow map generating method and device

    CN107274476A