Grid division, grid rendering method, device, equipment and readable medium
By dividing the virtual space into multiple ground grids and classifying them according to the display distance of the target object, a ground grid list is generated, and hierarchical rendering is realized, which solves the problems of large amount of virtual space rendering and low efficiency in the prior art, and significantly improves the rendering efficiency and effect.
Patent Information
- Application Number
- CN202111444436.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2041-11-30
AI Technical Summary
When rendering virtual spaces in the prior art, it is necessary to traverse virtual objects one by one, resulting in large amount of calculations and affecting the rendering efficiency and effect, especially when the hardware configuration is insufficient.
Through the ground grid division method, the virtual space is divided into multiple ground grids, each ground grid contains at least one target object, and the ground grid is classified according to the number of first ground grids visible to the target object within the display distance, and a ground grid list is generated to realize hierarchical rendering.
Through ground grid division and hierarchical rendering, the efficiency of virtual space rendering is significantly improved, the calculation amount is reduced, and the rendering effect is improved, especially when the hardware configuration is insufficient.
Smart Images

Figure CN114168696B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of Internet technology, and in particular to a method, device, equipment, and readable medium for grid division and grid rendering. Background Art
[0002] With the development of image-related technologies, users have higher and higher requirements for image visual experience, which also requires better image rendering effects.
[0003] In the prior art, in order to obtain better image processing effects, many virtual objects and corresponding virtual effects are added. When performing spatial rendering, it is necessary to traverse these virtual objects in the current space one by one. The more virtual objects contained in the grid to be rendered, the more corresponding rendering effects, the more traversals, and the greater the amount of calculation required. When the hardware configuration is insufficient, the rendering efficiency and rendering effect are seriously affected, affecting the user's visual experience. Summary of the invention
[0004] The embodiments of the present invention provide a method, device, equipment and readable medium for grid division and grid rendering, so as to improve the efficiency of executing virtual space rendering tasks.
[0005] In a first aspect, an embodiment of the present invention provides a method for dividing a geographical grid, the method comprising:
[0006] Acquire a grid to be rendered and at least one target object contained in the grid; wherein the grid to be rendered is a basic unit of terrain in a virtual space;
[0007] Determining a first number of visible ground grids within a display distance of the target object;
[0008] The target objects in the grids are classified according to the first number of grids, and a grid list is generated for dividing the grids to be rendered into rendering levels.
[0009] Further optionally, the determining a first number of visible ground grids within the display distance of the target object includes:
[0010] Determining the display distance of the target object and the size range of the ground grid;
[0011] According to the relationship between the display distance and the size range, a first number of visible grids of the target object within the display distance is determined.
[0012] Further optionally, the determining, according to the size relationship between the display distance and the size range, a first number of visible grids of the target object within the display distance includes:
[0013] Determining the physical location of the target object in the grid;
[0014] According to the relationship between the display distance and the size range, a first number of visible ground grids within the display distance with the physical position as a starting point is determined.
[0015] Further optionally, the generating a grid list for dividing the grid to be rendered includes:
[0016] A grid list for dividing the grid to be rendered is generated according to the grids and the number of first grids corresponding to the target objects contained in the grids.
[0017] Further optionally, the determining the display distance of the target object includes:
[0018] Determining a screen-to-body ratio of the target object;
[0019] The display distance of the target object is determined according to the field of view angle and the screen ratio.
[0020] Optionally, the method further includes:
[0021] If the target object is a moving object, the number of third grids is determined according to the change in the physical position; or,
[0022] If the target object is a retractable object, the number of the third grid cells is determined according to the volume change; or,
[0023] If the light of the grid where the target object is located is variable, the number of the third grids is determined according to the amount of light change;
[0024] Based on the third number of grid cells, the target objects in the grid cell list are updated.
[0025] Optionally, the method further includes:
[0026] Determining the number of second grids to be traversed based on the grid where the virtual object is located;
[0027] Determine, from the grid list, at least one target object whose number in the first grid is not less than that in the second grid;
[0028] The at least one target object is rendered.
[0029] Further optionally, the rendering of the at least one target object includes:
[0030] Determining physical distances respectively corresponding to the virtual object and the at least one target object;
[0031] Rendering is performed on a target object of which the physical distance is not greater than the display distance among the at least one target object.
[0032] In a second aspect, an embodiment of the present invention provides a ground grid rendering method, the method comprising:
[0033] Get the grid where the virtual object is located;
[0034] Determining the number of second grids to be traversed according to the grid where the virtual object is located;
[0035] Determine at least one target object from the grid list, the number of which is not less than the number of which is the second grid; wherein the grid list is generated by classifying the grids to be rendered and the first grid numbers of visible grids within the display distance of the target object in the grids to be rendered;
[0036] Render at least one target object in the grid to be rendered.
[0037] In a third aspect, an embodiment of the present invention provides a device for dividing a grid, the device comprising:
[0038] An acquisition module, used to acquire a grid to be rendered and at least one target object contained in the grid; wherein the grid to be rendered is a basic unit of terrain in a virtual space;
[0039] A determination module, used to determine a first number of visible ground grids within a display distance of the target object;
[0040] A generation module is used to classify the target objects in the grids according to the first number of grids, and generate a grid list for dividing the grids to be rendered into rendering levels.
[0041] In a fourth aspect, an embodiment of the present invention provides a ground grid rendering device, the device comprising:
[0042] An acquisition module is used to obtain the grid where the virtual object is located;
[0043] A grid determination module, used to determine the number of second grids to be traversed according to the grid where the virtual object is located;
[0044] An object determination module, used to determine at least one target object whose first grid number is not less than the second grid number from a grid list; wherein the grid list is generated by classifying the grids to be rendered and the first grid number of visible grids within the display distance of the target object in the grids to be rendered;
[0045] A rendering module is used to render at least one target object in the grid to be rendered.
[0046] In a fifth aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the grid division method described in the first aspect or the grid rendering method described in the second aspect.
[0047] In the sixth aspect, an embodiment of the present invention also provides a computer-readable medium on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the grid division method described in the first aspect or the grid rendering method described in the second aspect.
[0048] In an embodiment of the present invention, a grid to be rendered and at least one target object contained in the grid are obtained; wherein the grid to be rendered is a basic unit of terrain in a virtual space. The first grid number of visible grids within the display distance of the target object is determined. The target objects in the grid are classified according to the first grid number, and a grid list is generated for dividing the grid to be rendered into rendering levels. Multiple grid basic units are obtained by dividing the terrain of the virtual space, and each grid contains at least one target object to be rendered. Since the display distance corresponding to each target object is different, the target objects in the grid can be classified according to the first grid number, and a grid list is generated for dividing the grid into rendering levels. Through the grid list, the space is divided into multiple levels to achieve hierarchical rendering, which can effectively improve the rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 A flowchart of a method for dividing a grid into grids provided in an embodiment of the present application;
[0051] Figure 2 A schematic diagram of calculating and displaying distance provided in an embodiment of the present application;
[0052] Figure 3 A schematic diagram of display distance provided in an embodiment of the present application;
[0053] Figure 4A schematic diagram showing another distance provided in an embodiment of the present application;
[0054] Figure 5a , 5b A schematic diagram of a geographical grid list provided in an embodiment of the present application;
[0055] Figure 6 A schematic diagram of a target object rendering effect provided in an embodiment of the present application;
[0056] Figure 7 A flowchart of a method for rendering a ground grid provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of the structure of a grid division device provided in an embodiment of the present application;
[0058] Fig. 9 A schematic diagram of the structure of a ground grid rendering device provided in an embodiment of the present application;
[0059] Fig.10 For Figure 8 A schematic diagram of the structure of an electronic device corresponding to the grid division device provided in the embodiment;
[0060] Fig.11 For Fig. 9 A schematic diagram of the structure of an electronic device corresponding to the grid rendering device provided in the embodiment. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. 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.
[0062] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0063] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0064] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0065] With the development of image rendering technology, it is applied to various technical scenes. Among them, various rendering technologies are used to achieve the required display effects in film and television scenes and game scenes. In practical applications, since there are many target objects in the virtual space to be displayed, such as mountains, waters, trees, flowers, buildings, etc. in the game scene, the target objects in the surrounding virtual space are rendered and displayed as the virtual objects (game characters) move. Especially in some big world games, there are many target objects contained in the virtual space. When rendering, it is usually determined that those target objects need to be rendered and displayed by traversing the target objects. The movement of virtual objects or switching of perspectives requires a traversal, which consumes certain computing resources and also affects the rendering efficiency. Therefore, the present application proposes a technical solution that can effectively improve the efficiency of ground grid rendering.
[0066] For ease of understanding, the following specific examples illustrate the grid division method. It should be noted that in the technical solution of this application, if it is a game scene, it can be a single-player game or a multiplayer game (for example, an open world game); it can be a battle game or a non-battle game (for example, a business game); it can be a terminal game or a mobile game. The game type of the game scene is not limited in this embodiment. For example, the game can be a massively multiplayer online role-playing game, or an augmented reality (AR) game, or a virtual reality (VR) game, or other types of games.
[0067] like Figure 1 A flowchart of a method for dividing a grid into grids is provided in an embodiment of the present application. Figure 1 As you can see, the specific steps include the following:
[0068] 101: Acquire a grid to be rendered and at least one target object contained in the grid; wherein the grid to be rendered is a basic unit of terrain in a virtual space.
[0069] 102: Determine a first number of visible ground grids within a display distance of the target object.
[0070] 103: Classify the target objects in the grids according to the first number of grids, and generate a grid list for dividing the grids to be rendered into rendering levels.
[0071] Taking the Big World game as an example, the terrain in the virtual space of the Big World game is composed of many grids, and there are many target objects in different grids, such as mountains, rivers, flowers, trees, buildings, etc. The grid size can be configured as needed. For example, it can be a square grid of 100×100 meters, one grid next to another. A Big World game scene can be composed of many such grids. Virtual objects in the virtual space (for example, game characters controlled by players) can move from one grid to another in the virtual space. During the movement, corresponding rendering and display processing needs to be performed according to the distance relationship between the target object and the virtual object.
[0072] As described above, firstly, the basic unit grids to be rendered in the current virtual space and at least one target object contained in each grid are obtained, so that it is possible to know which target objects are in each grid and which adjacent grids there are.
[0073] It should be noted that the display distance of the target object indicates the maximum display distance of the target object. When the distance is exceeded, the target object is removed from the clipping space of the virtual camera, so that the target object is not loaded.
[0074] Since the size range of the grid is fixed, the greater the display distance of the target object, the greater the number of first grids of the visible grid. In other words, the greater the display distance of the target object, the virtual object can see the target object from a distance of more grids. If there are multiple target objects in the grid, the number of first grids corresponding to each target object needs to be determined.
[0075] Next, the target objects in the grid are classified according to the number of the first grids, and then a grid list is generated. For example, suppose there are target objects a, b, c, and d in grid A. Among them, the number of first grids corresponding to target object a is 0, the number of first grids corresponding to target object b is 1, the number of first grids corresponding to target object c is 1, and the number of first grids corresponding to target object d is 2. According to the classification processing of the first grid data, three categories will be obtained, namely, a category of target object a with a first grid number of 0, a category of target objects b and c with a first grid number of 1, and a category of target object d with a first grid number of 2. Then, the grid list 0-a, 1-bc, and 2-d of grid A can be obtained. When rendering the grid A, the target object d with the largest number of first grids in grid A will be rendered according to the grid list. As the virtual object approaches grid A, the target objects b and c with a relatively large number of first grids will be rendered, and finally the target object a will be rendered. When rendering each target object in the grid, the level and order are defined in the grid list, so there is no need to traverse all target objects in grid A, and the rendering can be clearly targeted. By dividing the grids to be rendered into rendering levels through the grid list, the image processing efficiency can be effectively improved.
[0076] In one or more embodiments of the present application, determining the first number of visible ground grids within the display distance of the target object includes: determining the display distance of the target object and the size range of the ground grids; and determining the first number of visible ground grids of the target object within the display distance based on the size relationship between the display distance and the size range.
[0077] As mentioned above, by splitting the terrain of the virtual space, multiple grids are obtained. Generally speaking, the size range of each grid is the same. For example, assume that the size range of the grid is 100*100. In the same grid, different target objects have different display distances. For example, the display distance of some target objects is 10, and the display distance of some target objects is 200. Therefore, it can be directly calculated based on the display distance and the grid size range. For example, assuming that the size range of the grid is 100*100, if the display distance of a certain target object 1 is 10, then the calculated number of the first grid is 10 / 100=0.1 grid, that is, it does not exceed the grid range of the target object; for another example, if the display distance of a certain target object 2 is 200, then the calculated number of the second grid is 200 / 100=2 grids, that is, the target object 2 can be seen at a distance of 2 grids from the target object.
[0078] It should be noted that the display distance determination method mentioned here is: determining the screen ratio of the target object; and determining the display distance of the target object according to the field of view angle and the screen ratio. The field of view angle and the screen ratio may be preset values.
[0079] like Figure 2 A schematic diagram of calculating and displaying distance provided in an embodiment of the present application. Figure 2 As can be seen from the figure, the full screen width of the target object (i.e., the longest side of the target object bounding box / the screen ratio of the target object) is width, d is the maximum display distance of the target object (i.e., the clipping distance), the near plane width of the clipping space is c, the near plane distance is a, and the field of view angle is θ. It can be seen that c / a=2tan(θ / 2). In addition, from Figure 2 It can also be seen that c / a=width / d, so d=width*c / a can be calculated, that is, the display distance d=(the longest side of the target object bounding box / the screen ratio of the target object)*2tan(θ / 2).
[0080] For example, if Figure 3 This is a schematic diagram of the display distance provided in the embodiment of the present application. Figure 3 As shown, it is assumed that the target object B is located at the center of the grid A and is far away from the boundary of the virtual space. Determining the first number of grids of the visible grid of the target object within the display distance according to the size relationship between the display distance and the size range includes: determining the physical position of the target object in the grid; and determining the first number of grids of the visible grid within the display distance with the physical position as the starting point according to the size relationship between the display distance and the size range.
[0081] Assume that the display distance of the target object B is 200, and the grid size range is 100*100. Starting from the location of the target object B, the farthest reachable area within the display distance is as follows: Figure 3 From the range shown, it can be seen that within the display distance, the farthest that can be reached is the second grid other than the grid where the target object B is located, so the number of first grids of the visual grid corresponding to the target object B is 2. It can be seen that if the physical position of the target object B is the center of grid A, the number of first grids of the target object in different display angle directions in this scene is the same. It should be noted that if the display distance of a target object in the grid does not exceed the size range of the grid, then the corresponding number of first grids is defined as 0. If it exceeds the size range of the current grid and has a partial range intersection with an adjacent grid, then the corresponding number of first grids is 1. In other words, the number of corresponding grids is the same as the number of grids with which the display distance has a range intersection (except the current grid).
[0082] Of course, the number of the first grids can also be defined as 1 when the display distance of a target object in the grid does not exceed the size range of the grid, and correspondingly, the number of grids with a display distance that exceeds the size range of the current grid is increased by 1. The number of grids here is used to classify the target objects in the grid, and is used to indicate the relative difference in display distance of each target object, so as to divide the grid rendering level.
[0083] In order to make the established grid list more accurate, the number of first grids corresponding to the target object can also be determined by displaying different directions and angles. The details are as follows:
[0084] If the physical position of the target object in the grid is a non-central position. Determining the first number of visible grids within the display distance starting from the physical position based on the size relationship between the display distance and the size range includes: determining a plurality of first display angles corresponding to the target object at the physical position. Determining the first number of visible grids within the display distance in different directions of the plurality of first display angles based on the size relationship between the display distance and the size range.
[0085] like Figure 4 Another schematic diagram showing distance provided by an embodiment of the present application. Figure 4 It can be seen that the target object B is at one side edge of grid A, that is, the physical position is not at the center. It is easy to understand that if the target object B is not at the center of grid A, then the number of first grids corresponding to the target object B in different display angle directions is different (the number of first grids corresponding to the target object in different display angle directions is also the number of first grids corresponding to the target object in different directions). In order to be able to more finely control the rendering effect of the target object in the grid, the display angle can be divided based on the physical position of the target object to obtain multiple first display angles. Then, determine the number of first grids corresponding to the target object within each first display angle range. In other words, the same target object in the same grid corresponds to different numbers of first grids in different display angles. As Figure 4As shown, although the display distance of the target object B in all directions is the same, the number of grids covered or partially overlapped by the same display distance is different in different display angle directions. For example, at the first display angle A, the number of first grids corresponding to the target object is 1, and at the first display angle B, the number of first grids corresponding to the target object is 2. Therefore, when rendering, it is also necessary to select the target object to be rendered from the grid list according to the relative orientation of the virtual object and the target object, so as to achieve accurate and efficient grid rendering effects. It should be noted that the display angle mentioned here can be understood as the angle range formed by the same display distance in different directions with the target object as the center, such as Figure 4 As shown in the first display angle A and the first display angle B.
[0086] In one or more embodiments of the present application, the generating of the grid list for dividing the grid to be rendered includes: generating the grid list for dividing the grid to be rendered according to the grid and the number of first grids corresponding to the target objects contained in the grid. In addition, considering that different display angles correspond to different numbers of first grids, the grid list for dividing the grid to be rendered can also be generated according to the grid and the number of first grids corresponding to the target objects contained in the grid, according to different directions of the first display angle.
[0087] like Figure 5a , 5b A schematic diagram of a grid list provided in an embodiment of the present application. Figure 5a As can be seen in , when there is no need to accurately subdivide the grid rendering level, or when the target object is located at the center of the grid, or when the target object is too large or the display distance is too large, the number of first grids of the target object in different first display angle directions can be ignored. Figure 5a The simple grid list shown includes a grid identifier, a target object name in the grid, and the first grid number. When actually rendering, you can select which target objects to render based on the grid list, without having to traverse all target objects in the grid once to determine which ones to render, effectively improving the efficiency of target object rendering.
[0088] from Figure 5bIt can be seen that in the grid list, not only the grid identifier, the name of the target object in the grid and the number of first grids are included, but also the corresponding first display angle direction. As mentioned above, if the target object is located at a non-central position of the grid, or the target object is too small or the display distance is too small, different first display angle directions correspond to different numbers of first grids. Therefore, in order to achieve more refined control of the rendering level, it is necessary to establish a grid list according to different first display angle directions. When rendering, it is necessary to determine the corresponding first display angle based on the relative orientation of the virtual object and the target object, so as to select the target object to be rendered from the grid list.
[0089] In one or more embodiments of the present application, it also includes: if the target object is a mobile object, the number of the third grids is determined according to the change in the physical position; or, if the target object is a retractable object, the number of the third grids is determined according to the change in volume; or, if the light in the grid where the target object is located is variable, the number of the third grids is determined according to the change in light; based on the third number of grids, the target object in the grid list is updated.
[0090] In actual applications, the virtual space contains various target objects, some of which are movable, such as animals, vehicles, etc. When moving, the physical position of the target object in the grid will change. It is easy to understand that when the physical position changes, the number of visible grids corresponding to different first display angles of the target object relative to the surrounding grids will also change accordingly. Assuming that the position of the virtual object in the grid has not changed, the display effect of the target object has also changed because the target object has moved, and the grid list of the grid where the target object is located needs to be updated based on the third number of grids.
[0091] If the target object B moves from grid A to grid B, the information about the target object B in the grid list corresponding to grid A is deleted, and the information about the target object B is added to the grid list corresponding to grid B.
[0092] In practical applications, if the target object is a retractable object, the third number of grids is determined according to the volume change (corresponding to the change in the longest side of the bounding box). For example, if the target object is an upgradeable elf, or a balloon that is expanding or shrinking, etc., since the longest side of the bounding box of the target object has changed significantly, the corresponding display distance will also change accordingly. Therefore, it is necessary to re-determine the number of grids in different first display angle directions corresponding to the target object, update the first number of grids to the third number of grids, and then update the grid list of the grid where the target object is located (replace the first number of grids in the grid list with the third number of grids). In an embodiment of the present application, if the target object is a retractable object, the display distance corresponding to the target object is updated in real time.
[0093] In practical applications, if the light in the grid where the target object is located is variable, the third grid number is determined according to the amount of light change. For example, if the environment where the target object is located changes (the target object moves from the basement to the outdoors during the day, or flares are projected from outdoors to high altitudes, etc.), the corresponding display distance will also change accordingly. Therefore, it is necessary to re-determine the number of grids in different first display angle directions corresponding to the target object, update the first grid number to the third grid number, and then update the grid list of the grid where the target object is located (replace the first grid number in the grid list with the third grid number).
[0094] After the grid list is established, the grids in the current virtual space can be rendered, which specifically includes the following steps: determining the number of second grids to be traversed based on the grid where the virtual object is located; determining at least one target object from the grid list whose number of the first grids is not less than that of the second grids; and rendering the at least one target object.
[0095] It should be noted that the second number of grids to be traversed mentioned here is determined based on the grid position of the virtual object and the visible distance of the virtual object. For example, if the visible distance of the virtual object is 2 grids (the farthest distance that the virtual object can see, and the number of grids is used to represent the distance here for ease of understanding), the grids to be loaded corresponding to the virtual object are further determined, wherein the grids to be loaded corresponding to the virtual object are grids within 2 grids from the virtual object. For example, taking the grid where the virtual object is located as the starting point, traverse each grid within a range of no more than 2 grids from the grid where the virtual object is located to obtain at least one grid to be loaded. For each grid to be loaded, determine the number of grids between the grid where the virtual object is currently located and the grid to be loaded to obtain the second number of grids. After determining the second number of grids, for the object of the grid to be loaded, according to the grid list corresponding to the grid to be loaded, filter out the target object to be rendered whose first number of grids is greater than or equal to the second number of grids. For specific screening and rendering technical solutions, please refer to the following Figure 7 The corresponding embodiments will not be repeated here.
[0096] When rendering is actually performed, the rendering of the at least one target object includes: determining the physical distances respectively corresponding to the virtual object and the at least one target object. The target object whose physical distance is not greater than the display distance is rendered. The physical distances respectively corresponding to the virtual object and the at least one target object are determined, that is, the distance between the current position of the virtual object and the position of the target object is determined. When the distance is not greater than the display distance of the target object, the target object is loaded and rendered.
[0097] For example, suppose there are target objects a, b, c, and d in grid A. Among them, the number of first grids corresponding to target object a is 0, the number of first grids corresponding to target object b is 1, the number of first grids corresponding to target object c is 1, and the number of first grids corresponding to target object d is 2. The grid list 0-a, 1-bc, 2-d of grid A is obtained (assuming that the list does not include the first display angle direction, the number in front represents the number of first grids, and the letter behind represents the target object identifier or name). Figure 6 A schematic diagram of a target object rendering effect provided by an embodiment of the present application. Figure 6It can be seen that the virtual object is in grid C. Assuming that the number of second grids to be traversed is 1, there are two target objects b and c in grid A which is 1 grid away from the virtual object. It is also necessary to further determine the physical distance between the virtual object and the target objects b and c in grid A. Only when the physical distance is not greater than the display distance of the target object is rendered, assuming that only the physical distance of target object b is less than the display distance of target object b, then target object b will be rendered and visible to the virtual object. Only when the virtual object approaches grid A, as the distance between the virtual object and grid A shortens, other target objects (for example, target object c) in the grid are rendered according to the grid list. The rendering process renders the target objects in the grid in layers according to the grid list.
[0098] In one or more embodiments of the present application, determining from the grid list at least one target object whose number of the first grids is not less than the number of the second grids includes: determining a second display angular direction of the virtual object in the grid; and determining from the grid list at least one target object whose number of the first grids is not less than the number of the second grids based on the second display angular direction.
[0099] In actual applications, since the number of first ground grids corresponding to the same target object in different display angle directions may be different, the order of the rendered target objects is also different when the ground grids are rendered in multiple levels. Specifically, determine the second display angle direction of the position of the virtual object relative to the target object, and search the first display angle direction range to which the second display angle direction belongs from the ground grid list corresponding to the target object. Assume that the range is determined to be 0-180 degrees, and the corresponding list is 0-a, 1-bc, 2-d, and then select at least one target object whose number of first ground grids is not less than the number of second ground grids for rendering.
[0100] Figure 7 A flowchart of a method for rendering a grid provided in an embodiment of the present application is shown below. Figure 7 As shown, the method comprises the following steps:
[0101] 701: Get the grid where the virtual object is located.
[0102] 702: Determine the number of second grids to be traversed according to the grid where the virtual object is located.
[0103] 703: Determine from a grid list at least one target object whose first grid quantity is not less than the second grid quantity; wherein the grid list is generated based on the grids to be rendered and the first grid quantity of visible grids within the display distance of the target object in the grids to be rendered.
[0104] 704: Render at least one target object in the grid to be rendered.
[0105] The rendering of the at least one target object from the grid list includes: determining the physical distances respectively corresponding to the virtual object and the at least one target object, and rendering the target object whose physical distance is not greater than the display distance among the at least one target object.
[0106] For example, suppose there are target objects a, b, c, and d in traversed grid A. Among them, the number of first grids corresponding to target object a is 0, the number of first grids corresponding to target object b is 1, the number of first grids corresponding to target object c is 1, and the number of first grids corresponding to target object d is 2. Get the grid list 0-a, 1-bc, 2-d of grid A (assuming that the list does not contain the first display angle direction, the number in front represents the number of first grids, and the letter behind represents the target object identifier or name). From Figure 6 As can be seen in the figure, the virtual object is in grid C. Assuming that the number of second grids to be traversed is 1, there are two target objects b and c in grid A which is 1 grid away from the virtual object. It is also necessary to further determine the physical distance between the virtual object and the target objects b and c in grid A. Only when the physical distance is not greater than the display distance of the target object is rendered, it is assumed that only when the physical distance of target object b is less than the display distance of target object b, target object b will be rendered and visible to the virtual object.
[0107] For the process of generating the grid list, please refer to Figure 1 The various embodiments corresponding to FIG. 5 will not be repeated here.
[0108] It can be known from the above scheme that a grid to be rendered and at least one target object contained in the grid are obtained; wherein the grid to be rendered is a basic unit of terrain in the virtual space. The first grid number of visible grids within the display distance of the target object is determined. The target objects in the grid are classified according to the first grid number, and a grid list is generated for dividing the grid to be rendered into rendering levels. Through the above technical scheme, a plurality of grid basic units are obtained by dividing the terrain of the virtual space, and each grid contains at least one target object to be displayed. Since the display distance corresponding to each target object is different, the target objects in the grid can be classified according to the first grid number determined by the display distance, and a grid list is generated for dividing the grid into rendering levels. Through the grid list, the space is divided into multiple levels to achieve hierarchical rendering, which can effectively improve the rendering efficiency.
[0109] Based on the same idea, the embodiment of the present application also provides a grid division device. Figure 8 A schematic diagram of the structure of a grid division device provided in an embodiment of the present application. Figure 8 As can be seen in the figure, the device includes:
[0110] The acquisition module 81 is used to acquire the grids contained in the grids to be rendered and at least one target object contained in the grids.
[0111] The determination module 82 is used to determine a first number of visible ground grids within the display distance of the target object.
[0112] The generating module 83 is used to classify the target objects in the grids according to the first number of grids, and generate a grid list for dividing the grids to be rendered.
[0113] Further optionally, the determination module 82 is also used to determine the display distance of the target object and the size range of the grids; and determine the first number of grids of the target object visible within the display distance based on the size relationship between the display distance and the size range.
[0114] Further optionally, the determination module 82 is also used to determine the physical position of the target object in the grid; based on the size relationship between the display distance and the size range, determine the first number of grids visible within the display distance starting from the material position.
[0115] Further optionally, if the physical position of the target object in the grid is a non-central position; the determination module 82 is also used to determine a plurality of first display angles corresponding to the target object when it is at the physical position; and according to the relationship between the display distance and the size range, the number of first grids of the corresponding visual grids within the display distance is determined in different directions of the plurality of first display angles.
[0116] Further optionally, the generation module 83 is also used to generate a grid list for dividing the grid to be rendered according to the grid and the number of first grids corresponding to the target objects contained in the grid; or, based on the grid and the number of first grids corresponding to the target objects contained in the grid, generate a grid list for dividing the grid to be rendered according to different first display angle directions.
[0117] Further optionally, the determination module 82 is further configured to determine the display distance of the target object according to the field of view angle and the screen ratio; and determine the display distance based on the physical position of the target object.
[0118] Further optionally, an update module 84 is included, which is used to determine the third grid number according to the change in the physical position if the target object is a moving object; or, if the target object is a retractable object, determine the third grid number according to the change in volume; or, if the light in the grid where the target object is located is variable, determine the third grid number according to the change in light; based on the third grid number, update the target object in the grid list.
[0119] Further optionally, it also includes a rendering module 85, which is used to determine the number of second grids to be traversed based on the grid where the virtual object is located; determine at least one target object from the grid list whose number of the first grids is not less than the number of the second grids; and render the at least one target object.
[0120] Further optionally, the rendering module 85 is further configured to determine the physical distances respectively corresponding to the virtual object and the at least one target object; and render the target object among the at least one target object whose physical distance is not greater than the display distance.
[0121] Based on the same idea, the present application embodiment also provides a ground grid rendering device. Fig. 9 A schematic diagram of the structure of a ground grid rendering device provided in an embodiment of the present application. Fig. 9 As can be seen in the figure, the device includes:
[0122] The acquisition module 91 is used to acquire the grid where the virtual object is located.
[0123] The grid determination module 92 is used to determine the number of second grids to be traversed according to the grid where the virtual object is located.
[0124] The object determination module 93 is used to determine from a grid list at least one target object whose first grid quantity is not less than the second grid quantity; wherein the grid list is generated based on the grids to be rendered and the first grid quantity of visible grids within the display distance of the target object in the grids to be rendered.
[0125] The rendering module 94 is used to render at least one target object in the grid to be rendered.
[0126] In one possible design, the above Figure 8 The structure of the grid division device shown can be implemented as an electronic device. Fig.10As shown, the electronic device may include: a processor 101 and a memory 102. The memory 102 stores executable code, and when the executable code is executed by the processor 101, the processor 101 can at least implement the grid division method provided in the above embodiment. The structure of the electronic device may also include a communication interface 103 for communicating with other devices or communication networks.
[0127] In addition, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of a wireless router, the processor executes the grid division method provided in the aforementioned embodiments.
[0128] In one possible design, the above Fig. 9 The structure of the grid rendering device shown can be implemented as an electronic device. Fig.11 As shown, the electronic device may include: a processor 1101 and a memory 1102. The memory 1102 stores executable code, and when the executable code is executed by the processor 1101, at least the processor 1101 can implement the grid rendering method provided in the above-mentioned embodiment. The structure of the electronic device may also include a communication interface 1103 for communicating with other devices or communication networks.
[0129] In addition, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of a wireless router, the processor executes the grid rendering method provided in the aforementioned embodiments.
[0130] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0131] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or contribute to the part in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for dividing a land grid, characterized in that: The method comprises: Acquire a grid to be rendered and at least one target object contained in the grid; wherein the grid to be rendered is a basic unit of terrain in a virtual space; Determining a first number of visible ground grids within a display distance of the target object, wherein the display distance is adapted to a volume change of the target object; Classifying the target objects in the grids according to the first number of grids, and generating a grid list for dividing the grids to be rendered into rendering levels; When rendering any grid to be rendered, rendering the target object having the largest number of first grids in the grids according to the grid list; As the virtual object approaches the grid, other target objects are rendered in sequence according to the levels and order defined in the grid list.
2. The method according to claim 1, characterized in that The determining of a first number of visible ground grids within a display distance of the target object comprises: Determining the display distance of the target object and the size range of the ground grid; According to the relationship between the display distance and the size range, a first number of visible grids of the target object within the display distance is determined.
3. The method according to claim 2, characterized in that The determining, according to the size relationship between the display distance and the size range, a first number of visible ground grids of the target object within the display distance includes: Determining the physical location of the target object in the grid; According to the relationship between the display distance and the size range, a first number of visible ground grids within the display distance with the physical position as a starting point is determined.
4. The method according to claim 3, characterized in that The generating of a grid list for dividing the grid to be rendered includes: A grid list for dividing the grid to be rendered is generated according to the grids and the number of first grids corresponding to the target objects contained in the grids.
5. The method according to claim 3, characterized in that: The determining the display distance of the target object includes: Determining a screen-to-body ratio of the target object; The display distance of the target object is determined according to the field of view angle and the screen ratio.
6. The method according to claim 3, characterized in that Also includes: If the target object is a moving object, determining the number of third grids according to the change in the physical position; or, If the target object is a retractable object, the number of the third grid cells is determined according to the volume change; or, If the light of the grid where the target object is located is variable, the number of the third grids is determined according to the amount of light change; Based on the third number of grid cells, the target objects in the grid cell list are updated.
7. The method according to claim 5, characterized in that Also includes: Determining the number of second grids to be traversed based on the grid where the virtual object is located; Determine, from the grid list, at least one target object whose number in the first grid is not less than that in the second grid; The at least one target object is rendered.
8. The method according to claim 7, characterized in that The rendering of the at least one target object comprises: Determining physical distances respectively corresponding to the virtual object and the at least one target object; Rendering is performed on a target object of which the physical distance is not greater than the display distance among the at least one target object.
9. A grid division device, characterized in that: The device comprises: An acquisition module, used for acquiring a grid contained in a grid to be rendered and at least one target object contained in the grid; A determination module, configured to determine a first number of visible ground grids within a display distance of the target object, wherein the display distance is adapted to a volume change of the target object; A generation module, used for classifying the target objects in the grids according to the first number of grids, and generating a grid list for dividing the grids to be rendered; A rendering module is used to render any grid to be rendered, and render the target object with the largest number of first grids in the grid according to the grid list; as the virtual object approaches the grid, other target objects are rendered in sequence according to the level and order defined in the grid list.
10. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the method according to any one of claims 1 to 8.
11. A computer readable medium, characterized in that At least one instruction, at least one program, code set or instruction set is stored thereon, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Virtual object display control method and device, storage medium and electronic equipment
CN112494941A
Object rendering method and device, equipment and storage medium
CN113282289A