A method and related apparatus for shadow generation based on geographic information
By generating shadow maps for key time nodes in the game scene based on a geographic information system and rendering shadows according to user operation commands, the problem of high computational overhead in shadow generation in existing technologies is solved, achieving efficient and stable shadow rendering effects and improving user experience.
Patent Information
- Application Number
- CN202311531628.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-15
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-11-15
AI Technical Summary
Existing technologies require frequent maintenance and generation of shadow maps when generating shadows in game scenes, which increases the computational overhead of terminal devices and results in unstable shadow rendering effects, affecting user experience.
Based on a geographic information system, key shadow maps are generated only at critical time nodes, and shadow rendering is performed according to user operation instructions and time nodes. Target visibility maps are generated through blurring or approximation processing, reducing the update frequency of shadow maps and the number of coordinate system transformations.
It reduces the operating burden on terminal devices, improves shadow rendering efficiency and quality, ensures the realism and three-dimensionality of game scenes, and enhances the user's gaming experience.
Smart Images

Figure CN120037649B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the Internet field, and more particularly to a method and related apparatus for generating shadows based on geographic information. Background Technology
[0002] Shadows are an indispensable part of game scenes, giving characters and environments a more realistic and three-dimensional effect, enhancing user immersion and improving the gaming experience. Currently, one of the most common shadow generation methods in game scenes is shadow mapping. This method renders the entire game scene at the light source location, storing the depth values of the illuminated parts in a shadow map using a z-buffer. Then, it compares each point in the normal game scene with the shadow map to determine if each point is visible to the light, thus rendering the normal scene. However, during rendering, a shadow map needs to be maintained or generated for each frame, increasing the number of rendering iterations. Furthermore, each frame requires coordinate system transformation calculations, increasing the computational overhead of the terminal device and hindering its performance. Summary of the Invention
[0003] In a first aspect, this application provides a method and related apparatus for shadow generation based on geographic information, the method comprising:
[0004] Based on geographic information in the geographic information system, the key shadow map corresponding to the key game scene is calculated. The key shadow map is the shadow map corresponding to the game model at the key time node. The key time node is a preset time node, and the number of key time nodes is greater than or equal to 2.
[0005] In response to the user's operation command, determine the viewport information, which includes the first time node, which is the time node of the game scene corresponding to the viewport information;
[0006] Determine whether the first time node is a critical time node, and generate a target visibility map based on the determination result and the critical shadow map;
[0007] Based on the target visibility map, shadows are drawn on the game scene corresponding to the viewport information to generate the target game image frame.
[0008] By implementing the method provided in the first aspect, the terminal device does not need to update the shadow map in real time based on the user's operation command. Instead, it can generate the corresponding key shadow map for the game scene at key time points. Furthermore, it can render the game scene based on the time node corresponding to the user's operation command and the key shadow map. This helps to reduce the operating burden of the terminal device while ensuring that the game scene has a realistic and three-dimensional effect, and also helps to protect the user's gaming experience.
[0009] Implementing the method provided in the first aspect, in some embodiments, determining whether a first time node is a critical time node, and generating a target visibility map based on the determination result and a critical shadow map, includes:
[0010] If the judgment result is yes, then the key shadow map corresponding to the first time node is blurred and a target visibility map is generated;
[0011] If the judgment result is negative, a target visibility map is generated based on the target shadow map corresponding to the target time node. The target time node is the two key time nodes before and after the first time node, and the target shadow map is the key shadow map corresponding to each target time node.
[0012] Implementing the method provided in the above embodiments, the terminal device will take different shadow rendering steps according to the time node corresponding to the user's operation command. Specifically, when the time node corresponding to the user's operation command (i.e., the first time node) is the same as a preset key time node, the key shadow map corresponding to the key time node can be blurred to obtain a target visibility map that matches the viewport information. When the time node corresponding to the user's operation command (i.e., the first time node) is between two preset key time nodes (which can be regarded as target time nodes), the terminal device can approximate the key shadow map corresponding to the target time node to obtain the target visibility map corresponding to the first time node. This helps to simplify the shadow rendering work of the terminal device in the game scene, thereby reducing the operating burden of the terminal device. Furthermore, approximating the target shadow map can ensure that the terminal device can simplify the shadow rendering work while also ensuring the shadow rendering effect and quality of the game scene.
[0013] Implementing the method provided in the first aspect, in some embodiments, after calculating key shadow maps corresponding to key game scenes based on geographic information in a geographic information system, the method further includes:
[0014] Generate the corresponding first visibility map based on the key shadow map.
[0015] By implementing the method provided in the above embodiments, the terminal device only needs to sample the key shadows corresponding to key time nodes to generate the corresponding first visibility map, which reduces the number of times the terminal device performs game scene coordinate system transformation and also reduces the frequency of the terminal device updating the game shadow map, thereby achieving the goal of reducing the computational overhead of the terminal device.
[0016] Implementing the method provided in the first aspect, in some embodiments, if the determination result is negative, a target visibility map is generated based on the target shadow map corresponding to the target time node, including:
[0017] An approximation is performed on the first visibility map corresponding to the target shadow map to generate a target visibility map.
[0018] By implementing the method provided in the above embodiments, the terminal device can generate a target visibility map corresponding to a first time node by approximating the first visibility map corresponding to the target shadow map. This achieves the purpose of shadow rendering for game scenes (or game models) corresponding to non-critical time nodes without performing shadow map sampling. This helps improve the rendering efficiency of the terminal device for game scenes (or game models) while ensuring the shadow rendering effect of the game scene (or game model).
[0019] Implementing the method provided in the first aspect, in some embodiments, approximating the first visibility map to generate a target visibility map includes:
[0020] Determine the shadow bounding box and control points in the first visibility map, where the control points are the vertices of the shadow bounding box;
[0021] Inverse bilinear interpolation is performed based on the coordinates of the first time node, the target time node, and the control points to obtain the target visibility map.
[0022] By implementing the method provided in the above embodiments, the terminal device can approximately generate a target visibility map based on the first visibility map corresponding to the target shadow map when the "first time node is not a critical time node". Specifically, the terminal device can first determine the shadow bounding box corresponding to each of the first visibility maps, and calculate the target visibility map corresponding to the first time node based on the inverse bilinear interpolation method, combined with the first time node, the target time node, and the vertices of the shadow bounding box. By combining multiple parameters (such as the coordinate positions of the first time node, the target time node, and the control point) to calculate the target visibility map, the terminal device helps to ensure the accuracy of shadow rendering of the game scene (or game model), making it more consistent with the projection rules of the first time node, thereby making the game scene more realistic, allowing users to experience game details more immersively, and improving the user's gaming experience.
[0023] In implementing the method provided in the first aspect, in some embodiments, the geographic information includes spatial data and temporal data;
[0024] Calculate key shadow maps corresponding to key game scenes based on geographic information from a geographic information system, including:
[0025] Based on key time nodes and time data, identify the key game scenarios corresponding to the key time nodes;
[0026] Key shadow maps for key game scenes are calculated based on spatial data.
[0027] By implementing the method provided in the above embodiments, the terminal device can determine the key game scene corresponding to the preset key time node, and calculate the corresponding key shadow map based on the spatial data corresponding to the key game scene. This helps to reduce the operating burden of the terminal device while ensuring the accuracy of shadow rendering of the game scene, and also helps to improve the speed of shadow rendering of the game scene.
[0028] In implementing the method provided in the first aspect, in some embodiments, the geographic information further includes attribute data, and the spatial data includes elevation information;
[0029] If the determination is yes, then the key shadow map corresponding to the first time node is blurred, and a target visibility map is generated, including:
[0030] Based on elevation information and preset formulas, the sampling width for key shadow maps is determined;
[0031] A sampling shadow is generated based on the sampling width.
[0032] By implementing the method provided in the above embodiments, the terminal device can determine the sampling width of the key shadow map based on the height information of each fragment or object in the game scene, thereby generating the corresponding sampled shadow. It can be seen that the method provided in this embodiment considers the impact of height information on shadow generation, which helps to improve the accuracy and realism of shadows, thereby enhancing the user's gaming experience.
[0033] Implementing the method provided in the first aspect, in some embodiments, determining the sampling width for the key shadow map based on elevation information and a preset formula includes:
[0034] Based on elevation information, light source width, and scaling factor, it is determined that for sampling width, the light source width is related to key time nodes, and the scaling factor is used to adjust the blur level of the sampled shadow.
[0035] By implementing the method provided in the above embodiments, technicians can adjust the appropriate scaling factor based on the shadow generation effect. The terminal device can calculate the corresponding sampling width based on the light source width, elevation information, and scaling factor. Taking into account the influence of different factors on the shadow generation effect helps to determine the width of the shadow sampling, thereby helping to generate shadows that are more in line with the shadow generation rules in real scenes and improving the realism of the game scene.
[0036] Implementing the method provided in the first aspect, in some embodiments, after generating the sampling shadow based on the sampling width, further includes:
[0037] Determine whether the shadow-projected surface in the game scene corresponding to the viewport information contains attribute data;
[0038] If the determination is yes, then a target visibility map is generated based on the attribute data and sampled shadows;
[0039] If the determination is negative, then the sampled shadow is determined to be the target visibility map.
[0040] By implementing the method provided in the above embodiments, the problem of "shadows being imaged on surfaces of different materials with varying degrees of blurring" can be solved. The terminal device can perform different blurring processes on the sampled shadows based on the attribute data of different surfaces, which helps to make the shadows more consistent with the shadow generation rules in real-world scenes, thereby improving the realism of game scenes and the user's gaming experience.
[0041] Implementing the method provided in the first aspect, in some embodiments, generates a target visibility map based on attribute data and sampled shadows, including:
[0042] Determine the fuzzy radius based on attribute data;
[0043] Based on the fuzzy radius and the standard deviation of the normal distribution, the sampled shadows are blurred to generate a target visibility map.
[0044] Secondly, embodiments of this application provide a terminal device, which may include: a calculation module, an input module, and a judgment module;
[0045] The calculation module is used to calculate the key shadow map corresponding to the key game scene based on the geographic information in the geographic information system. The key shadow map is the shadow map corresponding to the game model at the key time node. The key time node is a preset time node, and the number of key time nodes is greater than or equal to 2.
[0046] The input module is used to receive user operation commands;
[0047] The calculation module is also used to determine viewport information based on operation instructions. The viewport information includes a first time node, which is the time node of the game scene corresponding to the viewport information.
[0048] The judgment module is used to determine whether the first time node is a critical time node;
[0049] The calculation module is also used to generate a target visibility map based on the judgment results and key shadow maps;
[0050] The calculation module is also used to draw shadows on the game scene corresponding to the viewport information based on the target visibility map, and generate the target game image frame.
[0051] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0052] The calculation module is also used to blur the key shadow map corresponding to the first time node and generate a target visibility map when the judgment result is yes.
[0053] The calculation module is also used to generate a target visibility map based on the target shadow map corresponding to the target time node when the judgment result is negative. The target time node is the two key time nodes before and after the first time node, and the target shadow map is the key shadow map corresponding to each target time node.
[0054] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0055] The calculation module is also used to generate the corresponding first visibility map based on the key shadow map.
[0056] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0057] The calculation module is also used to approximate the first visibility map corresponding to the target shadow map to generate a target visibility map.
[0058] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0059] The calculation module is also used to determine the shadow bounding box and control points in the first visibility map, where the control points are the vertices of the shadow bounding box;
[0060] The calculation module is also used to perform inverse bilinear interpolation based on the coordinates of the first time node, the target time node, and the control point to obtain the target visibility map.
[0061] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0062] The calculation module is also used to determine the key game scenarios corresponding to key time nodes based on key time nodes and time data;
[0063] The calculation module is also used to calculate key shadow maps corresponding to key game scenes based on spatial data.
[0064] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0065] The calculation module is also used to determine the sampling width of the key shadow map based on elevation information and preset formulas;
[0066] The calculation module is also used to generate sampling shadows based on the sampling width.
[0067] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0068] The calculation module is also used to determine the sampling width based on elevation information, light source width, and scaling factor. The light source width is related to key time nodes, and the scaling factor is used to adjust the blur level of the sampled shadow.
[0069] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0070] The judgment module is also used to determine whether the shadow projection surface in the game scene corresponding to the viewport information contains attribute data;
[0071] The calculation module is also used to generate a target visibility map based on the attribute data and sampled shadows when the shadow projection surface in the game scene corresponding to the viewport information contains attribute data;
[0072] The calculation module is also used to determine the sampled shadow as the target visibility map when the shadow projection surface in the game scene corresponding to the viewport information does not contain attribute data.
[0073] In implementing the method provided in the second aspect, in some embodiments, the terminal device further includes:
[0074] The calculation module is also used to determine the fuzzy radius based on attribute data;
[0075] The calculation module is also used to blur the sampled shadows based on the blur radius and the standard deviation of the normal distribution to generate a target visibility map.
[0076] Thirdly, this application provides a terminal device including one or more processors and one or more memories; wherein the one or more memories are coupled to one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when the one or more processors execute the computer instructions, cause the execution of the method described in the first aspect and any possible implementation thereof.
[0077] Fourthly, this application provides a computer-readable storage medium including instructions that, when executed on a target terminal, cause the execution of the method described in the first aspect and any possible implementation thereof.
[0078] Fifthly, this application provides a computer program product containing instructions that, when the computer program product is run on a terminal device, causes the terminal device to perform the method described in the first aspect and any possible implementation thereof.
[0079] It is understood that the terminal devices provided in the second and third aspects, the computer-readable storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the methods provided in this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here. Attached Figure Description
[0080] Figure 1 This is a schematic diagram of a shadow generation process based on shadow mapping in the existing technology;
[0081] Figure 2 This is a flowchart illustrating a method for generating shadows based on geographic information provided in this application;
[0082] Figure 3 This is a schematic diagram of a data structure for a game data packet type provided in an embodiment of this application;
[0083] Figure 4 This is a scene diagram illustrating the determination of key game scenes according to an embodiment of this application;
[0084] Figure 5 This is a flowchart illustrating a method for generating a target visibility map provided in an embodiment of this application;
[0085] Figure 6 This is a schematic diagram of a scenario for generating a target visibility map, provided in an embodiment of this application.
[0086] Figure 7 This is a flowchart illustrating a method for blurring a visibility map according to an embodiment of this application;
[0087] Figure 8 This is a schematic diagram of the composition of a terminal device provided in an embodiment of this application;
[0088] Figure 9 This is a schematic diagram of the hardware structure of another terminal device provided in an embodiment of this application;
[0089] Figure 10 This is a software structure block diagram of a terminal device provided in an embodiment of this application. Detailed Implementation
[0090] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; the word "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0091] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0092] The term "user interface (UI)" used in the following embodiments of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. It realizes the conversion between the internal form of information and the form that the user can accept. The user interface is source code written in a specific computer language such as Java or Extensible Markup Language (XML). The interface source code is parsed and rendered on the terminal device, ultimately presenting content that the user can recognize. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be visible interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets displayed on the terminal device's screen.
[0093] To ensure clarity and conciseness in the description of the following embodiments, a brief introduction to the related technologies is given first:
[0094] A Geographic Information System (GIS), sometimes also known as "Geoscience Information System", is a specific and very important spatial information system. It is a technical system that, supported by computer hardware and software systems, collects, stores, manages, calculates, analyzes, displays, and describes geographical distribution data in the space of the entire or part of the Earth's surface (including the atmosphere). The geographical information in a Geographic Information System can include spatial data, temporal data, and attribute data. For this application and the related embodiments of this application, the spatial data can be the position information (such as coordinate information) of each segment or object in the game scene, the temporal data can be the time node of the current game scene corresponding to the user operation instruction, and the attribute data can be the material information of each segment or object in the game scene, etc.
[0095] Shadow mapping is the process of adding shadows in 3D computer graphics, also known as Light Mapping, and can also be considered a method to achieve realistic lighting and shadow effects without reducing the frame rate. The basic process of the shadow mapping algorithm is as follows: Treat the light source as a camera, render the entire scene, and save the depth information in the depth buffer into a texture, which is called the shadow map texture or depth map texture; Render the entire scene using a regular camera. For each visible pixel point, assume its viewport coordinates are (x, y, z), and transform the coordinates (x, y, z) to the clip coordinates (x1, y1, z1) of the light source (i.e., the situation of rendering the scene with the light source as a camera); Compare z1 with the z value at (x1, y1) in the depth map texture. If z1 < z, then this pixel point is not in the shadow; otherwise, this pixel point is in the shadow. By judging whether each pixel point in the scene is in the shadow, a visibility map corresponding to the scene can be obtained, and then the shadow rendering of the scene can be completed.
[0096] Please refer to Figure 1 , Figure 1 which is a schematic diagram of a shadow generation process based on shadow mapping in the prior art.
[0097] As Figure 1 shown, the prior art method can include the following steps:
[0098] S101: The terminal device generates a shadow map of the game scene in the light source coordinate system.
[0099] S102: The terminal device converts the viewport coordinates of each game model in the current viewport scene to world coordinates.
[0100] Specifically, the coordinates of the pixels of each game model in the current viewport scene can be transformed from the viewport coordinate system to the world coordinate system to obtain the first coordinates of the pixels in the current viewport scene.
[0101] S103: The terminal device converts the world coordinates of each game model in the current viewport scene to the light source coordinates.
[0102] For example, the first coordinate is transformed from the world coordinate system to the light source coordinate system to obtain the second coordinate of the pixel in the current viewport scene in the light source coordinate system.
[0103] S104: The terminal device compares the depth values of each game model in the current viewport scene with the shadow map in the light source coordinate system.
[0104] S105: The terminal device generates a visibility map corresponding to the current viewport scene.
[0105] Specifically, the terminal device 10 can compare the coordinate value representing "depth" in the second coordinate with the corresponding depth value in the shadow map, and generate a visibility map corresponding to the current viewport scene. Then, the terminal device can draw shadows in the current viewport scene based on the visibility map.
[0106] S106: The terminal device draws a shadow based on the visibility map.
[0107] As can be seen, existing technologies, when rendering shadows based on the current viewport scene (or viewport coordinate information), require multiple maintenance or generation of shadow maps, increasing the number of rendering iterations. Furthermore, rendering each frame of the game scene necessitates multiple coordinate system transformations, further increasing the computational overhead of the terminal device. Existing technologies also fail to consider the impact of the imaging surface material on shadow rendering effects, easily leading to homogenized shadows. In addition, each frame of the game scene requires sampling from the shadow map to generate a visibility map. Due to limitations in the accuracy of the data and the size of the shadow map itself when the light source or user's viewpoint moves, consistent shadow sampling cannot be guaranteed for each frame of the game scene. Therefore, shadow jitter may occur during real-time rendering of the game scene, which is detrimental to the user's gaming experience.
[0108] This application provides a method for generating shadows based on geographic information. It can generate corresponding key shadow maps for game scenes at key time points only, and can render game scenes based on time nodes corresponding to user operation commands and key shadow maps. This helps to reduce the operating burden of terminal devices while ensuring that game scenes have realistic and three-dimensional effects, and also helps to protect the user's gaming experience.
[0109] Please see Figure 2 , Figure 2 This is a flowchart illustrating a method for generating shadows based on geographic information, provided in an embodiment of this application.
[0110] like Figure 2 As shown, the method may include the following steps:
[0111] S201: The terminal device calculates the key shadow texture corresponding to the key game scene based on the geographic information in the geographic information system.
[0112] Among them, the key shadow map can be the shadow map corresponding to the game model at the key time node, the key time node is a preset time node, and the number of key time nodes is greater than or equal to 2.
[0113] In some possible implementations, the technician can select appropriate time nodes as key time nodes based on the shadow imaging rules. Specifically, the technician can select the hourly time node as the key time node; alternatively, the technician can also select the time node that can form a shadow that clearly highlights the shape features of the object as the key time node; alternatively, the technician can also use the area of the shadow as the basis for setting the key time node, which is not limited in this application.
[0114] Specifically, taking a "day" in a game as an example, technicians can pre-define the hourly times of the day as key time nodes (such as 00:00, 1:00, 2:00...23:00). When a user launches the game application on terminal device 10, terminal device 10 can generate corresponding shadow maps based on the game model (or game scene) at the key time node. Understandably, the more key time nodes (or key shadow maps) there are, the more realistic and three-dimensional the shadow rendering results of the game scene corresponding to non-key time nodes will be. However, too many key time nodes cannot achieve the goal of reducing the operating load of terminal device 10. Therefore, technicians can set an appropriate number of key time nodes according to the actual situation; this application does not impose any restrictions on this.
[0115] It should be noted that the terminal device 10 used to execute the method of the embodiments of this application is a terminal device with rendering function. The terminal device 10 can be of various types, and the embodiments of this application do not limit its specific type. For example, the terminal device 10 can be a mobile phone, and can also include tablet computers, desktop computers, desktop computers with touch-sensitive surfaces or touch panels, laptop computers, handheld computers, smart screens, wearable devices (such as smartwatches, smart bracelets, etc.), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, in-vehicle systems, smart headphones, game consoles, and can also be Internet of Things (IoT) devices or smart home devices such as smart water heaters, smart lights, smart air conditioners, etc.
[0116] In some possible implementations, calculating key shadow maps corresponding to key game scenes based on geographic information in a geographic information system may include:
[0117] Terminal device 10 obtains game data packets from the server;
[0118] Terminal device 10 receives user operation commands;
[0119] Terminal device 10 responds to the user's operation command and calculates the key shadow texture corresponding to the key game scene based on the geographic information in the geographic information system.
[0120] Among them, such as Figure 3 As shown, Figure 3 This is a data structure diagram of a game data packet type provided in an embodiment of this application. The game data packet may include position information, normal information, color information, texture coordinates, spatial data, time data, and attribute data of each game model in the game scene.
[0121] In some other possible implementations, geographic information may include spatial data and temporal data;
[0122] Calculating key shadow maps corresponding to key game scenes based on geographic information from a geographic information system can include:
[0123] Terminal device 10 determines the key game scenarios corresponding to key time nodes based on key time nodes and time data;
[0124] Terminal device 10 calculates key shadow maps corresponding to key game scenes based on spatial data.
[0125] Among them, the spatial data in the geographic information can be the location information (or relative location information) of each game model in different game scenarios, and the temporal data can be the time nodes corresponding to different game scenarios.
[0126] For example, please see Figure 4 , Figure 4 This application provides a scene diagram for determining key game scenes in an embodiment.
[0127] like Figure 4 As shown, terminal device 10 can respond to user installation commands (such as...) Figure 4 When the user clicks button 41, the terminal device 10 retrieves the data packet corresponding to the game application 42 from the server 20. After receiving the user's launch command, the terminal device 10 can use the data packet corresponding to the game application 42 (the contents of the data packet can be found in [reference]). Figure 3 (Related embodiment content) The calculation of key shadow maps for key game scenes in game application 42 begins. Furthermore, during the calculation of key shadow maps corresponding to key game scenes based on geographic information from a geographic information system, terminal device 10 can filter out key time nodes based on the game timeline and time data, and based on the mapping relationship between time and game scenes (e.g., Figure 4 Table 43) of the first mapping relationship in the table determines the key game scenes corresponding to the key time nodes.
[0128] Furthermore, in the process of calculating key shadow maps corresponding to key game scenes based on spatial data, the terminal device 10 can refer to... Figure 1 The method for generating shadow maps using existing technologies is mentioned, and key shadow maps corresponding to key game scenes are generated by combining the position information of each game model in key game scenes.
[0129] In some other possible implementations, after calculating the key shadow map corresponding to the key game scene based on the geographic information in the geographic information system, the terminal device 10 can blur the key shadow map to generate the corresponding first visibility map.
[0130] S202: The terminal device responds to the user's operation command and determines the viewport information.
[0131] The viewport information may include a first time node, which is the time node of the game scene corresponding to the viewport information. Specifically, the viewport information may represent the game scene (or game screen) that the user can currently see through the interface of the terminal device 10. However, before presenting the game scene (or game screen) to the user, the game scene (or game screen) needs to be rendered. The terminal device 10 can determine the game scene corresponding to the user's operation command based on the first time node, and then perform the corresponding rendering operation.
[0132] S203: The terminal device determines whether the first time node is the critical time node.
[0133] S204: Generate a target visibility map based on the judgment result and the key shadow map.
[0134] In some possible implementations, generating a first shadow map based on the judgment result and the key shadow map may include:
[0135] If the judgment result is yes, the terminal device 10 will blur the key shadow map corresponding to the first time node and generate a target visibility map.
[0136] If the judgment result is negative, the terminal device 10 generates a target visibility map based on the target shadow map corresponding to the target time node. The target time node is the two key time nodes before and after the first time node, and the target shadow map is the key shadow map corresponding to each target time node.
[0137] As can be seen, in this embodiment, the terminal device 10 can determine which shadow rendering method needs to be applied to the game scene corresponding to the user's operation instruction by judging whether the first time node corresponding to the user's operation instruction is a critical time node. For example, assuming time nodes 10:00, 14:00, and 16:00 are critical time nodes, if the first time node corresponding to the user's operation instruction is 10:00, then the first time node can be determined as a critical time node. In one possible implementation, if the terminal device 10 does not generate a first visibility map based on the critical shadow map after acquiring the game data package and before receiving the user's operation instruction, then the critical shadow map corresponding to the 10:00 time node can be blurred to generate a target visibility map. In another possible implementation, if the terminal device 10 does not generate a first visibility map based on the critical shadow map after acquiring the game data package and before receiving the user's operation instruction, then the critical shadow map corresponding to the 10:00 time node can be blurred to generate a target visibility map. If the first visibility map corresponding to all key shadow maps has already been generated before accepting the user's operation command, then the first visibility map corresponding to the 10:00 time node can be used as the target visibility map, without needing to blur the key shadow maps again. If the first time node corresponding to the user's operation command is 15:00, then 14:00 and 16:00 can be used as target time nodes, and the key shadow maps corresponding to the 14:00 time node and the key shadow maps corresponding to the 16:00 time node can be used as target shadow maps. Based on the target shadow maps, the target visibility map corresponding to the 15:00 time node can be generated.
[0138] Furthermore, the terminal device 10 can obtain a target visibility map by approximating the first visibility map corresponding to the target shadow map. The specific approximation process can be found in [reference needed]. Figure 5 Related implementation examples.
[0139] S205: Based on the target visibility map, the terminal device performs shadow rendering on the game scene corresponding to the viewport information to generate a target game image frame.
[0140] The viewport information may also include the viewport scene and viewport coordinate information. The terminal device 10 can determine the specific game scene area requiring shadow rendering based on the viewport scene. The terminal device can also perform coordinate system transformation on the viewport coordinate information (which can be understood as the coordinate information of each game model in the game scene corresponding to the viewport scene in the viewport coordinate system). Finally, the first shadow map corresponding to the viewport information generates an initial visibility map corresponding to the viewport information. It should be noted that the initial visibility map can be understood as the initial shadow distribution map in the game scene corresponding to the viewport information, which can simply show the shadow generation direction, position, and size of each game model in the game scene corresponding to the viewport information.
[0141] Understandably, the target visibility map can reflect the shadow distribution of the game scene corresponding to the viewport information (e.g., whether each pixel is in shadow, or the pixel value of each pixel). Therefore, the target game image frame corresponding to the viewport information can be drawn based on the target visibility map.
[0142] Furthermore, geographic information can also include attribute data and elevation information. Attribute data can represent the surface material of each game model in the game scene; different surface materials will have different effects on shadow generation. Elevation information can represent the height difference between different pixels of each game model and the game horizontal plane; different elevation information will have different effects on shadow generation. By blurring the initial visibility map based on attribute data and elevation information, a more realistic and three-dimensional target visibility map can be generated. For example, the smoother the surface material of the game model, the clearer the shadow presented on that game model's surface; the rougher the surface material of the game model, the blurrier the shadow presented on that game model's surface; the farther a pixel on the game model is from the game horizontal plane, the blurrier the shadow corresponding to that pixel; the closer a pixel on the game model is to the game horizontal plane, the clearer the shadow corresponding to that pixel. It should be noted that the attribute data and elevation information can be pre-entered into the data package corresponding to the game application by technicians; this application does not limit this.
[0143] As can be seen, by implementing the method of this application embodiment, the terminal device 10 can adopt different shadow rendering methods for game scenes corresponding to different time nodes, thereby achieving the purpose of reducing rendering overhead and reducing the operating burden of the terminal device 10. Specifically, the terminal device 10 can generate shadow maps corresponding to key game scenes at key event nodes. When the game scene time node corresponding to the user operation command is not a key time node, the shadow maps corresponding to the two key time nodes before and after the key time node are approximated to obtain the shadow map corresponding to the key time node. This eliminates the need for the terminal device 10 to maintain or update the shadow map frame by frame, reducing the number of rendering operations of the terminal device 10. This can reduce the computational overhead of the terminal device 10 while ensuring the quality of shadow rendering in the game scene.
[0144] Please see Figure 5 , Figure 5 This is a flowchart illustrating a method for generating a target visibility map, as provided in an embodiment of this application.
[0145] like Figure 5 As shown, the method may include the following steps:
[0146] S501: The terminal device determines the shadow bounding box and control point in the first visibility map.
[0147] The control points are the vertices of the shadow bounding box.
[0148] S502: The terminal device performs inverse bilinear interpolation based on the coordinates of the first time node, the target time node, and the control point to obtain the target visibility map.
[0149] For example, please see Figure 6 , Figure 6 This is a schematic diagram of a scenario for generating a target visibility map, provided as an embodiment of this application.
[0150] like Figure 6 As shown, assuming the first time node corresponding to the user's operation command is not a critical time node, the terminal device 10 can base its operation on the target time node corresponding to the first time node (e.g., ...). Figure 6 The first visibility map is generated from the first visibility map of the first target time node 61 and the second target time node 62. Specifically, the terminal device 10 can determine the shadow bounding box (e.g., ...) in each first visibility map. Figure 6 The first shadow bounding box 63 and the second shadow bounding box 64 are defined, and the control points of each shadow bounding box are determined (e.g., the control point corresponding to the first shadow bounding box 63 is the first control point P). 11 Second control point P 12 Third control point P 21 and the fourth control point P 22 The first control point P corresponding to the second shadow bounding box 64 11 Second control point P 12 Fifth control point P 31 and the sixth control point P 32 Referring to inverse bilinear interpolation, the third control point P can be... 21 Fourth control point P 22 Fifth control point P 31 and the sixth control point P 32 The quadrilateral is used for interpolation.
[0151] Furthermore, terminal device 10 can be based on the third control point P 21 and the fifth control point P 31 The coordinate values are interpolated to obtain the seventh control point P. 41 Coordinates:
[0152] f(P 41 )=f(P 21 )+f(P 31 )-f(P 21 )·u
[0153] Where u is the interpolation coefficient, which can be obtained based on the proportional relationship between the first time node and the target time node, and there are no restrictions here.
[0154] Then from the fourth control point P 22 and the sixth control point P 32 The coordinate values are interpolated to obtain the eighth control point P. 42 Coordinates:
[0155] f(P 42 )=f(P 22 )+f(P 32 )-f(P 22 )·u
[0156] Finally, the first control point P can be used. 11 Second control point P 12 Seventh control point P 41 and the eighth control point P 42 The constructed shadow bounding box serves as the shadow bounding box corresponding to the target visibility map, thereby determining the target visibility map corresponding to the first time node.
[0157] Please see Figure 7 , Figure 7 This is a flowchart illustrating a method for blurring a visibility map, as provided in an embodiment of this application.
[0158] like Figure 7 As shown, the method may include the following steps:
[0159] S701: The terminal device determines the sampling width of the key shadow map based on the elevation information and the preset formula.
[0160] In some possible implementations, geographic information may also include attribute data, and spatial data may include elevation information.
[0161] Furthermore, the preset formula can be w sample =w light ·s·h, where w sample w is the sampling width. light w is the width of the light source light Related to key time points, h represents elevation information, s represents scaling factor, and s is used to control the degree of ambiguity.
[0162] S702: The terminal device generates a sampling shadow based on the sampling width.
[0163] S703: The terminal device determines whether the shadow projection surface in the game scene corresponding to the viewport information contains attribute data.
[0164] If the determination is negative, the terminal device 10 executes step S704: The terminal device determines that the sampled shadow is the target visibility map.
[0165] If the determination is yes, the terminal device 10 executes step S705: The terminal device generates a target visibility map based on attribute data and sampled shadows.
[0166] In other possible implementations, if the determination is yes, generating a target visibility map based on attribute data and sampled shadows may include:
[0167] based on Calculate the blur level of the sampled shadow, where K is a constant, r is the blur radius, and σ is the standard deviation of the normal distribution, where r is related to the attribute data.
[0168] Please see Figure 8 , Figure 8 This is a schematic diagram illustrating the composition of a terminal device according to an embodiment of this application. The terminal device 10 may include: a computing module 810 and an input module 820;
[0169] The calculation module 810 is used to calculate the key shadow map corresponding to the key game scene based on the geographic information in the geographic information system. The key shadow map is the shadow map corresponding to the game model at the key time node, and the number of key time nodes is greater than or equal to 2.
[0170] Input module 820 is used to receive user operation commands;
[0171] The calculation module 810 is also used to determine viewport information based on operation instructions, the viewport information including the first time node;
[0172] The calculation module 810 is also used to generate a target visibility map based on the first time node and key shadow maps;
[0173] The calculation module 810 is also used to draw shadows on the game scene corresponding to the viewport information based on the target visibility map, and generate the target game image frame.
[0174] In some possible implementations, the terminal device further includes: a determination module 830;
[0175] The judgment module 830 is used to determine whether the first time node is a critical time node;
[0176] The calculation module 810 is also used to blur the key shadow map corresponding to the first time node when the first time node is a key time node, and generate a target visibility map.
[0177] The calculation module 810 is also used to generate a target visibility map based on the target shadow map corresponding to the target time node when the first time node is not a critical time node. The target time node is the two critical time nodes that are closest to the first time node, and the target shadow map is the critical shadow map corresponding to each of the target time nodes.
[0178] In some other possible implementations, the terminal device further includes:
[0179] The calculation module 810 is also used to generate a corresponding first visibility map based on the key shadow map.
[0180] In some other possible implementations, the terminal device further includes:
[0181] The calculation module 810 is also used to approximate the first visibility map corresponding to the target shadow map to generate a target visibility map.
[0182] In some other possible implementations, the terminal device further includes:
[0183] The calculation module 810 is also used to determine the shadow bounding box and control points in the first visibility map, where the control points are the vertices of the shadow bounding box;
[0184] The calculation module 810 is also used to perform inverse bilinear interpolation based on the coordinate positions of the first time node, the target time node, and the control point to obtain the target visibility map.
[0185] In some other possible implementations, the terminal device further includes:
[0186] The calculation module 810 is also used to determine the key game scenes corresponding to the key time nodes based on key time nodes and time data;
[0187] The calculation module 810 is also used to calculate key shadow maps corresponding to key game scenes based on spatial data.
[0188] In some other possible implementations, the terminal device further includes:
[0189] The calculation module 810 is also used to determine the sampling width of the key shadow map based on the elevation information and the preset formula;
[0190] The calculation module 810 is also used to generate sampling shadows based on the sampling width.
[0191] In some other possible implementations, the terminal device further includes:
[0192] The calculation module 810 is also used to determine the sampling width based on elevation information, light source width, and scaling factor. The light source width is related to key time nodes, and the scaling factor is used to adjust the blur level of the sampling shadow.
[0193] In some other possible implementations, the terminal device further includes:
[0194] The judgment module 830 is also used to determine whether the shadow projection surface in the game scene corresponding to the viewport information contains attribute data;
[0195] The calculation module 810 is also used to generate a target visibility map based on the attribute data and sampled shadows when the shadow projection surface in the game scene corresponding to the viewport information contains attribute data;
[0196] The calculation module 810 is also used to determine the sampled shadow as a target visibility map when the shadow projection surface in the game scene corresponding to the viewport information does not contain attribute data.
[0197] In some other possible implementations, the terminal device further includes:
[0198] The calculation module 810 is also used to determine the fuzzy radius based on attribute data;
[0199] The calculation module 810 is also used to blur the sampled shadows based on the blur radius and the standard deviation of the normal distribution to generate a target visibility map.
[0200] Please see Figure 9 , Figure 9 This is a schematic diagram of the hardware structure of another terminal device provided in an embodiment of this application. The terminal device 10 is used to execute the image recommendation method provided in the preceding method embodiments.
[0201] Terminal device 10 may include a processor 101, a memory 102, a wireless communication module 103, a mobile communication module 104, an antenna 103A, an antenna 104A, a power switch 105, a sensor module 106, a focusing motor 107, a camera 108, a display screen 109, etc. The sensor module 106 may include a gyroscope sensor 106A, an accelerometer sensor 106B, an ambient light sensor 106C, an image sensor 106D, a proximity sensor 106E, etc. The wireless communication module 103 may include a WLAN communication module, a Bluetooth communication module, etc. All of the above components can transmit data via a bus.
[0202] Processor 101 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0203] Memory 102 can be used to store computer executable program code, which may include instructions. Processor 101 executes various functional applications and data processing of terminal device 10 by running the instructions stored in memory 102. Memory 102 may include a program storage area and a data storage area. In specific implementations, memory 102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.
[0204] The wireless communication function of the terminal device 10 can be implemented through antenna 103A, antenna 104A, mobile communication module 104, wireless communication module 103, modem processor, and baseband processor.
[0205] Antennas 103A and 104A can be used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 10 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization.
[0206] The mobile communication module 104 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the terminal device 10. The mobile communication module 104 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 104 can receive electromagnetic waves via antenna 104A, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 104 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 104A.
[0207] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device or displays an image or video through the display screen 109.
[0208] The wireless communication module 103 can provide solutions for wireless communication applications on the terminal device 10, including wireless local area networks (WLAN), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR). The wireless communication module 103 can be one or more devices integrating at least one communication processing module. The wireless communication module 103 receives electromagnetic waves via antenna 103A, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to processor 101. The wireless communication module 103 can also receive signals to be transmitted from processor 101, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 103A.
[0209] The power switch 105 can be used to control the power supply to the terminal device 10.
[0210] The gyroscope sensor 106A can be used to determine the motion attitude of the terminal device 10. In some embodiments, the gyroscope sensor 106A can determine the angular velocity of the terminal device 10 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 106A can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 106A detects the angle of the shaking of the terminal device 10, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shaking of the terminal device 10 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 106A can also be used in navigation and motion-sensing game scenarios.
[0211] Accelerometer 106B can detect the magnitude of acceleration of terminal device 10 in various directions (generally three axes). When terminal device 10 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the user terminal's posture; for example, accelerometer 106B can be applied to applications such as landscape / portrait screen switching and pedometers.
[0212] The ambient light sensor 106C is used to sense the ambient light intensity. The terminal device 10 can adaptively adjust the brightness of the display screen 109 according to the sensed ambient light intensity. The ambient light sensor 106C can also be used to automatically adjust the white balance when taking pictures.
[0213] The 106D image sensor, also known as a photosensitive element, uses the photoelectric conversion function of an optoelectronic device to convert a light image on a photosensitive surface into an electrical signal proportional to the light image. Image sensors can be either charge-coupled device (CCD) sensors or complementary metal-oxide-semiconductor (CMOS) sensors.
[0214] The distance sensor 106E can be used to measure distance. The terminal device 10 can measure distance via infrared or laser. In some shooting scenarios, the terminal device 10 can use the distance sensor 106E to measure distance for fast focusing.
[0215] The focusing motor 107 can be used for rapid focusing. The terminal device 10 can control the movement of the lens via the focusing motor 107 to achieve autofocus.
[0216] Terminal device 10 can perform shooting functions through ISP, camera 108, video codec, GPU, display 109 and application processor.
[0217] The ISP is used to process data fed back by the camera 108. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, converting it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise and brightness. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 108.
[0218] Camera 108 can be used to capture still images or videos. An object is projected onto an image sensor through the lens, generating an optical image. The image sensor converts the light signal into an electrical signal, which is then passed to an ISP (Internet Service Provider) for conversion into a digital image signal. The ISP can output the digital image signal to a DSP (Digital Signal Processor) for processing. The DSP converts the digital image signal into image signals in standard formats such as RGB and YUV. In some embodiments, the terminal device 10 may include one or N cameras 108, where N is a positive integer greater than 1.
[0219] Video codecs are used to compress or decompress digital images. Terminal device 10 may support one or more image codecs. Thus, terminal device 10 can open or save images or videos in various encoding formats.
[0220] Terminal device 10 can implement display functions through a GPU, display screen 109, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 109 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 101 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0221] The display screen 109 is used to display images, videos, etc. The display screen 109 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a minimized display, a microLED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 10 may include one or N displays 109, where N is a positive integer greater than 1.
[0222] It is understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the terminal device 10. In other embodiments of this application, the terminal device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0223] The operations performed by each device in the terminal device 10 can be referred to the relevant descriptions in the previous method embodiments, and will not be elaborated here.
[0224] The software system of terminal device 10 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses a layered mobile operating system as an example to exemplify the software structure of terminal device 10.
[0225] Please see Figure 10 , Figure 10 This is a software structure block diagram of a terminal device according to an embodiment of this application.
[0226] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, a mobile operating system is divided into four layers, from top to bottom: the application layer, the application framework / core service layer, the system libraries and runtime, and the kernel layer.
[0227] The application layer can include a series of application packages.
[0228] like Figure 10 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0229] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0230] like Figure 10 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0231] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0232] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0233] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0234] A phone manager is used to provide communication functions for user terminals. For example, it manages call status (including connection and disconnection).
[0235] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0236] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of download completion or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating the user's device, and flashing indicator lights.
[0237] Runtime can refer to all the code libraries, frameworks, etc., required for a program to run. For example, for the C language, the runtime includes a series of function libraries required for C programs to run. For the Java language, in addition to the core libraries, the runtime also includes the virtual machine required for Java programs to run. The aforementioned core libraries can include the functionalities that the Java language needs to call.
[0238] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.
[0239] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0240] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0241] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0242] A 2D graphics engine is a graphics engine for 2D drawing.
[0243] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0244] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0245] This application also provides a user terminal, which may include a memory and a processor. The memory may be used to store computer programs; the processor may be used to invoke the computer programs in the memory, so that the user terminal executes the methods executed on the user terminal side in any of the above embodiments.
[0246] This application also provides a user terminal, which may include a memory and a processor. The memory may be used to store computer programs; the processor may be used to invoke the computer programs in the memory, so that the user terminal executes the methods executed on the user terminal side in any of the above embodiments.
[0247] This application also provides a chip system, which includes at least one processor for implementing the functions involved on the user terminal side in any of the above embodiments.
[0248] In one possible design, the chip system also includes a memory for storing program instructions and data, which may be located within or outside the processor.
[0249] The chip system can consist of chips or include chips and other discrete components.
[0250] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.
[0251] Optionally, the chip system may contain one or more memories. The memory may be integrated with the processor or disposed separately from it; this application embodiment does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed separately on different chips. This application embodiment does not specifically limit the type of memory or the arrangement of the memory and processor.
[0252] For example, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0253] This application also provides a computer program product, which includes a computer program (also referred to as code or instructions) that, when run, causes a computer to execute the method executed on the user terminal side in any of the above embodiments.
[0254] This application also provides a computer-readable storage medium storing a computer program (also referred to as code or instructions). When the computer program is run, it causes the computer to perform the method executed on the user terminal side in any of the above embodiments.
[0255] The various embodiments of this application can be combined arbitrarily to achieve different technical effects.
[0256] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0257] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0258] In summary, the above description is merely an embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made based on the disclosure of this application should be included within the scope of protection of this application.
Claims
1. A method for shadow generation based on geographic information, characterized in that, The method includes the following steps: Based on geographic information in a geographic information system, calculate key shadow maps corresponding to key game scenes. The key shadow maps are shadow maps corresponding to game models at key time nodes. The key time nodes are preset time nodes, and the number of key time nodes is greater than or equal to 2. In response to the user's operation command, the viewport information is determined, the viewport information including a first time node, the first time node being the time node of the game scene corresponding to the viewport information; Determine whether the first time node is the key time node, and generate a target visibility map based on the determination result and the key shadow map. The target visibility map is used to reflect the shadow distribution of the game scene corresponding to the viewport information. Based on the target visibility map, shadows are drawn on the game scene corresponding to the viewport information to generate the target game image frame.
2. The method according to claim 1, characterized in that, The step of determining whether the first time node is a critical time node, and generating a target visibility map based on the determination result and the critical shadow map, includes: If the judgment result is yes, then the key shadow map corresponding to the first time node is blurred, and the target visibility map is generated; If the judgment result is negative, then the target visibility map is generated based on the target shadow map corresponding to the target time node. The target time node is the two key time nodes before and after the first time node, and the target shadow map is the key shadow map corresponding to each of the target time nodes.
3. The method according to claim 2, characterized in that, After calculating the key shadow maps corresponding to key game scenes based on geographic information in the geographic information system, the method further includes: A first visibility map is generated based on the key shadow map.
4. The method according to claim 3, characterized in that, If the determination result is negative, then based on the target shadow map corresponding to the target time node, the target visibility map is generated, including: The first visibility map corresponding to the target shadow map is approximated to generate the target visibility map.
5. The method according to claim 4, characterized in that, The step of approximating the first visibility map corresponding to the target shadow map to generate the target visibility map includes: Determine the shadow bounding box and control points in the first visibility map, where the control points are the vertices of the shadow bounding box; The target visibility map is obtained by performing inverse bilinear interpolation based on the coordinates of the first time node, the target time node, and the control point.
6. The method according to claim 5, characterized in that, The geographic information includes spatial data and temporal data; The calculation of key shadow maps corresponding to key game scenes based on geographic information in a geographic information system includes: Based on the key time nodes and the time data, the key game scenes corresponding to the key time nodes are determined; The key shadow map corresponding to the key game scene is calculated based on the spatial data.
7. The method according to claim 6, characterized in that, The geographic information also includes attribute data, and the spatial data includes elevation information; If the determination result is yes, then the key shadow map corresponding to the first time node is blurred, and the target visibility map is generated, including: Based on the elevation information and the preset formula, the sampling width for the key shadow map is determined; A sampling shadow is generated based on the sampling width.
8. The method according to claim 7, characterized in that, The step of determining the sampling width of the key shadow map based on the elevation information and a preset formula includes: Based on the elevation information, light source width, and scaling factor, it is determined that for the sampling width, the light source width is related to the key time node, and the scaling factor is used to adjust the blur level of the sampled shadow.
9. The method according to claim 7 or 8, characterized in that, After generating the sampling shadow based on the sampling width, the method further includes: Determine whether the shadow projection surface in the game scene corresponding to the viewport information contains attribute data; If the determination is yes, then the target visibility map is generated based on the attribute data and the sampled shadow; If the determination is negative, then the sampled shadow is determined to be the target visibility map.
10. The method according to claim 9, characterized in that, If the determination is yes, then generating the target visibility map based on the attribute data and the sampled shadow includes: The fuzzy radius is determined based on the attribute data; Based on the blur radius and the standard deviation of the normal distribution, the sampled shadow is blurred to generate the target visibility map, which is used to reflect the shadow distribution of the game scene corresponding to the viewport information.
11. A terminal device, characterized in that, The terminal device includes: a calculation module, an input module, and a judgment module; The calculation module is used to calculate key shadow maps corresponding to key game scenes based on geographic information in the geographic information system. The key shadow map is the shadow map corresponding to the game model at a key time node. The key time node is a preset time node. The number of key time nodes is greater than or equal to 2. The input module is used to receive user operation instructions; The calculation module is further configured to determine viewport information based on the operation instructions. The viewport information includes a first time node, which is the time node of the game scene corresponding to the viewport information. The judgment module is used to determine whether the first time node is the key time node; The calculation module is also used to generate a target visibility map based on the judgment result and the key shadow map; The calculation module is also used to draw shadows on the game scene corresponding to the viewport information based on the target visibility map, and generate a target game image frame.
12. A terminal device, characterized in that, The terminal device includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when executed by the one or more processors, cause the method as described in any one of claims 1-10 to be performed.
13. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is executed on the target terminal, it causes the method described in any one of claims 1-10 to be performed.
Citation Information
Patent Citations
Background updating method of depth map
CN110889866A
Building shadow analysis method, device and equipment and storage medium
CN114494384A