A virtual scene inspection method, device and storage medium
By collecting and analyzing voxels in virtual scenes and generating color image recognition performance hotspots, the problem of virtual scene drawing data affecting game frame rate is solved, achieving efficient scene optimization and improving user experience.
Patent Information
- Application Number
- CN202111454395.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-01
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2041-12-01
AI Technical Summary
In the existing technology, the rendering data of the virtual scene affects the game frame rate, resulting in a decrease in user experience, and there is a lack of effective detection and optimization methods.
By collecting voxels of the virtual scene, obtaining voxel coordinates and scene rendering data sets, using a virtual camera to traverse the voxels, analyzing the scene rendering data, and generating color images to identify performance hotspots.
It realizes the automated acquisition and analysis of virtual scene rendering data, improves data acquisition efficiency, can quickly identify areas with high performance consumption, optimize game scenes, and enhance user experience.
Smart Images

Figure CN114146416B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device and storage medium for inspecting a virtual scene. Background Art
[0002] Virtual scenes, such as scene assets in games, are often complex to create. For example, during gameplay, the player character's facing surface often contains a large number of mesh triangles and geometric objects required to construct the scene assets, as well as numerous rendering operations. Because this scene rendering data can affect game frame rates and reduce user experience, there is an urgent need to provide a method for detecting and analyzing virtual scene rendering data to optimize and improve virtual scene production. Summary of the Invention
[0003] The embodiments of the present application provide a method, device and storage medium for inspecting a virtual scene, thereby providing an effective method for detecting and analyzing the drawing data of the virtual scene, so as to optimize and improve the scene production of the virtual scene.
[0004] In a first aspect, the present application provides a method for inspecting a virtual scene, the method comprising:
[0005] Perform voxel collection on a target area in a virtual scene to obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer;
[0006] Controlling the virtual camera to traverse the target area according to each voxel coordinate, and determining a scene rendering data set corresponding to each voxel coordinate;
[0007] The scene rendering data set corresponding to the N voxels is analyzed to obtain a scene inspection result corresponding to the virtual scene.
[0008] Optionally, determining the scene rendering data set corresponding to each voxel coordinate includes: determining, based on a preset direction, the scene rendering data set of each voxel coordinate in the preset direction;
[0009] When the preset directions include multiple directions, analyzing the scene drawing data set corresponding to the N voxels to obtain the scene inspection result corresponding to the virtual scene includes: analyzing the scene drawing data set corresponding to the N voxels obtained in each preset direction to obtain the scene inspection result in each preset direction.
[0010] Optionally, the preset direction includes at least one of the following directions: the positive direction of the horizontal axis in the spatial coordinate system corresponding to the virtual scene, the negative direction of the horizontal axis in the spatial coordinate system, the positive direction of the vertical axis in the spatial coordinate system, and the negative direction of the vertical axis in the spatial coordinate system.
[0011] Optionally, performing voxel acquisition on the target area in the virtual scene to obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene includes: performing voxel acquisition on the target area according to a preset number of acquisition layers, obtaining at least one voxel in each preset acquisition layer and the corresponding voxel coordinates;
[0012] The analyzing the scene rendering data set corresponding to the N voxels to obtain the scene inspection result corresponding to the virtual scene includes: analyzing the scene rendering data set corresponding to at least one voxel in each preset acquisition layer to obtain the scene inspection result corresponding to each preset acquisition layer.
[0013] Optionally, the scene rendering data set corresponding to each voxel includes rendering data of M data types, where M is a positive integer. The analyzing the scene rendering data sets corresponding to the N voxels to obtain a scene inspection result corresponding to the virtual scene includes:
[0014] Based on the M data types, filtering out rendering data of each data type from the scene rendering data set corresponding to the N voxels;
[0015] Determine a color channel in the color image corresponding to each data type, and use each data type and the corresponding color channel as a target data type and a target color channel, respectively, and perform the following color image generation steps: for each voxel, map the drawing data of the target data type corresponding to the voxel to the target color channel to obtain target color data corresponding to the voxel; determine a target pixel point corresponding to the voxel coordinates of the voxel in the color image, and store the target color data in the target color channel corresponding to the target pixel point;
[0016] The generated color image is analyzed to obtain the scene inspection result.
[0017] Optionally, for each voxel, mapping the drawing data of the target data type corresponding to the voxel to a target color channel to obtain target color data corresponding to the voxel includes:
[0018] Filtering, from the drawing data of the target data type corresponding to the N voxels, a maximum value and a minimum value of the drawing data corresponding to the target data type, and obtaining a maximum value and a minimum value of the color data of the target color channel;
[0019] For each voxel, obtaining drawing data corresponding to the target data type of the voxel, and performing interpolation processing on the drawing data corresponding to the target data type of the voxel, the maximum value of the drawing data, the minimum value of the drawing data, the maximum value of the color, and the minimum value of the color data to obtain target color data mapped to the target color channel for the voxel.
[0020] Optionally, the scene drawing data set corresponding to each voxel includes at least one of the following drawing data: the number of renderings of the virtual scene corresponding to the current viewing angle of the virtual camera, the number of static meshes corresponding to the virtual scene, the number of geometric bodies corresponding to the virtual scene, and the memory usage corresponding to drawing the virtual scene.
[0021] Optionally, analyzing the generated color image to obtain the scene inspection result includes:
[0022] Determining the color value of each pixel in the color image;
[0023] Determine at least one pixel point whose color value is greater than a preset color value, determine the voxel coordinates corresponding to the at least one pixel point, and use the area in the target area where the voxel coordinates corresponding to the at least one pixel point are located as the hotspot area of the virtual scene, wherein the scene inspection result includes the hotspot area.
[0024] In a second aspect, the present application further provides a virtual scene inspection device, comprising:
[0025] A voxel acquisition module is used to acquire voxels of a target area in a virtual scene, obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer;
[0026] A rendering data acquisition module, configured to control the virtual camera to traverse the target area according to each voxel coordinate, and determine a scene rendering data set corresponding to each voxel coordinate;
[0027] The processing module is used to analyze the scene rendering data set corresponding to the N voxels to obtain a scene inspection result corresponding to the virtual scene.
[0028] In a third aspect, an embodiment of the present invention provides a virtual scene inspection device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors to perform operating instructions corresponding to the one or more programs for performing the virtual scene inspection method provided in the first aspect.
[0029] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps corresponding to the method for inspecting a virtual scene provided in the first aspect.
[0030] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:
[0031] The solution in the embodiment of the present application acquires voxels in a target area of a virtual scene to obtain N voxels corresponding to the virtual scene and the voxel coordinates of each voxel in the virtual scene; controls a virtual camera to traverse the target area according to each voxel coordinate, and determines the scene rendering data set corresponding to each voxel coordinate; and analyzes the scene rendering data set corresponding to the N voxels to obtain a scene inspection result for the virtual scene. The solution in the present application acquires voxels in the virtual scene and determines the corresponding scene rendering data set voxel by voxel, thereby automating the acquisition of the scene rendering data set and improving data acquisition efficiency. At the same time, by analyzing the scene rendering data set for each voxel, it is possible to determine the performance hotspot areas in the virtual scene, i.e., areas with high performance consumption, based on the scene inspection results, so as to optimize them during the subsequent scene production process. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0033] Figure 1 This is a flow chart of a method for inspecting a virtual scene in an embodiment of the present application;
[0034] Figure 2 This is a structural diagram of an inspection device for a virtual scene in an embodiment of the present application;
[0035] Figure 3 This is a structural diagram of an inspection device for a virtual scene in an embodiment of the present application;
[0036] Figure 4This is a structural diagram of a virtual scene inspection device used as a server in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The embodiments of the present application provide a method, device, and storage medium for inspecting a virtual scene, thereby providing an effective method for inspecting and analyzing rendering data of a virtual scene.
[0038] The overall idea of the technical solution of the embodiment of the present application is as follows: voxel collection is performed on the target area in the virtual scene to obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer; the virtual camera is controlled to traverse the target area according to each voxel coordinate, and the scene rendering data set corresponding to each voxel coordinate is determined; the scene rendering data set corresponding to the N voxels is analyzed to obtain a scene inspection result corresponding to the virtual scene.
[0039] The solution in this application obtains voxels in the virtual scene and determines the corresponding scene rendering data set voxel by voxel, thereby automating the acquisition of the scene rendering data set and improving data acquisition efficiency. At the same time, based on the analysis of the scene rendering data set of each voxel, it is possible to determine the performance hotspot area (or so-called area to be optimized) in the virtual scene based on the scene inspection results, that is, the area where the performance consumption is greater than the preset threshold, so as to optimize it in the subsequent scene production process.
[0040] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.
[0041] First, the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the associated objects.
[0042] The embodiment of this specification provides a method for checking a virtual scene, such as Figure 1 As shown, the method includes the following steps:
[0043] Step S101: performing voxel acquisition on a target area in a virtual scene to obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer;
[0044] Step S102: controlling the virtual camera to traverse the target area according to each voxel coordinate, and determining a scene rendering data set corresponding to each voxel coordinate;
[0045] Step S103: Analyze the scene rendering data set corresponding to the N voxels to obtain a scene inspection result corresponding to the virtual scene.
[0046] The solutions in the embodiments of this specification can be applied to terminal devices that can perform detection and analysis on virtual scenes, such as smartphones and tablet computers. When applied to terminal devices, the solutions provided in the embodiments of this specification can be implemented by a plug-in installed in the terminal device. For example, the plug-in can be a plug-in set in a game engine. In addition, the solutions provided in the embodiments of this specification can also be applied to servers that perform detection and analysis on virtual scenes, and can also be applied to systems composed of terminal devices and servers, which are not limited here.
[0047] In step S101, the virtual scene may be a game scene in a game. For example, for game X, there may be multiple level scenes. The virtual scene in the embodiment of this specification may be any level scene in game X. The number of virtual scenes may be one or more, and is not limited here.
[0048] When performing voxel collection on a virtual scene, voxel collection can be performed on a target area in the virtual scene. The target area can be a specified area in the virtual scene or the entire area of the virtual scene, which is not limited here. Taking the target area as a specified area in the virtual scene as an example, the area coordinates of the target area can be obtained first. The area coordinates can be manually input by the user (for example, inputting the starting coordinates and the ending coordinates of the target area), or can be pre-set default coordinates, or can be obtained by performing area recognition on the virtual scene. In one embodiment, taking the virtual scene as a game scene as an example, the target area can be an area where the player can walk. For example, the virtual scene is a canyon scene, and the walkable area is a path in the canyon. In this case, the path can be used as the target area.
[0049] After determining the target area for voxel acquisition, the target area of the virtual scene can be divided into voxels based on the voxel size to obtain N voxels divided from the target area, which serve as the N voxels corresponding to the virtual scene. The voxel size can be set according to actual needs and is not limited here. At the same time, while obtaining the N voxels, the voxel coordinates of each voxel in the virtual scene can also be determined, that is, the N voxel coordinates corresponding to the N voxels are obtained.
[0050] Furthermore, after collecting the voxels corresponding to the virtual scene, step S102 can be executed to obtain a scene drawing data set under each voxel coordinate. The scene drawing data set includes but is not limited to at least one of the following data: the number of renderings of the virtual scene corresponding to the current viewing angle of the virtual camera, the number of static meshes corresponding to the virtual scene, the number of geometric bodies corresponding to the virtual scene, and the memory usage corresponding to drawing the virtual scene. The number of renderings can be the number of MeshDrawCalls (i.e., the number of times the CPU calls the underlying graphics drawing interface to command the GPU to perform rendering operations), the number of static meshes can be the number of StaticMeshTriangles (i.e., the number of static mesh triangles, indicating the number of all triangles on the screen), the number of geometric bodies can be the number of ProcessedPrimitives, and the memory usage can be UsedPhysical.
[0051] It should be noted that the virtual scenes that need to be drawn are different depending on the voxel coordinates of the virtual camera. In addition, if the virtual camera is facing different directions at the same voxel coordinates, the virtual scenes that need to be drawn are also different. Therefore, in the embodiments of this specification, when collecting scene drawing data sets, it is necessary to collect them based on the current viewing angle of the virtual camera.
[0052] For ease of explanation, the embodiments of this specification use a scene rendering data set including the four types of rendering data as an example. For each voxel, when rendering the virtual scene at the voxel's coordinates using the current perspective of the virtual camera, the corresponding number of MeshDrawCalls, StaticMeshTriangles, ProcessedPrimitives, and UsedPhysicals are recorded. These four types of data constitute the scene rendering data set corresponding to that voxel.
[0053] After obtaining the scene rendering data set for each voxel, the scene rendering data set can be analyzed in step S103. In one embodiment, the scene rendering data set can be subjected to hotspot analysis. The purpose of hotspot analysis is to identify areas of high performance consumption in the virtual scene. Areas of high performance consumption may cause lag, frame drops, etc. Identifying areas of high performance consumption through hotspot analysis can effectively help production personnel optimize and improve the virtual scene.
[0054] In the embodiments of this specification, the specific analysis method for the scene drawing data set can be set according to actual needs and is not limited here. For example, for each type of drawing data, the area where the voxels whose drawing data meets the preset data range are located is determined, and these areas are used as scene inspection results for characterizing hot spots. Taking the analysis of the number of MeshDrawCalls as an example, based on the number of N MeshDrawCalls corresponding to N voxels, voxels with a number of MeshDrawCalls greater than a threshold can be screened out from the N voxels, and the areas where these voxels are located are considered to be areas with high performance consumption, and are used as scene inspection results.
[0055] It can be seen that through the solution provided in the embodiments of this specification, it is possible to effectively obtain the scene drawing data set corresponding to each voxel, analyze the drawing data set, and determine the areas with higher performance consumption in the virtual scene, so as to optimize them in the subsequent game production process, thereby improving the user's gaming experience.
[0056] Furthermore, for the game scene, when the player's perspective is different, the corresponding drawing data of the game scene will also be different. Since the different perspectives of the player correspond to different orientations of the game scene, in the embodiment of this specification, the drawing data set can be collected based on different directions. In the specific implementation process, step S102 can be implemented in the following manner: based on the preset direction, determine the scene drawing data set corresponding to each voxel coordinate in the preset direction. Correspondingly, step S103 can be specifically implemented in the following manner: analyze the scene drawing data set corresponding to the N voxels obtained in each preset direction to obtain the scene inspection analysis result in each preset direction.
[0057] The preset direction may include, but is not limited to, at least one of the following directions: a positive horizontal axis direction in the spatial coordinate system corresponding to the virtual scene, a negative horizontal axis direction in the spatial coordinate system, a positive vertical axis direction in the spatial coordinate system, and a negative vertical axis direction in the spatial coordinate system. Specifically, taking a game scene as an example, the positive vertical axis direction, the negative vertical axis direction, the negative horizontal axis direction, and the positive horizontal axis direction of the spatial coordinate system corresponding to the virtual scene may correspond to the forward, backward, left, and right directions of the game character controlled by the player, respectively.
[0058] Furthermore, still taking the game scene as an example, when collecting drawing data, each voxel in the game scene can be traversed in each direction one by one through the virtual camera. For example, when the preset directions include the above four directions, the virtual camera can be controlled to first traverse each voxel coordinate along the positive direction of the horizontal axis to collect the scene drawing data set corresponding to the positive direction of the horizontal axis, and then collect the scene drawing data set corresponding to each voxel coordinate in the negative direction of the horizontal axis, the positive direction of the vertical axis, and the negative direction of the vertical axis in turn. Of course, the voxel coordinates of all voxels can also be traversed. When the virtual camera is located at each voxel coordinate, the virtual camera can be controlled to shoot the scene in four directions respectively to collect the scene drawing data set in the four directions corresponding to each voxel coordinate.
[0059] In the embodiments of this specification, in addition to obtaining a scene drawing data set in each direction, for each voxel, the drawing data obtained for each voxel in all directions can also be summed to obtain the overall drawing data set corresponding to each voxel. Specifically, for a voxel, the drawing data sets corresponding to the above four directions are collected respectively at the voxel coordinates of the voxel. For example, taking the collection of the number of MeshDrawCalls as an example, the number of MeshDrawCalls collected along the positive direction of the horizontal axis at the voxel coordinates is a, the number of MeshDrawCalls collected along the negative direction of the horizontal axis is b, the number of MeshDrawCalls collected along the positive direction of the vertical axis is c, and the number of MeshDrawCalls collected along the negative direction of the vertical axis is d. Then the overall number of MeshDrawCalls corresponding to the voxel is the sum of a, b, c, and d. In the same way, the overall drawing data corresponding to other drawing data can be determined, so that the overall drawing data set corresponding to each voxel is obtained. Of course, when calculating the overall drawing data, in addition to summing the drawing data in each direction, the overall drawing data can also be determined by other methods, such as calculating the average value of the drawing data in each direction, or taking a weighted average of the drawing data in each direction, etc., which are not limited here.
[0060] Through the above method, a scene drawing data set for each voxel along multiple directions and the overall scene drawing data set can be obtained. Furthermore, the scene drawing data for each direction and the overall scene drawing data set can be stored so that the scene drawing data set can be analyzed and processed later. In the embodiment of this specification, when storing the scene drawing data set, it can be stored based on the voxel coordinates of each voxel. For example, taking the scene drawing data set collected along the positive direction of the horizontal axis as an example, for voxel A, the voxel coordinates of voxel A are (x, y), then the scene drawing data set corresponding to voxel A collected along the positive direction of the horizontal axis can be stored in (x, y) coordinates. In this way, a picture in which the scene drawing data set is stored according to the voxel coordinates of each voxel can be finally obtained. Of course, the scene drawing data set can also be stored in other ways, which are not limited here.
[0061] Furthermore, after collecting the scene drawing data set in each preset direction, data analysis can be performed on the scene drawing data set in each preset direction to obtain the scene inspection results corresponding to each preset direction. For example, hotspot analysis can be performed to check the performance consumption of the virtual scene in each preset direction.
[0062] In an embodiment of the present specification, there may be multiple walkable points of different heights in the scene resources of the game. For example, there is a ladder in the game scene, and the player can perform the operation of climbing the ladder. For the ladder, the corresponding horizontal and vertical coordinates are unchanged, but under the vertical coordinate (Z coordinate), there are multiple walkable points of different heights. Taking into account the walkable points at different heights, in an embodiment of the present specification, step S101 can be implemented in the following manner: voxel acquisition is performed on the target area according to the preset acquisition layer number, and at least one voxel in each preset acquisition layer and the corresponding voxel coordinates are obtained. Correspondingly, step S103 can be implemented in the following manner: the scene drawing data set corresponding to at least one voxel in each preset acquisition layer is analyzed to obtain the scene inspection result corresponding to each preset acquisition layer.
[0063] Specifically, the preset number of acquisition layers can be manually input by the user (for example, 5 layers, 6 layers, etc.), or it can be a default number of layers. Different preset acquisition layers correspond to different heights, that is, different corresponding Z coordinates. When performing voxel acquisition, for each preset acquisition layer, voxel division can be performed according to the voxel size to obtain at least one voxel under each preset acquisition layer, and the corresponding voxel coordinates. Furthermore, for the voxels under each preset acquisition layer, the drawing data set can be collected in sequence according to the preset direction, so that the scene drawing data set corresponding to each preset direction under each preset acquisition layer can be obtained.
[0064] Correspondingly, when performing hotspot analysis in a scenario involving multiple preset acquisition layers, data analysis can be performed separately for each preset acquisition layer. For example, for preset acquisition layer 1, the voxels contained in preset acquisition layer 1 are determined, and the scene rendering data set corresponding to each voxel is obtained. The scene rendering data set corresponding to each voxel is analyzed to obtain the scene inspection result corresponding to preset acquisition layer 1. Of course, when there are multiple preset directions, for each preset acquisition layer, the scene rendering data sets corresponding to different preset directions are analyzed to obtain the scene inspection results corresponding to the different preset directions in the preset acquisition layer.
[0065] It should be noted that the analysis method for the scene rendering data set can be set according to actual needs. For the sake of convenience, one of the analysis methods is described below.
[0066] Based on the M data types, the drawing data under each data type is screened out from the scene drawing data set corresponding to the N voxels; the color channel in the color image corresponding to each data type is determined, and each data type and the corresponding color channel are respectively used as the target data type and the target color channel, and the following color image generation steps are performed: for each voxel, the drawing data under the target data type corresponding to the voxel is mapped to the target color channel to obtain the target color data corresponding to the voxel; the target pixel point corresponding to the voxel coordinates of the voxel is determined in the color image, and the target color data is stored in the target color channel corresponding to the target pixel point; the generated color image is analyzed to obtain the scene inspection result
[0067] Specifically, M can be set based on actual needs. Continuing with the example above, the scene drawing data set corresponding to each voxel contains the following four types of drawing data: MeshDrawCalls, StaticMeshTriangles, ProcessedPrimitives, and UsedPhysicals. Each type of drawing data is mapped to a color channel in the color image, and each type of drawing data corresponds to a different color channel.
[0068] For example, the four types of drawing data described above can be mapped to color channels in the RGBA color space: MeshDrawCalls can be mapped to the R (Red) channel, StaticMeshTriangles can be mapped to the G (Green) channel, ProcessedPrimitives can be mapped to the B (Blue) channel, and UsedPhysicals can be mapped to the A (Alpha) channel. Of course, the color channels corresponding to each type of drawing data can be selected based on actual needs, and color channels in other color spaces can also be selected; this is not a limitation here.
[0069] In a specific implementation, mapping the drawing data of each type to the corresponding color channel can be achieved in the following manner: filtering out the maximum drawing data value and the minimum drawing data value corresponding to the target data type from the drawing data of the target data type corresponding to the N voxels, and obtaining the maximum color data value and the minimum color data value of the target color channel; for each voxel, obtaining the drawing data of the target data type corresponding to the voxel, and interpolating the drawing data of the target data type corresponding to the voxel, the maximum drawing data value, the minimum drawing data value, the maximum color value, and the minimum color data value to obtain the target color data mapped to the target color channel for the voxel.
[0070] Specifically, taking the case where the drawing data is the number of StaticMeshTriangles, since the drawing data set corresponding to N voxels all contains the number of StaticMeshTriangles, the number of StaticMeshTriangles corresponding to each voxel can be filtered out, thus obtaining N numbers of StaticMeshTriangles. The maximum and minimum values of the N numbers of StaticMeshTriangles are determined. For example, the maximum number of StaticMeshTriangles is p, and the minimum number is q. The color channel corresponding to the number of StaticMeshTriangles is the G channel. The color data of the G channel ranges from 0 to 255, so the maximum value of the color data of the G channel is 255, and the minimum value of the color data is 0. Therefore, the color data after mapping p to the G channel is 255, and the color data after mapping q to the G channel is 0. For data between p and q, it is mapped to color data between 0 and 255 through interpolation calculation. In this way, the number of StaticMeshTriangles can be converted to color data in the G channel. Furthermore, for each voxel's coordinates, the target pixel corresponding to that voxel's coordinates can be determined in the color image. The target color data mapped to the G channel for that voxel is then stored in the G channel of the target pixel. Similarly, each type of drawing data is mapped to other color channels in the color image. This allows the distribution of the drawing data to be represented in the color image.
[0071] After generating the generated color image, the performance hotspots of the virtual scene can be visually observed based on the color image's hue. For the four drawing data types—MeshDrawCalls, StaticMeshTriangles, ProcessedPrimitives, and UsedPhysical—larger values indicate greater performance consumption. Therefore, in a color image, higher color data values—that is, brighter colors—indicate greater performance consumption.
[0072] In an embodiment of the present specification, the following steps can be specifically used to perform hotspot analysis on the generated color image: determine the color value of each pixel in the color image; determine at least one pixel whose color value is greater than a preset color value, and determine the voxel coordinates corresponding to the at least one pixel, and use the area in the target area where the voxel coordinates corresponding to the at least one pixel are located as the hotspot area of the virtual scene, wherein the scene inspection result includes the hotspot area.
[0073] During the specific implementation process, the preset color value can be set according to actual needs. For each color channel, it can correspond to its own preset color value, or the preset color value is the total preset color value corresponding to all color channels, which is not limited here. Among them, when each color channel corresponds to its own preset color value, for each pixel point, the color data of each color channel corresponding to the pixel point can be used as the color value of each color channel, and then the color value of each color channel can be compared with the corresponding preset color value. When the preset color value is the total color value, for each pixel point, the color data of all color channels corresponding to the pixel point can be weighted averaged as the total color value of the pixel point, and compared with the total preset color value. When the color value is greater than the preset color value, it means that the area where the voxel corresponding to the pixel point is located is a hot spot area with high performance consumption in the virtual scene.
[0074] Furthermore, in the process of determining the hotspot area, at least one pixel whose color value is greater than a preset color value is first determined. Since there is a mapping relationship between pixels and voxels in the virtual scene, that is, the pixel coordinates of the pixel in the color image are mapped to the voxel coordinates of the corresponding voxel in the virtual scene, the corresponding voxel coordinates can be determined in the virtual scene based on the pixel coordinates. The area formed by these voxel coordinates is regarded as the hotspot area of the virtual scene, and the hotspot area is fed back as the scene inspection result.
[0075] It should be noted that corresponding color images can be generated for different preset directions and different preset acquisition layers. In this way, when displaying color images, the corresponding color images can be displayed according to user needs. For example, when a user needs to view the performance consumption of a specific preset acquisition layer, the color image corresponding to the specific preset acquisition layer can be determined. When a specific preset acquisition layer corresponds to multiple preset directions, the color image under the preset direction selected by the user can also be displayed according to the user's selection of the preset direction.
[0076] The solution in the embodiments of this specification can intuitively observe the hot spot area through the above-mentioned color image. In order to facilitate the user to determine the above-mentioned hot spot area in the actual game scene, the jump from the color image to the game scene can be achieved through the following steps: During the game running process, if a click operation on a pixel point of the color image is received, based on the coordinates of the pixel point clicked by the click operation, the voxel coordinates corresponding to the coordinates of the pixel point are determined, and the virtual scene is positioned at the voxel coordinates.
[0077] Specifically, the virtual scene is a game scene. During the game, if the user wants to know which area of the game scene the hot spot area corresponds to, the user can click on the pixel with a higher color value on the color image. Since the pixel on the color image corresponds to the voxel coordinates in the virtual scene, after the user clicks the pixel on the color image, he can jump to the corresponding voxel coordinates in the game scene.
[0078] In one embodiment, since different preset directions correspond to different color images, if the user clicks on the color image in one of the preset directions, for example, clicks on a pixel point on the color image corresponding to the left direction, then when jumping to the game scene, the virtual camera in the game scene jumps to the position of the pixel point, and the shooting angle of the virtual camera is facing left at the pixel point, so that the game scene under the angle of view is further checked based on the game scene captured by the virtual camera.
[0079] It can be seen that through the solution in the embodiments of this specification, the performance consumption in the virtual scene can be intuitively determined. For game producers, they can quickly find the location of the virtual scene that needs to be optimized based on the color image, thereby optimizing and improving the game more quickly.
[0080] Based on the same inventive concept, the embodiment of this specification also provides a virtual scene inspection device, such as Figure 2 As shown, the device includes:
[0081] A voxel acquisition module 201 is configured to acquire voxels of a target area in a virtual scene, obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer;
[0082] A rendering data acquisition module 202 is used to control the virtual camera to traverse the target area according to each voxel coordinate and determine a scene rendering data set corresponding to each voxel coordinate;
[0083] The processing module 203 is configured to analyze the scene rendering data set corresponding to the N voxels to obtain a scene inspection result corresponding to the virtual scene.
[0084] Optionally, the rendering data acquisition module 202 is configured to determine, based on a preset direction, a scene rendering data set of each voxel coordinate in the preset direction;
[0085] When there are multiple preset directions, the processing module 203 is configured to analyze the scene rendering data set corresponding to the N voxels acquired in each preset direction to obtain a scene inspection result in each preset direction.
[0086] Optionally, the preset direction includes at least one of the following directions: the positive direction of the horizontal axis in the spatial coordinate system corresponding to the virtual scene, the negative direction of the horizontal axis in the spatial coordinate system, the positive direction of the vertical axis in the spatial coordinate system, and the negative direction of the vertical axis in the spatial coordinate system.
[0087] Optionally, the voxel acquisition module 201 is configured to perform voxel acquisition on the target area according to a preset number of acquisition layers, and obtain at least one voxel and corresponding voxel coordinates in each preset acquisition layer;
[0088] The processing module 203 is configured to analyze a scene rendering data set corresponding to at least one voxel in each preset acquisition layer to obtain a scene inspection result corresponding to each preset acquisition layer.
[0089] Optionally, the scene rendering data set corresponding to each voxel includes rendering data of M data types, where M is a positive integer. The processing module 203 is configured to:
[0090] Based on the M data types, filtering out rendering data of each data type from the scene rendering data set corresponding to the N voxels;
[0091] Determine a color channel in the color image corresponding to each data type, and use each data type and the corresponding color channel as a target data type and a target color channel, respectively, and perform the following color image generation steps: for each voxel, map the drawing data of the target data type corresponding to the voxel to the target color channel to obtain target color data corresponding to the voxel; determine a target pixel point corresponding to the voxel coordinates of the voxel in the color image, and store the target color data in the target color channel corresponding to the target pixel point;
[0092] The generated color image is analyzed to obtain the scene inspection result.
[0093] Optionally, the processing module 203 is configured to:
[0094] Filtering, from the drawing data of the target data type corresponding to the N voxels, a maximum value and a minimum value of the drawing data corresponding to the target data type, and obtaining a maximum value and a minimum value of the color data of the target color channel;
[0095] For each voxel, obtaining drawing data corresponding to the target data type of the voxel, and performing interpolation processing on the drawing data corresponding to the target data type of the voxel, the maximum value of the drawing data, the minimum value of the drawing data, the maximum value of the color, and the minimum value of the color data to obtain target color data mapped to the target color channel for the voxel.
[0096] Optionally, the scene drawing data set corresponding to each voxel includes at least one of the following drawing data: the number of renderings of the virtual scene corresponding to the current viewing angle of the virtual camera, the number of static meshes corresponding to the virtual scene, the number of geometric bodies corresponding to the virtual scene, and the memory usage corresponding to drawing the virtual scene.
[0097] Optionally, the processing module 203 is configured to:
[0098] Determining the color value of each pixel in the color image;
[0099] Determine at least one pixel point whose color value is greater than a preset color value, determine the voxel coordinates corresponding to the at least one pixel point, and use the area in the target area where the voxel coordinates corresponding to the at least one pixel point are located as the hotspot area of the virtual scene, wherein the scene inspection result includes the hotspot area.
[0100] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0101] Figure 3 FIG1 is a block diagram of an inspection device for a virtual scene according to an exemplary embodiment. For example, device 1800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0102] Reference Figure 3 , device 1800 may include one or more of the following components: a processing component 1802 , a memory 1804 , a power component 1806 , a multimedia component 1808 , an audio component 1810 , an input / output (I / O) interface 1812 , a sensor component 1814 , and a communication component 1816 .
[0103] Processing component 1802 generally controls the overall operation of device 1800, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. Processing component 1802 may include one or more processors 1820 to execute instructions to perform all or part of the steps of the aforementioned methods. Furthermore, processing component 1802 may include one or more modules to facilitate interaction between processing component 1802 and other components. For example, processing component 1802 may include a multimedia module to facilitate interaction between multimedia component 1808 and processing component 1802.
[0104] The memory 1804 is configured to store various types of data to support the operations of the device 1800. Examples of such data include instructions for any application or method operating on the device 1800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0105] The power component 1806 provides power to the various components of the device 1800. The power component 1806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 1800.
[0106] The multimedia component 1808 includes a screen that provides an output interface between the device 1800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1808 includes a front camera and / or a rear camera. When the device 1800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0107] The audio component 1810 is configured to output and / or input audio signals. For example, the audio component 1810 includes a microphone (MIC) that is configured to receive external audio signals when the device 1800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 1804 or transmitted via the communication component 1816. In some embodiments, the audio component 1810 further includes a speaker for outputting audio signals.
[0108] I / O interface 1812 provides an interface between processing component 802 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.
[0109] The sensor assembly 1814 includes one or more sensors for providing various aspects of the status assessment of the device 1800. For example, the sensor assembly 1814 can detect the open / closed state of the device 1800, the relative positioning of components, such as the display and keypad of the device 1800. The sensor assembly 1814 can also detect changes in the position of the device 1800 or a component of the device 1800, the presence or absence of user contact with the device 1800, the orientation or acceleration / deceleration of the device 1800, and changes in the temperature of the device 1800. The sensor assembly 1814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1814 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 can also include an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0110] The communication component 1816 is configured to facilitate wired or wireless communication between the device 1800 and other devices. The device 1800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0111] In an exemplary embodiment, the apparatus 1800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described methods.
[0112] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1804 including instructions, and the instructions can be executed by the processor 1820 of the apparatus 1800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0113] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by the processor of a device (server or terminal), enables the device to perform the data processing methods of the aforementioned embodiments.
[0114] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to perform a virtual scene inspection method, the method comprising: performing voxel acquisition on a target area in the virtual scene, obtaining N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer; controlling a virtual camera to traverse the target area according to each voxel coordinate, and determining a scene rendering data set corresponding to each voxel coordinate; and analyzing the scene rendering data set corresponding to the N voxels to obtain a scene inspection result corresponding to the virtual scene.
[0115] Figure 4 This is a structural diagram of a virtual scene inspection device in an embodiment of the present invention when it is used as a server. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, one or more storage media 1930 (for example, one or more massive storage devices) for storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be temporary storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 to execute a series of instruction operations in the storage medium 1930 on the server 1900.
[0116] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or one or more operating systems 1941, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0117] Other embodiments of the present invention will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the invention being indicated by the following claims.
[0118] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope of the present invention. The scope of the present invention is limited only by the appended claims. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A method for inspecting a virtual scene, characterized in that: include: Perform voxel collection on a target area in a virtual scene to obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer; Controlling the virtual camera to traverse the target area according to each voxel coordinate, and determining the scene rendering data set corresponding to each voxel coordinate. Specifically, when collecting the scene rendering data, the virtual camera in the game scene traverses each voxel in each direction, and for each voxel, sums the rendering data obtained for each voxel in all directions to obtain the scene rendering data set for each voxel along multiple directions and the overall scene rendering data set; The scene rendering data set corresponding to the N voxels is analyzed to obtain a scene inspection result corresponding to the virtual scene.
2. The method according to claim 1, characterized in that The determining of the scene rendering data set corresponding to each voxel coordinate includes: determining, based on a preset direction, the scene rendering data set of each voxel coordinate in the preset direction; When the preset directions include multiple directions, analyzing the scene drawing data set corresponding to the N voxels to obtain the scene inspection result corresponding to the virtual scene includes: analyzing the scene drawing data set corresponding to the N voxels obtained in each preset direction to obtain the scene inspection result in each preset direction.
3. The method according to claim 2, characterized in that The preset direction includes at least one of the following directions: a positive direction of the horizontal axis in the space coordinate system corresponding to the virtual scene, a negative direction of the horizontal axis in the space coordinate system, a positive direction of the vertical axis in the space coordinate system, and a negative direction of the vertical axis in the space coordinate system.
4. The method according to claim 1 or 2, characterized in that The performing voxel acquisition on the target area in the virtual scene to obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene includes: performing voxel acquisition on the target area according to a preset acquisition layer number to obtain at least one voxel in each preset acquisition layer and the corresponding voxel coordinates; The analyzing the scene rendering data set corresponding to the N voxels to obtain the scene inspection result corresponding to the virtual scene includes: analyzing the scene rendering data set corresponding to at least one voxel in each preset acquisition layer to obtain the scene inspection result corresponding to each preset acquisition layer.
5. The method according to claim 1, wherein The scene rendering data set corresponding to each voxel includes rendering data of M data types, where M is a positive integer. The scene rendering data set corresponding to the N voxels is analyzed to obtain a scene inspection result corresponding to the virtual scene, including: Based on the M data types, filtering out rendering data of each data type from the scene rendering data set corresponding to the N voxels; Determine a color channel in the color image corresponding to each data type, and use each data type and the corresponding color channel as a target data type and a target color channel, respectively, and perform the following color image generation steps: for each voxel, map the drawing data of the target data type corresponding to the voxel to the target color channel to obtain target color data corresponding to the voxel; determine a target pixel point corresponding to the voxel coordinates of the voxel in the color image, and store the target color data in the target color channel corresponding to the target pixel point; The generated color image is analyzed to obtain the scene inspection result.
6. The method according to claim 5, characterized in that For each voxel, mapping the drawing data of the target data type corresponding to the voxel to the target color channel to obtain the target color data corresponding to the voxel includes: Filtering, from the drawing data of the target data type corresponding to the N voxels, a maximum value and a minimum value of the drawing data corresponding to the target data type, and obtaining a maximum value and a minimum value of the color data of the target color channel; For each voxel, obtaining drawing data corresponding to the target data type of the voxel, and performing interpolation processing on the drawing data corresponding to the target data type of the voxel, the maximum value of the drawing data, the minimum value of the drawing data, the maximum value of the color, and the minimum value of the color data to obtain target color data mapped to the target color channel for the voxel.
7. The method according to claim 5, characterized in that The scene drawing data set corresponding to each voxel includes at least one of the following drawing data: the number of renderings of the virtual scene corresponding to the current viewing angle of the virtual camera, the number of static meshes corresponding to the virtual scene, the number of geometric bodies corresponding to the virtual scene, and the memory usage corresponding to drawing the virtual scene.
8. The method according to claim 5, characterized in that The analyzing the generated color image to obtain the scene inspection result includes: Determining the color value of each pixel in the color image; Determine at least one pixel point whose color value is greater than a preset color value, determine the voxel coordinates corresponding to the at least one pixel point, and use the area in the target area where the voxel coordinates corresponding to the at least one pixel point are located as the hotspot area of the virtual scene, wherein the scene inspection result includes the hotspot area.
9. A virtual scene inspection device, characterized in that: include: A voxel acquisition module is used to acquire voxels of a target area in a virtual scene, obtain N voxels corresponding to the target area and the voxel coordinates of each voxel in the virtual scene, where N is a positive integer; A rendering data acquisition module is used to control the virtual camera to traverse the target area according to each voxel coordinate and determine the scene rendering data set corresponding to each voxel coordinate. Specifically, when collecting scene rendering data, the virtual camera in the game scene traverses each voxel in each direction. For each voxel, the rendering data acquired for each voxel in all directions are summed to obtain the scene rendering data set for each voxel along multiple directions and the overall scene rendering data set; The processing module is used to analyze the scene rendering data set corresponding to the N voxels to obtain a scene inspection result corresponding to the virtual scene.
10. A virtual scene inspection device, characterized in that: The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operating instructions corresponding to the method according to any one of claims 1 to 8 contained in the one or more programs.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method steps according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Resource processing method and device in virtual scene and electronic equipment
CN112717416A
Volume rendering display method and device of medical image, storage medium and electronic device
CN113160241A