CN116059631A - Object rendering method, device, electronic equipment and computer readable storage medium - Google Patents

Object rendering method, device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN116059631A
CN116059631A CN202111295388.9A CN202111295388A CN116059631A CN 116059631 A CN116059631 A CN 116059631A CN 202111295388 A CN202111295388 A CN 202111295388A CN 116059631 A CN116059631 A CN 116059631A
Authority
CN
China
Prior art keywords
rendered
rendering
detail
model
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111295388.9A
Other languages
Chinese (zh)
Inventor
林培华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111295388.9A priority Critical patent/CN116059631A/en
Publication of CN116059631A publication Critical patent/CN116059631A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Image Generation (AREA)

Abstract

The embodiment of the application discloses an object rendering method, an object rendering device, electronic equipment and a computer-readable storage medium; in the embodiment of the application, the initial multi-detail level model needed to be used for rendering the object to be rendered is determined according to the screen ratio between the object to be rendered and the display interface, and then the initial multi-detail level model needed to be used for rendering the object to be rendered is only loaded into the memory, and all multi-detail level models corresponding to the object to be rendered are not required to be loaded into the memory, so that the memory occupied by the multi-detail level model is saved, and the crash rate of the game is reduced. The embodiment of the invention can be applied to the map field.

Description

Object rendering method, device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer graphics, and in particular, to an object rendering method, an object rendering device, an electronic device, and a computer readable storage medium.
Background
With the development of science and technology, the visual experience brought by the computer to the user is better and better, for example, the visual experience brought by the game interface to the user is better and better.
The computer needs to render the game interface before presenting the game interface to the user. To speed up the rendering, a multi-level of Detail technique (LOD) is employed. However, when the multi-level-of-detail technology is adopted for rendering, all LOD models corresponding to the object to be rendered are generally loaded on the memory, that is, the LOD models which are not used for rendering the object to be rendered are also loaded on the memory, so that more memory is occupied, and further, the game is crashed.
Disclosure of Invention
The embodiment of the application provides an object rendering method, an object rendering device, electronic equipment and a computer readable storage medium, which can solve the technical problem that more memory is occupied in a rendering process.
An object rendering method, comprising:
acquiring an object to be rendered in a display interface;
determining a screen ratio between the object to be rendered and the display interface;
determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio;
and loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
Accordingly, an embodiment of the present application provides an object rendering apparatus, including:
the acquisition module is used for acquiring an object to be rendered in the display interface;
a first determining module, configured to determine a screen ratio between the object to be rendered and the display interface;
the second determining module is used for determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio;
and the loading module is used for loading the initial multi-detail level model into a memory so as to call the initial multi-detail level model in the memory to render the object to be rendered.
Optionally, the second determining module is specifically configured to perform:
and determining an initial multi-detail level model to be used for rendering the object to be rendered at the current time and a preset future time according to the screen duty ratio.
Optionally, the first determining module is specifically configured to perform:
and determining the screen ratio between the object to be rendered and the display interface by using an asynchronous thread.
The second determining module is specifically configured to perform:
and determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen ratio by using the asynchronous thread.
Optionally, the second determining module is specifically configured to perform:
determining an initial level of an initial multi-detail level model to be used for rendering the object to be rendered according to the screen ratio by using the asynchronous thread, and sending the initial level to a main thread;
correspondingly, the loading module is specifically configured to execute:
and loading the initial multi-detail level model corresponding to the initial level into a memory by using the main thread.
Optionally, the loading module is specifically configured to perform:
transmitting the initial level to a loading thread by using the main thread;
and loading the initial multi-detail level model corresponding to the initial level into a memory by using the loading thread.
Optionally, the object rendering apparatus further includes:
the rendering module is used for determining a target multi-detail level model to be used for rendering the object to be rendered by utilizing a rendering thread, and searching an initial multi-detail level model matched with the target multi-detail level model from the memory; and rendering the object to be rendered according to the initial multi-detail level model matched with the target multi-detail level model by using the rendering thread.
Optionally, the rendering module is specifically configured to perform:
acquiring the object to be rendered in the display interface by using a rendering thread, and determining the screen occupation ratio between the object to be rendered and the display interface;
and determining a target multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio by utilizing the rendering thread.
Optionally, the rendering module is further configured to perform:
if the rendering thread does not find an initial multi-detail level model matched with the target multi-detail level model from the memory, the rendering thread is used for finding a near multi-detail level model from the memory, wherein the near multi-detail level model is a multi-detail level model corresponding to the target level of the target multi-detail level model in the memory and the closest level; and rendering the object to be rendered according to the near multi-detail level model by using the rendering thread.
Optionally, the object rendering apparatus further includes:
the unloading module is used for searching the multi-detail level model which is not matched with the initial multi-detail level model from the memory; unloading the multi-detail level model which is not matched with the initial multi-detail level model in the memory.
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;
accordingly, the first determining module is specifically configured to perform:
acquiring current position information of the object to be rendered on the display interface;
determining the size of a bounding box of the object to be rendered according to the current position information;
and determining the pixel ratio between the object to be rendered and the display interface according to the size of the bounding box.
In addition, the embodiment of the application also provides electronic equipment, which comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used for running the computer program in the memory to realize the object rendering method provided by the embodiment of the application.
In addition, the embodiment of the application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute any one of the object rendering methods provided by the embodiment of the application.
In addition, the embodiment of the application also provides a computer program product, which comprises a computer program, wherein the computer program is executed by a processor to realize any object rendering method provided by the embodiment of the application.
In the embodiment of the application, an object to be rendered in a display interface is acquired first. A screen ratio between the object to be rendered and the display interface is then determined. And then determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio. And finally, loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
In the embodiment of the application, the initial multi-detail level model needed to be used for rendering the object to be rendered is determined according to the screen ratio between the object to be rendered and the display interface, then the initial multi-detail level model needed to be used for rendering the object to be rendered is only loaded into the memory, and all multi-detail level models corresponding to the object to be rendered are not required to be loaded into the memory, namely in the embodiment of the application, the multi-detail level model is loaded by a streaming loading method, so that the memory occupied by the multi-detail level model is saved, and the crash rate of a game is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view of a scene of an object rendering process provided in an embodiment of the present application;
fig. 2 is a flow chart of an object rendering method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a two-dimensional shape, a first length value, and a second length value provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of another object rendering method according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of rendering an object to be rendered using a rendering thread provided by an embodiment of the present application;
FIG. 6 is a flowchart of another object rendering method according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an object rendering apparatus provided in an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Embodiments of the present application provide an object rendering method, apparatus, and computer-readable storage medium. The object rendering device may be integrated in an electronic device, which may be a server or a terminal.
For example, referring to fig. 1, taking an example that the object rendering device is integrated in a terminal, the terminal first obtains an object to be rendered in the display interface. A screen ratio between the object to be rendered and the display interface is then determined. And then determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio. And finally, loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligent platform.
Also, multiple servers may be organized into a blockchain, with the servers being nodes on the blockchain.
The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart home appliance, a vehicle-mounted terminal, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
The embodiments of the present application may be applied to various scenarios including, but not limited to, cloud technology, artificial intelligence, intelligent transportation, assisted driving, and map fields, among others.
In addition, "plurality" in the embodiments of the present application means two or more. "first" and "second" and the like in the embodiments of the present application are used for distinguishing descriptions and are not to be construed as implying relative importance.
The following will describe in detail. The following description of the embodiments is not intended to limit the preferred embodiments.
The multi-level-of-detail technology refers to a technology for determining the number of faces and the degree of detail of an object displayed on a display interface according to the position and the importance of the object model in a display environment, namely determining the allocation of resources rendered by the object.
In the multi-level-of-detail technology, one object to be rendered has a multi-level-of-detail model with multiple levels, and the number and material complexity of static grids on the multi-level-of-detail model with different levels are different.
The multi-level of detail model in the embodiments of the present application may also be referred to as a multi-level of detail resource, and the level of the multi-level of detail model may also be referred to as an index of the multi-level of detail model.
When the object to be rendered is rendered, all the multi-detail level models corresponding to the object to be rendered are loaded to the memory, namely, the multi-detail level models which are not used for rendering the object to be rendered are also loaded to the memory, so that the multi-detail level models occupy more memory, and game breakdown is caused.
In order to solve the technical problem that the multi-detail level model occupies more memory in the rendering process, the application provides a rendering method, wherein in the method, an object to be rendered in a display interface is acquired first. A screen ratio between the object to be rendered and the display interface is then determined. And then determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio. And finally, loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
In the embodiment of the application, the initial multi-detail level model needed to be used for rendering the object to be rendered is determined according to the screen ratio between the object to be rendered and the display interface, then the initial multi-detail level model needed to be used for rendering the object to be rendered is only loaded into the memory, and all multi-detail level models corresponding to the object to be rendered are not required to be loaded into the memory, namely in the embodiment of the application, the multi-detail level model is loaded by a streaming loading method, so that the memory occupied by the multi-detail level model is saved, and the crash rate of a game is reduced.
In this embodiment, description will be made from the perspective of an object rendering apparatus, which may be specifically integrated in a device such as a server or a terminal, and for convenience in explaining the object rendering method of the present application, the object rendering apparatus will be described in detail below in terms of integration in the terminal, that is, in terms of the terminal as an execution subject.
Referring to fig. 2, fig. 2 is a flowchart of an object rendering method according to an embodiment of the present application. The object rendering method may include:
s201, obtaining an object to be rendered in a display interface.
The object to be rendered is the object to be rendered on the display interface. For example, in a game scene, the object to be rendered may be a tree, house, or virtual character on the game interface.
When the user needs to enter the interface, the user can operate the terminal, so that the terminal displays the interface which the user needs to enter. When the terminal displays the interface, the object to be rendered in the display interface can be obtained.
S202, determining the screen ratio between the object to be rendered and the display interface.
Wherein, the screen ratio between the object to be rendered and the display interface may refer to a 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 object to be rendered and the display interface at the current position on the display interface, that is, the pixel ratio between the object to be rendered and the display interface at the current time.
When the screen 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 the terminal obtains the object to be rendered, the terminal can determine the current position information of the object to be rendered on the display interface, then determine the size of a bounding box of the object to be rendered according to the current position information, calculate the pixel of the object to be rendered on the display interface according to the size of the bounding box, and calculate the ratio of the pixel of the object to be rendered on the display interface to the pixel of the display interface, so as to obtain the screen ratio of the object to be rendered relative to the display interface.
Alternatively, the size of the bounding box refers to pixels of a two-dimensional shape on the display interface that result from 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 taking the pixels of the two-dimensional shape on the display interface as the pixels of the object to be rendered on the display interface.
Wherein, the process of determining the pixels of the two-dimensional shape on the display interface may be: and acquiring the maximum abscissa and the minimum abscissa of the two-dimensional shape on a preset coordinate axis, and then determining a first length value according to the maximum abscissa and the minimum abscissa. And acquiring the maximum ordinate and the minimum ordinate of the two-dimensional shape on a preset coordinate axis, determining a second length value according to the maximum ordinate and the minimum ordinate, and taking the first length value and the second length value as pixels of the object to be rendered on a display interface.
For example, when the two-dimensional shape is circular, then both the first length value and the second length value are diameters of the circular shape. When the two-dimensional shape is rectangular and the length of the rectangle is parallel to a preset coordinate axis, the first length value is the length of the rectangle, and the second length value is the width of the rectangle.
It should be noted that, if the two-dimensional shape is rectangular but the length of the rectangle is not parallel to the preset coordinate axis, for example, as shown in fig. 3, the first length value calculated according to the maximum abscissa and the minimum abscissa is not the length of the rectangle, and the second length value calculated according to the maximum ordinate and the minimum ordinate is not the width of the rectangle.
Or after the two-dimensional shape is obtained, determining the type of the two-dimensional shape by using an asynchronous thread, and if the type of the two-dimensional shape is a preset shape and the first length value and the second length value are the same, obtaining only the maximum abscissa and the minimum abscissa or obtaining only the maximum ordinate and the minimum ordinate, thereby improving the speed of calculating the size of the bounding box.
After obtaining the pixels of the two-dimensional shape on the display interface, dividing the first length value by the row pixels of the display interface by the asynchronous thread to obtain a first pixel ratio, dividing the second length value by the column pixels of the display interface to obtain a second pixel ratio, and taking 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 larger 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 smaller 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.
It should be noted that the shape of the bounding box may be set according to practical situations, for example, a rectangular parallelepiped bounding box or a sphere bounding box is used as the shape of the bounding box in the present embodiment, which is not limited herein.
S203, determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio.
After determining the screen ratio between the object to be rendered and the display interface, the terminal determines an initial multi-detail level model to be used for rendering the object to be rendered according to the screen ratio. The initial multi-level-of-detail model may be a multi-level-of-detail model to be used for rendering the object to be rendered at the current time, that is, a multi-level-of-detail model to be used for rendering the object to be rendered at the current position.
Optionally, the screen duty ratio and the multi-detail level model may be stored in the mapping table in an associated manner, and when the terminal obtains the screen duty ratio, the initial multi-detail level model corresponding to the screen duty ratio is searched from the mapping table, so as to obtain the initial multi-detail level model required to be used for rendering the object to be rendered.
In the mapping table, the relationship between the screen duty ratio and the multi-level-of-detail model may be a one-to-one relationship, or the relationship between the screen duty ratio and the multi-level-of-detail model may be a many-to-one relationship, or a one-to-many relationship. For example, a screen duty cycle of 0.5 may correspond to multi-level of detail model 1. For another example, a screen ratio of 0.5 may correspond to multi-level of detail model 1 and multi-level of detail model 2. For another example, a screen duty cycle of 0.5 and a screen duty cycle of 0.51 each correspond to multi-level of detail model 1.
It should be appreciated that when the relationship between the screen duty cycle and the multi-level of detail model is a one-to-many relationship, one of the multi-level of detail models corresponding to the screen duty cycle may be selected as the initial multi-level of detail model.
Alternatively, the screen duty ratio may be input into a preset function to perform calculation, so as to obtain an initial level of the initial multi-detail level model, and then the initial multi-detail level model corresponding to the initial level is searched, so as to obtain the initial multi-detail level model corresponding to the screen duty ratio.
Since the more details of the object to be rendered are seen by the user when the screen ratio is larger, the higher-level multi-level detail model (the more the number of static grids contained in the higher-level multi-level detail model) is required to be used for rendering the object to be rendered, the level of the multi-level detail model required to be used for rendering the object to be rendered becomes larger as the screen ratio of the object to be rendered becomes larger. Therefore, the screen duty ratio is taken as an independent variable, the level of the multi-detail level model is taken as a dependent variable, and a function which becomes larger as the independent variable becomes larger can be taken as a preset function, for example, the preset function can be a direct proportion function, or the preset function can be a piecewise function (the dependent variable of each function in the piecewise function becomes larger as the independent variable becomes larger).
It should be noted that the preset function may be a linear function or a nonlinear function, and the specific type of the preset function may be set according to the actual situation, which is not specifically limited herein.
In some embodiments, because the object to be rendered moves on the display interface after rendering, the initial multi-level-of-detail model corresponding to the moved object to be rendered also changes, and therefore, the moved object to be rendered needs to be re-rendered by adopting the changed initial multi-level-of-detail model. Therefore, in order to accelerate the efficiency of the subsequent rendering, the initial multi-detail level model needed for rendering the object to be rendered at the current moment is determined according to the screen duty ratio, and meanwhile, the initial multi-detail level model needed for rendering the object to be rendered at the preset future time can be predicted according to the screen duty ratio.
The process of determining the initial multi-detail level model to be used for rendering the object to be rendered at the current time and the preset future time according to the screen duty ratio may be: and searching a section to which the screen duty ratio belongs, and then taking each multi-detail level model corresponding to the section as an initial multi-detail level model required to be used for rendering the object to be rendered at the current moment and the preset future time.
For example, the screen ratio is 0.51, the section 1 includes a screen ratio of 0.5-0.55, the detail level model corresponding to the section 1 includes multiple detail level models 1-6, the section to which the screen ratio of 0.51 belongs is the section 1, and the initial multiple detail level models are the multiple detail level models 1-6 respectively.
And then, when rendering is carried out, finding an initial multi-detail level model which is needed to be used for rendering the object to be rendered at the current moment from the memory according to the screen duty ratio.
For example, the screen duty ratio is 0.51, and the memory includes the initial multi-detail level models 1-6, then the initial multi-detail level model 2 corresponding to the screen duty ratio of 0.51 is found from the memory, and the initial multi-detail level model 2 is the initial multi-detail level model required to be used for rendering the object to be rendered at the current moment.
For the interval, the terminal can predict the position of the object to be rendered on the display interface at the preset future time, namely, the terminal can predict the changed position of the object to be rendered, then the screen ratio between the changed position of the object to be rendered and the display interface and the screen ratio between the current moment of the object to be rendered and the display interface are placed in the same interval, namely, the screen ratio between the changed position of the object to be rendered and the display interface and the screen ratio between the current position of the object to be rendered and the display interface are placed in the same interval.
In this embodiment, an initial multi-detail level model to be used for rendering the object to be rendered at a preset future time is predicted according to the screen duty ratio, and then the initial multi-detail level model to be used 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 to be used for rendering the object to be rendered can be directly obtained from the memory, and the initial multi-detail level model to be used for rendering the object to be rendered does not need to be loaded into the memory, thereby improving the efficiency of rendering the object to be rendered.
In other embodiments, before determining an initial multi-level-of-detail model to be used for rendering an object to be rendered according to the screen ratio, the multi-level-of-detail models of different levels corresponding to the object to be rendered may be acquired first, and then the multi-level-of-detail models of different levels corresponding to the object to be rendered are stored in a target file corresponding to the object to be rendered, so that the initial multi-level-of-detail model corresponding to the initial level may be acquired from the target file later, and the initial multi-level-of-detail model may be loaded into the memory.
S204, loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
After determining an initial multi-detail level model to be used for rendering the object to be rendered, the terminal can only load the initial multi-detail level model into the memory, does not need to load all the detail level models corresponding to the object to be rendered into the memory, and then in the game running process, if other detail level models of the object to be rendered need to be adopted, then other detail level models of the object to be rendered need to be loaded, namely, the game can be run at the moment, and the other detail level models of the object to be rendered are loaded at the same time, so that the memory occupied by the multi-detail level model and the initial multi-detail level model in the subsequent call memory are saved, and the object to be rendered is rendered.
In the application, the multi-detail level model is loaded by a streaming loading method, so that the memory occupied by the multi-detail level model is saved. The streaming loading refers to loading an initial multi-detail level model needed by rendering an object to be rendered, and then loading other multi-detail level models of the object to be rendered while running a game.
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 may be immediately called to render the object to be rendered, or after a rendering instruction is received, the initial multi-level-of-detail model in the memory may be called to render the object to be rendered.
Invoking the initial multi-detail level model in the memory to render the object to be rendered refers to invoking a static network on the initial multi-detail level model in the memory to render the object to be rendered.
In other embodiments, since the main thread (the thread running immediately when a program is started) has relatively more data to be calculated when executing, if the screen ratio between the object to be rendered and the display interface is determined by the main thread and the initial multi-detail level model to be used for rendering the object to be rendered is determined according to the screen ratio, the speed is relatively slow, and the efficiency of game running is reduced.
In order to improve the efficiency of game execution, in this embodiment, after the object to be rendered is acquired by the main thread, the object to be rendered may be sent to the asynchronous thread. And then, determining the screen ratio between the object to be rendered and the display interface by utilizing the asynchronous thread, and determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen ratio.
Wherein, sending the object to be rendered to the asynchronous thread by the main thread may refer to sending the current position information of the object to be rendered to the asynchronous thread, and determining the screen ratio between the object to be rendered and the display interface by the asynchronous thread based on the current position information (refer to fig. 4). And when the current position information of the object to be rendered is updated, the updated current position is sent to the asynchronous thread by the main thread.
In this embodiment, since the asynchronous thread needs less data to be calculated, the efficiency of game running can be improved by determining the screen ratio between the object to be rendered and the display interface by the asynchronous thread and determining the initial multi-detail level model to be used for rendering the object to be rendered according to the screen ratio.
Optionally, the detailed procedure of determining an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen duty ratio by using the asynchronous thread may be: and determining the initial level of the initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio by utilizing the asynchronous thread, then sending the initial level to a main thread (refer to fig. 4), and loading the initial multi-detail level model corresponding to the initial level into a memory by utilizing the main thread.
And an initial multi-detail level model to be used for rendering the object to be rendered at the current moment and the preset future time can be determined by utilizing an asynchronous thread according to the screen duty ratio.
In addition, after the initial level is sent to the main thread, the main thread can be used for sending the initial level to the loading thread, and then the loading thread is used for loading the initial multi-detail level model corresponding to the initial level into the memory.
Optionally, since the multi-detail level models of different levels corresponding to the object to be rendered are stored in the target file corresponding to the object to be rendered, the process of loading the initial multi-detail level model corresponding to the initial level into the memory by using the loading thread is as follows: the loading thread is utilized to request to load the initial multi-detail level model corresponding to the initial level in the target file, the initial multi-detail level model corresponding to the initial level in the target file is loaded into the memory, namely, the loading thread is utilized to acquire the initial multi-detail level model corresponding to the initial level from the target file, and the initial multi-detail level model corresponding to the initial level is loaded into the memory (refer to fig. 4).
Finally, the loaded initial multi-detail level model is sent to the main thread, so that the main thread can render the object to be rendered by adopting the initial multi-detail level model (refer to fig. 4).
The loading thread is utilized to load the initial multi-detail level model, and the initial multi-detail level model is not required to be loaded through the main thread, so that the terminal can load the initial multi-detail level model while running the game, and the game is not blocked.
In other embodiments, invoking the initial multi-level of detail model in memory to render the object to be rendered includes: determining a target multi-detail level model to be used for rendering the object to be rendered by using a rendering thread, searching an initial multi-detail level model matched with the target multi-detail level model from a memory, and rendering the object to be rendered by using the rendering thread according to the initial multi-detail level model matched with the target multi-detail level model.
In the process of searching the initial multi-detail level model matched with the target multi-detail level model, the target level of the target multi-detail level model can be matched with the initial level in the memory, and then the initial multi-detail level model corresponding to the initial level matched with the target level is used as the initial multi-detail level model matched with the target multi-detail level model.
The initial multi-level of detail model that matches the target multi-level of detail model refers to the same initial multi-level of detail model as the target multi-level of detail model.
The method for determining the target multi-detail level model to be used for rendering the object to be rendered by using the rendering thread also comprises the steps of determining according to the screen ratio between the object to be rendered and the display interface, namely, firstly acquiring the object to be rendered in the display interface by using the rendering thread, determining the screen ratio between the object to be rendered and the display interface, and then determining the target multi-detail level model to be used for rendering the object to be rendered by using the rendering thread according to the screen ratio. The specific implementation process may refer to the above process of determining the initial multi-level-of-detail model according to the screen ratio between the object to be rendered and the display interface, and this embodiment will not be described herein.
Since the sum of the time for determining the initial multi-level model to be used for rendering the object to be rendered by using the asynchronous thread according to the screen duty ratio and the time for loading the initial multi-level model may be more than the time for determining the target multi-level model to be used for rendering the object to be rendered by using the rendering thread according to the screen duty ratio, a phenomenon may occur that after the target multi-level model to be used for rendering the object to be rendered is determined by using the rendering thread according to the screen duty ratio, the initial multi-level model matched with the target multi-level model is not loaded into the memory or is still in the middle of loading, so that the initial multi-level model matched with the target multi-level model is not found from the memory by using the rendering thread at this time.
Thus, in other embodiments, if the rendering thread is utilized to find no initial multi-level-of-detail model from memory that matches the target multi-level-of-detail model, then the rendering thread is utilized to find a near multi-level-of-detail model from memory that is the multi-level-of-detail model in memory that corresponds to the target level of the target multi-level-of-detail model, the closest level.
For example, if the target level is level 1, and the memory includes a level 9 multi-detail level model and a level 10 multi-detail level model, then level 9 in the memory is closest to level 1, and the level 9 multi-detail level model is regarded as a near multi-detail level model.
And then rendering the object to be rendered according to the near multi-detail level model by using the rendering thread. Because the object to be rendered is rendered by the near multi-detail level model, the object to be rendered is actually required to be rendered by the target multi-detail level model. Therefore, after the rendering thread is utilized to render the object to be rendered according to the near multi-detail level model, in order to improve the rendering effect, the rendering thread can be utilized to continuously search the initial multi-detail level model matched with the target multi-detail level model from the memory until the rendering thread is utilized to search the initial multi-detail level model matched with the target multi-detail level model, and then the rendering thread is utilized to render the object to be rendered again by adopting the initial multi-detail level model matched with the target multi-detail level model.
It should be noted that, the detailed process of searching the near multi-detail level model from the memory by using the rendering thread may be: and searching a level closest to the target level of the target multi-detail level model in the memory by using the rendering thread, and taking the multi-detail level model corresponding to the level closest to the target level as a near multi-detail level model.
Alternatively, a process of rendering an object to be rendered by a rendering thread according to the present embodiment is further described with reference to fig. 5. Firstly, determining the screen ratio between an object to be rendered and a display interface by using a rendering thread, and then determining the target level of the target multi-detail level model according to the screen ratio by using the rendering thread. And matching the target grade with the initial grade in the memory, and if the initial grade matched with the target grade exists, rendering the object to be rendered by using the rendering thread by adopting an initial multi-detail-level model corresponding to the initial grade matched with the target grade.
If the initial level matched with the target level does not exist, searching a level closest to the target level from a memory by using a rendering thread, and rendering the object to be rendered by adopting a close multi-detail level model corresponding to the level closest to the target level. And simultaneously, returning to execute the matching of the target grade and the initial grade in the memory until the initial grade matched with the target grade is found, and then, re-adopting the initial grade initial multi-detail level model matched with the target grade to render the object to be rendered by utilizing the rendering thread.
To further save memory occupied by the multi-level of detail model, in other embodiments, after loading the initial multi-level of detail model into memory, further comprises:
Searching a multi-detail level model which is not matched with the initial multi-detail level model from a memory; unloading the multi-detail level model which is not matched with the initial multi-detail level model in the memory.
If the multi-detail level model which is not matched with the initial multi-detail level model exists in the memory, the fact that the multi-detail level model which is not needed by rendering the object to be rendered exists in the memory is indicated, and at the moment, the multi-detail level model which is not matched with the initial multi-detail level model in the memory is unloaded, so that the memory occupied by the multi-detail level model corresponding to the unloading level is saved.
Optionally, searching the multi-detail level model which is not matched with the initial multi-detail level model from the memory, and unloading the multi-detail level model which is not matched with the initial multi-detail level model from the memory may be: and searching the unloading level which is not matched with the initial level from the memory by utilizing the main thread, and unloading the multi-detail level model (refer to fig. 4) corresponding to the unloading level in the memory by utilizing the main thread, wherein the multi-detail level model corresponding to the unloading level is the multi-detail level model which is not matched with the initial multi-detail level model.
As can be seen from the above, in the embodiment of the present application, the object to be rendered in the display interface is acquired first. A screen ratio between the object to be rendered and the display interface is then determined. And then determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio. And finally, loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
In the embodiment of the application, the initial multi-detail level model needed to be used for rendering the object to be rendered is determined according to the screen ratio between the object to be rendered and the display interface, then the initial multi-detail level model needed to be used for rendering the object to be rendered is only loaded into the memory, and all multi-detail level models corresponding to the object to be rendered are not required to be loaded into the memory, namely in the embodiment of the application, the multi-detail level model is loaded by a streaming loading method, so that the memory occupied by the multi-detail level model is saved, and the crash rate of a game is reduced.
The method described in the above embodiments is described in further detail below by way of example.
In this embodiment, an object rendering device is integrated in a terminal, refer to fig. 6, and fig. 6 is a flowchart of an object rendering method according to an embodiment of the present application. The object rendering method flow may include:
s601, the terminal acquires an object to be rendered in the display interface by using the main thread, and determines the current position information of the object to be rendered on the display interface.
The object to be rendered is the object to be rendered on the display interface. For example, in a game scene, the object to be rendered may be a tree, house, or virtual character on the game interface.
S602, the terminal sends the current position information to the asynchronous thread by using the main thread, and determines the size of the bounding box of the object to be rendered by using the asynchronous thread based on the current position information.
The size of the bounding box refers to the pixels of the two-dimensional shape on the display interface that result from projecting the bounding box onto the display interface. The graph of the bounding box may be set according to practical situations, for example, a cuboid bounding box or a sphere bounding box is used as the graph of the bounding box in this embodiment, which is not limited herein.
Wherein, the process of determining the pixels of the two-dimensional shape on the display interface may be: and acquiring the maximum abscissa and the minimum abscissa of the two-dimensional shape on a preset coordinate axis, and then determining a first length value according to the maximum abscissa and the minimum abscissa. And acquiring the maximum ordinate and the minimum ordinate of the two-dimensional shape on a preset coordinate axis, determining a second length value according to the maximum ordinate and the minimum ordinate, and taking the first length value and the second length value as pixels of the object to be rendered on a display interface.
For example, when the two-dimensional shape is circular, then both the first length value and the second length value are diameters of the circular shape. When the two-dimensional shape is rectangular and the length of the rectangle is parallel to a preset coordinate axis, the first length value is the length of the rectangle, and the second length value is the width of the rectangle.
It should be noted that, if the two-dimensional shape is rectangular but the length of the rectangle is not parallel to the preset coordinate axis, for example, as shown in fig. 3, the first length value calculated according to the maximum abscissa and the minimum abscissa is not the length of the rectangle, and the second length value calculated according to the maximum ordinate and the minimum ordinate is not the width of the rectangle.
S603, the terminal determines the pixel ratio between the object to be rendered and the display interface according to the size of the bounding box by using the asynchronous thread.
After obtaining the size of the bounding box, namely obtaining a first length value and a second length value, dividing the first length value by row pixels of the display interface by using an asynchronous thread to obtain a first pixel ratio, dividing the second length value by column pixels of the display interface to obtain a second pixel ratio, and taking 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 larger 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 smaller 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.
S604, the terminal determines an initial multi-detail level model to be used for rendering the object to be rendered at the current moment and the preset future time according to the pixel ratio by using the asynchronous thread.
Because the object to be rendered can move on the display interface after being rendered, the initial multi-detail level model corresponding to the moved object to be rendered is also changed, and therefore the moved object to be rendered needs to be rendered again by adopting the changed initial multi-detail level model. Therefore, in order to accelerate the efficiency of the subsequent rendering, the asynchronous thread is utilized to determine an initial multi-detail level model to be used for rendering the object to be rendered at the current moment according to the pixel ratio, and simultaneously, the initial multi-detail level model to be used for rendering the object to be rendered at the preset future time can be predicted according to the pixel ratio.
The process of determining an initial multi-detail level model to be used for rendering the object to be rendered at the current time and the preset future time by using the asynchronous thread according to the pixel ratio may be: and searching a pixel interval to which the pixel ratio belongs by using an asynchronous thread, and then taking each multi-detail level model corresponding to the pixel interval as an initial multi-detail level model to be used for rendering the object to be rendered at the current moment and the preset future time.
For example, the pixel ratio is 0.51, the pixel interval 1 includes a pixel ratio of 0.5-0.55, the detail level model corresponding to the pixel interval 1 includes multiple detail level models 1-6, the pixel interval to which the pixel ratio of 0.51 belongs is the pixel interval 1, and the initial multiple detail level models are the multiple detail level models 1-6 respectively.
And when the rendering is performed later, the rendering thread is utilized to find an initial multi-detail level model which is needed to be used for rendering the object to be rendered at the current moment from the memory according to the pixel ratio.
For example, if the pixel ratio is 0.51 and the memory includes the initial multi-detail level models 1 to 6, the initial multi-detail level model 2 corresponding to the pixel ratio of 0.51 is found from the memory, and the initial multi-detail level model 2 is the initial multi-detail level model to be used for rendering the object to be rendered at the current time.
For the pixel interval, the terminal can predict the position of the object to be rendered on the display interface at the preset future time by using the asynchronous thread, namely, the terminal can predict the changed position of the object to be rendered by using the asynchronous thread, then the pixel ratio between the changed position of the object to be rendered and the display interface and the pixel ratio between the current moment of the object to be rendered and the display interface are placed in the same pixel interval, namely, the pixel ratio between the changed position of the object to be rendered and the display interface and the pixel ratio between the current position of the object to be rendered and the display interface are placed in the same pixel interval.
In this embodiment, an asynchronous thread is utilized to predict an initial multi-detail level model to be used for rendering the object to be rendered at a preset future time according to the pixel ratio, and then the initial multi-detail level model to be used 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 to be used for rendering the object to be rendered can be directly obtained from the memory, and the initial multi-detail level model to be used for rendering the object to be rendered does not need to be loaded into the memory, thereby improving the efficiency of rendering the object to be rendered.
In this embodiment, since the asynchronous thread has less data to be calculated, the efficiency of game running can be improved by executing S602 to S604 by the asynchronous thread.
S605, the terminal sends the initial level of the initial multi-detail level model to the main thread by using the asynchronous thread.
S606, the terminal sends the initial level to the loading thread by using the main thread, and loads the initial multi-detail level model corresponding to the initial level into the memory by using the loading thread.
The loading thread is utilized to load the initial multi-detail level model, and the initial multi-detail level model is not required to be loaded through the main thread, so that the terminal can load the initial multi-detail level model while running the game, and the game is not blocked.
S607, the terminal searches the unloading grade which is not matched with the initial grade from the memory by using the main thread, and unloads the multi-detail level model corresponding to the unloading grade in the memory by using the main thread.
If the memory has an unloading level different from the initial level, the fact that the memory has a multi-detail level model which is not needed by rendering the object to be rendered is indicated, namely, the object to be rendered does not need to be used for the multi-detail level model corresponding to the unloading level, at the moment, the multi-detail level model corresponding to the unloading level in the memory is unloaded by the main thread, so that the memory occupied by the multi-detail level model corresponding to the unloading level is saved.
And S608, the terminal sends the current position information to the rendering thread by using the main thread, and determines a target multi-detail level model to be used for rendering the object to be rendered at the current moment by using the rendering thread based on the current position information.
The specific process of determining, by the terminal, the target multi-level-of-detail model to be used for rendering the object to be rendered at the current time based on the current position information by using the rendering thread may refer to the above-mentioned S602 to S603, and this embodiment will not be described herein.
S609, the terminal searches an initial multi-detail level model matched with the target multi-detail level model from the memory by using the rendering thread.
The target level of the target multi-level of detail model may be matched with the initial level in the memory, and then the initial multi-level of detail model corresponding to the initial level matched with the target level may be used as the initial multi-level of detail model matched with the target multi-level of detail model.
The initial multi-level of detail model that matches the target multi-level of detail model refers to the same initial multi-level of detail model as the multi-level of detail model.
And S6010, the terminal renders the object to be rendered by using the rendering thread according to the initial multi-detail level model matched with the target multi-detail level model.
S6011, if the rendering thread is utilized to find the initial multi-detail level model matched with the target multi-detail level model from the memory, the terminal utilizes the rendering thread to find a near multi-detail level model from the memory, wherein the near multi-detail level model is a multi-detail level model corresponding to a near level closest to the target level of the target multi-detail level model in the memory.
If the rendering thread is utilized to find the initial multi-detail level model matched with the target multi-detail level model from the memory, and the loading thread is not used for loading the initial multi-detail level model matched with the target multi-detail level model into the memory or is still in the process of loading, the rendering thread is utilized to find the approximate multi-detail level model from the memory, and the approximate multi-detail level model is the multi-detail level model corresponding to the approximate level closest to the target level of the target multi-detail level model in the memory.
For example, if the target level is level 1, and the memory includes a level 9 multi-detail level model and a level 10 multi-detail level model, then level 9 in the memory is closest to level 1, and the level 9 multi-detail level model is regarded as a near multi-detail level model.
And S6012, the terminal renders the object to be rendered according to the near multi-detail level model by using the rendering thread.
And after the terminal determines the near multi-detail level model by using the rendering thread, rendering the object to be rendered by using the rendering thread according to the near multi-detail level model. And the rendering thread is utilized to continuously search the initial multi-detail level model matched with the target multi-detail level model from the memory until the rendering thread is utilized to search the initial multi-detail level model matched with the target multi-detail level model, and then the rendering thread is utilized to render the object to be rendered by re-adopting the initial multi-detail level model matched with the target multi-detail level model.
From the above, in the embodiment of the present application, an initial multi-detail level model to be used for rendering an object to be rendered is determined by using an asynchronous thread through a pixel ratio between the object to be rendered and a display interface, and then only the initial multi-detail level model to be used for rendering the object to be rendered is loaded into a memory by using a loading thread, and all the multi-detail level models corresponding to the object to be rendered are not required to be loaded into the memory, i.e., in the embodiment of the present application, the multi-detail level model is loaded by a streaming loading method, so that the memory occupied by the multi-detail level model is saved, and the crash rate of a game is reduced.
In order to facilitate better implementation of the object rendering method provided by the embodiment of the application, the embodiment of the application also provides a device based on the object rendering method. Wherein the meaning of nouns is the same as in the object rendering method described above, specific implementation details may be referred to the description in the method embodiment.
For example, as shown in fig. 7, the object rendering apparatus may include:
the obtaining module 701 is configured to obtain an object to be rendered in the display interface.
A first determining module 702 is configured to determine a screen duty ratio between an object to be rendered and a display interface.
A second determining module 703 is configured to determine an initial multi-level of detail model to be used for rendering the object to be rendered according to the screen duty ratio.
The loading module 704 is configured to load the initial multi-level-of-detail model into the memory, so as to invoke the initial multi-level-of-detail model in the memory to render the object to be rendered.
Optionally, the second determining module 703 is specifically configured to perform:
and determining an initial multi-detail level model to be used for rendering the object to be rendered at the current moment and a preset future time according to the screen duty ratio.
Optionally, the first determining module 702 is specifically configured to perform:
and determining the screen ratio between the object to be rendered and the display interface by using the asynchronous thread.
The second determining module 703 is specifically configured to perform:
and determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio by utilizing the asynchronous thread.
Optionally, the second determining module 703 is specifically configured to perform:
and determining the initial level of the initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio, and sending the initial level to the main thread.
Accordingly, the loading module 704 is specifically configured to perform:
and loading the initial multi-detail level model corresponding to the initial level into a memory by using the main thread.
Optionally, the loading module 704 is specifically configured to perform:
transmitting the initial grade to a loading thread by utilizing a main thread;
and loading the initial multi-detail level model corresponding to the initial level into a memory by using a loading thread.
Optionally, the object rendering apparatus further includes:
the rendering module is used for determining a target multi-detail level model to be used for rendering the object to be rendered by utilizing a rendering thread and searching an initial multi-detail level model matched with the target multi-detail level model from a memory; and rendering the object to be rendered according to the initial multi-detail level model matched with the target multi-detail level model by using a rendering thread.
Optionally, the rendering module is specifically configured to perform:
acquiring an object to be rendered in a display interface by using a rendering thread, and determining the screen occupation ratio between the object to be rendered and the display interface;
and determining a target multi-detail level model to be used for rendering the object to be rendered by using the rendering thread according to the screen duty ratio.
Optionally, the rendering module is further configured to perform:
if the rendering thread is utilized to find the initial multi-detail level model matched with the target multi-detail level model from the memory, the rendering thread is utilized to find a near multi-detail level model from the memory, wherein the near multi-detail level model is a multi-detail level model corresponding to the target level of the target multi-detail level model in the memory and the nearest level; rendering the object to be rendered according to the near multi-detail level model by using the rendering thread.
Optionally, the object rendering apparatus further includes:
the unloading module is used for searching the multi-detail level model which is not matched with the initial multi-detail level model from the memory; unloading the multi-detail level model which is not matched with the initial multi-detail level model in the memory.
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;
Accordingly, the first determining module 702 is specifically configured to perform:
acquiring current position information of an object to be rendered on a display interface;
determining the size of a bounding box of an object to be rendered according to the current position information;
and determining the pixel ratio between the object to be rendered and the display interface according to the size of the bounding box.
In the specific implementation, each module may be implemented as an independent entity, or may be combined arbitrarily, and implemented as the same entity or a plurality of entities, and the specific implementation and the corresponding beneficial effects of each module may be referred to the foregoing method embodiments, which are not described herein again.
The embodiment of the application also provides an electronic device, which may be a server or a terminal, as shown in fig. 8, and shows a schematic structural diagram of the electronic device according to the embodiment of the application, specifically:
the electronic device may include one or more processing cores 'processors 801, one or more computer-readable storage media's memory 802, power supply 803, and input unit 804, among other components. It will be appreciated by those skilled in the art that the electronic device structure shown in fig. 8 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. Wherein:
The processor 801 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing computer programs and/or modules stored in the memory 802, and calling data stored in the memory 802, thereby performing overall monitoring of the electronic device. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 801.
The memory 802 may be used to store computer programs and modules, and the processor 801 performs various functional applications and data processing by executing the computer programs and modules stored in the memory 802. The memory 802 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, computer programs required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to the use of the electronic device, etc. In addition, memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.
The electronic device further comprises a power supply 803 for powering the various components, preferably the power supply 803 can be logically coupled to the processor 801 via a power management system such that functions such as managing charging, discharging, and power consumption are performed by the power management system. The power supply 803 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may further comprise an input unit 804, which input unit 804 may be used for receiving input digital or character information and for generating keyboard, mouse, joystick, optical or trackball signal inputs in connection with user settings and function control.
Although not shown, the electronic device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processor 801 in the electronic device loads 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 executes the computer programs stored in the memory 802, so as to implement various functions, such as:
Acquiring an object to be rendered in a display interface;
determining a screen duty ratio between an object to be rendered and a display interface;
determining an initial multi-detail level model to be used for rendering an object to be rendered according to the screen occupation ratio;
and loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
The specific embodiments and the corresponding beneficial effects of the above operations can be referred to the above detailed description of the image processing method, and are not described herein.
It will be appreciated by those of ordinary skill in the art that all or part of the steps of the various methods of the above embodiments may be performed by a computer program, or by computer program control related hardware, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium having stored therein a computer program that is capable of being loaded by a processor to perform steps in any of the object rendering methods provided by embodiments of the present application. For example, the computer program may perform the steps of:
Acquiring an object to be rendered in a display interface;
determining a screen duty ratio between an object to be rendered and a display interface;
determining an initial multi-detail level model to be used for rendering an object to be rendered according to the screen occupation ratio;
and loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
The specific embodiments and the corresponding beneficial effects of each of the above operations can be found in the foregoing embodiments, and are not described herein again.
Wherein the computer-readable storage medium may comprise: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
Since the computer program stored in the computer readable storage medium may execute the steps in any one of the object rendering methods provided in the embodiments of the present application, the beneficial effects that any one of the object rendering methods provided in the embodiments of the present application may be achieved, which are detailed in the previous embodiments and are not described herein.
Among other things, according to one aspect of the present application, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from a computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the above-described object rendering method.
The foregoing has described in detail the methods, apparatuses, electronic devices and computer readable storage medium for rendering objects provided in the embodiments of the present application, and specific examples have been applied to illustrate the principles and embodiments of the present application, where the foregoing examples are provided to assist in understanding the methods and core ideas of the present application; meanwhile, those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, and the present description should not be construed as limiting the present application in view of the above.

Claims (14)

1. An object rendering method, comprising:
acquiring an object to be rendered in a display interface;
determining a screen ratio between the object to be rendered and the display interface;
determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio;
and loading the initial multi-detail level model into a memory to call the initial multi-detail level model in the memory to render the object to be rendered.
2. The method for rendering objects according to claim 1, wherein the determining an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio comprises:
And determining an initial multi-detail level model to be used for rendering the object to be rendered at the current moment and the preset future time according to the screen duty ratio.
3. The method for rendering an object according to claim 1, wherein determining a 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, comprises:
and determining a screen ratio between the object to be rendered and the display interface by utilizing an asynchronous thread, and determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen ratio.
4. The method for rendering objects according to claim 3, wherein the determining an initial multi-level-of-detail model to be used for rendering the object to be rendered according to the screen ratio comprises:
determining an initial level of an initial multi-detail level model to be used for rendering the object to be rendered by using an asynchronous thread;
sending the initial level to a main thread;
accordingly, the loading the initial multi-level of detail model into memory includes:
and loading the initial multi-detail level model corresponding to the initial level into a memory by using the main thread.
5. The method of object rendering according to claim 4, wherein loading the initial multi-level of detail model corresponding to the initial level into memory using the main thread comprises:
sending the initial level to a loading thread by using the main thread;
and loading the initial multi-detail level model corresponding to the initial level into a memory by using the loading thread.
6. The method for rendering an object according to any one of claims 1 to 5, wherein said calling the initial multi-level of detail model in the memory to render the object to be rendered comprises:
determining a target multi-detail level model to be used for rendering the object to be rendered by using a rendering thread, and searching an initial multi-detail level model matched with the target multi-detail level model from the memory;
and rendering the object to be rendered by using the rendering thread according to an initial multi-detail level model matched with the target multi-detail level model.
7. The object rendering method of claim 6, wherein determining, with a rendering thread, a target multi-level of detail model to be used for rendering the object to be rendered comprises:
Acquiring the object to be rendered in the display interface by using a rendering thread, and determining the screen occupation ratio between the object to be rendered and the display interface;
and determining a target multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio by utilizing the rendering thread.
8. The object rendering method of claim 6, further comprising:
if the rendering thread is utilized to find the initial multi-detail level model matched with the target multi-detail level model from the memory, the rendering thread is utilized to find a near multi-detail level model from the memory, wherein the near multi-detail level model is a multi-detail level model corresponding to the target level of the target multi-detail level model in the memory and the closest level;
accordingly, the rendering the object to be rendered according to the initial multi-level-of-detail model matched with the target multi-level-of-detail model by using the rendering thread comprises:
and rendering the object to be rendered according to the near multi-detail level model by using the rendering thread.
9. The method of object rendering of claim 1, further comprising, after said loading the initial multi-level of detail model into memory:
Searching a multi-detail level model which is not matched with the initial multi-detail level model from the memory;
unloading the multi-detail level model which is not matched with the initial multi-detail level model in the memory.
10. The object rendering method according to claim 1, wherein a 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;
accordingly, the determining the screen ratio between the object to be rendered and the display interface includes:
acquiring current position information of the object to be rendered on the display interface;
determining the size of a bounding box of the object to be rendered according to the current position information;
and determining the pixel ratio between the object to be rendered and the display interface according to the size of the bounding box.
11. An object rendering apparatus, comprising:
the acquisition module is used for acquiring an object to be rendered in the display interface;
a first determining module, configured to determine a screen ratio between the object to be rendered and the display interface;
the second determining module is used for determining an initial multi-detail level model to be used for rendering the object to be rendered according to the screen duty ratio;
And the loading module is used for loading the initial multi-detail level model into a memory so as to call the initial multi-detail level model in the memory to render the object to be rendered.
12. An electronic device comprising a processor and a memory, the memory storing a computer program, the processor being configured to execute the computer program in the memory to perform the object rendering method of any one of claims 1 to 10.
13. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program adapted to be loaded by a processor for performing the object rendering method of any one of claims 1 to 10.
14. A computer program product, characterized in that the computer program product stores a computer program adapted to be loaded by a processor for performing the object rendering method of any one of claims 1 to 10.
CN202111295388.9A 2021-11-03 2021-11-03 Object rendering method, device, electronic equipment and computer readable storage medium Pending CN116059631A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111295388.9A CN116059631A (en) 2021-11-03 2021-11-03 Object rendering method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111295388.9A CN116059631A (en) 2021-11-03 2021-11-03 Object rendering method, device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116059631A true CN116059631A (en) 2023-05-05

Family

ID=86175698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111295388.9A Pending CN116059631A (en) 2021-11-03 2021-11-03 Object rendering method, device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116059631A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116824082A (en) * 2023-08-30 2023-09-29 腾讯科技(深圳)有限公司 Virtual terrain rendering method, device, equipment, storage medium and program product

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116824082A (en) * 2023-08-30 2023-09-29 腾讯科技(深圳)有限公司 Virtual terrain rendering method, device, equipment, storage medium and program product
CN116824082B (en) * 2023-08-30 2024-02-23 腾讯科技(深圳)有限公司 Virtual terrain rendering method, device, equipment, storage medium and program product

Similar Documents

Publication Publication Date Title
CN110047123B (en) Map rendering method, map rendering device, storage medium and computer program product
CN110716766A (en) Game scene loading method and device, computer readable medium and electronic equipment
CN116059631A (en) Object rendering method, device, electronic equipment and computer readable storage medium
CN111796825B (en) Bullet screen drawing method, bullet screen drawing device, bullet screen drawing equipment and storage medium
CN111569418B (en) Rendering method, device and medium for content to be output and electronic equipment
CN113694518B (en) Freezing effect processing method and device, storage medium and electronic equipment
CN114741193A (en) Scene rendering method and device, computer readable medium and electronic equipment
CN111243069B (en) Scene switching method and system of Unity3D engine
CN113384893A (en) Data processing method and device and computer readable storage medium
CN117591053A (en) Information display method, information display device, augmented reality device and computer storage medium
CN117771666A (en) Picture display method, device, terminal and computer storage medium
CN113051491B (en) Map data processing method, apparatus, storage medium, and program product
CN113656876B (en) Automatic cabinet model generation method, device, medium and electronic equipment
CN117409113A (en) Animation playing method and device, electronic equipment and computer storage medium
CN118045338A (en) Game operation control method, game operation control device, electronic equipment and computer storage medium
CN112734898A (en) Data processing method and device, electronic equipment and storage medium
CN101587584A (en) Resource arrangement method and apparatus based on graph drawing engine
CN117406869A (en) Control triggering method and device, electronic equipment and computer storage medium
CN113821349A (en) Load balancing method and device
CN117412165A (en) Device processing method, device, computer device and computer readable storage medium
CN117899472A (en) Object rendering method, device, medium and equipment
CN116889726A (en) Game map rendering method and device, electronic equipment and readable storage medium
CN118152770A (en) Task processing method and device, electronic equipment and storage medium
CN114494507A (en) Chart data processing method and device, computer equipment and storage medium
CN117407186A (en) Task execution method, device, electronic equipment and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination