CN117531194A - Model loading method, device, equipment and storage medium in game - Google Patents

Model loading method, device, equipment and storage medium in game Download PDF

Info

Publication number
CN117531194A
CN117531194A CN202311486969.XA CN202311486969A CN117531194A CN 117531194 A CN117531194 A CN 117531194A CN 202311486969 A CN202311486969 A CN 202311486969A CN 117531194 A CN117531194 A CN 117531194A
Authority
CN
China
Prior art keywords
model
local
screen
bounding box
ratio
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
CN202311486969.XA
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.)
Shanghai Neteasy Brilliant Network Technology Co ltd
Original Assignee
Shanghai Neteasy Brilliant Network Technology 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 Shanghai Neteasy Brilliant Network Technology Co ltd filed Critical Shanghai Neteasy Brilliant Network Technology Co ltd
Priority to CN202311486969.XA priority Critical patent/CN117531194A/en
Publication of CN117531194A publication Critical patent/CN117531194A/en
Pending legal-status Critical Current

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images
    • A63F2300/6615Methods for processing data by generating or executing the game program for rendering three dimensional images using models with different levels of detail [LOD]

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a model loading method, device and equipment in a game and a storage medium, and relates to the technical field of computers. Comprising the following steps: acquiring a first distance between a virtual camera and a first bounding box corresponding to a first model; determining a first screen duty ratio corresponding to the first bounding box based on the first distance; responding to the first screen ratio being larger than a first preset screen ratio, obtaining a second distance between each local model corresponding to the first model and the virtual camera, wherein the local model is a part of the first model obtained by carrying out model division on the first model, at least part of the local model comprises a second model, and each local model is configured with a corresponding proxy model; and determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on the second screen ratio and rendering the proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model. This may make the rendering effect better.

Description

Model loading method, device, equipment and storage medium in game
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for loading a model in a game.
Background
HLOD (Hierarchical Level of Detail ) is a common optimization technique in the gaming of very large scenes. The technology can combine the long-range views into one model, thereby achieving the purpose of reducing the rendering batch.
In the related art, determining the distance between a bounding box corresponding to a model and a virtual camera, and judging whether the distance is larger than a preset distance; if yes, rendering a rough model of the model, and if not, displaying a fine model of the model.
However, in the related art, whether to render a coarse model or a fine model is determined based on the distance, and a problem of poor rendering effect easily occurs.
Disclosure of Invention
The present invention aims to solve the above-mentioned problems occurring in the related art, and to provide a method, an apparatus, a device and a storage medium for loading a model in a game.
In order to achieve the above purpose, the technical scheme adopted by the embodiment of the invention is as follows:
in a first aspect, an embodiment of the present invention provides a method for loading a model in a game, where a game scene of the game includes a first model, the first model includes at least one second model, and each of the first model and the second model is configured with a plurality of LOD models, and different LOD models correspond to different model accuracies, and the method includes:
In the game scene, acquiring a first distance between a virtual camera and a first bounding box corresponding to the first model;
determining a first screen duty ratio corresponding to the first bounding box based on the first distance;
responding to the first screen duty ratio being larger than a first preset screen duty ratio, and obtaining a second distance between each local model corresponding to the first model and the virtual camera, wherein the local model is a part of the first model obtained by carrying out model division on the first model, at least part of the local model comprises the second model, each local model is provided with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model;
and determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model based on the second screen ratio.
In a second aspect, an embodiment of the present invention further provides a model loading device in a game, where a game scene of the game includes a first model, the first model includes at least one second model, and the first model and the second model are configured with a plurality of LOD models, and different LOD models correspond to different model accuracies, and the device includes:
The first acquisition module is used for acquiring a first distance between the virtual camera and a first bounding box corresponding to the first model in the game scene;
the first determining module is used for determining a first screen duty ratio corresponding to the first bounding box based on the first distance;
the second obtaining module is used for obtaining a second distance between each local model corresponding to the first model and the virtual camera in response to the first screen ratio being larger than a first preset screen ratio, wherein the local model is a part of the first model obtained by carrying out model division on the first model, at least part of the local model comprises the second model, each local model is configured with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model;
and the second determining module is used for determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model based on the second screen ratio.
In a third aspect, an embodiment of the present invention further provides a model loading device in a game, including: a memory storing a computer program executable by the processor, and a processor implementing the method for loading a model in a game according to any one of the first aspect.
In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program is read and executed to implement the method for loading a model in a game according to any one of the first aspect.
The beneficial effects of the invention are as follows: the embodiment of the invention provides a model loading method in a game, which comprises the following steps: in a game scene, acquiring a first distance between a virtual camera and a first bounding box corresponding to a first model; determining a first screen duty ratio corresponding to the first bounding box based on the first distance; responding to the first screen ratio being larger than a first preset screen ratio, obtaining a second distance between each local model corresponding to the first model and the virtual camera, wherein the local models are partial first models obtained by carrying out model division on the first models, at least partial local models comprise second models, each local model is provided with a corresponding proxy model, and the proxy models are generated based on LOD models corresponding to the first models and LOD models corresponding to the second models; and determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on the second screen ratio and rendering the proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model. In response to the first screen duty cycle being greater than the first preset screen duty cycle, determining a second screen duty cycle based on the acquired second distance, rendering and generating a third model based on the second screen duty cycle, wherein the second screen duty cycle can more accurately represent the size of the bounding box, and therefore rendering effects can be better.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a method for loading models in a game according to an embodiment of the present invention;
FIG. 2 is a second flow chart of a model loading method in a game according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a relationship between a screen height and a virtual camera according to an embodiment of the present invention;
FIG. 4 is a flowchart of a method for loading models in a game according to an embodiment of the present invention;
FIG. 5 is a flowchart of a method for loading models in a game according to an embodiment of the present invention;
FIG. 6 is a flowchart of a method for loading models in a game according to an embodiment of the present invention;
FIG. 7 is a flowchart of a method for loading models in a game according to an embodiment of the present invention;
FIG. 8 is a flow chart of a model loading method in a game according to an embodiment of the present invention;
FIG. 9 is a schematic flow chart eight of a model loading method in a game according to an embodiment of the present invention;
FIG. 10 is a flowchart of a method for loading models in a game according to an embodiment of the present invention;
FIG. 11 is a schematic flow chart of a model loading method in a game according to an embodiment of the present invention;
FIG. 12 is a schematic diagram of a model loading device in a game according to an embodiment of the present invention;
fig. 13 is a schematic structural diagram of a model loading device in a game according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention.
Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Furthermore, the terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, without conflict, features in embodiments of the present application may be combined with each other.
The embodiment of the application provides a method for generating a model, which is applied to model loading equipment in a game, wherein the equipment can be a server or terminal equipment, and the terminal equipment can be any one of the following: computers, notebook computers, tablet computers, smart phones, and the like.
The method for loading the model in the game in one embodiment of the application can be run on a local terminal device or a server. When the model loading method in the game runs on a server, the method can be realized and executed based on a cloud interaction system, wherein the cloud interaction system comprises the server and the client device.
In an alternative embodiment, various cloud applications may be run under the cloud interaction system, for example: and (5) cloud game. Taking cloud game as an example, cloud game refers to a game mode based on cloud computing. In the running mode of the cloud game, a running main body of the game program and a game picture presentation main body are separated, the storage and running of a model loading method in the game are completed on a cloud game server, and the function of a client device is used for receiving and sending data and presenting game pictures, for example, the client device can be a display device which is close to a player side and has a data transmission function, such as a mobile terminal, a television, a computer, a palm computer and the like; but the cloud game server which performs information processing is a cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server, the cloud game server runs the game according to the operation instruction, codes and compresses data such as game pictures and the like, returns the data to the client device through a network, and finally decodes the data through the client device and outputs the game pictures.
In an alternative embodiment, taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used for interacting with the player through the graphical user interface, namely, conventionally downloading and installing the game program through the electronic device and running. The manner in which the local terminal device provides the graphical user interface to the player may include a variety of ways, for example, it may be rendered for display on a display screen of the terminal, or provided to the player by holographic projection. For example, the local terminal device may include a display screen for presenting a graphical user interface including game visuals, and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.
The following explains a model loading method in a game provided in the embodiment of the present application.
Fig. 1 is a schematic flow chart of a method for loading models in a game according to an embodiment of the present invention, as shown in fig. 1, the method includes:
s101, in a game scene, a first distance between a virtual camera and a first bounding box corresponding to a first model is obtained.
According to the method for loading the models in the game, a game scene of the game comprises a first model, the first model comprises at least one second model, the first model and the second model are respectively provided with a plurality of LOD (level of Detail) models, and different LOD models correspond to different model accuracies.
By way of example, the first model may be a portion of a game scene, and the second model may be a street light, river, road, tree, etc. in the portion of the game scene. Alternatively, the first model may be a house and then the second model may be a chair, desk, flower pot, etc. in the house.
The first bounding box is used for framing the first model, and the virtual camera is used for collecting picture information of the game scene.
S102, determining a first screen duty ratio corresponding to the first bounding box based on the first distance.
In some embodiments, the screen height corresponding to the first distance is calculated according to the first distance and the view angle of the virtual camera, and the first screen duty ratio is calculated according to the screen height corresponding to the first distance and the size of the first bounding box.
The first screen duty ratio corresponding to the first bounding box is used for representing the screen duty ratio of the first model at the first distance.
S103, responding to the fact that the first screen duty ratio is larger than the first preset screen duty ratio, and obtaining second distances between the local models corresponding to the first models and the virtual cameras.
The local model is a part of first model obtained by carrying out model division on the first model, at least part of the local model comprises a second model, each local model is configured with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model.
The proxy model corresponding to each local model may be generated in advance. The first model may be divided into at least two partial models, either on average or not, and one partial model may be a partial region of the first model.
In some embodiments, whether the first screen duty ratio is greater than the first preset screen duty ratio is determined, if yes, the second distance between each local model corresponding to the first model and the virtual camera is obtained, then the local models corresponding to the first model are obtained, the number of the local models can be at least two, in the embodiment of the application, the distances between each local model and the virtual camera can be sequentially obtained, and of course, the distances between each local model and the virtual camera can also be simultaneously obtained.
It should be noted that the first preset screen duty ratio may be preset according to the actual requirement, where the first preset screen duty ratio is the minimum screen duty ratio, and when the first preset screen duty ratio is greater than the first preset screen duty ratio, the first model corresponding to the first bounding box needs to be displayed.
S104, determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on the second screen ratio and rendering the proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model.
The second bounding box is used for framing the local model.
In the embodiment of the application, according to the second distance, the view angle of the virtual camera and the size of the second bounding boxes, calculating the second screen duty ratio of each second bounding box; and respectively judging whether the second screen ratio of each second bounding box meets the preset condition or not, and obtaining a judgment result of each second bounding box.
In some embodiments, according to the judgment result of each second bounding box, determining a proxy model corresponding to each local model and/or model information corresponding to a second model included in each local model, generating a third model according to the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model, and rendering the third model.
In addition, the proxy model characterizes a coarse model of the local model, i.e. contains fewer detail features, and the model information characterizes a fine model of the second model, i.e. contains more detail features.
In summary, the embodiment of the application provides a method for loading a model in a game, which includes: in a game scene, acquiring a first distance between a virtual camera and a first bounding box corresponding to a first model; determining a first screen duty ratio corresponding to the first bounding box based on the first distance; responding to the first screen ratio being larger than a first preset screen ratio, obtaining a second distance between each local model corresponding to the first model and the virtual camera, wherein the local models are partial first models obtained by carrying out model division on the first models, at least partial local models comprise second models, each local model is provided with a corresponding proxy model, and the proxy models are generated based on LOD models corresponding to the first models and LOD models corresponding to the second models; and determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on the second screen ratio and rendering the proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model. In response to the first screen duty cycle being greater than the first preset screen duty cycle, determining a second screen duty cycle based on the acquired second distance, rendering and generating a third model based on the second screen duty cycle, wherein the second screen duty cycle can more accurately represent the size of the bounding box, and therefore rendering effects can be better.
Optionally, fig. 2 is a second flow chart of a model loading method in a game according to an embodiment of the present invention, as shown in fig. 2, a process of determining, in S104, a second screen ratio of a second bounding box corresponding to each local model based on a second distance may include:
s201, calculating the screen height based on the second distance and the view angle of the virtual camera.
In some embodiments, a first preset formula is used to calculate a screen height corresponding to the second distance based on the second distance and the view angle of the virtual camera. Wherein the view angle of the virtual camera is preset.
Fig. 3 is a schematic diagram of a relationship between a screen height and a virtual camera according to an embodiment of the present invention, where, as shown in fig. 3, a view angle of the virtual camera may be denoted as fov, a second distance may be denoted as D, and a screen height may be denoted as H, and a second preset formula may be obtained according to fig. 3:
wherein halfscreen height is half the screen height, i.e. H/2 in fig. 3, distance is the second distance, i.e. D in fig. 3;is half the angle of view of the virtual camera.
S202, calculating a second screen duty ratio based on the screen height and the size of the second surrounding box.
In the embodiment of the application, a second preset formula is adopted, and the second screen duty ratio is calculated based on the screen height and the size of the second enclosure box.
The second preset formula is as follows:
wherein 0.5size represents half the size of the second bounding box, relativeHeigh represents the second screen duty cycle, and halfscreenehigh represents half the screen height.
Optionally, fig. 4 is a flowchart of a model loading method in a game, as shown in fig. 4, where in S104, a process of generating a third model based on a proxy model corresponding to each local model and/or model information corresponding to a second model included in each local model and rendered based on a second screen ratio may include:
s301, determining a proxy model corresponding to each local model and/or model information corresponding to a second model included in each local model based on a second screen duty ratio and a second preset screen duty ratio;
in some embodiments, according to the second screen duty ratio and the second preset screen duty ratio, judging whether each second screen duty ratio meets the preset condition, obtaining a judging result, and determining the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model according to the judging result.
In practical applications, the second preset screen duty ratio may be set according to an actual requirement or an empirical value, and in an example, the second preset screen duty ratio may be 0.5.
S302, rendering the proxy model corresponding to each local model and/or rendering the model information corresponding to the second model included in each local model to generate a third model.
According to the second screen ratio, only the proxy model corresponding to each local model, or only the model information corresponding to the second model included in each local model, or both the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model may be rendered, and finally a third model may be generated and displayed.
Optionally, fig. 5 is a flowchart of a model loading method in a game provided by the embodiment of the present invention, as shown in fig. 5, determining, based on a second screen duty ratio and a preset screen duty ratio threshold, a proxy model corresponding to each local model and/or model information corresponding to a second model included in each local model, including:
s401, judging whether the second screen duty ratio is smaller than or equal to a second preset screen duty ratio.
And S402, if yes, determining a proxy model corresponding to the local model.
If the second screen duty ratio is smaller than or equal to the second preset screen duty ratio, that is, the second screen duty ratio meets the preset condition, it is indicated that the second bounding box is far away from the virtual camera, so that the proxy model corresponding to the local model, that is, the rough model corresponding to the local model, can be determined.
For example, if the first model is a house, the first model is divided equally into 4 equal divisions, each equal division is a local model.
S403, if not, determining the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model according to the size of the second model included in the local model and the second preset screen ratio.
If the second screen duty ratio is greater than the second preset screen duty ratio, that is, the second screen duty ratio does not meet the preset condition, it is indicated that the second bounding box is closer to the virtual camera, and therefore, a proxy model of the second model and/or model information corresponding to the second model included in the local model corresponding to the second bounding box need to be further determined.
For example, the number of the local models may be 4, and the second enclosure box corresponding to each local model includes: A. b, C, D; and if the second screen ratio of the second surrounding boxes A and C is smaller than or equal to the second preset screen ratio, determining the proxy models of the two local models corresponding to the second surrounding boxes A and C, and if the second screen ratio of the second surrounding boxes B and D is larger than the second preset screen ratio, determining the proxy models corresponding to the two local models corresponding to the second surrounding boxes B and D and/or model information corresponding to the second models included in the two local models.
Optionally, fig. 6 is a flowchart of a model loading method in a game provided by the embodiment of the present invention, as shown in fig. 6, in S403, determining, according to a size of a second model included in each local model and a second preset screen ratio, a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model, including:
s501, calculating a third screen duty ratio of a third bounding box corresponding to the second model included in each local model according to the size, the second distance and the view angle of the virtual camera of the second model included in each local model.
Wherein the view angle of the virtual camera is preset. The third bounding box is used to frame the second model.
In some implementations, the screen height is calculated based on the second distance and the view angle of the virtual camera; determining each local model corresponding to a second surrounding box with the second screen duty ratio larger than the second preset screen duty ratio; a third screen ratio of a third bounding box is calculated based on the size of the second model included within the partial models and the screen height.
If the second screen duty ratio is larger than the second preset screen duty ratio, and the second model does not exist in the local model corresponding to the second surrounding box, model information of the local model is directly determined.
For example, the second screen ratio of the second bounding boxes a and C is smaller than or equal to the second preset screen ratio, the second screen ratio of the second bounding boxes B and D is larger than the second preset screen ratio, and the third screen ratio of the third bounding box corresponding to the second model included in the local model B is calculated according to the size of the second model included in the second bounding box B, the second distance between the second bounding box B and the virtual camera, and the view angle of the virtual camera. Similarly, a third screen duty ratio of a third bounding box corresponding to the second model included in the local model D is calculated according to the size of the second model included in the second bounding box D, the second distance between the second bounding box D and the virtual camera and the view angle of the virtual camera.
S502, taking the proxy model of the second model with the third screen duty ratio smaller than or equal to the second preset screen duty ratio as the proxy model of each local model.
It should be noted that, if the third screen duty ratio is less than or equal to the second preset screen duty ratio, it is explained that the second model framed by the third bounding box corresponding to the third screen duty ratio is far from the virtual camera, so that the proxy model of the second model can be obtained and used as the proxy model of the local model.
S503, taking model information corresponding to a second model with a third screen duty ratio larger than a second preset screen duty ratio as model information corresponding to the second model included in each local model.
In this embodiment of the present application, if the third screen duty ratio is greater than the second preset screen duty ratio, it is indicated that the distance between the second model framed by the third bounding box corresponding to the third screen duty ratio and the virtual camera is relatively close, so that model information of the second model may be obtained and used as model information corresponding to the second model included in the local model.
For example, the second bounding box B includes three second models, and third bounding boxes corresponding to the three second models are respectively: a1, B1 and c1, determining model information of a second model corresponding to the third bounding box a1 and B1 when the third screen ratio of the third bounding box a1 and B1 is larger than the second preset screen ratio, and determining a proxy model corresponding to the third bounding box c1 as a proxy model of the second bounding box B when the third screen ratio of the third bounding box c1 is smaller than or equal to the second preset screen ratio.
The second bounding box D comprises two second models, and third bounding boxes corresponding to the two second models are respectively: a2, b2, determining model information of a second model corresponding to the third bounding box a2 when the third screen ratio of the third bounding box a2 is larger than the second preset screen ratio, and determining a proxy model corresponding to the third bounding box b2 as a proxy model of the second bounding box D when the third screen ratio of the third bounding box b2 is smaller than or equal to the second preset screen ratio.
In the related art, a preset distance is configured, the preset distance is 50 meters, a model is displayed as a fine model within 50 meters, and the model is directly cut out from the 50 meters. This can lead to a strange phenomenon: the combined model may be determined to be displayed at a distance from the box, the combined model including the box. That is, the user will see the box. When the user moves a little distance to the box and just reaches the condition that the original model needs to be switched, if the distance between the camera and the box is larger than 50, the box is cut off again, and the problem of unreasonable display exists in the related technology.
Aiming at the technical problems in the related art, according to the size, the second distance and the view angle of the virtual camera of the second model included in each local model, the third screen occupation ratio of the third bounding box corresponding to the second model included in each local model is calculated, so that the model can be prevented from jumping, and the display is more reasonable.
Optionally, fig. 7 is a flowchart sixth of a method for loading a model in a game according to an embodiment of the present invention, as shown in fig. 7, where the method further includes:
S601, judging whether the second screen duty ratio is smaller than or equal to a third preset screen duty ratio;
wherein the third preset screen duty cycle is smaller than the second preset screen duty cycle.
In practical applications, the second preset screen duty ratio may be set according to an actual requirement or an empirical value, and in an example, the second preset screen duty ratio may be 0.25.
S602, if yes, determining that a proxy model of the local model corresponding to the second screen occupation ratio and model information of the second model in the local model corresponding to the second screen occupation ratio do not participate in rendering.
In this embodiment of the present application, if the second screen duty ratio is less than or equal to the third preset screen duty ratio, it is indicated that the local model framed by the second bounding box corresponding to the second screen duty ratio is far away from the virtual camera, and the local model is not required to be displayed, so that the proxy model of the local model and the model information of the second model in the local model do not participate in rendering.
Optionally, fig. 8 is a flow chart seven of a model loading method in a game according to an embodiment of the present invention, and as shown in fig. 8, the proxy model is obtained by adopting the following manner:
s701, determining a plurality of local models corresponding to the first model.
In the process of constructing the proxy model, the first model is divided to obtain a plurality of local models.
S702, constructing a proxy model according to the fourth preset screen ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model and the LOD model corresponding to the second model.
In the present embodiment, the process of constructing the proxy model may be regarded as a process of baking the HLOD profile.
It should be noted that, according to the fourth preset screen ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model, and the LOD model corresponding to the second model, the screen ratio of the first bounding box and the screen ratio of the second bounding box are calculated, where the fourth preset screen ratio may be preset according to actual requirements, and the fourth preset screen ratio may be used to determine whether the first model corresponding to the first bounding box, the second model corresponding to the second bounding box participates in baking.
Optionally, fig. 9 is a schematic flow diagram eight of a method for loading a model in a game according to an embodiment of the present invention, as shown in fig. 9, a process for constructing a proxy model in S702 according to a fourth preset screen ratio, a size of a first bounding box, a size of a second bounding box, an LOD model corresponding to the first model, and an LOD model corresponding to the second model may include:
S801, respectively calculating the screen ratio of the first bounding box and the screen ratio of the second bounding box according to the fourth preset screen ratio, the size of the first bounding box, the size of the second bounding box and the view angle of the virtual camera.
In some embodiments, according to the size of the first bounding box and the fourth preset screen duty ratio, calculating a screen height corresponding to the first bounding box, and according to the screen height corresponding to the first bounding box and the view angle of the virtual camera, calculating a distance between the first bounding box and the virtual camera; the screen duty ratio of the first bounding box is calculated according to the distance between the first bounding box and the virtual camera and the size of the first bounding box.
Similarly, calculating the screen height corresponding to the second bounding box according to the size of the second bounding box and the fourth preset screen occupation ratio, and calculating the distance between the second bounding box and the virtual camera according to the screen height corresponding to the second bounding box and the view angle of the virtual camera; and calculating the screen duty ratio of the second bounding box according to the distance between the second bounding box and the virtual camera and the size of the second bounding box.
In the embodiment of the application, the screen ratio of the first bounding box can be calculated first, then the screen ratio of the second bounding box can be calculated, the screen ratio of the second bounding box can be calculated first, then the screen ratio of the first bounding box can be calculated, and the screen ratio of the first bounding box and the screen ratio of the second bounding box can be calculated simultaneously.
S802, if the screen ratio of the first bounding box and the screen ratio of the second bounding box are larger than or equal to the fourth preset screen ratio, constructing a proxy model according to the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box.
If the screen ratio of the second bounding box is smaller than the fourth preset screen ratio, the LOD model corresponding to the second model in the local models corresponding to the second bounding box does not participate in the construction of the proxy model. If the screen ratio of the first bounding box is smaller than the fourth preset screen ratio, the LOD model corresponding to the first model does not participate in the construction of the proxy model.
Optionally, fig. 10 is a flowchart of a model loading method in a game provided by the embodiment of the present invention, as shown in fig. 10, a process for constructing a proxy model according to an LOD model corresponding to a first model and an LOD model corresponding to a second model in a local model corresponding to a second bounding box in S802 may include:
s901, respectively calculating the screen duty ratio of a third bounding box according to the fourth preset screen duty ratio, the size of the third bounding box corresponding to the second model in the local model and the view angle of the virtual camera.
In the embodiment of the application, according to the fourth preset screen occupation ratio and the size of the third bounding box, calculating the screen height corresponding to the third bounding box, and according to the screen height corresponding to the third bounding box and the view angle of the virtual camera, determining the distance between the third bounding box and the virtual camera; and calculating the screen duty ratio of the third bounding box according to the distance between the third bounding box and the virtual camera and the size of the third bounding box.
S902, if the screen ratio of the third surrounding box is larger than or equal to the fourth preset screen ratio, constructing a proxy model according to the LOD model of the second model corresponding to the third surrounding box and the LOD model corresponding to the first model.
If the screen ratio of the third bounding box is smaller than the fourth preset screen ratio, the LOD model of the second model corresponding to the third bounding box does not participate in the construction of the proxy model.
In the related technology, when a simple model is constructed, all models which need HLOD optimization are collected, and unnecessary small models are filtered according to the configured minimum size, namely, models with bounding boxes smaller than the minimum size do not participate in the combination of the HLOD models, and the simple model is obtained according to the combination of the models which participate in the combination, however, in the related technology, when the simple model is obtained, the appropriate minimum size can be obtained only by manually and frequently adjusting, and the efficiency of obtaining the simple model is reduced.
In the embodiment of the application, according to the screen ratio of the first bounding box, the screen ratio of the second bounding box, the screen ratio of the third bounding box and the fourth preset screen ratio, the corresponding LOD model can be determined efficiently and accurately to construct the proxy model, the appropriate minimum size is obtained without frequent adjustment of artistic personnel, and the efficiency of obtaining the proxy model is improved.
Optionally, fig. 11 is a schematic flowchart of a method for loading a model in a game according to an embodiment of the present invention, as shown in fig. 11, a process of determining a plurality of local models corresponding to a first model in S701 may include:
s1001, taking the first model as a father node.
Wherein the parent node may also be considered a root node. The parent and node may be the first level in the tree structure.
S1002, dividing the first model to obtain a plurality of first sub-models, and taking the plurality of first sub-models as a plurality of first sub-nodes respectively.
It should be noted that, the first model is divided into a preset number of first sub-models, the preset number may be set according to actual requirements, and the preset number may be, for example, 2, 3, 4, 5, or the like, which is not specifically limited in the embodiment of the present application.
In addition, the plurality of first child nodes may be a second level in the tree structure.
S1003, dividing each first sub-model to obtain a plurality of second sub-models, and taking the plurality of second sub-models as a plurality of second sub-nodes respectively until the division is completed to obtain a plurality of sub-nodes of the tree structure.
The plurality of local models are models corresponding to the plurality of child nodes.
In some embodiments, each first sub-model is divided into a preset number of second sub-models, the second sub-models are respectively used as second sub-nodes, the second sub-nodes can be third layers in the tree structure, and when the number of layers in the tree structure is greater than or equal to the preset number of layers, the division is completed, so that a plurality of sub-nodes in the tree structure are obtained.
It should be noted that, when the proxy model is constructed, each node in the tree structure may be traversed, and the process in S702 is performed for each node, so as to complete the construction of the proxy model.
In the embodiment of the application, the artist only needs to preset LOD (level of Detail) groups of each node of the agent model, so that when the agent model is constructed, the appropriate model can be automatically screened out to participate in generating the agent model, and the purpose of improving the art work efficiency is achieved.
In the process of proxy model application, LOD Group in each node can be adopted to calculate the screen duty ratio, and when the third screen duty ratio of a third bounding box corresponding to the second model is calculated, the screen duty ratio is calculated based on the second distance between the center of the local model where the second model is located and the virtual camera. The preset interface may be a lodkroup.
In summary, the third model is rendered and generated based on the second screen duty ratio, and the second screen duty ratio can more accurately represent the size of the bounding box, so that the rendering effect is better. According to the size, the second distance and the visual field angle of the virtual camera of the second model included in each local model, the third screen duty ratio of the third bounding box corresponding to the second model included in each local model is calculated, jump of the models can be avoided, and display is more reasonable. According to the screen ratio of the first bounding box, the screen ratio of the second bounding box, the screen ratio of the third bounding box and the fourth preset screen ratio, the corresponding LOD model can be efficiently and accurately determined to construct the proxy model, the appropriate minimum size is obtained without frequent adjustment of artistic personnel, and the efficiency of obtaining the proxy model is improved.
The following describes a model loading device, equipment, a storage medium, etc. in a game for executing the model loading method in the game provided in the present application, and specific implementation processes and technical effects thereof refer to relevant contents of the above model generating method, which are not described in detail below.
Fig. 12 is a schematic structural diagram of a model loading device in a game according to an embodiment of the present invention, as shown in fig. 12, the device includes:
a first obtaining module 101, configured to obtain, in the game scene, a first distance between a virtual camera and a first bounding box corresponding to the first model;
a first determining module 102, configured to determine a first screen duty ratio corresponding to the first bounding box based on the first distance;
a second obtaining module 103, configured to obtain, in response to the first screen duty ratio being greater than a first preset screen duty ratio, a second distance between each local model corresponding to the first model and the virtual camera, where the local model is a part of the first model obtained by performing model division on the first model, at least part of the local model includes the second model, and each local model is configured with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model;
A second determining module 104, configured to determine a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generate a third model based on rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model based on the second screen ratio.
Optionally, the second determining module 104 is specifically configured to calculate a screen height based on the second distance and the view angle of the virtual camera; the second screen duty cycle is calculated based on the screen height and the size of the second bounding box.
Optionally, the second determining module 104 is specifically configured to determine, based on the second screen duty ratio and a second preset screen duty ratio, a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model; and generating the third model by rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model.
Optionally, the second determining module 104 is specifically configured to determine whether the second screen duty cycle is less than or equal to the second preset screen duty cycle; if yes, determining a proxy model corresponding to the local model; if not, determining a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model according to the size of the second model included in the local model and the second preset screen ratio.
Optionally, the second determining module 104 is specifically configured to calculate a third screen duty ratio of a third bounding box corresponding to the second model included in each local model according to a size of the second model included in each local model, the second distance, and a view angle of the virtual camera; taking the proxy model of the second model with the third screen duty ratio smaller than or equal to the second preset screen duty ratio as the proxy model of each local model; and taking the model information corresponding to the second model with the third screen duty ratio larger than the second preset screen duty ratio as the model information corresponding to the second model included in each local model.
Optionally, the apparatus further includes:
the judging module is used for judging whether the second screen duty ratio is smaller than or equal to a third preset screen duty ratio;
and the third determining module is used for determining that the proxy model of the local model corresponding to the second screen duty ratio and the model information of the second model in the local model corresponding to the second screen duty ratio do not participate in rendering if the second screen duty ratio is positive.
Optionally, the proxy model is obtained in the following manner:
A fourth determining module, configured to determine a plurality of local models corresponding to the first model;
the construction module is used for constructing the proxy model according to a fourth preset screen duty ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model and the LOD model corresponding to the second model.
Optionally, the construction module is specifically configured to calculate, according to the fourth preset screen duty ratio, the size of the first bounding box, the size of the second bounding box, and the view angle of the virtual camera, a screen duty ratio of the first bounding box and a screen duty ratio of the second bounding box respectively; and if the screen ratio of the first bounding box and the screen ratio of the second bounding box are larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box.
Optionally, the construction module is specifically configured to calculate, according to the fourth preset screen duty ratio, a size of a third bounding box corresponding to the second model in the local model, and a view angle of the virtual camera, a screen duty ratio of the third bounding box respectively; if the screen ratio of the third bounding box is larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model of the second model corresponding to the third bounding box and the LOD model corresponding to the first model.
Optionally, the fourth determining module is specifically configured to use the first model as a parent node; dividing the first model to obtain a plurality of first sub-models, and taking the plurality of first sub-models as a plurality of first sub-nodes respectively; dividing each first sub-model to obtain a plurality of second sub-models, and taking the plurality of second sub-models as a plurality of second sub-nodes respectively until the division is completed to obtain a plurality of sub-nodes of a tree structure; the local models are models corresponding to the child nodes.
The foregoing apparatus is used for executing the method provided in the foregoing embodiment, and its implementation principle and technical effects are similar, and are not described herein again.
The above modules may be one or more integrated circuits configured to implement the above methods, for example: one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as ASIC), or one or more microprocessors (digital singnal processor, abbreviated as DSP), or one or more field programmable gate arrays (Field Programmable Gate Array, abbreviated as FPGA), or the like. For another example, when a module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 13 is a schematic structural diagram of a model loading device in a game according to an embodiment of the present invention, where, as shown in fig. 13, the model loading device in a game includes: processor 201, memory 202.
The memory 202 is used for storing a program, and the processor 201 calls the program stored in the memory 202 to execute the above-described method embodiment. The specific implementation manner and the technical effect are similar, and are not repeated here.
Illustratively, the method includes:
in the game scene, acquiring a first distance between a virtual camera and a first bounding box corresponding to the first model;
determining a first screen duty ratio corresponding to the first bounding box based on the first distance;
responding to the first screen duty ratio being larger than a first preset screen duty ratio, and obtaining a second distance between each local model corresponding to the first model and the virtual camera, wherein the local model is a part of the first model obtained by carrying out model division on the first model, at least part of the local model comprises the second model, each local model is provided with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model;
And determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model based on the second screen ratio.
Optionally, the determining, based on the second distance, a second screen ratio of a second bounding box corresponding to each local model includes:
calculating a screen height based on the second distance and a view angle of the virtual camera;
the second screen duty cycle is calculated based on the screen height and the size of the second bounding box.
Optionally, the generating a third model based on the proxy model corresponding to each local model rendered by the second screen ratio and/or the model information corresponding to the second model included in each local model includes:
determining a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model based on the second screen duty ratio and a second preset screen duty ratio;
and generating the third model by rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model.
Optionally, the determining, based on the second screen duty ratio and a preset screen duty ratio threshold, the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model includes:
judging whether the second screen duty ratio is smaller than or equal to the second preset screen duty ratio;
if yes, determining a proxy model corresponding to the local model;
if not, determining a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model according to the size of the second model included in the local model and the second preset screen ratio.
Optionally, the determining, according to the size of the second model included in each local model and the second preset screen ratio, the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model includes:
calculating a third screen duty ratio of a third bounding box corresponding to the second model included in each local model according to the size of the second model included in each local model, the second distance and the view angle of the virtual camera;
Taking the proxy model of the second model with the third screen duty ratio smaller than or equal to the second preset screen duty ratio as the proxy model of each local model;
and taking the model information corresponding to the second model with the third screen duty ratio larger than the second preset screen duty ratio as the model information corresponding to the second model included in each local model.
Optionally, the method further comprises:
judging whether the second screen duty ratio is smaller than or equal to a third preset screen duty ratio;
if yes, determining that the proxy model of the local model corresponding to the second screen duty ratio and the model information of the second model in the local model corresponding to the second screen duty ratio do not participate in rendering.
Optionally, the proxy model is obtained in the following manner:
determining a plurality of local models corresponding to the first model;
and constructing the proxy model according to a fourth preset screen duty ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model and the LOD model corresponding to the second model.
Optionally, the constructing the proxy model according to a fourth preset screen duty ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model, and the LOD model corresponding to the second model includes:
According to the fourth preset screen ratio, the size of the first bounding box, the size of the second bounding box and the view angle of the virtual camera, respectively calculating the screen ratio of the first bounding box and the screen ratio of the second bounding box;
and if the screen ratio of the first bounding box and the screen ratio of the second bounding box are larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box.
Optionally, the constructing the proxy model according to the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box includes:
according to the fourth preset screen duty ratio, the size of a third bounding box corresponding to the second model in the local model and the view angle of the virtual camera, respectively calculating the screen duty ratio of the third bounding box;
if the screen ratio of the third bounding box is larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model of the second model corresponding to the third bounding box and the LOD model corresponding to the first model.
Optionally, the determining the plurality of local models corresponding to the first model includes:
taking the first model as a father node;
dividing the first model to obtain a plurality of first sub-models, and taking the plurality of first sub-models as a plurality of first sub-nodes respectively;
dividing each first sub-model to obtain a plurality of second sub-models, and taking the plurality of second sub-models as a plurality of second sub-nodes respectively until the division is completed to obtain a plurality of sub-nodes of a tree structure; the local models are models corresponding to the child nodes.
In summary, in response to the first screen duty ratio being greater than the first preset screen duty ratio, the second screen duty ratio is determined based on the acquired second distance, the third model is rendered and generated based on the second screen duty ratio, and the size of the bounding box can be more accurately represented by the second screen duty ratio, so that the rendering effect is better.
Optionally, the present invention also provides a program product, such as a computer readable storage medium, comprising a program for performing the above-described method embodiments when being executed by a processor.
Illustratively, the method includes:
in the game scene, acquiring a first distance between a virtual camera and a first bounding box corresponding to the first model;
Determining a first screen duty ratio corresponding to the first bounding box based on the first distance;
responding to the first screen duty ratio being larger than a first preset screen duty ratio, and obtaining a second distance between each local model corresponding to the first model and the virtual camera, wherein the local model is a part of the first model obtained by carrying out model division on the first model, at least part of the local model comprises the second model, each local model is provided with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model;
and determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model based on the second screen ratio.
Optionally, the determining, based on the second distance, a second screen ratio of a second bounding box corresponding to each local model includes:
calculating a screen height based on the second distance and a view angle of the virtual camera;
The second screen duty cycle is calculated based on the screen height and the size of the second bounding box.
Optionally, the generating a third model based on the proxy model corresponding to each local model rendered by the second screen ratio and/or the model information corresponding to the second model included in each local model includes:
determining a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model based on the second screen duty ratio and a second preset screen duty ratio;
and generating the third model by rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model.
Optionally, the determining, based on the second screen duty ratio and a preset screen duty ratio threshold, the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model includes:
judging whether the second screen duty ratio is smaller than or equal to the second preset screen duty ratio;
if yes, determining a proxy model corresponding to the local model;
if not, determining a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model according to the size of the second model included in the local model and the second preset screen ratio.
Optionally, the determining, according to the size of the second model included in each local model and the second preset screen ratio, the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model includes:
calculating a third screen duty ratio of a third bounding box corresponding to the second model included in each local model according to the size of the second model included in each local model, the second distance and the view angle of the virtual camera;
taking the proxy model of the second model with the third screen duty ratio smaller than or equal to the second preset screen duty ratio as the proxy model of each local model;
and taking the model information corresponding to the second model with the third screen duty ratio larger than the second preset screen duty ratio as the model information corresponding to the second model included in each local model.
Optionally, the method further comprises:
judging whether the second screen duty ratio is smaller than or equal to a third preset screen duty ratio;
if yes, determining that the proxy model of the local model corresponding to the second screen duty ratio and the model information of the second model in the local model corresponding to the second screen duty ratio do not participate in rendering.
Optionally, the proxy model is obtained in the following manner:
determining a plurality of local models corresponding to the first model;
and constructing the proxy model according to a fourth preset screen duty ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model and the LOD model corresponding to the second model.
Optionally, the constructing the proxy model according to a fourth preset screen duty ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model, and the LOD model corresponding to the second model includes:
according to the fourth preset screen ratio, the size of the first bounding box, the size of the second bounding box and the view angle of the virtual camera, respectively calculating the screen ratio of the first bounding box and the screen ratio of the second bounding box;
and if the screen ratio of the first bounding box and the screen ratio of the second bounding box are larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box.
Optionally, the constructing the proxy model according to the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box includes:
according to the fourth preset screen duty ratio, the size of a third bounding box corresponding to the second model in the local model and the view angle of the virtual camera, respectively calculating the screen duty ratio of the third bounding box;
if the screen ratio of the third bounding box is larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model of the second model corresponding to the third bounding box and the LOD model corresponding to the first model.
Optionally, the determining the plurality of local models corresponding to the first model includes:
taking the first model as a father node;
dividing the first model to obtain a plurality of first sub-models, and taking the plurality of first sub-models as a plurality of first sub-nodes respectively;
dividing each first sub-model to obtain a plurality of second sub-models, and taking the plurality of second sub-models as a plurality of second sub-nodes respectively until the division is completed to obtain a plurality of sub-nodes of a tree structure; the local models are models corresponding to the child nodes.
In summary, in response to the first screen duty ratio being greater than the first preset screen duty ratio, the second screen duty ratio is determined based on the acquired second distance, the third model is rendered and generated based on the second screen duty ratio, and the size of the bounding box can be more accurately represented by the second screen duty ratio, so that the rendering effect is better.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (english: processor) to perform some of the steps of the methods according to the embodiments of the invention. And the aforementioned storage medium includes: u disk, mobile hard disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (13)

1. A method for loading models in a game, wherein a game scene of the game includes a first model, at least one second model is included in the first model, the first model and the second model are each configured with a plurality of LOD models, and different LOD models correspond to different model accuracies, the method comprising:
in the game scene, acquiring a first distance between a virtual camera and a first bounding box corresponding to the first model;
determining a first screen duty ratio corresponding to the first bounding box based on the first distance;
responding to the first screen duty ratio being larger than a first preset screen duty ratio, and obtaining a second distance between each local model corresponding to the first model and the virtual camera, wherein the local model is a part of the first model obtained by carrying out model division on the first model, at least part of the local model comprises the second model, each local model is provided with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model;
and determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model based on the second screen ratio.
2. The method of claim 1, wherein determining a second screen ratio of a second bounding box corresponding to each of the local models based on the second distance comprises:
calculating a screen height based on the second distance and a view angle of the virtual camera;
the second screen duty cycle is calculated based on the screen height and the size of the second bounding box.
3. The method according to claim 1, wherein the generating a third model based on the proxy model corresponding to each of the local models rendered based on the second screen ratio and/or the model information corresponding to the second model included in each of the local models rendered includes:
determining a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model based on the second screen duty ratio and a second preset screen duty ratio;
and generating the third model by rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model.
4. A method according to claim 3, wherein the determining, based on the second screen duty ratio and a preset screen duty ratio threshold, a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model includes:
Judging whether the second screen duty ratio is smaller than or equal to the second preset screen duty ratio;
if yes, determining a proxy model corresponding to the local model;
if not, determining a proxy model corresponding to each local model and/or model information corresponding to the second model included in each local model according to the size of the second model included in the local model and the second preset screen ratio.
5. The method according to claim 4, wherein determining the proxy model corresponding to each local model and/or the model information corresponding to the second model included in each local model according to the size of the second model included in the local model and the second preset screen ratio includes:
calculating a third screen duty ratio of a third bounding box corresponding to the second model included in each local model according to the size of the second model included in each local model, the second distance and the view angle of the virtual camera;
taking the proxy model of the second model with the third screen duty ratio smaller than or equal to the second preset screen duty ratio as the proxy model of each local model;
And taking the model information corresponding to the second model with the third screen duty ratio larger than the second preset screen duty ratio as the model information corresponding to the second model included in each local model.
6. The method according to claim 1, wherein the method further comprises:
judging whether the second screen duty ratio is smaller than or equal to a third preset screen duty ratio;
if yes, determining that the proxy model of the local model corresponding to the second screen duty ratio and the model information of the second model in the local model corresponding to the second screen duty ratio do not participate in rendering.
7. The method according to any of claims 1-6, wherein the proxy model is derived by:
determining a plurality of local models corresponding to the first model;
and constructing the proxy model according to a fourth preset screen duty ratio, the size of the first bounding box, the size of the second bounding box, the LOD model corresponding to the first model and the LOD model corresponding to the second model.
8. The method of claim 7, wherein constructing the proxy model from a fourth preset screen duty cycle, a size of the first bounding box, a size of the second bounding box, a LOD model corresponding to the first model, and a LOD model corresponding to the second model comprises:
According to the fourth preset screen ratio, the size of the first bounding box, the size of the second bounding box and the view angle of the virtual camera, respectively calculating the screen ratio of the first bounding box and the screen ratio of the second bounding box;
and if the screen ratio of the first bounding box and the screen ratio of the second bounding box are larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box.
9. The method of claim 8, wherein constructing the proxy model from the LOD model corresponding to the first model and the LOD model corresponding to the second model in the local model corresponding to the second bounding box comprises:
according to the fourth preset screen duty ratio, the size of a third bounding box corresponding to the second model in the local model and the view angle of the virtual camera, respectively calculating the screen duty ratio of the third bounding box;
if the screen ratio of the third bounding box is larger than or equal to the fourth preset screen ratio, constructing the proxy model according to the LOD model of the second model corresponding to the third bounding box and the LOD model corresponding to the first model.
10. The method of claim 7, wherein said determining a plurality of said local models to which said first model corresponds comprises:
taking the first model as a father node;
dividing the first model to obtain a plurality of first sub-models, and taking the plurality of first sub-models as a plurality of first sub-nodes respectively;
dividing each first sub-model to obtain a plurality of second sub-models, and taking the plurality of second sub-models as a plurality of second sub-nodes respectively until the division is completed to obtain a plurality of sub-nodes of a tree structure; the local models are models corresponding to the child nodes.
11. A model loading device in a game, wherein a game scene of the game includes a first model, at least one second model is included in the first model, the first model and the second model are configured with a plurality of LOD models, and different LOD models correspond to different model accuracies, the device comprises:
the first acquisition module is used for acquiring a first distance between the virtual camera and a first bounding box corresponding to the first model in the game scene;
the first determining module is used for determining a first screen duty ratio corresponding to the first bounding box based on the first distance;
The second obtaining module is used for obtaining a second distance between each local model corresponding to the first model and the virtual camera in response to the first screen ratio being larger than a first preset screen ratio, wherein the local model is a part of the first model obtained by carrying out model division on the first model, at least part of the local model comprises the second model, each local model is configured with a corresponding proxy model, and the proxy model is generated based on an LOD model corresponding to the first model and an LOD model corresponding to the second model;
and the second determining module is used for determining a second screen ratio of a second bounding box corresponding to each local model based on the second distance, and generating a third model based on rendering a proxy model corresponding to each local model and/or rendering model information corresponding to the second model included in each local model based on the second screen ratio.
12. A model loading device in a game, comprising: a memory and a processor, the memory storing a computer program executable by the processor, the processor implementing the method of model loading in a game as claimed in any one of claims 1 to 10 when the computer program is executed.
13. A computer readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when read and executed, implements the model loading method in a game according to any of the preceding claims 1-10.
CN202311486969.XA 2023-11-08 2023-11-08 Model loading method, device, equipment and storage medium in game Pending CN117531194A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311486969.XA CN117531194A (en) 2023-11-08 2023-11-08 Model loading method, device, equipment and storage medium in game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311486969.XA CN117531194A (en) 2023-11-08 2023-11-08 Model loading method, device, equipment and storage medium in game

Publications (1)

Publication Number Publication Date
CN117531194A true CN117531194A (en) 2024-02-09

Family

ID=89785369

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311486969.XA Pending CN117531194A (en) 2023-11-08 2023-11-08 Model loading method, device, equipment and storage medium in game

Country Status (1)

Country Link
CN (1) CN117531194A (en)

Similar Documents

Publication Publication Date Title
US11087553B2 (en) Interactive mixed reality platform utilizing geotagged social media
US8976168B2 (en) Mesh generation from depth images
US10902660B2 (en) Determining and presenting solar flux information
CN111803945B (en) Interface rendering method and device, electronic equipment and storage medium
CN111598986B (en) Virtual fluid surface rendering method, device, equipment and storage medium
US20150113474A1 (en) Techniques for navigation among multiple images
CN110120087B (en) Label marking method and device for three-dimensional virtual sand table and terminal equipment
CN110070616A (en) Memory, statistical data rendering method, device and equipment based on GIS platform
CN112652046A (en) Game picture generation method, device, equipment and storage medium
CN108765084B (en) Synchronous processing method and device for virtual three-dimensional space
CN111784817B (en) Shadow display method and device, storage medium and electronic device
CN110248165B (en) Label display method, device, equipment and storage medium
CN109697748A (en) Model compression processing method, model pinup picture processing method device, storage medium
CN117531194A (en) Model loading method, device, equipment and storage medium in game
CN116912387A (en) Texture map processing method and device, electronic equipment and storage medium
WO2020253342A1 (en) Panoramic rendering method for 3d video, computer device, and readable storage medium
CN113989427A (en) Illumination simulation method and device, electronic equipment and storage medium
Wang et al. Roaming of oblique photography model in unity3D
CN113240787A (en) Shadow rendering method and device and electronic equipment
CN115035231A (en) Shadow baking method, shadow baking device, electronic apparatus, and storage medium
US20230251706A1 (en) Method and apparatus for acquiring object's attention information and electronic device
CN113160405A (en) Point cloud map generation method and device, computer equipment and storage medium
CN114627274A (en) Object processing method and device
Li et al. A CAVE-based panoramic video playing method with 360° viewpoint
CN117093170A (en) Linkage determination method for two-dimensional information and three-dimensional information display and related equipment

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