Method and device for achieving high-end hardware game effect through low-end hardware
By dividing the game virtual scene data into pre-processing and real-time processing objects, and generating video files for decoding processing, the problem of high cost of high-end hardware in the existing technology is solved, and high-definition and smooth game effects on low-end hardware are achieved, and Reduced hardware requirements.
Patent Information
- Application Number
- CN202410934905.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-11
AI Technical Summary
Existing video game technology requires high-end hardware to achieve high-quality and smooth game effects, resulting in high hardware costs.
Divide the data objects in the game virtual scene into pre-processing objects and real-time processing objects, use virtual cameras to roam and save data, generate video files, and decode them while the game is running for shadow casting and lighting calculations, reducing the amount of real-time calculations.
Realizing high-end hardware game effects on low-end hardware reduces the amount of calculation and memory consumption, saves hardware costs, and is suitable for fields such as VR and the Metaverse.
Smart Images

Figure CN118750877A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of game data processing, and in particular relates to a method for realizing high-end hardware game effects with low-end hardware. Background Art
[0002] At present, the realization of video games usually uses a game engine to create a digital virtual scene, then sets a virtual camera in the scene, and draws the pictures taken by the virtual camera to the screen. Under the control of the player, the game character can move freely, the perspective can be changed at will (that is, the virtual camera posture changes), and the screen picture is redrawn frame by frame in real time, so that the player can see continuous and smooth animation effects.
[0003] At present, traditional video game technology requires all images to be redrawn in real time in each frame, which requires the corresponding equipment to have strong hardware computing power; and in order to obtain excellent picture effects, the virtual scene needs to be made very fine (models with more triangles, larger textures), which requires more memory to store data, resulting in high-definition and smooth video games that can only run on expensive high-end hardware platforms. Summary of the invention
[0004] To this end, the present invention provides a method and device for realizing high-end hardware game effects with low-end hardware, which can achieve high-definition and smooth game effects without the need for expensive high-end hardware, thereby solving the problem that traditional technology requires reliance on hardware computing power and memory for high-definition and smooth video games.
[0005] In order to achieve the above object, the present invention provides the following technical solution: a method for realizing high-end hardware game effects with low-end hardware, comprising:
[0006] Dividing the data objects in the game virtual scene into pre-processing objects and real-time processing objects, and temporarily deleting the real-time processing objects in the game virtual scene during the pre-processing process;
[0007] Using a virtual camera to roam the game virtual scene according to the game plot, and saving each frame of roaming data obtained, wherein the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data;
[0008] The RGB image data, depth image data, normal image data, category image data, and shadow image data in each frame of roaming data are spliced to generate a summary image, and the summary image of each frame of roaming data is arranged and compressed to form a video file;
[0009] Draw a real-time shadow map of all the real-time processed objects in the game virtual scene using a real-time shadow camera;
[0010] When the game is actually running, the video file is decoded, and the decoded RGB image data is copied to the output buffer of the game. According to the depth map data and the coordinates of the set pixel, the coordinates of the set pixel in the virtual scene of the game are inverted, and the real-time shadow map is used to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object.
[0011] As a preferred method for realizing high-end hardware gaming effects with low-end hardware, the RGB image data is the game screen data normally displayed on the screen;
[0012] The depth map data is the distance from the virtual object represented by each pixel of the RGB map data to the virtual camera;
[0013] The normal map data is normal surface orientation data of the virtual object represented by each pixel of the RGB map data in the camera space.
[0014] As a preferred method for realizing high-end hardware gaming effects with low-end hardware, the category map data is the category of objects in the game virtual scene represented by grayscale values;
[0015] The shadow map data is the depth map data captured by a shadow camera set according to the coordinates and orientation of the main parallel light source in the game virtual scene.
[0016] As a preferred method for realizing high-end hardware gaming effects with low-end hardware, when a new light source is generated in the virtual game scene, real-time lighting is used to generate dynamic lighting for the RGB image data;
[0017] In the process of generating dynamic lighting, the world coordinates of the set pixels in the RGB data are inferred using the depth map data; and the lighting effect of the new light source is calculated using the world coordinates of the set pixels in the RGB data and the normal map data.
[0018] As a preferred solution of the method for realizing high-end hardware game effects with low-end hardware, the method further includes: using the depth map data to determine whether each pixel of the real-time processing object needs to be drawn;
[0019] Using the shadow map data, determining whether the real-time processing object is in the virtual world shadow of the game virtual scene, and calculating the shadow effect of the real-time processing object;
[0020] The physical action effect of the real-time processing object is calculated using the depth map data and the normal map data.
[0021] The present invention also provides a device for realizing high-end hardware game effects with low-end hardware, comprising:
[0022] A virtual scene object processing module, used to divide the data objects in the game virtual scene into pre-processing objects and real-time processing objects, and temporarily delete the real-time processing objects in the game virtual scene during the pre-processing process;
[0023] A virtual scene roaming module is used to roam the game virtual scene according to the game plot using a virtual camera, and save the obtained roaming data of each frame, wherein the information of the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data;
[0024] A roaming data splicing module is used to splice the RGB image data, depth image data, normal image data, category image data, and shadow image data in each frame of roaming data to generate a summary image, and arrange and compress the summary image of each frame of roaming data to form a video file;
[0025] A real-time shadow map drawing module, used for drawing real-time shadow maps of all the real-time processed objects in the game virtual scene using a real-time shadow camera;
[0026] The shadow projection analysis module is used to decode the video file when the game is actually running, copy the decoded RGB image data to the output buffer of the game, and inversely deduce the coordinates of the set pixel in the virtual scene of the game based on the depth map data and the coordinates of the set pixel, and use the real-time shadow map to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object.
[0027] As a preferred solution for realizing high-end hardware gaming effects with low-end hardware, in the virtual scene roaming module:
[0028] The RGB image data is the game screen data normally displayed on the screen;
[0029] The depth map data is the distance from the virtual object represented by each pixel of the RGB map data to the virtual camera;
[0030] The normal map data is normal surface orientation data of the virtual object represented by each pixel of the RGB map data in the camera space.
[0031] As a preferred solution for realizing high-end hardware gaming effects with low-end hardware, in the virtual scene roaming module:
[0032] The category map data is the category of objects in the game virtual scene represented by grayscale values;
[0033] The shadow map data is the depth map data captured by a shadow camera set according to the coordinates and orientation of the main parallel light source in the game virtual scene.
[0034] As a preferred solution for low-end hardware to achieve high-end hardware gaming effects, it also includes:
[0035] The lighting effect analysis module is used to generate dynamic lighting for the RGB image data using real-time lighting when a new light source is generated in the game virtual scene; in the process of generating dynamic lighting, the world coordinates of the set pixels in the RGB data are reversed using the depth map data; and the lighting effect of the new light source is calculated using the world coordinates of the set pixels in the RGB data and the normal map data.
[0036] As a preferred solution for low-end hardware to achieve high-end hardware gaming effects, it also includes:
[0037] The real-time processing object analysis module is used to use the depth map data to determine whether each pixel of the real-time processing object needs to be drawn; it is also used to use the shadow map data to determine whether the real-time processing object is in the virtual world shadow of the game virtual scene, and calculate the shadow effect of the real-time processing object; it is also used to use the depth map data and the normal map data to calculate the physical action effect of the real-time processing object.
[0038] The beneficial effects of the present invention are as follows: data objects in a game virtual scene are divided into pre-processing objects and real-time processing objects, and the real-time processing objects in the game virtual scene are temporarily deleted during the pre-processing process; the game virtual scene is roamed by a virtual camera according to the game plot, and each frame of roaming data obtained is saved, and the information of the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data; the RGB image data, depth image data, normal image data, category image data and shadow image data in each frame of roaming data are spliced to generate a summary image, and the summary image of each frame of roaming data obtained is arranged and compressed to form a video file; a real-time shadow camera is used to draw a real-time shadow image of all the real-time processing objects in the game virtual scene; the video file is decoded when the game is actually running, and the decoded RGB image data is copied to the output buffer of the game, and the coordinates of the set pixel in the game virtual scene are inversely deduced according to the depth map data and the coordinates of the set pixel, and the real-time shadow image is used to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object. The present invention greatly reduces the amount of calculation. Since the pre-processed virtual scene data is not needed during the game process, the amount of virtual scene data is also greatly reduced, thereby reducing the consumption of memory and video memory; it can greatly save hardware costs; it can also be applied to VR, metaverse, digital roaming, digital education, digital museums and other fields, and has practical and economic value. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the drawings required for the implementation methods or the prior art descriptions are briefly introduced below. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0040] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.
[0041] Figure 1 A schematic flow chart of a method for realizing high-end hardware gaming effects using low-end hardware provided by an embodiment of the present invention;
[0042] Figure 2A schematic diagram comparing the processing effects of the method for realizing high-end hardware gaming effects with low-end hardware provided by an embodiment of the present invention;
[0043] Figure 3 A schematic diagram of the device architecture for achieving high-end hardware gaming effects using low-end hardware provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] The core of the present invention is preprocessing, that is, in the process of making the game, the pictures and related data that the players can see are calculated and saved in advance, so that in the actual operation of the game, only these data need to be read, and no complicated physics, lighting and other calculations are required, thereby reducing the amount of calculation. A simple understanding is: a video file is generated when the game is made, and this video file is played when the game is running, so that the playback can be completed smoothly on a low-end hardware platform. Through preprocessing, most of the calculations that previously needed to be completed when the game was running are completed in advance during the game production process, thereby reducing the game's requirements for hardware.
[0046] In view of this, in order to achieve high-quality and smooth game effects without expensive high-end hardware, the embodiment of the present invention provides a method and device for achieving high-end hardware game effects with low-end hardware. The following is the specific content of the embodiment of the present invention.
[0047] Example 1
[0048] See also Figure 1 , a method for realizing high-end hardware gaming effects with low-end hardware provided by embodiment 1 of the present invention comprises the following steps:
[0049] S1, dividing the data objects in the game virtual scene into pre-processing objects and real-time processing objects, and temporarily deleting the real-time processing objects in the game virtual scene during the pre-processing process;
[0050] S2, using a virtual camera to roam the game virtual scene according to the game plot, and saving each frame of roaming data obtained, wherein the information of the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data;
[0051] S3, splicing the RGB map data, depth map data, normal map data, category map data, and shadow map data in each frame of roaming data to generate a summary map, and arranging and compressing the obtained summary map of each frame of roaming data to form a video file;
[0052] S4, using a real-time shadow camera to draw a real-time shadow map of all the real-time processing objects in the game virtual scene;
[0053] S5. When the game is actually running, the video file is decoded, and the decoded RGB image data is copied to the output buffer of the game. According to the depth map data and the coordinates of the set pixel, the coordinates of the set pixel in the virtual scene of the game are inferred, and the real-time shadow map is used to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object.
[0054] In this embodiment, in step S1, not all data objects in the virtual scene of the game are pre-processed, but are divided into two parts: pre-processed objects and real-time processed objects. Objects whose posture, action and other information can be known in advance are set as "pre-processed objects". For example, in a shooting game, assuming that objects such as trees and houses will not be destroyed according to the plot design, trees and houses can be set as pre-processed objects. Objects whose posture, action and other information cannot be known in advance are set as "real-time processed objects". For example, in a shooting game, "enemies" will appear at random positions on the screen, so they are set as real-time processed objects; similarly: it is unpredictable when the player will fire a bullet, so "bullets" also need to be set as real-time processed objects.
[0055] In this embodiment, in step S2, the RGB image data is the game screen data normally displayed on the screen; the depth map data is the distance from the virtual object represented by each pixel of the RGB image data to the virtual camera; the normal map data is the normal surface orientation data of the virtual object represented by each pixel of the RGB image data in the camera space; the category map data is the category of objects in the game virtual scene represented by grayscale values; the shadow map data is the depth map data captured by the shadow camera set with the coordinates and orientation of the main parallel light source in the game virtual scene.
[0056] Specifically, after deleting all real-time processing objects in the game virtual scene, let the virtual camera roam once according to the design of the game plot, and save each frame of roaming data to the hard disk. Each frame of roaming data includes the following information: 1. RGB image data (the screen normally displays the picture); 2. Depth map data (the distance from the virtual object represented by each pixel of the RGB image to the virtual camera); 3. Normal map data (the normal of the virtual object represented by each pixel of the RGB image in the camera space - the direction of the surface); 4. Category map data (see below for details); 5. Shadow map data (a shadow camera is set with the coordinates and direction of the main parallel light source in the virtual scene, and the "depth map" taken by the camera is the shadow map); 6. Virtual camera data: virtual camera coordinates, posture, field of view (FOV), near and far cross-section data, etc.
[0057] Among them, the existing game engine does not have the concept of "category map data". "Category map" is a concept proposed by the embodiment of the present invention: that is, a grayscale map is used to represent the category of objects in the virtual scene of the game. For example, there are four types of objects in the virtual scene of the game, namely ground, house, enemy, and sky. Their "grayscale values" can be defined as 0, 10, 20, and 30 respectively. The specific process of drawing the "category map" is: let the game engine draw objects of different categories in turn, but the value of the drawn pixel is not the material corresponding to the object plus the lighting, but the grayscale value in the category map data, so that a "category map" can be obtained. It should also be noted that in order to achieve more game effects, other pre-processing data may be required, that is, the types of pre-processing data are not limited to the above-mentioned ones.
[0058] In this embodiment, in step S3, the data volume of the "image" in each frame is very large. When saving, the RGB image data, depth image data, normal image data, category image data, and shadow image data are pieced together into a large summary image, that is, a large summary image is generated for each frame, and then the summary images of all frames are arranged together, and a conventional video compression algorithm is used to make a video, such as a video in H.264 format, a video in H.265 format, etc. (It should be noted that it is not necessary to save the above pre-processed data in the form of a video, because the video data is lossy compression, which will lose some data accuracy. If the game requires a lower resolution but a higher data accuracy, the data can be saved directly or subjected to conventional lossless compression). Among them, the virtual camera data is relatively small and can be saved directly without compression.
[0059] It should be noted that the "RGB map, depth map, normal map, shadow map, and virtual camera data" mentioned in this embodiment are basic functions of modern game engines, which are not the content of the present invention and will not be repeated here.
[0060] In this embodiment, in step S4, a "real-time shadow camera" is set to draw shadow maps of all real-time processing objects in the game virtual scene, that is, real-time shadow maps. This step is a basic function of the game engine and will not be repeated here.
[0061] In this embodiment, in step S5, the video file is decoded and the RGB image data is directly copied to the output buffer of the game (this step is equivalent to drawing all the pre-processed objects in the virtual scene, and in conventional video games, this step accounts for most of the computing power, so this is the key to saving computing power in the embodiment of the present invention). While copying, the coordinates of the pixel in the virtual scene of the game are inferred based on the depth map data and the coordinates of the pixel, and then the real-time shadow map of step S4 can be used to calculate whether the pixel is in the real-time shadow, thereby completing the shadow projection from the real-time processing object to the pre-processed object.
[0062] Among them, the specific algorithm pseudo code for using the real-time shadow map to generate dynamic shadows for the preprocessed RGB map is as follows:
[0063] "RGB pixel NDC coordinate_X = RGB pixel screen coordinate_X / RGB image width;
[0064] RGB pixel NDC coordinate_Y=RGB pixel screen coordinate_Y / RGB image height;
[0065] RGB pixel depth value = texture sampling function (preprocessed data_depth map, RGB pixel NDC coordinate_X, RGB pixel NDC coordinate_Y);
[0066] RGB pixel NDC coordinate = (RGB pixel NDC coordinate_X, RGB pixel NDC coordinate_Y, RGB pixel depth value);
[0067] RGB pixel camera coordinates = virtual camera projection inverse matrix * RGB pixel NDC coordinates;
[0068] RGB pixel world coordinates = inverse matrix of world coordinate to virtual camera coordinate transformation * RGB pixel camera coordinates;
[0069] The camera coordinates of RGB pixels in the "real-time shadow camera" = the transformation matrix from world coordinates to real-time shadow camera coordinates * RGB pixel world coordinates;
[0070] NDC coordinates of RGB pixels in the “real-time shadow camera” = real-time shadow camera projection matrix * camera coordinates of RGB pixels in the “real-time shadow camera”;
[0071] Depth value of RGB pixel in real-time shadow map = texture sampling function (real-time shadow map, NDC coordinate of RGB pixel in “real-time shadow camera”_X, NDC coordinate of RGB pixel in “real-time shadow camera”_Y);
[0072] If "depth value of RGB pixel in real-time shadow map" < "NDC coordinate_Z value of RGB pixel in 'real-time shadow camera'"
[0073] Then: the RGB pixel is in the real-time shadow. When drawing the pixel, the RGB pixel value = RGB pixel pre-processing value * shadow brightness;
[0074] Otherwise: the RGB pixel is not in the real-time shadow, and when drawing the pixel, the RGB pixel value = the RGB pixel preprocessing value".
[0075] Among them, the "virtual camera projection inverse matrix" and "world coordinate to virtual camera coordinate transformation inverse matrix" in the pseudo code are the required data obtained from the "virtual camera data" of the preprocessed data, that is, obtaining the coordinates, posture, field of view (FOV), and near and far sections of the virtual camera. With these data, the above two coordinate transformation matrices can be obtained by calling the game engine function. The two matrices "world coordinate to real-time shadow camera coordinate transformation matrix" and "real-time shadow camera projection matrix" can be obtained in the same way, except that the camera's coordinates, posture, field of view (FOV), and near and far sections are replaced by the real-time shadow camera.
[0076] In a possible embodiment, when a new light source is generated in the game virtual scene, real-time lighting is used to generate dynamic lighting for the RGB image data;
[0077] In the process of generating dynamic lighting, the world coordinates of the set pixels in the RGB data are inferred using the depth map data; and the lighting effect of the new light source is calculated using the world coordinates of the set pixels in the RGB data and the normal map data.
[0078] Specifically, if a new light source is generated in the virtual scene of the game, for example, a player throws a "bomb" that explodes, generating a new point light source, which will illuminate the surrounding environment. At this time, the pre-processed normal map data and depth map data can be used to correctly calculate the illuminated pixels and the degree of illumination. The key to using real-time lighting to generate dynamic lighting for pre-processed RGB images is to use the depth map to infer the world coordinates of RGB pixels. The specific algorithm is included in the pseudo code above to obtain the "RGB pixel world coordinates". Similar to this process, the pseudo code for obtaining the normal of RGB pixels is as follows:
[0079] "RGB pixel normal = texture sampling function (preprocessed data_normal map, RGB pixel NDC coordinate_X, RGB pixel NDC coordinate_Y)".
[0080] When the world coordinates and normal map of RGB pixels are obtained, calculating the lighting effect for them is a basic function of the game engine, and the embodiment of the present invention will not be repeated. Thus, through the above-mentioned dynamic shadow projection and dynamic lighting, the pre-processed image has a dynamic light and shadow effect.
[0081] In a possible embodiment, the depth map data is used to determine whether each pixel of the real-time processing object needs to be drawn. For example, when drawing the real-time processing object "enemy", if the depth value of the "enemy" pixel is greater than the depth value of the pre-processed "house", it means that the distance from the "enemy" to the camera is farther than the distance from the "house" to the camera, so the "enemy" should be behind the "house", that is, blocked by the "house", then this pixel will not be drawn, otherwise it will be drawn.
[0082] In a possible embodiment, the shadow map data is used to determine whether the real-time processing object is in the virtual world shadow of the game virtual scene, and the shadow effect of the real-time processing object is calculated. The pseudo code for calculating the shadow effect of the real-time processing object is as follows:
[0083] "Real-time object camera coordinates = world coordinate to virtual camera coordinate transformation matrix * real-time object world coordinates;
[0084] Real-time object NDC coordinates = virtual camera projection matrix * real-time object camera coordinates;
[0085] The depth value of the real-time object in the pre-processed shadow map = texture sampling function (pre-processed_shadow map, real-time object NDC coordinate_X, real-time object NDC coordinate_Y);
[0086] Real-time object shadow camera coordinates = world coordinate to shadow camera coordinate transformation matrix * real-time object world coordinates;
[0087] The NDC coordinates of the real-time object in the shadow camera = the shadow camera projection matrix * the real-time object shadow camera coordinates;
[0088] If "depth value of real-time object in preprocessed shadow map" < "NDC coordinate _Z value of real-time object in shadow camera"
[0089] Then: the pixel of the real-time object is located in the pre-processed shadow. When drawing the pixel, the pixel color value = pixel color value * shadow brightness;
[0090] Otherwise: The pixel of the real-time object is not located in the pre-processed shadow, and no shadow calculation is performed when drawing this pixel.
[0091] In a possible embodiment, the depth map data and the normal map data are used to calculate the physical action effect of the real-time processing object. For example, when the real-time processing object "bullet" in the game hits the ground, smoke and dust will be splashed in the vertical direction of the impact point. The depth map data can be used to calculate the spatial coordinates of the impact point, and the normal map data can be used to calculate the vertical direction of the impact point. (The pseudo code for inferring the world and obtaining the normal according to the screen coordinates has been described in the previous text.) With the spatial coordinates and vertical direction data, the effect of splashing smoke and dust can be correctly generated. At the same time, the category map data can be used to determine the object category in the virtual scene corresponding to each pixel in the RGB map data, for example, identifying the specific location of water, trees, and land in the RGB map data. In this way, different effects can be displayed when "hitting" different objects, for example, when hitting the ground, dust splashes, and when hitting the water surface, water splashes.
[0092] See also Figure 2 , the game effect of the conventional method, it can be seen that there are 3.0M (ie: 3 million) triangles in the picture, and after being processed by the method of the present invention, the same picture has 19.9k (ie: 19,900) triangles, and the number of triangles is 0.663% of the conventional method. Therefore, the amount of calculation is greatly reduced, but the image quality is not significantly deteriorated.
[0093] During the experiment, a video game was produced using existing technology. The required hardware platform configuration is Intel Core i7-13700F CPU + GeForce RTX4060Ti 16G video memory + 32G memory, and the hardware cost is about 9,000 RMB. After being modified using the technology of the present invention, the game can be run on a TV set-top box whose main chip is Allwinner H618, and the hardware cost is about 100 RMB. Therefore, in commercial gaming equipment, the present invention can greatly save hardware costs. At the same time, in addition to the game application scenario, the embodiments of the present invention can also be applied to VR, metaverse, digital roaming, digital education, digital museums and other fields, which are of great practical value and economic value.
[0094] In summary, the present invention divides the data objects in the game virtual scene into pre-processing objects and real-time processing objects, temporarily deletes the real-time processing objects in the game virtual scene during the pre-processing process; uses a virtual camera to roam the game virtual scene according to the game plot, and saves each frame of roaming data obtained, wherein the information of the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data; splices the RGB image data, depth image data, normal image data, category image data and shadow image data in each frame of roaming data to generate a summary image, and arranges and compresses the summary image of each frame of roaming data obtained to form a video file; uses a real-time shadow camera to draw a real-time shadow image of all the real-time processing objects in the game virtual scene; decodes the video file when the game is actually running, copies the decoded RGB image data to the output buffer of the game, and inversely deduces the coordinates of the set pixel in the game virtual scene according to the depth image data and the coordinates of the set pixel, and uses the real-time shadow image to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object. The present invention greatly reduces the amount of calculation. Since the pre-processed virtual scene data is not needed during the game process, the amount of virtual scene data is also greatly reduced, thereby reducing the consumption of memory and video memory; it can greatly save hardware costs; it can also be applied to VR, metaverse, digital roaming, digital education, digital museums and other fields, and has practical and economic value.
[0095] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0096] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0097] Example 2
[0098] See also Figure 3Embodiment 2 of the present invention provides a device for realizing high-end hardware gaming effects with low-end hardware, including:
[0099] A virtual scene object processing module 001 is used to divide the data objects in the game virtual scene into pre-processing objects and real-time processing objects, and temporarily delete the real-time processing objects in the game virtual scene during the pre-processing process;
[0100] A virtual scene roaming module 002 is used to roam the game virtual scene according to the game plot using a virtual camera, and save each frame of roaming data obtained, wherein the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data;
[0101] The roaming data splicing module 003 is used to splice the RGB image data, depth image data, normal image data, category image data, and shadow image data in each frame of roaming data to generate a summary image, and arrange and compress the summary image of each frame of roaming data to form a video file;
[0102] A real-time shadow map drawing module 004 is used to draw real-time shadow maps of all the real-time processing objects in the game virtual scene using a real-time shadow camera;
[0103] The shadow projection analysis module 005 is used to decode the video file when the game is actually running, copy the decoded RGB image data to the output buffer of the game, and invert the coordinates of the set pixel in the virtual scene of the game based on the depth map data and the coordinates of the set pixel, and use the real-time shadow map to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object.
[0104] In this embodiment, in the virtual scene roaming module 002:
[0105] The RGB image data is the game screen data normally displayed on the screen;
[0106] The depth map data is the distance from the virtual object represented by each pixel of the RGB map data to the virtual camera;
[0107] The normal map data is normal surface orientation data of the virtual object represented by each pixel of the RGB map data in the camera space.
[0108] In this embodiment, in the virtual scene roaming module 002:
[0109] The category map data is the category of objects in the game virtual scene represented by grayscale values;
[0110] The shadow map data is the depth map data captured by a shadow camera set according to the coordinates and orientation of the main parallel light source in the game virtual scene.
[0111] In this embodiment, it also includes:
[0112] The lighting effect analysis module 006 is used to generate dynamic lighting for the RGB image data using real-time lighting when a new light source is generated in the game virtual scene; in the process of generating dynamic lighting, the world coordinates of the set pixels in the RGB data are inferred using the depth map data; and the lighting effect of the new light source is calculated using the world coordinates of the set pixels in the RGB data and the normal map data.
[0113] In this embodiment, it also includes:
[0114] The real-time processing object analysis module 007 is used to use the depth map data to determine whether each pixel of the real-time processing object needs to be drawn; it is also used to use the shadow map data to determine whether the real-time processing object is in the virtual world shadow of the game virtual scene, and calculate the shadow effect of the real-time processing object; it is also used to use the depth map data and the normal map data to calculate the physical action effect of the real-time processing object.
[0115] It should be noted that the information interaction, execution process and other contents between the modules of the above-mentioned device are based on the same concept as the method embodiment in Example 1 of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown in the previous part of the present application, and will not be repeated here.
[0116] Example 3
[0117] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which program code for a method for implementing high-end hardware gaming effects with low-end hardware is stored. The program code includes instructions for executing the method for implementing high-end hardware gaming effects with low-end hardware of embodiment 1 or any possible implementation thereof.
[0118] The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0119] Example 4
[0120] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
[0121] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method of achieving high-end hardware gaming effects with low-end hardware in Example 1 or any possible implementation thereof.
[0122] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor implemented by reading software codes stored in a memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.
[0123] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of 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, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.
[0124] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0125] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.
Claims
1. A method for achieving high-end hardware gaming effects with low-end hardware, characterized in that: include: Dividing the data objects in the game virtual scene into pre-processing objects and real-time processing objects, and temporarily deleting the real-time processing objects in the game virtual scene during the pre-processing process; Using a virtual camera to roam the game virtual scene according to the game plot, and saving each frame of roaming data obtained, wherein the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data; The RGB image data, depth image data, normal image data, category image data, and shadow image data in each frame of roaming data are spliced to generate a summary image, and the summary image of each frame of roaming data is arranged and compressed to form a video file; Draw a real-time shadow map of all the real-time processed objects in the game virtual scene using a real-time shadow camera; When the game is actually running, the video file is decoded, and the decoded RGB image data is copied to the output buffer of the game. According to the depth map data and the coordinates of the set pixel, the coordinates of the set pixel in the virtual scene of the game are inverted, and the real-time shadow map is used to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object.
2. The method of realizing high-end hardware gaming effects with low-end hardware according to claim 1, characterized in that: The RGB image data is the game screen data normally displayed on the screen; The depth map data is the distance from the virtual object represented by each pixel of the RGB map data to the virtual camera; The normal map data is normal surface orientation data of the virtual object represented by each pixel of the RGB map data in the camera space.
3. The method of realizing high-end hardware gaming effects with low-end hardware according to claim 2, characterized in that: The category map data is the category of objects in the game virtual scene represented by grayscale values; The shadow map data is the depth map data captured by a shadow camera set according to the coordinates and orientation of the main parallel light source in the game virtual scene.
4. The method of realizing high-end hardware gaming effects with low-end hardware according to claim 1, characterized in that: When a new light source is generated in the game virtual scene, real-time lighting is used to generate dynamic lighting for the RGB image data; In the process of generating dynamic lighting, the world coordinates of the set pixels in the RGB data are inferred using the depth map data; and the lighting effect of the new light source is calculated using the world coordinates of the set pixels in the RGB data and the normal map data.
5. The method of realizing high-end hardware gaming effects with low-end hardware according to claim 1, characterized in that: It also includes: using the depth map data to determine whether each pixel of the real-time processing object needs to be drawn; Using the shadow map data, determining whether the real-time processing object is in the virtual world shadow of the game virtual scene, and calculating the shadow effect of the real-time processing object; The physical action effect of the real-time processing object is calculated using the depth map data and the normal map data.
6. A device for realizing high-end hardware gaming effects with low-end hardware, characterized in that: include: A virtual scene object processing module, used to divide the data objects in the game virtual scene into pre-processing objects and real-time processing objects, and temporarily delete the real-time processing objects in the game virtual scene during the pre-processing process; A virtual scene roaming module is used to roam the game virtual scene according to the game plot using a virtual camera, and save the obtained roaming data of each frame, wherein the information of the roaming data includes RGB image data, depth image data, normal image data, category image data, shadow image data and virtual camera data; A roaming data splicing module is used to splice the RGB image data, depth image data, normal image data, category image data, and shadow image data in each frame of roaming data to generate a summary image, and arrange and compress the summary image of each frame of roaming data to form a video file; A real-time shadow map drawing module, used for drawing real-time shadow maps of all the real-time processed objects in the game virtual scene using a real-time shadow camera; The shadow projection analysis module is used to decode the video file when the game is actually running, copy the decoded RGB image data to the output buffer of the game, and inversely deduce the coordinates of the set pixel in the virtual scene of the game based on the depth map data and the coordinates of the set pixel, and use the real-time shadow map to calculate whether the set pixel is in the real-time shadow, so as to complete the shadow projection from the real-time processing object to the pre-processing object.
7. The device for realizing high-end hardware gaming effects with low-end hardware according to claim 6, characterized in that: In the virtual scene roaming module: The RGB image data is the game screen data normally displayed on the screen; The depth map data is the distance from the virtual object represented by each pixel of the RGB map data to the virtual camera; The normal map data is normal surface orientation data of the virtual object represented by each pixel of the RGB map data in the camera space.
8. The device for realizing high-end hardware gaming effects with low-end hardware according to claim 6, characterized in that: In the virtual scene roaming module: The category map data is the category of objects in the game virtual scene represented by grayscale values; The shadow map data is the depth map data captured by a shadow camera set according to the coordinates and orientation of the main parallel light source in the game virtual scene.
9. The device for realizing high-end hardware gaming effects with low-end hardware according to claim 6, characterized in that: Also includes: A lighting effect analysis module, used to generate dynamic lighting for the RGB image data using real-time lighting when a new light source is generated in the game virtual scene; In the process of generating dynamic lighting, the world coordinates of the set pixels in the RGB data are inferred using the depth map data; and the lighting effect of the new light source is calculated using the world coordinates of the set pixels in the RGB data and the normal map data.
10. The device for realizing high-end hardware gaming effects with low-end hardware according to claim 6, characterized in that: Also includes: A real-time processing object analysis module, used to determine whether each pixel of the real-time processing object needs to be drawn using the depth map data; It is also used to use the shadow map data to determine whether the real-time processing object is in the virtual world shadow of the game virtual scene, and calculate the shadow effect of the real-time processing object; it is also used to use the depth map data and the normal map data to calculate the physical action effect of the real-time processing object.
