A method and device for determining a shadow map

By dynamically judging and drawing shadow maps of objects in 3D game scenes, using 3D cones and lighting angles, the problem of shadows in the prior art is not realistic enough, improving user experience and saving energy consumption.

CN114266878BActive Publication Date: 2024-12-31JINGCAI ON LINE TECH DALIAN CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202111597092.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-02-11
Publication Date
2024-12-31
Estimated Expiration
2038-02-11

AI Technical Summary

Technical Problem

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

Method used

By obtaining the current video frame and the previous video frame of the application scenario, we can determine whether the shadow map of the object to be displayed is the same as the shadow map of the displayed object. If it is different, draw a new shadow map and use the 3D cone and lighting angle to perform shadowing. Dynamic update of the diagram.

Benefits of technology

It improves the authenticity of object shadows in application scenarios, improves the user experience, and avoids the increase in energy consumption caused by repeated drawing of shadow maps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114266878B_ABST
    Figure CN114266878B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a shadow map determination method and device, which obtains the current video frame of a 3D game scene and the previous video frame of the current video frame; 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 they are the same, 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 they are not the same, determines the illumination angle of each object in the current video frame and / or the illumination intensity of the light source in the current video frame; draws the shadow map of the object to be displayed in the current video frame according to the illumination intensity of the light source in the current video frame and / or the illumination angle of each object in the current video frame. The technical solution provided by the embodiment of the present invention can make the shadows of objects in the 3D game scene more realistic, and improves the user experience of users in the application scene.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the 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 uses a 3D game scene as an example. When a terminal is running a 3D game, to provide the user with a more realistic gaming experience, it simulates the shadows of objects in the 3D game scene. The terminal simulates the shadows of objects in the 3D game scene by drawing a shadow map of the objects in the 3D game scene and determining the drawn shadow map of the objects in the 3D game scene as the shadows of the objects 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 pre-drawn shadow map 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] Using this approach, the shadows of objects in the 3D game scene simulated by the terminal remain fixed and cannot change with changes in the lighting in the 3D game scene. As a result, the shadows of objects in the simulated 3D game scene are not realistic, reducing the realism of the 3D game and providing a poor user experience. Summary of the Invention

[0007] The purpose of the embodiments of the present invention is to provide a shadow map determination method and device to make the shadows of objects in application scenarios more realistic and improve the user experience in the application scenarios. 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] Obtaining 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, 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 viewing cone of the current video frame as a first 3D viewing cone, and obtaining a 3D viewing cone of the previous video frame as a second 3D viewing cone;

[0015] Using the first 3D viewing cone and the second 3D viewing cone, it is determined 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 viewing cone in a preset coordinate system as first coordinates, and obtaining coordinates of a center point of the second 3D viewing cone in the preset coordinate system as second coordinates;

[0018] Comparing 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] 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;

[0024] Sort the sub-3D view cones in the segmentation results 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 the 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] 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 view 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 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, wherein the third type of sub-3D view cone is: a sub-3D view cone corresponding to a change value greater than the preset value in the obtained change value, the fourth type of sub-3D view cone is: a sub-3D view cone with the same order as the fifth type of sub-3D view cone, and the fifth type of sub-3D view cone is: a sub-3D view cone corresponding to a change value less than the preset value in the obtained change value, the third type of sub-3D view cone is a sub-3D view cone in the first type of sub-3D view cone, the fourth type of sub-3D view cone is a sub-3D view cone in the second type of sub-3D view cone, and the fifth type of sub-3D view cone is a sub-3D view cone in the first type of sub-3D view cone except the third type of sub-3D view cone.

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

[0032] Determine whether there is an object in a corresponding area of ​​the third type of sub-3D viewing 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 viewing frustum in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type of sub-3D viewing frustum in the corresponding area of ​​the current video frame, the method further includes:

[0035] Determine whether there is an object in a corresponding area of ​​the fifth type of sub-3D viewing 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] Determining 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;

[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 illumination 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 light intensity and the determined light 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, configured to acquire a current video frame of an application scene and a video frame preceding the current video frame;

[0049] a shadow map judgment module, configured 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 so, trigger the shadow map determination module; if not, trigger the shadow map judgment module;

[0050] a shadow map determining module, configured 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 configured to determine, using the first 3D viewing cone and the second 3D viewing cone, 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.

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

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

[0057] Comparing 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] 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;

[0063] Sort the sub-3D view cones in the segmentation results 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 the two sub-cones in the sub-3D view 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 view 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 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, wherein the third type of sub-3D view cone is: a sub-3D view cone corresponding to a change value greater than the preset value in the obtained change value, the fourth type of sub-3D view cone is: a sub-3D view cone with the same order as the fifth type of sub-3D view cone, and the fifth type of sub-3D view cone is: a sub-3D view cone corresponding to a change value less than the preset value in the obtained change value, the third type of sub-3D view cone is a sub-3D view cone in the first type of sub-3D view cone, the fourth type of sub-3D view cone is a sub-3D view cone in the second type of sub-3D view cone, and the fifth type of sub-3D view cone is a sub-3D view cone in the first type of sub-3D view cone except the third type of sub-3D view cone.

[0070] Optionally, the device further includes:

[0071] a first object determination module, configured to determine whether there is an object in the corresponding area of ​​the current video frame of the third type sub-3D view frustum before drawing the shadow map of the object in the corresponding area of ​​the current video frame; and if so, triggering 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 sub-3D view frustum;

[0072] The second object judgment module is used to determine whether there is an object in the corresponding area of ​​the current video frame of the fifth type sub-3D view cone before determining the shadow map of the object of the fourth type sub-3D view cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type sub-3D view 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 sub-3D view cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type sub-3D view cone in the corresponding area of ​​the current video frame.

[0073] Optionally, the device further includes:

[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 includes:

[0076] The shadow map deletion module is configured 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 relative to the object in the current video frame;

[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 illumination 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 light intensity and the determined light angle.

[0083] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising 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 for storing computer programs;

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

[0086] In a fourth aspect, an embodiment 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 video frame before 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, thereby improving 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 following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 any 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 structural diagram of a shadow map determination device provided by an embodiment of the present invention;

[0093] Figure 5 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION

[0094] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 making creative efforts 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 scenario can be a 3D animation scene, a 3D movie scene, a 3D game scene, etc. The embodiment of the present invention does not specifically limit the application scenario.

[0096] The execution subject of the above 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, computer, game console, etc., which is all reasonable.

[0097] An embodiment of the present invention provides a shadow map determination method, comprising:

[0098] Get 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 video frame before 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, thereby improving 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 can be a game character walking on the 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 scenarios are usually 3D scenes. The 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 existing technology that can convert a 3D scene into a 2D image. 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 that has been displayed is: the shadow map of the object in the video frame before the current video frame that has been displayed to the user when the video frame before 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, the shadow images of the object seen by the user may be the same or different in different video frames.

[0110] Taking a 3D game scene as an example, for a game character in the 3D game scene, the game user's perspective is different 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, while 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 frame of video.

[0112] The 3D viewing cone can accurately reflect the position of objects in the application scene and their angle relative to the light source. These positions and angles are important factors affecting the shadow map of objects in the application scene. Therefore, the 3D viewing cone of the current video frame and the 3D viewing 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 embodiment, 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 viewing cone of a current video frame as a first 3D viewing cone, and obtaining a 3D viewing cone of the previous video frame as a second 3D viewing 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 viewing cone and the second 3D viewing cone can both be obtained by using a virtual camera in the executing electronic device to shoot the application scene to obtain the first 3D viewing cone and the second 3D viewing cone.

[0117] Specifically, the first 3D viewing cone displays the scene presented to the user during the current video frame, while the second 3D viewing cone displays the scene presented to the user during the video frame immediately preceding the current video frame. Therefore, using the first and second 3D viewing cones, it is possible to determine whether the shadow map of an object to be displayed in the current video frame is identical to the shadow map of an object displayed in the video frame immediately preceding 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 embodiment, 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 relative to the object in the current video frame;

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

[0124] In application scenarios, the direction and size of an object's shadow map are closely related to the object's lighting angle. 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 lighting 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 scenario, suppose a player is playing a 3D game and has selected a sunny weather mode with the sun as the light source. In the 3D game scene, from morning to afternoon, the sun rises in the east and sets in the west. As the sun moves from east to west, the angle of illumination on objects changes, and so do their shadows—that is, their shadow maps.

[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 lighting angle of the object gradually becomes smaller (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 lighting angle of the object gradually becomes larger (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 scenario, suppose a gamer is playing a 3D game with night selected as the weather mode and a street lamp as the light source. In this case, objects located to the east, south, west, and north of the street lamp will have different lighting angles, and the shadow patterns of objects in these four directions will also be different.

[0130] Specifically, the shadow of an object located to the east of the street lamp should be oriented eastward. Therefore, in the process of drawing the shadow map of the object, the shadow map of the object is also oriented eastward. Similarly, the shadow of an object located to the south of the street lamp should be oriented southward. Therefore, in the process of drawing the shadow map of the object, the shadow map of the object is also oriented southward. The shadow of an object located to the west of the street lamp should be oriented westward. Therefore, in the process of drawing the shadow map of the object, the shadow map of the object is also oriented westward. The shadow of an object located to the north of the street lamp should be oriented northward. Therefore, in the process of drawing the shadow map of the object, the shadow map of the object is also oriented northward. 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 object's illumination angle is, and the smaller the object's shadow image is; similarly, the farther it is from the street lamp, the larger the object's illumination angle is, and the larger the object's shadow image is.

[0132] In one embodiment, in order to make the shadow map of the object in the current frame 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] Taking a 3D game scene as an example, 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 shadows of objects are clearer. Therefore, the shadow map of the objects drawn in the current frame should also be clearer. When the weather mode is cloudy, the sun's light intensity is low, and the shadows of objects are blurry. Therefore, the shadow map of the objects drawn in the current frame should also be blurry.

[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 video frame before 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, thereby improving the user experience of the user in the application scene.

[0141] exist Figure 1 Based on 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 existing technology, 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 in the application scene; moreover, it can also avoid the increase in energy consumption of electronic devices caused by repeatedly drawing the shadow map of the object.

[0146] exist Figure 1 Based on 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 shadows of objects 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 FIG. 1 shows an implementation method for “using a first 3D viewing cone and a second 3D viewing cone 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” provided by an embodiment of the present invention, which mainly includes the following steps:

[0151] S201, obtaining the coordinates of the center point of the first 3D viewing cone in the preset coordinate system as the first coordinates, and obtaining the coordinates of the center point of the second 3D viewing cone in the preset coordinate system as the 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 viewing cone and the second 3D viewing cone, in order to accurately determine whether the application scenario displayed by the first 3D viewing cone is the same as the application scenario displayed by the second 3D viewing cone, first obtain the coordinates of the center point of the first 3D viewing cone in the preset coordinate system and the coordinates of the center point of the second 3D viewing 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 the change value of the horizontal coordinate X, the change value of the vertical coordinate Y, or the 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 is 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 value 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 viewing cone is the same as the application scene displayed by the second 3D viewing cone.

[0160] S204, if the coordinate change value is greater than the 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 viewing cone is the same as the application scene displayed by the second 3D viewing cone.

[0165] Figure 3 FIG. 4 shows another implementation 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, which 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] Among them, there can be multiple preset segmentation rules. For example, the segmentation rule can 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, that is, to obtain a first type of 3D sub-view cones. Among them, the preset number can be large or small, and the embodiment of the present invention does not specifically limit the preset number.

[0168] Each sub-3D view cone in the first type of sub-3D view cone displays a portion of the application scene displayed in the current video frame. Therefore, after obtaining the first 3D view cone, segmenting the first 3D view cone using a preset segmentation rule facilitates determining whether each portion of the application scene displayed in the current video frame has changed compared to the corresponding portion of the application scene displayed in the previous video frame. Thus, segmenting the first and second 3D view cones facilitates more accurate determination of whether the application scene displayed by the first and second 3D view cones is the same.

[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 viewing cone is divided into the first type of sub-3D viewing cones and the second 3D viewing cone is divided into the second type of sub-3D viewing cones, the first type of sub-3D viewing cones and the second type of sub-3D viewing cones may be sorted.

[0171] For example, assuming the above segmentation rule is to segment the 3D view frustum from closest to the view frustum vertex to farthest, then when sorting the first type of sub-3D view frustums, the sub-3D view frustum closest to the view frustum vertex of the first type can be numbered 1, and the sub-3D view frustums of the first type can be numbered 2, 3, 4, 5, ... in sequence. Similarly, the second type of sub-3D view frustums can be sorted in the same manner, starting with the sub-3D view frustum closest to the second view frustum vertex and numbering the sub-3D view frustums of the second type 1, 2, 3, 4, 5, ....

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

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

[0174] After obtaining the sub-3D view cone pairs, 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 in coordinates of the center points of the two sub-3D view cones in each sub-3D view cone pair in a 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 any of the obtained coordinate change values ​​is greater than a preset value.

[0178] For different application scenarios, the preset values ​​may be the same or different;

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

[0180] S305, determining whether 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 and the application scenario displayed by the second 3D view cone are the same. 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 embodiment, 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 the object in the corresponding area of ​​the third type of sub-3D view cone in the current video frame is drawn, and the shadow map of the object in the corresponding area of ​​the fourth type of sub-3D view cone in the previous video frame is 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.

[0186] The third type of sub-3D visual frustum is a sub-3D visual frustum corresponding to a change value greater than the preset value among the obtained change values, the fourth type of sub-3D visual frustum is a sub-3D visual frustum having the same order as the fifth type of sub-3D visual frustum, and the fifth type of sub-3D visual frustum is a sub-3D visual frustum corresponding to a change value less than the preset value among the obtained change values. The third type of sub-3D visual frustum is a sub-3D visual frustum within the first type of sub-3D visual frustum, the fourth type of sub-3D visual frustum is a sub-3D visual frustum within the second type of sub-3D visual frustum, and the fifth type of sub-3D visual frustum is a sub-3D visual frustum within the first type of sub-3D visual frustum excluding the third type of sub-3D visual frustum. In other words, based on the magnitude relationship between the obtained change value and the preset value, the first type of sub-3D visual frustum can be divided into the third type of sub-3D visual frustum and the fifth type of sub-3D visual frustum, and the sub-3D visual frustum within the second type of sub-3D visual frustum having the same order as the fifth type of sub-3D visual frustum is the fourth type of sub-3D visual frustum.

[0187] Specifically, among multiple sub-3D cone pairs, the change value of the coordinates of the center points of two sub-3D cones in a part of the sub-3D cone pairs in the preset coordinate system is greater than the preset value, indicating that the 3D scenes displayed by the two sub-3D cones in this part of the sub-3D cone pairs are different. Therefore, it is necessary to draw the shadow map of the object in the corresponding area of ​​the current video frame of the third type of sub-3D cone contained in this part of the sub-3D cone pairs; and the change value of the coordinates of the center points of the two sub-3D cones in the preset coordinate system in another part of the sub-3D cone pairs is less than the preset value, indicating that the 3D scenes displayed by the two sub-3D cones in this part of the sub-3D cone pairs are the same. Therefore, the shadow map of the object in the corresponding area of ​​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 cone in the current video frame.

[0188] It is understandable that there may be no object in the corresponding area of ​​the third type 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 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 sub-3D visual cone in the corresponding area of ​​the current video frame, it is also possible to determine whether there is an object of the third type sub-3D visual cone in the corresponding area of ​​the current video frame; if there is an object of the third type 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 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 sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type sub-3D visual cone in the corresponding area of ​​the current video frame, it is also possible to determine whether there is an object of the fifth type sub-3D visual cone in the corresponding area of ​​the current video frame; if there is an object of the fifth type 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 sub-3D visual cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type sub-3D visual cone in the corresponding area of ​​the current video frame is performed.

[0190] Compared with the existing technology, 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 determination device, such as Figure 4 As shown, the shadow map determining device includes:

[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 determining module 420 configured to determine whether the shadow map of the object to be displayed in the current video frame is identical to the shadow map of the object displayed in the previous video frame, and trigger the shadow map determining module if they are identical; and trigger the shadow map determining module if they are different;

[0194] The shadow map determining module 430 is configured 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 configured 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 configured to determine, using the first 3D viewing cone and the second 3D viewing cone, 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.

[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 relative to the object in the current video frame;

[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 illumination 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 light intensity and the determined light 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 video frame before 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, thereby improving 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 viewing cone in a preset coordinate system as first coordinates, and obtaining coordinates of a center point of the second 3D viewing cone in the preset coordinate system as second coordinates;

[0208] Comparing 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 viewing cone is the same as the application scene displayed by the second 3D viewing cone.

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

[0214] 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;

[0215] Sort the sub-3D view cones in the segmentation results 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 the two sub-cones in the sub-3D view 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 an object in the corresponding area of ​​the current video frame of the third type of sub-3D visual cone, and determine the shadow map of an object in the corresponding area of ​​the previous video frame of the fourth type of sub-3D visual cone as the shadow map of an object in the corresponding area of ​​the current video frame of the fifth type of sub-3D visual cone, 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 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 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. Optionally, the apparatus may further include:

[0222] a first object determination module, configured to determine whether there is an object in the corresponding area of ​​the current video frame of the third type sub-3D view frustum before drawing the shadow map of the object in the corresponding area of ​​the current video frame; and if so, triggering 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 sub-3D view frustum;

[0223] The second object judgment module is used to determine whether there is an object in the corresponding area of ​​the current video frame of the fifth type sub-3D view cone before determining the shadow map of the object of the fourth type sub-3D view cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type sub-3D view 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 sub-3D view cone in the corresponding area of ​​the previous video frame as the shadow map of the object of the fifth type sub-3D view cone in the corresponding area of ​​the current video frame.

[0224] Compared with the existing technology, 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 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.

[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 existing technology, 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 in the application scene; moreover, it can also avoid the increase in energy consumption of electronic devices caused by repeatedly drawing the shadow map of the object.

[0228] Optionally, the device may further include:

[0229] The shadow map deletion module is configured 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 shadows of objects 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 configured to implement any shadow map determination method described in the method embodiment of the first aspect when executing the program stored in the memory 503 .

[0234] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only 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 random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the 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, and 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 video frame before 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, thereby improving 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. When the computer-readable storage medium is run 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 video frame before 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, thereby improving the user experience of the user in the application scene.

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

[0242] Each embodiment in this specification is described in a related manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. In particular, the device, electronic device, and storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For related portions, reference can be made to the descriptions of the method embodiments.

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

Claims

1. A shadow map determination method, characterized in that: The method comprises: Obtaining a current video frame of a 3D game scene and a video frame previous to the current video frame; 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 already displayed in the previous 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 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; If they are not the same, determining the illumination angle of each object in the current video frame and / or the illumination intensity of the light source 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; Drawing a shadow map of the object to be displayed in the current video frame according to the illumination intensity of the light source in the current video frame and / or the illumination angle of each object in the current video frame; 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: 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; 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.

2. The method according to claim 1, characterized in that 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, comprises: 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; Compare the first coordinate with the second coordinate to obtain a coordinate change value; Determining whether the coordinate change value is greater than a preset change value; 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; 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.

3. The method according to claim 1, characterized in that 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, comprises: 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; 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; 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 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; If not, 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.

4. The method according to claim 3, characterized in that Drawing a shadow map of the object to be displayed in the current video frame according to the illumination intensity of the light source in the current video frame and / or the illumination angle of each object in the current video frame includes: In a case where 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, a shadow map of the object in the corresponding area of ​​the current video frame is drawn according to the illumination intensity of the light source in the current video frame and / or the illumination angle of the object, 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, and the third type of sub-3D visual cone is a sub-3D visual cone in the first type of sub-3D visual cone; The method further comprises: When 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 of the fourth type of sub-3D visual cone in the corresponding area of ​​the previous video frame is determined 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 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 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.

5. The method according to claim 4, characterized in that In a case where 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, before drawing the shadow map of the object in the corresponding area of ​​the current video frame according to the illumination intensity of the light source in the current video frame and / or the illumination angle of the object, 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 according to the illumination intensity of the light source in the current video frame and / or the illumination angle of the object when 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; Correspondingly, when 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 of the fourth type of sub-3D view frustum in the corresponding area of ​​the previous video frame is determined to be before the shadow map of the object of the fifth type of sub-3D view frustum 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, 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 when 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.

6. 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.

7. 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.

8. A shadow map determination device, characterized in that: The device comprises: A video frame acquisition module, used to acquire a current video frame of a 3D game scene and a video frame previous to the current video frame; 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. If they are the same, the shadow map determination module is triggered; if they are not the same, the shadow map judgment module is triggered; 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 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; 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; a shadow map drawing module, used to determine the illumination angle of each object in the current video frame and / or the illumination intensity of the light source 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; and draw a shadow map of the object to be displayed in the current video frame according to the illumination intensity of the light source in the current video frame and / or the illumination angle of each object in the current video frame; The shadow map judgment module comprises: 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; 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.

9. 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-7 when executing the program stored in the memory.

10. 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 7 is implemented.

Citation Information

Patent Citations

  • Method for using inter-frame time correlation in 3D animating process

    CN102346919A

  • Video scene switching detection method and device

    CN104270553A

  • General assistant technique for generating shadow through shadow map

    CN104966297A

  • Shadow map generating method and device

    CN107274476A

  • Visual display systems

    GB2533625A