Method, device, electronic device and storage medium for generating fog of war

By receiving the entry mark of the central processor and generating directed distance field maps, the problem of high pressure on the central processor during war fog generation in the prior art is solved, and efficient war fog generation and multi-light source support are achieved.

CN114298887BActive Publication Date: 2025-03-18SHANGHAI MIHOYO TIANMING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011043481.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-28
Publication Date
2025-03-18
Estimated Expiration
2040-09-28

AI Technical Summary

Technical Problem

When generating war fog, the prior art has problems such as high pressure on the central processor, update delay and high computing volume, especially in the case of multiple light sources.

Method used

By receiving the entry mark sent by the central processor, the directed distance field map of the static scene is determined, and the map is rendered based on the light source parameter information and the war fog parameter information, a shadow map is generated, and the war fog effect map is determined.

Benefits of technology

It reduces the pressure on the central processor, improves the operating efficiency of the system CPU, supports multiple light sources, and reduces the pressure on the computing processor when there are not many scene occlusions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114298887B_ABST
    Figure CN114298887B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, device, electronic device and storage medium for generating fog of war. The method comprises: for any static scene of fog of war, receiving an entry mark sent by a central processor to indicate whether it is the first time to enter the static scene of fog of war; based on the entry mark, determining the directed distance field map corresponding to the static scene; based on the first parameter information of each light source sent by the central processor and the second parameter information of fog of war, rendering the directed distance field map to generate a shadow map; based on the shadow map, determining the fog of war effect map of each target in the static scene, and based on the fog of war effect map of each target in the static scene, determining the target fog of war effect map. The effect of reducing the pressure of the central processor and realizing the fog of war effect of multiple light sources is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to online game technology, and in particular to a method, device, electronic device and storage medium for generating fog of war. Background Art

[0002] At present, with the development of online games, how to better experience online games is a problem that people are concerned about. In the game environment, when a player enters the game, the game character will have his own vision in a scene. In the scene, there will be many obstacles. The game character cannot see the area blocked by obstacles. This is the fog of war. How to realize the fog of war is an important task for game designers now.

[0003] In the prior art, there are several ways to design the fog of war: one is a four-domain filling algorithm based on a grid, but the fog of war generated by this method requires the central processing unit (CPU) to open an additional thread and spend a certain amount of time to update after moving the game character, resulting in a delay in the update of the fog of war, and a high time-consuming CPU to fill the map. Another method is to create a grid model of the projected object in real time. This method will create a grid model for each object that needs to be projected in real time, and the mobile platform CPU and bandwidth pressure are very high. The last method is based on the 1D shadow map projection shape. This method requires drawing a complete scene once for each frame, so the operation time is proportional to the number of occluders in the scene, which is not suitable for use in larger-scale scenes.

[0004] The above three methods of realizing fog of war will increase the amount of calculation when there are multiple light sources, which will slow down the efficiency of generating fog of war. Summary of the invention

[0005] The embodiments of the present invention provide a method, device, electronic device and storage medium for generating fog of war, so as to reduce the pressure of a central processing unit and realize the effect of fog of war with multiple light sources.

[0006] In a first aspect, an embodiment of the present invention provides a method for generating fog of war, the method comprising:

[0007] For any static scene in the fog of war, receiving an entry flag sent by the central processor indicating whether it is the first time to enter the static scene in the fog of war;

[0008] Based on the entry identifier, determining a signed distance field map corresponding to the static scene;

[0009] Based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processing unit, the signed distance field map is rendered to generate a shadow map;

[0010] Based on the shadow map, a war fog effect map of each target in the static scene is determined, and based on the war fog effect map of each target in the static scene, a target war fog effect map is determined.

[0011] In a second aspect, an embodiment of the present invention further provides a device for generating fog of war, the device comprising:

[0012] An entry identification receiving module is used to receive, for any static scene in the fog of war, an entry identification sent by the central processor indicating whether it is the first time to enter the static scene in the fog of war;

[0013] A signed distance field map determining module, configured to determine a signed distance field map corresponding to the static scene based on the entry identifier;

[0014] A shadow map determination module, configured to render the signed distance field map based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processing unit to generate a shadow map;

[0015] The target war fog effect map determining module is used to determine the war fog effect map of each target in the static scene based on the shadow map, and determine the target war fog effect map based on the war fog effect map of each target in the static scene.

[0016] In a third aspect, an embodiment of the present invention further provides a system for generating fog of war, the system comprising: a central processing unit and a computing processor;

[0017] The central processing unit is used to, when detecting entry into any static scene of the fog of war, determine whether it is the first time to enter the static scene, generate an entry identifier of whether it is the first time to enter the static scene of the fog of war, and send the entry identifier to the computing processor;

[0018] The computing processor is communicatively connected or electrically connected to the central processing unit, and is used to determine the directed distance field map corresponding to the static scene based on the received entry identifier;

[0019] The central processor is used to send first parameter information of each light source and second parameter information of the fog of war to the computing processor;

[0020] The computing processor is used to render the signed distance field map based on the received first parameter information and the second parameter information to generate a shadow map, determine the fog of war effect map of each target in the static scene based on the shadow map, and determine the target fog of war effect map based on the fog of war effect map of each target in the static scene.

[0021] In a fourth aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0022] one or more processors;

[0023] A storage device for storing one or more programs;

[0024] When the one or more programs are executed by the one or more processors, the one or more processors implement any method for generating fog of war described in any one of the embodiments of the present invention.

[0025] In a fifth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute any of the methods for generating the fog of war described in the embodiments of the present invention.

[0026] The technical solution of the embodiment of the present invention is to receive an entry mark sent by the central processor for any static scene of the fog of war, indicating whether it is the first time to enter the static scene of the fog of war, so that the subsequent processing is performed by the computing processor, so that the generation of the fog of war does not require too much participation of the central processor, but transfers the performance pressure to the computing processor, thereby reducing the pressure of the CPU and improving the operating efficiency of the system CPU. According to the entry mark, the directed distance field map corresponding to the static scene is determined, and a shadow map can be formed according to the directed distance field map. Here, in the process of forming the shadow map, the formation effect of the shadow map is only related to the resolution of the directed distance field map. Therefore, multiple light sources can be supported, and the pressure of the computing processor can be reduced when the number of scene occluders is small. Finally, based on the shadow map, the fog of war effect map of each target in the static scene is determined, and based on the fog of war effect map of each target in the static scene, the target fog of war effect map is determined. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a flow chart of a method for generating fog of war in Embodiment 1 of the present invention;

[0028] Figure 2 is a schematic diagram of a signed distance field map in Embodiment 1 of the present invention;

[0029] Figure 3 is a schematic diagram of a shadow map in Embodiment 1 of the present invention;

[0030] Figure 4 Schematic diagram of a target war fog effect diagram of a static scene in the first embodiment of the present invention;

[0031] Figure 5 is a flow chart of a method for generating fog of war in Embodiment 2 of the present invention;

[0032] Figure 6 is an execution flow chart of the method for generating fog of war in the second embodiment of the present invention;

[0033] Figure 7 is a schematic diagram of a scene map of a static scene in Embodiment 2 of the present invention;

[0034] Figure 8 is a schematic diagram of a target shadow map in Embodiment 2 of the present invention;

[0035] Fig. 9 is a schematic diagram of the structure of a device for generating fog of war in Embodiment 3 of the present invention;

[0036] Fig.10 is a schematic diagram of the structure of a system for generating fog of war in Embodiment 4 of the present invention;

[0037] Fig.11 It is a structural schematic diagram of an electronic device in Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0038] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0039] Embodiment 1

[0040] Figure 1 This is a flow chart of a method for generating fog of war provided in Embodiment 1 of the present invention. The technical solution of the embodiment of the present invention can be applied to a computing processor. This embodiment can be applied to the case of generating fog of war while reducing the pressure of a central processing unit. The method can be executed by a device for generating fog of war. The device for generating fog of war can be implemented by software and / or hardware. The device for generating fog of war can be configured on an electronic computing device. Specifically, the method includes the following steps:

[0041] S110: For any static scene in the fog of war, receiving an entry flag sent by a central processor indicating whether it is the first time to enter the static scene in the fog of war.

[0042] Exemplarily, the entry identifier may be an identifier sent by the central processor indicating whether it is the first time to enter the static scene.

[0043] It should be noted that the technical solution of the embodiment of the present invention is executed by a computing processor.

[0044] Optionally, the operation processor here may be located in the same device as the central processing unit (CPU), or the operation processor may be located in a device independent of the device to which the CPU belongs.

[0045] Optionally, the operation processor here may be any processor. Specifically, the operation processor may be, for example, a graphics processing unit (GPU).

[0046] In this way, the generation of war fog does not require excessive CPU involvement, but instead transfers the performance pressure to the computing processor, which reduces the pressure on the CPU and improves the operating efficiency of the system CPU.

[0047] S120: Determine a signed distance field map corresponding to the static scene based on the entry identifier.

[0048] For example, according to the entry mark sent by the CPU, the directed distance field map corresponding to the static scene can be determined, and the following Figure 2 A schematic diagram of the signed distance field map.

[0049] It is well known to those skilled in the art that Figure 2 In a signed distance field map, each pixel stores the distance from itself to other pixels.

[0050] S130 , based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processing unit, render a signed distance field map to generate a shadow map.

[0051] Exemplarily, the first parameter information may be parameter information of each light source, such as radius information and position information of each light source.

[0052] The second parameter information may be parameter information of the fog of war to be generated, for example, the shadow color and the shadow brightness of the fog of war.

[0053] The shadow map may be an image obtained by rendering the signed distance field map, where the areas visible to the light source are bright areas, and the areas invisible to the light source are shadow areas.

[0054] The central processing unit sends the first parameter information of each light source and the second parameter information of the fog of war to the computing processor, and the computing processor renders the signed distance field map using the first parameter information and the second parameter information to obtain the shadow map.

[0055] Optionally, the method of rendering the signed distance field map based on the first parameter information of each light source sent by the central processing unit and the second parameter information of the fog of war to generate a shadow map may specifically be: ray stepping rendering is performed on the signed distance field map, and according to the position and radius of the light source, when the ray steps to the obstacle pixel point of the signed distance field map, the current obstacle pixel point in the signed distance field map is rendered as a shadow area based on the shadow color of the fog of war and the shadow brightness of the fog of war, so as to generate a shadow map.

[0056] Exemplarily, the first parameter information and the second parameter information may be used to render the directed distance field map through a ray marching algorithm. Specifically, according to the position of the light source, the rays emitted from the light source position are stepped based on the radius of the light source, that is, starting from the light source position, one pixel is stepped at a time. When the obstacle pixel is stepped to, the current obstacle pixel is rendered as a shadow area according to the shadow color of the fog of war and the shadow brightness of the fog of war, and the pixel obscured by the obstacle pixel is also rendered as a shadow area. The specific rendering color and brightness can be rendered according to the received shadow color of the fog of war and the shadow brightness of the fog of war. This can form a picture like Figure 3 A schematic diagram of the shadow map described above. Figure 3 In the figure, the bright area is the area where the light source is visible according to the position and radius of the light source, and the dark area is the shadow area.

[0057] In this way, a shadow map can be formed according to the signed distance field map. In the process of forming the shadow map, the formation effect of the shadow map is only related to the resolution of the signed distance field map. Therefore, multiple light sources can be supported, that is, multiple RayMarching can be used to simultaneously project shadows, so the amount of calculation of the computing processor will not be multiplied, and the pressure on the computing processor can be reduced when the number of scene occluders is not large.

[0058] S140, determining a war fog effect map of each target in the static scene based on the shadow map, and determining a target war fog effect map based on the war fog effect map of each target in the static scene.

[0059] Exemplarily, each target in a static scene may be a preset range area where each obstacle in the static scene is located.

[0060] It should be noted that the targets in the static scene here can also be areas divided according to the geographical orientation of the static scene. For example, the static scene graph corresponding to the static scene can be divided into several parts, such as 4 parts, namely the upper left corner area, the upper right corner area, the lower left corner area and the lower right corner area, etc. The specific number of parts here can be set according to user needs and is not limited here.

[0061] It should be noted that, in addition to the above two division methods, there may be other division methods, as long as the static scene can be divided into multiple areas, they all fall within the protection scope of the embodiments of the present invention.

[0062] The target war fog effect image may be a war fog effect image of the static scene that is finally generated.

[0063] According to the shadow map obtained above, the static scene can be divided into multiple areas according to each obstacle, and then the shadow map obtained above is used to calculate each object (obstacle) in each area to obtain the fog of war effect map of each area, and the obtained fog of war effect map of each area is output to a buffer respectively, and the buffer is copied one by one, and then the final buffer is rendered as a whole, and the following can be obtained: Figure 4 The target war fog effect of this static scene is shown.

[0064] exist Figure 4 In Figure (a), the game character may be used as a light source, the visible area of ​​the game character is a bright area, and the invisible area (blocked area) is a shadow area. Figure 4 In the figure (a), the radius of the light source of the game character is limited to a 90-degree fan-shaped light source, and the direction can be set according to the user's orientation, and is not limited here. Of course, the radius and shape of the light source of the game character here can also be set according to the user's needs, and are not limited here.

[0065] It should be noted that the technical solution of the embodiment of the present invention can be provided with multiple light sources, such as Figure 4 As shown in Figure (b), the game character here is a light source (90 degree fan shape), and the cube in box A is another light source (360 degrees). When forming the above shadow map, the two light sources are RayMarching at the same time to form a shadow map where the two light sources exist at the same time. The shadow map where the two light sources exist at the same time is used to generate the following Figure 4 (b) shows the target war fog effect.

[0066] It should be noted that, when determining the war fog effect map of each target in the static scene based on the shadow map, the war fog effect map of each target can be obtained by parallel processing, which improves the generation efficiency of the target war fog effect map.

[0067] The technical solution of the embodiment of the present invention is to receive an entry mark sent by the central processor for any static scene of the fog of war, indicating whether it is the first time to enter the static scene of the fog of war, so that the subsequent processing is performed by the computing processor, so that the generation of the fog of war does not require too much participation of the central processor, but transfers the performance pressure to the computing processor, thereby reducing the pressure of the CPU and improving the operating efficiency of the system CPU. According to the entry mark, the directed distance field map corresponding to the static scene is determined, and a shadow map can be formed according to the directed distance field map. Here, in the process of forming the shadow map, the formation effect of the shadow map is only related to the resolution of the directed distance field map. Therefore, multiple light sources can be supported, and the pressure of the computing processor can be reduced when the number of scene occluders is small. Finally, based on the shadow map, the fog of war effect map of each target in the static scene is determined, and based on the fog of war effect map of each target in the static scene, the target fog of war effect map is determined.

[0068] Embodiment 2

[0069] Figure 5 The flowchart of the method for generating fog of war provided in the second embodiment of the present invention can be combined with the various optional schemes in the above embodiments. In the embodiment of the present invention, optionally, after generating the shadow map, the method further includes: blurring the shadow map for a preset number of times to generate a target shadow map; correspondingly, determining the fog of war effect map of each target in the static scene based on the shadow map includes: multiplying the pixel value of the target shadow map by the pixel value of each target in the static scene to obtain the fog of war effect map of each target in the static scene.

[0070] like Figure 5 As shown, the method of the embodiment of the present invention specifically includes the following steps:

[0071] S210: For any static scene in the fog of war, receiving an entry flag sent by the central processor indicating whether it is the first time to enter the static scene in the fog of war.

[0072] S220: Determine a signed distance field map corresponding to the static scene based on the entry identifier.

[0073] Optionally, when the entry mark is an mark of entering a static scene for the first time, determining the signed distance field map corresponding to the static scene based on the entry mark may specifically be: obtaining a static scene graph of the fog of war; vertically projecting the static scene graph to obtain a scene map, and baking the scene map to obtain a signed distance field map corresponding to the static scene.

[0074] Exemplary, reference Figure 6The execution flow chart of the method for generating the fog of war is as follows: when the user enters the static scene for the first time, that is, the static scene is entered for the first time, a static scene graph of the fog of war is obtained, and the static scene graph is vertically projected to obtain a scene map of the static scene, such as Figure 7 shown.

[0075] According to the obtained scene map, the scene map is baked to obtain Figure 2 Specifically, the process of baking the scene map to obtain the signed distance field map belongs to the prior art and will not be described in detail here.

[0076] It should be noted that the process of baking the scene map to obtain the signed distance field map only needs to be performed once, that is, only when entering the static scene for the first time, it is necessary to generate the scene map according to the static scene map, and then bake the scene map to obtain the signed distance field map corresponding to the static scene. When entering the static scene again in the future, the signed distance field map corresponding to the static scene can be directly called. This saves the generation time of the target war fog effect map and improves the generation efficiency of the target war fog effect map.

[0077] exist Figure 7 In the figure, the black area is the obstacle information in the static scene, and the gray area is the empty occlusion area in the static scene. Figure 7 The arrow B in the figure is the direction of the viewing angle of the light source, that is, Figure 3 The shadow map is generated according to the position of the light source.

[0078] It should be noted that the specific process of vertically projecting a static scene graph to obtain a scene map is a prior art and will not be described here.

[0079] Optionally, when the entry identifier is not an identifier for entering a static scene for the first time; determining the directed distance field map corresponding to the static scene based on the entry identifier includes: based on an identifier that it is not the first time entering the static scene, and a storage address of the directed distance field map corresponding to the static scene sent by a received central processor, calling the directed distance field map corresponding to the static scene.

[0080] Exemplarily, when the entry mark is a mark that indicates that the user is not entering the static scene for the first time, it means that the user has entered the static scene before and the signed distance field map of the static scene has been generated.

[0081] According to the identifier, the storage address of the directed distance field map corresponding to the static scene sent by the central processor can be received, for example, it can be a storage ID, and according to the storage address, the directed distance field map corresponding to the static scene can be directly called. In this way, there is no need to regenerate the directed distance field map corresponding to the static scene, which improves the generation efficiency of the target war fog effect map.

[0082] S230 , based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processing unit, render a signed distance field map to generate a shadow map.

[0083] S240: Blurring the shadow map a preset number of times to generate a target shadow map.

[0084] Exemplarily, the preset number of times may be a preset number of times the shadow map is blurred. The number of times the shadow map is blurred may be set according to user needs and is not limited here.

[0085] Specifically, if the user feels that the shadow map is not soft enough, the blurring may be performed more times; if the user feels that the softness of the shadow map is feasible, the blurring may be performed less times.

[0086] The target shadow map can be a Figure 3 The image generated by blurring the shadow map of Figure 8 shown.

[0087] Blurring the shadow map in this way can make the shadow rendering softer and the rendering result more refined. Figure 8 The shadow edge of the circle in the figure is Figure 3 Smoother and softer.

[0088] S250, based on the pixel value of the target shadow map, multiplying the pixel value of each target in the static scene to obtain a fog of war effect map of each target in the static scene, and based on the fog of war effect map of each target in the static scene, determine the target fog of war effect map.

[0089] Exemplarily, according to the obtained target shadow map, the pixel value of the target shadow map is multiplied by the pixel value of each target in the static scene, so that the color of the bright area will not change, and the color of the shadow area will become darker, so that the war fog effect map of each target in the static scene can be obtained. According to the war fog effect map of each target in the static scene, the target war fog effect map can be obtained.

[0090] The technical solution of the embodiment of the present invention blurs the shadow map a preset number of times, so that the shadow rendering is softer and the rendering result is more refined, and a target shadow map with better rendering effect can be obtained.

[0091] Embodiment 3

[0092] Fig. 9 This is a schematic diagram of the structure of a device for generating fog of war provided in Embodiment 3 of the present invention. This device may be arranged in a computing processor. Fig. 9 As shown, the device includes: an entry identification receiving module 31, a directed distance field map determining module 32, a shadow map determining module 33 and a target war fog effect map determining module 34.

[0093] The entry mark receiving module 31 is used to receive, for any static scene in the fog of war, an entry mark sent by the central processor, indicating whether it is the first time to enter the static scene in the fog of war;

[0094] A signed distance field map determining module 32, configured to determine a signed distance field map corresponding to the static scene based on the entry identifier;

[0095] A shadow map determination module 33, configured to render the signed distance field map based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processor to generate a shadow map;

[0096] The target war fog effect map determining module 34 is used to determine the war fog effect map of each target in the static scene based on the shadow map, and determine the target war fog effect map based on the war fog effect map of each target in the static scene.

[0097] Optionally, the operation processor and the central processing unit are located in the same device, or the operation processor is located in a device independent of the device to which the central processing unit belongs.

[0098] Optionally, when the entry mark is a mark of entering the static scene for the first time, the signed distance field map determination module 32 is specifically used to:

[0099] A static scene graph of the fog of war is obtained; the static scene graph is vertically projected to obtain the scene map; and the scene map is baked to obtain a signed distance field map corresponding to the static scene.

[0100] Optionally, when the entry mark is not a mark of entering the static scene for the first time, the signed distance field map determining module 32 is specifically configured to:

[0101] Based on the identification that it is not the first time to enter the static scene and the storage address of the directed distance field map corresponding to the static scene sent by the central processor, the directed distance field map corresponding to the static scene is called.

[0102] Based on the technical solution of the above embodiment, the device further includes:

[0103] A target shadow map generation module, used to blur the shadow map a preset number of times to generate a target shadow map;

[0104] Correspondingly, the target war fog effect diagram determination module 34 is specifically used for:

[0105] Based on the pixel value of the target shadow map, multiplying it by the pixel value of each target in the static scene, a war fog effect map of each target in the static scene is obtained, and based on the war fog effect map of each target in the static scene, a target war fog effect map is determined.

[0106] Optionally, the first parameter information includes: the position of each light source and the radius of each light source; the second parameter information includes: the shadow color of the war fog and the shadow brightness of the war fog.

[0107] Based on the technical solution of the above embodiment, the shadow map determination module 33 is specifically used for:

[0108] The signed distance field map is subjected to ray stepping rendering. According to the position and radius of the light source, when the ray steps to the obstacle pixel point of the signed distance field map, the current obstacle pixel point in the signed distance field map is rendered as a shadow area based on the shadow color of the fog of war and the shadow brightness of the fog of war, so as to generate a shadow map.

[0109] The war fog generating device provided by the embodiment of the present invention can execute the war fog generating method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0110] Embodiment 4

[0111] Fig.10 This is a schematic diagram of the structure of a system for generating fog of war provided in Embodiment 4 of the present invention, as shown in FIG. Fig.10 As shown, the system includes: a central processing unit 40 and an operation processor 50.

[0112] The central processing unit 40 is used to determine whether it is the first time to enter any static scene in the fog of war when it is detected that the static scene is entered, generate an entry mark of whether it is the first time to enter the static scene in the fog of war, and send the entry mark to the computing processor 50;

[0113] The computing processor 50 is communicatively connected or electrically connected to the central processing unit 40, and is used to determine the directed distance field map corresponding to the static scene based on the received entry identifier;

[0114] The central processing unit 40 is used to send the first parameter information of each light source and the second parameter information of the fog of war to the computing processor 50;

[0115] The computing processor 50 is used to render the signed distance field map based on the received first parameter information and the second parameter information to generate a shadow map, determine the fog of war effect map of each target in the static scene based on the shadow map, and determine the target fog of war effect map based on the fog of war effect map of each target in the static scene.

[0116] Optionally, the operation processor 50 and the central processing unit 40 are located in the same device, or the operation processor 50 is located in a device independent of the device to which the central processing unit 40 belongs.

[0117] For example, when the computing processor and the central processing unit are located in the same device, reference may be made to Fig.10 As shown in Figure (a), the operation processor and the central processing unit can be electrically connected.

[0118] When the computing processor is located in a device independent of the device to which the central processing unit belongs, it can refer to Fig.10 As shown in Figure (b), the computing processor and the central processing unit can be communicatively connected.

[0119] The system for generating fog of war provided by the embodiment of the present invention can execute the method for generating fog of war provided by any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0120] Embodiment 5

[0121] Fig.11 A schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention is shown in FIG. Fig.11 As shown, the electronic device includes a processor 70, a memory 71, an input device 72 and an output device 73; the number of processors 70 in the electronic device can be one or more. Fig.11 A processor 70 is taken as an example; the processor 70, the memory 71, the input device 72 and the output device 73 in the electronic device can be connected by a bus or other means. Fig.11 The example of connecting through bus is taken in the following.

[0122] The memory 71, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the method for generating fog of war in the embodiment of the present invention (for example, the entry identification receiving module 31, the directed distance field map determination module 32, the shadow map determination module 33 and the target fog of war effect map determination module 34). The processor 70 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 71, that is, realizing the above-mentioned method for generating fog of war.

[0123] The memory 71 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 71 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 71 may further include a memory remotely arranged relative to the processor 70, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0124] The input device 72 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 73 may include a display device such as a display screen.

[0125] Embodiment 6

[0126] Embodiment 6 of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute a method for generating fog of war when executed by a computer processor.

[0127] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the method for generating fog of war provided by any embodiment of the present invention.

[0128] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer electronic device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0129] It is worth noting that in the above-mentioned embodiment of the war fog generation device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

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

Claims

1. A method for generating fog of war, characterized in that: The method is applied to a computing processor, comprising: For any static scene in the fog of war, receiving an entry flag sent by the central processor indicating whether it is the first time to enter the static scene in the fog of war; Based on the entry identifier, determining a signed distance field map corresponding to the static scene; Based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processing unit, the signed distance field map is rendered to generate a shadow map; Determining a fog of war effect map for each target in the static scene based on the shadow map, and determining a target fog of war effect map based on the fog of war effect map for each target in the static scene; The first parameter information includes: the position of each light source and the radius of each light source; the second parameter information includes: the shadow color of the war fog and the shadow brightness of the war fog; The method of rendering the directed distance field map based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processor to generate a shadow map includes: The signed distance field map is subjected to ray stepping rendering. According to the position and radius of the light source, when the ray steps to the obstacle pixel point of the signed distance field map, the current obstacle pixel point in the signed distance field map is rendered as a shadow area based on the shadow color of the fog of war and the shadow brightness of the fog of war, so as to generate a shadow map.

2. The method according to claim 1, characterized in that: The operation processor and the central processor are located in the same device, or the operation processor is located in a device independent of the device to which the central processor belongs.

3. The method according to claim 1, characterized in that When the entry mark is a mark of entering the static scene for the first time; The step of determining the directed distance field map corresponding to the static scene based on the entry identifier includes: Get a static scene map of the fog of war; Performing vertical projection on the static scene graph to obtain the scene map; The scene map is baked to obtain a signed distance field map corresponding to the static scene.

4. The method according to claim 1, characterized in that When the entry identifier is not an identifier for entering the static scene for the first time; The step of determining the directed distance field map corresponding to the static scene based on the entry identifier includes: Based on the identification that it is not the first time to enter the static scene and the storage address of the directed distance field map corresponding to the static scene sent by the central processor, the directed distance field map corresponding to the static scene is called.

5. The method according to claim 1, characterized in that After generating the shadow map, the method further includes: Blurring the shadow map a preset number of times to generate a target shadow map; Correspondingly, determining the fog of war effect map of each target in the static scene based on the shadow map includes: Based on the pixel value of the target shadow map, the pixel value of each target in the static scene is multiplied to obtain a fog of war effect map of each target in the static scene.

6. A device for generating fog of war, characterized in that: The device is arranged in a computing processor and includes: An entry identification receiving module is used to receive, for any static scene in the fog of war, an entry identification sent by the central processor indicating whether it is the first time to enter the static scene in the fog of war; A signed distance field map determining module, configured to determine a signed distance field map corresponding to the static scene based on the entry identifier; A shadow map determination module, configured to render the signed distance field map based on the first parameter information of each light source and the second parameter information of the fog of war sent by the central processing unit to generate a shadow map; A target war fog effect map determining module, used to determine the war fog effect map of each target in the static scene based on the shadow map, and determine the target war fog effect map based on the war fog effect map of each target in the static scene; The first parameter information includes: the position of each light source and the radius of each light source; the second parameter information includes: the shadow color of the war fog and the shadow brightness of the war fog; The shadow map determination module is specifically used for: The signed distance field map is subjected to ray stepping rendering. According to the position and radius of the light source, when the ray steps to the obstacle pixel point of the signed distance field map, the current obstacle pixel point in the signed distance field map is rendered as a shadow area based on the shadow color of the fog of war and the shadow brightness of the fog of war, so as to generate a shadow map.

7. A system for generating fog of war, characterized in that: The system comprises: a central processing unit and an operation processor; The central processing unit is used to, when detecting entry into any static scene of the fog of war, determine whether it is the first time to enter the static scene, generate an entry identifier of whether it is the first time to enter the static scene of the fog of war, and send the entry identifier to the computing processor; The computing processor is communicatively connected or electrically connected to the central processing unit, and is used to determine the directed distance field map corresponding to the static scene based on the received entry identifier; The central processor is used to send first parameter information of each light source and second parameter information of the fog of war to the computing processor; The computing processor is used to render the signed distance field map based on the received first parameter information and the second parameter information to generate a shadow map, determine the fog of war effect map of each target in the static scene based on the shadow map, and determine the target fog of war effect map based on the fog of war effect map of each target in the static scene; The first parameter information includes: the position of each light source and the radius of each light source; the second parameter information includes: the shadow color of the war fog and the shadow brightness of the war fog; The step of rendering the signed distance field map based on the received first parameter information and the received second parameter information to generate a shadow map includes: The signed distance field map is subjected to ray stepping rendering. According to the position and radius of the light source, when the ray steps to the obstacle pixel point of the signed distance field map, the current obstacle pixel point in the signed distance field map is rendered as a shadow area based on the shadow color of the fog of war and the shadow brightness of the fog of war, so as to generate a shadow map.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating fog of war as described in any one of claims 1 to 5.

9. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to execute the method for generating the fog of war as claimed in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for generating fog mask map

    CN106780642A

  • Method for realizing fog of war in game

    CN107358579A