Virtual object rendering method and device, electronic device, computer readable storage medium and computer program product
By allocating computing resources according to the type of virtual object and selecting a suitable level of detail model for rendering, the problem of device overload caused by model aggregation in virtual scenes is solved, and rendering efficiency and frame rate are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN TENCENT NETWORK INFORMATION TECH CO LTD
- Filing Date
- 2024-11-29
- Publication Date
- 2026-05-29
AI Technical Summary
When a large number of models are aggregated in a virtual scene, existing technologies can cause device performance to be overloaded, frame rate to drop, and user experience to be affected.
Allocate total computing resources based on the object type of the virtual object, determine the corresponding partial computing resources for different object types, and select a suitable target level of detail model for rendering based on the rendering parameters.
While ensuring visual effects, resource consumption is optimized to improve rendering efficiency and performance stability, and the display frame rate is increased.
Smart Images

Figure CN122115683A_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer graphics processing technology, and more particularly to a method, apparatus, electronic device, computer-readable storage medium, and computer program product for rendering virtual objects. Background Technology
[0002] As the amount of content to be displayed in a virtual scene increases, such as pets, characters, buildings, vegetation, and various static models, the number of drawing commands (DrawCall, DC) that need to be processed and the number of faces that need to be displayed will increase dramatically when these models are gathered in large numbers, resulting in a drop in the display frame rate.
[0003] In related technologies, the level of detail of virtual objects is adjusted based on the distance between virtual objects in a virtual scene and the camera. However, when multiple different types of models appear, this approach can easily cause each model to be given the highest priority and display a high level of detail, leading to device performance overload, unsmooth image display, and consequently affecting the user experience. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for rendering virtual objects, which can optimize resource consumption while ensuring visual effects.
[0005] The technical solution of this application embodiment is implemented as follows:
[0006] This application provides a method for rendering virtual objects, the method comprising:
[0007] Determine the total computing resources allocated to the virtual scene;
[0008] Determine the object type corresponding to at least one virtual object to be rendered in the virtual scene, and determine the portion of computing resources corresponding to each object type from the total computing resources;
[0009] The first rendering parameters of the first virtual object in the at least one virtual object to be rendered are obtained, and based on the first rendering parameters and the first part of the computing resources corresponding to the first object type of the first virtual object, a target level of detail model for rendering the first virtual object is determined, wherein the first virtual object rendered based on different level of detail models has different levels of detail.
[0010] Based on the target level of detail model, the first virtual object is rendered in the virtual scene.
[0011] This application provides a virtual object rendering apparatus, including:
[0012] The total resource determination module is used to determine the total computing resources allocated to the virtual scene;
[0013] A partial resource determination module is used to determine the object type corresponding to at least one virtual object to be rendered in the virtual scene, and to determine the partial computing resources corresponding to the object type from the total computing resources.
[0014] The model determination module is used to obtain the first rendering parameters of the first virtual object among the at least one virtual object to be rendered, and to determine the target level of detail model for rendering the first virtual object based on the first rendering parameters and the first part of the computing resources corresponding to the first object type of the first virtual object. The first virtual object rendered based on different level of detail models has different levels of detail.
[0015] A rendering module is used to render the first virtual object in the virtual scene based on the target level of detail model.
[0016] This application provides an electronic device, the electronic device comprising:
[0017] Memory is used to store executable instructions or computer programs.
[0018] The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the virtual object rendering method provided in the embodiments of this application.
[0019] This application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the virtual object rendering method provided in this application when executed by a processor.
[0020] This application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the virtual object rendering method provided in this application.
[0021] The embodiments of this application have the following beneficial effects:
[0022] By allocating total computing resources for the virtual scene according to the object type of the virtual object, partial computing resources corresponding to different object types are obtained. Combined with the first partial computing resources corresponding to the first object type of the first virtual object and the first rendering parameters of the first virtual object, an accurate and suitable target detail level model for rendering the first virtual object is determined. This enables differentiated rendering for virtual objects of different object types and optimizes resource consumption while ensuring the visual effect of the virtual scene. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the architecture of the virtual object rendering system provided in the embodiments of this application;
[0024] Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0025] Figure 3 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 1 ;
[0026] Figure 4 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 2 ;
[0027] Figure 5 This is a schematic diagram illustrating the determination of total computing resources provided in an embodiment of this application;
[0028] Figure 6 This is a schematic diagram illustrating the allocation of total computing resources provided in an embodiment of this application;
[0029] Figure 7 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 3 ;
[0030] Figure 8 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 4 ;
[0031] Figure 9 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 5 ;
[0032] Figure 10 This is a schematic diagram of a portion of the computing resources provided in an embodiment of this application;
[0033] Figure 11 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 6 ;
[0034] Figure 12 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 7 ;
[0035] Figure 13 This is a schematic diagram of the virtual object to be rendered in an interactive state, provided in an embodiment of this application;
[0036] Figure 14 This is a schematic diagram illustrating the principle of rendering different details of a virtual object to be rendered based on size parameters, as provided in the embodiments of this application.
[0037] Figure 15 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 8 ;
[0038] Figure 16 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 9 ;
[0039] Figure 17 This is a schematic diagram of the modules of the virtual object rendering system provided in the embodiments of this application;
[0040] Figure 18 This is a schematic diagram of the multi-level detail strategy update process provided in the embodiments of this application;
[0041] Figure 19 This is a schematic diagram of the process shown in the model provided in the embodiment of this application. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0043] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0044] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0045] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0046] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0047] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0048] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0049] 1) Responding to: used to indicate the conditions or states on which the operation is performed depends. When the conditions or states on which it depends are met, one or more operations can be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0050] 2) Client: An application running on a terminal that provides various services, such as a video playback client, a game client, etc.
[0051] 3) Virtual Scene: A virtual scene displayed (or provided) by the application when it runs on the terminal. This virtual scene can be a simulation of the real world, a semi-simulated / semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any of a two-dimensional, 2.5-dimensional, or three-dimensional virtual scene; this application embodiment does not limit the dimension of the virtual scene. For example, a virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities. Users can control virtual objects to move within this virtual scene.
[0052] 4) Virtual Objects: These are interactive images of people and objects within a virtual scene, or movable objects within the virtual scene. These movable objects can be virtual characters, virtual animals, anime characters, etc., such as people or animals displayed in a virtual scene. A virtual object can be a virtual avatar representing the user within the virtual scene. A virtual scene can include multiple virtual objects, each with its own shape and volume, occupying a portion of the space within the virtual scene.
[0053] 5) Level of Detail (LOD) Model: This technique allocates rendering resources based on the virtual object's location and importance within the virtual environment, reducing the face count of less important virtual objects to achieve more efficient rendering. For example, when a virtual object is far from the camera, the amount of visible detail is greatly reduced. The face count (or triangular mesh count) of the virtual object can be adjusted based on its distance from the camera. Different levels of LOD are activated for different distances, resulting in different levels of LOD used to render virtual objects in the virtual scene.
[0054] 6) Draw Calls (DCs): These are drawing instructions sent by the engine to the Graphics Application Programming Interface (GUI) to instruct the GUI to draw virtual objects. All the information the GUI needs to draw on the screen is contained in each draw call, such as textures, shaders, and buffers. The work of drawing calls is performed by the Central Processing Unit (CPU), and increasing the number of draw calls increases the CPU load.
[0055] 7) Count of polygons: A basic concept in 3D modeling, it refers to the number of polygons that make up a 3D mesh. The more polygons there are, the higher the accuracy of the model and the better the display effect. However, the more computing resources are required.
[0056] 8) 3D mesh: A data structure used to represent the surface or volume of an object in three-dimensional space. It consists of a series of vertices, edges, and faces, where each face is usually a polygon (most commonly a triangle) defined by three or more vertices.
[0057] To better understand the virtual object rendering method provided in the embodiments of this application, the problems faced by virtual object rendering methods in related technologies will first be explained.
[0058] In the gaming industry, as gameplay becomes increasingly complex, the amount of content displayed on game screens grows, including pets, characters, buildings, vegetation, and various static models. When these models are clustered together in large numbers, the number of rendering commands and the number of faces to be displayed increase dramatically, overloading the Graphics Processing Unit (GPU) and CPU, leading to frame rate drops and severely impacting the user experience. One related technology involves creating multiple levels of Level of Detail (LOD) for each model. Lower-level LODs have significantly reduced face counts and rendering commands. In actual display, different LODs can be selected based on distance and importance, achieving a balance between performance and user experience. However, this approach can only control the number of rendering commands and faces for a specific type of model. While effective when processing a single type of model, when multiple different models are clustered together in large numbers, each model may be given the highest priority, displaying high-level LODs, leading to serious performance issues such as frame drops and excessive power consumption, negatively impacting the user experience.
[0059] Based on the problems existing in related technologies, embodiments of this application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for rendering virtual objects. These methods can select the most suitable target level of detail model for rendering based on the device's computing resources and the rendering parameters of the virtual object, thereby optimizing resource consumption while ensuring visual effects. The following describes exemplary applications of the electronic device provided in this application. The electronic device provided in this application can be implemented as various types of terminals such as laptops, tablets, desktop computers, set-top boxes, smartphones, smart speakers, smartwatches, smart TVs, and in-vehicle terminals, or it can be implemented as a server. The following will describe exemplary applications when the electronic device is implemented as a terminal or server.
[0060] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of a virtual object rendering system provided in an embodiment of this application. The virtual object rendering system 100 in this embodiment includes at least a terminal 400, a network 300, and a server 200. The terminal 400 is connected to the server 200 through the network 300, which can be a wide area network (WAN), a local area network (LAN), or a combination of both.
[0061] In the game scene, see Figure 1The terminal 400 runs a client 400-1 (e.g., a game application). During the operation of the client 400-1, the virtual scene of the game is output. The virtual scene can be an environment for game characters to interact with, such as plains, streets, valleys, etc., for game characters to fight. The virtual scene can include virtual objects of various object types, such as game characters, pets, trees, buildings, etc. The user can launch client 400-1 through terminal 400. Client 400-1 obtains the terminal's device parameters. Client 400-1 sends a scene display request to server 200, which includes the terminal's device parameters. In response to the scene display request, server 200 determines the total computing resources allocated to the virtual scene based on the device parameters. Server 200 determines the object type corresponding to at least one virtual object to be rendered in the virtual scene, and determines the corresponding portion of computing resources from the total computing resources. Server 200 obtains the first rendering parameters of the first virtual object among the at least one virtual object to be rendered, and determines the target level of detail model for rendering the first virtual object based on the first rendering parameters and the first portion of computing resources corresponding to the first object type of the first virtual object. The first virtual object rendered based on different level of detail models has different levels of detail. Server 200 sends the target level of detail model to terminal 400, and client 400-1 running on terminal 400 renders the first virtual object in the virtual scene based on the target level of detail model.
[0062] Alternatively, the user can initiate the operation of client 400-1 through terminal 400. Client 400-1 obtains the device parameters of the terminal; client 400-1 determines the total computing resources allocated for the virtual scene based on the device parameters; client 400-1 determines the object type corresponding to at least one virtual object to be rendered in the virtual scene, and determines the partial computing resources corresponding to each object type from the total computing resources; client 400-1 obtains the first rendering parameters of the first virtual object among the at least one virtual object to be rendered, and determines the target level of detail model for rendering the first virtual object based on the first rendering parameters and the first partial computing resources corresponding to the first object type of the first virtual object, wherein the first virtual object rendered based on different level of detail models has different levels of detail; client 400-1 renders the first virtual object in the virtual scene based on the target level of detail model.
[0063] See Figure 2 , Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Figure 2The illustrated electronic device includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components of the electronic device are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 2 The general labeled all buses as Bus System 440.
[0064] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0065] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0066] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
[0067] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.
[0068] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0069] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0070] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
[0071] Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with user interface 430;
[0072] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
[0073] In some embodiments, the virtual object rendering apparatus provided in this application can be implemented in software. Figure 2 A rendering apparatus 455 for virtual objects stored in memory 450 is shown. This apparatus can be software in the form of programs and plugins, and includes the following software modules: a total resource determination module 4551, a partial resource determination module 4552, a model determination module 4553, and a rendering module 4554. These modules are logically linked and can therefore be arbitrarily combined or further divided according to their implemented functions. The functions of each module will be described below.
[0074] In other embodiments, the virtual object rendering apparatus provided in this application can be implemented in hardware. As an example, the apparatus provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the virtual object rendering method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0075] The rendering method for virtual objects provided in the embodiments of this application will now be described in detail with reference to the accompanying drawings. As mentioned above, the electronic device implementing the rendering method for virtual objects in the embodiments of this application can be a terminal, a server, or a combination of both. Therefore, the executing entity of each step will not be described again below.
[0076] It should be noted that the examples of virtual object rendering methods in the following text are illustrated using virtual objects as entities in a game. Based on the understanding of the following text, those skilled in the art can apply the virtual object rendering methods provided in the embodiments of this application to any other scene that requires graphics rendering, such as virtual reality or augmented reality scenes, simulation scenes in the medical field, architectural visualization scenes, etc.
[0077] See Figure 3 , Figure 3 This is a flowchart illustrating the virtual object rendering method provided in the embodiments of this application. Figure 1 , will combine Figure 3 The steps shown are explained as follows: Figure 3 As shown, taking the terminal as the execution subject of the virtual object rendering method as an example, the method includes the following steps 101 to 104:
[0078] In step 101, the total computing resources allocated to the virtual scene are determined.
[0079] Here, a virtual scene refers to a three-dimensional space constructed within a computer-generated environment, containing various virtual objects, terrain, lighting effects, and other elements. A virtual scene can be completely fictional or a simulation of the real world. Virtual scenes provide users with an immersive environment where they can interact, explore, or complete tasks. Virtual objects are digital entities created within a virtual scene; they can be any three-dimensional or two-dimensional graphical representation, such as characters, props, buildings, vehicles, and natural landscapes. Virtual objects are the basic elements constituting a virtual environment. The total computing resources allocated to a virtual scene refer to the available computing resources for the device running the virtual scene. The device refers to the terminal where the client application running the virtual scene resides, such as a personal computer, laptop, tablet, smartphone, game console, dedicated augmented reality (AR) headset, or dedicated virtual reality (VR) headset. In other words, the total computing resources allocated to a virtual scene represent the highest processing capacity the terminal can handle for the virtual scene at the current processor's operating frequency and utilization rate, including the maximum number of faces that can be rendered per unit time and the number of executable rendering commands (DCs). A unit of time is a fixed time interval used to measure and compare performance within the same time period. In this embodiment, the unit of time can be per second, per minute, or per frame, etc. In response to a user launching the client, jumping to another virtual scene, or controlling a player character to move within a virtual scene, the client determines the total computing resources allocated to the virtual scene.
[0080] For example, taking a game application as an example, the virtual scene can include, but is not limited to, a base scene, a forest scene, a mountain scene, and a battle scene. Virtual objects include player characters, non-player characters (NPCs), buildings, props, pets, plants, etc. Virtual objects can be static (such as buildings) or dynamic (such as moving NPCs and player characters). In response to the user launching the game application client, the game application client loads into a virtual scene. If the player character is currently in the base scene, the game application client loads into the base scene and needs to render the various virtual objects included in the current base scene. The terminal model and operating status are obtained in real time. The operating status includes CPU operating frequency, CPU utilization, GPU operating frequency, and GPU utilization. Based on the terminal model, CPU operating frequency, CPU utilization, GPU operating frequency, and GPU utilization, the total computing resources allocated to the virtual scene are determined. The total computing resources include the maximum number of faces and the maximum number of DCs that the current terminal can support for rendering the virtual scene per unit time.
[0081] In some embodiments, see Figure 4 The determination of the total computing resources allocated to the virtual scene in step 101 can be achieved through the following steps 1011 to 1013, which are explained in detail below.
[0082] In step 1011, the computing resource configuration file is obtained.
[0083] The computing resource configuration file includes the association between candidate device parameters and candidate computing resources.
[0084] Here, the computing resource configuration file is a predefined file that includes the relationships between multiple candidate device parameters and multiple candidate computing resources. The computing resource configuration file helps the client quickly determine the computing resources currently allocated to the virtual scene by the device based on its specific configuration. Candidate device parameters include at least one of the following: device model, processor operating frequency, and processor utilization. The processor includes CPU and / or GPU. Candidate computing resources refer to the maximum number of faces and the maximum number of rendering instructions that the device can support per unit time under the candidate device parameters. The device model is a unique identifier used to distinguish devices, usually specified by the device manufacturer, used to differentiate between different versions or configurations of devices. The device model may include brand, series, specific model, etc. Different device models have different processor performance. The processor operating frequency (usually measured in Hertz, such as GHz) refers to the number of clock cycles that a processor (CPU or GPU) can execute per second, and is an important indicator of processor speed. Processor utilization refers to the percentage of processing power actually used by the processor (CPU or GPU) at a certain moment or over a period of time, relative to its total processing power. For example, if a processor's utilization rate is 80%, it means that it used 80% of its total processing capacity during that time period.
[0085] In some embodiments, the computing resource configuration file includes a device configuration table for different device models. The device configuration table includes the association between candidate processor parameter ranges and candidate computing resources. The candidate processor parameter ranges are obtained by dividing the ranges of processor operating frequency and processor utilization. The candidate processor parameter ranges include multiple operating frequency ranges and utilization ranges. The range of processor operating frequency values can be divided into multiple operating frequency ranges, each with an upper and lower limit. The range of processor utilization values can be divided into multiple utilization ranges, each with an upper and lower limit. Referring to Table 1, when the processor is a CPU, each combination of CPU utilization range and operating frequency range corresponds to the maximum number of rendering instructions (DCs) in a candidate computing resource. For example, when the processor operating frequency is between 0-2.4 GHz and the utilization is between 0-20%, the maximum number of rendering instructions (DCs) that the candidate computing resource can support per unit time is 200. Referring to Table 2, when the processor is a GPU, each combination of GPU utilization range and operating frequency range corresponds to the maximum number of faces in a candidate computing resource. For example, when the processor operates at a frequency between 0 and 2.4 GHz and the utilization rate is between 0 and 20%, the candidate computing resource is the maximum number of faces that the device can support per unit time, which is 1 million.
[0086] Table 1. Device Configuration Table for CPU
[0087]
[0088] Table 2. Device Configuration Table for GPU
[0089]
[0090]
[0091] In step 1012, the device parameters when the device is running the virtual scene are obtained, and the computing resource configuration file is queried based on the device parameters when running the virtual scene.
[0092] In this embodiment of the application, the step 1012 of querying the computing resource configuration file based on the device parameters when running the virtual scene can also be implemented in the following way: First, query the computing resource configuration file based on the device model to obtain a device configuration table for the device model; then, based on the processor operating frequency and processor utilization when running the virtual scene, query the candidate processor parameter ranges included in the device configuration table for the device model to obtain the processor parameter ranges corresponding to the processor operating frequency and processor utilization; finally, based on the processor parameter ranges corresponding to the processor operating frequency and processor utilization when running the virtual scene, query the association relationship between the candidate processor parameter ranges included in the device configuration table for the device model and the candidate computing resources.
[0093] In step 1013, when a candidate device parameter corresponding to the device parameter is found, the candidate computing resources associated with the found candidate device parameter are determined as the total computing resources allocated for the virtual scene.
[0094] Here, when a candidate computing resource corresponding to the processor parameter range is found in the device configuration table for the device model, the found candidate computing resource is determined as the total computing resource allocated for the virtual scene.
[0095] For example, if the terminal's current CPU processor operating frequency is 2GHz with a processor utilization of 15%, and the GPU processor operating frequency is 1.8GHz with a processor utilization of 10%, and the terminal's device model is A, then the CPU and GPU device configuration tables for device model A are searched from the computing resource configuration file. Based on the CPU's processor operating frequency of 2GHz and processor utilization of 15%, multiple candidate processor parameter ranges are queried in the CPU device configuration for device model A to obtain the corresponding processor parameter range. This processor parameter range includes an operating frequency range of 0-2.4GHz and a utilization range of 0-20%. The candidate computing resource associated with this processor parameter range is a maximum number of rendering instructions (DC) of 200. Based on the GPU's processor operating frequency of 1.8GHz and processor utilization of 10%, multiple candidate processor parameter ranges are queried in the GPU device configuration for device model A to obtain the corresponding processor parameter range. This processor parameter range includes an operating frequency range of 0-2.4GHz and a utilization range of 0-20%. The candidate computing resource associated with this processor parameter range is a maximum number of faces of 1 million. At this point, the total computing resources allocated to the virtual scene are the maximum number of drawing commands (DC) of 200 and the maximum number of faces of 1 million.
[0096] As an example, Figure 5 This is a schematic diagram illustrating the determination of total computing resources according to an embodiment of this application. See also... Figure 5When a user launches the client on their terminal or switches between virtual scenes within the client, the client loads the virtual scene. At this time, the client obtains the CPU's operating frequency and utilization, and the GPU's operating frequency and utilization, from both the CPU and GPU. It then determines the range of the CPU's operating frequency and utilization from the CPU's device configuration table, and identifies the number of faces associated with that range. Similarly, it determines the range of the GPU's operating frequency and utilization from the GPU's device configuration table, and identifies the number of rendering instructions associated with that range. The obtained face count and rendering instruction count constitute the total computing resources for the virtual scene.
[0097] This application embodiment ensures that the rendering of the virtual scene can be optimized according to the specific performance of the device by dynamically matching the actual total computing resources allocated to the virtual scene by the device. This improves rendering efficiency and performance stability while ensuring visual effects, thereby improving the stability of the display frame rate.
[0098] In step 102, the object type corresponding to at least one virtual object to be rendered in the virtual scene is determined, and the partial computing resources corresponding to the object type are determined from the total computing resources.
[0099] Here, the virtual object to be rendered refers to the virtual object that needs to be drawn and displayed in the virtual scene. Object type refers to the classification of virtual objects, which is a category obtained by classifying multiple virtual objects according to their actual use and appearance characteristics. For example, object types can include characters, pets, buildings, trees, props, rocks, etc. For each object type, the corresponding partial computing resources refer to the highest processing capacity that the terminal can handle for all virtual objects of that object type in the virtual scene to be rendered. Allocating the total computing resources to each object type in the virtual scene yields the partial computing resources corresponding to each object type. Different object types may require different allocations of computing resources to ensure a balance between overall rendering performance and visual effects. For example, taking the virtual scene as a base scene as an example, the current player character is in the base scene, and the base scene currently includes 10 pets. The partial computing resources for the virtual objects to be rendered of the pet type are the computing resources (maximum number of faces and maximum number of DCs) that the device can support in rendering these 10 pets per unit of time.
[0100] As an example, Figure 6 This is a schematic diagram illustrating the allocation of total computing resources according to an embodiment of this application. See also... Figure 6After determining the total computing resources for the virtual scene, at least one object type in the virtual scene is obtained: object type A, object type B, object type C, etc. The total computing resources are allocated to each object type to obtain the corresponding partial computing resources for each object type.
[0101] In some embodiments, see Figure 7 In step 102, the partial computing resources corresponding to each object type are determined from the total computing resources. This can be achieved for each object type through the following steps 1021 to 1024, which will be explained in detail below.
[0102] In step 1021, the number of virtual objects of type object to be rendered in the virtual scene is determined.
[0103] Here, for each object type, the number of virtual objects belonging to that object type within the current camera's field of view in the virtual scene can be determined. For example, if the current virtual scene is a base scene, for the object type "pet", the number of pets within the camera's field of view in the base scene is 50; for the object type "character", the number of characters within the camera's field of view in the base scene is 3.
[0104] In step 1022, the first resource weight of the object type in the virtual scene is obtained.
[0105] Here, the first resource weight is a parameter used to reflect the importance of each object type in the virtual scene. The first resource weight refers to the pre-defined resource allocation ratio for each object type in the virtual scene, representing the relative proportion of total computing resources that all virtual objects of that object type can occupy during rendering. For example, the sum of the first resource weights for all object types in the virtual scene is 100. In the base scene, the first resource weights for each object type are: Character: 20; Pet: 40; Building: 20; Tree: 10; Rock: 10. It should be noted that the first resource weight for the same object type may differ in different virtual scenes.
[0106] In some embodiments, see Figure 8 In step 1022, obtaining the first resource weight of the object type in the virtual scene can be achieved through the following steps 10221 to 10223, which are explained in detail below.
[0107] In step 10221, the resource weight configuration file is obtained.
[0108] The resource weight configuration file includes a scenario configuration table for different candidate virtual scenarios, and the scenario configuration table includes the association between candidate object types and candidate resource weights.
[0109] Here, the resource weight configuration file is a predefined file that includes a scenario configuration table for each of the multiple candidate virtual scenarios. The multiple candidate virtual scenarios are all the virtual scenarios that might be displayed, pre-defined during application development. The scenario configuration table contains the specific configuration information for each candidate virtual scenario in the resource weight configuration file. Each scenario configuration table contains a set of associations between candidate object types and candidate resource weights. A candidate object type refers to all object types that may be included in the virtual scenario corresponding to that scenario configuration table. A candidate resource weight refers to the resource weight pre-defined for each candidate object type in the scenario configuration table.
[0110] In step 10222, the scene identifier of the virtual scene is obtained, and the resource weight configuration file is queried based on the scene identifier. When a candidate virtual scene corresponding to the scene identifier is found, the scene configuration table of the queried candidate virtual scene is determined as the scene configuration table for the virtual scene.
[0111] Here, the scene identifier is a unique identifier used to distinguish virtual scenes. The scene identifier can be represented in various ways, including but not limited to numbers, letters, and strings. For example, the scene identifier of the base scene is 1. The resource weight configuration file can be queried based on the scene identifier "1" to obtain the scene configuration table for the base scene. Table 3 shows an example of the scene configuration table. Referring to Table 3, the budget baseline is the candidate resource weight corresponding to each candidate object type.
[0112] Table 3 Scene Configuration Table
[0113]
[0114] In step 10223, the scene configuration table for the virtual scene is queried based on the object type. When a candidate object type corresponding to the object type is found, the candidate resource weight associated with the queried candidate object type is determined as the first resource weight of the object type in the virtual scene.
[0115] For example, in the base scenario, the scenario configuration table is queried for the object type "Pet". The scenario configuration table includes multiple candidate object types: User Role, Pet, Building, Tree, and Rock. The candidate resource weights for each candidate object type are: User Role: 20; Pet: 40; Building: 20; Tree: 10; Rock: 10. Therefore, the candidate resource weight associated with the object type "Pet" (based on the budget baseline) is 40, meaning the first resource weight for the object type "Pet" in the base scenario is 40.
[0116] This application embodiment uses a resource weight configuration file to set different resource weight configurations for different virtual scenes, ensuring that resource allocation is more in line with scene requirements. At the same time, based on the scene identifier and object type of the virtual scene, the first resource weight of the object type can be dynamically queried and determined, thereby achieving more refined resource management. Furthermore, through reasonable resource weight configuration, while ensuring visual effects, rendering performance can be optimized to ensure smooth operation of the application.
[0117] In step 1023, the resource weight increment parameter corresponding to the object type is obtained.
[0118] The resource weight increment parameter is used to indicate how to increase the first resource weight based on the quantity.
[0119] Here, for each object type, the corresponding resource weight increment parameter is used to adjust the resource weight of the object type based on the actual number of virtual objects of that type to be rendered in the virtual scene. The same object type can have the same resource weight increment parameter in different virtual scenes. The resource weight increment parameter includes the initial number of virtual objects to be rendered corresponding to the object type, the increase ratio of the resource weight for each additional preset number of virtual objects, and the upper limit of the increase ratio. The initial number serves as a baseline for adjusting the resource weight of the object type based on the actual number of virtual objects to be rendered. When the actual number of virtual objects to be rendered in the virtual scene exceeds this initial number, the resource weight is adjusted according to the preset increase ratio. It should be noted that the values of the initial number, preset number, increase ratio, and upper limit of the increase ratio can all be set based on actual needs.
[0120] For example, the object type is pet, and the resource weight increment parameters corresponding to the pet type include an initial quantity of 10, an increase of 20% for every additional preset quantity of 10, and an upper limit of 100% for the increase ratio.
[0121] In step 1024, based on the quantity, the first resource weight, and the resource weight increment parameter, the portion of computing resources corresponding to the object type is determined from the total computing resources.
[0122] Here, the first resource weight can be increased based on the resource weight increment parameter and the quantity. After obtaining the increased first resource weight for each object type, the corresponding computing resources are allocated from the total computing resources to each object type based on the increased first resource weight for each object type, thus obtaining the corresponding partial computing resources for each object type (such as the maximum number of faces and the maximum number of DCs).
[0123] This application's embodiments dynamically adjust resource weights based on the number and type of virtual objects to be rendered, ensuring more reasonable and flexible resource allocation. This ensures that important objects (such as characters) receive more computational resources, while less important objects (such as distant buildings) are allocated fewer resources, thereby improving overall rendering performance. By determining the portion of computational resources corresponding to each object type, it is possible to ensure smooth display of the virtual scene while maintaining visual quality.
[0124] In some embodiments, see Figure 9 In step 1024, based on the quantity, the first resource weight, and the resource weight increment parameter, the part of the computing resources corresponding to the object type is determined from the total computing resources. This can be achieved through the following steps 10241 to 10243, which are explained in detail below.
[0125] In step 10241, based on the resource weight increment parameter and the quantity, the first resource weight is increased, and the increased first resource weight is determined as the second resource weight.
[0126] In this embodiment, the resource weight increment parameter includes the initial number of virtual objects to be rendered corresponding to the object type, the increase ratio of the resource weight when a preset number of virtual objects to be rendered are added, and the upper limit of the increase ratio. In step 10241, increasing the first resource weight based on the resource weight increment parameter and the quantity can be achieved in the following way: First, based on the initial quantity, the quantity, and the increase ratio, determine the weight increase ratio corresponding to the object type; then, when the weight increase ratio is less than the upper limit of the increase ratio, increase the first resource weight based on the weight increase ratio; or, when the weight increase ratio is greater than or equal to the upper limit of the increase ratio, increase the first resource weight based on the upper limit of the increase ratio.
[0127] Here, for each object type, the quantity change can be determined based on the initial quantity of that object type and its actual quantity in the virtual scene. The increase is then calculated by determining how many preset quantities (i.e., the first value) have been added. The product of the increase ratio and the first value is determined as the weight increase ratio corresponding to the object type. When the weight increase ratio is less than the upper limit of the increase ratio, the sum of the weight increase ratio and the value 1 is determined, and the product of this sum and the first resource weight is determined as the second resource weight. Alternatively, when the weight increase ratio is greater than or equal to the upper limit of the increase ratio, the sum of the upper limit of the increase ratio and the value 1 is determined, and the product of this sum and the first resource weight is determined as the second resource weight. It should be noted that if the result of dividing the quantity change by the preset quantity is not an integer, the result is rounded to the nearest integer, and the larger integer is taken as the first value. That is, even if the quantity change is less than a complete preset quantity, it will still be considered as an increase of one preset quantity.
[0128] For example, the object type is pets, and the first resource weight of pets is 40. The resource weight increment parameters for pets include an initial quantity of 10, an increase of 20% for every additional preset quantity of 10, and an upper limit of 100%. In the base scenario, the current number of pets is 50, the first value is (50-10) / 4 = 4, and the weight increase percentage is the product of the increase percentage and the first value, 4 × 20% = 80%. The weight increase percentage is less than the upper limit, so the second resource weight of pets is 40 × (1 + 80%) = 72. The object type is buildings, and the first resource weight of buildings is 20. The resource weight increment parameters for buildings include an initial quantity of 5, an increase of 10% for every additional preset quantity of 5, and an upper limit of 50%. In the base scenario, the current number of buildings is 40 (19), the first value is (19-5) / 5 = 2.8, or the first value is 3, and the weight increase percentage is the product of the increase percentage and the first value, 3 × 10% = 30%. The weight increase percentage is less than the upper limit of the increase percentage, so the weight of the second resource for pets is 20 × (1 + 30%) = 26.
[0129] In step 10242, the second resource weight is normalized to obtain the normalized resource weight.
[0130] Here, after determining the second resource weight for each object type, the normalization of the second resource weight can be achieved in the following way: determine the sum of the weights of the second resource weights of multiple object types, and for each object type, determine the ratio of the second resource weight of that object type to the sum of the weights, and use the ratio as the normalized resource weight of that object type.
[0131] For example, there are several object types in the base scene: characters, pets, buildings, trees and rocks, with corresponding second resource weights of 32, 72, 26, 12 and 11.5 respectively. The total weight is 32+72+26+12+11.5=153.5, and the normalized resource weight corresponding to the character type is 32 / 153.5.
[0132] In step 10243, total computing resources are allocated based on normalized resource weights, and the allocated computing resources are determined as a portion of the computing resources corresponding to the object type.
[0133] Here, after determining the normalized resource weight for each object type, the product of the normalized resource weight for each object type and the total computing resources is determined as a portion of the computing resources for that object type. For example, if the total computing resources include a maximum face count of 80,000 and a maximum DC count of 500, then the portion of the computing resources for the character type includes a maximum face count of 800,000 × (32 / 153.5) = 166,775 and a maximum DC count of 500 × (32 / 153.5) = 104.
[0134] As an example, Figure 10 This is a schematic diagram of a determined portion of the computing resources provided in an embodiment of this application. See also... Figure 10 For the virtual scene loaded by the client, at least one virtual object to be rendered belonging to each object type is obtained from the virtual scene. For example, virtual objects 1 and 2 belonging to object type A, and virtual objects 3 and 4 belonging to object type B, etc. Then, the first resource weight of each object type in the virtual scene is obtained from the scene configuration table, and the resource weight increment parameter for each object type is obtained from the database. For each object type, based on the number of virtual objects to be rendered belonging to that object type and the resource weight increment parameter for that object type, the first resource weight of that object type is increased to obtain the second resource weight of that object type. Normalization is performed based on the second resource weight of each object type to obtain the normalized resource weight of each object type. Total computing resources are allocated based on the normalized resource weight of each object type to obtain the partial computing resources for each object type.
[0135] This application embodiment dynamically adjusts resource weights based on the actual and initial number of virtual objects to be rendered, obtaining a second resource weight for each object type. By normalizing the second resource weights, it ensures that the sum of the resource weights for each object type is 1, thereby rationally allocating total computing resources. This ensures that different object types are allocated different portions of computing resources, thus ensuring a balance between rendering quality and performance for different object types.
[0136] In step 103, the first rendering parameters of the first virtual object in at least one virtual object to be rendered are obtained, and based on the first rendering parameters and the first part of the computing resources corresponding to the first object type of the first virtual object, the target level of detail model for rendering the first virtual object is determined.
[0137] Among them, the first virtual object rendered based on different levels of detail models has different levels of detail.
[0138] Here, the first virtual object is any one of at least one virtual object to be rendered. Rendering parameters are attribute parameters reflecting the importance of the virtual object to be rendered in the current virtual scene, including but not limited to the distance, interaction state, direction, and model volume of the virtual object to be rendered, collected from the current virtual scene. The first rendering parameters are used to determine the target level of detail model used by the first virtual object during the rendering process. The first virtual object has multiple corresponding level of detail models. The first virtual object rendered based on different level of detail models has different levels of detail. Level of detail refers to the level of detail in terms of geometric complexity, texture quality, and animation refinement of the rendered first virtual object. For the first virtual object, based on the first rendering parameters and the first part of the computational resources, the target level of detail model is determined from the multiple level of detail models corresponding to the first virtual object.
[0139] For each virtual object to be rendered, each of its multiple Level of Detail (LHD) models corresponds to a different Level of Detail (LOD) level and different actual resource consumption. For each virtual object to be rendered in each virtual scene, the relationship between the rendering parameters and LOD level of that virtual object in that virtual scene can be obtained. It should be noted that different virtual objects to be rendered can have different relationships between rendering parameters and LOD levels, and even the same virtual object to be rendered can have different relationships between rendering parameters and LOD levels in different virtual scenes. For the first virtual object, based on the first rendering parameters of the first virtual object and the relationship between the first rendering parameters and LOD level of the first virtual object in the virtual scene, the target LOD level of the first virtual object is determined. After obtaining the target LOD level of each virtual object to be rendered, for each object type, the total actual resource consumption of the LHD model corresponding to the target LOD level of each virtual object to be rendered within that object type can be determined. If the total actual resource consumption is less than or equal to the partial computational resources of that object type, then the LHD model corresponding to the target LOD level of each virtual object to be rendered under that object type is taken as the target LHD model. Alternatively, if the total actual resources consumed exceed the computational resources of the object type, the target LOD level is re-determined for each virtual object to be rendered in that object type based on its respective rendering parameters.
[0140] The model-level configuration table for each of the multiple virtual objects to be rendered can be obtained, and the model-level configuration table for each virtual object to be rendered is determined based on the unique identifier of the virtual object. See Table 4. The model-level configuration table includes the object identifier (i.e., model id) of the virtual object to be rendered, the LOD level, the storage path of multiple LOD models (LOD storage path), and the actual resources consumed by each LOD level (number of faces and DC).
[0141] Table 4 Model Level Configuration Table
[0142]
[0143] In some embodiments, see Figure 11 In step 103, the target level of detail model for rendering the first virtual object is determined based on the first rendering parameters and the first part of the computing resources corresponding to the first object type of the first virtual object. This can be achieved through the following steps 1031 to 1035, which will be explained in detail below.
[0144] In step 1031, the first level of detail model is determined from multiple level of detail models corresponding to the first virtual object based on the first rendering parameters.
[0145] Here, a rendering parameter configuration file for the first virtual object in the virtual scene can be obtained. This configuration file includes the association between candidate rendering parameters and candidate level of detail (HLD) models. Based on the first rendering parameters of the first virtual object, the rendering parameter configuration file is queried. When a candidate rendering parameter corresponding to the first rendering parameter is found, the candidate HLD model associated with that parameter is determined as the first HLD model.
[0146] The rendering parameter configuration file can also include the association between candidate rendering parameter ranges and LOD levels. Candidate rendering parameter ranges are obtained by dividing the value ranges of the fields corresponding to the rendering parameters. Based on the first rendering parameter, the candidate rendering parameter ranges included in the rendering parameter configuration file are queried to obtain the candidate rendering parameter range corresponding to the first rendering parameter. Based on the candidate rendering parameter range corresponding to the first rendering parameter, the association between the candidate rendering parameter ranges included in the rendering parameter configuration file and the LOD level is queried to obtain the target LOD level of the first virtual object. Based on the target LOD level of the first virtual object, the storage path of the level of detail model corresponding to the target LOD level can be determined from the model level configuration table of the first virtual object. The level of detail model corresponding to the target LOD level can then be retrieved from the storage path; this is the first level of detail model.
[0147] For example, the first rendering parameters include distance parameters, which are the distances between the first virtual object and the camera in the virtual scene. Referring to Table 5, the rendering parameter configuration file includes distance parameter configuration tables for different virtual scenes and different virtual objects to be rendered. These distance parameter configuration tables include the scene identifier (scene ID) and object identifier (model ID) of the virtual object to be rendered. The rendering parameter configuration file includes the farthest and nearest distances within each distance parameter range, as well as the LOD level corresponding to each distance parameter range.
[0148] Table 5 Distance Parameter Configuration Table
[0149]
[0150] In step 1032, the first actual resources consumed by rendering the first virtual object based on the first level of detail model are determined, and the second actual resources consumed by rendering the second virtual object based on the second level of detail model are determined.
[0151] The second level of detail model is determined from multiple level of detail models corresponding to the second virtual object based on the second rendering parameters of the second virtual object. The second virtual object is at least one virtual object to be rendered that is of the same object type as the first virtual object.
[0152] Here, the first actual resource consumed in rendering the first virtual object based on the first level of detail (LLD) model is the actual computational resource required to render the first virtual object based on the first LLD model, including the number of faces actually used for rendering by the first LLD model and the number of DCs actually called when rendering the first virtual object. The model level configuration table of the first virtual object can be obtained, and the first actual resource consumed by the first virtual object can be determined from the model level configuration table based on the LOD level of the first LLD model. The second virtual object is at least one of multiple virtual objects to be rendered that is of the same object type as the first virtual object. The specific process of determining the second LLD model of the second virtual object and the second actual resource consumed in rendering the second virtual object based on the second LLD model is consistent with the processing process of the first virtual object, and will not be repeated here.
[0153] In step 1033, it is determined whether the sum of the first actual resource and the second actual resource is greater than the first part of the computing resources.
[0154] Specifically, when the sum of the first actual resource and the second actual resource is less than or equal to the first part of the computing resources, proceed to step 1034; when the sum of the first actual resource and the second actual resource is greater than the first part of the computing resources, proceed to step 1035.
[0155] For example, regarding pets, the base scene currently contains 50 pets. One pet, 'a', is selected as the first virtual object, and the remaining 49 pets are selected as the second virtual objects. The first actual resource for rendering pet 'a' and the second actual resources for rendering each of the remaining 49 pets are determined. The first actual resource of pet 'a' and the second actual resources of the remaining 49 pets are summed. If the sum is less than or equal to the first part of the computational resources, then each pet in the base scene can be rendered normally, and the first level of detail model of pet 'a' is the target level of detail model. If the sum is greater than the first part of the computational resources, it will cause frame drops due to insufficient performance, affecting the visual effect.
[0156] In step 1034, the first level of detail model is determined as the target level of detail model.
[0157] Here, the second level of detail model of the second virtual object is also determined as the target level of detail model for rendering the second virtual object.
[0158] In step 1035, the level of detail parameters of the first virtual object are determined based on the first rendering parameters and the first level of detail model, and the target level of detail model is determined from multiple level of detail models corresponding to the first virtual object based on the level of detail parameters.
[0159] Here, the level of detail (LOD) parameter is used to divide the multiple LOD models corresponding to the virtual object to be rendered. For example, dividing 0-100 results in multiple intervals, each interval corresponding to a LOD model. The number of interval boundaries is the LOD parameter: LOD1: 80, LOD2: 60, LOD3: 40, LOD4: 20, LOD5: 0. When the sum of the first and second actual resources exceeds the first part of the computational resources, for the first virtual object, the initial LOD parameter associated with the first LOD model can be converted based on the first rendering parameters of the first virtual object to obtain the LOD parameter of the first virtual object. The LOD level LOD model corresponding to the LOD parameter of the first virtual object is then determined as the target LOD model.
[0160] This application embodiment determines whether the sum of the first actual resources and the second actual resources is greater than a portion of the computing resources. This allows for dynamic adjustment of the detail level model, ensuring that the total resource requirement does not exceed the computing resources corresponding to the object type. This, in turn, ensures a balance between rendering quality and performance for different object types.
[0161] In some embodiments, the second level of detail model can also be a level of detail model at the same level as the first level of detail model, corresponding to the second virtual object. After determining the first level of detail model of the first virtual object in step 1031, for each object type corresponding to the first virtual object, other virtual objects to be rendered in the virtual scene belonging to that object type are determined as second virtual objects. The level of detail (LOD) of the first level of detail model of the first virtual object is determined. For each second virtual object, the level of detail model corresponding to the LOD level of the first level of detail model is determined from the multiple level of detail models corresponding to the second virtual object, and used as the second level of detail model of the second virtual object. Then, steps 1033 to 1035 are executed.
[0162] In some embodiments, see Figure 12 In step 1035, the detail level parameters of the first virtual object are determined based on the first rendering parameters and the first detail level model. This can be achieved through the following steps 10351 to 10353, which will be explained in detail below.
[0163] In step 10351, the mapping table is queried based on the first level of detail model.
[0164] The mapping table includes the relationship between candidate level-of-detail models and candidate level-of-detail parameters.
[0165] Here, each candidate level of detail parameter in the mapping table corresponds to a Level of Detail (LOD) level of a candidate LOD model. For example, the first virtual object has five LOD levels: LOD1, LOD2, LOD3, LOD4, and LOD5, with corresponding candidate level of detail parameters as follows: LOD1: 80, LOD2: 60, LOD3: 40, LOD4: 20, LOD5: 0. It should be noted that the magnitude of the candidate level of detail parameter is positively or negatively correlated with the LOD level and can be set according to actual needs. For example, in this embodiment, the higher the LOD level, the smaller the corresponding candidate level of detail parameter, and the higher the level of detail model has more detail, consuming more actual resources.
[0166] In step 10352, when a candidate level of detail model corresponding to the first level of detail model is found, the candidate level of detail parameters associated with the found candidate level of detail model are determined as the initial level of detail parameters.
[0167] Here, when a candidate level of detail model corresponding to the LOD level of the first level of detail model is found, the candidate level of detail parameters associated with the found candidate level of detail model are determined as the initial level of detail parameters.
[0168] In step 10353, the level of detail parameters of the first virtual object are determined based on the first rendering parameters and the initial level of detail parameters.
[0169] Here, the initial level of detail parameters can be converted based on the first rendering parameters to obtain the level of detail parameters of the first virtual object.
[0170] This application embodiment adjusts the initial level of detail parameters by adjusting the rendering parameters of the virtual object to be rendered in the virtual scene, so as to determine the final level of detail parameters. It can dynamically adjust the level of detail of each virtual object to be rendered according to the real-time virtual scene situation, so as to ensure that more important virtual objects to be rendered can be rendered with higher precision.
[0171] In this embodiment, the first rendering parameter includes a third rendering parameter and a fourth rendering parameter. The determination of the level of detail parameter of the first virtual object in step 10353 based on the first rendering parameter and the initial level of detail parameter can be achieved as follows: First, based on the third rendering parameter and the initial level of detail parameter, the first level of detail parameter of the first virtual object is determined; then, based on the fourth rendering parameter, an adjustment coefficient is determined, and the first level of detail parameter is adjusted based on the adjustment coefficient, and the adjusted first level of detail parameter is determined as the second level of detail parameter; finally, the second level of detail parameter is normalized to obtain the level of detail parameter of the first virtual object.
[0172] Here, the third rendering parameter can be a distance parameter, and the fourth rendering parameter can include at least one parameter representing the importance of the first virtual object. The initial level-of-detail parameter can be converted based on the distance parameter of the first virtual object in the virtual scene to obtain the first level-of-detail parameter of the first virtual object. The adjustment factor is a coefficient used to decrease or increase the first level-of-detail parameter. The adjustment factor can be determined based on the fourth rendering parameter, and the first level-of-detail parameter can be decreased or increased based on the adjustment factor to obtain the second level-of-detail parameter. For each object type, after obtaining the second level-of-detail parameters of each virtual object to be rendered for that object type through the above steps, the second level-of-detail parameter of the first virtual object can be normalized based on multiple second level-of-detail parameters to obtain the level-of-detail parameter of the first virtual object.
[0173] In this embodiment, the first level of detail parameter of the first virtual object is determined based on the third rendering parameter and the initial level of detail parameter. This can be achieved in the following way: First, multiple rendering parameter ranges are obtained, wherein the multiple rendering parameter ranges are obtained by dividing the value range of the field corresponding to the third rendering parameter; then, based on the rendering parameter range in which the third rendering parameter is located, the third rendering parameter is normalized to obtain the normalized third rendering parameter; finally, based on the normalized third rendering parameter, the initial level of detail parameter is transformed to obtain the first level of detail parameter of the first virtual object.
[0174] Here, based on the rendering parameter range in which the third rendering parameter is located, the normalization of the third rendering parameter can be achieved in the following way: obtain the maximum and minimum values in the rendering parameter range in which the third rendering parameter is located, take the difference between the third rendering parameter and the minimum value as the first difference, determine the difference between the maximum and the minimum value as the second difference, and determine the ratio of the first difference to the second difference as the normalized third rendering parameter.
[0175] Taking the distance parameter as the third rendering parameter as an example, the rendering parameter range is the distance parameter range. See Table 5. The distance parameter range in which the distance parameter is located can be determined from the distance parameter configuration table. Obtain the farthest distance and the nearest distance in this distance parameter range. Take the difference between the third rendering parameter and the nearest distance as the first difference, and the difference between the farthest distance and the nearest distance as the second difference. Take the ratio of the first difference to the second difference as the normalized third rendering parameter. Based on the normalized third rendering parameter, the parameter transformation of the initial level of detail parameter can be achieved in the following way: multiply the normalized third rendering parameter by the preset value, add the initial level of detail parameter, and obtain the first level of detail parameter of the first virtual object. The first level of detail parameter of the first virtual object can satisfy the following formula (1).
[0176] J = L + 20 × (S - Min) / (Max - Min) Formula (1)
[0177] Where J is the first level of detail parameter, 20 is the preset value, S is the third rendering parameter, Min is the minimum value of the rendering parameter range in which the third rendering parameter is located, and Max is the maximum value of the rendering parameter range in which the third rendering parameter is located.
[0178] In this embodiment, the adjustment coefficient is determined based on the fourth rendering parameter in the following ways: when the fourth rendering parameter indicates that the first virtual object is currently in an interactive state, the set coefficient is determined as the adjustment coefficient; when the fourth rendering parameter includes the first size parameter of the level of detail model corresponding to the first virtual object, the second size parameter of the level of detail model corresponding to the second virtual object is determined, and the average value of the first size parameter and the second size parameter is determined, and the adjustment coefficient is determined based on the first size parameter and the average value; when the fourth rendering parameter includes the orientation parameter of the first virtual object, the field of view orientation parameter of the camera in the virtual scene is obtained, and the adjustment coefficient is determined based on the orientation parameter and the field of view orientation parameter.
[0179] Here, "the virtual object to be rendered is currently in an interactive state" means that the user is interacting with the virtual object. For example, if the virtual object is a pet, the interactive state might be that the user is currently commanding or attacking the pet. The virtual object being interacted with needs to be displayed beforehand, therefore a preset coefficient is used. This coefficient can be set based on actual needs or can be the average value of coefficients set during the historical rendering process of the virtual scene, such as 20%. Since a larger level of detail parameter in this embodiment corresponds to a lower level of detail model, when the first virtual object is currently in an interactive state, the adjustment coefficient can be determined to be reduced by 20%. When the fourth rendering parameter can be used to characterize whether the first virtual object is currently in an interactive state, a value of "1" indicates that the first virtual object is currently in an interactive state, and a value of "0" indicates that the first virtual object is not currently in an interactive state.
[0180] As an example, Figure 13 This is a schematic diagram illustrating the virtual object to be rendered in an interactive state, as provided in an embodiment of this application. See also... Figure 13 In the virtual scene, the virtual objects to be rendered include: a user role 1301 (object type: role), and a first tree 1302 and a second tree 1303 (object type: tree). The user is instructing user role 1301 to interact with the second tree 1303 (e.g., climb the tree). Therefore, the fourth rendering parameter for user role 1301 and the second tree 1303 is 1, and the fourth rendering parameter for the first tree 1302 is 0. User role 1301 and the second tree 1303 should have a higher level of detail during rendering. For example, a corresponding adjustment factor is assigned to the second tree 1303 to adjust its first level of detail parameter, resulting in the level of detail parameter for the second tree 1303. Based on the level of detail parameter of the second tree 1303, a target level of detail model is determined for rendering the second tree 1303.
[0181] When the fourth rendering parameter includes the first size parameter of the level of detail model corresponding to the first virtual object, the first size parameter can be the model volume of the level of detail model. The level of detail model corresponding to the first level of detail parameter of the first virtual object can be determined, and the model volume of the level of detail model corresponding to the first level of detail parameter can be determined as the first size parameter. Obtain at least one other second virtual object of the same object type as the first virtual object, and determine the model volume of the level of detail model corresponding to each second virtual object when it is at the same LOD level as the first virtual object as the second size parameter. Divide the sum of the first size parameter and the second size parameter by the number of virtual objects to be rendered in the object type to obtain the average value of the first size parameter and the second size parameter. Determine the adjustment coefficient based on the ratio of the first size parameter to the average value. Adjust the first level of detail parameter based on the adjustment coefficient, and determine the adjusted first level of detail parameter as the second level of detail parameter. The second level of detail parameter can satisfy the following formula (2).
[0182] L2=L1×(1-m / M) Formula (2)
[0183] Where L2 is the second level of detail parameter, L1 is the first level of detail parameter, m is the first size parameter, M is the average of the first size parameter and the second size parameter, and m / M is the adjustment coefficient.
[0184] As an example, Figure 14 This is a schematic diagram illustrating the principle of rendering virtual objects with different levels of detail based on size parameters, as provided in this application embodiment. The virtual scene includes virtual objects to be rendered: Tree 1 (1402) and Tree 2 (1401). The level of detail model corresponding to the first level of detail parameter of Tree 1 can be obtained, and the model volume of the level of detail model corresponding to the first level of detail parameter is determined as the first size parameter. The level of detail model corresponding to the level of detail parameter of Tree 1 is obtained, and the model volume of the level of detail model corresponding to the level of detail parameter is determined as the second size parameter. The sum of the first size parameter and the second size parameter is divided by the number of virtual objects to be rendered in this object type to obtain the average value of the first size parameter and the second size parameter. The adjustment coefficient of Tree 1 is determined based on the ratio of the first size parameter to the average value, and the adjustment coefficient of Tree 2 is determined based on the ratio of the second size parameter to the average value. The first size parameter of Tree 1 is greater than the second size parameter of Tree 2; therefore, the adjustment coefficient of Tree 1 is greater than the adjustment coefficient of Tree 2. The final target level of detail model determined for Tree 1 is higher than that for Tree 2, resulting in a higher level of rendering detail for Tree 1.
[0185] When the fourth rendering parameter includes the orientation parameter of the first virtual object, the orientation parameter is the orientation vector of the first virtual object relative to the camera origin in the camera coordinate system of the virtual scene. The camera's field of view orientation parameter refers to the orientation or field of view of the camera in the virtual scene, that is, the direction seen by the player, and can be represented as a vector relative to the camera origin. When the orientation parameter and the field of view orientation parameter are the same, or the difference between the orientation parameter and the field of view orientation parameter is less than a preset threshold, or the similarity between the orientation parameter and the field of view orientation parameter is greater than a preset similarity threshold, the first virtual object is located in front of the user's field of view and should be displayed first. A preset coefficient can be determined as the adjustment coefficient, for example, reduced by 20%.
[0186] In some embodiments, there can be multiple fourth rendering parameters, including a fourth rendering parameter indicating whether the first virtual object is currently in an interactive state, a first size parameter, and a direction parameter, etc. When the fourth rendering parameter indicates that the first virtual object is currently in an interactive state, a set coefficient can be determined as a first adjustment coefficient, and the first level of detail parameter can be adjusted based on the first adjustment coefficient. Then, a second adjustment coefficient is determined based on the first size parameter, and the first level of detail parameter adjusted by the first adjustment coefficient is adjusted based on the second adjustment coefficient to obtain an intermediate level of detail parameter. Finally, a third adjustment coefficient is determined based on the direction parameter, and the intermediate level of detail parameter is adjusted based on the third adjustment coefficient to obtain the second level of detail parameter of the first virtual object.
[0187] This application embodiment determines the adjustment parameters for adjusting the first level of detail parameters by using a fourth rendering parameter other than the distance parameter. The final second level of detail parameters can be calculated based on the screen ratio data, distance, user operation and other parameters when the model is actually displayed. Based on the second level of detail parameters, the true target level of detail model is determined, ensuring that the more important virtual objects to be rendered have a higher precision display effect.
[0188] In this embodiment, after obtaining the second level of detail parameters of each virtual object to be rendered, for each object type, the maximum value of the second level of detail parameters corresponding to each virtual object to be rendered of that object type is obtained. Based on the maximum value of the parameters, the second level of detail parameters of the first virtual object are normalized to obtain the level of detail parameters of the first virtual object. The level of detail parameters of the first virtual object can satisfy the following formula (3).
[0189]
[0190] Where Li is the detail level parameter of the first virtual object, and Lmax is the maximum value of the parameter.
[0191] In some embodiments, see Figure 15In step 1035, the target level of detail model is determined from multiple level of detail models corresponding to the first virtual object based on the level of detail parameters. This can be achieved through the following steps 10354 to 10357, which are explained in detail below.
[0192] In step 10354, the mapping table is queried based on the level of detail parameters.
[0193] The mapping table includes the association between the candidate level of detail model and the candidate level parameter range of the first virtual object. The candidate level parameter range is obtained by dividing the value range of the fields corresponding to the level of detail parameters.
[0194] Here, the mapping table is the same as the mapping table in step 10351, and will not be repeated. For example, the value range of the field corresponding to the level of detail parameter can be 0-100, which divides the data into 5 candidate level parameter ranges. The relationship between the 5 candidate level parameter ranges and the LOD level of the candidate level of detail model is as follows: (80, 100], LOD1; (60, 80], LOD2; (40, 60], LOD3; (20, 40], LOD4; (0, 20], LOD5.
[0195] In step 10355, when a candidate level parameter interval corresponding to the level of detail parameter is found, the candidate level of detail model associated with the found candidate level parameter interval is determined as the third level of detail model.
[0196] For example, if the level of detail parameter of the first virtual object is 65, then the candidate level of detail parameter range corresponding to the level of detail parameter is (60, 80], and the candidate level of detail model associated with the candidate level of detail parameter range (60, 80] is a level of detail model at the LOD2 level. The level of detail model at the LOD2 level corresponding to the first virtual object is determined as the third level of detail model.
[0197] In step 10356, the third actual resource consumed by rendering the first virtual object based on the third level of detail model is determined, and the fourth actual resource consumed by rendering the second virtual object based on the fourth level of detail model is determined.
[0198] Among them, the fourth level of detail model is determined from multiple level of detail models corresponding to the second virtual object based on the level of detail parameters of the second virtual object.
[0199] Here, the specific process of determining the third actual resource consumed in rendering the first virtual object based on the third level of detail model and the fourth actual resource consumed in rendering the second virtual object based on the fourth level of detail model is basically the same as in the above embodiments, and will not be repeated here.
[0200] In step 10357, when the sum of the third actual resources and the fourth actual resources is greater than the first part of the computing resources, and the level of the third level of detail model is higher than the first level threshold and lower than the second level threshold, the third level of detail model is downgraded to obtain the target level of detail model.
[0201] The second-level threshold is greater than the first-level threshold.
[0202] Here, the first-level threshold and the second-level threshold are both the LOD levels of the multiple level-of-detail models corresponding to the first virtual object. The specific values of the first-level threshold and the second-level threshold can be set according to actual needs. For example, if the second-level threshold is LOD3 and the first-level threshold is LOD1, then when the third actual resources consumed by the third level-of-detail model of the first virtual object and the sum of the fourth actual resources consumed by the current fourth level-of-detail models of multiple second virtual objects are greater than the first part of the computing resources, if the LOD level of the third level-of-detail model of the first virtual object is LOD2, the third level-of-detail model is downgraded to obtain the target level-of-detail model of LOD1.
[0203] Alternatively, from the third level of detail model and multiple fourth level of detail models, a level of detail model with a level higher than the first level threshold and lower than the second level threshold can be selected and downgraded. It should be noted that if, after one downgrade, the sum of the third actual resources consumed by the third level of detail model of the first virtual object and the fourth actual resources consumed by the current fourth level of detail models of multiple second virtual objects still exceeds the first part of the computing resources, then downgrading can continue according to the above rules until the upper limit requirement of the first part of the computing resources is met.
[0204] In this embodiment of the application, when the total actual resources consumed by each virtual object to be rendered in an object type exceed the partial computing resources of that object type, the level of detail model is downgraded, which can ensure device performance and improve rendering effect and stability.
[0205] In step 104, the first virtual object is rendered in the virtual scene based on the target level of detail model.
[0206] Here, the first virtual object can be rendered in the virtual scene based on the geometric and texture data of the target detail model.
[0207] This application embodiment allocates the device's total computing resources according to the object type of the virtual object to be rendered, obtains partial computing resources corresponding to different object types, and combines the partial computing resources with the first rendering parameters of the first virtual object to determine an accurate and suitable target level of detail model. This enables differentiated rendering strategies to be adopted for virtual objects of different object types, and optimizes resource consumption while ensuring the visual effect of the virtual scene.
[0208] In some embodiments, see Figure 16 After rendering the first virtual object in the virtual scene based on the target level of detail model in step 104, the virtual object rendering method provided in this application embodiment may further include the following steps 105 to 107:
[0209] In step 105, the display frame rate of the virtual scene is obtained.
[0210] Here, frame rate, usually measured in frames per second (FPS), refers to the number of image frames of a virtual scene displayed per unit of time (usually one second). In a virtual scene, frame rate directly affects the smoothness and responsiveness of the visuals. Clients can directly capture the frame rate of the virtual scene.
[0211] In step 106, when the display frame rate is less than the frame rate threshold, the target level of detail model is downgraded to obtain an updated target level of detail model.
[0212] Here, the frame rate threshold can be set by the user in the application, or determined based on the average of multiple display frame rates corresponding to periods of choppy rendering in history. When the display frame rate is lower than the frame rate threshold, the target level of detail model is downgraded to obtain an updated target level of detail model. When the display frame rate is greater than or equal to the frame rate threshold, the target level of detail model is not modified.
[0213] In step 107, the corresponding first virtual object is rendered in the virtual scene based on the updated target detail level model.
[0214] Here, the corresponding first virtual object can be rendered in the virtual scene based on the updated geometric and texture data of the target level of detail model.
[0215] This application embodiment ensures rendering stability by real-time acquisition of the display frame rate and downgrading the rendering of the target detail level model of the first virtual object when the display frame rate is lower than the frame rate threshold.
[0216] In some embodiments, after rendering the corresponding first virtual object in the virtual scene, the current device parameters of the device are determined; the computing resource configuration file is queried based on the current device parameters to obtain the processor parameter range corresponding to the current device parameters; when the processor parameter range when running the virtual scene is different from the processor parameter range corresponding to the current device parameters, the operation of determining the total computing resources allocated for the virtual scene is re-executed.
[0217] This application embodiment determines whether the device parameters have changed after rendering the virtual object, and can collect changes in the total computing resources that the device can support in real time, thereby updating the target detail level model of the virtual object to be rendered in real time, improving the balance between rendering efficiency and visual effects.
[0218] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0219] The following explanation uses a virtual game scenario as an example:
[0220] In games, a large number of models may be displayed simultaneously, requiring significant CPU and GPU computing resources. This could exceed the system's performance limits, leading to frame drops and impacting user experience. This application proposes a virtual object rendering method, which is also an adaptive performance optimization method based on Level of Detail (LOD). It determines the performance budget for different types of models based on the actual user experience requirements of various scenarios, and determines the final display LOD level based on the priority of different models within the same category. This allows for optimal LOD settings under performance constraints, balancing user experience and performance. To achieve this solution, at least the following issues need to be addressed: Establishing LOD models of different levels for each model, enabling the display of different LOD levels under varying performance budgets, and controlling the number of visible faces and DC. Setting different priorities for models in different game scenarios, and calculating the final priority coefficient based on the screen-to-body ratio data of the actual model display to derive the final display priority and allocate performance budgets. Determining the final LOD level based on the performance budget of each model.
[0221] Figure 17 This is a schematic diagram of the modules of the virtual object rendering system provided in an embodiment of this application. See also... Figure 17The virtual object rendering system provided in this application embodiment includes a game client 500 and a game server 510. The game server 510 includes a Level of Detail (LOD) management module 511, a priority strategy control module 512, and a client control module 513. The LOD management module 511 calculates and stores relevant performance data (corresponding to the actual resources in the above embodiments) based on the LOD model (corresponding to the LOD model in the above embodiments) designed for each model (corresponding to the virtual object to be rendered in the above embodiments). The priority strategy control module 512 manages and stores the priority control strategies for each model. The client control module 513 receives requests from the game client and distributes the performance data of each LOD model and the priority control strategies for each model (corresponding to the first resource weight and resource weight increment parameters in the above embodiments). The game client 500 includes a strategy management module 501, a budget control module 502, and a priority management module 503. The strategy management module 501 requests priority control strategies from the game server and caches them locally for use when displaying models. The budget control module 502 is used to calculate the performance budget (corresponding to a portion of the computing resources in the above embodiments) that can be used for each type of model when entering a new virtual scene, based on the cache priority control strategy. The priority management module 503 is used to calculate the display priority (corresponding to the level of detail parameter in the above embodiments), that is, the LOD level, for each model based on the performance budget and the current actual state (corresponding to the rendering parameters in the above embodiments).
[0222] During game operation, the most important computing resources are the CPU and GPU. The number of DCs directly affects the CPU's computational load, and the number of faces in the displayed model directly affects the GPU's computational load. Therefore, controlling the number of DCs and faces becomes crucial for performance optimization. The performance budget in the following description mainly refers to these two core metrics: the number of DCs and faces. In this embodiment, by pre-designing the number of DCs and faces (actual resource consumption) corresponding to different LOD levels of the displayed model (corresponding to multiple levels of detail models of the virtual object in the above embodiments), in high-load scenarios, a suitable LOD is determined based on the model's priority, thereby controlling the overall number of DCs and faces.
[0223] The performance budget management process in this embodiment is described below. First, the total available performance budget is determined. The CPU and GPU computing capabilities of each type of terminal vary significantly. Therefore, simulation calculations are needed based on the terminal model (corresponding to the device model in the above embodiment) to confirm the total available performance budget (corresponding to the total computing resources in the above embodiment). Furthermore, during actual gameplay, the game does not exclusively utilize all computing resources; the operating system and other background applications also partially consume system resources. Therefore, it is also necessary to calculate the performance budget that the CPU and GPU can provide to the game under different operating conditions. Once these details are obtained, they are stored in a table. The game client can retrieve the currently supported performance budget by querying this data during gameplay. Referring to Tables 1 and 2, the CPU and GPU operating frequencies and utilization rates are pre-divided into multiple intervals, and the maximum performance that the terminal can support for each interval is collected.
[0224] Next, determine the available performance budget (partial computing resources) for each type of model (object type). After determining the total performance budget, the display effect of different types of models (corresponding to the object types in the above embodiments) has a different impact on the user experience. Therefore, it is also necessary to determine the performance budget that can be allocated to different types of models according to different scenarios (virtual scenarios). Taking an open-world pet raising game as an example, the following types of models may exist in the player's base scene. The priority control strategy for each type of model is as follows: User roles, including the user's own role, and there may also be multiple roles of other users at the same time. The default is 1 role (corresponding to the initial number in the above embodiments). For each additional role (corresponding to the preset number in the above embodiments), the performance budget (corresponding to the increase ratio in the above embodiments) increases by 20%, with an increase limit (corresponding to the increase ratio limit in the above embodiments) of 100%. Pets, including the player's pets, pets in the open world, and pets of other characters, etc., the default is 10. For each additional 10, the performance budget increases by 20%, with an increase limit of 100%. Buildings, various buildings in the open world, the default is 5. For each additional 5, the performance budget increases by 10%, with an increase limit of 50%. Trees: The default number of trees in the open world is 10. For every additional 10 trees, the performance budget increases by 5%, with a maximum increase of 20%. Rocks: The default number of rocks or mountains in the open world is 5. For every additional 5 rocks, the performance budget increases by 5%, with a maximum increase of 20%. Meanwhile, the baseline performance budget allocation ratios for different models in each scene are stored in a table, resulting in Table 3.
[0225] During game operation, the baseline performance budget for each model (corresponding to the first resource weight in the above embodiment) is obtained through Table 3. Simultaneously, the actual number of each type of model is calculated, and the final performance budget for each type of model is derived. The process for determining the baseline performance budget for each model is as follows: A typical base scene is constructed, and multiple experiments are conducted to find the budget allocation that achieves the highest terminal frame rate, thus obtaining the baseline performance budget for each model. The number of model types in the same scene remains fixed, but the number of each type of model changes according to the user's perspective in the game. For example, the total budget performance is 500 DCs and 800,000 polygons. In the base scene, the baseline performance budget for each type of model is: User Character: 20; Pet: 40; Building: 20; Tree: 10; Rock: 10. The number of each type of model is as follows: User Character: 4; Pet: 50; Building: 19; Tree: 60; Rock: 20. Based on the aforementioned rules (corresponding to the resource weight incrementing parameters in the above embodiments), the weighted performance budgets for each type of model (corresponding to the second resource weight in the above embodiments) can be obtained: User Role: 20(1+60%) = 32, Pet: 40(1+80%) = 72, Building: 20(1+30%) = 26, where 14 buildings are added, and the part less than 5 is calculated as 5, so it increases by 30%; Tree: 10(1+20%) = 12, 60 trees, reaching the upper limit. Rock: 10(1+15%) = 11.5. It can be concluded that the final DC limit available to the user role is: 500×32 / (32+72+26+12+11.5) = 104, and the upper limit of the number of faces that can be used is: 800000×32 / (32+72+26+12+11.5) = 166775. The calculation method for the available performance budget of the basic type model is the same.
[0226] The following describes the LOD level control process for the model in this embodiment. Models displayed in the game can have different levels of precision due to factors such as distance and user attention. Different precisions require different numbers of DCs and faces. Therefore, it is necessary to accurately determine the required number of DCs and faces for models of different precisions. The LOD level and required performance are different for each model (even if the object type is the same), as recorded in Table 4. Generally, using distance (the distance from the model to the user's field of view, with the model as the endpoint and the camera's reference point as the starting point) to determine the model's LOD level does not pose a significant problem under light loads. However, when performance bottlenecks occur, this approach can lead to frame drops due to insufficient performance, affecting the user experience. Therefore, targeted optimization is required, and the specific methods are as follows:
[0227] The performance budget for each model type is determined according to the aforementioned method. The initial LOD priority is set based on distance in Table 5. The LOD level of each model under each model type is calculated, and then the face count and DC count (the sum of actual resources) of the current LOD level are determined according to the aforementioned steps. It is determined whether the current LOD level is lower than the overall performance budget (both DC count and face count must be met). If it is lower, the current LOD level is used directly; otherwise, the following steps are performed to calculate the model object priority. First, distance conversion is performed. A default priority value (corresponding to the initial level of detail parameter in the above embodiment) is set for each LOD level as follows: LOD1: 80, LOD2: 60, LOD3: 40, LOD4: 20, LOD5: 0. The corresponding value J (corresponding to the first level of detail parameter in the above embodiment) is calculated based on the above formula (1) and distance, where J is the final calculated priority of the current model, L is the default priority of the initial LOD level set by the aforementioned distance; S is the actual distance of the current model (distance parameter); Max is the maximum distance of the current LOD level, and Min is the minimum distance of the current LOD level. Then, the game state influence is judged. In-game operations can also affect the display priority of models. For example, the pet that the user is currently commanding or attacking needs to be displayed first, so the priority needs to be reduced by 20%. In addition, the screen ratio of the model is also a factor affecting the priority. For the same type of model, if the size is larger, it should theoretically be displayed at a higher LOD level to ensure the display effect. The new priority of the current model is calculated according to formula (2) (corresponding to the second level of detail parameter in the above embodiment). Among them, L2 is the new priority of the current model, L1 is the priority J of the current model calculated in the previous steps, m is the size of the current model, and M is the average size of this type of model. In addition, L2 can be recalculated based on the display ratio of the model in the current scene. Other parameters can also be added: for example, whether the model is in the forward direction of the user's field of vision. The priority calculated in the above steps is normalized, that is, the priority data is converted into a number between 0 and 100. The calculation method satisfies the above formula (3). Among them, Li is the final priority of the i-th model, L2 is the priority of the i-th model calculated in the above steps, and Lmax is the maximum priority of this type of model. Determine the new LOD level and map the LOD levels according to the final priority, as follows: (80, 100], LOD1; (60, 80], LOD2; (40, 60], LOD3; (20, 40], LOD4; (0, 20], LOD5.
[0228] Finally, sequential LOD degradation can be performed. If the performance budget required by the new LOD level is still higher than the performance budget of that type of model, then the lowest priority model is demoted one LOD level, starting from LOD2. If the new result still does not meet the performance budget requirement, this degradation process continues until the performance budget requirement can be met.
[0229] Figure 18 This is a schematic diagram of the multi-level detail strategy update process provided in an embodiment of this application. See also... Figure 18 The following is the process of obtaining the LOD strategy during client initialization.
[0230] Step 601: Start the game.
[0231] For example, when the game client starts, this process is initiated to obtain the LOD control strategy from the game server.
[0232] Step 602: Obtain strategy data.
[0233] The strategy data, also known as the LOD strategy, includes the performance data of each LOD model (corresponding to the actual resources consumed by each level of detail model of the virtual object in the above embodiments), and the priority control strategy of each model (corresponding to the first resource weight and the resource weight increment parameter in the above embodiments). After the game server receives the request from the game client, it queries the corresponding LOD strategy from the database and sends it to the client.
[0234] Step 603, cache strategy data.
[0235] For example, after receiving the LOD policy from the game server, the game client caches it locally for use during game execution.
[0236] Step 604, process ends.
[0237] For example, once the game client has completed caching the LOD strategy, the process of obtaining the LOD strategy during client initialization ends.
[0238] See Figure 18 Below is the process for the game server to periodically update the LOD strategy.
[0239] Step 401, Start.
[0240] For example, the game server starts in the background at regular intervals (regardless of whether the game is running) to process newly added models and scenes.
[0241] Step 402: Determine if there is a new model.
[0242] For example, the presence of a new model can be determined by checking whether a model has been added or modified. Specifically, determining if a new model has been added can be achieved by checking if a new model ID (corresponding to the object identifier in the above embodiment) exists. If a new model ID exists, it indicates that a new model has been added. Determining if a model has been modified can be achieved by checking if, for each model, a new or modified level-of-detail model exists. If such a model exists, it indicates that a modified model has been added. If no new or modified models are found, proceed to step 405; if so, proceed to step 403.
[0243] Step 403: Import the level of detail model data.
[0244] For example, if a new or modified model is added, the performance budget (corresponding to the actual resources in the above embodiments) required for displaying the Level of Detail (LOD) model at each level of the model is calculated and stored.
[0245] Step 404: Update the scene budget.
[0246] For example, if a model is added or modified in the scenario, the performance budget data for different types of models in that scenario (corresponding to some computing resources in the above embodiments) is updated. Alternatively, if a scenario is added or modified, the scenario control strategy related to that scenario is updated (corresponding to the first resource weight of each object type in the virtual scenario in the above embodiments). After this step is completed, proceed to step 407.
[0247] Step 405: Determine if there are any new scenarios.
[0248] For example, the presence of a new scenario can be determined by checking whether a new scenario has been added or modified. A new scenario can be identified based on its scenario ID (scenario identifier). Determining if a scenario has been modified can be achieved as follows: For each scenario, check if the scenario control policy has been modified. If a new scenario exists, proceed to step 404 to update the corresponding scenario control policy; otherwise, proceed to step 406.
[0249] Step 406, process ends.
[0250] For example, if there are no newly modified models or scene updates, the process of the game server periodically updating the LOD strategy ends.
[0251] Step 407: Update the model priority strategy.
[0252] For example, based on the aforementioned steps and the new scenario and model data, update the priority control strategy for each model.
[0253] Figure 19 This is a schematic diagram of the process shown in the model provided in the embodiment of this application.
[0254] Step 701: Begin scene display.
[0255] For example, this process can be initiated when a new scene begins or when the scene content changes.
[0256] Step 702: Obtain the terminal running status.
[0257] The operating status includes the operating frequency and utilization of the CPU and GPU, and the operating frequency and utilization of the CPU and GPU are obtained.
[0258] Step 703: Calculate the performance budget.
[0259] For example, the overall available performance budget (total computing resources) is determined based on the terminal's operating status, and the available performance budget (partial computing resources) for various models is further calculated based on the priority control strategy of the local cache.
[0260] Step 704, determine the model.
[0261] For example, based on the performance budget available for each type of model and a priority control strategy for local caching, the LOD model (corresponding to the target level of detail model in the above embodiments) for each model is calculated.
[0262] Step 705: Render the model.
[0263] For example, the actual rendering of the model is performed based on the calculated LOD model.
[0264] Step 706: Display the model.
[0265] For example, the rendered model is sent to the terminal, and the rendered model is displayed to the user on the game client interface on the terminal, and the terminal's running status is collected again.
[0266] Step 707: Determine if the running status has changed.
[0267] For example, if the operating frequency or utilization rate changes within a certain range, proceed to step 703 to recalculate the performance budget for each model and then redetermine the actual LOD model displayed for each model; if there is no change, proceed to step 708.
[0268] Step 708, process ends.
[0269] For example, end the current process and collect changes in the scene, such as changes in the number of models in the scene or entering a new scene, and then start a new process.
[0270] This application embodiment employs unified performance budget management, setting different priorities for different models based on different scenarios. This ensures that the highest priority model maintains the best LOD level, thus balancing user experience while reducing polygon count and DC, maintaining stable frame rate and power consumption. This application embodiment differentiates between different scenarios and screen ratios, setting specific priorities for each type of model to achieve global performance budget management. Models exceeding the budget automatically undergo LOD degradation, thereby achieving a balance between performance and display effect in any scenario.
[0271] It is understood that in the embodiments of this application, data such as user information are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.
[0272] The following description continues to illustrate the exemplary structure of the virtual object rendering device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software module in the rendering device 455 storing the virtual object in the memory 450 may include:
[0273] The total resource determination module 4551 is used to determine the total computing resources allocated for the virtual scene;
[0274] The partial resource determination module 4552 is used to determine the object type corresponding to at least one virtual object to be rendered in the virtual scene, and to determine the partial computing resources corresponding to the object type from the total computing resources.
[0275] The model determination module 4553 is used to obtain the first rendering parameters of the first virtual object in at least one virtual object to be rendered, and to determine the target level of detail model for rendering the first virtual object based on the first rendering parameters and the first part of the computing resources corresponding to the first object type of the first virtual object. The first virtual object rendered based on different level of detail models has different levels of detail.
[0276] Rendering module 4554 is used to render the first virtual object in the virtual scene based on the target level of detail model.
[0277] In some embodiments, the partial resource determination module 4552 is further configured to perform the following processing for each object type: determine the number of virtual objects to be rendered belonging to the object type in the virtual scene; obtain the first resource weight of the object type in the virtual scene; obtain the resource weight increment parameter corresponding to the object type, wherein the resource weight increment parameter is used to indicate that the first resource weight is increased according to the number; and determine the partial computing resources corresponding to the object type from the total computing resources based on the number, the first resource weight and the resource weight increment parameter.
[0278] In some embodiments, the partial resource determination module 4552 is further configured to obtain a resource weight configuration file, wherein the resource weight configuration file includes a scene configuration table for different candidate virtual scenes, and the scene configuration table includes the association between candidate object types and candidate resource weights; obtain the scene identifier of the virtual scene, query the resource weight configuration file based on the scene identifier, and when a candidate virtual scene corresponding to the scene identifier is found, determine the scene configuration table of the found candidate virtual scene as the scene configuration table for the virtual scene; query the scene configuration table for the virtual scene based on the object type, and when a candidate object type corresponding to the object type is found, determine the candidate resource weight associated with the found candidate object type as the first resource weight of the object type in the virtual scene.
[0279] In some embodiments, the partial resource determination module 4552 is further configured to increase a first resource weight based on the resource weight increment parameter and the quantity, and determine the increased first resource weight as a second resource weight; normalize the second resource weight to obtain a normalized resource weight; allocate total computing resources based on the normalized resource weight, and determine the allocated computing resources as the partial computing resources corresponding to the object type.
[0280] In some embodiments, the resource weight increment parameters include the initial number of virtual objects to be rendered corresponding to the object type, the increase ratio of the resource weight when a preset number of virtual objects to be rendered are added, and the upper limit of the increase ratio. The partial resource determination module 4552 is further used to determine the weight increase ratio corresponding to the object type based on the initial number, the number, and the increase ratio; when the weight increase ratio is less than the upper limit of the increase ratio, the first resource weight is increased based on the weight increase ratio; when the weight increase ratio is greater than or equal to the upper limit of the increase ratio, the first resource weight is increased based on the upper limit of the increase ratio.
[0281] In some embodiments, the model determination module 4553 is further configured to determine a first level of detail model from multiple level of detail models corresponding to a first virtual object based on first rendering parameters; determine a first actual resource consumed in rendering the first virtual object based on the first level of detail model, and determine a second actual resource consumed in rendering the second virtual object based on a second level of detail model, wherein the second level of detail model is determined from multiple level of detail models corresponding to the second virtual object based on the second rendering parameters of the second virtual object, and the second virtual object is a virtual object of the same object type as the first virtual object among at least one virtual object to be rendered; when the sum of the first actual resource and the second actual resource is greater than the first part of the computing resources, determine the level of detail parameters of the first virtual object based on the first rendering parameters and the first level of detail model, and determine a target level of detail model from multiple level of detail models corresponding to the first virtual object based on the level of detail parameters.
[0282] In some embodiments, the model determination module 4553 is further configured to query a mapping table based on the first level of detail model, wherein the mapping table includes the association between candidate level of detail models and candidate level of detail parameters; when a candidate level of detail model corresponding to the first level of detail model is found, the candidate level of detail parameters associated with the found candidate level of detail model are determined as initial level of detail parameters; and the level of detail parameters of the first virtual object are determined based on the first rendering parameters and the initial level of detail parameters.
[0283] In some embodiments, the first rendering parameter includes a third rendering parameter and a fourth rendering parameter; the model determination module 4553 is further configured to determine the first level of detail parameter of the first virtual object based on the third rendering parameter and the initial level of detail parameter; determine the adjustment coefficient based on the fourth rendering parameter, and adjust the first level of detail parameter based on the adjustment coefficient, and determine the adjusted first level of detail parameter as the second level of detail parameter; normalize the second level of detail parameter to obtain the level of detail parameter of the first virtual object.
[0284] In some embodiments, the model determination module 4553 is further configured to obtain multiple rendering parameter ranges, wherein the multiple rendering parameter ranges are obtained by dividing the value range of the field corresponding to the third rendering parameter; based on the rendering parameter range in which the third rendering parameter is located, the third rendering parameter is normalized to obtain the normalized third rendering parameter; based on the normalized third rendering parameter, the initial level of detail parameter is transformed to obtain the first level of detail parameter of the first virtual object.
[0285] In some embodiments, the model determination module 4553 is further configured to: determine the setting coefficient as the adjustment coefficient when the fourth rendering parameter indicates that the first virtual object is currently in an interactive state; determine the second size parameter of the level of detail model corresponding to the second virtual object when the fourth rendering parameter includes the first size parameter of the level of detail model corresponding to the first virtual object, and determine the average value of the first size parameter and the second size parameter, and determine the adjustment coefficient based on the first size parameter and the average value; and obtain the field of view direction parameter of the camera in the virtual scene when the fourth rendering parameter includes the orientation parameter of the first virtual object, and determine the adjustment coefficient based on the orientation parameter and the field of view direction parameter.
[0286] In some embodiments, the model determination module 4553 is further configured to query a mapping table based on the level of detail parameters, wherein the mapping table includes the association between candidate level of detail models of the first virtual object and candidate level of detail parameter intervals, and the candidate level of detail parameter intervals are obtained by dividing the value intervals of the fields corresponding to the level of detail parameters; when a candidate level of detail parameter interval corresponding to the level of detail parameter is found, the candidate level of detail model associated with the found candidate level of detail parameter interval is determined as the third level of detail model; the third actual resource consumed by rendering the first virtual object based on the third level of detail model is determined, and the fourth actual resource consumed by rendering the second virtual object based on the fourth level of detail model is determined, wherein the fourth level of detail model is determined from multiple level of detail models corresponding to the second virtual object based on the level of detail parameters of the second virtual object; when the sum of the third actual resource and the fourth actual resource is greater than the first part of the computing resources, and the level of the third level of detail model is higher than the first level threshold and lower than the second level threshold, the third level of detail model is downgraded to obtain the target level of detail model, wherein the second level threshold is greater than the first level threshold.
[0287] In some embodiments, the rendering apparatus 455 for virtual objects further includes a model update module, which is used to obtain the display frame rate of the virtual scene; when the display frame rate is less than the frame rate threshold, the target level of detail model is downgraded to obtain an updated target level of detail model; and based on the updated target level of detail model, the corresponding first virtual object is rendered in the virtual scene.
[0288] In some embodiments, the total resource determination module 4551 is used to obtain a computing resource configuration file, wherein the computing resource configuration file includes the association between candidate device parameters and candidate computing resources; obtain device parameters when the device runs a virtual scene, and query the computing resource configuration file based on the device parameters when running the virtual scene; when a candidate device parameter corresponding to the device parameter is found, the candidate computing resources associated with the found candidate device parameter are determined as the total computing resources allocated for the virtual scene.
[0289] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the virtual object rendering method described above in this application.
[0290] This application provides a computer-readable storage medium storing computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the virtual object rendering method provided in this application. For example, ... Figure 3 The rendering method of the virtual object is shown.
[0291] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0292] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0293] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0294] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0295] In summary, through the embodiments of this application, the game can distinguish the display priority of each model according to the actual changes in terminal performance and different scenes, thereby ensuring that the most important model can still maintain the best LOD level. This not only takes into account the best visual performance, but also reduces the number of faces and DCs, and maintains the stability of frame rate and power consumption.
[0296] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A method for rendering virtual objects, characterized in that, The method includes: Determine the total computing resources allocated to the virtual scene; Determine the object type corresponding to at least one virtual object to be rendered in the virtual scene, and determine the portion of computing resources corresponding to each object type from the total computing resources; The first rendering parameters of the first virtual object in the at least one virtual object to be rendered are obtained, and based on the first rendering parameters and the first part of the computing resources corresponding to the first object type of the first virtual object, a target level of detail model for rendering the first virtual object is determined, wherein the first virtual object rendered based on different level of detail models has different levels of detail. Based on the target level of detail model, the first virtual object is rendered in the virtual scene.
2. The method according to claim 1, characterized in that, The step of determining the portion of computing resources corresponding to the object type from the total computing resources includes: Perform the following processing for each of the aforementioned object types: Determine the number of virtual objects of the object type to be rendered in the virtual scene; Obtain the first resource weight of the object type in the virtual scene; Obtain the resource weight increment parameter corresponding to the object type, wherein the resource weight increment parameter is used to indicate that the first resource weight is increased according to the quantity; Based on the quantity, the first resource weight, and the resource weight increment parameter, a portion of the computing resources corresponding to the object type is determined from the total computing resources.
3. The method according to claim 2, characterized in that, The step of obtaining the first resource weight of the object type in the virtual scene includes: Obtain a resource weight configuration file, wherein the resource weight configuration file includes a scene configuration table for different candidate virtual scenes, and the scene configuration table includes the association between candidate object types and candidate resource weights; Obtain the scene identifier of the virtual scene, query the resource weight configuration file based on the scene identifier, and when a candidate virtual scene corresponding to the scene identifier is found, determine the scene configuration table of the candidate virtual scene as the scene configuration table for the virtual scene. Based on the object type, query the scene configuration table for the virtual scene. When a candidate object type corresponding to the object type is found, the candidate resource weight associated with the found candidate object type is determined as the first resource weight of the object type in the virtual scene.
4. The method according to claim 2, characterized in that, The step of determining the portion of computing resources corresponding to the object type from the total computing resources based on the quantity, the first resource weight, and the resource weight increment parameter includes: Based on the resource weight increment parameter and the quantity, the first resource weight is increased, and the increased first resource weight is determined as the second resource weight. The second resource weight is normalized to obtain the normalized resource weight; The total computing resources are allocated based on the normalized resource weights, and the allocated computing resources are determined as a portion of the computing resources corresponding to the object type.
5. The method according to claim 4, characterized in that, The resource weight increment parameter includes the initial number of virtual objects to be rendered corresponding to the object type, the increase ratio of resource weight when a preset number of virtual objects to be rendered are added, and the upper limit of the increase ratio; The step of increasing the weight of the first resource based on the resource weight increment parameter and the quantity includes: Based on the initial quantity, the quantity, and the increase ratio, determine the weight increase ratio corresponding to the object type; When the weight increase ratio is less than the upper limit of the increase ratio, the weight of the first resource is increased based on the weight increase ratio. When the weight increase ratio is greater than or equal to the upper limit of the increase ratio, the weight of the first resource is increased based on the upper limit of the increase ratio.
6. The method according to any one of claims 1 to 5, characterized in that, The step of determining the target hierarchy of detail model for rendering the first virtual object based on the first rendering parameters and the first portion of computing resources corresponding to the first object type of the first virtual object includes: The first level of detail model is determined from multiple level of detail models corresponding to the first virtual object based on the first rendering parameters; The first actual resource consumed in rendering the first virtual object based on the first level of detail model is determined, and the second actual resource consumed in rendering the second virtual object based on the second level of detail model is determined. The second level of detail model is determined from multiple level of detail models corresponding to the second virtual object based on the second rendering parameters of the second virtual object. The second virtual object is the virtual object to be rendered that is of the same object type as the first virtual object among the at least one virtual object to be rendered. When the sum of the first actual resource and the second actual resource is greater than the first part of the computing resources, the level of detail parameters of the first virtual object are determined based on the first rendering parameters and the first level of detail model, and the target level of detail model is determined from multiple level of detail models corresponding to the first virtual object based on the level of detail parameters.
7. The method according to claim 6, characterized in that, Determining the level of detail parameters of the first virtual object based on the first rendering parameters and the first level of detail model includes: The mapping table is queried based on the first level of detail model, wherein the mapping table includes the association between candidate level of detail models and candidate level of detail parameters; When a candidate level of detail model corresponding to the first level of detail model is found, the candidate level of detail parameters associated with the found candidate level of detail model are determined as the initial level of detail parameters. Based on the first rendering parameters and the initial level of detail parameters, the level of detail parameters of the first virtual object are determined.
8. The method according to claim 7, characterized in that, The first rendering parameters include the third rendering parameters and the fourth rendering parameters; The step of determining the level of detail parameters of the first virtual object based on the first rendering parameters and the initial level of detail parameters includes: Based on the third rendering parameters and the initial level of detail parameters, the first level of detail parameters of the first virtual object are determined; Based on the fourth rendering parameter, an adjustment coefficient is determined, and the first level of detail parameter is adjusted based on the adjustment coefficient. The adjusted first level of detail parameter is then determined as the second level of detail parameter. The second level of detail parameter is normalized to obtain the level of detail parameter of the first virtual object.
9. The method according to claim 8, characterized in that, Determining the first level of detail parameters of the first virtual object based on the third rendering parameters and the initial level of detail parameters includes: Multiple rendering parameter ranges are obtained, wherein the multiple rendering parameter ranges are obtained by dividing the value range of the field corresponding to the third rendering parameter; Based on the rendering parameter range in which the third rendering parameter is located, the third rendering parameter is normalized to obtain the normalized third rendering parameter. Based on the normalized third rendering parameters, the initial level of detail parameters are transformed to obtain the first level of detail parameters of the first virtual object.
10. The method according to claim 8, characterized in that, The process of determining the adjustment coefficient based on the fourth rendering parameter includes: When the fourth rendering parameter indicates that the first virtual object is currently in an interactive state, the set coefficient is determined as the adjustment coefficient; When the fourth rendering parameter includes the first size parameter of the level of detail model corresponding to the first virtual object, the second size parameter of the level of detail model corresponding to the second virtual object is determined, and the average value of the first size parameter and the second size parameter is determined. Based on the first size parameter and the average value, the adjustment coefficient is determined. When the fourth rendering parameter includes the orientation parameter of the first virtual object, the field of view orientation parameter of the camera in the virtual scene is obtained, and the adjustment coefficient is determined based on the orientation parameter and the field of view orientation parameter.
11. The method according to claim 6, characterized in that, The step of determining the target level of detail model from multiple level of detail models corresponding to the first virtual object based on the level of detail parameters includes: The detail level parameter query mapping table includes the association between the candidate detail level model of the first virtual object and the candidate detail level parameter range, wherein the candidate detail level parameter range is obtained by dividing the value range of the field corresponding to the detail level parameter. When a candidate level parameter interval corresponding to the level of detail parameter is found, the candidate level of detail model associated with the found candidate level parameter interval is determined as the third level of detail model. The third actual resource consumed by rendering the first virtual object based on the third level of detail model is determined, and the fourth actual resource consumed by rendering the second virtual object based on the fourth level of detail model is determined from multiple level of detail models corresponding to the second virtual object based on the level of detail parameters of the second virtual object. When the sum of the third actual resource and the fourth actual resource is greater than the first part of the computing resources, and the level of the third level of detail model is higher than the first level threshold but lower than the second level threshold, the third level of detail model is downgraded to obtain the target level of detail model, wherein the second level threshold is greater than the first level threshold.
12. The method according to any one of claims 1 to 11, characterized in that, After rendering the first virtual object in the virtual scene based on the level of detail model, the method further includes: Obtain the display frame rate of the virtual scene; When the display frame rate is less than the frame rate threshold, the target level of detail model is downgraded to obtain the updated target level of detail model. Based on the updated level of detail model, the corresponding first virtual object is rendered in the virtual scene.
13. The method according to any one of claims 1 to 11, characterized in that, The determination of the total computing resources allocated for the virtual scene includes: Obtain a computing resource configuration file, wherein the computing resource configuration file includes the association between candidate device parameters and candidate computing resources; Obtain the device parameters when running the virtual scene, and query the computing resource configuration file based on the device parameters; When a candidate device parameter corresponding to the device parameter is found, the candidate computing resources associated with the found candidate device parameter are determined as the total computing resources allocated for the virtual scene.
14. A rendering apparatus for virtual objects, characterized in that, The device includes: The total resource determination module is used to determine the total computing resources allocated to the virtual scene; A partial resource determination module is used to determine the object type of at least one virtual object to be rendered in the virtual scene, and to determine the partial computing resources corresponding to the object type from the total computing resources; The model determination module is used to obtain the first rendering parameters of the first virtual object among the at least one virtual object to be rendered, and to determine the target level of detail model for rendering the first virtual object based on the first rendering parameters and the first part of the computing resources corresponding to the first object type of the first virtual object. The first virtual object rendered based on different level of detail models has different levels of detail. A rendering module is used to render the first virtual object in the virtual scene based on the target level of detail model.
15. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the rendering method of the virtual object according to any one of claims 1 to 13.
16. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, the rendering method of the virtual object according to any one of claims 1 to 13 is implemented.
17. A computer program product comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, the rendering method of the virtual object according to any one of claims 1 to 13 is implemented.