Rendering Method, Device, Equipment and Storage Medium of Virtual Object

By performing collision detection of the field of view space range and space blocks in the virtual environment and performing secondary collision detection, the calculation complexity problem caused by the increase in the number of virtual objects is solved, and more efficient virtual object rendering is achieved.

CN117815652BActive Publication Date: 2025-05-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211185429.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-27
Publication Date
2025-05-30
Estimated Expiration
2042-09-27

AI Technical Summary

Technical Problem

The prior art requires a large number of collision detection due to the increase in the number of virtual objects in the virtual environment, resulting in an increase in the computational complexity and it is difficult to meet the computing capability requirements of computer equipment.

Method used

By performing collision detection on the field of view space range and space block in the virtual environment, and performing secondary collision detection on the space sub-blocks in the presence of collisions, rendering of virtual objects only when there is a collision between the field of view space range and space sub-blocks.

Benefits of technology

The complexity of judging whether to render virtual objects is reduced, avoiding the problem of too many collision detection times due to the increase in the number of virtual objects, and effectively reducing the computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117815652B_ABST
    Figure CN117815652B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, device and storage medium for rendering virtual objects, belonging to the technical field of virtual environments. The method includes: performing a collision detection on a field of view space range and a space block in a virtual environment; when there is a collision between the field of view space range and a first space block, performing a collision detection on space sub-blocks in the field of view space range and the first space block, where the first space block includes at least one space sub-block; and when there is a collision between the field of view space range and a first space sub-block, rendering a second virtual object in the first space sub-block. By performing a collision detection on the field of view space range and the space block in the virtual environment, and only performing a secondary collision detection when there is a collision between the field of view space range and the first space block, the present application avoids the problem of a large number of collision detections caused by an increase in the number of second virtual objects, and effectively reduces the computational complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of virtual environments, and particularly to a method, apparatus, device, and storage medium for rendering virtual objects. Background Art

[0002] With the development of Internet technology, in order to pursue a sense of immersion in the virtual environment, the number of virtual objects in the virtual environment is increasing day by day.

[0003] In related technologies, by performing collision detection on each of the edge points of the field of view space range and the virtual objects in the virtual environment, it is determined whether the virtual object is located within the field of view space range, and the virtual objects located within the field of view space range are rendered to obtain an image of the virtual environment.

[0004] However, with the increase in the number of virtual objects, a large number of collision detections need to be performed in the above process, which poses a high demand on the computing power of computer devices in the actual application process. How to reduce the computational complexity is an urgent problem to be solved. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for rendering virtual objects, and the technical solutions are as follows:

[0006] According to one aspect of this application, a method for rendering virtual objects is provided, and the method includes:

[0007] Performing collision detection on the field of view space range and spatial blocks in the virtual environment, where the virtual environment includes at least one of the spatial blocks;

[0008] In the case of a collision between the field of view space range and a first spatial block, performing collision detection on the spatial sub-blocks in the field of view space range and the first spatial block, where the first spatial block includes at least one of the spatial sub-blocks;

[0009] In the case of a collision between the field of view space range and the first spatial sub-block, rendering a second virtual object in the first spatial sub-block.

[0010] According to another aspect of this application, a device for rendering virtual objects is provided, and the device includes:

[0011] A detection module, configured to perform collision detection on the field of view space range and spatial blocks in the virtual environment, where the virtual environment includes at least one of the spatial blocks;

[0012] The detection module is further configured to perform a collision detection on the spatial sub - blocks in the visual field space range and the first spatial block when there is a collision between the visual field space range and the first spatial block, where the first spatial block includes at least one of the spatial sub - blocks;

[0013] The rendering module is configured to render a second virtual object in the first spatial sub - block when there is a collision between the visual field space range and the first spatial sub - block.

[0014] In an alternative design of the present application, the position of the spatial sub - block is determined according to the position of the second virtual object, and the arrangement of the spatial sub - blocks in the first spatial block is a non - tessellated arrangement.

[0015] In an alternative design of the present application, the first spatial block contains a first virtual object and the second virtual object, and the spatial sub - block contains the second virtual object;

[0016] Wherein, the size of the first virtual object is greater than the corresponding size threshold of the spatial block; the size of the second virtual object is less than or equal to the size threshold.

[0017] In an alternative design of the present application, the rendering module is further configured to:

[0018] Render the first virtual object in the first spatial block when there is a collision between the visual field space range and the first spatial block.

[0019] In an alternative design of the present application, the device further includes:

[0020] A determination module, configured to determine that the first virtual object and / or the second virtual object in the second spatial block is in a hidden state when there is no collision between the visual field space range and the second spatial block.

[0021] In an alternative design of the present application, the rendering module is further configured to:

[0022] Determine the number of second virtual objects in the first spatial sub - block when there is a collision between the visual field space range and the first spatial sub - block and no memory space is allocated;

[0023] Allocate the memory space according to the number of the second virtual objects;

[0024] Based on the memory space, set parameter information and index information for the parameter matrix of the second virtual object, where the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block;

[0025] Based on the parameter matrix of the second virtual object, render the second virtual object.

[0026] In an alternative design of the present application, the rendering module is further configured to:

[0027] When there is a collision between the viewing space range and the first spatial sub-block and memory space has been allocated, add the second virtual object in the second spatial block to the display list of the memory space;

[0028] Based on the parameter matrix of the second virtual object, render the second virtual object in the display list.

[0029] In an alternative design of the present application, the device further includes:

[0030] A processing module, configured to set parameter information and index information for the parameter matrix of the second virtual object when the memory space does not overflow;

[0031] The processing module is further configured to add the second virtual object to the list of objects to be processed and allocate new memory space when the memory space overflows;

[0032] The processing module is further configured to reuse the list of objects to be processed and the display list in the new memory space;

[0033] The processing module is further configured to set parameter information and index information for the parameter matrix of the second virtual object in the list of objects to be processed;

[0034] Wherein, the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block.

[0035] In an alternative design of the present application, the device further includes:

[0036] A processing module, configured to add the second virtual object in the second spatial sub-block to the hidden list when there is no collision between the viewing space range and the second spatial sub-block;

[0037] The processing module is further configured to determine the second virtual object in the hidden list as a hidden state.

[0038] In an alternative design of the present application, the rendering module is further configured to:

[0039] When there is a shadow of the second virtual object, add a shadow drawing identifier to the second virtual object and add the second virtual object to the shadow list;

[0040] Render the second virtual object and the shadow of the second virtual object in the shadow list based on the parameter matrix of the second virtual object.

[0041] In an alternative design of the present application, the detection module is further configured to:

[0042] Perform a collision detection on the field of view projection and the spatial block projection, where the field of view projection is the projection of the field of view space range on the horizontal plane of the virtual environment, and the spatial block projection is the projection of the spatial block on the horizontal plane of the virtual environment;

[0043] When there is a collision between the field of view projection and the first spatial block projection, perform a collision detection on the field of view projection and the spatial sub-block projection, where the spatial sub-block projection is the projection of the spatial sub-block on the horizontal plane of the virtual environment.

[0044] In an alternative design of the present application, the device further includes:

[0045] A processing module, configured to determine a loading space range in the virtual environment with the field of view space range as the center, and the distance between any spatial point in the loading space range and the field of view space range is less than the first distance threshold;

[0046] The processing module is further configured to perform a loading process on the loading space blocks in the memory space, where the loading space blocks are the spatial blocks that overlap with the loading space range.

[0047] In an alternative design of the present application, the processing module is further configured to:

[0048] Based on the field of view space range, determine a clearing space range in the virtual environment, and the distance between any spatial point in the clearing space range and the field of view space range is greater than the second distance threshold;

[0049] Perform a deletion process on the clearing space blocks in the memory space, where the clearing space blocks are the spatial blocks that overlap with the clearing space range and do not overlap with the loading space range.

[0050] In an alternative design of the present application, the processing module is further configured to:

[0051] Based on the visual field space range, determine a cache space range in the virtual environment, and the distance between any space point in the cache space range and the visual field space range is greater than a third distance threshold;

[0052] Establish a cache for the cache space block, where the cache space block is the space block that overlaps with the cache space range and does not overlap with the loading space range.

[0053] According to another aspect of the present application, there is provided a computer device, which includes a processor and a memory. At least one instruction, at least one program, a code set or an instruction set is stored in the memory, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the rendering method of the virtual object as described in the above aspect.

[0054] According to another aspect of the present application, there is provided a computer-readable storage medium, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the rendering method of the virtual object as described in the above aspect.

[0055] According to another aspect of the present application, there is provided a computer program product, which includes computer instructions. The computer instructions are stored in a computer-readable storage medium, and a processor reads and executes the computer instructions from the computer-readable storage medium to implement the rendering method of the virtual object as described in the above aspect.

[0056] The beneficial effects brought by the technical solution provided by the present application at least include:

[0057] By performing collision detection on the visual field space range and space blocks in the virtual environment, and determining the rendering of virtual objects based on the collision results of the space blocks, the complexity of judging whether to render virtual objects is reduced; by performing secondary collision detection only when there is a collision between the visual field space range and the first space block, the problem of a large number of collision detections caused by an increase in the number of second virtual objects is avoided, and the computational complexity is effectively reduced. Description of the Drawings

[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0059] Figure 1It is a block diagram of a computer system provided by an exemplary embodiment of the present application;

[0060] Figure 2 It is a schematic diagram of a virtual environment provided by an exemplary embodiment of the present application;

[0061] Figure 3 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0062] Figure 4 It is a schematic diagram of a spatial block provided by an exemplary embodiment of the present application;

[0063] Figure 5 It is a schematic diagram of a spatial block provided by an exemplary embodiment of the present application;

[0064] Figure 6 It is a schematic diagram of a spatial block provided by an exemplary embodiment of the present application;

[0065] Figure 7 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0066] Figure 8 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0067] Figure 9 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0068] Figure 10 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0069] Figure 11 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0070] Figure 12 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0071] Figure 13 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0072] Figure 14 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0073] Figure 15 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0074] Figure 16It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0075] Figure 17 It is a schematic diagram of a virtual environment provided by an exemplary embodiment of the present application;

[0076] Figure 18 It is a flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application;

[0077] Figure 19 It is a structural block diagram of a virtual object rendering device provided by an exemplary embodiment of the present application;

[0078] Figure 20 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application.

[0079] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Detailed implementation manners

[0080] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0081] Exemplary embodiments will be described in detail here, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0082] The terms used in this disclosure are for the purpose of describing particular embodiments only and are not intended to limit the disclosure. The singular forms "a", "the", and "that" used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0083] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions. It should be understood that although terms such as first and second may be used in this disclosure to describe various information, these information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0084] Figure 1 The block diagram of the structure of a computer system provided by an exemplary embodiment of the present application is shown. The computer system 100 includes: a first terminal 110, a server 120, and a second terminal 130.

[0085] The first terminal 110 installs and runs a client 111 that supports a virtual environment. The client 111 can be a multiplayer online battle program. When the first terminal runs the client 111, the user interface of the client 111 is displayed on the screen of the first terminal 110. The client 111 can be any one of a battle royale shooting game, a Virtual Reality (VR) application, an Augmented Reality (AR) program, a three-dimensional map program, a virtual reality game, an augmented reality game, a First-Person Shooting Game (FPS), a Third-Personal Shooting Game (TPS), a Multiplayer Online Battle Arena Game (MOBA), and a Simulation Game (SLG). In this embodiment, the client 111 is taken as an FPS game for example. The first terminal 110 is a terminal used by the first user 112. The first user 112 uses the first terminal 110 to control the first virtual character located in the virtual environment to perform activities. The first virtual character can be called the virtual character of the first user 112. The activities of the first virtual character include but are not limited to at least one of moving, jumping, teleporting, releasing skills, using items, adjusting body postures, crawling, walking, running, cycling, flying, jumping, driving, picking up, shooting, attacking, and throwing. Schematically, the first virtual character is a first virtual character, such as a simulated human character or an anime character.

[0086] The second terminal 130 installs and runs a client 131 that supports a virtual environment. The client 131 can be a multiplayer online battle program. When the second terminal 130 runs the client 131, the user interface of the client 131 is displayed on the screen of the second terminal 130. The client can be any one of a battle royale shooting game, a VR application, an AR program, a three-dimensional map program, a virtual reality game, an augmented reality game, an FPS, a TPS, a MOBA, and an SLG. In this embodiment, the client is taken as a MOBA game for example. The second terminal 130 is a terminal used by the second user 132. The second user 132 uses the second terminal 130 to control the second virtual character located in the virtual environment to perform activities. The second virtual character can be called the virtual character of the second user 132. Schematically, the second virtual character is a second virtual character, such as a simulated human character or an anime character.

[0087] Optionally, the first virtual character and the second virtual character are in the same virtual environment. Optionally, the first virtual character and the second virtual character may belong to the same faction, the same team, the same organization, have a friendship relationship, or have temporary communication permissions. Optionally, the first virtual character and the second virtual character may belong to different factions, different teams, different organizations, or have a hostile relationship.

[0088] Optionally, the clients installed on the first terminal 110 and the second terminal 130 are the same, or the clients installed on the two terminals are of the same type on different operating system platforms (Android or iOS). The first terminal 110 may generally refer to one of multiple terminals, and the second terminal 130 may generally refer to another of multiple terminals. This embodiment only takes the first terminal 110 and the second terminal 130 as examples for illustration. The device types of the first terminal 110 and the second terminal 130 are the same or different, and the device types include at least one of a smart phone, a tablet computer, an e-book reader, an MP3 player, an MP4 player, a laptop computer, and a desktop computer.

[0089] Figure 1 Only two terminals are shown in the figure, but in different embodiments, there are multiple other terminals 140 that can access the server 120. Optionally, there is also one or more terminals 140 that are the terminals corresponding to the developer. A development and editing platform for the client that supports the virtual environment is installed on the terminal 140. The developer can edit and update the client on the terminal 140, and transmit the updated client installation package to the server 120 through a wired or wireless network. The first terminal 110 and the second terminal 130 can download the client installation package from the server 120 to update the client.

[0090] The first terminal 110, the second terminal 130, and the other terminals 140 are connected to the server 120 through a wireless network or a wired network.

[0091] The server 120 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The server 120 is used to provide background services for the client that supports the three-dimensional virtual environment. Optionally, the server 120 undertakes the main computing work, and the terminal undertakes the secondary computing work; or, the server 120 undertakes the secondary computing work, and the terminal undertakes the main computing work; or, a distributed computing architecture is adopted between the server 120 and the terminal for collaborative computing.

[0092] In a schematic example, the server 120 includes a processor 122, a user account database 123, a battle service module 124, and a user-oriented input / output interface (I / O interface) 125. Among them, the processor 122 is used to load the instructions stored in the server 121 and process the data in the user account database 123 and the battle service module 124; the user account database 123 is used to store the data of the user accounts used by the first terminal 110, the second terminal 130, and other terminals 140, such as the avatars of the user accounts, the nicknames of the user accounts, the combat power indexes of the user accounts, and the service areas where the user accounts are located; the battle service module 124 is used to provide multiple battle rooms for users to conduct battles, such as 1V1 battles, 3V3 battles, 5V5 battles, etc.; the user-oriented I / O interface 125 is used to establish communication and exchange data with the first terminal 110 and / or the second terminal 130 through a wireless network or a wired network.

[0093] Exemplarily, for the virtual object rendering method provided in the embodiments of the present application, taking the execution subject of each step as a computer device as an example for description, the computer device refers to an electronic device with data calculation, processing, and storage capabilities, such as a terminal and / or a server.

[0094] Figure 2 A schematic diagram of a virtual environment 300 provided by an embodiment of the present application is shown.

[0095] There are at least three space blocks in the virtual environment 300: A space block 310, a B space block 320, and a C space block 330; it can be understood that there can be more space blocks in the virtual environment 300. In this embodiment, for the convenience of observation, Figure 2 more space blocks are not shown; further, for the convenience of observation, the virtual objects in the A space block 310 are not shown in this embodiment either.

[0096] The field of view space range 340 is the field of view range for observing a virtual space using a virtual camera. Collision detection is performed on the field of view space range 340 and the above three space blocks, and it is obtained that there is a collision between the field of view space range 340 and the A space block 310 and the B space block 320; there is no collision between the field of view space range 340 and the A space block 310 and the C space block 330. It should be noted that the field of view space range 340 in this embodiment is represented as a frustum of a pyramid, and the frustum of a pyramid is a three-dimensional shape obtained by translating a trapezoid; it can be understood that representing the field of view space range 340 as a frustum of a pyramid is only an exemplary description, and the field of view space range 340 can be implemented as any one of three-dimensional shapes such as a cone, a pyramid, a frustum of a cone, a frustum of a pyramid, a cuboid, etc., or a three-dimensional shape obtained by combining at least one of the above three-dimensional shapes. This embodiment does not make any restrictive regulations on the shape of the field of view space range.

[0097] There are two non-tessellated space sub-blocks in the B space block 320: the A space sub-block 322 and the B space sub-block 324; the A space sub-block 322 contains a first virtual fence, and the B space sub-block 324 contains a first virtual tree. The sizes of the first virtual fence and the first virtual tree are both smaller than the space sub-block. The B space block 320 also contains a virtual house 320a, and the size of the virtual house 320a is larger than the space sub-block.

[0098] There are four non-tessellated space sub-blocks in the C space block 330: the C space sub-block 332, the D space sub-block 334, the E space sub-block 336, and the F space sub-block 338; the C space sub-block 332 contains a virtual bird, the D space sub-block 334 contains a second virtual tree, the E space sub-block 336 contains a second virtual fence, and the F space sub-block 338 contains a third virtual fence. Exemplarily, the virtual objects in the virtual environment 300 are usually static virtual objects, but the situation where there are dynamic virtual objects is not excluded.

[0099] Since there is a collision between the field of view space range 340 and the B space block 320, collision detection is performed on the field of view space range 340 and the A space sub-block 322, and it is obtained that there is a collision between the two, and the first virtual fence in the A space sub-block 322 is rendered.

[0100] Since there is a collision between the field of view space range 340 and the B space block 320, collision detection is performed on the field of view space range 340 and the B space sub-block 324; in this embodiment, there is a collision between the two, and the first virtual tree in the B space sub-block 324 is rendered. In another embodiment, when there is no collision between the two, the first virtual tree in the B space sub-block 324 is determined to be in a hidden state and not rendered.

[0101] Since there is a collision between the viewing space range 340 and the B space block 320, the virtual house 320a in the B space block 320 is rendered.

[0102] Since there is no collision between the viewing space range 340 and the C space block 330, the virtual bird, the second virtual tree, the second virtual fence, and the third virtual fence in the C space block 330 are all determined to be in a hidden state and not rendered. It is not necessary to perform collision detection on any space sub-block in the viewing space range 340 and the C space block 330.

[0103] Next, the rendering method of virtual objects will be introduced through the following embodiments.

[0104] Figure 3 The flowchart of the rendering method of virtual objects provided by an exemplary embodiment of the present application is shown. This method can be executed by a computer device. This method includes:

[0105] Step 510: Perform collision detection on the viewing space range and the space block in the virtual environment;

[0106] Exemplarily, the virtual environment includes at least one space block; the space block is a closed space in the virtual environment, and the shape of the space block can be any one of three-dimensional shapes such as a cube, a cuboid, a polygonal prism, a cylinder, a sphere, etc.; the shapes of different space blocks are usually the same, but different situations are not excluded. Further, the space blocks in the virtual space can be arranged in a close-packed manner or a non-close-packed manner, and this embodiment does not make any restrictive regulations on the arrangement method of the space blocks in the virtual space.

[0107] Further, the space blocks in this embodiment are only used for dividing the virtual environment. When observing the virtual environment through a virtual camera, the space blocks in the virtual environment usually cannot be directly observed. The data of the virtual objects in the same space block can be saved in the same file or in different files, and this embodiment does not make any restrictive regulations on this.

[0108] Exemplarily, by performing collision detection on the viewing space range and the space block in the virtual environment, it is determined whether there is an overlapping area between the viewing space range and the space block through the collision detection. In the case of a collision, there is an overlapping area between the viewing space range and the space block; in the case of no collision, there is no overlapping area between the viewing space range and the space block.

[0109] Step 520: When there is a collision between the viewing space range and the first space block, perform collision detection on the space sub-blocks in the viewing space range and the first space block;

[0110] Exemplarily, the first spatial block is a spatial block that collides with the field of view spatial range, and the number of the first spatial blocks can be one or more. It can be understood that the first spatial blocks are usually partial spatial blocks in the virtual environment, but it does not exclude the case where the first spatial blocks are all the spatial blocks in the virtual environment.

[0111] Exemplarily, the first spatial block includes at least one spatial sub-block; the shape of the spatial sub-block and the shape of the spatial block can be the same or different.

[0112] Step 530: When there is a collision between the field of view spatial range and the first spatial sub-block, render the second virtual object in the first spatial sub-block;

[0113] Exemplarily, the first spatial sub-block is a spatial sub-block that collides with the field of view spatial range, and the number of the first spatial sub-blocks can be one or more.

[0114] The second virtual object in the first spatial sub-block is completely located in the first spatial sub-block, which is also referred to as the first spatial sub-block includes the second virtual object. Exemplarily, perform a rendering process on the second virtual object to display the second virtual object in the virtual environment.

[0115] In summary, the method provided in this embodiment reduces the complexity of determining whether to render a virtual object by performing a collision detection on the field of view spatial range and the spatial blocks in the virtual environment and determining the rendering of the virtual object based on the collision result of the spatial blocks; by performing a secondary collision detection only when there is a collision between the field of view spatial range and the first spatial block, it avoids the problem of a large number of collision detections caused by an increase in the number of second virtual objects, effectively reducing the computational complexity.

[0116] For Figure 3 introduce the field of view spatial range in the illustrated embodiment; Exemplarily, the field of view spatial range is the range observed on the virtual environment through a camera model.

[0117] Optionally, the camera model automatically follows the virtual character in the virtual environment, that is, when the position of the virtual character changes in the virtual environment, the camera model follows the position of the virtual character in the virtual environment and changes simultaneously, and the camera model is always within a preset distance range of the virtual character in the virtual environment. Optionally, during the automatic following process, the relative positions of the camera model and the virtual character do not change.

[0118] A camera model refers to a three-dimensional model located around a virtual character in a virtual environment. When using the first-person perspective, the camera model is near the head of the virtual character or located on the head of the virtual character. When using the third-person perspective, the camera model can be located behind the virtual character and bound to the virtual character, or can be located at any position at a preset distance from the virtual character. Through this camera model, the virtual character in the virtual environment can be observed from different angles. Optionally, when the third-person perspective is an over-the-shoulder perspective of the first-person, the camera model is located behind the virtual character (such as the head and shoulders of the virtual character). Optionally, in addition to the first-person perspective and the third-person perspective, the perspective also includes other perspectives, such as the top-down perspective. When using the top-down perspective, the camera model can be located above the head of the virtual character. The top-down perspective is a perspective for observing the virtual environment from an aerial top-down angle. Optionally, the camera model is not actually displayed in the virtual environment, that is, the camera model is not displayed in the virtual environment displayed on the user interface.

[0119] Taking the example that the camera model is located at any position at a preset distance from the virtual character, optionally, one virtual character corresponds to one camera model, and the camera model can rotate around the virtual character as the rotation center. For example, the camera model is rotated around any point of the virtual character. During the rotation of the camera model, there is not only rotation in terms of angle but also displacement offset. The distance between the camera model and the rotation center remains unchanged during rotation, that is, the camera model rotates on the surface of a sphere with the rotation center as the center of the sphere. Among them, any point of the virtual character can be the head, torso, or any point around the virtual character. The embodiments of the present application do not limit this. Optionally, when the camera model observes the virtual character, the central pointing direction of the perspective of the camera model is the direction from the point on the spherical surface where the camera model is located to the center of the sphere.

[0120] Optionally, the camera model can also observe the virtual character at a preset angle in different directions of the virtual character.

[0121] It should be noted that Figure 3 In the illustrated embodiment, only a two-level spatial structure of spatial blocks and spatial sub-blocks is shown. In one implementation, the virtual environment can be divided into more levels of spatial structure. Taking a three-level spatial structure as an example, the virtual environment includes at least one first-level spatial block, the first-level spatial block includes at least one second-level spatial block, and the second-level spatial block includes at least one third-level spatial block. In the above three-level spatial structure, any two adjacent levels of spatial structure can be referred to as spatial blocks and spatial sub-blocks. For example, for the first-level spatial block and the second-level spatial block, the second-level spatial block is called the spatial sub-block, and the first-level spatial block is called the spatial block.

[0122] Optionally, the position of the spatial sub-block is determined according to the position of the second virtual object. Exemplarily, in different spatial blocks, due to the different positions of the second virtual object, the relative positions of the spatial sub-blocks in the spatial block are also different. Referring to the Figure 2 above, the relative positions of the spatial sub-blocks in different spatial blocks are different. Optionally, the arrangement of the spatial sub-blocks in the spatial block is a non-tessellating arrangement. Exemplarily, there is at least a gap space between at least two adjacent spatial sub-blocks, and there is at least one spatial point in the spatial block that does not belong to any spatial sub-block. Referring to the Figure 2 spatial blocks shown above, the arrangement of the spatial sub-blocks is a non-tessellating arrangement.

[0123] Exemplarily, taking the three-layer spatial structure above as an example, the spatial blocks and virtual objects in the virtual environment are introduced.

[0124] Figure 4 FIG. shows a schematic diagram of a spatial block provided by an embodiment of the present application. Exemplarily, the first-level spatial block 602 includes a virtual house 602a. The dotted line on the periphery of the virtual house 602a in the figure is used to indicate the size of the virtual house. For the convenience of observation, Figure 4 the shown schematic diagram is a front view of the spatial block.

[0125] Figure 5 FIG. shows a schematic diagram of a spatial block provided by an embodiment of the present application. Exemplarily, the first-level spatial block 612 includes a second-level spatial block 614, and the second-level spatial block 614 includes a virtual tree 614a; it can be understood that the size of the virtual tree 614a is smaller than the size of the second-level spatial block 614.

[0126] Figure 6 FIG. shows a schematic diagram of a spatial block provided by an embodiment of the present application. Exemplarily, the first-level spatial block 622 includes a second-level spatial block 624, and the second-level spatial block 624 includes a third-level spatial block 626; the third-level spatial block 626 includes a virtual grassland 626a; it can be understood that the size of the virtual grassland 626a is smaller than the size of the third-level spatial block 626.

[0127] It should be noted that in the above three-layer spatial structure, the sizes of the first-level spatial block, the second-level spatial block, and the third-level spatial block decrease. For example, the side length of the first-level spatial block is 1024 meters, the side length of the second-level spatial block is 128 meters, and the side length of the third-level spatial block is 16 meters. Similarly, the virtual objects in the spatial block are classified into large objects, medium objects, and small objects according to their sizes. For example: the side length of a large object is greater than 64 meters, the side length of a medium object is less than or equal to 64 meters and greater than 8 meters. The side length of a small object is less than or equal to 8 meters.

[0128] Optionally, for any two adjacent levels of spatial structures, the spatial block contains a first virtual object and a second virtual object, and the spatial sub-block only contains the second virtual object. The size of the first virtual object is greater than the size threshold corresponding to the spatial block; the size of the second virtual object is less than or equal to the size threshold corresponding to the spatial block; the size threshold can be the size of the spatial sub-block or independent of the size of the spatial sub-block. Taking the spatial block as the first-level spatial block in the above text as an example, the first virtual object is Figure 5 the virtual house shown in Figure 6 The second virtual object is the virtual tree shown in

[0129] In one implementation, the number of virtual objects in the spatial block and the spatial sub-block can be one or more. There is a corresponding relationship between the size threshold and the spatial block, but it does not limit that the size is determined based on the size of the spatial block; for example: the size threshold can be preset and independent of the size of the spatial block. The size threshold can also be the product of the size of the spatial block and a proportionality coefficient, that is, the size threshold is determined based on the size of the spatial block. For any two adjacent levels of spatial structures, the size of the spatial sub-block is usually the same, and the size threshold corresponding to the spatial block is usually the same, but different situations are not excluded.

[0130] Figure 7 The flowchart of the rendering method of the virtual object provided by an exemplary embodiment of the present application is shown. This method can be executed by a computer device. That is, on the basis of the embodiment shown in Figure 3 it further includes step 542:

[0131] Step 542: When there is a collision between the field of view space range and the first spatial block, render the first virtual object in the first spatial block;

[0132] Exemplarily, the first spatial block is the spatial block that collides with the field of view space range, and the first virtual object is the object in the first spatial block; there is a corresponding relationship between the first virtual object and the first spatial block. Further, the size of the first virtual object is greater than the size threshold corresponding to the spatial block, and the first virtual object only exists in the first spatial block with the corresponding relationship, but there is no corresponding relationship between any spatial sub-block in the first spatial block and the first virtual object. It should be noted that this embodiment only limits that there is no corresponding relationship between the first virtual object and the spatial sub-block, but it does not mean that there is no overlapping area between the first virtual object and the spatial sub-block. That is, there may or may not be an overlapping area between the first virtual object and the spatial sub-block.

[0133] Exemplarily, in the case of a collision between the field of view space range and the first spatial block in this embodiment, the first virtual object in the first spatial block is rendered; that is, the rendering of the first virtual object does not require collision detection between the field of view space range and the spatial sub-blocks. Regardless of whether there is a collision between the field of view space range and the spatial sub-blocks, the first virtual object is rendered.

[0134] In summary, the method provided in this embodiment reduces the complexity of determining whether to render a virtual object by performing collision detection on the field of view space range and spatial blocks in the virtual environment and determining the rendering of the virtual object based on the collision results of the spatial blocks; by rendering the first virtual object in the case of a collision between the field of view space range and the first spatial block, it avoids repeated collision detection for the first virtual object.

[0135] Figure 8 The flowchart of the method for rendering a virtual object provided by an exemplary embodiment of the present application is shown. This method can be executed by a computer device. That is, Figure 3 Based on the shown embodiment, it further includes step 544:

[0136] Step 544: When there is no collision between the field of view space range and the second spatial block, determine the first virtual object and / or the second virtual object in the second spatial block as a hidden state;

[0137] Exemplarily, the second spatial block is a spatial block that has no collision with the field of view space range, and the number of second spatial blocks can be one or more. At least one second spatial block includes a first virtual object and / or a second object, the size of the first virtual object is greater than the size threshold corresponding to the spatial block; the size of the second virtual object is less than or equal to the size threshold;

[0138] It should be noted that when there is no collision between the field of view space range and the second spatial block, there is no need to perform collision detection between the spatial sub-blocks in the second spatial block and the field of view space range, and directly determine all the virtual objects in the second spatial block, that is, the first virtual object and / or the second virtual object, as a hidden state. It should be further noted that the first virtual object and / or the second virtual object are all the virtual objects in the second spatial block. For example: when only the first virtual object exists in the second spatial block, the first virtual object is determined as a hidden state; when only the second virtual object exists in the second spatial block, the second virtual object is determined as a hidden state.

[0139] In summary, the method provided in this embodiment reduces the complexity of determining whether to render a virtual object by performing collision detection on the visual field space range and spatial blocks in the virtual environment and determining the rendering of the virtual object based on the collision results of the spatial blocks. By rendering the first virtual object when there is a collision between the visual field space range and the first spatial block, repeated collision detection for the first virtual object is avoided.

[0140] Figure 9 The flowchart of the method for rendering a virtual object provided by an embodiment of the present application is shown. This method can be executed by a computer device.

[0141] Step 602: Change the visual field space range;

[0142] Change the visual field space range of observing the virtual environment through the camera by at least one of moving the camera position, changing the camera height, and adjusting the camera angle.

[0143] Step 604: Determine whether there is a collision between the space of the large-size data block and the visual field space range;

[0144] The large-size data block corresponds to a space in the virtual environment. By performing collision detection on the visual field space range in the virtual environment and the space of the large-size data block, it is determined whether a collision occurs. Exemplarily, if the determination result is yes, step 610 is executed; otherwise, step 606 is executed.

[0145] Step 606: Determine whether the display state of the large-size data block has changed;

[0146] Exemplarily, in the case where there is no collision between the space of the large-size data block and the visual field space range, it is determined whether the display state of the large-size data block has changed.

[0147] The change in the display state is used to indicate that the display state of the large-size data block is different before and after the change of the visual field space range.

[0148] Exemplarily, if the determination result is yes, step 608 is executed; otherwise, no processing is performed on the first virtual object.

[0149] Step 608: Determine that the first virtual object is in a hidden state;

[0150] Exemplarily, in the case where the display state of the large-size data block has changed, it is determined that the first virtual object is in a hidden state. The first virtual object is all the virtual objects in the large-size data block.

[0151] Step 610: Determine whether there is a collision between the space of the medium-size data block and the visual field space range;

[0152] Exemplarily, in the case where there is a collision between the space of the large-sized data block and the field of view space range, it is determined whether there is a collision between the space of the medium-sized data block and the field of view space range.

[0153] The medium-sized data block corresponds to a space in the virtual environment. By performing a collision detection on the field of view space range in the virtual environment and the space of the medium-sized data block, it is determined whether a collision occurs. Exemplarily, if the determination result is yes, step 616 is executed; otherwise, step 612 is executed.

[0154] Step 612: Determine whether the display state of the medium-sized data block has changed;

[0155] Exemplarily, in the case where there is no collision between the space of the medium-sized data block and the field of view space range, it is determined whether the display state of the medium-sized data block has changed.

[0156] The change in the display state is used to indicate that the display state of the medium-sized data block is different before and after the change of the field of view space range.

[0157] Exemplarily, if the determination result is yes, step 614 is executed; otherwise, no processing is performed on virtual object two.

[0158] Step 614: Determine that virtual object two is in a hidden state;

[0159] Exemplarily, in the case where the display state of the medium-sized data block has changed, it is determined that virtual object two is in a hidden state. Virtual object two is all the virtual objects in the medium-sized data block.

[0160] Step 616: Determine whether there is a collision between the space of the small-sized data block and the field of view space range;

[0161] Exemplarily, in the case where there is a collision between the space of the medium-sized data block and the field of view space range, it is determined whether there is a collision between the space of the small-sized data block and the field of view space range.

[0162] The small-sized data block corresponds to a space in the virtual environment. By performing a collision detection on the field of view space range in the virtual environment and the space of the small-sized data block, it is determined whether a collision occurs. Exemplarily, if the determination result is yes, step 620 is executed; otherwise, step 618 is executed.

[0163] Step 618: Determine that virtual object three is in a hidden state;

[0164] Exemplarily, in the case where there is no collision between the space of the small-sized data block and the field of view space range, it is determined that virtual object three is in a hidden state. Virtual object three is the virtual object in the small-sized data block, and the size of virtual object three is less than or equal to the size of the small-sized data block.

[0165] Step 620: Determine that the virtual object three is in the display state and render the virtual object three.

[0166] Exemplarily, in the case where there is a collision between the space of the small-sized data block and the view space range, determine that the virtual object three is in the display state and render the virtual object three.

[0167] Exemplarily, in the case where the number of virtual objects three exceeds the quantity threshold or reusable resources are adopted, render in the way of GPU instantiation (gpuinstance); in the case where the number of virtual objects three does not exceed the quantity threshold or non-reusable resources are adopted, render in the way of game object (gameobject). The quantity threshold is preset.

[0168] In summary, the method provided in this embodiment reduces the complexity of determining whether to render a virtual object by performing collision detection on the view space range and the space block in the virtual environment and determining to render the virtual object based on the collision result of the space block; by performing secondary collision detection only when there is a collision between the view space range and the first space block, it avoids the problem of a large number of collision detections caused by an increase in the number of second virtual objects, effectively reducing the computational complexity.

[0169] Figure 10 The flowchart of the rendering method of the virtual object provided by an exemplary embodiment of the present application is shown. This method can be executed by a computer device. That is, in Figure 3 In the shown embodiment, step 530 can be implemented as step 531, step 532, step 533, and step 534:

[0170] Step 531: When there is a collision between the view space range and the first space sub-block and the memory space is not allocated, determine the number of second virtual objects in the first space sub-block.

[0171] Exemplarily, the memory space is used to process the parameter matrix of the second virtual object. In one example, the situation of not allocating the memory space usually occurs when first entering the virtual environment or switching to a new virtual environment, but other scenarios where the memory space is not allocated are not excluded.

[0172] Step 532: Allocate the memory space according to the number of second virtual objects.

[0173] Exemplarily, each second virtual object corresponds to a parameter matrix. Determine the size of the space required to process the parameter matrix according to the number of second virtual objects, and the allocated memory space is greater than or equal to the size of the space required to process the parameter matrix.

[0174] Step 533: Set parameter information and index information for the parameter matrix of the second virtual object based on the memory space;

[0175] Exemplarily, the parameter matrix includes parameter information and index information. The parameter information is used to indicate the object form of the second virtual object in the virtual environment, such as at least one of the coordinate position, rotation angle, and scaling ratio of the second virtual object in the virtual environment. The index information is used to indicate the index relationship between the second virtual object and the first space sub-block; further, the index information is also used to indicate the relationship between at least one of the space block and the space sub-block and the second virtual object; in the case where there is a multi-level space structure in the virtual environment, such as the three-level space structure shown above, the index information can be the index relationship between more-level space blocks and the second virtual object. Exemplarily, setting the parameter matrix converts transform data into Matri4x4 data.

[0176] Step 534: Render the second virtual object based on the parameter matrix of the second virtual object;

[0177] Exemplarily, perform a rendering process on the second virtual object according to the parameter information and index information in the parameter matrix of the second virtual object, and display the second virtual object in the virtual environment.

[0178] In summary, the method provided in this embodiment improves the way of rendering the second virtual object by allocating memory space to set the parameter matrix of the second virtual object; by performing secondary collision detection only when there is a collision between the field of view space range and the first space block, it avoids the problem of a large number of collision detections caused by an increase in the number of second virtual objects, and effectively reduces the computational complexity.

[0179] Figure 11 The flowchart of the rendering method of the virtual object provided by an exemplary embodiment of the present application is shown. This method can be executed by a computer device. That is, in Figure 3 the embodiment shown, step 530 can be implemented as step 536 and step 538:

[0180] Step 536: When there is a collision between the field of view space range and the first space sub-block and the memory space has been allocated, add the second virtual object in the second space block to the display list of the memory space;

[0181] Exemplarily, the memory space is a memory space for processing the parameter matrix of the second virtual object. In one example, the situation where the memory space has been allocated usually occurs after displaying the image of the observed virtual environment, but other scenarios where the memory space is not allocated are not excluded. Exemplarily, in this embodiment, the allocated memory space is used for rendering processing, and there is no need to re-allocate the memory space every time rendering is performed.

[0182] Optionally, in an alternative design of this embodiment, the following steps are further included:

[0183] In the case where there is no collision between the field of view space range and the second spatial sub-block, add the second virtual object in the second spatial sub-block to the hidden list;

[0184] Determine the second virtual object in the hidden list as the hidden state.

[0185] Exemplarily, the second spatial sub-block is a spatial sub-block in the first spatial block that has no collision with the field of view space range, and the number of second spatial sub-blocks can be one or more. It can be understood that the second spatial sub-block can be part or all of the spatial sub-blocks in the first spatial block. Since there is no collision between the field of view space range and the second spatial sub-block, there is no need to render the objects in the second spatial sub-block. Add the second virtual object in the second spatial sub-block to the hidden list, and determine the second virtual object in the hidden list as the hidden state. Similar to the display list, the hidden list is a list in the memory space. In one implementation, the display list and the hidden list are in the same queue; among them, adjust the position of the display list to before the hidden list. Determine the number of second virtual objects in the display list as i, and the first i virtual objects in the above queue are the objects in the display list for rendering processing. The objects after the i-th virtual object in the queue are the objects in the hidden list and are determined as the hidden state.

[0186] Optionally, in another alternative design of this embodiment, the following steps are further included:

[0187] In the case where the second virtual object has a shadow, add a shadow drawing identifier to the second virtual object and add the second virtual object to the shadow list;

[0188] Based on the parameter matrix of the second virtual object, render the second virtual object and the shadow of the second virtual object in the shadow list.

[0189] Exemplarily, the second virtual objects with shadows are some or all of the second virtual objects in the display list. Add the second virtual objects with shadows to the shadow list. In one implementation, the display list and the shadow list are in the same queue; wherein, the shadow list is adjusted to be before the display list. First, draw the second virtual objects with shadows, and draw the shadows in a separate texture map. The shadows do not need to be drawn repeatedly. Exemplarily, the second virtual objects need to be drawn and rendered every frame. Drawing the shadows in a separate texture map avoids rendering the shadows multiple times.

[0190] Step 538: Render the second virtual objects in the display list based on the parameter matrix of the second virtual objects.

[0191] Exemplarily, perform rendering processing on the second virtual objects according to the parameter information and index information in the parameter matrix of the second virtual objects, and display the second virtual objects in the virtual environment. The display list includes the second virtual objects that need to be rendered.

[0192] In summary, the method provided in this embodiment sets the parameter matrix of the second virtual objects by using the already allocated memory space, expands the way of rendering the second virtual objects, and realizes the incremental refresh of the parameter matrix; by performing secondary collision detection only when there is a collision between the field of view space range and the first spatial block, it avoids the problem of a large number of collision detections caused by the increase in the number of second virtual objects, and effectively reduces the computational complexity.

[0193] Next, introduce the parameter matrix of the second virtual objects:

[0194] In an example, the data structure of the parameter matrix of the second virtual objects at least includes:

[0195]

[0196]

[0197] It should be noted that gpuinstance supports a maximum of 1023. In the case of exceeding 1023, it is necessary to call DrawMeshInstanced again for drawing to achieve rendering. Use a two-dimensional array of matrices. The first dimension records the batches that need to be rendered, and the second dimension records the number of matrices that need to be processed in the current batch.

[0198] Next, introduce the preprocessing content in the process of rendering the shadows of virtual objects through an embodiment.

[0199] Figure 12The flowchart of the rendering method of the virtual object provided by an embodiment of the present application is shown. This method can be executed by a computer device.

[0200] Step 902: Determine whether the virtual object needs to draw a shadow;

[0201] Exemplarily, determine whether the virtual object needs to draw a shadow according to at least one of the following bases: the position of the virtual object in the virtual environment, the lighting information in the virtual environment, and the rendering settings of the virtual environment.

[0202] The shadow is generated when the virtual object is irradiated by the light in the virtual environment. The shadow of the virtual object is usually displayed on or around the virtual object.

[0203] Step 904: Add a shadow drawing identifier to the virtual object;

[0204] Exemplarily, in the case where the virtual object needs to draw a shadow, add a shadow identifier to the virtual object. For example, the shadow identifier is true (needDrawShadow).

[0205] Step 906: Determine the number of virtual objects that need to draw shadows;

[0206] Exemplarily, when adding the shadow identifier, increment the number of virtual objects that need to draw shadows by one and count the number of virtual objects that need to draw shadows.

[0207] Step 908: Add the virtual objects that need to draw shadows to the shadow list;

[0208] Exemplarily, the shadow list is lsShadowModel. Exemplarily, each step in this embodiment is executed before refreshing the parameter matrix of the virtual object and is the content before performing the shadow rendering of the virtual object. Among them, the position of the shadow list is adjusted to before the display list. The number of virtual objects that need to draw shadows is j, and the first j virtual objects in the queue including the shadow list are the objects in the shadow list, and rendering processing is performed to render the virtual object and the shadow of the virtual object.

[0209] In summary, the method provided by this embodiment differentiates the virtual objects with shadows through the shadow list, and by first performing rendering processing on the virtual objects with shadows, it avoids the repeated drawing of shadows.

[0210] Figure 13 The flowchart of the rendering method of the virtual object provided by an exemplary embodiment of the present application is shown. This method can be executed by a computer device. That is, on the basis of the embodiment shown, it further includes steps 537a to 537d: Figure 11 On the basis of the embodiment shown, it further includes steps 537a to 537d:

[0211] Step 537a: When there is no memory overflow, set parameter information and index information for the parameter matrix of the second virtual object.

[0212] It should be noted that in Figure 11 the illustrated embodiment, the second virtual object can be a virtual object for which the parameter matrix has been set, or a virtual object for which the parameter matrix has not been set; in this embodiment, the process of setting the parameter matrix for the virtual object for which the parameter matrix has not been set is introduced.

[0213] Exemplarily, since the second virtual object is added to the display list, it is necessary to determine whether there is a memory overflow in the memory space of the display list. When there is no overflow, the matrix parameters of the second virtual object are directly set. Among them, the parameter matrix of the second virtual object includes parameter information and index information.

[0214] Step 537b: When there is a memory overflow, add the second virtual object to the list to be processed, and allocate new memory space.

[0215] Exemplarily, when there is an overflow, new memory space needs to be allocated. Since there is a memory overflow, the second virtual object needs to be added to the list to be processed, and the matrix parameters are set in the new memory space. Exemplarily, since only the identification information of the second virtual object needs to be determined in the list to be processed, and the matrix parameters do not need to be set, the space occupied by the identification information is small and there will be no overflow. In another implementation, the list to be processed does not belong to the memory space and will not cause an overflow.

[0216] Step 537c: In the new memory space, reuse the list to be processed and the display list.

[0217] Based on the new memory space, reuse the list to be processed and the display list, that is, all data in the list to be processed and the display list can be obtained in the new memory space.

[0218] Step 537d: Set parameter information and index information for the parameter matrix of the second virtual object in the list to be processed.

[0219] Exemplarily, after allocating new memory space, based on the new memory space, set the parameter matrix of the second virtual object in the list to be processed.

[0220] Exemplarily, the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block. For a detailed introduction to the parameter information and index information, please refer to the parameter matrix of the second virtual object in the above text, which will not be elaborated in this embodiment.

[0221] In summary, for the method provided in this embodiment, by using the already allocated memory space to set the parameter matrix of the second virtual object, the rendering method for the second virtual object is expanded, and incremental refreshing of the parameter matrix is achieved; reasonable technical solutions are provided for both the case where the already allocated memory space overflows and the case where it does not, and the setting method of the parameter matrix is improved.

[0222] Figure 14 The flowchart of the rendering method for the virtual object provided by an embodiment of the present application is shown. This method can be executed by a computer device.

[0223] Step 622: Determine whether it is the first matrix refresh;

[0224] Exemplarily, the situation of the first matrix refresh usually occurs when first entering the virtual environment or switching to a new virtual environment. Exemplarily, in the case of the first matrix refresh, no memory space is allocated for parameter matrix processing. Exemplarily, if the determination result is yes, execute step 624; otherwise, execute step 630.

[0225] Step 624: Determine whether the virtual object is in a display state;

[0226] Exemplarily, in the case of the first matrix refresh, determine whether the virtual object is in a display state; when there is a collision between the space block where the virtual object is located and the field of view space range, the virtual object is in a display state; otherwise, it is not in a display state. Exemplarily, if the determination result is yes, execute step 626; otherwise, no processing is performed on the virtual object.

[0227] Step 626: Increase the display quantity of the virtual object;

[0228] Exemplarily, when the virtual object is in a display state, increase the display quantity of the virtual object; by increasing the display quantity of the virtual object, the quantity of virtual objects in the display state is statistically determined.

[0229] Step 628: Create a memory space according to the display quantity of the virtual object, and execute a full matrix refresh;

[0230] Based on the display quantity of the virtual object, the created memory space is larger than the size of the parameter matrix of the virtual object in the display state. By executing a full matrix refresh, the parameter matrix of the virtual object is set, and the virtual object in the display state is rendered.

[0231] Step 630: Determine whether the virtual object is in a display state;

[0232] Exemplarily, in the case where it is not the first time to refresh the matrix, it is determined whether the virtual object is in the display state. Exemplarily, if the determination result is yes, step 636 is executed; otherwise, step 632 is executed.

[0233] Step 632: Determine whether the virtual object has completed initialization;

[0234] Exemplarily, in the case where the virtual object is not in the display state, it is determined whether the virtual object has completed initialization; Exemplarily, the initialization of the virtual object includes setting parameter information and index information for the parameter matrix of the virtual object. Exemplarily, if the determination result is yes, step 634 is executed; otherwise, no processing is performed on the virtual object.

[0235] Step 634: Add to the hidden list;

[0236] Exemplarily, in the case where the virtual object has completed initialization, the virtual object is added to the hidden list, and the virtual object in the hidden list is determined to be in the hidden state and no rendering process is performed.

[0237] Optionally, for a virtual object that has not completed initialization, no processing is performed. Since the virtual object has not completed initialization and the parameter matrix has not been set, the virtual object cannot be rendered.

[0238] Step 636: Add to the display list;

[0239] Exemplarily, in the case where the virtual object is in the display state, the virtual object is added to the display list; the virtual object in the display list needs to be rendered.

[0240] Step 638: Determine whether the virtual object has completed initialization;

[0241] Exemplarily, the initialization of the virtual object includes setting parameter information and index information for the parameter matrix of the virtual object. Exemplarily, if the determination result is no, step 640 is executed; otherwise, no processing is performed on the virtual object.

[0242] Step 640: Determine whether the memory space overflows;

[0243] Exemplarily, since in the case where it is not the first time to refresh the matrix, based on the already allocated memory space, matrix parameter settings are performed, it is necessary to determine whether the internal memory space overflows. Exemplarily, if the determination result is yes, step 642 is executed; otherwise, step 644 is executed.

[0244] Step 642: Add to the list to be initialized;

[0245] Exemplarily, in the case where the memory space overflows, the virtual object that has not completed initialization is added to the list to be initialized.

[0246] Step 644: Perform object initialization;

[0247] Exemplarily, in the case of no memory space overflow, perform object initialization on the objects in the display list that have not been initialized, and set parameter information and index information for the parameter matrix of the virtual object.

[0248] Exemplarily, the content shown in this embodiment is an embodiment executed at the beginning of a frame.

[0249] In summary, the method provided in this embodiment improves the implementation method of object initialization, provides technical solutions for both the case of memory space overflow and non-overflow, improves the setting method of the parameter matrix, and lays a foundation for the rendering of virtual objects.

[0250] Figure 15 The flowchart of the rendering method of the virtual object provided by an embodiment of the present application is shown. This method can be executed by a computer device.

[0251] Step 652: Determine whether the memory space overflows;

[0252] Exemplarily, the content shown in this embodiment is an embodiment executed at the end of a frame;

[0253] Exemplarily, since the already allocated memory space is utilized, it is necessary to determine whether the already allocated memory space overflows. Exemplarily, if the determination result is yes, execute step 654; otherwise, execute step 660.

[0254] Step 654: Create a new memory space according to the display quantity of the virtual object;

[0255] Exemplarily, in the case of memory space overflow, create a new memory space according to the display quantity of the virtual object statistically obtained in the above embodiment.

[0256] Step 656: Reuse the matrix in the new memory space;

[0257] Exemplarily, reuse the parameter matrix of the virtual object in the display list in the new memory space.

[0258] Step 658: Perform initialization on the virtual objects in the uninitialized list;

[0259] Exemplarily, perform initialization processing on the virtual objects in the to-be-processed list obtained in the above embodiment.

[0260] Step 660: Calculate the minimum value of the number of virtual objects in the display list and the hidden list;

[0261] Exemplarily, this embodiment only exemplarily shows a way to swap the positions of the display list and the hidden list. In another implementation, there may be other implementation ways to adjust the positions of the virtual objects in the display list before the hidden list.

[0262] Step 662: Perform swapping on the first a virtual objects in the display list and the hidden list;

[0263] Exemplarily, a is the minimum value of the number of virtual objects in the display list and the hidden list; by performing swapping on the first a virtual objects in the display list and the hidden list, the positions of the virtual objects in the display list are adjusted before the hidden list.

[0264] Step 664: Determine whether the number of objects in the display list is greater than the hidden list;

[0265] Exemplarily, by determining whether the number of objects in the display list is greater than the hidden list, it is determined whether the virtual objects that have not changed positions after the a virtual objects are swapped are the virtual objects in the display list or the virtual objects in the hidden list. Exemplarily, if the determination result is yes, execute Step 666; otherwise, execute Step 668.

[0266] Step 666: Insert the virtual object at the tail of the display list before the hidden list;

[0267] Exemplarily, when the number of objects in the display list is greater than the hidden list, insert the virtual object at the tail of the display list before the hidden list. It can be understood that the objects that have not changed positions are the objects in the display list, and the virtual object at the tail of the display list is the object after the a-th virtual object, and insert the virtual object at the tail before the hidden list.

[0268] Step 668: Adjust the virtual object at the tail of the hidden list to the end of the queue;

[0269] Exemplarily, when the number of objects in the display list is less than or equal to the hidden list, adjust the virtual object at the tail of the hidden list to the end of the queue. It can be understood that the objects that have not changed positions are the objects in the hidden list, and the virtual object at the tail of the hidden list is the object after the a-th virtual object, and adjust the virtual object at the tail of the hidden list to the end of the queue.

[0270] Step 670: Clear the display list, the hidden list, and the list to be processed;

[0271] Delete the data in the display list, the hidden list, and the list to be processed.

[0272] Step 672: Execute the incremental refresh matrix;

[0273] Render the virtual objects located in the display list by performing an incremental refresh matrix.

[0274] In summary, the method provided in this embodiment provides a technical solution for creating a new memory space in the case of overflowing memory space, sets the parameter matrix in the new memory space, and lays a foundation for the rendering of virtual objects.

[0275] Figure 16 The flowchart of the rendering method of virtual objects provided by an exemplary embodiment of the present application is shown. This method can be executed by a computer device. That is, Figure 3 On the basis of the shown embodiment, it further includes step 502 and step 504:

[0276] Step 502: Determine the loading space range in the virtual environment with the field of view space range as the center;

[0277] Exemplarily, the distance between any space point in the loading space range and the field of view space range is less than the first distance threshold; in one implementation, the shape of the loading space range is the same as that of the field of view space range. It should be noted that the field of view space range is usually the central area of the loading space range, but it does not exclude the case where the loading space range includes the field of view space range, but the field of view space range is not the central area of the loading space range.

[0278] Step 504: Perform a loading process on the loading space block in the memory space;

[0279] Exemplarily, the loading space block is a space block that overlaps with the loading space range; by performing a loading process on the loading space block, the construction of the virtual environment is realized.

[0280] Exemplarily, the loading process of the loading space block is completed by reading the data of the loading space block from the storage space to the memory space.

[0281] In an alternative design of this embodiment, the following steps are further included:

[0282] Based on the field of view space range, determine the clearing space range in the virtual environment, and the distance between any space point in the clearing space range and the field of view space range is greater than the second distance threshold;

[0283] Perform a deletion process on the clearing space block in the memory space, and the clearing space block is a space block that overlaps with the clearing space range and does not overlap with the loading space range.

[0284] Exemplarily, the clearing space block and the loading space block are different space blocks. Exemplarily, the clearing space range does not include the loading space range; the clearing space range and the loading space range may be adjacent or non - adjacent. Exemplarily, the processing of the clearing space block is completed by deleting the data of the clearing space block in the memory space.

[0285] In another alternative design of this embodiment, the following steps are further included:

[0286] Based on the field - of - view space range, determine a cache space range in the virtual environment, and the distance between any space point in the cache space range and the field - of - view space range is greater than a third distance threshold;

[0287] Establish a cache for the cache space block, where the cache space block is a space block that overlaps with the cache space range and does not overlap with the loading space range.

[0288] Exemplarily, the cache space block and the loading space block are different space blocks. Exemplarily, the cache space range does not include the loading space range; the cache space range and the loading space range may be adjacent or non - adjacent. Exemplarily, the processing of the cache space block is completed by establishing a cache for the data of the cache space block in the memory space.

[0289] It should be noted that, in one implementation, there are a loading space range, a cache space range, and a clearing space range in the virtual environment at the same time; among them, the second distance threshold is greater than the third distance threshold.

[0290] In summary, the method provided in this embodiment, by determining the loading space range and loading the data of the loading space block in the memory space, the technical solution of pre - loading avoids the time delay caused by performing loading during the rendering process of virtual objects, effectively reduces the computational complexity, and saves the time required for rendering virtual objects.

[0291] Figure 17 Shows a schematic diagram of a virtual environment provided by an embodiment of the present application.

[0292] For ease of observation, Figure 17 The schematic diagram of the virtual environment shown is a top - view observation diagram.

[0293] There are at least fifty - six space blocks 402 in the virtual environment, as Figure 17 shown, the arrangement of the fifty - six space blocks 402 in the virtual space is 7 rows and 8 columns;

[0294] With the field of view space range 404 as the center, the loading space range 406 is determined in the virtual environment; it should be noted that, in the present embodiment, the field of view space range 404 and the loading space range 406 are both cuboids, and the projection when viewed from a top perspective is a rectangle. In other embodiments, the field of view space range 404 may be other shapes such as a truncated pyramid or a cone, and the present embodiment does not make any restrictive provisions on this.

[0295] In the virtual environment, the space block 402 that overlaps with the loading space range 406 is determined as the loading space block, and the loading space block is loaded in the memory. In this embodiment, the loading space block includes twelve space blocks 402, specifically: from the third row to the fifth row from top to bottom, the third to the sixth space blocks 402 from the left of each row.

[0296] Based on the field of view space range 404, the cache space range and the clear space range are determined; illustratively, the cache space range is the annular closed area enclosed between the loading space range 406 and the first boundary line 408, and the clear space range is the annular closed area enclosed between the first boundary line 408 and the second boundary line 410.

[0297] The cache space block is determined according to the cache space range, and a cache is established for the cache space block; in the present embodiment, the cache space block includes eighteen space blocks 402, specifically: the second to seventh space blocks 402 from the left of each row in the second row and the sixth row from top to bottom; and the second to sixth space blocks 402 from the top of each column in the second column and the seventh row from left to right.

[0298] The cleared space blocks are determined according to the cleared space range, and the cleared space blocks are deleted in the memory. In this embodiment, the cache space blocks include twenty-six space blocks 402, specifically: all space blocks 402 in the first row and the seventh row from top to bottom; and all space blocks 402 in the first column and the eighth row from left to right.

[0299] Figure 18 A flowchart of a method for rendering a virtual object provided by an exemplary embodiment of the present application is shown. The method can be executed by a computer device. Figure 3 In the illustrated embodiment, step 510 may be implemented as step 510a, and step 520 may be implemented as step 520a:

[0300] Step 510a: performing collision detection on the field of view projection and the space block projection;

[0301] Exemplarily, in this embodiment, collision detection is performed based on projection on a two-dimensional plane.

[0302] Exemplarily, the field of view projection is the projection of the field of view space range on the horizontal plane of the virtual environment, and the spatial block projection is the projection of the spatial block on the horizontal plane of the virtual environment; Exemplarily, collision detection is performed on the field of view projection and the spatial block projection by determining whether there is an overlapping area between the field of view projection and the spatial block projection.

[0303] Step 520a: When there is a collision between the field of view projection and the first spatial block projection, perform collision detection on the field of view projection and the spatial sub-block projection;

[0304] Exemplarily, the spatial sub-block projection is the projection of the spatial sub-block on the horizontal plane of the virtual environment. Similarly, collision detection is performed on the field of view projection and the spatial sub-block projection by determining whether there is an overlapping area between the field of view projection and the spatial sub-block projection.

[0305] In summary, the method provided in this embodiment performs collision detection through projections on a two-dimensional horizontal plane, simplifies the collision detection in three-dimensional space to two-dimensional space, effectively reduces the computational complexity, and saves the time required for performing collision detection.

[0306] Those of ordinary skill in the art can understand that the above embodiments can be implemented independently, or the above embodiments can be freely combined to form new embodiments to implement the virtual object rendering method of the present application.

[0307] Figure 19 The block diagram of a virtual object rendering device provided by an exemplary embodiment of this embodiment is shown. The device includes:

[0308] A detection module 810, configured to perform collision detection on the field of view space range and spatial blocks in the virtual environment, where the virtual environment includes at least one of the spatial blocks;

[0309] The detection module 810 is further configured to, when there is a collision between the field of view space range and the first spatial block, perform collision detection on the spatial sub-blocks in the field of view space range and the first spatial block, where the first spatial block includes at least one of the spatial sub-blocks;

[0310] A rendering module 820, configured to render a second virtual object in the first spatial sub-block when there is a collision between the field of view space range and the first spatial sub-block.

[0311] In an alternative design of this embodiment, the position of the spatial sub-block is determined according to the position of the second virtual object, and the arrangement of the spatial sub-blocks in the first spatial block is a non-tessellated arrangement.

[0312] In an alternative design of this embodiment, the first spatial block contains a first virtual object and the second virtual object, and the spatial sub-block contains the second virtual object;

[0313] Wherein, the size of the first virtual object is greater than the size threshold corresponding to the spatial block; the size of the second virtual object is less than or equal to the size threshold.

[0314] In an alternative design of this embodiment, the rendering module 820 is further configured to:

[0315] When there is a collision between the field of view space range and the first spatial block, render the first virtual object in the first spatial block.

[0316] In an alternative design of this embodiment, the apparatus further includes:

[0317] A determination module 830, configured to determine the first virtual object and / or the second virtual object in the second spatial block as a hidden state when there is no collision between the field of view space range and the second spatial block.

[0318] In an alternative design of this embodiment, the rendering module 820 is further configured to:

[0319] When there is a collision between the field of view space range and the first spatial sub-block and no memory space is allocated, determine the number of the second virtual objects in the first spatial sub-block;

[0320] Allocate the memory space according to the number of the second virtual objects;

[0321] Based on the memory space, set parameter information and index information for the parameter matrix of the second virtual object, where the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block;

[0322] Render the second virtual object based on the parameter matrix of the second virtual object.

[0323] In an alternative design of this embodiment, the rendering module 820 is further configured to:

[0324] When there is a collision between the field of view space range and the first spatial sub-block and the memory space has been allocated, add the second virtual object in the second spatial block to the display list of the memory space;

[0325] Render the second virtual object in the display list based on the parameter matrix of the second virtual object.

[0326] In an alternative design of this embodiment, the device further includes:

[0327] A processing module 840, configured to set parameter information and index information for the parameter matrix of the second virtual object when there is no overflow in the memory space;

[0328] The processing module 840 is further configured to add the second virtual object to a list of objects to be processed and allocate new memory space when there is an overflow in the memory space;

[0329] The processing module 840 is further configured to reuse the list of objects to be processed and the display list in the new memory space;

[0330] The processing module 840 is further configured to set parameter information and index information for the parameter matrix of the second virtual object in the list of objects to be processed;

[0331] Wherein, the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block.

[0332] In an alternative design of this embodiment, the device further includes:

[0333] A processing module 840, configured to add the second virtual object in the second spatial sub-block to a hidden list when there is no collision between the field of view space range and the second spatial sub-block;

[0334] The processing module 840 is further configured to determine the second virtual object in the hidden list as a hidden state.

[0335] In an alternative design of this embodiment, the rendering module 820 is further configured to:

[0336] Add a shadow drawing identifier to the second virtual object and add the second virtual object to a shadow list when the second virtual object has a shadow;

[0337] Render the second virtual object and the shadow of the second virtual object in the shadow list based on the parameter matrix of the second virtual object.

[0338] In an alternative design of this embodiment, the detection module 810 is further configured to:

[0339] Perform collision detection on the field of view projection and the spatial block projection, where the field of view projection is the projection of the field of view spatial range on the horizontal plane of the virtual environment, and the spatial block projection is the projection of the spatial block on the horizontal plane of the virtual environment;

[0340] In the case of a collision between the field of view projection and the first spatial block projection, perform collision detection on the field of view projection and the spatial sub-block projection, where the spatial sub-block projection is the projection of the spatial sub-block on the horizontal plane of the virtual environment.

[0341] In an alternative design of this embodiment, the device further includes:

[0342] A processing module 840, configured to determine a loading spatial range in the virtual environment with the field of view spatial range as the center, where the distance between any spatial point in the loading spatial range and the field of view spatial range is less than a first distance threshold;

[0343] The processing module 840 is further configured to perform a loading process on the loading spatial blocks in the memory space, where the loading spatial blocks are the spatial blocks that overlap with the loading spatial range.

[0344] In an alternative design of this embodiment, the processing module 840 is further configured to:

[0345] Based on the field of view spatial range, determine a clearing spatial range in the virtual environment, where the distance between any spatial point in the clearing spatial range and the field of view spatial range is greater than a second distance threshold;

[0346] Perform a deletion process on the clearing spatial blocks in the memory space, where the clearing spatial blocks are the spatial blocks that overlap with the clearing spatial range and do not overlap with the loading spatial range.

[0347] In an alternative design of this embodiment, the processing module 840 is further configured to:

[0348] Based on the field of view spatial range, determine a caching spatial range in the virtual environment, where the distance between any spatial point in the caching spatial range and the field of view spatial range is greater than a third distance threshold;

[0349] Establish a cache for the caching spatial blocks, where the caching spatial blocks are the spatial blocks that overlap with the caching spatial range and do not overlap with the loading spatial range.

[0350] It should be noted that when the device provided in the above embodiments realizes its functions, only the division of the above-mentioned functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to actual needs, that is, the content structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0351] Regarding the device in the above embodiments, the specific ways in which each module performs operations have been described in detail in the embodiments related to the method; the technical effects obtained by each module performing operations are the same as those in the embodiments related to the method, and will not be elaborated here in detail.

[0352] Figure 20 The block diagram of a computer device provided by an exemplary embodiment of the present application is shown. The computer device 900 may be a portable mobile terminal, such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player. The computer device 900 may also be referred to by other names such as a user device, a portable terminal, etc.

[0353] Generally, the computer device 900 includes: a processor 901 and a memory 902.

[0354] The processor 901 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0355] The memory 902 may include one or more computer-readable storage media, and the computer-readable storage media may be tangible and non-transitory. The memory 902 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 902 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 901 to implement the virtual object rendering method provided in the embodiments of the present application.

[0356] In some embodiments, the computer device 900 may further optionally include: a peripheral device interface 903 and at least one peripheral device. Specifically, the peripheral device includes at least one of a radio frequency circuit 904, a touch display screen 905, a camera 906, an audio circuit 907, and a power supply 908.

[0357] The peripheral device interface 903 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 may be implemented on a separate chip or circuit board, and the present embodiment does not limit this.

[0358] The radio frequency circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts the received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 904 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The radio frequency circuit 904 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: the World Wide Web, a metropolitan area network, an intranet, each generation of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 904 may further include a circuit related to NFC (Near Field Communication), which is not limited in this application.

[0359] The touch display screen 905 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. The touch display screen 905 also has the ability to collect touch signals on or above the surface of the touch display screen 905. The touch signals can be input as control signals to the processor 901 for processing. The touch display screen 905 is used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one touch display screen 905, which is set on the front panel of the computer device 900; in other embodiments, there may be at least two touch display screens 905, which are respectively set on different surfaces of the computer device 900 or are in a foldable design; in some embodiments, the touch display screen 905 may be a flexible display screen, which is set on the curved surface or the folding surface of the computer device 900. Even, the touch display screen 905 can be set into an irregular non-rectangular shape, that is, a special-shaped screen. The touch display screen 905 can be prepared using materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0360] The camera assembly 906 is used to collect images or videos. Optionally, the camera assembly 906 includes a front camera and a rear camera. Generally, the front camera is used for video calls or selfies, and the rear camera is used for taking photos or videos. In some embodiments, there are at least two rear cameras, which can be any one of a main camera, a depth-of-field camera, and a wide-angle camera, so as to realize the background blurring function by fusing the main camera and the depth-of-field camera, and realize the panoramic shooting and VR (Virtual Reality) shooting functions by fusing the main camera and the wide-angle camera. In some embodiments, the camera assembly 906 may further include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation under different color temperatures.

[0361] The audio circuit 907 is used to provide an audio interface between the user and the computer device 900. The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals and input them to the processor 901 for processing, or input them to the radio frequency circuit 904 to achieve voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the computer device 900. The microphone can also be an array microphone or an omnidirectional collection type microphone. The speaker is used to convert the electrical signal from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker can be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for uses such as ranging. In some embodiments, the audio circuit 907 may further include a headphone jack.

[0362] The power supply 908 is used to supply power to each component in the computer device 900. The power supply 908 can be alternating current, direct current, a disposable battery or a rechargeable battery. When the power supply 908 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0363] In some embodiments, the computer device 900 further includes one or more sensors 909. The one or more sensors 909 include but are not limited to: an acceleration sensor 910, a gyroscope sensor 911, a pressure sensor 912, an optical sensor 913, and a proximity sensor 914.

[0364] The acceleration sensor 910 can detect the magnitudes of accelerations on the three coordinate axes of the coordinate system established by the computer device 900. For example, the acceleration sensor 910 can be used to detect the components of the gravitational acceleration on the three coordinate axes. The processor 901 can control the touch display screen 905 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signals collected by the acceleration sensor 910. The acceleration sensor 910 can also be used for collecting game or user movement data.

[0365] The gyroscope sensor 911 can detect the body orientation and rotation angle of the computer device 900. The gyroscope sensor 911 can cooperate with the acceleration sensor 910 to collect the 3D actions of the user on the computer device 900. Based on the data collected by the gyroscope sensor 911, the processor 901 can implement the following functions: motion sensing (such as changing the UI according to the user's tilting operation), image stabilization during shooting, game control, and inertial navigation.

[0366] The pressure sensor 912 can be disposed on the side frame of the computer device 900 and / or the lower layer of the touch display screen 905. When the pressure sensor 912 is disposed on the side frame of the computer device 900, it can detect the holding signal of the user on the computer device 900 and perform left / right hand recognition or shortcut operations according to the holding signal. When the pressure sensor 912 is disposed on the lower layer of the touch display screen 905, it can control the operable controls on the UI interface according to the pressure operation of the user on the touch display screen 905. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0367] The optical sensor 913 is used to collect the ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the touch display screen 905 according to the ambient light intensity collected by the optical sensor 913. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 905 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 913.

[0368] The proximity sensor 914, also known as a distance sensor, is typically disposed on the front of the computer device 900. The proximity sensor 914 is used to collect the distance between the user and the front of the computer device 900. In one embodiment, when the proximity sensor 914 detects that the distance between the user and the front of the computer device 900 is gradually decreasing, the touch display screen 905 is controlled by the processor 901 to switch from the lit state to the off state; when the proximity sensor 914 detects that the distance between the user and the front of the computer device 900 is gradually increasing, the touch display screen 905 is controlled by the processor 901 to switch from the off state to the lit state.

[0369] Those skilled in the art can understand that the structures shown above do not constitute a limitation on the computer device 900, and it may include more or fewer components than shown in the figure, or combine certain components, or adopt different component arrangements.

[0370] In an exemplary embodiment, a chip is further provided, and the chip includes a programmable logic circuit and / or program instructions, which are used to implement the rendering method of the virtual object described in the above aspects when the chip runs on a computer device.

[0371] In an exemplary embodiment, a computer program product is further provided, and the computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor reads and executes the computer instructions from the computer-readable storage medium to implement the rendering method of the virtual object provided by the above method embodiments.

[0372] In an exemplary embodiment, a computer-readable storage medium is further provided, and a computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by the processor to implement the rendering method of the virtual object provided by the above method embodiments.

[0373] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the storage medium mentioned above can be a read-only memory, a disk, an optical disc, etc.

[0374] Those skilled in the art should be able to realize that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented by hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. The computer-readable medium includes computer storage media and communication media, where the communication media includes any medium that facilitates the transmission of a computer program from one place to another. The storage media can be any available medium accessible by a general-purpose or special-purpose computer.

[0375] The above are only alternative embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A rendering method for virtual objects, characterized in that, the method includes: Performing collision detection on the field of view space range and spatial blocks in the virtual environment, where the virtual environment includes at least one of the spatial blocks; When there is a collision between the field of view space range and the first spatial block, performing collision detection on the spatial sub-blocks in the field of view space range and the first spatial block, where the first spatial block includes at least one of the spatial sub-blocks, the first spatial block contains a first virtual object and a second virtual object, and the spatial sub-block contains the second virtual object, where the size of the first virtual object is greater than the size threshold corresponding to the spatial block; the size of the second virtual object is less than or equal to the size threshold; When there is a collision between the field of view space range and the first spatial sub-block and no memory space is allocated, determining the number of the second virtual objects in the first spatial sub-block; Allocating the memory space according to the number of the second virtual objects; Based on the memory space, setting parameter information and index information for the parameter matrix of the second virtual object, where the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block; Rendering the second virtual object in the first spatial sub-block based on the parameter matrix of the second virtual object; where the position of the spatial sub-block is determined according to the position of the second virtual object, and the arrangement of the spatial sub-blocks in the first spatial block is a non-tessellated arrangement.

2. The method according to claim 1, characterized in that, the method further includes: When there is a collision between the field of view space range and the first spatial block, rendering the first virtual object in the first spatial block.

3. The method according to claim 1, characterized in that, the method further includes: When there is no collision between the field of view space range and the second spatial block, determining the first virtual object and / or the second virtual object in the second spatial block as a hidden state.

4. The method according to any one of claims 1 to 3, characterized in that, when there is a collision between the field of view space range and the first spatial sub-block, rendering the second virtual object in the first spatial sub-block includes: When there is a collision between the field of view space range and the first spatial sub-block and the memory space has been allocated, adding the second virtual object in the second spatial block to the display list of the memory space; Rendering the second virtual object in the display list based on the parameter matrix of the second virtual object.

5. The method according to claim 4, characterized in that, the method further includes: When the memory space does not overflow, setting parameter information and index information for the parameter matrix of the second virtual object; When the memory space overflows, adding the second virtual object to the list to be processed and allocating new memory space; In the new memory space, reuse the list to be processed and the display list; Set parameter information and index information for the parameter matrix of the second virtual object in the list to be processed; Wherein, the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block.

6. The method according to claim 4, wherein, the method further includes: When there is no collision between the field of view space range and the second spatial sub-block, add the second virtual object in the second spatial sub-block to the hidden list; Determine the second virtual object in the hidden list as the hidden state.

7. The method according to claim 4, wherein, the method further includes: When the second virtual object has a shadow, add a shadow rendering identifier to the second virtual object and add the second virtual object to the shadow list; Based on the parameter matrix of the second virtual object, render the second virtual object and the shadow of the second virtual object in the shadow list.

8. The method according to any one of claims 1 to 3, wherein, the collision detection of the field of view space range and the spatial block in the virtual environment includes: Perform collision detection on the field of view projection and the spatial block projection, where the field of view projection is the projection of the field of view space range on the horizontal plane of the virtual environment, and the spatial block projection is the projection of the spatial block on the horizontal plane of the virtual environment; When there is a collision between the field of view space range and the first spatial block, the collision detection of the field of view space range and the spatial sub-blocks in the first spatial block includes: When there is a collision between the field of view projection and the first spatial block projection, perform collision detection on the field of view projection and the spatial sub-block projection, where the spatial sub-block projection is the projection of the spatial sub-block on the horizontal plane of the virtual environment.

9. The method according to any one of claims 1 to 3, wherein, the method further includes: Taking the field of view space range as the center, determine the loading space range in the virtual environment, and the distance between any spatial point in the loading space range and the field of view space range is less than the first distance threshold; Perform a loading process on the loading spatial block in the memory space, where the loading spatial block is the spatial block that overlaps with the loading space range.

10. The method according to claim 9, wherein, the method further includes: Based on the field of view space range, determine the clearing space range in the virtual environment, and the distance between any spatial point in the clearing space range and the field of view space range is greater than the second distance threshold; Perform a deletion process on the clearing spatial block in the memory space, where the clearing spatial block is the spatial block that overlaps with the clearing space range and does not overlap with the loading space range.

11. The method according to claim 9, wherein, the method further includes: Based on the visual field space range, determine a cache space range in the virtual environment, wherein the distance between any spatial point in the cache space range and the visual field space range is greater than a third distance threshold; Establish a cache for the cache space block, where the cache space block is a spatial block that overlaps with the cache space range and does not overlap with the loading space range.

12. A rendering device for virtual objects, characterized in that, the device includes: a detection module for performing collision detection on a visual field space range and spatial blocks in a virtual environment, where the virtual environment includes at least one of the spatial blocks; the detection module is further configured to, when there is a collision between the visual field space range and a first spatial block, perform collision detection on spatial sub-blocks in the visual field space range and the first spatial block, where the first spatial block includes at least one of the spatial sub-blocks, the first spatial block contains a first virtual object and a second virtual object, and the spatial sub-block contains the second virtual object, wherein the size of the first virtual object is greater than the size threshold corresponding to the spatial block; the size of the second virtual object is less than or equal to the size threshold; a rendering module for, when there is a collision between the visual field space range and a first spatial sub-block and no memory space is allocated, determining the number of the second virtual objects in the first spatial sub-block; allocating the memory space according to the number of the second virtual objects; setting parameter information and index information for a parameter matrix of the second virtual object based on the memory space, where the parameter information is used to indicate the object form of the second virtual object in the virtual environment, and the index information is used to indicate the index relationship between the second virtual object and the first spatial sub-block; and rendering the second virtual object in the first spatial sub-block based on the parameter matrix of the second virtual object; wherein the position of the spatial sub-block is determined according to the position of the second virtual object, and the arrangement of the spatial sub-blocks in the first spatial block is a non-tessellated arrangement.

13. A computer device, characterized in that, the computer device includes: a processor and a memory, where at least one program is stored in the memory; the processor is configured to execute the at least one program in the memory to implement the virtual object rendering method according to any one of claims 1 to 11 above.

14. A computer-readable storage medium, characterized in that, executable instructions are stored in the readable storage medium, and the executable instructions are loaded and executed by a processor to implement the virtual object rendering method according to any one of claims 1 to 11 above.

15. A computer program product, characterized in that, the computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium, and a processor reads and executes the computer instructions from the computer-readable storage medium to implement the virtual object rendering method according to any one of claims 1 to 11 above.

Citation Information

Patent Citations

  • Method and device for determining rendering object in virtual scene, and electronic device

    CN108470368A

  • Object loading method and device, storage medium and electronic device

    CN109523621A

  • Feature index establishing method and device

    CN111190893A

  • KR20200091255A