Model processing method and device, electronic device and storage medium
By merging and baking scene models in 3D games, the visual experience problem caused by excessive accuracy differences when switching models is solved, and rendering efficiency and user experience are improved.
Patent Information
- Application Number
- CN202011488097.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-16
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-12-16
AI Technical Summary
In 3D game development, the user's visual experience is poor due to excessive accuracy differences when switching models.
By displaying multiple LOD models on the target client and merging and baking scene models in the target flow level, it reduces the number of submissions for model rendering, improves model accuracy, reduces CPU and GPU overhead, and reduces differences in rendered images.
It improves the user's visual experience, reduces the difference in rendering images before and after model switching, saves CPU and GPU resources, and improves rendering efficiency.
Smart Images

Figure CN112587921B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a model processing method and device, an electronic device and a storage medium. Background Art
[0002] In the process of 3D (Three Dimensions) game development, it is necessary to optimize the game performance, and an important process of performance optimization is the optimization of model rendering. Model rendering optimization involves the following aspects: memory usage of model textures; optimization of model vertices and triangle faces; number of submissions for model rendering on the same screen in each frame; and rendering efficiency of the model itself in each frame.
[0003] At present, LOD (Levels of Detail) models can be used in 3D game scenes. When switching between different LODs, it is necessary to ensure that the rendering effect of the picture does not change significantly. However, in the model processing method in the related art, if the mapping accuracy of some models is not enough, the color difference of the model will be large when switching, and the rendering effect of the picture will change significantly, making the visual information obtained by the user jump too much, thereby reducing the user's visual experience.
[0004] Therefore, the model processing method in the related art has the problem of poor user visual experience due to the large difference in model accuracy before and after switching. Summary of the invention
[0005] The present application provides a model processing method and device, an electronic device and a storage medium, so as to at least solve the problem of poor user visual experience caused by excessive difference in model accuracy before and after switching in the model switching method in the related art.
[0006] According to one aspect of an embodiment of the present application, a model processing method is provided, comprising: displaying a plurality of first scene models of a target level on a target client, wherein each of the plurality of first scene models is an LOD model of a scene object; loading a target stream level to be switched from the target level, wherein the target stream level contains a plurality of second scene models, wherein each of the plurality of second scene models is a scene model obtained by merging models of some scene models in the plurality of first scene models; and controlling the level displayed on the target client to switch to the target stream level, wherein the plurality of second scene models are displayed on the target stream level.
[0007] Optionally, before displaying multiple first scene models of the target level on the target client, the method further includes: when the target virtual character enters the target event scene to which the target level belongs for the first time, loading multiple levels in the target event scene that are within a target visible range, wherein the target virtual character is a virtual character controlled by the target client, and the target visible range is a visible range of a target camera corresponding to the target virtual character; and displaying the recorded multiple levels on the target client.
[0008] Optionally, before loading the target streaming level to be switched to by the target level, the method further includes: determining to switch the target level to the target streaming level when it is detected that the distance between the target level and a target virtual character changes from less than a target distance threshold to greater than or equal to the target distance threshold, wherein the target virtual character is a virtual character controlled by the target client.
[0009] Optionally, after controlling the level displayed on the target client to switch to the target streaming level, the method further comprises: when all scene models in the target streaming level have been displayed, uninstalling all scene models in the target level.
[0010] Optionally, after the level displayed on the target client is controlled to switch to the target stream level, the method further includes: when the multiple second scene models include instantiated models baked from multiple third scene models, submitting the instantiated models in a batch, rendering the instantiated models to the target stream level for display, wherein the number of vertices submitted in a batch is the number of vertices of one of the third scene models, the multiple third scene models are at least one of the following: grass, forest, and the density of the multiple third scene models is less than the density of multiple matching scene models in the target level that match the multiple third scene models.
[0011] Optionally, after controlling the level displayed on the target client to switch to the target stream level, the method further includes: when multiple second scene models include a first target scene model obtained by baking multiple fourth scene models by merging model vertices, model textures and model materials, using the model vertices, model textures and model materials of the first target scene model, rendering the first target scene model to the target stream level for display.
[0012] Optionally, after the level displayed on the target client is controlled to switch to the target stream level, the method further includes: obtaining a target color map of a second target scene model among the multiple second scene models, wherein a target material attribute is written in a target color channel of the target color map; and using the target color map, rendering the second target scene model to the target stream level for display.
[0013] Optionally, after controlling the level displayed on the target client to switch to the target stream level, the method further includes: obtaining a transparent mask map of a third target scene model among the multiple second scene models; and using the transparent mask map to render the third target scene model onto the target stream level for display.
[0014] Optionally, after controlling the level displayed on the target client to switch to the target streaming level, the method further includes: generating a plot shadow map for the target streaming level according to a target frequency, wherein a resolution of the plot shadow map is less than a target resolution threshold; and rendering a plot shadow for the target streaming level using the plot shadow map, wherein the plot shadow includes a shadow of at least one of the following scene objects: terrain, model, and building.
[0015] According to another aspect of an embodiment of the present application, a model processing device is provided, comprising: a first display unit, used to display multiple first scene models of a target level on a target client, wherein each of the multiple first scene models is an LOD model of a scene object; a first loading unit, used to load a target stream level to be switched from the target level, wherein the target stream level contains multiple second scene models, and each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models; and a control unit, used to control the level displayed on the target client to switch to the target stream level, wherein the multiple second scene models are displayed on the target stream level.
[0016] Optionally, the device further includes: a second loading unit, used to load multiple levels located within a target visible range in the target event scene before displaying multiple first scene models of the target level on the target client, when the target virtual character first enters the target event scene to which the target level belongs, wherein the target virtual character is a virtual character controlled by the target client, and the target visible range is the visible range of a target camera corresponding to the target virtual character; and a second display unit, used to display the recorded multiple levels on the target client.
[0017] Optionally, the device further includes: a determining unit, configured to determine, before the target streaming level to be switched to is loaded, to switch the target level to the target streaming level when it is detected that the distance between the target level and a target virtual character is converted from less than a target distance threshold to greater than or equal to the target distance threshold, wherein the target virtual character is a virtual character controlled by the target client.
[0018] Optionally, the device further comprises: an unloading unit, configured to unload all scene models in the target level after the level displayed on the target client is switched to the target stream level and when all scene models in the target stream level have been displayed.
[0019] Optionally, the device also includes: a first rendering unit, which is used to submit the instantiated models in a batch after the level displayed on the target client is switched to the target stream level, when the multiple second scene models include instantiated models baked from multiple third scene models, and render the instantiated models to the target stream level for display, wherein the number of vertices submitted in a batch is the number of vertices of one third scene model, and the multiple third scene models are at least one of the following: grass, forest, and the density of the multiple third scene models is less than the density of multiple matching scene models in the target level that match the multiple third scene models.
[0020] Optionally, the device also includes: a second rendering unit, which is used to render the first target scene model onto the target stream level for display using the model vertices, model textures and model materials of the first target scene model after the level displayed on the target client is switched to the target stream level and when the multiple second scene models include a first target scene model baked by merging model vertices, model textures and model materials of multiple fourth scene models.
[0021] Optionally, the device also includes: a first acquisition unit, used to obtain a target color map of a second target scene model among the multiple second scene models after the level displayed on the target client is switched to the target stream level, wherein the target material attributes are written in the target color channel of the target color map; and a third rendering unit, used to use the target color map to render the second target scene model to the target stream level for display.
[0022] Optionally, the device also includes: a second acquisition unit, used to acquire a transparent mask map of a third target scene model among the multiple second scene models after the level displayed on the target client is switched to the target stream level; and a fourth rendering unit, used to use the transparent mask map to render the third target scene model onto the target stream level for display.
[0023] Optionally, the device further includes: a generating unit, configured to generate a plot shadow map for the target stream level according to a target frequency after the level displayed on the target client is controlled to be switched to the target stream level, wherein a resolution of the plot shadow map is less than a target resolution threshold; and a fifth rendering unit, configured to render a plot shadow for the target stream level using the plot shadow map, wherein the plot shadow includes a shadow of at least one of the following scene objects: terrain, model, and building.
[0024] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps in any of the above embodiments by running the computer program stored in the memory.
[0025] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the method steps in any of the above embodiments when executed.
[0026] In an embodiment of the present application, a scene model is divided into different parts and the models are merged separately. By displaying multiple first scene models of the target level on the target client, wherein each of the multiple first scene models is an LOD model of a scene object; loading the target stream level to be switched to, wherein the target stream level contains multiple second scene models, and each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models; controlling the level displayed on the target client to switch to the target stream level, wherein multiple second scene models are displayed on the target stream level. Since the scene model is divided into different parts and the models are merged separately, a variety of baking methods can be used to bake the model, thereby achieving the purpose of improving the accuracy of certain models (for example, baking in a method with better baking effect). In addition, since multiple models are merged into one model, the number of submissions for model rendering can be reduced, and while ensuring the accuracy of the model as much as possible, the CPU (Central Processing Unit) and GPU (Graphics Processing Unit) can be saved. The overhead of the graphics processing unit (GPU) is reduced to achieve the technical effect of reducing the difference in rendering images before and after model switching and improving the user's visual experience, thereby solving the problem of poor user visual experience caused by the large difference in model accuracy before and after switching in the model switching method in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0029] Figure 1 is a schematic diagram of a hardware environment of an optional model processing method according to an embodiment of the present application;
[0030] Figure 2 is a flow chart of an optional model processing method according to an embodiment of the present application;
[0031] Figure 3 is a schematic diagram of an optional game display interface according to an embodiment of the present application;
[0032] Figure 4is a schematic diagram of an optional baking interface according to an embodiment of the present application;
[0033] Figure 5 is a flow chart of another optional model processing method according to an embodiment of the present application;
[0034] Figure 6 is a flowchart of another optional model processing method according to an embodiment of the present application;
[0035] Figure 7 is a schematic diagram of an optional frame rate and performance comparison according to an embodiment of the present application;
[0036] Figure 8 is a structural block diagram of an optional model processing device according to an embodiment of the present application;
[0037] Fig. 9 is a structural block diagram of another optional model processing device according to an embodiment of the present application;
[0038] Fig.10 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] According to one aspect of an embodiment of the present application, a model switching method is provided. Optionally, in this embodiment, the above-mentioned model switching method can be applied to Figure 1In the hardware environment composed of the terminal 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal 102 via a network, and can be used to provide services (such as game services, application services, etc.) for the terminal or a client (for example, a game client) installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for the server 104.
[0042] The above network includes but is not limited to: wired network, wireless network, and the above wired network may include but is not limited to: wide area network, metropolitan area network or local area network. The terminal 102 is not limited to PC (Personal Computer), mobile phone, tablet computer and the like.
[0043] The model switching method of the embodiment of the present application can be executed by the terminal 102, or by the server 104, or by both the terminal 102 and the server 104. The terminal 102 can also execute the model switching method of the embodiment of the present application by a client installed thereon (e.g., a client of the target game).
[0044] Taking the terminal 102 executing the model switching method in this embodiment as an example, Figure 2 is a flow chart of an optional model processing method according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:
[0045] Step S202: Display multiple first scene models of the target level on the target client, where each of the multiple first scene models is an LOD model of a scene object.
[0046] The model switching method in this embodiment can be applied to an event scene composed of multiple levels, for example, a game scene, which can be a game scene of a target game (for example, a three-dimensional game scene). The target event scene in this embodiment is described by taking the target game scene of the target game as an example, and the model processing method in this embodiment is also applicable to other event scenes containing multiple levels.
[0047] The target game can be a single-player game or a multiplayer game (for example, an open world game); it can be a competitive game or a non-competitive game (for example, a management game); it can be a PC game or a mobile game. In this embodiment, there is no limitation on the game type of the target game.
[0048] For example, the target game may be a MMORPG (Massive or Massively Multiplayer Online Role-Playing Game), or an AR (Augmented Reality) game, or a VR (Virtual Reality) game, or other types of games.
[0049] The target client of the target game application can be run on the terminal device of the target user (target player). The target client can communicate with the server, which is the background server of the target game. The target user can log in to the target client running on his terminal device using an account and password, a dynamic password, or an associated application (third-party application) login, and enter the target game scene (target game map, such as the big world) by operating the target client.
[0050] Taking the big world as an example, a big world is made up of many levels. Different levels have undulating mountains, rivers, and buildings. The size of a level can be configured as needed. For example, it can be a square (plot) of 128×128 meters, one square next to another. A big world can be made up of many such squares.
[0051] In the target game scene, the virtual character controlled by the target user through the target client is the target virtual character. The target game scene may include multiple levels, and the level currently displayed on the target client may include the target level. For the target level, when the distance between the target virtual character and the target level is relatively close, multiple first scene models may be displayed on the target level, each of which corresponds to the first scene object in the target level and is the LOD model of the object (e.g., a multi-level LOD model).
[0052] LOD refers to the allocation of resources for object rendering based on the position and importance of the nodes of the object model in the display environment, reducing the number of faces and details of non-important objects to achieve efficient rendering operations.
[0053] It should be noted that the distance between the target level and the target virtual character can be: the distance between the level and the character (for example, the target virtual character) is not the distance between an object in the level and the character, but the distance between the center point of the level plot and the character.
[0054] The scene objects corresponding to each first scene model may be different, and the types of scene objects corresponding to different first scene models may be the same or different. The scene objects may include but are not limited to at least one of the following: buildings, trees, and grass.
[0055] For example, the target level contains 3 objects, and the LOD model of each object can be displayed on the currently displayed target level.
[0056] According to the number of model faces and details, different levels of LOD models of the same object can correspond to different precisions. The more faces and details, the higher the precision. According to the location and importance of the object model node in the scene, the target client can decide the resource allocation for object rendering, that is, which level of LOD model to render.
[0057] Step S204, loading the target flow level to which the target level is to be switched, wherein the target flow level includes a plurality of second scene models, and each of the plurality of second scene models is a scene model obtained by merging a portion of the scene models in the plurality of first scene models.
[0058] Since each model has its own multi-level LOD, if the scene model in the scene adopts a multi-level LOD model, when the number of scene models is too large, each model has its own simple model with different LODs and corresponding texture materials, and needs to be rendered separately (rendering a model is called a batch. If there are 1,000 different models in the scene, then 1,000 batches need to be rendered, and they must be rendered separately in a certain order). Efficiency cannot be guaranteed, and memory usage cannot be reduced.
[0059] When the target level is far away from the target person (target virtual character) (for example, exceeding the set distance threshold), it is not necessary to use a high-precision model for the scenery above it. In order to ensure rendering efficiency and reduce content occupancy, it can be replaced with a low-precision model without affecting the overall effect too much.
[0060] In this embodiment, each level (plot with target size) in the target game scene can be loaded using a streaming loading scheme, so that the high-precision model can be switched to a low-precision model. For each level, one or more streaming levels can be pre-baked for it, that is, StreamingLevelLOD (LOD streaming level). LOD streaming level (streaming level) is similar to mesh LOD, which can be set according to the streaming distance, and the level can be replaced with the corresponding streaming level.
[0061] Streaming Level means: asynchronously loading and unloading levels during the game, which can reduce memory usage and create a seamless world scene. StreamingLevelLOD means: streaming loading LOD solution, merging model material maps by pre-baking the model of the entire map, and unloading the original model after loading the new model.
[0062] However, since pre-baking is performed in levels, the model of the entire level is pre-baked, and the baked map is not accurate enough. For some models with high precision requirements (for example, iconic buildings, trees, etc.), the color difference will be very large.
[0063] Optionally, in this embodiment, when baking the stream level, the scene model in the level can be divided into multiple different parts, and the scene models of different parts can be merged in different ways according to the scene, and baked into one scene model respectively. For some objects with higher precision requirements, the precision of these object models can be improved by baking them specially. For example, there are several buildings in the scene, some of which are more obvious and are landmark buildings, and they can be baked in a way with better baking effect. For some objects with lower precision requirements, they can be baked in a way with general baking effect. For a large number of identical objects, Instance can be used for baking.
[0064] After baking each scene model, the baked models can be combined into a streamer card, or combined with other information to form a stream level. The baked stream level can be saved in a server or other storage device, so that it can be loaded into a client (e.g., a target client) running the target game when the game is running.
[0065] It should be noted that baking a model only bakes the model itself, and does not record the light and shadow information of the model. The lighting is calculated in real time through the material during rendering. For model baking, storing the mesh data of the model is one aspect, and it can also include: storing texture data. For example, some model rendering requires mixing multiple basic color maps, so the mixed map can be directly calculated. Exemplarily, baking a model can include: obtaining the mesh information, material and texture of the model.
[0066] It should be noted that the baking process of streaming levels requires a lot of calculations. In order to improve the smoothness of game operation, the scene or streaming level baking can be performed in advance by the server. Compared with the running process of the target game, the baking process of the scene can be used as an offline preparation process instead of being executed when the target game is running.
[0067] For the target stream level, when the target virtual character is far away from the target level, or when other level switching conditions are met, the target client can determine to switch the target level to the target stream level. The target client can interact with the server to load the target stream level, or directly load the locally saved target stream level.
[0068] The target stream level may include multiple second scene models. Each of the multiple second scene models is a scene model obtained by merging partial scene models in the multiple first scene models. According to the different corresponding scene objects and the importance of the scene objects, the same or different baking methods may be used to bake each partial scene model in the multiple first scene models to obtain each second scene model.
[0069] For example, the number of scene objects displayed on the target level is 10. When baking the target stream level, you can merge the models of 4 scene objects and bake them into one scene model in the target stream level, merge the models of 3 scene objects and bake them into one scene model in the target stream level, and merge the models of the remaining 3 scene objects and bake them into one scene model in the target stream level. After baking, the number of scene models obtained is 3.
[0070] Step S206: Control the level displayed on the target client to switch to the target stream level, wherein the target stream level displays a plurality of second scene models.
[0071] For the loaded target stream level, the target client can render it to the target level for display, that is, control the level displayed on the target client to switch to the target stream level, and the target stream level displays multiple second scene models. The target client can render from near to far, or in other ways. The rendering method is determined by the rendering pipeline of the engine itself, which is not limited in this embodiment.
[0072] Optionally, in this embodiment, the light in the game needs to be real-time rather than static, so it is not possible to bake light and shadow for the model. When rendering the model in the target stream level, the target client can use color maps, normal maps, roughness metal maps, etc. to calculate the lighting, and then use the obtained lighting to render the light and shadow.
[0073] Through the above steps S202 to S206, multiple first scene models of the target level are displayed on the target client, wherein each of the multiple first scene models is an LOD model of a scene object; the target stream level to be switched to is loaded, wherein the target stream level includes multiple second scene models, and each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models; the level displayed on the target client is controlled to switch to the target stream level, wherein multiple second scene models are displayed on the target stream level, so as to solve the problem of poor user visual experience caused by excessive difference in model accuracy before and after switching in the model switching method in the related art, reduce the difference in rendering images before and after model switching, and improve the user's visual experience.
[0074] As an optional embodiment, before displaying the plurality of first scene models of the target level on the target client, the method further includes:
[0075] S11, when the target virtual character enters the target event scene to which the target level belongs for the first time, multiple levels in the target event scene that are within the target visible range are loaded, wherein the target virtual character is a virtual character controlled by the target client, and the target visible range is the visible range of the target camera corresponding to the target virtual character;
[0076] S12, displaying the recorded multiple levels on the target client.
[0077] In order to improve the loading efficiency of the scene, when the virtual object enters the target game scene for the first time, the range (fan-shaped range) that the current camera can see can be calculated according to the direction of the camera (corresponding to the target virtual object), and the plots within this range can be loaded first, so as to achieve the purpose of entering the target game faster.
[0078] For example, the target client can first read the configured person's viewing distance, such as 500 meters, so the person's visual range is a 180-degree sector with a radius of 500 meters. By traversing the bounding box information of the plots in the scene, it is calculated whether the bounding box of each plot is within this sector.
[0079] Optionally, in this embodiment, when the target virtual character enters the target game scene for the first time, the target client can load multiple levels in the target event scene that are within the target visible range, the target virtual character is a virtual character controlled by the target client, and the target visible range is the visible range of the target camera corresponding to the target virtual character. The target client can determine the stream level that needs to be loaded for each level according to the distance between each level in the multiple levels and the target virtual character.
[0080] After the multiple levels within the target visible range are loaded, the multiple loaded levels can be displayed on the target client.
[0081] Through this embodiment, the levels within the field of view are loaded preferentially according to the direction of the camera, which can speed up the entry into the event scene and solve the problem of slow scene (map) loading.
[0082] As an optional embodiment, before loading the target stream level to be switched to, the method further includes:
[0083] S21, when it is detected that the distance between the target level and the target virtual character changes from less than the target distance threshold to greater than or equal to the target distance threshold, determine to switch the target level to the target streaming level, and the target virtual character is the virtual character controlled by the target client.
[0084] If the distance between the target level and the target virtual character (target person) exceeds the target distance threshold, it can be considered that the scene model in the target level does not need to use a high-precision model, thereby triggering the execution of level switching.
[0085] The target client can detect the distance between the target level and the target virtual character, and when detecting that the distance between the target level and the target virtual character changes from less than the target distance threshold to greater than or equal to the target distance threshold, determine that level switching needs to be performed, and switch the target level to the target stream level. The above detection operation can be performed in real time or periodically, which is not limited in this embodiment.
[0086] It should be noted that if the distance between the target level and the target virtual character changes from being greater than or equal to the target distance threshold to being less than the target distance threshold, the target client can switch the target stream level back to the target level. The switching process is the reverse process of the above process, which will not be described in detail in this embodiment.
[0087] It should also be noted that if the distance between the target level and the target virtual character increases further, the stream level switch can be performed again, switching from the target stream level to another stream level, and the model accuracy of the scene model on this stream level can be lower than the model accuracy of the scene model on the target stream level.
[0088] Through this embodiment, the switching of the flow level is performed according to the distance control between the level and the character, which can improve the flexibility of the flow level switching.
[0089] As an optional embodiment, after controlling the level displayed on the target client to switch to the target stream level, the method further includes:
[0090] S31, when all the scene models in the target stream level have been displayed, all the scene models in the target level are uninstalled.
[0091] In some game engines, an HLOD (Hierarchical LOD) system or a similar system may be deployed, and the game engine may be UE4. The HLOD system reduces the memory of new models and improves rendering efficiency by merging models, materials, and textures. The HLOD system can replace multiple static mesh actors at a distance with a single merged static mesh actor (a static mesh is a basic type of renderable geometry in the virtual engine). In this way, the number of Actors that need to be rendered in the scene can be reduced, thereby improving performance by reducing the number of draw calls per frame.
[0092] If only the HLOD system is used, since the different LODs of the model are essentially still one model (for example, a model has 3 levels of LOD, there are 3 groups of vertices in this model, and one group of vertices is selected from the 3 groups for use during runtime), it is impossible to unload the original model through streaming loading to reduce memory.
[0093] In this embodiment, since the streaming LOD loading method is adopted, the memory occupation of the model can be reduced by streaming loading of the new model and unloading the original model.
[0094] When switching streaming levels, after asynchronously loading the LOD level (target streaming level), the target client can unload all scene models displayed on the target level before the target streaming level.
[0095] Optionally, after loading the target stream level, the target client may not unload the currently displayed level first, but instead perform transition through LOD Dithering. LOD Dithering means: rendering two models at the same time, one with more and more pixels and the other with less and less pixels to achieve a switching transition.
[0096] When the transition time is over and all the level objects of FadeIn (eg, scene objects on the target stream level) are displayed, all the level objects of FadeOut (eg, scenes on the target level) are uninstalled.
[0097] Through this embodiment, the original model is unloaded after the new model is loaded, which can reduce the memory occupation of the model.
[0098] As an optional embodiment, after controlling the level displayed on the target client to switch to the target stream level, the method further includes:
[0099] S41, in the case where multiple second scene models include instantiated models baked from multiple third scene models, the instantiated models are submitted in a batch, and the instantiated models are rendered to the target stream level for display, wherein the number of vertices submitted in a batch is the number of vertices of a third scene model, and the multiple third scene models are at least one of the following: grass, forest, and the density of the multiple third scene models is less than the density of multiple matching scene models in the target level that match the multiple third scene models.
[0100] The plurality of second scene models may include instantiated models baked from the plurality of third scene models, and the plurality of third scene models may be at least one of the following: grass, forest. For example, grass, forest, etc. on the target level may be baked into the target stream level by way of Instance.
[0101] The Instance method is to render a large number of identical objects in a batch. If you just bake the same object into a model, if a model has 100 vertices, and an instance contains 10 models, then the baked model will have 1000 vertices. If you bake it into an instance, you still need to submit a batch, but you only need to submit data for 100 vertices instead of 1000 vertices.
[0102] When rendering the above-mentioned instantiated models, the target client can submit the instantiated models in a batch. The number of vertices submitted is the number of vertices of a third scene model. In addition, the position, status, color, etc. of different third scene models can also be submitted, so as to display the instantiated models on the target stream level, which can reduce the number of CPU submissions.
[0103] Optionally, in this embodiment, if the switching to the target stream level is caused by the increase in the distance from the target virtual character, the rendering efficiency can be improved by adjusting the density of the baked specific object. The specific object can be at least one of a grass field and a forest.
[0104] For the instantiated models (ie, grass and / or forest) baked by Instance, the density of the corresponding multiple third scene models is less than the density of the multiple matching scene models in the target level that match the multiple third scene models.
[0105] For example, the density of each tree and each grass can be adjusted after baking. For other types of object models, as long as they have similar object features, such as repeated shapes and concentrated positions, they can also be baked in a similar way.
[0106] Through this embodiment, multiple models are submitted for rendering in a batch, which can reduce the number of submissions by the CPU; by reducing the density of grass, trees, etc., the rendering efficiency can be improved.
[0107] As an optional embodiment, after controlling the level displayed on the target client to switch to the target stream level, the method further includes:
[0108] S51, in the case where the multiple second scene models include a first target scene model obtained by baking the multiple fourth scene models by merging model vertices, model textures and model materials, the first target scene model is rendered to the target stream level for display using the model vertices, model textures and model materials of the first target scene model.
[0109] The multiple second scene models may include a first target scene model baked by merging model vertices, model maps and model materials from the multiple fourth scene models, that is, the first target scene model is baked by the multiple fourth scene models using HLOD or a similar method.
[0110] When baking multiple fourth scene models, the server can merge the model resources of the multiple fourth scene models, bake the multiple fourth scene models into a new object, and the baked new object is the first target scene model. Model resources are resources used for model baking, and a new object can be baked using model resources.
[0111] The first target scene model can be considered as a new object, which has corresponding model vertices, model textures and model materials. The model vertices, model textures and model materials of the first target scene model can be used to render the first target scene model to the target stream level for display.
[0112] For example, if the relevant personnel bake Model 1 and Model 2 into HLOD models through the editor, that is, Model 3 (baked model), then a new resource is obtained. When the level is switched, the HLOD model can be directly loaded and used directly during rendering without relying on the original model. By merging multiple models, the rendering effect can be improved. At the same time, the streaming level method can save memory.
[0113] Through this embodiment, baking multiple scene models in an HLOD manner can improve the model accuracy of these models, reduce model color difference, and enhance the user's visual experience.
[0114] As an optional embodiment, after controlling the level displayed on the target client to switch to the target stream level, the method further includes:
[0115] S61, obtaining a target color map of a second target scene model among the plurality of second scene models, wherein a target material attribute is written into a target color channel of the target color map;
[0116] S62, using the target color map, rendering the second target scene model to the target stream level for display.
[0117] When baking a model, you can increase GPU sampling efficiency by merging map channels. A color map has four channels: R (Red), G (Green), B (Blue), and A (Alpha). When baking, if you choose to bake at least one of the metalness, highlights, roughness, and transparency, you can write the selected attribute to at least one of the four RGBA channels and merge them into one map.
[0118] For a second target scene model among the plurality of second scene models, the second target scene model may have a target color map obtained by the baking method, and a target material attribute is written in a target color channel of the target color map. Optionally, the target color channel is at least one of the following: R channel, G channel, B channel, A channel, and the target material attribute includes at least one of the following: metalness, highlight, roughness, and transparency.
[0119] After obtaining the target color map, the target client can use the target color map to render the second target scene model onto the target stream level for display, which has been described above and will not be repeated here.
[0120] When sampling multiple maps, multiple samplings are required. Through this embodiment, by merging the maps into color channels, the number of samplings can be reduced, and multiple data can be obtained by sampling one map, thereby improving operation efficiency.
[0121] It should be noted that, in addition to the target color map, other maps, such as a normal map, etc., may also be used to render the second target scene model. This embodiment does not limit the map used to render the second target scene model.
[0122] As an optional embodiment, after controlling the level displayed on the target client to switch to the target stream level, the method further includes:
[0123] S71, obtaining a transparent mask map of a third target scene model among the plurality of second scene models;
[0124] S72, using a transparent mask map, rendering the third target scene model onto the target stream level for display.
[0125] If a third target scene model among the multiple second scene models has a transparent mask map, the target client can obtain the transparent mask map of the third target scene model, and use the transparent mask map to render the third target scene model to the target stream level for display.
[0126] Through this embodiment, by using a transparent mask map to render the model, it can be ensured that a mask object of the Mask type can be rendered, thereby improving the display effect of the mask object after rendering.
[0127] It should be noted that, in addition to the transparent mask map, other maps, such as color maps, normal maps, etc., may also be used to render the third target scene model. This embodiment does not limit the maps used to render the third target scene model.
[0128] As an optional embodiment, after controlling the level displayed on the target client to switch to the target stream level, the method further includes:
[0129] S81, generating a block shadow map for a target stream level according to a target frequency, wherein a resolution of the block shadow map is less than a target resolution threshold;
[0130] S82, using the land shadow map to render a land shadow for the target stream level, wherein the land shadow includes a shadow of at least one of the following scene objects: terrain, model, and building.
[0131] In order to ensure the level of realism, a land shadow map can be generated for the level. For example, the CSM (Cascaded Shadow Maps) algorithm can be used to generate real-time shadows for the target stream level. As the user's viewing distance increases, the performance overhead of generating real-time shadows will increase exponentially using the above shadow generation method.
[0132] Optionally, in this embodiment, a shadow map may be generated for each distant LOD block (block in the streaming level) in the field of view to render the shadow, and the resolution of the shadow map is smaller than the resolution of the shadow map required for normal shadow rendering. At the same time, the shadow update frequency of the block may be reduced to increase CPU performance. The shadow update frequency may be a target update frequency that is less than the rendering frequency of the image frame.
[0133] For the target stream level, the target client can generate a plot shadow map for the target stream level according to the target frequency. The resolution of the plot shadow map is less than the target resolution threshold. The target resolution threshold can be a relative value, for example, the resolution of the real-time shadow map generated for the target stream level according to the CSM algorithm. It can also be a fixed value, that is, a fixed resolution threshold, which is not limited in this embodiment.
[0134] After obtaining the plot shadow map, the target client can use the plot shadow map to render the plot shadow for the target stream level. The plot shadow includes the shadow of at least one of the following scene objects: terrain, model, and building.
[0135] The plot shadow is a separate shadow for each baked level, not a global shadow. The terrain, models, and buildings on the plot will calculate the shadow. Since the characters are too far away from the scene, the shadow does not need to be updated every frame. Through the above method, the distant plots also have shadows and reduce consumption.
[0136] Through this embodiment, by generating a shadow map with a smaller resolution for the level and reducing the update frequency of the shadow of the plot, the rendering efficiency of the plot shadow can be improved, and the resource consumption of rendering the plot shadow can be reduced.
[0137] It should be noted that, in this embodiment, the model processing method described above is executed by the client as an example, and the model processing method in this embodiment is also applicable to the manner in which the server and the client execute together.
[0138] According to another aspect of the embodiment of the present application, a model processing method is also provided. Optionally, in this embodiment, the above-mentioned model processing method can be applied to Figure 1 The hardware environment composed of the terminal 102 and the server 104 has been described above and will not be repeated here.
[0139] The model processing method in this embodiment may be executed by the server 104, or by the terminal 102, or by both the server 104 and the terminal 102. The server executing the model processing method in this embodiment may be the same server as the server executing the model processing method in the previous embodiment, or may be a different server. This is not limited in this embodiment.
[0140] Taking the server 104 as an example to execute the model processing method in this embodiment, Figure 3 is a flow chart of another optional model processing method according to an embodiment of the present application, such as Figure 3 As shown, the process of the method may include the following steps:
[0141] Step S302: Acquire a plurality of first scene models in a target level of a target event scene, where the plurality of first scene models are LOD models on the target level to be baked into a target stream level.
[0142] The model processing method in this embodiment can be applied to the event scene composed of the aforementioned multiple levels. Optionally, the model processing method in this embodiment can be used to bake the above-mentioned target event scene, for example, the target game scene. In this embodiment, baking the target game scene is used as an example for explanation.
[0143] The server may bake multiple streaming levels for each level in the target game scene. For the target level, when baking the target streaming level, the server may first obtain multiple first scene models in the target level, where the multiple first scene models are LOD models on the target level to be baked into the target streaming level.
[0144] Step S304, baking the multiple first scene models into multiple second scene models to obtain a target flow level, wherein each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models.
[0145] The multiple first scene models can be divided into multiple parts. According to the different corresponding scene objects and the importance of the scene objects, the same or different baking methods can be used to bake the respective part scene models in the multiple first scene models to obtain the second scene models. The baking process of the model is similar to that described in the above embodiment and will not be repeated here.
[0146] For example, for some objects with high precision requirements, you can improve the precision of these object models by baking them specially. For some objects with low precision requirements, you can bake them in a general way. For a large number of identical objects, you can bake them in an Instance way.
[0147] Optionally, in this embodiment, the server can traverse the scene model in the target level, and determine whether the traversed scene model needs to be baked according to the configured baking conditions. If it does not need to be baked, the scene model is discarded (for example, the model is ignored and marked as not needing to be baked); if it needs to be baked and does not need to be combined with other models for baking, it can be marked as to be baked; if it needs to be baked and needs to be combined with other models for baking, the scene models that need to be combined and baked can be determined according to the marks, and these scene models are marked as to be combined and baked, etc.
[0148] It should be noted that the acquisition of scene models and the baking of the acquired scene models can be performed sequentially or alternately, which is not limited in this embodiment. For example, after acquiring the scene models to be baked together, they can be baked directly; or, after acquiring all scene models, each model can be baked, wherein multiple models that need to be baked together can be baked as a whole.
[0149] Through the above steps S302 to S304, multiple first scene models in the target level of the target event scene are obtained, and the multiple first scene models are LOD models on the target level to be baked into the target stream level; the multiple first scene models are baked into multiple second scene models to obtain the target stream level, wherein each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models, which solves the problem of poor user visual experience caused by excessive difference in model accuracy before and after switching in the model switching method in the related art, reduces the difference in rendering images before and after model switching, and improves the user's visual experience.
[0150] As an optional embodiment, baking the multiple first scene models into the multiple second scene models may include multiple methods, for example, an Instance method, an HLOD method, and a distance field sampling method.
[0151] As an optional implementation, baking multiple first scene models into multiple second scene models includes: submitting multiple third scene models from the multiple first scene models in a batch, and baking the multiple third scene models into an instantiated model, wherein the multiple third scene models are at least one of the following: grassland, forest, and the multiple second scene models include an instantiated model, and the number of vertices submitted in a batch is the number of vertices of a third scene model.
[0152] The server can bake a large number of identical objects such as forests and grasslands (multiple third scene models are the same scene model) into the generated Streaming Level through Instance. The above-mentioned embodiments have been described and will not be repeated here.
[0153] Through this embodiment, the forest and grass are baked into the generated Streaming Level in an Instance manner, which can reduce the number of CPU submissions during rendering and improve rendering efficiency.
[0154] Optionally, in this embodiment, acquiring multiple first scene models in a target level of a target event scene includes: randomly sampling multiple matching scene models that match multiple third scene models according to a target sampling accuracy to obtain multiple third scene models.
[0155] The multiple third sub-scene models may be parts of the multiple matching scene models on the target level, for example, parts of grass and woods. In order to increase rendering efficiency, the density of the multiple matching scene models on the target level after baking may be adjusted, for example, the multiple matching scene models may be randomly sampled according to the target sampling accuracy to obtain multiple third scene models, and the multiple third scene models may be parts of the multiple first scene models.
[0156] As an example, you can adjust the density of grass, forests, etc. by customizing the sampling accuracy. For example, a piece of grass has 1000 grasses, and after normal baking, there are still 1000 grasses. During the baking process, you can use random values to bake only 10%, 50%, etc. of them, reducing the density of the baked grass. The density adjustment method of forests and grass is similar.
[0157] Through this embodiment, by customizing the sampling accuracy to adjust the density of the object model set, the density of the object models in the baked scene can be flexibly controlled, the number of models that need to be rendered can be reduced, and the rendering efficiency can be improved.
[0158] As another optional implementation, baking multiple first scene models into multiple second scene models includes: baking multiple fourth scene models into a first target sub-model by merging model vertices, model maps and model materials of multiple fourth scene models in the multiple first scene models, wherein the multiple second scene models include the first target sub-model.
[0159] Optionally, in this embodiment, obtaining multiple first scene models in a target level of a target event scene includes: obtaining a scene model with a target mark on the target level, and obtaining multiple fourth scene models, wherein the target mark is used to mark scene models to be merged into one model, and the multiple first scene models include multiple fourth scene models.
[0160] When baking or before baking, you can use TAG (tag) to additionally mark objects that need to be specially baked and divide them into HLOD types and other types (for example, you can include types that do not participate in baking).
[0161] For the target level, the target level contains multiple scene models, and the target tag can be used to mark the objects that need to be specially baked in the multiple scene models. The server can obtain the scene model with the target tag from the multiple scene models to obtain multiple fourth scene models. The target tag can be used to mark the scene models to be merged into one model. If there are multiple groups of scene models (multiple groups of HLOD objects) that need to be merged separately, different tags can be used to mark each group of scene models.
[0162] Optionally, in this embodiment, the HLOD object can be marked by a target tag. For the marked HLOD object, it can be baked into a new object by the HLOD algorithm of UE4. In addition, the required effect can be added by custom materials (custom materials are universal base materials).
[0163] For multiple fourth scene models, the models can be merged by merging model resources. Model resources can include multiple types, such as model vertex information, model textures, and model materials. Baking multiple fourth scene models through HLOD can be: merging the vertices (model vertex information), textures (model textures), and materials (model materials) of multiple fourth scene models respectively to obtain a model (target model vertex information), a texture (target model texture), and a material (target model material). By merging models, materials, and textures, the memory of the new model can be effectively reduced and the rendering efficiency can be improved.
[0164] For example, if 10 models are marked by HLOD, their vertex model information can be combined together to form a new model; if the model has 10 textures, the 10 textures can be reduced and put into a new large texture, so that it becomes one model, one texture, and one material, which can save the original CPU rendering of 10 batches to one batch.
[0165] It should be noted that a material contains several maps (for example, highlight map, reflection map, color map, normal map, roughness metalness map, etc.). The material of the model describes how to render the model, and the model's map describes what color or parameters to use to render the model.
[0166] Optionally, the server can also optimize the UV allocation of the merged model to solve the problem of inaccurate Mask (mask) in the critical line sampling of the merged texture. For example, if there is a Mask channel in the texture, the UV is likely to sample the texture pixels on the critical line during sampling, resulting in pixels that should not be displayed being displayed. The UV sampling restrictions can be increased, for example, adding additional critical line judgments to solve the above problem.
[0167] As another optional implementation, baking the multiple first scene models into the multiple second scene models includes: baking the multiple fifth scene models into a scene model in the target flow level by performing distance field sampling on the multiple fifth scene models in the multiple first scene models.
[0168] Multiple fifth scene models can be non-iconic buildings in the target level, and do not need to be baked intensively. For multiple fifth scene models, the server can use a distance field sampling algorithm for baking.
[0169] It should be noted that, by using the distance field sampling algorithm for baking, the baked scene model may only contain the information of the model surface (sampling is only sampling of the model surface), and its model accuracy is lower than the model accuracy of the lowest precision LOD model. However, by merging model vertices, maps and materials to merge models, the model's vertices, maps and other information (not just surface information, but also internal information) can be retained, and its model accuracy can be comparable to the lowest precision LOD model.
[0170] Optionally, in this embodiment, the first target sub-model may also be obtained by performing distance field sampling on multiple fourth scene models, wherein the sampling accuracy of the multiple fourth scene models is higher than the sampling accuracy of the multiple fifth scene models.
[0171] In order to improve the accuracy of some models, high-precision sampling parameters can also be set to make the baked objects closer to the original models. For multiple fourth scene models, multiple fourth scene models can also be baked using distance field sampling, and their sampling accuracy is higher than the sampling accuracy of multiple fifth scene models.
[0172] For example, non-transparent masked objects can be baked using the distance field sampling algorithm of UE4's Streaming Level LOD. UE4's own baking sampling algorithm mainly extracts vertex information on the model surface through spatial sampling.
[0173] Through this embodiment, different baking methods can be used to bake different parts of the scene model, which can improve the flexibility of model baking, reduce rendering consumption, improve the accuracy of certain models, and improve the user's visual experience.
[0174] As an optional embodiment, baking multiple first scene models into multiple second scene models includes: in the process of merging multiple sixth scene models in the multiple first scene models to obtain a second target scene model, writing the target material attributes of the second target scene model into the target color channel of the second target scene model to obtain the target color map of the second target scene model, wherein the multiple second scene models include the second target scene model.
[0175] When multiple maps are sampled, multiple samples are required. In order to reduce the number of samples, the material properties of the scene model obtained by merging the models can be merged into the color channel during the model baking process.
[0176] For multiple sixth scene models among multiple first scene models, in the process of merging the multiple sixth scene models to obtain a second target scene model, the target material attributes of the second target scene model can be written into the target color channel of the second target scene model to obtain the target color map of the second target scene model.
[0177] The target material attribute may be at least one of metalness, highlight, roughness, and transparency, and the target color channel may be at least one of the four RGBA channels of the target color map.
[0178] Through this embodiment, by merging the texture into the color channel, the number of sampling times can be reduced, and multiple data can be obtained by sampling one texture, which can improve the operation efficiency.
[0179] It should be noted that the above-mentioned method of mapping the material to the color channel can be used in the baking process of each part of the scene model. For some unsuitable scene models, the mapping may not be merged into the color channel, which is not limited in this embodiment.
[0180] As an optional embodiment, baking multiple first scene models into multiple second scene models includes: in the process of merging multiple seventh scene models among the multiple first scene models to obtain a third target scene model, baking a transparent mask map of the third target scene model according to the transparent mask maps of the multiple seventh scene models.
[0181] When baking the third target scene model, if multiple seventh scene models have transparent mask maps, the transparent mask map of the third target scene model can be baked according to the transparent mask maps of the multiple seventh scene models, and the transparent channel can be exported to support transparent materials.
[0182] Through this embodiment, by exporting the transparent channel of the model, it can be ensured that the mask type mask objects (for example, trees) can be baked, thereby improving the display effect of the mask objects after baking.
[0183] As an optional embodiment, obtaining multiple first scene models in a target level of a target event scene includes: determining a bounding box size threshold corresponding to a target stream level, wherein the bounding box size threshold is a size threshold of scene models allowed to be baked; and eliminating scene models on the target level whose bounding box size is smaller than the bounding box size threshold.
[0184] When obtaining the first multiple scene models, some objects that do not need to be rendered can be eliminated by traversing. Optionally, during the baking process, small objects that do not need to be baked into the LOD terrain, that is, small objects whose bounding boxes are too small, can be eliminated according to different distances.
[0185] For example, you can pre-configure the distance for switching LOD (streaming distance), for example, when the distance to the character exceeds 200 meters, switch to the currently baked streaming level. Then when baking, you can read the configured value of 200 meters and remove the models that do not need to be baked beyond 200 meters and whose bounding boxes are too small.
[0186] The culled bounding box can become larger as the distance increases. For example, if a stream level is configured with a switching distance of 200 meters and a stream level is configured with a switching distance of 400 meters, then the size of the culled bounding box in the stream level corresponding to 400 meters is larger than the size of the culled bounding box in the stream level corresponding to 200 meters.
[0187] For the target stream level, the server can determine the bounding box size threshold corresponding to the target stream level. The bounding box size threshold matches the streaming distance of the target stream level and is the size threshold of the scene model allowed to be baked. According to the bounding box size threshold, the scene model on the target level whose bounding box size is smaller than the bounding box size threshold is eliminated.
[0188] The method of removing the scene model may be to delete the scene model, or to ignore the scene model when traversing the scene model and mark the scene model as a model that does not need to be baked. The method of removing the scene model may be configured as needed and is not limited in this embodiment.
[0189] For example, Figure 4 As shown, in the game scene, the bounding box of object B in plot A is small. When the distance between character C and plot A is close, object B will be rendered on plot A (at this time, the model of object B is baked in the streaming level displayed on plot A); if the distance between character C and plot A is far, object B will not be rendered on plot A (at this time, the model of object B is not baked in the streaming level displayed on plot A).
[0190] As an optional embodiment, acquiring a plurality of first scene models in a target level of a target event scene includes: eliminating scene models having hidden attributes on the target level.
[0191] In order to avoid baking unnecessary models, hidden objects in the scene can be not baked. For example, when traversing a scene model with hidden attributes, the scene model can be eliminated and not baked.
[0192] For example, during the baking process, the scene model can be judged. If the attributes of the current model in the scene are hidden, this model can be skipped.
[0193] Through this embodiment, by removing small objects or hidden objects whose bounding boxes are too small on the level, the number of baked models can be reduced, thereby improving rendering efficiency.
[0194] For example, when baking scenes or levels, you can use Figure 5 The baking interface shown configures the parameters used in the baking process, which can include the following parameters:
[0195] Relative Distance (relative distance, refers to the relative distance from the target person);
[0196] Simplification Details, including: Create Package Per Asset, Static Mesh Details Percentage, Foliage Density, Grass Density, Bake Foliage to Instance, Bake Grass to Instance, Only Bake Landscape, Override Spatial Sampling Distance;
[0197] Static Mesh Material Setting, including: Landscape ExportLOD;
[0198] Landscape Material Setting, including: Bake Foliage to Landscape, Bake All Static Mesh to Landscape, Bake Grass to Landscape.
[0199] The model processing method in the embodiment of the present application is explained below with optional examples. For the game scene, Streaming Level LOD and HLOD are used in combination, and LOD is made for the streaming level loading method to ensure that when switching LOD, after the new model is loaded, the old model resources will be unloaded and recycled.
[0200] like Figure 6 As shown, the process of the model processing method in this example may include the following steps:
[0201] Step S602, bake the corresponding stream level for each level in the game scene.
[0202] For each level in the game scene, you can pre-bake streaming levels for it. When baking a streaming level, you can use TAG to additionally mark objects that need to be specially baked, dividing them into HLOD types and other types. The marked HLOD objects can be baked into a new object through UE4's HLOD algorithm.
[0203] In addition, the following operations can be performed on objects in the streaming level: for objects with non-transparent masks, bake them using the distance field sampling algorithm; eliminate small objects with bounding boxes that are too small (models that do not need to be baked) based on the distance; adjust the density of trees and grass after baking by customizing the sampling accuracy, and bake them into the generated StreamingLevel through Instance to increase rendering efficiency; increase GPU sampling efficiency by merging map channels; export transparent channels to support transparent materials.
[0204] Step S604, when the character enters the game scene for the first time, the range that the current camera can see is calculated by the direction of the character's camera, and the plots within this range are loaded first.
[0205] Step S606, during the running of the game, a small-resolution shadow map is generated for each distant plot in the field of view, and the shadow update frequency of the plot is reduced.
[0206] Step S608, when the character position moves, the streaming levels displayed on each level are switched according to the streaming distance control of the level.
[0207] If the character's position moves, the distance between the character and each level will also change. If the distance to some levels exceeds the configured distance threshold, the streaming levels displayed on these levels will be switched, and the original model will be unloaded after the new model is loaded.
[0208] Figure 7 This is an illustration of the frame rate and performance improvement results obtained by using the model processing method in this example, where the meanings of each indicator are: Frame, the time spent on rendering each frame; Game, the time spent on each frame by the game thread; Draw, the time spent on Draw Call, the part responsible for rendering by the CPU; GPU, the time spent on the rendering thread; RHIT, Render hardware interface time, hardware interface rendering time; DynRes, dynamic resolution.
[0209] This example can save memory, improve rendering performance and frame rate, enhance rendering effects, and provide a highly customizable model to meet diverse needs.
[0210] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0211] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0212] According to another aspect of the embodiments of the present application, a model processing device for implementing the above-mentioned model processing method is also provided. Figure 8 is a structural block diagram of an optional model processing device according to an embodiment of the present application, such as Figure 8 As shown, the device may include:
[0213] A first display unit 802 is used to display a plurality of first scene models of a target level on a target client, wherein each of the plurality of first scene models is a multi-level-of-detail (LOD) model of a scene object;
[0214] A first loading unit 804 is connected to the first display unit 802 and is used to load a target stream level to be switched to by the target level, wherein the target stream level includes a plurality of second scene models, and each of the plurality of second scene models is a scene model obtained by merging a part of the plurality of first scene models;
[0215] The control unit 806 is connected to the first loading unit 804 and is used to control the level displayed on the target client to switch to the target stream level, wherein a plurality of second scene models are displayed on the target stream level.
[0216] It should be noted that the first display unit 802 in this embodiment can be used to execute the above step S202, the first loading unit 804 in this embodiment can be used to execute the above step S204, and the control unit 806 in this embodiment can be used to execute the above step S206.
[0217] Through the above module, multiple first scene models of the target level are displayed on the target client, wherein each of the multiple first scene models is a multi-level-of-detail LOD model of a scene object; the target stream level to be switched to by the target level is loaded, wherein the target stream level contains multiple second scene models, and each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models; the level displayed on the target client is controlled to switch to the target stream level, wherein multiple second scene models are displayed on the target stream level, thereby solving the problem of poor user visual experience caused by excessive difference in model accuracy before and after switching in the model switching method in the related art, reducing the color difference of the model during model rendering, and improving the picture rendering effect.
[0218] As an optional embodiment, the above device also includes:
[0219] A second loading unit is used for loading a plurality of levels located within a target visible range in the target event scene before displaying a plurality of first scene models of the target level on the target client, when the target virtual character enters the target event scene to which the target level belongs for the first time, wherein the target virtual character is a virtual character controlled by the target client, and the target visible range is a visible range of a target camera corresponding to the target virtual character;
[0220] The second display unit is used to display the recorded multiple levels on the target client.
[0221] As an optional embodiment, the above device also includes:
[0222] A determination unit is used to determine, before loading a target streaming level to be switched from a target level to a target streaming level, to switch the target level to a target streaming level when it is detected that the distance between the target level and a target virtual character changes from less than a target distance threshold to greater than or equal to the target distance threshold, wherein the target virtual character is a virtual character controlled by a target client.
[0223] As an optional embodiment, the above device also includes:
[0224] The unloading unit is used to unload all scene models in the target level after the level displayed on the control target client is switched to the target stream level and when all scene models in the target stream level have been displayed.
[0225] As an optional embodiment, the above device also includes:
[0226] A first rendering unit is used to submit instantiated models in a batch after the level displayed on the control target client is switched to the target stream level, when the multiple second scene models include instantiated models baked from multiple third scene models, and render the instantiated models to the target stream level for display, wherein the number of vertices submitted in a batch is the number of vertices of a third scene model, and the multiple third scene models are at least one of the following: grass, forest, and the density of the multiple third scene models is less than the density of multiple matching scene models in the target level that match the multiple third scene models.
[0227] As an optional embodiment, the above device also includes:
[0228] The second rendering unit is used to render the first target scene model onto the target stream level for display using the model vertices, model textures and model materials of the first target scene model after the level displayed on the control target client is switched to the target stream level, when the multiple second scene models include the first target scene model baked by merging model vertices, model textures and model materials of the multiple fourth scene models.
[0229] As an optional embodiment, the above device also includes:
[0230] A first acquisition unit is used to acquire a target color map of a second target scene model among the plurality of second scene models after the level displayed on the target client is controlled to switch to the target stream level, wherein a target material attribute is written in a target color channel of the target color map;
[0231] The third rendering unit is used to render the second target scene model onto the target stream level for display using the target color map.
[0232] As an optional embodiment, the above device also includes:
[0233] A second acquisition unit is used to acquire a transparent mask map of a third target scene model among the plurality of second scene models after controlling the level displayed on the target client to switch to the target stream level;
[0234] The fourth rendering unit is used to render the third target scene model onto the target stream level for display using the transparent mask map.
[0235] As an optional embodiment, the above device also includes:
[0236] A generating unit, configured to generate a block shadow map for the target stream level according to a target frequency after the level displayed on the target client is switched to the target stream level, wherein a resolution of the block shadow map is less than a target resolution threshold;
[0237] The fifth rendering unit is used to render a land shadow for the target stream level using the land shadow map, wherein the land shadow includes a shadow of at least one of the following scene objects: terrain, model, and building.
[0238] According to another aspect of the embodiments of the present application, a model processing device for implementing the above-mentioned model processing method is provided. Fig. 9 is a structural block diagram of another optional model processing device according to an embodiment of the present application, such as Fig. 9 As shown, the device may include:
[0239] A third acquisition unit 902 is used to acquire a plurality of first scene models in a target level of a target event scene, where the plurality of first scene models are LOD models on the target level to be baked into a target stream level;
[0240] The baking unit 904 is connected to the third acquisition unit 902, and is used to bake the multiple first scene models into multiple second scene models to obtain a target flow level, wherein each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models.
[0241] It should be noted that the third acquisition unit 902 in this embodiment can be used to execute the above step S302, and the baking unit 904 in this embodiment can be used to execute the above step S304.
[0242] Through the above module, multiple first scene models in the target level of the target event scene are obtained, and the multiple first scene models are LOD models on the target level to be baked into the target flow level. The multiple first scene models are baked into multiple second scene models to obtain the target flow level, wherein each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models. This solves the problem of poor user visual experience caused by excessive difference in model accuracy before and after switching in the model switching method in the related art, reduces the difference in rendering images before and after model switching, and improves the user's visual experience.
[0243] As an optional embodiment, the baking unit 904 includes at least one of the following:
[0244] A first baking module is used to submit a plurality of third scene models from the plurality of first scene models in a batch, and bake the plurality of third scene models into an instantiated model, wherein the plurality of third scene models are at least one of the following: grass, forest, the plurality of second scene models include the instantiated model, and the number of vertices submitted in a batch is the number of vertices of one third scene model;
[0245] a second baking module, configured to bake the plurality of fourth scene models into a first target sub-model by merging model vertices, model maps and model materials of the plurality of fourth scene models in the plurality of first scene models, wherein the plurality of second scene models include the first target sub-model;
[0246] The third baking module is used to bake the multiple fifth scene models into a scene model in the target stream level by performing distance field sampling on the multiple fifth scene models in the multiple first scene models.
[0247] As an optional embodiment, the baking unit 904 includes:
[0248] The fourth baking module is used to write the target material attributes of the second target scene model into the target color channel of the second target scene model in the process of merging multiple sixth scene models in the multiple first scene models to obtain the second target scene model, so as to obtain the target color map of the second target scene model, wherein the multiple second scene models include the second target scene model.
[0249] As an optional embodiment, the baking unit 904 includes:
[0250] The fifth baking module is used to bake out the transparent mask map of the third target scene model according to the transparent mask maps of the multiple seventh scene models in the process of merging the multiple seventh scene models in the multiple first scene models to obtain the third target scene model.
[0251] As an optional embodiment, the third obtaining unit 902 includes:
[0252] A determination module, used to determine a bounding box size threshold corresponding to a target stream level, wherein the bounding box size threshold is a size threshold of a scene model that is allowed to be baked;
[0253] The first culling module is used to cull the scene model whose bounding box size is smaller than the bounding box size threshold on the target level.
[0254] As an optional embodiment, the third obtaining unit 902 includes:
[0255] The second culling module is used to cull the scene model with hidden attributes on the target level.
[0256] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.
[0257] According to another aspect of an embodiment of the present application, an electronic device for implementing the above-mentioned model processing method is also provided. The electronic device may be a server, a terminal, or a combination thereof.
[0258] Fig.10 is a structural block diagram of an optional electronic device according to an embodiment of the present application, such as Fig.10 As shown, it includes a processor 1002, a communication interface 1004, a memory 1006 and a communication bus 1008, wherein the processor 1002, the communication interface 1004 and the memory 1006 communicate with each other through the communication bus 1008, wherein,
[0259] Memory 1006, used for storing computer programs;
[0260] Optionally, the processor 1002 is configured to implement the following steps when executing the computer program stored in the memory 1006:
[0261] S1, displaying a plurality of first scene models of a target level on a target client, wherein each of the plurality of first scene models is an LOD model of a scene object;
[0262] S2, loading a target stream level to be switched to by the target level, wherein the target stream level includes a plurality of second scene models, and each of the plurality of second scene models is a scene model obtained by merging a part of the scene models in the plurality of first scene models;
[0263] S3, controlling the level displayed on the target client to switch to the target stream level, wherein the target stream level displays a plurality of second scene models.
[0264] The processor 1002 is used to execute the computer program stored in the memory 1006 to implement the following steps:
[0265] S1, obtaining a plurality of first scene models in a target level of a target event scene, where the plurality of first scene models are LOD models on the target level to be baked into a target stream level;
[0266] S2, baking the multiple first scene models into multiple second scene models to obtain a target flow level, wherein each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models.
[0267] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0268] The communication interface is used for communication between the above electronic device and other devices.
[0269] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0270] As an optional example, the memory 1006 may include but is not limited to the first display unit 802, the first loading unit 804 and the control unit 806 in the model processing device. In addition, it may also include but is not limited to other modules in the model processing device, which will not be repeated in this example.
[0271] As another optional example, the memory 1006 may include but is not limited to the third acquisition unit 902 and the baking unit 904 in the model processing device. In addition, it may also include but is not limited to other modules in the model processing device, which will not be repeated in this example.
[0272] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU, NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0273] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0274] It can be understood by those skilled in the art that Fig.10 The structure shown is for illustration only. The device for implementing the above-mentioned model processing method may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Fig.10 It does not limit the structure of the above electronic device. For example, the terminal device may also include Fig.10 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Fig.10 Different configurations shown.
[0275] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.
[0276] According to another aspect of the embodiment of the present application, a storage medium is also provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of any of the above model processing methods in the embodiment of the present application.
[0277] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.
[0278] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
[0279] S1, displaying a plurality of first scene models of a target level on a target client, wherein each of the plurality of first scene models is an LOD model of a scene object;
[0280] S2, loading a target stream level to be switched to by the target level, wherein the target stream level includes a plurality of second scene models, and each of the plurality of second scene models is a scene model obtained by merging a part of the scene models in the plurality of first scene models;
[0281] S3, controlling the level displayed on the target client to switch to the target stream level, wherein the target stream level displays a plurality of second scene models.
[0282] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
[0283] S1, obtaining a plurality of first scene models in a target level of a target event scene, where the plurality of first scene models are LOD models on the target level to be baked into a target stream level;
[0284] S2, baking the multiple first scene models into multiple second scene models to obtain a target flow level, wherein each of the multiple second scene models is a scene model obtained by merging some scene models in the multiple first scene models.
[0285] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, which will not be described in detail in this embodiment.
[0286] Optionally, in this embodiment, the storage medium may include but is not limited to: a U disk, a ROM, a RAM, a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0287] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0288] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0289] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0290] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0291] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.
[0292] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0293] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A model processing method, characterized in that: include: Displaying a plurality of first scene models of a target level on a target client, wherein each of the plurality of first scene models is a level-of-detail (LOD) model of a scene object; A target stream level to be switched to by the target level is loaded using a streaming loading solution, wherein the target stream level includes a plurality of second scene models, and each of the plurality of second scene models is a scene model obtained by merging a portion of the plurality of first scene models; Controlling the level displayed on the target client to switch to the target stream level, wherein the target stream level displays the plurality of second scene models; Controlling the level displayed on the target client to switch to the target stream level includes transitioning through a gradual jittering manner, specifically including: gradually increasing the number of pixels rendered by the model corresponding to the target stream level, and gradually reducing the number of pixels rendered by the model corresponding to the target level to perform the switching transition.
2. The method according to claim 1, characterized in that Before displaying the plurality of first scene models of the target level on the target client, the method further includes: When a target virtual character enters a target event scene to which the target level belongs for the first time, loading multiple levels in the target event scene that are within a target visual range, wherein the target virtual character is a virtual character controlled by the target client, and the target visual range is the visual range of a target camera corresponding to the target virtual character; The recorded multiple levels are displayed on the target client.
3. The method according to claim 1, characterized in that Before loading the target stream level to be switched to, the method further includes: When it is detected that the distance between the target level and the target virtual character changes from less than a target distance threshold to greater than or equal to the target distance threshold, it is determined to switch the target level to the target streaming level, wherein the target virtual character is a virtual character controlled by the target client.
4. The method according to claim 1, wherein After controlling the level displayed on the target client to switch to the target stream level, the method further includes: When all scene models in the target stream level have been displayed, all scene models in the target level are uninstalled.
5. The method according to claim 1, wherein After controlling the level displayed on the target client to switch to the target stream level, the method further includes: In the case where the multiple second scene models include instantiated models baked from multiple third scene models, the instantiated models are submitted in a batch and rendered to the target stream level for display, wherein the number of vertices submitted in a batch is the number of vertices of one third scene model, and the multiple third scene models are at least one of the following: grass, forest, and the density of the multiple third scene models is less than the density of multiple matching scene models in the target level that match the multiple third scene models.
6. The method according to claim 1, wherein After controlling the level displayed on the target client to switch to the target stream level, the method further includes: In a case where the multiple second scene models include a first target scene model obtained by baking multiple fourth scene models by merging model vertices, model textures and model materials, the first target scene model is rendered onto the target stream level for display using the model vertices, model textures and model materials of the first target scene model.
7. The method according to claim 1, characterized in that After controlling the level displayed on the target client to switch to the target stream level, the method further includes: Obtaining a target color map of a second target scene model among the plurality of second scene models, wherein a target material attribute is written into a target color channel of the target color map; The second target scene model is rendered onto the target stream level for display using the target color map.
8. The method according to claim 1, characterized in that After controlling the level displayed on the target client to switch to the target stream level, the method further includes: Obtaining a transparent mask map of a third target scene model among the plurality of second scene models; The third target scene model is rendered onto the target stream level for display using the transparent mask map.
9. The method according to any one of claims 1 to 8, characterized in that After controlling the level displayed on the target client to switch to the target stream level, the method further includes: generating a parcel shadow map for the target stream level at a target frequency, wherein a resolution of the parcel shadow map is less than a target resolution threshold; The land shadow map is used to render land shadows for the target streaming level, wherein the land shadows include shadows of at least one of the following scene objects: terrain, models, and buildings.
10. A model processing device, characterized in that: include: A first display unit is configured to display a plurality of first scene models of a target level on a target client, wherein each of the plurality of first scene models is a level-of-detail (LOD) model of a scene object; a first loading unit, configured to load a target stream level to be switched from the target level using a streaming loading solution, wherein the target stream level includes a plurality of second scene models, each of the plurality of second scene models being a scene model obtained by merging a portion of the plurality of first scene models; A control unit is configured to control the level displayed on the target client to switch to the target stream level, wherein the target stream level displays the multiple second scene models; the control of switching the level displayed on the target client to the target stream level includes transitioning by gradual dithering, specifically including: gradually increasing the number of pixels rendered by the model corresponding to the target stream level, and gradually reducing the number of pixels rendered by the model corresponding to the target level to perform the switching transition.
11. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via the communication bus, wherein: The memory is used to store computer programs; The processor is configured to execute the method steps according to any one of claims 1 to 9 by running the computer program stored in the memory.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method steps described in any one of claims 1 to 9 when run.
Citation Information
Patent Citations
Method for improving three-dimensional model rendering performance
CN102663801A
Resource dynamic loading method and terminal
CN106547599A
Processing method, rendering method and device for static component in game scene
CN108339270A
Method and apparatus for rendering animation scene, electronic device, and readable storage medium
CN108389245A
Object loading method and device, storage medium and electronic device
CN109523621A
