Object rendering method, device, electronic device and computer-readable storage medium

By selecting and loading the initial multi-detail hierarchy model based on the screen-to-body ratio between the object to be rendered and the display interface in computer graphics technology, the problem of excessive memory usage in multi-detail hierarchy technology is solved, and a more efficient rendering process is achieved.

CN116059631BActive Publication Date: 2025-05-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111295388.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-03
Publication Date
2025-05-23
Estimated Expiration
2041-11-03

AI Technical Summary

Technical Problem

When rendering using multi-detail hierarchy technology, all LOD models need to be loaded into memory, resulting in a large amount of memory occupancy, which may cause the game to crash.

Method used

By obtaining the object to be rendered in the display interface and determining the screen-to-body ratio between it and the display interface, determining the initial multi-detail hierarchical model required for rendering based on the screen-to-body ratio, only the necessary models are loaded into memory, and a streaming loading method is adopted.

Benefits of technology

Saves memory occupied by multi-detail hierarchical models, reduces the crash rate of the game, and improves rendering efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116059631B_ABST
    Figure CN116059631B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an object rendering method, device, electronic device and computer-readable storage medium; in the embodiment of the present application, the initial multi-level-of-detail model required for rendering the object to be rendered is determined by the screen ratio between the object to be rendered and the display interface, and then only the initial multi-level-of-detail model required for rendering the object to be rendered is loaded into the memory, and all multi-level-of-detail models corresponding to the object to be rendered do not need to be loaded into the memory, so as to save the memory occupied by the multi-level-of-detail model, thereby reducing the crash rate of the game. The embodiment of the present invention can be applied to the field of maps.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer graphics technology, and in particular to an object rendering method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the development of science and technology, the visual experience that computers bring to users is getting better and better, for example, the visual experience that game interfaces bring to users.

[0003] Before presenting the game interface to the user, the computer needs to render the game interface first. In order to speed up the rendering, the Levels of Detail (LOD) technology is used. However, when using the Levels of Detail technology for rendering, all LOD models corresponding to the objects to be rendered are generally loaded into the memory, that is, the LOD models that are not needed for rendering the objects to be rendered are also loaded into the memory, which occupies a lot of memory and causes the game to crash. Summary of the invention

[0004] The embodiments of the present application provide an object rendering method, device, electronic device and computer-readable storage medium, which can solve the technical problem of occupying a large amount of memory during the rendering process.

[0005] An object rendering method, comprising:

[0006] Get the object to be rendered in the display interface;

[0007] Determine the screen ratio between the object to be rendered and the display interface;

[0008] Determining an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio;

[0009] The initial multi-level-of-details model is loaded into a memory, so as to call the initial multi-level-of-details model in the memory to render the object to be rendered.

[0010] Accordingly, an embodiment of the present application provides an object rendering device, comprising:

[0011] An acquisition module is used to acquire the object to be rendered in the display interface;

[0012] A first determining module, used to determine the screen ratio between the object to be rendered and the display interface;

[0013] A second determining module is used to determine an initial multi-level detail model to be used for rendering the object to be rendered according to the screen ratio;

[0014] The loading module is used to load the initial multi-level-of-details model into the memory, so as to call the initial multi-level-of-details model in the memory to render the object to be rendered.

[0015] Optionally, the second determining module is specifically configured to execute:

[0016] An initial multi-level-of-detail model to be used for rendering the object to be rendered at the current moment and a preset future time is determined according to the screen-to-body ratio.

[0017] Optionally, the first determining module is specifically configured to execute:

[0018] An asynchronous thread is used to determine the screen ratio between the object to be rendered and the display interface.

[0019] The second determination module is specifically used to execute:

[0020] The asynchronous thread is used to determine an initial multi-level-of-detail model required for rendering the object to be rendered according to the screen ratio.

[0021] Optionally, the second determining module is specifically configured to execute:

[0022] Determine, by using the asynchronous thread, an initial level of an initial multi-level-of-detail model required for rendering the object to be rendered according to the screen-to-body ratio, and send the initial level to the main thread;

[0023] Accordingly, the above loading module is specifically used to execute:

[0024] The initial multi-level-of-detail model corresponding to the initial level is loaded into the memory using the main thread.

[0025] Optionally, the above loading module is specifically used to execute:

[0026] Using the main thread, the initial level is sent to the loading thread;

[0027] The initial multi-level-of-detail model corresponding to the initial level is loaded into the memory using the loading thread.

[0028] Optionally, the object rendering device further includes:

[0029] A rendering module is used to use a rendering thread to determine a target multi-level-of-detail model to be used for rendering the above-mentioned object to be rendered, and to search from the above-mentioned memory for an initial multi-level-of-detail model that matches the above-mentioned target multi-level-of-detail model; and use the above-mentioned rendering thread to render the above-mentioned object to be rendered according to the initial multi-level-of-detail model that matches the target multi-level-of-detail model.

[0030] Optionally, the rendering module is specifically used to execute:

[0031] Acquire the object to be rendered in the display interface by using a rendering thread, and determine a screen ratio between the object to be rendered and the display interface;

[0032] The rendering thread is used to determine a target multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio.

[0033] Optionally, the rendering module is further used to execute:

[0034] If the initial multi-detail level model that matches the target multi-detail level model is not found in the memory using the rendering thread, the approximate multi-detail level model is searched for from the memory using the rendering thread, the approximate multi-detail level model being a multi-detail level model corresponding to the target level of the target multi-detail level model in the memory; the object to be rendered is rendered using the rendering thread according to the approximate multi-detail level model.

[0035] Optionally, the object rendering device further includes:

[0036] The unloading module is used to search the multi-level-of-detail models that do not match the initial multi-level-of-detail models from the memory; and unload the multi-level-of-detail models that do not match the initial multi-level-of-detail models in the memory.

[0037] Optionally, the screen ratio between the object to be rendered and the display interface includes a pixel ratio between the object to be rendered and the display interface;

[0038] Accordingly, the first determining module is specifically configured to execute:

[0039] Obtaining the current position information of the object to be rendered on the display interface;

[0040] Determine the size of the bounding box of the object to be rendered according to the current position information;

[0041] The pixel ratio between the object to be rendered and the display interface is determined according to the size of the bounding box.

[0042] In addition, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the object rendering method provided in the embodiment of the present application.

[0043] In addition, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute any object rendering method provided in the embodiment of the present application.

[0044] In addition, an embodiment of the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, any object rendering method provided in the embodiment of the present application is implemented.

[0045] In an embodiment of the present application, an object to be rendered in a display interface is first obtained. Then, the screen ratio between the object to be rendered and the display interface is determined. Then, according to the screen ratio, an initial multi-level-of-detail model to be used for rendering the object to be rendered is determined. Finally, the initial multi-level-of-detail model is loaded into a memory to call the initial multi-level-of-detail model in the memory to render the object to be rendered.

[0046] That is, in an embodiment of the present application, the initial multi-level-of-detail model required to render the object to be rendered is determined by the screen-to-screen ratio between the object to be rendered and the display interface, and then only the initial multi-level-of-detail model required to render the object to be rendered is loaded into the memory, and there is no need to load all the multi-level-of-detail models corresponding to the object to be rendered into the memory. That is, in an embodiment of the present application, the multi-level-of-detail model is loaded by the streaming loading method, thereby saving the memory occupied by the multi-level-of-detail model, thereby reducing the crash rate of the game. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0048] Figure 1 is a scene schematic diagram of an object rendering process provided by an embodiment of the present application;

[0049] Figure 2 is a flowchart of an object rendering method provided in an embodiment of the present application;

[0050] Figure 3 is a schematic diagram of a two-dimensional shape, a first length value, and a second length value provided in an embodiment of the present application;

[0051] Figure 4 is a schematic diagram of another object rendering method provided in an embodiment of the present application;

[0052] Figure 5 is a schematic diagram of rendering an object to be rendered by using a rendering thread provided by an embodiment of the present application;

[0053] Figure 6 is a flowchart of another object rendering method provided in an embodiment of the present application;

[0054] Figure 7is a schematic diagram of the structure of an object rendering device provided in an embodiment of the present application;

[0055] Figure 8 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0057] The embodiments of the present application provide an object rendering method, device and computer-readable storage medium. The object rendering device can be integrated in an electronic device, which can be a server or a terminal.

[0058] For example, see Figure 1 , taking the object rendering device integrated in the terminal as an example, the terminal first obtains the object to be rendered in the display interface. Then the screen ratio between the object to be rendered and the display interface is determined. Then, the initial multi-level detail model to be used for rendering the object to be rendered is determined according to the screen ratio. Finally, the initial multi-level detail model is loaded into the memory to call the initial multi-level detail model in the memory to render the object to be rendered.

[0059] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.

[0060] Furthermore, multiple servers can form a blockchain, and the servers are nodes on the blockchain.

[0061] The terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart home appliance, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, and this application does not limit this.

[0062] The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, and mapping fields.

[0063] In addition, the term "plurality" in the embodiments of the present application refers to two or more than two. The terms "first" and "second" in the embodiments of the present application are used to distinguish descriptions and should not be understood as implying relative importance.

[0064] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0065] Multi-level-of-detail technology refers to a technology that determines the number of faces and detail of an object displayed on a display interface based on the position and importance of the object model in the display environment, that is, determines the allocation of resources for object rendering.

[0066] In the LOD technology, a to-be-rendered object has multiple levels of LOD models, and the number and material complexity of static meshes on different levels of LOD models are different.

[0067] The LOD model in the embodiment of the present application may also be referred to as a LOD resource, and the level of the LOD model may also be referred to as an index of the LOD model.

[0068] When rendering an object to be rendered, all the multi-level-of-detail models corresponding to the object to be rendered are loaded into the memory, that is, the multi-level-of-detail models that are not needed for rendering the object to be rendered are also loaded into the memory, causing the multi-level-of-detail models to occupy more memory, thereby causing the game to crash.

[0069] In order to solve the technical problem that the multi-level-of-detail model occupies a lot of memory during the rendering process, the present application provides a rendering method, in which the object to be rendered in the display interface is first obtained. Then the screen ratio between the object to be rendered and the display interface is determined. Then, the initial multi-level-of-detail model to be used to render the object to be rendered is determined based on the screen ratio. Finally, the initial multi-level-of-detail model is loaded into the memory to call the initial multi-level-of-detail model in the memory to render the object to be rendered.

[0070] That is, in an embodiment of the present application, the initial multi-level-of-detail model required to render the object to be rendered is determined by the screen-to-screen ratio between the object to be rendered and the display interface, and then only the initial multi-level-of-detail model required to render the object to be rendered is loaded into the memory, and there is no need to load all the multi-level-of-detail models corresponding to the object to be rendered into the memory. That is, in an embodiment of the present application, the multi-level-of-detail model is loaded by the streaming loading method, thereby saving the memory occupied by the multi-level-of-detail model, thereby reducing the crash rate of the game.

[0071] In this embodiment, the description will be made from the perspective of an object rendering device, which can be specifically integrated in a device such as a server or a terminal. In order to facilitate the description of the object rendering method of the present application, the following will be described in detail with the object rendering device integrated in the terminal, that is, with the terminal as the execution subject.

[0072] See also Figure 2 , Figure 2 : is a flowchart of an object rendering method provided by an embodiment of the present application. The object rendering method may include:

[0073] S201: Obtain an object to be rendered in a display interface.

[0074] The object to be rendered is an object to be rendered on the display interface. For example, in a game scene, the object to be rendered may be a tree, a house, or a virtual character on the game interface.

[0075] When the user needs to enter an interface, the user can operate the terminal so that the terminal displays the interface that the user needs to enter. When the terminal displays the interface, the object to be rendered in the displayed interface can be obtained.

[0076] S202: Determine the screen ratio between the object to be rendered and the display interface.

[0077] The screen ratio between the object to be rendered and the display interface may refer to the ratio between the size of the object to be rendered and the size of the display interface. Alternatively, the screen ratio between the object to be rendered and the display interface may also refer to the pixel ratio between the current position of the object to be rendered on the display interface and the display interface, that is, the pixel ratio between the object to be rendered and the display interface at the current time.

[0078] When the screen-to-body ratio between the object to be rendered and the display interface refers to the pixel ratio between the current position of the object to be rendered on the display interface and the display interface, after obtaining the object to be rendered, the terminal can first determine the current position information of the object to be rendered on the display interface, and then determine the size of the bounding box of the object to be rendered based on the current position information, and then calculate the pixels of the object to be rendered on the display interface based on the size of the bounding box, and calculate the ratio of the pixels of the object to be rendered on the display interface to the pixels of the display interface, so as to obtain the screen-to-body ratio of the object to be rendered relative to the display interface.

[0079] Optionally, the size of the bounding box refers to the pixels of the two-dimensional shape on the display interface obtained after projecting the bounding box onto the display interface. Calculating the pixels of the object to be rendered on the display interface according to the size of the bounding box refers to using the pixels of the two-dimensional shape on the display interface as the pixels of the object to be rendered on the display interface.

[0080] The process of determining the pixels of the two-dimensional shape on the display interface may include: obtaining the maximum horizontal coordinate and the minimum horizontal coordinate of the two-dimensional shape on the preset coordinate axis, and then determining the first length value according to the maximum horizontal coordinate and the minimum horizontal coordinate. Obtaining the maximum vertical coordinate and the minimum vertical coordinate of the two-dimensional shape on the preset coordinate axis, determining the second length value according to the maximum vertical coordinate and the minimum vertical coordinate, and using the first length value and the second length value as the pixels of the object to be rendered on the display interface.

[0081] For example, when the two-dimensional shape is a circle, the first length value and the second length value are both the diameter of the circle. When the two-dimensional shape is a rectangle and the length of the rectangle is parallel to the preset coordinate axis, the first length value is the length of the rectangle and the second length value is the width of the rectangle.

[0082] It should be noted that if the two-dimensional shape is a rectangle but the length of the rectangle is not parallel to the preset coordinate axis, for example, Figure 3 As shown, at this time, the first length value calculated according to the maximum horizontal coordinate and the minimum horizontal coordinate is not the length of the rectangle, and the second length value calculated according to the maximum vertical coordinate and the minimum vertical coordinate is not the width of the rectangle.

[0083] Alternatively, after obtaining the two-dimensional shape, the type of the two-dimensional shape can be determined by using an asynchronous thread. If the type of the two-dimensional shape is a preset shape, indicating that the first length value and the second length value are the same, only the maximum horizontal coordinate and the minimum horizontal coordinate can be obtained, or only the maximum vertical coordinate and the minimum vertical coordinate can be obtained, thereby increasing the speed of calculating the size of the bounding box.

[0084] After obtaining the pixels of the two-dimensional shape on the display interface, the terminal uses an asynchronous thread to divide the first length value by the row pixels of the display interface to obtain a first pixel ratio, and divides the second length value by the column pixels of the display interface to obtain a second pixel ratio, and uses the larger pixel ratio of the first pixel ratio and the second pixel ratio as the pixel ratio between the object to be rendered and the display interface. For example, when the first pixel ratio is greater than the second pixel ratio, the first pixel ratio is used as the pixel ratio between the object to be rendered and the display interface, and when the first pixel ratio is less than the second pixel ratio, the second pixel ratio is used as the pixel ratio between the object to be rendered and the display interface.

[0085] It should be noted that the graphics of the bounding box can be set according to actual conditions. For example, a rectangular bounding box or a spherical bounding box is used as the graphics of the bounding box in this embodiment, and this application does not limit this.

[0086] S203: Determine an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio.

[0087] After determining the screen ratio between the object to be rendered and the display interface, the terminal determines the initial multi-level detail model to be used for rendering the object to be rendered according to the screen ratio. The initial multi-level detail model can be the multi-level detail model to be used for rendering the object to be rendered at the current moment, that is, the multi-level detail model to be used for rendering the object to be rendered at the current position.

[0088] Optionally, the screen ratio and the multi-level detail model can be associated and stored in a mapping table. After the terminal obtains the screen ratio, the initial multi-level detail model corresponding to the screen ratio is searched from the mapping table to obtain the initial multi-level detail model required for rendering the object to be rendered.

[0089] Among them, in the mapping table, the relationship between the screen ratio and the multi-level detail model can be a one-to-one correspondence, or the relationship between the screen ratio and the multi-level detail model can also be a many-to-one or one-to-many relationship. For example, a screen ratio of 0.5 can correspond to a multi-level detail model 1. For another example, a screen ratio of 0.5 can correspond to a multi-level detail model 1 and a multi-level detail model 2. For another example, a screen ratio of 0.5 and a screen ratio of 0.51 both correspond to a multi-level detail model 1.

[0090] It should be understood that when the relationship between the screen-to-body ratio and the multi-level-of-detail models is a one-to-many relationship, one of the multi-level-of-detail models corresponding to the screen-to-body ratio can be selected as the initial multi-level-of-detail model.

[0091] Optionally, the screen-to-body ratio may be input into a preset function for calculation to obtain an initial level of the initial multi-level-of-details model, and then the initial multi-level-of-details model corresponding to the initial level is searched to obtain an initial multi-level-of-details model corresponding to the screen-to-body ratio.

[0092] Since the larger the screen-to-body ratio is, the more details of the object to be rendered the user sees, so a higher-level multi-detail level model (the higher-level multi-detail level model contains more static meshes) is needed to render the object to be rendered. Therefore, the level of the multi-detail level model required to render the object to be rendered increases as the screen-to-body ratio of the object to be rendered increases. Therefore, the screen-to-body ratio is used as the independent variable, and the level of the multi-detail level model is used as the dependent variable. As long as the dependent variable increases as the independent variable increases, the function can be used as the preset function. For example, the preset function can be a direct proportional function, or the preset function can also be a piecewise function (the dependent variable of each function in the piecewise function also increases as the independent variable increases).

[0093] It should be noted that the preset function can be a linear function or a nonlinear function. The specific type of the preset function can be set according to actual conditions, and this application does not make any specific limitations here.

[0094] In some embodiments, because the object to be rendered will move on the display interface after rendering, the initial multi-detail level model corresponding to the moved object to be rendered will also change. Therefore, it is necessary to use the changed initial multi-detail level model to re-render the moved object to be rendered. Therefore, in order to speed up the efficiency of subsequent rendering, while determining the initial multi-detail level model to be used to render the object to be rendered at the current moment according to the screen ratio, the initial multi-detail level model to be used to render the object to be rendered at a preset future time can also be predicted according to the screen ratio.

[0095] Among them, the process of determining the initial multi-level-of-detail model required to be used for rendering the object to be rendered at the current moment and the preset future time according to the screen-to-body ratio can be: finding the interval to which the screen-to-body ratio belongs, and then using each multi-level-of-detail model corresponding to the interval as the initial multi-level-of-detail model required to be used for rendering the object to be rendered at the current moment and the preset future time.

[0096] For example, the screen-to-body ratio is 0.51, interval 1 includes screen-to-body ratios of 0.5-0.55, and the detail level models corresponding to interval 1 include multi-detail level models 1 to 6. Then the interval to which the screen-to-body ratio of 0.51 belongs is interval 1, and the initial multi-detail level models are multi-detail level models 1 to 6 respectively.

[0097] When rendering is performed later, the initial multi-level-of-detail model required to render the object to be rendered at the current moment is found from the memory according to the screen ratio.

[0098] For example, if the screen-to-body ratio is 0.51 and the memory includes initial LOD models 1 to 6, the initial LOD model 2 corresponding to the screen-to-body ratio of 0.51 is found from the memory. The initial LOD model 2 is the initial LOD model used to render the object to be rendered at the current moment.

[0099] For the interval, the terminal can predict the position of the object to be rendered on the display interface at a preset future time, that is, the terminal can predict the position of the object to be rendered after the change, and then put the screen-to-rendering ratio between the object to be rendered at the changed position and the display interface and the screen-to-rendering ratio between the object to be rendered at the current moment in the same interval, that is, the screen-to-rendering ratio between the object to be rendered at the changed position and the display interface and the screen-to-rendering ratio between the object to be rendered at the current position and the display interface are put in the same interval.

[0100] In this embodiment, an initial multi-detail level model required for rendering an object to be rendered at a preset future time is predicted based on the screen-to-body ratio, and then the initial multi-detail level model required for rendering the object to be rendered at the preset future time is also loaded into the memory, so that when the object to be rendered needs to be re-rendered at the preset future time, the initial multi-detail level model required for rendering the object to be rendered can be directly obtained from the memory, and there is no need to load the initial multi-detail level model required for rendering the object to be rendered into the memory, thereby improving the efficiency of rendering the object to be rendered.

[0101] In other embodiments, before determining the initial multi-detail level model required to render the object to be rendered based on the screen-to-body ratio, the multi-detail level models of different levels corresponding to the object to be rendered can be obtained first, and then the multi-detail level models of different levels corresponding to the object to be rendered can be stored in a target file corresponding to the object to be rendered, so that the initial multi-detail level model corresponding to the initial level can be obtained from the target file subsequently, and the initial multi-detail level model can be loaded into the memory.

[0102] S204: Load the initial multi-level-of-detail model into the memory, so as to call the initial multi-level-of-detail model in the memory to render the object to be rendered.

[0103] After the terminal determines the initial multi-level-of-detail model required to render the object to be rendered, the terminal can only load the initial multi-level-of-detail model into the memory, without loading all the level-of-detail models corresponding to the object to be rendered into the memory. Later in the process of running the game, if other level-of-detail models of the object to be rendered are needed, the other level-of-detail models of the object to be rendered can be loaded. That is, at this time, the game can be run while loading other level-of-detail models of the object to be rendered, so as to save the memory occupied by the multi-level-of-detail model and the subsequent call of the initial multi-level-of-detail model in the memory to render the object to be rendered.

[0104] That is, in this application, the multi-level-of-detail model is loaded by the streaming loading method, thereby saving the memory occupied by the multi-level-of-detail model. Streaming loading means first loading the initial multi-level-of-detail model required for rendering the object to be rendered, and then loading other multi-level-of-detail models of the object to be rendered while running the game.

[0105] It should be noted that after the initial multi-level-of-detail model is loaded into the memory, the initial multi-level-of-detail model in the memory can be called immediately to render the object to be rendered, or the initial multi-level-of-detail model in the memory can be called to render the object to be rendered after receiving the rendering instruction.

[0106] Calling the initial multi-level-of-detail model in the memory to render the object to be rendered refers to calling the static network on the initial multi-level-of-detail model in the memory to render the object to be rendered.

[0107] In other embodiments, since the main thread (the main thread refers to the thread that runs immediately when a program starts) needs to calculate more data during execution, if the screen-to-body ratio between the object to be rendered and the display interface is determined through the main thread, and the initial multi-level-of-detail model to be used to render the object to be rendered is determined based on the screen-to-body ratio, the speed will be relatively slow, thereby reducing the efficiency of the game operation.

[0108] In order to improve the efficiency of the game operation, in this embodiment, after the object to be rendered is obtained by the main thread, the object to be rendered can be sent to the asynchronous thread. Then, the asynchronous thread is used to determine the screen ratio between the object to be rendered and the display interface, and the initial multi-level detail model to be used for rendering the object to be rendered is determined according to the screen ratio.

[0109] Among them, using the main thread to send the object to be rendered to the asynchronous thread can refer to sending the current position information of the object to be rendered to the asynchronous thread, and using the asynchronous thread to determine the screen ratio between the object to be rendered and the display interface based on the current position information (refer to Figure 4 ). And, when the current position information of the object to be rendered is updated, the main thread is used to send the updated current position to the asynchronous thread.

[0110] In this embodiment, since the asynchronous thread needs to calculate less data, the efficiency of the game operation can be improved by determining the screen ratio between the object to be rendered and the display interface through the asynchronous thread, and determining the initial multi-level detail model required to render the object to be rendered based on the screen ratio.

[0111] Optionally, the detailed process of using an asynchronous thread to determine the initial multi-level detail model to be used for rendering the object to be rendered according to the screen ratio may be: using an asynchronous thread to determine the initial level of the initial multi-level detail model to be used for rendering the object to be rendered according to the screen ratio, and then sending the initial level to the main thread (refer to Figure 4 ), and then use the main thread to load the initial multi-level detail model corresponding to the initial level into memory.

[0112] Furthermore, an asynchronous thread may be used to determine an initial multi-level-of-detail model to be used for rendering the object to be rendered at the current time and a preset future time according to the screen ratio.

[0113] In addition, after sending the initial level to the main thread, the main thread can be used to send the initial level to the loading thread, and then the loading thread can be used to load the initial level of the initial level of the model into the memory.

[0114] Optionally, since the multi-level detailed models of different levels corresponding to the to-be-rendered object are stored in the target file corresponding to the to-be-rendered object, the process of using the loading thread to load the initial multi-level detailed model corresponding to the initial level into the memory is: using the loading thread to request to load the initial multi-level detailed model corresponding to the initial level in the target file, and loading the initial multi-level detailed model corresponding to the initial level in the target file into the memory, that is, using the loading thread to obtain the initial multi-level detailed model corresponding to the initial level from the target file, and loading the initial multi-level detailed model corresponding to the initial level into the memory (refer to Figure 4 ).

[0115] Finally, the loaded initial multi-level detail model is sent to the main thread, so that the main thread can use the initial multi-level detail model to render the object to be rendered (refer to Figure 4 ).

[0116] The initial multi-level-of-detail model is loaded by using a loading thread, and there is no need to load the initial multi-level-of-detail model through a main thread, so that the terminal can run the game while loading the initial multi-level-of-detail model, thereby preventing the game from being stuck.

[0117] In other embodiments, calling the initial multi-level-of-detail model in the memory to render the object to be rendered includes: using a rendering thread to determine a target multi-level-of-detail model to be used to render the object to be rendered, and searching the memory for an initial multi-level-of-detail model that matches the target multi-level-of-detail model, and using the rendering thread to render the object to be rendered according to the initial multi-level-of-detail model that matches the target multi-level-of-detail model.

[0118] In the process of searching for an initial multi-detail level model that matches a target multi-detail level model, a target level of the target multi-detail level model may be matched with an initial level in memory, and then an initial multi-detail level model corresponding to the initial level that matches the target level may be used as an initial multi-detail level model that matches the target multi-detail level model.

[0119] The initial LOD model that matches the target LOD model refers to an initial LOD model that is the same as the target LOD model.

[0120] The method of using a rendering thread to determine the target multi-level-of-detail model to be used for rendering the object to be rendered is also determined based on the screen ratio between the object to be rendered and the display interface, that is, using the rendering thread to first obtain the object to be rendered in the display interface, and determine the screen ratio between the object to be rendered and the display interface, and then using the rendering thread to determine the target multi-level-of-detail model to be used for rendering the object to be rendered based on the screen ratio. The specific implementation process can refer to the above-mentioned process of determining the initial multi-level-of-detail model based on the screen ratio between the object to be rendered and the display interface, and this embodiment will not be repeated here.

[0121] Since the sum of the time for using an asynchronous thread to determine the initial multi-level-of-detail model for rendering the object to be rendered according to the screen-to-body ratio and the time for loading the initial multi-level-of-detail model may be longer than the time for using the rendering thread to determine the target multi-level-of-detail model for rendering the object to be rendered according to the screen-to-body ratio, it may occur that after the rendering thread determines the target multi-level-of-detail model for rendering the object to be rendered according to the screen-to-body ratio, the initial multi-level-of-detail model matching the target multi-level-of-detail model has not been loaded into the memory or is still being loaded, resulting in the rendering thread not finding the initial multi-level-of-detail model matching the target multi-level-of-detail model from the memory at this time.

[0122] Therefore, in other embodiments, if the rendering thread fails to find an initial multi-detail level model that matches the target multi-detail level model from the memory, the rendering thread is used to search for a close multi-detail level model from the memory, where the close multi-detail level model is a multi-detail level model in the memory that corresponds to the target level of the target multi-detail level model and is closest to the level.

[0123] For example, if the target level is level 1, and the memory includes a level 9 LOD model and a level 10 LOD model, then level 9 in the memory is closest to level 1, and the level 9 LOD model is taken as the approximate LOD model.

[0124] Then, the rendering thread is used to render the object to be rendered according to the close multi-detail level model. Since the object to be rendered is rendered using the close multi-detail level model at this time, the target multi-detail level model actually needs to be used to render the object to be rendered. Therefore, after the rendering thread is used to render the object to be rendered according to the close multi-detail level model, in order to improve the rendering effect, the rendering thread can also be used to continuously search for the initial multi-detail level model that matches the target multi-detail level model from the memory until the rendering thread finds the initial multi-detail level model that matches the target multi-detail level model, and then the rendering thread is used to re-use the initial multi-detail level model that matches the target multi-detail level model to render the object to be rendered.

[0125] It should be noted that the detailed process of using the rendering thread to search for a model close to the multi-level-of-details model from the memory can be: using the rendering thread to search the memory for the level closest to the target level of the target multi-level-of-details model, and then using the multi-level-of-details model corresponding to the level closest to the target level as the model close to the multi-level-of-details model.

[0126] Optionally, refer to Figure 5, the process of rendering the object to be rendered by using the rendering thread in this embodiment is further described. The rendering thread is first used to determine the screen ratio between the object to be rendered and the display interface, and then the rendering thread is used to determine the target level of the target multi-level detail model according to the screen ratio. The target level is matched with the initial level in the memory. If there is an initial level that matches the target level, the rendering thread is used to render the object to be rendered using the initial multi-level detail model corresponding to the initial level that matches the target level.

[0127] If there is no initial level matching the target level, the rendering thread is used to find the level closest to the target level from the memory, and the close multi-level detail model corresponding to the level closest to the target level is used to render the object to be rendered. At the same time, the target level is returned to match the initial level in the memory until the initial level matching the target level is found, and then the rendering thread is used to re-use the initial multi-level detail model of the initial level matching the target level to render the object to be rendered.

[0128] In order to further save the memory occupied by the LOD model, in other embodiments, after the initial LOD model is loaded into the memory, the method further includes:

[0129] Find the level of detail model that does not match the initial level of detail model from the memory; unload the level of detail model that does not match the initial level of detail model in the memory.

[0130] If there is a multi-level-of-detail model in the memory that does not match the initial multi-level-of-detail model, it means that there is a multi-level-of-detail model in the memory that is not needed for rendering the object to be rendered. At this time, the multi-level-of-detail model in the memory that does not match the initial multi-level-of-detail model is unloaded, thereby saving the memory occupied by the multi-level-of-detail model corresponding to the unloading level.

[0131] Optionally, the process of searching the memory for a multi-level-of-detail model that does not match the initial multi-level-of-detail model and unloading the multi-level-of-detail model that does not match the initial multi-level-of-detail model in the memory may be: using the main thread to search the memory for an unloaded level that does not match the initial level, and using the main thread to unload the multi-level-of-detail model corresponding to the unloaded level in the memory (refer to Figure 4 ), the LOD model corresponding to the unloading level is the LOD model that does not match the initial LOD model.

[0132] As can be seen from the above, in the embodiment of the present application, the object to be rendered in the display interface is first obtained. Then the screen ratio between the object to be rendered and the display interface is determined. Then, the initial multi-level detail model to be used for rendering the object to be rendered is determined according to the screen ratio. Finally, the initial multi-level detail model is loaded into the memory to call the initial multi-level detail model in the memory to render the object to be rendered.

[0133] That is, in an embodiment of the present application, the initial multi-level-of-detail model required to render the object to be rendered is determined by the screen-to-screen ratio between the object to be rendered and the display interface, and then only the initial multi-level-of-detail model required to render the object to be rendered is loaded into the memory, and there is no need to load all the multi-level-of-detail models corresponding to the object to be rendered into the memory. That is, in an embodiment of the present application, the multi-level-of-detail model is loaded by the streaming loading method, thereby saving the memory occupied by the multi-level-of-detail model, thereby reducing the crash rate of the game.

[0134] The method described in the above embodiment is further described in detail below with examples.

[0135] This embodiment takes the object rendering device integrated into the terminal as an example. Figure 6 , Figure 6 A schematic diagram of a process flow of an object rendering method provided in an embodiment of the present application. The process flow of the object rendering method may include:

[0136] S601: The terminal uses the main thread to obtain an object to be rendered in a display interface, and determines current position information of the object to be rendered on the display interface.

[0137] The object to be rendered is an object to be rendered on the display interface. For example, in a game scene, the object to be rendered may be a tree, a house, or a virtual character on the game interface.

[0138] S602: The terminal uses the main thread to send the current position information to the asynchronous thread, and uses the asynchronous thread to determine the size of the bounding box of the object to be rendered based on the current position information.

[0139] The size of the bounding box refers to the pixels on the display interface of the two-dimensional shape obtained by projecting the bounding box onto the display interface. The graphics of the bounding box can be set according to actual conditions, for example, a rectangular bounding box or a spherical bounding box is used as the graphics of the bounding box in this embodiment, and this application does not limit this.

[0140] The process of determining the pixels of the two-dimensional shape on the display interface may include: obtaining the maximum horizontal coordinate and the minimum horizontal coordinate of the two-dimensional shape on the preset coordinate axis, and then determining the first length value according to the maximum horizontal coordinate and the minimum horizontal coordinate. Obtaining the maximum vertical coordinate and the minimum vertical coordinate of the two-dimensional shape on the preset coordinate axis, determining the second length value according to the maximum vertical coordinate and the minimum vertical coordinate, and using the first length value and the second length value as the pixels of the object to be rendered on the display interface.

[0141] For example, when the two-dimensional shape is a circle, the first length value and the second length value are both the diameter of the circle. When the two-dimensional shape is a rectangle and the length of the rectangle is parallel to the preset coordinate axis, the first length value is the length of the rectangle and the second length value is the width of the rectangle.

[0142] It should be noted that if the two-dimensional shape is a rectangle but the length of the rectangle is not parallel to the preset coordinate axis, for example, Figure 3 As shown, at this time, the first length value calculated according to the maximum horizontal coordinate and the minimum horizontal coordinate is not the length of the rectangle, and the second length value calculated according to the maximum vertical coordinate and the minimum vertical coordinate is not the width of the rectangle.

[0143] S603: The terminal uses an asynchronous thread to determine a pixel ratio between the object to be rendered and the display interface according to the size of the bounding box.

[0144] After obtaining the size of the bounding box, that is, obtaining the first length value and the second length value, the first length value is divided by the row pixels of the display interface using an asynchronous thread to obtain a first pixel ratio, and the second length value is divided by the column pixels of the display interface to obtain a second pixel ratio, and the larger pixel ratio of the first pixel ratio and the second pixel ratio is used as the pixel ratio between the object to be rendered and the display interface. For example, when the first pixel ratio is greater than the second pixel ratio, the first pixel ratio is used as the pixel ratio between the object to be rendered and the display interface, and when the first pixel ratio is less than the second pixel ratio, the second pixel ratio is used as the pixel ratio between the object to be rendered and the display interface.

[0145] S604: The terminal uses an asynchronous thread to determine, according to the pixel ratio, an initial multi-level detail model to be used for rendering the object to be rendered at the current time and a preset future time.

[0146] Because the object to be rendered will move on the display interface after rendering, the initial multi-detail level model corresponding to the moved object to be rendered will also change. Therefore, it is necessary to use the changed initial multi-detail level model to re-render the moved object to be rendered. Therefore, in order to speed up the efficiency of subsequent rendering, while using asynchronous threads to determine the initial multi-detail level model to be used to render the object to be rendered at the current moment according to the pixel ratio, the initial multi-detail level model to be used to render the object to be rendered at a preset future time can also be predicted according to the pixel ratio.

[0147] Among them, the process of using an asynchronous thread to determine the initial multi-level detail model required for rendering the object to be rendered at the current moment and the preset future time according to the pixel ratio can be: using an asynchronous thread to find the pixel interval to which the pixel ratio belongs, and then using each multi-level detail model corresponding to the pixel interval as the initial multi-level detail model required for rendering the object to be rendered at the current moment and the preset future time.

[0148] For example, the pixel ratio is 0.51, pixel interval 1 includes pixel ratios of 0.5-0.55, the detail level models corresponding to pixel interval 1 include multi-detail level models 1 to 6, then the pixel interval to which the pixel ratio 0.51 belongs is pixel interval 1, and the initial multi-detail level models are multi-detail level models 1 to 6 respectively.

[0149] When rendering is performed subsequently, the rendering thread is used to find the initial multi-level detail model required for rendering the object to be rendered at the current moment from the memory according to the pixel ratio.

[0150] For example, if the pixel ratio is 0.51 and the memory includes initial LOD models 1 to 6, the initial LOD model 2 corresponding to the pixel ratio 0.51 is found from the memory, and the initial LOD model 2 is the initial LOD model to be used for rendering the object to be rendered at the current moment.

[0151] For the pixel interval, the terminal can use an asynchronous thread to predict the position of the object to be rendered on the display interface at a preset future time, that is, the terminal can use an asynchronous thread to predict the position of the object to be rendered after the change, and then put the pixel ratio between the object to be rendered at the changed position and the display interface and the pixel ratio between the object to be rendered at the current moment and the display interface in the same pixel interval, that is, put the pixel ratio between the object to be rendered at the changed position and the display interface and the pixel ratio between the object to be rendered at the current position and the display interface in the same pixel interval.

[0152] In this embodiment, an asynchronous thread is used to predict an initial multi-detail level model required for rendering an object to be rendered at a preset future time based on a pixel ratio, and then the initial multi-detail level model required for rendering the object to be rendered at the preset future time is also loaded into a memory, so that when the object to be rendered needs to be re-rendered at the preset future time, the initial multi-detail level model required for rendering the object to be rendered can be directly obtained from the memory, and there is no need to load the initial multi-detail level model required for rendering the object to be rendered into the memory, thereby improving the efficiency of rendering the object to be rendered.

[0153] In this embodiment, since the asynchronous thread needs to calculate less data, the efficiency of the game operation can be improved by executing S602 to S604 through the asynchronous thread.

[0154] S605: The terminal sends the initial level of the initial multi-level-of-detail model to the main thread using an asynchronous thread.

[0155] S606: The terminal sends the initial level to the loading thread by using the main thread, and loads the initial LOD model corresponding to the initial level into the memory by using the loading thread.

[0156] The initial multi-level-of-detail model is loaded by using a loading thread, and there is no need to load the initial multi-level-of-detail model through a main thread, so that the terminal can run the game while loading the initial multi-level-of-detail model, thereby preventing the game from being stuck.

[0157] S607: The terminal uses the main thread to search the memory for the uninstallation level that does not match the initial level, and uses the main thread to uninstall the multi-level detail model corresponding to the uninstallation level in the memory.

[0158] If there is an unloaded level in the memory that is different from the initial level, it means that there is a multi-detail level model in the memory that is not needed for rendering the object to be rendered, that is, the multi-detail level model corresponding to the unloaded level is not needed for rendering the object to be rendered. At this time, the main thread is used to unload the multi-detail level model corresponding to the unloaded level in the memory, thereby saving the memory occupied by the multi-detail level model corresponding to the unloaded level.

[0159] S608: The terminal uses the main thread to send the current position information to the rendering thread, and uses the rendering thread to determine the target LOD model to be used for rendering the object to be rendered at the current moment based on the current position information.

[0160] The specific process of the terminal using the rendering thread to determine the target LOD model to be used for rendering the object to be rendered at the current moment based on the current position information can refer to the above S602 to S603, which will not be repeated in this embodiment.

[0161] S609: The terminal uses the rendering thread to search the memory for an initial LOD model that matches the target LOD model.

[0162] The target level of the target LOD model may be matched with the initial level in the memory, and then the initial LOD model corresponding to the initial level matching the target level may be used as the initial LOD model matching the target LOD model.

[0163] The initial LOD model that matches the target LOD model refers to an initial LOD model that is identical to the LOD model.

[0164] S6010: The terminal uses a rendering thread to render the object to be rendered according to an initial LOD model that matches the target LOD model.

[0165] S6011. If the initial multi-detail level model that matches the target multi-detail level model is not found in the memory using the rendering thread, the terminal uses the rendering thread to search for a close multi-detail level model from the memory, where the close multi-detail level model is a multi-detail level model in the memory corresponding to a close level that is closest to the target level of the target multi-detail level model.

[0166] If the rendering thread fails to find the initial multi-detail level model that matches the target multi-detail level model from the memory, it means that the loading thread has not yet loaded the initial multi-detail level model that matches the target multi-detail level model into the memory or is still loading it. Then the rendering thread is used to find the approximate multi-detail level model from the memory. The approximate multi-detail level model is the multi-detail level model corresponding to the approximate level in the memory that is closest to the target level of the target multi-detail level model.

[0167] For example, if the target level is level 1, and the memory includes a level 9 LOD model and a level 10 LOD model, then level 9 in the memory is closest to level 1, and the level 9 LOD model is taken as the approximate LOD model.

[0168] S6012. The terminal uses a rendering thread to render the object to be rendered according to a model close to the multi-level of detail model.

[0169] After the terminal determines the approximate multi-level-of-detail model using the rendering thread, it uses the rendering thread to render the object to be rendered according to the approximate multi-level-of-detail model. The rendering thread is used to continuously search for the initial multi-level-of-detail model that matches the target multi-level-of-detail model from the memory until the initial multi-level-of-detail model that matches the target multi-level-of-detail model is found using the rendering thread, and then the rendering thread is used to re-use the initial multi-level-of-detail model that matches the target multi-level-of-detail model to render the object to be rendered.

[0170] From the above, it can be seen that in the embodiment of the present application, an asynchronous thread is used to determine the initial multi-detail level model required for rendering the object to be rendered through the pixel ratio between the object to be rendered and the display interface, and then the loading thread is used to load only the initial multi-detail level model required for rendering the object to be rendered into the memory. There is no need to load all the multi-detail level models corresponding to the object to be rendered into the memory. That is, in the embodiment of the present application, the multi-detail level model is loaded by the streaming loading method, thereby saving the memory occupied by the multi-detail level model, thereby reducing the crash rate of the game.

[0171] In order to better implement the object rendering method provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above object rendering method. The meanings of the terms are the same as those in the above object rendering method, and the specific implementation details can refer to the description in the method embodiment.

[0172] For example, Figure 7 As shown, the object rendering device may include:

[0173] The acquisition module 701 is used to acquire the object to be rendered in the display interface.

[0174] The first determining module 702 is used to determine the screen ratio between the object to be rendered and the display interface.

[0175] The second determining module 703 is used to determine an initial LOD model to be used for rendering the object to be rendered according to the screen ratio.

[0176] The loading module 704 is used to load the initial LOD model into the memory, so as to call the initial LOD model in the memory to render the object to be rendered.

[0177] Optionally, the second determining module 703 is specifically configured to execute:

[0178] An initial multi-level-of-detail model to be used for rendering the object to be rendered at the current moment and a preset future time is determined according to the screen ratio.

[0179] Optionally, the first determining module 702 is specifically configured to execute:

[0180] An asynchronous thread is used to determine the screen ratio between the object to be rendered and the display interface.

[0181] The second determining module 703 is specifically configured to execute:

[0182] An asynchronous thread is used to determine the initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio.

[0183] Optionally, the second determining module 703 is specifically configured to execute:

[0184] An initial level of an initial multi-level-of-detail model to be used for rendering the object to be rendered is determined according to the screen ratio, and the initial level is sent to the main thread.

[0185] Accordingly, the loading module 704 is specifically used to execute:

[0186] The initial LOD model corresponding to the initial level is loaded into memory using the main thread.

[0187] Optionally, the loading module 704 is specifically used to execute:

[0188] Use the main thread to send the initial level to the loading thread;

[0189] The initial level-of-detail model corresponding to the initial level is loaded into memory using a loading thread.

[0190] Optionally, the object rendering device further includes:

[0191] The rendering module is used to use the rendering thread to determine the target multi-level detail model to be used for rendering the object to be rendered, and to search from the memory for an initial multi-level detail model that matches the target multi-level detail model; and to use the rendering thread to render the object to be rendered according to the initial multi-level detail model that matches the target multi-level detail model.

[0192] Optionally, the rendering module is specifically used to execute:

[0193] Using the rendering thread to obtain the object to be rendered in the display interface, and determining the screen ratio between the object to be rendered and the display interface;

[0194] The rendering thread is used to determine the target multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio.

[0195] Optionally, the rendering module is also used to perform:

[0196] If the rendering thread fails to find an initial level-of-detail model that matches the target level-of-detail model from the memory, the rendering thread searches for an approximate level-of-detail model from the memory. The approximate level-of-detail model is a level-of-detail model corresponding to the target level of the target level-of-detail model in the memory. The rendering thread renders the object to be rendered according to the approximate level-of-detail model.

[0197] Optionally, the object rendering device further includes:

[0198] The unloading module is used to search the multi-level-of-detail models that do not match the initial multi-level-of-detail models from the memory; and unload the multi-level-of-detail models that do not match the initial multi-level-of-detail models in the memory.

[0199] Optionally, the screen ratio between the object to be rendered and the display interface includes a pixel ratio between the object to be rendered and the display interface;

[0200] Accordingly, the first determining module 702 is specifically configured to execute:

[0201] Get the current position information of the object to be rendered on the display interface;

[0202] Determine the size of the bounding box of the object to be rendered according to the current position information;

[0203] The pixel ratio between the object to be rendered and the display interface is determined according to the size of the bounding box.

[0204] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation methods and corresponding beneficial effects of the above modules can be found in the previous method embodiments, which will not be repeated here.

[0205] The present application also provides an electronic device, which may be a server or a terminal, etc. Figure 8 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:

[0206] The electronic device may include components such as a processor 801 with one or more processing cores, a memory 802 with one or more computer-readable storage media, a power supply 803, and an input unit 804. Those skilled in the art will appreciate that Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0207] The processor 801 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing computer programs and / or modules stored in the memory 802, and calling data stored in the memory 802, it performs various functions of the electronic device and processes data, thereby performing overall detection of the electronic device. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 801.

[0208] The memory 802 can be used to store computer programs and modules. The processor 801 executes various functional applications and data processing by running the computer programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.

[0209] The electronic device also includes a power supply 803 for supplying power to each component. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 803 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.

[0210] The electronic device may further include an input unit 804, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0211] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 801 in the electronic device will load the executable files corresponding to the processes of one or more computer programs into the memory 802 according to the following instructions, and the processor 801 will run the computer programs stored in the memory 802, thereby realizing various functions, such as:

[0212] Get the object to be rendered in the display interface;

[0213] Determine the screen ratio between the object to be rendered and the display interface;

[0214] Determine an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio;

[0215] The initial multi-level-of-detail model is loaded into the memory, so as to call the initial multi-level-of-detail model in the memory to render the object to be rendered.

[0216] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the detailed description of the image processing method above, which will not be elaborated here.

[0217] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0218] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program can be loaded by a processor to execute the steps in any object rendering method provided in the embodiment of the present application. For example, the computer program can execute the following steps:

[0219] Get the object to be rendered in the display interface;

[0220] Determine the screen ratio between the object to be rendered and the display interface;

[0221] Determine an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio;

[0222] The initial multi-level-of-detail model is loaded into the memory, so as to call the initial multi-level-of-detail model in the memory to render the object to be rendered.

[0223] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0224] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0225] Since the computer program stored in the computer-readable storage medium can execute the steps in any object rendering method provided in the embodiments of the present application, the beneficial effects that can be achieved by any object rendering method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0226] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned object rendering method.

[0227] The object rendering method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application are introduced in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for rendering a game virtual object, It is characterized in that include: Get the object to be rendered in the display interface; Determine the screen ratio between the object to be rendered and the display interface; Determining an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio; Loading the initial multi-level-of-detail model into a memory, so as to call the initial multi-level-of-detail model in the memory to render the object to be rendered; Among them, calling the initial multi-detail level model in the memory to render the object to be rendered includes: using a rendering thread to determine the target multi-detail level model required to render the object to be rendered, and searching the memory for an initial multi-detail level model that matches the target multi-detail level model; using the rendering thread to render the object to be rendered according to the initial multi-detail level model that matches the target multi-detail level model.

2. The method for rendering a game virtual object according to claim 1, It is characterized in that The determining, according to the screen ratio, an initial multi-level-of-detail model to be used for rendering the object to be rendered includes: An initial multi-level-of-detail model to be used for rendering the object to be rendered at a current moment and a preset future time is determined according to the screen ratio.

3. The method for rendering a game virtual object according to claim 1, It is characterized in that The determining of the screen ratio between the object to be rendered and the display interface, and determining an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio, includes: An asynchronous thread is used to determine a screen ratio between the object to be rendered and the display interface, and an initial multi-level-of-detail model required for rendering the object to be rendered is determined according to the screen ratio.

4. The method for rendering a game virtual object according to claim 3, It is characterized in that The determining, according to the screen ratio, an initial multi-level-of-detail model to be used for rendering the object to be rendered includes: Determining, by using an asynchronous thread, an initial level of an initial multi-level-of-detail model required for rendering the object to be rendered; sending the initial level to the main thread; Accordingly, the step of loading the initial multi-level-of-detail model into the memory includes: The main thread is used to load the initial level-of-detail model corresponding to the initial level into the memory.

5. The method for rendering a game virtual object according to claim 4, It is characterized in that The step of using the main thread to load the initial multi-level detail model corresponding to the initial level into the memory includes: sending the initial level to a loading thread using the main thread; The initial LOD model corresponding to the initial level is loaded into the memory using the loading thread.

6. The method for rendering a game virtual object according to claim 1, It is characterized in that Determining, by using a rendering thread, a target multi-level-of-detail model to be used for rendering the object to be rendered, comprising: Acquire the object to be rendered in the display interface by using a rendering thread, and determine a screen ratio between the object to be rendered and the display interface; The rendering thread is used to determine a target multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio.

7. The method for rendering a game virtual object according to claim 1, It is characterized in that The game virtual object rendering method also includes: If the rendering thread fails to find an initial multi-level-of-detail model matching the target multi-level-of-detail model from the memory, the rendering thread is used to find a close multi-level-of-detail model from the memory, where the close multi-level-of-detail model is a multi-level-of-detail model in the memory corresponding to the closest level to the target level of the target multi-level-of-detail model; Correspondingly, the rendering thread is used to render the object to be rendered according to the initial LOD model that matches the target LOD model, including: The object to be rendered is rendered using the rendering thread according to the approximate multi-level-of-detail model.

8. The method for rendering a game virtual object according to claim 1, It is characterized in that After the initial multi-level-of-details model is loaded into the memory, the method further includes: Searching the memory for a level-of-detail model that does not match the initial level-of-detail model; The LOD model in the memory that does not match the initial LOD model is unloaded.

9. The method for rendering a game virtual object according to claim 1, It is characterized in that The screen ratio between the object to be rendered and the display interface includes a pixel ratio between the object to be rendered and the display interface; Correspondingly, determining the screen ratio between the object to be rendered and the display interface includes: Obtaining current position information of the object to be rendered on the display interface; Determine the size of the bounding box of the object to be rendered according to the current position information; The pixel ratio between the object to be rendered and the display interface is determined according to the size of the bounding box.

10. A device for rendering virtual objects in games, It is characterized in that include: An acquisition module is used to acquire the object to be rendered in the display interface; A first determining module, used to determine the screen ratio between the object to be rendered and the display interface; A second determining module is used to determine an initial multi-level detail model to be used for rendering the object to be rendered according to the screen ratio; A loading module, used for loading the initial multi-level-of-details model into a memory, so as to call the initial multi-level-of-details model in the memory to render the object to be rendered; Among them, the game virtual object rendering device also includes: a rendering module, which uses a rendering thread to determine the target multi-detail level model required to render the object to be rendered, and searches for an initial multi-detail level model that matches the target multi-detail level model from the memory; and uses the rendering thread to render the object to be rendered according to the initial multi-detail level model that matches the target multi-detail level model.

11. An electronic device, It is characterized in that It comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the game virtual object rendering method according to any one of claims 1 to 9.

12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the game virtual object rendering method according to any one of claims 1 to 9.

13. A computer program product, It is characterized in that The computer program product stores a computer program, and the computer program is suitable for being loaded by a processor to execute the game virtual object rendering method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Virtual object rendering method and device, computer equipment and storage medium

    CN112370783A