WO2022127275A1 - Method and device for model switching, electronic device, and storage medium - Google Patents

Method and device for model switching, electronic device, and storage medium Download PDF

Info

Publication number
WO2022127275A1
WO2022127275A1 PCT/CN2021/121447 CN2021121447W WO2022127275A1 WO 2022127275 A1 WO2022127275 A1 WO 2022127275A1 CN 2021121447 W CN2021121447 W CN 2021121447W WO 2022127275 A1 WO2022127275 A1 WO 2022127275A1
Authority
WO
WIPO (PCT)
Prior art keywords
scene
model
target
models
level
Prior art date
Application number
PCT/CN2021/121447
Other languages
French (fr)
Chinese (zh)
Inventor
徐聪
常亮
赵忠健
Original Assignee
成都完美时空网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 成都完美时空网络技术有限公司 filed Critical 成都完美时空网络技术有限公司
Publication of WO2022127275A1 publication Critical patent/WO2022127275A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering

Definitions

  • the present invention relates to the field of data processing, and in particular, to a model switching method and device, an electronic device and a storage medium.
  • LOD Levels of Detail
  • a model switching method comprising: displaying a plurality of first scene models of a target level on a target client, wherein each first scene in the plurality of first scene models
  • the model is an LOD model of a scene object; load the target flow level to which the target level is to be switched, wherein the target flow level contains multiple second scene models, and each of the multiple second scene models
  • the second scene model is a scene model obtained by merging some of the multiple first scene models; in the process of switching to the target flow level, the multiple first scene models are controlled to pass the gradient The jitter transitions to the plurality of second scene models.
  • a model switching device comprising: a display unit for displaying a plurality of first scene models of a target level on a target client, wherein, among the plurality of first scene models Each first scene model is a multi-level of detail LOD model of a scene object; the loading unit is used to load the target flow level to which the target level is to be switched, wherein the target flow level contains a plurality of second scenes model, each second scene model in the plurality of second scene models is a scene model obtained by model merging of some scene models in the plurality of first scene models; the control unit is configured to send the In the process of switching the target flow level, the plurality of first scene models are controlled to transition to the plurality of second scene models through gradual dithering.
  • a computer-readable medium on which computer programs/instructions are stored, and when the computer programs/instructions are executed by a processor, implement the steps of the above-mentioned model switching method.
  • a computer apparatus/equipment/system comprising a memory, a processor and a computer program/instruction stored on the memory, the processor implements the above model when executing the computer program/instruction The steps to switch the method.
  • a computer program product comprising a computer program/instruction, when the computer program/instruction is executed by a processor, the steps of the above-mentioned model switching method are implemented.
  • a plurality of first scene models of the target level are displayed on the target client, wherein each of the plurality of first scene models
  • the first scene model is an LOD model of a scene object; load the target flow level to which the target level is to be switched, wherein the target flow level contains multiple second scene models, and each second scene in the multiple second scene models
  • the model is a scene model obtained by merging some of the multiple first scene models; in the process of switching to the target flow level, the multiple first scene models are controlled to transition to multiple second scene models through gradual dithering , because multiple models are merged into one model, the transition of many-to-one (multiple models to one model) can be realized, the number of submissions of model rendering can be reduced, and the CPU (Central Processing Unit) can be saved while ensuring the model accuracy as much as possible.
  • CPU Central Processing Unit
  • FIG. 1 is a schematic diagram of a hardware environment of an optional model switching method according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of an optional model switching method according to an embodiment of the present application.
  • FIG. 3 is a schematic diagram of an optional model switching method according to an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of another optional model switching method according to an embodiment of the present application.
  • FIG. 5 is a structural block diagram of an optional model switching apparatus according to an embodiment of the present application.
  • FIG. 6 is a structural block diagram of an optional electronic device according to an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a computer apparatus/equipment/system according to an embodiment of the present application.
  • FIG. 8 is a block diagram of a computer program product according to an embodiment of the present application.
  • UE4 (Unreal Engine 4, Unreal Engine 4): is an open source game engine developed by Epic Games;
  • HLOD Hierarchical LOD, Hierarchical Level of Detail
  • StreamingLevelLOD The solution of streaming LOD is to merge the model material texture by pre-baking the model of the entire map. After the new model is loaded, the original model will be unloaded.
  • a model switching method is provided.
  • the above-mentioned model switching method may be applied to the hardware environment formed by the terminal 102 and the server 104 as shown in FIG. 1 .
  • the server 104 is connected to the terminal 102 through 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 may be provided independently of the server for providing data storage services for the server 104 .
  • the above-mentioned network includes but is not limited to: wired network, wireless network, and the above-mentioned 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 a PC (Personal Computer, personal computer), a mobile phone, a tablet computer, or the like.
  • the model switching method in this embodiment of the present application may be executed by the terminal 102 , may also be executed by the server 104 , or may be executed jointly by the terminal 102 and the server 104 .
  • the terminal 102 executes the model switching method of the embodiment of the present application, it may also be executed by a client installed on the terminal (for example, a client of the target game).
  • FIG. 2 is a schematic flowchart of an optional model switching method according to an embodiment of the present application. As shown in FIG. 2 , the process of the method may include: The following steps:
  • Step S202 displaying multiple first scene models of the target level on the target client, wherein each first scene model in the multiple first scene models is an LOD model of a scene object.
  • the model switching method in this embodiment can be applied to a game scene (target game scene, such as a big world) spliced by multiple levels, and the game scene can be a game scene of the target game (eg, a three-dimensional game scene).
  • a game scene target game scene, such as a big world
  • the game scene can be a game scene of the target game (eg, a three-dimensional game scene).
  • the target game can be a single-player game or a multi-player game (for example, an open world game); it can be a battle game or a non-combat game (such as a management game); it can be a client game or a For mobile games, the game type of the target game is not limited in this embodiment.
  • the target game can be an MMORPG (Massive or Massively Multiplayer Online Role-Playing Game), or an AR (Augmented Reality, augmented reality) game, or a VR (Virtual Reality, virtual reality) game , or other types of games.
  • MMORPG Massive or Massively Multiplayer Online Role-Playing Game
  • AR Augmented Reality, augmented reality
  • VR Virtual Reality, virtual reality
  • the terminal device of the target user may run the target client with the target game application.
  • the target client can communicate with the server, and the above server is the background server of the target game.
  • the target user can log in to the target client running on his terminal device by using the account and password, dynamic password, associated application (third-party application) login, etc., and enter the target game scene (target game map, for example) by operating the target client. , the big world).
  • a big world is made up of many levels. There are undulating mountains, rivers, and buildings on different levels.
  • the size of a level can be configured as needed, for example, it can be 128 ⁇ 128 meters. of squares (plots), one square next to another, a large world can be made up of many such squares.
  • the virtual character controlled by the target user through the target client is the target virtual character.
  • the target game scene may contain multiple levels, and the levels currently displayed on the target client may include the target level.
  • the target level when the distance between the target virtual character and the target level is relatively close, multiple first scene models can be displayed on the target level, and each first scene model corresponds to the first scene object in the target level, which is the The LOD model of the object (eg, a multi-level LOD model).
  • the distance between the target level and the target avatar may be: the distance between the level and the character (for example, the target avatar) is not the distance between an object in the level and the character, but the center of the plot of the level The distance between the point and the person.
  • 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.
  • Scene objects may include, but are not limited to, at least one of the following: buildings, trees, and grass.
  • the target level contains 3 objects, and the LOD model of each object can be displayed on the currently displayed target level.
  • the target client can decide the resource allocation for object rendering, that is, which level of LOD model to render.
  • Step S204 load the target flow level to which the target level is to be switched, wherein the target flow level contains multiple second scene models, and each second scene model in the multiple second scene models is one of the multiple first scene models.
  • the scene model obtained by model merging of part of the scene model.
  • each model has its own multi-level LOD
  • the scene model in the scene adopts the multi-level LOD model
  • each model has its own simple model of different LODs and corresponding texture materials. It 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), which cannot guarantee the efficiency and cannot Reduce memory usage.
  • target level When the target level is far away from the target character (target virtual character) (for example, exceeding the set distance threshold), it is not necessary to use a high-precision model for the scenery on it. In order to ensure rendering efficiency and reduce content occupancy, it can be replaced It is a low-precision model without affecting the overall effect too much.
  • each level in the target game scene (plots with the target size) can be loaded using a streaming loading scheme, so that switching from a high-precision model to a low-precision model can be realized.
  • a streaming loading scheme for each level, one or more streaming levels can be pre-baked for it, that is, StreamingLevelLOD (LOD streaming level).
  • LOD streaming levels are similar to mesh LODs, can be set according to the streaming distance, and levels can be replaced with corresponding streaming levels.
  • Streaming Level refers to loading and unloading levels asynchronously during gameplay, which reduces memory usage and creates a seamless world scene.
  • StreamingLevelLOD means: merge the model material texture by pre-baking the model of the entire map, and unload the original model after loading the new model.
  • the scene model in the level can be divided into multiple different parts, and the scene models of different parts can be modeled in different ways. Merge, bake separately into a scene model.
  • the baked model After baking each scene model, the baked model can be composed of a streamer card, or combined with other information to form a streamer level.
  • the baked streaming level can be saved in the server or other storage device, so that it can be loaded into the client (eg, the target client) running the target game when the game is running.
  • the baked 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.
  • storing the mesh data of the model is one aspect, and it can also include: storing texture data.
  • the mixed texture can be calculated directly.
  • baking the model may include: acquiring mesh information, materials, textures, and the like of the model.
  • the baking process of streaming levels requires a lot of calculations. In order to improve the smoothness of game running, you can pre-bake scenes or streaming levels through the server. Relative to the running process of the target game, the baking process of the scene can be used as an offline preparation process, rather than being executed when the target game is running.
  • the target client can determine to switch the target level to the target flow level.
  • the target client can interact with the server to load the target flow level, or directly load a locally saved target flow level.
  • the target flow level can contain multiple second scene models.
  • Each second scene model in the plurality of second scene models is a scene model obtained by model merging of some scene models in the plurality of first scene models. According to the difference of the corresponding scene objects and the importance of the scene objects, each partial scene model in the plurality of first scene models may be baked by using the same or different baking methods to obtain each second scene model.
  • the number of scene objects displayed on the target level is 10.
  • the number of obtained scene models is 3.
  • Step S206 in the process of switching to the target flow level, control the plurality of first scene models to transition to the plurality of second scene models through gradual dithering.
  • the level switching can be performed, and the scene models displayed on the target level are switched from multiple first scene models to multiple second scene models.
  • the transition between different models can be performed by means of gradient jitter.
  • the target client can control the LOD model on the target level to transition to the corresponding model in the target flow level by means of Dither (jitter, for example, gradient dithering).
  • gradient dithering refers to: rendering two models at the same time, one renders more and more pixels, and the other renders less and less pixels, so as to switch transitions.
  • the above gradient dithering can be LOD Dither.
  • Dithering ie, color dithering, color mixing
  • the accuracy of the model before and after the switch is different, and the color will also be different.
  • the gradient dithering includes the gradient of the color and the change of the model precision, through the gradient dithering, both of them can be made a gradient, so that all the objects on the entire Level can smoothly transition from one model precision to another model precision (for example, from The high-end model transitions to the low-end model) without letting users feel the visual experience of sudden changes in the picture.
  • the bucket in Figure 3 has Dither (LOD dithering, an example of dithering) turned on as it transitions from one color (eg, green) to another (eg, yellow), and Instead of transitioning from (a) to (c) all at once, there is a gradient process (b) of color fusion, which is more natural.
  • Dither LOD dithering, an example of dithering
  • a target material attribute for example, StreamingLevelDitherLOD
  • StreamingLevelDitherLOD StreamingLevelDitherLOD
  • the terminal device alone performs flow level switching as an example for illustration.
  • the server and the client to jointly perform, or the server to perform the data calculation in the target game alone (the client only displays the data synchronized by the server). data)
  • the model switching method in this embodiment is also applicable.
  • each first scene model in the multiple first scene models is an LOD model of a scene object; load the target The target flow level to which the level is to be switched, wherein the target flow level contains a plurality of second scene models, and each second scene model in the plurality of second scene models is performed for a part of the scene models in the plurality of first scene models.
  • the scene model obtained by model merging; in the process of switching to the target flow level, controlling multiple first scene models to transition to multiple second scene models through gradient jitter, which solves the problem of model switching in the related art due to visual information.
  • the problem of poor user visual experience caused by jumping improves the smoothness of model switching and the user's visual experience.
  • controlling a plurality of first scene models to transition to a plurality of second scene models through gradual dithering includes:
  • S12 Render multiple first scene models and multiple second scene models simultaneously according to the rendering parameters, so as to control the pixels rendered by the multiple first scene models to gradually decrease, and the pixels rendered by the multiple second scene models to gradually increase.
  • the target client can adjust the jitter parameters corresponding to the target level in real time during the transition time of the stream level, and pass the jitter parameters as parameters to each frame
  • the rendering parameters can be used to render multiple first scene models and multiple second scene models at the same time.
  • DitherFactor can be associated with transition time and can be used to describe how to render different models at the same time.
  • the jitter parameters can be adjusted according to the transition time, that is, at different time points in the transition time, the jitter parameters can be different, so as to control the pixels rendered by multiple first scene models to gradually decrease, and the pixels rendered by multiple second scene models. Pixels gradually increase
  • the target client can adjust the DitherFactor (jitter parameter) of the entire level through time transition, and combine all objects (multiple first scene models) of the two levels (target level and target flow level). and multiple second scene models) are rendered at the same time by the dynamic rendering method, and the DitherFactor is passed as a parameter to the shader parameters (rendering parameters) of all objects when rendering each frame.
  • DitherFactor jitter parameter
  • the shader parameters rendering parameters
  • the above method before rendering the multiple first scene models and the multiple second scene models simultaneously according to the rendering parameters, the above method further includes:
  • the multiple first target models and the multiple second target models are object models to be rendered.
  • stencils can be used to filter pixels of different models. For example, objects that do not need to be rendered can be filtered out through depth map information during rendering. pixel.
  • the target client may acquire first depth map information of the multiple first scene models.
  • the first depth map information may be used to represent the depth of each pixel in the texture corresponding to the first scene model.
  • the target client can filter the object pixels in the multiple first scene models that are outside the target depth range. These object pixels are object pixels that do not need to be rendered, so that multiple first target models can be obtained.
  • the plurality of first target models are object models to be rendered.
  • the target client may acquire second depth map information of the second initial model.
  • the second depth map information may be used to represent the depth of each pixel in the texture corresponding to the second scene model.
  • the target client can filter the object pixels in the multiple first scene models that are outside the target depth range. These object pixels are object pixels that do not need to be rendered, so that multiple second target models can be obtained.
  • the plurality of second target models are object models to be rendered.
  • simultaneously rendering multiple first scene models and multiple second scene models according to rendering parameters includes:
  • S31 select a model to be rendered corresponding to each pixel point from a plurality of first target models and a plurality of second target models;
  • the target client can select the to-be-received pixel corresponding to each pixel from the plurality of first target models and the plurality of second target models according to the current rendering parameters (including the current jitter parameters). Render the model.
  • the rendering parameters are adjusted over time.
  • the model rendered by the same pixel can be different.
  • the colors of different models on the same pixel can also be mixed.
  • Other gradient dithering methods may also be used to realize model transition, which is not limited in this embodiment.
  • the rendering mode of each pixel is determined according to the rendering parameters, which can improve the smoothness of the model transition.
  • the above method before loading the target stream level to which the target level is to be switched, the above method further includes:
  • the target level and the target virtual character is converted from less than the 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.
  • the distance between the level and the target character exceeds the set distance (target distance threshold, the distance is configurable)
  • the distance is configurable
  • the high-precision model can be replaced with a low-precision model without affecting the overall display effect too much.
  • the scene model in the target level does not need to use a high-precision model, thereby triggering the execution of level switching.
  • the target client can detect the distance between the target level and the target avatar, and when it detects that the distance between the target level and the target avatar is converted from less than the target distance threshold to greater than or equal to the target distance threshold, determine that it needs to be executed.
  • Level switch switch the target level to the target flow level. The foregoing detection operation may be performed in real time, or may be performed periodically, which is not limited in this embodiment.
  • the target client can switch the target flow level to the target level again.
  • the switching process is the above process.
  • the reverse process is not repeated in this embodiment.
  • the flow level switch can be performed again, and the target flow level is switched to another flow level.
  • the model accuracy of the scene model on the flow level can be Lower model accuracy than the scene model on the target flow level.
  • the switching of the streaming level is controlled according to the distance between the level and the character, which can improve the flexibility of switching the streaming level.
  • the above method before loading the target stream level to which the target level is to be switched, the above method further includes:
  • S51 Configure the model material of each second scene model in the plurality of second scene models as a target model material, where the target model material has an activated target material attribute, and the target material attribute is used to indicate that the Gradient jitter for model transitions.
  • a new material property that is, a target material property (the property of StreamingLevelDitherLOD) can be added to the model material.
  • a target material property the property of StreamingLevelDitherLOD
  • the target model material can be a model material with the target material properties activated.
  • the plurality of first scene models on the target level may be scene models using the material of the target model, and each of the plurality of second scene models on the target flow level may also be scene models using the material of the target model.
  • the scene model using the material of the target model enables the effect of StreamingDitherLOD, so that the model transition can be performed by gradient jitter when switching between streaming levels.
  • the server may configure the model material of the second scene model as a target model material, the target model material is a model material with an activated target material attribute, and the target material attribute may be used to indicate that the flow level is in the flow level.
  • gradient dithering is used for LOD model transition.
  • the material of the above StreamingLevelLODDither can be inherited and enabled.
  • the server may bake a plurality of first scene models to obtain the target flow level.
  • different baking methods for example, at least one baking method
  • Different baking methods may be performed sequentially (for example, a specified order, or, for example, the order of model positions in the baking direction), or may be performed in parallel, which is not limited in this embodiment.
  • the above method before loading the target stream level to which the target level is to be switched, the above method further includes:
  • the multiple first sub-scene models in the multiple first scene models may be iconic objects in the target level, for example, iconic buildings, which need to be rendered intensively (the model accuracy needs to be improved) during level switching.
  • the server can merge its model vertices, model textures and model materials (or, at least merge model textures), bake multiple first sub-scene models into a new model (new resource),
  • the new model can be a scene model in the target flow level.
  • the models to be baked by using the above-mentioned merged models, textures, and materials may be one group or multiple groups of models, and each group of models may be baked in the above-mentioned manner.
  • the number of scene models obtained by combining and baking may be one or more.
  • the baked scene model not only contains the information on the surface of the model, but also contains the information inside the model.
  • the model accuracy can be compared with the model accuracy of the lowest-precision LOD model. quite.
  • the above method before loading the target stream level to which the target level is to be switched, the above method further includes:
  • the plurality of second sub-scene models in the plurality of first scene models may be non-iconic buildings in the target level, and do not need to be heavily baked.
  • the server may use a distance field sampling algorithm for baking.
  • the distance field sampling algorithm is used for baking, and the baked scene model only contains the information of the model surface (sampling is only the sampling of the model surface), and its model accuracy is lower than that of the lowest-precision LOD model.
  • the above method before loading the target stream level to which the target level is to be switched to, the above method further includes:
  • S64 submit multiple sub-models to be baked according to one batch, bake the multiple sub-models to be baked into one scene model, and obtain a scene model of multiple second scene models, wherein the number of vertices submitted according to one batch is: The number of vertices for a third subscene model.
  • the plurality of third sub-scene models in the plurality of first scene models may correspond to a large number of identical objects (eg, grass, trees). If the distance between the target level and the target avatar is long, it may not be necessary to render all the multiple third sub-scene models.
  • the server may randomly sample multiple third sub-scene models according to the target sampling accuracy, to obtain multiple sub-models to be baked.
  • a lawn with 1000 grasses will still be 1000 grasses after normal baking.
  • 10% or 50% of the grass can be baked with random values, reducing the density of the baked grass and forest.
  • the server can submit them in one batch, and the number of vertices submitted in one batch is the number of vertices of a third sub-scene model, so as to bake the multiple sub-models to be baked into one scene model, and obtain
  • the scene model of can be a scene model in the target flow level.
  • Instance is a way to render a large number of identical objects in a batch. If you only bake the same object into one model, if a model has 100 vertices and an instance contains 10 models, then the baked model has 1000 vertices. If baked into an instance, a batch is still submitted, but only the data of 100 vertices needs to be submitted.
  • the scene model is baked in different ways according to different model requirements, which can improve the flexibility of model baking and improve the rendering performance of the model.
  • the above method further includes:
  • the target client may not unload the currently displayed level first.
  • the transition time ends, after all the level objects of FadeIn (for example, the scene objects on the target flow level) are all displayed, unload all the level objects of FadeOut (for example, the scene on the target level).
  • the target client can unload all the object models in the target level.
  • model switching method is described by taking the server execution model baking process and the terminal execution model rendering process as examples.
  • model switching method in this embodiment is The same method applies.
  • LOD Dither an example of dithering
  • streaming level loading to ensure that when switching LODs, all objects on the entire Level can smoothly transition from the high-end model to the low-end model without letting the The user feels that the screen changes suddenly.
  • the flow of the model switching method in this optional example may include the following steps:
  • Step S402 bake the objects in the level and inherit the material of the StreamingLevelDitherLOD enabled.
  • the model material can increase the attribute of StreamingLevelDitherLOD (target material attribute). When this attribute is activated, the model using this material will turn on the effect of StreamingDitherLOD. You can bake the objects of the entire level through StreamingLevelLOD, and inherit the material with StreamingLevelLODither turned on. When switching levels, all objects with material properties turned on will have a jitter effect.
  • target material attribute target material attribute
  • Step S404 when switching the flow level, control all objects on the entire Level to transition from the high-end model to the low-end model.
  • the client when switching the streaming level, after the LOD level is loaded asynchronously, the client can first not unload the currently displayed level, but adjust the DitherFactor that sets the entire level through time transition, and transfer all the two levels Objects are rendered at the same time through the dynamic rendering method, and DitherFactor is passed as a parameter to the shader parameters of all objects every frame.
  • the pixels of different models can be filtered in a stencil manner.
  • the client can unload all level objects of FadeOut.
  • the terrain of the entire plot, the houses, trees, grass, etc. on the terrain are all undergoing Dither transitions.
  • the transition through Dither will be softer.
  • model switching method can be a scheme of combining HLOD (for example, a method of merging models, textures and materials) and Streaming LOD, or a multi-model-to-single-model transition of StreamingLevelLOD Dither
  • the solution is the level-to-level transition solution of Streaming Level LOD Dither, and the transition solution of Streaming Level LOD Dither's Instance (instance) to Instance.
  • FIG. 5 is a structural block diagram of an optional model switching apparatus according to an embodiment of the present application. As shown in FIG. 5 , the apparatus may include:
  • a display unit 502 configured to display multiple first scene models of the target level on the target client, wherein each first scene model in the multiple first scene models is an LOD model of a scene object;
  • the loading unit 504 connected with the display unit 502, is used for 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 second scene in the plurality of second scene models
  • the model is a scene model obtained by merging some of the scene models in the plurality of first scene models
  • the control unit 506, which is connected to the loading unit 504, is configured to control a plurality of first scene models to transition to a plurality of second scene models through gradual dithering during the process of switching to the target flow level.
  • the display unit 502 in this embodiment can be used to execute the above step S202
  • the loading unit 504 in this embodiment can be used to execute the above step S204
  • the control unit 506 in this embodiment can be used to execute the above step S204. Step S206.
  • a plurality of first scene models of the target level are displayed on the target client, wherein each first scene model in the plurality of first scene models is an LOD model of a scene object; load the target level to be switched to The target flow level, wherein the target flow level contains a plurality of second scene models, and each second scene model in the plurality of second scene models is obtained by model merging of some scene models in the plurality of first scene models
  • multiple first scene models are controlled to transition to multiple second scene models through gradient jitter, which solves the problem of model switching in the related art caused by visual information jumping.
  • the problem of poor user visual experience improves the smoothness of model switching and improves the user's visual experience.
  • control unit 506 includes:
  • the adjustment module is used to adjust the jitter parameters corresponding to the target level during the transition time of switching to the target stream level, and pass the adjusted jitter parameters into the rendering parameters;
  • the rendering module is used to render multiple first scene models and multiple second scene models simultaneously according to the rendering parameters, so as to control the pixel points rendered by the multiple first scene models to gradually decrease, and the pixels rendered by the multiple second scene models to gradually decrease. Increase.
  • the above device also includes:
  • an acquiring unit configured to acquire first depth map information of multiple first scene models and second depths of multiple second scene models before simultaneously rendering multiple first scene models and multiple second scene models according to the rendering parameters map information;
  • a first filtering unit configured to filter object pixels outside the target depth range in the plurality of first scene models according to the first depth map information to obtain a plurality of first target models
  • a second filtering unit configured to filter object pixels outside the target depth range in the plurality of second scene models according to the second depth map information to obtain a plurality of second target models
  • the plurality of first target models and the plurality of second target models are object models to be rendered.
  • the rendering module includes:
  • the selection sub-module is used to select the to-be-rendered model corresponding to each pixel point from a plurality of first target models and a plurality of second target models according to the rendering parameters;
  • the rendering submodule is used to render the model to be rendered selected for each pixel on each pixel.
  • the above device also includes:
  • the detection unit is used to detect that the distance between the target level and the target virtual character is converted from less than the target distance threshold to greater than or equal to the target distance threshold before loading the target flow level to which the target level is to be switched, wherein the target virtual character is The virtual character controlled by the target client.
  • the above device also includes:
  • the configuration unit is configured to configure the model material of each second scene model in the plurality of second scene models as the target model material before loading the target stream level to which the target level is to be switched, wherein the target model material has an activated
  • the target material property which is used to indicate the transition of the model by gradient jitter when the flow level is switched.
  • the above device also includes at least one of the following:
  • the first baking unit is used to merge the model vertices, model maps and model materials of the multiple first sub-scene models in the multiple first scene models before loading the target stream level to which the target level is to be switched, and combine the multiple first sub-scene models.
  • the first sub-scene model is baked into a scene model to obtain a scene model of multiple second scene models;
  • the second baking unit is configured to bake the plurality of second sub-scene models into one scene model by sampling the distance field of the plurality of second sub-scene models in the plurality of first scene models to obtain a plurality of second scene models a scene model of ;
  • a sampling unit configured to randomly sample multiple third sub-scene models of the multiple first scene models according to the target sampling accuracy, to obtain multiple sub-models to be baked, wherein the multiple third sub-scene models are the same model;
  • the third baking unit is configured to submit a plurality of sub-models to be baked in one batch, bake the sub-models to be baked into a scene model, and obtain a scene model of the plurality of second scene models, wherein according to a batch
  • the number of vertices submitted is the number of vertices of a third subscene model.
  • the above device also includes:
  • the unloading unit is used to unload all the object models in the target level under the condition that all the object models in the target flow level have been displayed after controlling the plurality of first scene models to transition to the plurality of second scene models through gradient jittering .
  • the above modules may run in the hardware environment as shown in FIG. 1 , and may be implemented by software or hardware, wherein the hardware environment includes a network environment.
  • an electronic device for implementing the above model switching method is also provided, where the electronic device may be a server, a terminal, or a combination thereof.
  • FIG. 6 is a structural block diagram of an optional electronic device according to an embodiment of the present application. As shown in FIG. 6 , it includes a processor 602, a communication interface 604, a memory 606, and a communication bus 608, wherein the processor 602, the communication interface 604 and the memory 606 communicate with each other through the communication bus 608, wherein,
  • memory 606 for storing computer programs
  • each first scene model in the multiple first scene models is an LOD model of a scene object
  • each second scene model in the multiple second scene models is a second scene model in the multiple first scene models
  • the scene model obtained by model merging of some scene models
  • the above-mentioned communication bus may be a PCI (Peripheral Component Interconnect, Peripheral Component Interconnect Standard) bus, or an EISA (Extended Industry Standard Architecture, Extended Industry Standard Architecture) bus or the like.
  • the communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 6, but it does not mean that there is only one bus or one type of bus.
  • the communication interface is used for communication between the above electronic device and other devices.
  • the memory may include RAM and may also include non-volatile memory, such as at least one disk memory.
  • the memory may also be at least one storage device located remotely from the aforementioned processor.
  • the above-mentioned memory 606 may include, but is not limited to, the display unit 502 , the loading unit 504 and the control unit 506 in the above-mentioned model switching apparatus. In addition, it may also include but not limited to other modules in the above-mentioned model switching apparatus, which will not be repeated in this example.
  • the above-mentioned processor can be a general-purpose processor, which can include but is not limited to: CPU, NP (Network Processor, network processor), etc.; can also be DSP (Digital Signal Processing, digital signal processor), ASIC (Application Specific Integrated Circuit, Application-specific integrated circuits), FPGA (Field-Programmable Gate Array, Field Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • CPU Central Processing
  • NP Network Processor, network processor
  • DSP Digital Signal Processing, digital signal processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array, Field Programmable Gate Array
  • other programmable logic devices discrete gate or transistor logic devices, discrete hardware components.
  • the device implementing the above model switching method may be a terminal device, and the terminal device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a Handheld computers and terminal equipment such as Mobile Internet Devices (MID) and PAD.
  • FIG. 6 does not limit the structure of the above electronic device.
  • the terminal device may also include more or less components than those shown in FIG. 6 (eg, a network interface, a display device, etc.), or have a different configuration than that shown in FIG. 6 .
  • a storage medium is also provided.
  • the above-mentioned storage medium may be used to execute the program code of any one of the above-mentioned model switching methods in the embodiments of this application.
  • the foregoing storage medium may be located on at least one network device among multiple network devices in the network shown in the foregoing embodiment.
  • the storage medium is configured to store program codes for executing the following steps:
  • each first scene model in the multiple first scene models is an LOD model of a scene object
  • each second scene model in the multiple second scene models is a second scene model in the multiple first scene models
  • the scene model obtained by model merging of some scene models
  • the above-mentioned storage medium may include, but is not limited to: U disk, ROM, RAM, removable hard disk, magnetic disk, or optical disk, and other mediums that can store program codes.
  • the integrated units in the above-mentioned embodiments are implemented in the form of software functional units and sold or used as independent products, they may be stored in the above-mentioned computer-readable storage medium.
  • the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a storage medium,
  • Several instructions are included to cause 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.
  • the disclosed client may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of units or modules, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place or distributed to 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.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof.
  • a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the model switching apparatus according to the embodiment of the present invention.
  • DSP digital signal processor
  • the present invention can also be implemented as a program/instruction (eg, computer program/instruction and computer program product) for an apparatus or apparatus for performing some or all of the methods described herein.
  • Such programs/instructions implementing the present invention may be stored on a computer readable medium, or may exist in the form of one or more signals, such signals may be downloaded from an Internet website, or provided on a carrier signal, or in any form Available in other formats.
  • Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology.
  • Information may be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridges, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
  • PRAM phase-change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read only memory
  • EEPROM Electrically Erasable Programm
  • FIG. 7 schematically shows a computer apparatus/device/system that can implement a model switching method according to the present invention, the computer apparatus/device/system including a processor 710 and a computer-readable medium in the form of a memory 720 .
  • Memory 720 is an example of a computer-readable medium having storage space 730 for storing computer programs/instructions 731 .
  • the computer program/instructions 731 are executed by the processor 710, various steps in a model switching method described above can be implemented.
  • Figure 8 schematically shows a block diagram of a computer program product implementing the method according to the invention.
  • the computer program product includes a computer program/instructions 810 that, when executed by a processor, such as the processor 710 shown in FIG. 7, can implement a model switching method described above in each step.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

A method and device for model switching, an electronic device, and a storage medium. The method comprises: displaying multiple first scene models of a target level on a target client, where each first scene model in the multiple first scene models is a levels of detail (LOD) model of one scene object (S202); loading a target stream level to be switched to of the target level, where the target stream level comprises multiple second scene models, and each second scene model in the multiple second scene models is a scene model produced by a model merge of some scene models in the multiple scene models (S204); and while switching to the target stream level, controlling the multiple first scene models to transition by gradient dithering to the multiple second scene models (S206). By means of the method, solved is the problem of poor user visual experience due to visual information jumping found in a model switching scheme in the prior art.

Description

模型切换方法和装置、电子设备和存储介质Model switching method and apparatus, electronic device and storage medium
交叉引用cross reference
本申请要求2020年12月16日递交的、申请号为“202011487643.5”、发明名称为“模型切换方法和装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on December 16, 2020 with the application number "202011487643.5" and the invention titled "Model Switching Method and Device, Electronic Device and Storage Medium", the entire contents of which are incorporated by reference in in this application.
技术领域technical field
本发明涉及数据处理领域,尤其涉及一种模型切换方法和装置、电子设备和存储介质。The present invention relates to the field of data processing, and in particular, to a model switching method and device, an electronic device and a storage medium.
背景技术Background technique
目前,在3D(3 Dimensions,三维)游戏开发的过程中,需要对游戏性能进行优化,而性能优化的一个重要过程是对模型的渲染优化。为了提高模型渲染效率,可以对模型做LOD(Levels of Detail,多细节层次),离目标人物远的位置的模型可以从高配模型切换到低配模型,通过渲染大量的低配模型来提高性能。At present, in the process of 3D (3 Dimensions, three-dimensional) game development, the game performance needs to be optimized, and an important process of performance optimization is the rendering optimization of the model. In order to improve the rendering efficiency of the model, LOD (Levels of Detail) can be done on the model, and the model far away from the target character can be switched from the high-end model to the low-end model, and the performance can be improved by rendering a large number of low-end models.
在切换一个关卡上显示的模型时,由于切换前后模型的精度不同,存在由于视觉信息跳转导致的用户视觉体验差的问题。When switching models displayed on a level, there is a problem that the user's visual experience is poor due to the jump of visual information due to the different accuracy of the models before and after switching.
发明内容SUMMARY OF THE INVENTION
本发明提出以下技术方案以克服或者至少部分地解决或者减缓上述问题:The present invention proposes the following technical solutions to overcome or at least partially solve or alleviate the above-mentioned problems:
根据本发明的一个方面,提供了一种模型切换方法,包括:在目标客户端上显示目标关卡的多个第一场景模型,其中,所述多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型;加载所述目标关卡待切换到的目标流关卡,其中,所述目标流关卡中包含多个第二场景模型,所述多个第二场景模型中的每个第二场景模型为所述多个第一场景模型中的部分场景模型进行模型合并所得到的场景模 型;在向所述目标流关卡切换的过程中,控制所述多个第一场景模型通过渐变抖动过渡到所述多个第二场景模型。According to an aspect of the present invention, a model switching method is provided, comprising: displaying a plurality of first scene models of a target level on a target client, wherein each first scene in the plurality of first scene models The model is an LOD model of a scene object; load the target flow level to which the target level is to be switched, wherein the target flow level contains multiple second scene models, and each of the multiple second scene models The second scene model is a scene model obtained by merging some of the multiple first scene models; in the process of switching to the target flow level, the multiple first scene models are controlled to pass the gradient The jitter transitions to the plurality of second scene models.
根据本发明的另一个方面,提供了一种模型切换装置,包括:显示单元,用于在目标客户端上显示目标关卡的多个第一场景模型,其中,所述多个第一场景模型中的每个第一场景模型为一个场景物体的多细节层次LOD模型;加载单元,用于加载所述目标关卡待切换到的目标流关卡,其中,所述目标流关卡中包含多个第二场景模型,所述多个第二场景模型中的每个第二场景模型为所述多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;控制单元,用于在向所述目标流关卡切换的过程中,控制所述多个第一场景模型通过渐变抖动过渡到所述多个第二场景模型。According to another aspect of the present invention, a model switching device is provided, comprising: a display unit for displaying a plurality of first scene models of a target level on a target client, wherein, among the plurality of first scene models Each first scene model is a multi-level of detail LOD model of a scene object; the loading unit is used to load the target flow level to which the target level is to be switched, wherein the target flow level contains a plurality of second scenes model, each second scene model in the plurality of second scene models is a scene model obtained by model merging of some scene models in the plurality of first scene models; the control unit is configured to send the In the process of switching the target flow level, the plurality of first scene models are controlled to transition to the plurality of second scene models through gradual dithering.
根据本发明的再一个方面,提供了一种计算机可读介质,其上存储有计算机程序/指令,所述计算机程序/指令被处理器执行时实现上述模型切换方法的步骤。According to yet another aspect of the present invention, a computer-readable medium is provided, on which computer programs/instructions are stored, and when the computer programs/instructions are executed by a processor, implement the steps of the above-mentioned model switching method.
根据本发明的又一个方面,提供了一种计算机装置/设备/系统,包括存储器、处理器及存储在存储器上的计算机程序/指令,所述处理器执行所述计算机程序/指令时实现上述模型切换方法的步骤。According to yet another aspect of the present invention, there is provided a computer apparatus/equipment/system, comprising a memory, a processor and a computer program/instruction stored on the memory, the processor implements the above model when executing the computer program/instruction The steps to switch the method.
根据本发明的又一个方面,提供了一种计算机程序产品,包括计算机程序/指令,所述计算机程序/指令被处理器执行时实现上述模型切换方法的步骤。According to yet another aspect of the present invention, a computer program product is provided, comprising a computer program/instruction, when the computer program/instruction is executed by a processor, the steps of the above-mentioned model switching method are implemented.
在本发明实施例中,采用模型合并、以及通过渐变抖动进行模型过渡的方式,通过在目标客户端上显示目标关卡的多个第一场景模型,其中,多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型;加载目标关卡待切换到的目标流关卡,其中,目标流关卡中包含多个第二场景模型,多个第二场景模型中的每个第二场景模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;在向目标流关卡切换的过程中,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型,由于将多个模型合并成一个模型,可以实现多对1(多个模型到一个模型)的过渡,减少模型渲染的提交次数,可以在尽量保证模型精度的情况下,节省CPU(Central Processing  Unit,中央处理器)和GPU(Graphics Processing Unit,图形处理器)的开销,采用渐变抖动的方式进行模型过渡,可以减弱模型差异,从而实现模型平滑过渡的目的,达到提高模型切换的平滑度、提升用户的视觉体验的技术效果,进而解决了相关技术中的模型切换方式存在由于视觉信息跳转导致的用户视觉体验差的问题。In the embodiment of the present invention, by adopting the mode of model merging and performing model transition through gradient jitter, a plurality of first scene models of the target level are displayed on the target client, wherein each of the plurality of first scene models The first scene model is an LOD model of a scene object; load the target flow level to which the target level is to be switched, wherein the target flow level contains multiple second scene models, and each second scene in the multiple second scene models The model is a scene model obtained by merging some of the multiple first scene models; in the process of switching to the target flow level, the multiple first scene models are controlled to transition to multiple second scene models through gradual dithering , because multiple models are merged into one model, the transition of many-to-one (multiple models to one model) can be realized, the number of submissions of model rendering can be reduced, and the CPU (Central Processing Unit) can be saved while ensuring the model accuracy as much as possible. , central processing unit) and GPU (Graphics Processing Unit, graphics processor) overhead, using gradient jitter for model transition, which can reduce model differences, so as to achieve the purpose of smooth transition of models, to improve the smoothness of model switching, improve The technical effect of the user's visual experience further solves the problem that the user's visual experience is poor due to the jump of visual information in the model switching method in the related art.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,本发明的上述及各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。在附图中:The above and various other advantages and benefits of the present invention will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. In the attached image:
图1是根据本申请实施例的一种可选的模型切换方法的硬件环境的示意图;1 is a schematic diagram of a hardware environment of an optional model switching method according to an embodiment of the present application;
图2是根据本申请实施例的一种可选的模型切换方法的流程示意图;2 is a schematic flowchart of an optional model switching method according to an embodiment of the present application;
图3是根据本申请实施例的一种可选的模型切换方法的示意图;3 is a schematic diagram of an optional model switching method according to an embodiment of the present application;
图4是根据本申请实施例的另一种可选的模型切换方法的流程示意图;4 is a schematic flowchart of another optional model switching method according to an embodiment of the present application;
图5是根据本申请实施例的一种可选的模型切换装置的结构框图;5 is a structural block diagram of an optional model switching apparatus according to an embodiment of the present application;
图6是根据本申请实施例的一种可选的电子设备的结构框图;6 is a structural block diagram of an optional electronic device according to an embodiment of the present application;
图7是根据本申请实施例的一种计算机装置/设备/系统的示意图;7 is a schematic diagram of a computer apparatus/equipment/system according to an embodiment of the present application;
图8是根据本申请实施例的一种计算机程序产品的框图。FIG. 8 is a block diagram of a computer program product according to an embodiment of the present application.
具体实施方式Detailed ways
下面结合附图和具体的实施方式对本发明作进一步的描述。以下描述仅为说明本发明的基本原理而并非对其进行限制。The present invention will be further described below with reference to the accompanying drawings and specific embodiments. The following description is merely illustrative of the basic principles of the present invention and is not intended to limit it.
首先,在对本申请实施例进行描述的过程中出现的部分名词或者术语适用于如下解释:First of all, some nouns or terms that appear in the process of describing the embodiments of the present application are suitable for the following explanations:
(1)UE4(Unreal Engine 4,虚幻引擎4):是一款由Epic Games公司开发的开源游戏引擎;(1) UE4 (Unreal Engine 4, Unreal Engine 4): is an open source game engine developed by Epic Games;
(2)Streaming Level(流关卡):在游戏时异步加载和卸载关卡,降低内存使用率,创建无缝的世界场景;(2) Streaming Level: Load and unload levels asynchronously while gaming, reducing memory usage and creating a seamless world scene;
(3)HLOD(Hierarchical LOD,分层细节级别):通过合并模型、 材质、贴图来减少新模型的内存,并且提升渲染效率;(3) HLOD (Hierarchical LOD, Hierarchical Level of Detail): Reduce the memory of the new model by merging models, materials, and textures, and improve rendering efficiency;
(4)StreamingLevelLOD:流式加载LOD的方案,通过预烘焙整个地图的模型合并模型材质贴图,加载好新的模型后会卸载原有模型。(4) StreamingLevelLOD: The solution of streaming LOD is to merge the model material texture by pre-baking the model of the entire map. After the new model is loaded, the original model will be unloaded.
根据本申请实施例的一个方面,提供了一种模型切换方法。可选地,在本实施例中,上述模型切换方法可以应用于如图1所示的由终端102和服务器104所构成的硬件环境中。如图1所示,服务器104通过网络与终端102进行连接,可用于为终端或终端上安装的客户端(例如,游戏客户端)提供服务(如游戏服务、应用服务等),可在服务器上或独立于服务器设置数据库,用于为服务器104提供数据存储服务。According to an aspect of the embodiments of the present application, a model switching method is provided. Optionally, in this embodiment, the above-mentioned model switching method may be applied to the hardware environment formed by the terminal 102 and the server 104 as shown in FIG. 1 . As shown in FIG. 1 , the server 104 is connected to the terminal 102 through 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. Alternatively, a database may be provided independently of the server for providing data storage services for the server 104 .
上述网络包括但不限于:有线网络,无线网络,上述有线网络可以包括但不限于:广域网、城域网或局域网。终端102并不限定于PC(Personal Computer,个人计算机)、手机、平板电脑等。The above-mentioned network includes but is not limited to: wired network, wireless network, and the above-mentioned 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 a PC (Personal Computer, personal computer), a mobile phone, a tablet computer, or the like.
本申请实施例的模型切换方法可以由终端102来执行,也可以由服务器104来执行,还可以是由终端102和服务器104共同执行。其中,终端102执行本申请实施例的模型切换方法也可以是由安装在其上的客户端(例如,目标游戏的客户端)来执行。The model switching method in this embodiment of the present application may be executed by the terminal 102 , may also be executed by the server 104 , or may be executed jointly by the terminal 102 and the server 104 . Wherein, when the terminal 102 executes the model switching method of the embodiment of the present application, it may also be executed by a client installed on the terminal (for example, a client of the target game).
以由终端102来执行本实施例中的模型切换方法为例,图2是根据本申请实施例的一种可选的模型切换方法的流程示意图,如图2所示,该方法的流程可以包括以下步骤:Taking the terminal 102 to perform the model switching method in this embodiment as an example, FIG. 2 is a schematic flowchart of an optional model switching method according to an embodiment of the present application. As shown in FIG. 2 , the process of the method may include: The following steps:
步骤S202,在目标客户端上显示目标关卡的多个第一场景模型,其中,多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型。Step S202, displaying multiple first scene models of the target level on the target client, wherein each first scene model in the multiple first scene models is an LOD model of a scene object.
本实施例中的模型切换方法可以应用于由多个关卡拼接而成的游戏场景(目标游戏场景,例如,大世界),该游戏场景可以是目标游戏的游戏场景(例如,三维游戏场景)。The model switching method in this embodiment can be applied to a game scene (target game scene, such as a big world) spliced by multiple levels, and the game scene can be a game scene of the target game (eg, a three-dimensional game scene).
目标游戏可以是单人游戏,也可以是多人游戏(例如,开放式大世界游戏);可以是对战游戏,也可以是非对战游戏(例如,经营类游戏);可以是端游,也可以是手游,本实施例中对于目标游戏的游戏类型不作限定。The target game can be a single-player game or a multi-player game (for example, an open world game); it can be a battle game or a non-combat game (such as a management game); it can be a client game or a For mobile games, the game type of the target game is not limited in this embodiment.
例如,目标游戏可以是MMORPG(Massive或Massively Multiplayer Online Role-Playing Game,大型多人在线角色扮演游戏),或者,AR (Augmented Reality,增强现实)游戏,或者,VR(Virtual Reality,虚拟现实)游戏,或者其他类型的游戏。For example, the target game can be an MMORPG (Massive or Massively Multiplayer Online Role-Playing Game), or an AR (Augmented Reality, augmented reality) game, or a VR (Virtual Reality, virtual reality) game , or other types of games.
目标用户(目标玩家)的终端设备上可以运行有目标游戏应用的目标客户端。该目标客户端可以与服务器进行通信连接,上述服务器为目标游戏的后台服务器。目标用户可以使用帐号和密码、动态密码、关联应用(第三方应用)登录等方式登录到其终端设备上运行的目标客户端,并通过操作目标客户端进入到目标游戏场景(目标游戏地图,例如,大世界)。The terminal device of the target user (target player) may run the target client with the target game application. The target client can communicate with the server, and the above server is the background server of the target game. The target user can log in to the target client running on his terminal device by using the account and password, dynamic password, associated application (third-party application) login, etc., and enter the target game scene (target game map, for example) by operating the target client. , the big world).
以大世界为例,一个大世界是由许多关卡拼接而成,不同的关卡上面有高低起伏的山脉,河流,建筑物,一个关卡的尺寸可以根据需要进行配置,例如,可以是128×128米的正方形(地块),一个正方形挨着另一个,一个大世界可以由许许多多这样的正方形拼接而成。Take the big world as an example. A big world is made up of many levels. There are undulating mountains, rivers, and buildings on different levels. The size of a level can be configured as needed, for example, it can be 128×128 meters. of squares (plots), one square next to another, a large world can be made up of many such squares.
在目标游戏场景中,目标用户通过目标客户端所控制的虚拟角色为目标虚拟角色。目标游戏场景中可以包含有多个关卡,目标客户端上当前显示的关卡中可以包括目标关卡。对于目标关卡,在目标虚拟角色与目标关卡的距离较近时,可以在目标关卡上显示多个第一场景模型,每个第一场景模型对应于目标关卡中的第一个场景物体,是该物体的LOD模型(例如,多级LOD模型)。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 contain multiple levels, and the levels 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 can be displayed on the target level, and each first scene model corresponds to the first scene object in the target level, which is the The LOD model of the object (eg, a multi-level LOD model).
需要说明的是,目标关卡与目标虚拟角色的距离可以是:关卡与人物(例如,目标虚拟角色)之间的距离不是关卡内某一物体和人物之间的距离,而是关卡的地块中心点与人物之间的距离。It should be noted that the distance between the target level and the target avatar may be: the distance between the level and the character (for example, the target avatar) is not the distance between an object in the level and the character, but the center of the plot of the level The distance between the point and the person.
每个第一场景模型所对应的场景物件可以是不同的,不同的第一场景模型对应于场景物件的类型可以是相同的,也可以是不同的。场景物件可以包括但不限于以下至少之一:建筑,树木,草地。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. Scene objects may include, but are not limited to, at least one of the following: buildings, trees, and grass.
例如,目标关卡中包含3个物件,当前显示的目标关卡上可以显示每个物件的LOD模型。For example, the target level contains 3 objects, and the LOD model of each object can be displayed on the currently displayed target level.
按照模型面数和细节数,同一物件的不同级LOD模型可以对应于不同的精度,面数和细节数越多,精度越高。根据物体模型的节点在场景所处的位置和重要度,目标客户端可以决定物体渲染的资源分配,也就是,渲染哪一级的LOD模型。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 position and importance of the node of the object model in the scene, the target client can decide the resource allocation for object rendering, that is, which level of LOD model to render.
步骤S204,加载目标关卡待切换到的目标流关卡,其中,目标流关卡中包含多个第二场景模型,多个第二场景模型中的每个第二场景 模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型。Step S204, load the target flow level to which the target level is to be switched, wherein the target flow level contains multiple second scene models, and each second scene model in the multiple second scene models is one of the multiple first scene models. The scene model obtained by model merging of part of the scene model.
由于每个模型都有自己的多级LOD,如果在场景中的场景模型采用多级LOD模型,当场景模型数量过多时,每个模型都有自己的不同LOD的简模和应对的贴图材质,需要单独渲染(渲染一个模型叫一个批次,如果场景中有1000个不同的模型,那么,就需要渲染1000个批次,都要按着一定的顺序依次单独渲染),无法保证效率,也无法减少内存占用。Since each model has its own multi-level LOD, if the scene model in the scene adopts the multi-level LOD model, when the number of scene models is too large, each model has its own simple model of different LODs and corresponding texture materials. It 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), which cannot guarantee the efficiency and cannot Reduce memory usage.
在目标关卡距离目标人物(目标虚拟角色)较远时(例如,超过设定的距离阈值),其上的景色没有必要使用高精度的模型,为了保证渲染效率,减少内容占用,可以将其替换为低精度模型,而不会太影响整体效果。When the target level is far away from the target character (target virtual character) (for example, exceeding the set distance threshold), it is not necessary to use a high-precision model for the scenery on it. In order to ensure rendering efficiency and reduce content occupancy, it can be replaced It is a low-precision model without affecting the overall effect too much.
在本实施例中,目标游戏场景中的各个关卡(具有目标尺寸的地块)可以采用流式加载的方案进行加载,从而可以实现高精度模型向低精度模型切换。对于各个关卡,可以为其预先烘焙好一个或多个流关卡,即,StreamingLevelLOD(LOD流送关卡)。LOD流送关卡(流关卡)类似于网格体LOD,可以根据流送距离设置,关卡可以替换为相应的流关卡。In this embodiment, each level in the target game scene (plots with the target size) can be loaded using a streaming loading scheme, so that switching from a high-precision model to a low-precision model can be realized. For each level, one or more streaming levels can be pre-baked for it, that is, StreamingLevelLOD (LOD streaming level). LOD streaming levels (streaming levels) are similar to mesh LODs, can be set according to the streaming distance, and levels can be replaced with corresponding streaming levels.
流关卡(Streaming Level)是指:在游戏时异步加载和卸载关卡,可以降低内存使用率,创建无缝的世界场景。StreamingLevelLOD是指:通过预烘焙整个地图的模型合并模型材质贴图,并且加载好新的模型后会卸载原有模型。Streaming Level refers to loading and unloading levels asynchronously during gameplay, which reduces memory usage and creates a seamless world scene. StreamingLevelLOD means: merge the model material texture by pre-baking the model of the entire map, and unload the original model after loading the new model.
在进行模型切换过渡时,由于关卡中的多个LOD模型的数据一般会放在同一个mesh(网格)里,因此,一般只能实现单个模型的LOD Dither过渡(即,1对1的过渡)。如果把多个模型烘焙到一起,例如,HLOD,不同的LOD数据放在了不同的mesh中,引擎无法执行多对1的过渡。When performing a model switching transition, since the data of multiple LOD models in the level are generally placed in the same mesh (mesh), generally only the LOD Dither transition of a single model can be implemented (that is, a 1-to-1 transition). ). If multiple models are baked together, e.g. HLOD, with different LOD data in different meshes, the engine cannot perform many-to-one transitions.
为了实现多对1的过渡,从而提高模型切换方式的适用性,在流关卡烘焙时,可以将关卡中的场景模型划分成多个不同的部分,不同部分的场景模型可以场景不同的方式进行模型合并,分别烘焙成一个场景模型。In order to achieve a many-to-one transition and improve the applicability of the model switching method, when the stream level is baked, the scene model in the level can be divided into multiple different parts, and the scene models of different parts can be modeled in different ways. Merge, bake separately into a scene model.
在烘焙各个场景模型之后,烘焙好的模型可以组成流光卡,或者, 结合其他信息组成流关卡。烘焙好的流关卡可以保存在服务器中或者其他存储设备中,从而在游戏运行时可以被加载到运行目标游戏的客户端(例如,目标客户端)中。After baking each scene model, the baked model can be composed of a streamer card, or combined with other information to form a streamer level. The baked streaming level can be saved in the server or other storage device, so that it can be loaded into the client (eg, the target client) running the target game when the game is running.
需要说明的是,烘焙模型只是烘焙模型本身,并不记录模型的光影信息,光照是在渲染时通过材质实时计算的。对于模型烘焙,储存模型的网格数据是一方面,还可以包括:存储贴图数据,例如,有的模型渲染需要多张基础颜色贴图混合,那么可以直接计算出混合后的贴图。示例性地,对模型烘焙可以包括:获取模型的网格信息、材质和贴图等。It should be noted that the baked 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, if some model rendering requires multiple basic color maps to be mixed, the mixed texture can be calculated directly. Exemplarily, baking the model may include: acquiring mesh information, materials, textures, and the like of the model.
需要说明的是,流关卡的烘焙过程需要大量计算,为了提高游戏运行的流畅性,可以通过服务器预先进行场景或者流关卡烘焙。相对于目标游戏的运行过程而言,场景的烘焙过程可以作为离线准备过程,而不是在目标游戏运行时执行的。It should be noted that the baking process of streaming levels requires a lot of calculations. In order to improve the smoothness of game running, you can pre-bake scenes or streaming levels through the server. Relative to the running process of the target game, the baking process of the scene can be used as an offline preparation process, rather than being executed when the target game is running.
在目标虚拟角色与目标关卡的距离较远时,或者在其他关卡切换条件满足时,目标客户端可以确定将目标关卡切换到目标流关卡。目标客户端可以与服务器进行交互,从而加载目标流关卡,或者,直接加载本地保存的目标流关卡。When the distance between the target virtual character and the target level is relatively far, or when other level switching conditions are satisfied, the target client can determine to switch the target level to the target flow level. The target client can interact with the server to load the target flow level, or directly load a locally saved target flow level.
目标流关卡中可以包含多个第二场景模型。多个第二场景模型中的每个第二场景模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型。按照对应的场景物件不同和场景物件的重要程度,可以采用相同或者不同的烘焙方式对多个第一场景模型中的各个部分场景模型进行烘焙,得到各第二场景模型。The target flow level can contain multiple second scene models. Each second scene model in the plurality of second scene models is a scene model obtained by model merging of some scene models in the plurality of first scene models. According to the difference of the corresponding scene objects and the importance of the scene objects, each partial scene model in the plurality of first scene models may be baked by using the same or different baking methods to obtain each second scene model.
例如,目标关卡上显示的场景物体的数量为10个。在目标流关卡烘焙时,可以将4个场景物件进行模型合并,将其烘焙成目标流关卡中的一个场景模型,将3个场景物件进行模型合并,将其烘焙成目标流关卡中的一个场景模型,将剩余的3个场景物件进行模型合并,将其烘焙成目标流关卡中的一个场景模型。烘焙完成之后,得到的场景模型的数量为3个。For example, the number of scene objects displayed on the target level is 10. When baking the target flow level, you can merge the models of 4 scene objects, bake them into a scene model in the target flow level, merge the models of 3 scene objects, and bake them into a scene in the target flow level Model, merge the remaining 3 scene objects, and bake them into a scene model in the target flow level. After the baking is completed, the number of obtained scene models is 3.
步骤S206,在向目标流关卡切换的过程中,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型。Step S206 , in the process of switching to the target flow level, control the plurality of first scene models to transition to the plurality of second scene models through gradual dithering.
在目标流关卡加载完成之后,可以进行关卡切换,将目标关卡上显示的场景模型由多个第一场景模型切换到多个第二场景模型。After the loading of the target flow level is completed, the level switching can be performed, and the scene models displayed on the target level are switched from multiple first scene models to multiple second scene models.
为了避免模型切换时存在的视觉信息变化过大,可以采用渐变抖动的方式进行不同模型之间的过渡。对于目标关卡,目标客户端可以控制目标关卡上的LOD模型采用Dither(抖动,例如,渐变抖动)的方式过渡到目标流关卡中对应的模型。In order to prevent the visual information from changing too much when the model is switched, the transition between different models can be performed by means of gradient jitter. For the target level, the target client can control the LOD model on the target level to transition to the corresponding model in the target flow level by means of Dither (jitter, for example, gradient dithering).
需要说明的是,渐变抖动是指:同时渲染两个模型,一个渲染的像素越来越多,另一个渲染的像素越来越少,从而进行切换过渡,上述渐变抖动可以为LOD Dither。抖动(即抖色,混色)是像素的抖动,指像素增多、减少的过程。It should be noted that gradient dithering refers to: rendering two models at the same time, one renders more and more pixels, and the other renders less and less pixels, so as to switch transitions. The above gradient dithering can be LOD Dither. Dithering (ie, color dithering, color mixing) is the dithering of pixels, which refers to the process of increasing and decreasing pixels.
在模型切换时,切换前后的模型精度是不同的,颜色上也会有差别。由于渐变抖动包含了颜色的渐变以及模型精度的变化,通过渐变抖动,可以让两者都做一个渐变,使得整个Level上全部物体可以柔和的从一个模型精度过渡到另一个模型精度(例如,从高配模型过渡到低配模型),而不让用户感受到画面突然变化的视觉感受。When the model is switched, the accuracy of the model before and after the switch is different, and the color will also be different. Since the gradient dithering includes the gradient of the color and the change of the model precision, through the gradient dithering, both of them can be made a gradient, so that all the objects on the entire Level can smoothly transition from one model precision to another model precision (for example, from The high-end model transitions to the low-end model) without letting users feel the visual experience of sudden changes in the picture.
例如,如图3所示,图3中的桶开启了Dither(LOD抖动,抖动的一种示例),在其由一个颜色(例如,绿色)过渡到另一个颜色(例如,黄色)时,并不是一下子由(a)过渡到(c),而是有颜色融合的渐变过程(b),这样的过渡更加自然。For example, as shown in Figure 3, the bucket in Figure 3 has Dither (LOD dithering, an example of dithering) turned on as it transitions from one color (eg, green) to another (eg, yellow), and Instead of transitioning from (a) to (c) all at once, there is a gradient process (b) of color fusion, which is more natural.
可选地,在本实施例中,为了标识一起过渡的第一场景模型,可以在模型材质增加目标材质属性(例如,StreamingLevelDitherLOD),当该属性激活时,使用该模型材质的场景模型会开启渐变抖动(例如,StreamingDitherLOD)的效果。Optionally, in this embodiment, in order to identify the first scene model that transitions together, a target material attribute (for example, StreamingLevelDitherLOD) may be added to the model material. When this attribute is activated, the scene model using the model material will enable gradients. The effect of dithering (eg StreamingDitherLOD).
需要说明的是,本实施例中以终端设备单独执行流关卡切换为例进行说明,对于服务器和客户端共同执行、或者由服务器单独执行目标游戏中的数据计算(客户端仅显示服务器同步来的数据)的方式,本实施例中的模型切换方法同样适用。It should be noted that, in this embodiment, the terminal device alone performs flow level switching as an example for illustration. For the server and the client to jointly perform, or the server to perform the data calculation in the target game alone (the client only displays the data synchronized by the server). data), the model switching method in this embodiment is also applicable.
通过上述步骤S202至步骤S206,在目标客户端上显示目标关卡的多个第一场景模型,其中,多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型;加载目标关卡待切换到的目标流关卡,其中,目标流关卡中包含多个第二场景模型,多个第二场景模型中的每个第二场景模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;在向目标流关卡切换的过程中,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型,解决了相关技术中 的模型切换方式存在由于视觉信息跳转导致的用户视觉体验差的问题,提高了模型切换的平滑度、提升了用户的视觉体验。Through the above steps S202 to S206, multiple first scene models of the target level are displayed on the target client, wherein each first scene model in the multiple first scene models is an LOD model of a scene object; load the target The target flow level to which the level is to be switched, wherein the target flow level contains a plurality of second scene models, and each second scene model in the plurality of second scene models is performed for a part of the scene models in the plurality of first scene models. The scene model obtained by model merging; in the process of switching to the target flow level, controlling multiple first scene models to transition to multiple second scene models through gradient jitter, which solves the problem of model switching in the related art due to visual information. The problem of poor user visual experience caused by jumping improves the smoothness of model switching and the user's visual experience.
作为一种可选的实施例,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型包括:As an optional embodiment, controlling a plurality of first scene models to transition to a plurality of second scene models through gradual dithering includes:
S11,在向目标流关卡切换的过渡时间内,调整与目标关卡对应的抖动参数,将调整的抖动参数传入到渲染参数中;S11, in the transition time of switching to the target stream level, adjust the jitter parameter corresponding to the target level, and pass the adjusted jitter parameter into the rendering parameter;
S12,按照渲染参数同时渲染多个第一场景模型和多个第二场景模型,以控制多个第一场景模型渲染的像素点逐渐减少,多个第二场景模型渲染的像素点逐渐增加。S12: Render multiple first scene models and multiple second scene models simultaneously according to the rendering parameters, so as to control the pixels rendered by the multiple first scene models to gradually decrease, and the pixels rendered by the multiple second scene models to gradually increase.
在实时渲染时,在异步加载好LOD关卡(目标流关卡)之后,目标客户端可以在流关卡的过渡时间内,实时调整与目标关卡对应的抖动参数,并将抖动参数作为参数传入每帧的渲染参数中,从而可以使用该渲染参数同时渲染多个第一场景模型和多个第二场景模型。In real-time rendering, after asynchronously loading the LOD level (target stream level), the target client can adjust the jitter parameters corresponding to the target level in real time during the transition time of the stream level, and pass the jitter parameters as parameters to each frame In the rendering parameter of the , the rendering parameters can be used to render multiple first scene models and multiple second scene models at the same time.
抖动参数(DitherFactor)可以与过渡时间关联,可以用于描述如何同时渲染不同的模型。抖动参数可以根据过渡时间进行调整,也就是,在过渡时间内的不同时间点,抖动参数可以存在区别,以便控制多个第一场景模型渲染的像素点逐渐减少,多个第二场景模型渲染的像素点逐渐增加DitherFactor can be associated with transition time and can be used to describe how to render different models at the same time. The jitter parameters can be adjusted according to the transition time, that is, at different time points in the transition time, the jitter parameters can be different, so as to control the pixels rendered by multiple first scene models to gradually decrease, and the pixels rendered by multiple second scene models. Pixels gradually increase
例如,在异步加载好LOD关卡之后,目标客户端可以通过时间过渡调整设置整个关卡的DitherFactor(抖动参数),将两个关卡(目标关卡和目标流关卡)所有的物体(多个第一场景模型和多个第二场景模型)通过动态渲染的方法同时渲染,并将DitherFactor作为参数在渲染每帧时传入所有物体的shader参数(渲染参数)里。For example, after the LOD level is loaded asynchronously, the target client can adjust the DitherFactor (jitter parameter) of the entire level through time transition, and combine all objects (multiple first scene models) of the two levels (target level and target flow level). and multiple second scene models) are rendered at the same time by the dynamic rendering method, and the DitherFactor is passed as a parameter to the shader parameters (rendering parameters) of all objects when rendering each frame.
通过本实施例,通过将DitherFactor作为参数每帧传入所有物体的渲染参数里,并同时渲染两个关卡内的所有物体,可以保证模型渲染的准确性,提高流关卡过渡的流畅性。Through this embodiment, by passing DitherFactor as a parameter into the rendering parameters of all objects in each frame, and rendering all objects in two levels at the same time, the accuracy of model rendering can be ensured, and the smoothness of flow level transition can be improved.
作为一种可选的实施例,在按照渲染参数同时渲染多个第一场景模型和多个第二场景模型之前,上述方法还包括:As an optional embodiment, before rendering the multiple first scene models and the multiple second scene models simultaneously according to the rendering parameters, the above method further includes:
S21,获取多个第一场景模型的第一深度图信息和多个第二场景模型的第二深度图信息;S21, acquiring first depth map information of multiple first scene models and second depth map information of multiple second scene models;
S22,按照第一深度图信息过滤多个第一场景模型中处于目标深度范围以外的物体像素,得到多个第一目标模型;S22, filtering object pixels outside the target depth range in the plurality of first scene models according to the first depth map information to obtain a plurality of first target models;
S23,按照第二深度图信息过滤多个第二场景模型中处于目标深度范围以外的物体像素,得到多个第二目标模型;S23, filtering the object pixels outside the target depth range in the plurality of second scene models according to the second depth map information to obtain a plurality of second target models;
其中,多个第一目标模型和多个第二目标模型为待渲染的物体模型。The multiple first target models and the multiple second target models are object models to be rendered.
为了在如移动终端平台(例如,手机平台)等目标平台上节省效率,可以采用stencil(模板)的方式过滤不同模型的像素,例如,可以在渲染时通过深度图信息过滤掉不需要渲染的物体像素。In order to save efficiency on target platforms such as mobile terminal platforms (eg, mobile phone platforms), stencils can be used to filter pixels of different models. For example, objects that do not need to be rendered can be filtered out through depth map information during rendering. pixel.
对于多个第一场景模型,目标客户端可以获取多个第一场景模型的第一深度图信息。对于一个第一场景模型,第一深度图信息可以用于表示该第一场景模型对应的贴图中的各个像素点的深度。For multiple first scene models, the target client may acquire first depth map information of the multiple first scene models. For a first scene model, the first depth map information may be used to represent the depth of each pixel in the texture corresponding to the first scene model.
按照第一深度图信息,目标客户端可以过滤多个第一场景模型中处于目标深度范围以外的物体像素,这些物体像素是不需要渲染的物体像素,从而可以得到多个第一目标模型,得到的多个第一目标模型是待渲染的物体模型。According to the first depth map information, the target client can filter the object pixels in the multiple first scene models that are outside the target depth range. These object pixels are object pixels that do not need to be rendered, so that multiple first target models can be obtained. The plurality of first target models are object models to be rendered.
对于多个第二场景模型,目标客户端可以获取第二初始模型的第二深度图信息。对于一个第二图场景模型,第二深度图信息可以用于表示该第二场景模型对应的贴图中的各个像素点的深度。For multiple second scene models, the target client may acquire second depth map information of the second initial model. For a second image scene model, the second depth map information may be used to represent the depth of each pixel in the texture corresponding to the second scene model.
按照第二深度图信息,目标客户端可以过滤多个第一场景模型中处于目标深度范围以外的物体像素,这些物体像素是不需要渲染的物体像素,从而可以得到多个第二目标模型,得到的多个第二目标模型是待渲染的物体模型。According to the second depth map information, the target client can filter the object pixels in the multiple first scene models that are outside the target depth range. These object pixels are object pixels that do not need to be rendered, so that multiple second target models can be obtained. The plurality of second target models are object models to be rendered.
通过本实施例,通过在渲染时通过深度图信息过滤掉不需要渲染的物体像素,可以节省渲染的资源消耗,提高模型渲染的效率。With this embodiment, by filtering out the object pixels that do not need to be rendered by using the depth map information during rendering, the resource consumption of rendering can be saved, and the efficiency of model rendering can be improved.
作为一种可选的实施例,按照渲染参数同时渲染多个第一场景模型和多个第二场景模型包括:As an optional embodiment, simultaneously rendering multiple first scene models and multiple second scene models according to rendering parameters includes:
S31,按照渲染参数,从多个第一目标模型和多个第二目标模型中选取出与各个像素点所对应的待渲染模型;S31, according to the rendering parameters, select a model to be rendered corresponding to each pixel point from a plurality of first target models and a plurality of second target models;
S32,在各个像素点上渲染为各个像素点选取的待渲染模型。S32, rendering the model to be rendered selected for each pixel point on each pixel point.
在渲染每个图像帧时,目标客户端可以按照当前的渲染参数(包括当前的抖动参数),从多个第一目标模型和多个第二目标模型中选取出与各个像素点所对应的待渲染模型。When rendering each image frame, the target client can select the to-be-received pixel corresponding to each pixel from the plurality of first target models and the plurality of second target models according to the current rendering parameters (including the current jitter parameters). Render the model.
在由多个第一场景模型向多个第二场景模型过渡的过渡时间内, 渲染参数会随着时间进行调整。在渲染不同的帧时,同一像素点所渲染的模型可以是不同的。During the transition time from the plurality of first scene models to the plurality of second scene models, the rendering parameters are adjusted over time. When rendering different frames, the model rendered by the same pixel can be different.
可选地,在进行渲染时,也可以混合不同模型在同一像素点上的颜色。通过调整抖动参数,可以调整各个像素点的混合方式。还可以采用其他的渐变抖动方式,实现模型过渡,本实施例中对此不作限定。Optionally, when rendering, the colors of different models on the same pixel can also be mixed. By adjusting the dither parameter, you can adjust the blending method of each pixel. Other gradient dithering methods may also be used to realize model transition, which is not limited in this embodiment.
通过本实施例,按照渲染参数确定各个像素点的渲染方式,可以提高模型过渡的流畅性。With this embodiment, the rendering mode of each pixel is determined according to the rendering parameters, which can improve the smoothness of the model transition.
作为一种可选的实施例,在加载目标关卡待切换到的目标流关卡之前,上述方法还包括:As an optional embodiment, before loading the target stream level to which the target level is to be switched, the above method further includes:
S41,检测到目标关卡与目标虚拟角色之间的距离由小于目标距离阈值转换为大于或者等于目标距离阈值,其中,目标虚拟角色为通过目标客户端所控制的虚拟角色。S41, it is detected that the distance between the target level and the target virtual character is converted from less than the 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.
如果关卡与目标人物(例如,目标虚拟角色)之间的距离超过设定的距离(目标距离阈值,该距离可配置),可以认为远处的景色(关卡上的景色)没有必要使用高精度的模型,此时,可以将高精度的模型替换为低精度的模型,而不会太影响整体显示效果。If the distance between the level and the target character (for example, the target avatar) exceeds the set distance (target distance threshold, the distance is configurable), it can be considered that the distant scenery (the scenery on the level) does not need to use high precision Model, at this time, the high-precision model can be replaced with a low-precision model without affecting the overall display effect too much.
例如,如果目标关卡与目标虚拟角色(目标人物)之间的距离超过目标距离阈值,可以认为目标关卡中的场景模型没有必要使用高精度的模型,从而触发执行关卡切换。For example, if the distance between the target level and the target virtual character (target character) 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.
目标客户端可以检测目标关卡与目标虚拟角色之间的距离,并在检测到目标关卡与目标虚拟角色之间的距离由小于目标距离阈值转换为大于或者等于目标距离阈值的情况下,确定需要执行关卡切换,将目标关卡切换到目标流关卡。上述检测操作可以是实时执行的,也可以是周期执行的,本实施例中对此不作限定。The target client can detect the distance between the target level and the target avatar, and when it detects that the distance between the target level and the target avatar is converted from less than the target distance threshold to greater than or equal to the target distance threshold, determine that it needs to be executed. Level switch, switch the target level to the target flow level. The foregoing detection operation may be performed in real time, or may be performed periodically, which is not limited in this embodiment.
需要说明的是,如果目标关卡与目标虚拟角色之间的距离由大于或者等于目标距离阈值转换为小于目标距离阈值,目标客户端可以将目标流关卡重新切换到目标关卡,切换的过程是上述过程的逆过程,本实施例中对此不作赘述。It should be noted that if the distance between the target level and the target virtual character is converted from greater than or equal to the target distance threshold to less than the target distance threshold, the target client can switch the target flow level to the target level again. The switching process is the above process. The reverse process is not repeated in this embodiment.
还需要说明的是,如果目标关卡与目标虚拟角色之间的距离进一步增大,可以再次进行流关卡切换,由目标流关卡切换到另一个流关卡,该流关卡上的场景模型的模型精度可以低于目标流关卡上的场景模型的模型精度。It should also be noted that if the distance between the target level and the target virtual character is further increased, the flow level switch can be performed again, and the target flow level is switched to another flow level. The model accuracy of the scene model on the flow level can be Lower model accuracy than the scene model on the target flow level.
通过本实施例,按照关卡与人物的距离控制进行流关卡的切换,可以提高流关卡切换的灵活性。Through this embodiment, the switching of the streaming level is controlled according to the distance between the level and the character, which can improve the flexibility of switching the streaming level.
作为一种可选的实施例,在加载目标关卡待切换到的目标流关卡之前,上述方法还包括:As an optional embodiment, before loading the target stream level to which the target level is to be switched, the above method further includes:
S51,将多个第二场景模型中的每个第二场景模型的模型材质配置为目标模型材质,其中,目标模型材质具有激活的目标材质属性,目标材质属性用于指示在流关卡切换时通过渐变抖动进行模型过渡。S51: Configure the model material of each second scene model in the plurality of second scene models as a target model material, where the target model material has an activated target material attribute, and the target material attribute is used to indicate that the Gradient jitter for model transitions.
在本实施例中,可以在模型材质中增加新的材质属性,即,目标材质属性(StreamingLevelDitherLOD的属性),当该属性激活时,使用该材质的模型会开启StreamingDitherLOD的效果。目标模型材质可以是激活了目标材质属性的模型材质。In this embodiment, a new material property, that is, a target material property (the property of StreamingLevelDitherLOD) can be added to the model material. When this property is activated, the model using this material will enable the effect of StreamingDitherLOD. The target model material can be a model material with the target material properties activated.
目标关卡上的多个第一场景模型可以是使用目标模型材质的场景模型,目标流关卡上的多个第二场景模型中的每个第二场景模型也可以是使用目标模型材质的场景模型。使用目标模型材质的场景模型开启了StreamingDitherLOD的效果,从而可以在流关卡切换时采用渐变抖动的方式进行模型过渡。The plurality of first scene models on the target level may be scene models using the material of the target model, and each of the plurality of second scene models on the target flow level may also be scene models using the material of the target model. The scene model using the material of the target model enables the effect of StreamingDitherLOD, so that the model transition can be performed by gradient jitter when switching between streaming levels.
可续地,在本实施例中,服务器可以将第二场景模型的模型材质配置为目标模型材质,目标模型材质是具有激活的目标材质属性的模型材质,目标材质属性可以用于指示在流关卡切换时采用渐变抖动进行LOD模型过渡。Continued, in this embodiment, the server may configure the model material of the second scene model as a target model material, the target model material is a model material with an activated target material attribute, and the target material attribute may be used to indicate that the flow level is in the flow level. When switching, gradient dithering is used for LOD model transition.
例如,对于切换后的流关卡中的所有物体,可以继承并开启上述StreamingLevelLODDither的材质。For example, for all objects in the switched streaming level, the material of the above StreamingLevelLODDither can be inherited and enabled.
通过本实施例,通过配置切换后的流关卡中的所有物体继承并开启StreamingLevelLODDither的材质,可以保证流关卡切换的流畅性。Through this embodiment, by configuring all objects in the switched streaming level to inherit and enable the material of StreamingLevelLODDither, the smoothness of the streaming level switching can be ensured.
在加载目标关卡待切换到的目标流关卡之前,可以由服务器对多个第一场景模型进行烘焙,得到目标流关卡。对于多个第一场景模型,按照不同的模型需求,可以采用不同的烘焙方式(例如,至少一种烘焙方式)进行模型烘焙。不同的烘焙方式可以是顺序(例如,指定顺序,又例如,模型位置在烘焙方向上的顺序)执行的,也可以是并行执行的,本实施例中对此不作限定。Before loading the target flow level to which the target level is to be switched, the server may bake a plurality of first scene models to obtain the target flow level. For the multiple first scene models, according to different model requirements, different baking methods (for example, at least one baking method) may be used to perform model baking. Different baking methods may be performed sequentially (for example, a specified order, or, for example, the order of model positions in the baking direction), or may be performed in parallel, which is not limited in this embodiment.
作为一种可选的实施方式,在加载目标关卡待切换到的目标流关卡之前,上述方法还包括:As an optional implementation manner, before loading the target stream level to which the target level is to be switched, the above method further includes:
S61,通过合并多个第一场景模型中的多个第一子场景模型的模型顶点、模型贴图和模型材质,将多个第一子场景模型烘焙成一个场景模型,得到多个第二场景模型的一个场景模型。S61, by merging the model vertices, model maps and model materials of the multiple first sub-scene models in the multiple first scene models, bake the multiple first sub-scene models into one scene model to obtain multiple second scene models a scene model.
多个第一场景模型中的多个第一子场景模型可以是目标关卡中的标志性物件,例如,标志性建筑,在进行关卡切换时需要着重渲染(需要提高模型精度)。The multiple first sub-scene models in the multiple first scene models may be iconic objects in the target level, for example, iconic buildings, which need to be rendered intensively (the model accuracy needs to be improved) during level switching.
对于多个第一子场景模型,服务器可以合并其模型顶点、模型贴图和模型材质(或者,至少合并模型贴图),将多个第一子场景模型烘焙成一个新的模型(新的资源),该新的模型可以是目标流关卡中的一个场景模型。For multiple first sub-scene models, the server can merge its model vertices, model textures and model materials (or, at least merge model textures), bake multiple first sub-scene models into a new model (new resource), The new model can be a scene model in the target flow level.
需要说明的是,采用上述合并模型、贴图和材质进行烘焙的模型可以是一组或者是多组模型,每组模型均可以采用上述方式进行烘焙。对应地,合并烘焙得到的场景模型的数量可以为一个或多个。It should be noted that the models to be baked by using the above-mentioned merged models, textures, and materials may be one group or multiple groups of models, and each group of models may be baked in the above-mentioned manner. Correspondingly, the number of scene models obtained by combining and baking may be one or more.
还需要说明的是,采用合并模型、贴图、材质进行烘焙,烘焙得到的场景模型不仅包含了模型表面的信息,也包含了模型内部的信息,其模型精度可以与最低精度的LOD模型的模型精度相当。It should also be noted that the combined model, texture, and material are used for baking. The baked scene model not only contains the information on the surface of the model, but also contains the information inside the model. The model accuracy can be compared with the model accuracy of the lowest-precision LOD model. quite.
作为另一种可选的实施方式,在加载目标关卡待切换到的目标流关卡之前,上述方法还包括:As another optional implementation manner, before loading the target stream level to which the target level is to be switched, the above method further includes:
S62,通过对多个第一场景模型中的多个第二子场景模型进行距离场采样,将多个第二子场景模型烘焙成一个场景模型,得到多个第二场景模型的一个场景模型。S62, by performing distance field sampling on the plurality of second sub-scene models in the plurality of first scene models, and baking the plurality of second sub-scene models into one scene model, to obtain a scene model of the plurality of second scene models.
多个第一场景模型中的多个第二子场景模型可以是目标关卡中的非标志性建筑,无需着重烘焙。对于多个第二子场景模型,服务器可以采用距离场采样算法进行烘焙。The plurality of second sub-scene models in the plurality of first scene models may be non-iconic buildings in the target level, and do not need to be heavily baked. For multiple second sub-scene models, the server may use a distance field sampling algorithm for baking.
需要说明的是,采用距离场采样算法进行烘焙,烘焙得到的场景模型仅包含了模型表面的信息(采样仅是对模型表面的采样),其模型精度低于最低精度的LOD模型的模型精度。It should be noted that the distance field sampling algorithm is used for baking, and the baked scene model only contains the information of the model surface (sampling is only the sampling of the model surface), and its model accuracy is lower than that of the lowest-precision LOD model.
作为又一种可选的实施方式,在加载目标关卡待切换到的目标流关卡之前,上述方法还包括:As another optional implementation manner, before loading the target stream level to which the target level is to be switched to, the above method further includes:
S63,按照目标采样精度对多个第一场景模型的多个第三子场景模型进行随机采样,得到多个待烘焙子模型,其中,多个第三子场景模型为相同的模型;S63, randomly sampling multiple third sub-scene models of the multiple first scene models according to the target sampling accuracy, to obtain multiple sub-models to be baked, wherein the multiple third sub-scene models are the same model;
S64,按照一个批次提交多个待烘焙子模型,将多个待烘焙子模型烘焙成一个场景模型,得到多个第二场景模型的一个场景模型,其中,按照一个批次提交的顶点数为一个第三子场景模型的顶点数。S64, submit multiple sub-models to be baked according to one batch, bake the multiple sub-models to be baked into one scene model, and obtain a scene model of multiple second scene models, wherein the number of vertices submitted according to one batch is: The number of vertices for a third subscene model.
多个第一场景模型中的多个第三子场景模型可以对应于大量的相同物体(例如,草地,树木)。如果目标关卡与目标虚拟角色之间的距离较远时,可以无需渲染所有的多个第三子场景模型。服务器可以按照目标采样精度对多个第三子场景模型进行随机采样,得到多个待烘焙子模型。The plurality of third sub-scene models in the plurality of first scene models may correspond to a large number of identical objects (eg, grass, trees). If the distance between the target level and the target avatar is long, it may not be necessary to render all the multiple third sub-scene models. The server may randomly sample multiple third sub-scene models according to the target sampling accuracy, to obtain multiple sub-models to be baked.
例如,一片草地有1000颗草,正常烘焙后还是1000颗草。为了渲染效率,可以在烘焙过程中,通过随机值仅烘焙其中的10%、或者50%的草,降低了烘焙后的草地和树林的密度。For example, a lawn with 1000 grasses will still be 1000 grasses after normal baking. For rendering efficiency, during the baking process, only 10% or 50% of the grass can be baked with random values, reducing the density of the baked grass and forest.
对于多个待烘焙子模型,服务器可以按照一个批次提交,按照一个批次提交的顶点数为一个第三子场景模型的顶点数,从而将多个待烘焙子模型烘焙成一个场景模型,得到的场景模型可以是目标流关卡中的一个场景模型。For multiple sub-models to be baked, the server can submit them in one batch, and the number of vertices submitted in one batch is the number of vertices of a third sub-scene model, so as to bake the multiple sub-models to be baked into one scene model, and obtain The scene model of can be a scene model in the target flow level.
例如,可以将树林、草等通过Instance(实例化)的方式烘焙进生成的Streaming Level中。Instance是通过一个批次,渲染大量的相同物体的方式。如果只把相同物体烘焙成一个模型,假如一个模型有100个顶点,一个instance里包含10个模型,那么,烘焙后的模型就有1000个顶点。如果烘焙成instance,同样还是提交一个批次,但是只需要提交100个顶点的数据。For example, trees, grass, etc. can be baked into the generated Streaming Level by Instance (instantiation). Instance is a way to render a large number of identical objects in a batch. If you only bake the same object into one model, if a model has 100 vertices and an instance contains 10 models, then the baked model has 1000 vertices. If baked into an instance, a batch is still submitted, but only the data of 100 vertices needs to be submitted.
通过本实施例,按照不同的模型需求采用不同的方式对场景模型进行烘焙,可以提高模型烘焙的灵活性,提升模型的渲染性能。With this embodiment, the scene model is baked in different ways according to different model requirements, which can improve the flexibility of model baking and improve the rendering performance of the model.
作为一种可选的实施例,在控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型之后,上述方法还包括:As an optional embodiment, after controlling the plurality of first scene models to transition to the plurality of second scene models through gradual dithering, the above method further includes:
S71,在目标流关卡中的全部物体模型均已显示的情况下,卸载目标关卡中的全部物体模型。S71 , when all the object models in the target flow level have been displayed, uninstall all the object models in the target level.
当切换流关卡时,在异步加载好LOD关卡(目标流关卡)之后,目标客户端可以先不卸载当前显示的关卡。当过渡时间结束,FadeIn的关卡物体(例如,目标流关卡上的场景物体)全部显示出来以后,将FadeOut的关卡物体(例如,目标关卡上的场景)全部卸载掉。When switching streaming levels, after the LOD level (target streaming level) is loaded asynchronously, the target client may not unload the currently displayed level first. When the transition time ends, after all the level objects of FadeIn (for example, the scene objects on the target flow level) are all displayed, unload all the level objects of FadeOut (for example, the scene on the target level).
可选地,在本实施例中,如果目标流关卡中的全部物体模型均已 显示出来,目标客户端可以卸载目标关卡中的全部物体模型。Optionally, in this embodiment, if all the object models in the target flow level have been displayed, the target client can unload all the object models in the target level.
通过本实施例,在FadeIn的关卡物体全部显示出来以后,将FadeOut的关卡物体全部卸载掉,可以减少模型的内存占用。Through this embodiment, after all the level objects of FadeIn are displayed, all level objects of FadeOut are unloaded, which can reduce the memory occupation of the model.
需要说明的是,在本实施例中,由服务器执行模型的烘焙过程、终端执行模型的渲染过程为例说明上述模型切换方法,对于其他的烘焙和渲染的执行方案,本实施例中的模型切换方法同样适用。It should be noted that, in this embodiment, the model switching method is described by taking the server execution model baking process and the terminal execution model rendering process as examples. For other baking and rendering execution schemes, the model switching method in this embodiment is The same method applies.
下面结合可选示例对本申请实施例中的模型切换方法进行解释说明。在本示例中,针对流式加载关卡的方式做LOD Dither(抖动的一种示例),保证切换LOD时,整个Level上的所有物体都可以柔和的从高配模型过渡到低配模型,而不让用户感受到画面是突然变化的。The model switching method in the embodiment of the present application is explained below with reference to optional examples. In this example, LOD Dither (an example of dithering) is done for the way of streaming level loading, to ensure that when switching LODs, all objects on the entire Level can smoothly transition from the high-end model to the low-end model without letting the The user feels that the screen changes suddenly.
如图4所示,本可选示例中的模型切换方法的流程可以包括以下步骤:As shown in Figure 4, the flow of the model switching method in this optional example may include the following steps:
步骤S402,烘焙关卡中的物体,继承开启StreamingLevelDitherLOD的材质。Step S402 , bake the objects in the level and inherit the material of the StreamingLevelDitherLOD enabled.
模型材质可以增加StreamingLevelDitherLOD的属性(目标材质属性),当该属性激活时,使用该材质的模型会开启StreamingDitherLOD的效果。可以通过StreamingLevelLOD烘焙整个关卡的物体,并继承开启StreamingLevelLODDither的材质,切换关卡时,所有开启了材质属性的物体都会有抖动效果。The model material can increase the attribute of StreamingLevelDitherLOD (target material attribute). When this attribute is activated, the model using this material will turn on the effect of StreamingDitherLOD. You can bake the objects of the entire level through StreamingLevelLOD, and inherit the material with StreamingLevelLODither turned on. When switching levels, all objects with material properties turned on will have a jitter effect.
步骤S404,在切换流关卡时,控制整个Level上的所有物体从高配模型过渡到低配模型。Step S404, when switching the flow level, control all objects on the entire Level to transition from the high-end model to the low-end model.
在实时渲染的过程中,当切换流关卡时,在异步加载好LOD关卡之后,客户端可以先不卸载当前显示的关卡,而是通过时间过渡调整设置整个关卡的DitherFactor,将两个关卡所有的物体通过动态渲染的方法同时渲染,并将DitherFactor作为参数每帧传入所有物体的shader参数里。可选地,在手机平台上,为了提高效率,可以采用stencil的方式过滤不同模型的像素。In the process of real-time rendering, when switching the streaming level, after the LOD level is loaded asynchronously, the client can first not unload the currently displayed level, but adjust the DitherFactor that sets the entire level through time transition, and transfer all the two levels Objects are rendered at the same time through the dynamic rendering method, and DitherFactor is passed as a parameter to the shader parameters of all objects every frame. Optionally, on the mobile phone platform, in order to improve efficiency, the pixels of different models can be filtered in a stencil manner.
当过渡时间结束,FadeIn的关卡物体全部显示出来以后,客户端可以将FadeOut的关卡物体全部卸载掉。When the transition time ends and all the level objects of FadeIn are displayed, the client can unload all level objects of FadeOut.
在进行流关卡切换时,整个地块的地形、地形上的房子、树木、草地等都在进行Dither的过渡。在初始的模型和最终的模型有色差和形变的情况下,经过Dither的过渡会表现的更柔和。When switching the flow level, the terrain of the entire plot, the houses, trees, grass, etc. on the terrain are all undergoing Dither transitions. In the case of chromatic aberration and deformation between the initial model and the final model, the transition through Dither will be softer.
需要说明的是,本可选示例中所提供的模型切换方法可以是HLOD(例如,合并模型、贴图和材质的方式)与Streaming LOD结合使用的方案,可以是StreamingLevelLOD Dither的多模型对单模型过渡的解决方案,是StreamingLevelLOD Dither的关卡对关卡过渡的解决方案,也是Streaming Level LOD Dither的Instance(实例)对Instance的过渡解决方案。It should be noted that the model switching method provided in this optional example can be a scheme of combining HLOD (for example, a method of merging models, textures and materials) and Streaming LOD, or a multi-model-to-single-model transition of StreamingLevelLOD Dither The solution is the level-to-level transition solution of Streaming Level LOD Dither, and the transition solution of Streaming Level LOD Dither's Instance (instance) to Instance.
通过本示例,可以保证切换LOD时,整个Level上的所有物体都可以柔和的从高配模型过渡到低配模型,使得场景过渡更加自然。Through this example, it can be guaranteed that when switching LODs, all objects on the entire Level can smoothly transition from the high-end model to the low-end model, making the scene transition more natural.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or concurrently. Secondly, those skilled in the art should also know 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.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM(Read-Only Memory,只读存储器)/RAM(Random Access Memory,随机存取存储器)、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, 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 can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that make contributions to the prior art. The computer software products are stored in a storage medium (such as ROM (Read-Only Memory, ROM). Read-only memory)/RAM (Random Access Memory), magnetic disk, optical disk), including several instructions to make a terminal device (which can be a mobile phone, computer, server, or network device, etc.) The methods described in the various examples are applied.
根据本申请实施例的又一个方面,提供了一种用于实施上述模型切换方法的模型切换装置。图5是根据本申请实施例的一种可选的模型切换装置的结构框图,如图5所示,该装置可以包括:According to yet another aspect of the embodiments of the present application, a model switching device for implementing the above model switching method is provided. FIG. 5 is a structural block diagram of an optional model switching apparatus according to an embodiment of the present application. As shown in FIG. 5 , the apparatus may include:
显示单元502,用于在目标客户端上显示目标关卡的多个第一场景模型,其中,多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型;A display unit 502, configured to display multiple first scene models of the target level on the target client, wherein each first scene model in the multiple first scene models is an LOD model of a scene object;
加载单元504,与显示单元502相连,用于加载目标关卡待切换到的目标流关卡,其中,目标流关卡中包含多个第二场景模型,多个第 二场景模型中的每个第二场景模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;The loading unit 504, connected with the display unit 502, is used for 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 second scene in the plurality of second scene models The model is a scene model obtained by merging some of the scene models in the plurality of first scene models;
控制单元506,与加载单元504相连,用于在向目标流关卡切换的过程中,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型。The control unit 506, which is connected to the loading unit 504, is configured to control a plurality of first scene models to transition to a plurality of second scene models through gradual dithering during the process of switching to the target flow level.
需要说明的是,该实施例中的显示单元502可以用于执行上述步骤S202,该实施例中的加载单元504可以用于执行上述步骤S204,该实施例中的控制单元506可以用于执行上述步骤S206。It should be noted that the display unit 502 in this embodiment can be used to execute the above step S202, the loading unit 504 in this embodiment can be used to execute the above step S204, and the control unit 506 in this embodiment can be used to execute the above step S204. Step S206.
通过上述模块,在目标客户端上显示目标关卡的多个第一场景模型,其中,多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型;加载目标关卡待切换到的目标流关卡,其中,目标流关卡中包含多个第二场景模型,多个第二场景模型中的每个第二场景模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;在向目标流关卡切换的过程中,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型,解决了相关技术中的模型切换方式存在由于视觉信息跳转导致的用户视觉体验差的问题,提高了模型切换的平滑度,提升了用户的视觉体验。Through the above modules, a plurality of first scene models of the target level are displayed on the target client, wherein each first scene model in the plurality of first scene models is an LOD model of a scene object; load the target level to be switched to The target flow level, wherein the target flow level contains a plurality of second scene models, and each second scene model in the plurality of second scene models is obtained by model merging of some scene models in the plurality of first scene models In the process of switching to the target flow level, multiple first scene models are controlled to transition to multiple second scene models through gradient jitter, which solves the problem of model switching in the related art caused by visual information jumping. The problem of poor user visual experience improves the smoothness of model switching and improves the user's visual experience.
作为一种可选的实施例,控制单元506包括:As an optional embodiment, the control unit 506 includes:
调整模块,用于在向目标流关卡切换的过渡时间内,调整与目标关卡对应的抖动参数,将调整的抖动参数传入到渲染参数中;The adjustment module is used to adjust the jitter parameters corresponding to the target level during the transition time of switching to the target stream level, and pass the adjusted jitter parameters into the rendering parameters;
渲染模块,用于按照渲染参数同时渲染多个第一场景模型和多个第二场景模型,以控制多个第一场景模型渲染的像素点逐渐减少,多个第二场景模型渲染的像素点逐渐增加。The rendering module is used to render multiple first scene models and multiple second scene models simultaneously according to the rendering parameters, so as to control the pixel points rendered by the multiple first scene models to gradually decrease, and the pixels rendered by the multiple second scene models to gradually decrease. Increase.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
获取单元,用于在按照渲染参数同时渲染多个第一场景模型和多个第二场景模型之前,获取多个第一场景模型的第一深度图信息和多个第二场景模型的第二深度图信息;an acquiring unit, configured to acquire first depth map information of multiple first scene models and second depths of multiple second scene models before simultaneously rendering multiple first scene models and multiple second scene models according to the rendering parameters map information;
第一过滤单元,用于按照第一深度图信息过滤多个第一场景模型中处于目标深度范围以外的物体像素,得到多个第一目标模型;a first filtering unit, configured to filter object pixels outside the target depth range in the plurality of first scene models according to the first depth map information to obtain a plurality of first target models;
第二过滤单元,用于按照第二深度图信息过滤多个第二场景模型中处于目标深度范围以外的物体像素,得到多个第二目标模型;a second filtering unit, configured to filter object pixels outside the target depth range in the plurality of second scene models according to the second depth map information to obtain a plurality of second target models;
其中,多个第一目标模型和多个第二目标模型为待渲染的物体模 型。Wherein, the plurality of first target models and the plurality of second target models are object models to be rendered.
作为一种可选的实施例,渲染模块包括:As an optional embodiment, the rendering module includes:
选取子模块,用于按照渲染参数,从多个第一目标模型和多个第二目标模型中选取出与各个像素点所对应的待渲染模型;The selection sub-module is used to select the to-be-rendered model corresponding to each pixel point from a plurality of first target models and a plurality of second target models according to the rendering parameters;
渲染子模块,用于在各个像素点上渲染为各个像素点选取的待渲染模型。The rendering submodule is used to render the model to be rendered selected for each pixel on each pixel.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
检测单元,用于在加载目标关卡待切换到的目标流关卡之前,检测到目标关卡与目标虚拟角色之间的距离由小于目标距离阈值转换为大于或者等于目标距离阈值,其中,目标虚拟角色为通过目标客户端所控制的虚拟角色。The detection unit is used to detect that the distance between the target level and the target virtual character is converted from less than the target distance threshold to greater than or equal to the target distance threshold before loading the target flow level to which the target level is to be switched, wherein the target virtual character is The virtual character controlled by the target client.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
配置单元,用于在加载目标关卡待切换到的目标流关卡之前,将多个第二场景模型中的每个第二场景模型的模型材质配置为目标模型材质,其中,目标模型材质具有激活的目标材质属性,目标材质属性用于指示在流关卡切换时通过渐变抖动进行模型过渡。The configuration unit is configured to configure the model material of each second scene model in the plurality of second scene models as the target model material before loading the target stream level to which the target level is to be switched, wherein the target model material has an activated The target material property, which is used to indicate the transition of the model by gradient jitter when the flow level is switched.
作为一种可选的实施例,上述装置还包括以下至少之一:As an optional embodiment, the above device also includes at least one of the following:
第一烘焙单元,用于在加载目标关卡待切换到的目标流关卡之前,通过合并多个第一场景模型中的多个第一子场景模型的模型顶点、模型贴图和模型材质,将多个第一子场景模型烘焙成一个场景模型,得到多个第二场景模型的一个场景模型;The first baking unit is used to merge the model vertices, model maps and model materials of the multiple first sub-scene models in the multiple first scene models before loading the target stream level to which the target level is to be switched, and combine the multiple first sub-scene models. The first sub-scene model is baked into a scene model to obtain a scene model of multiple second scene models;
第二烘焙单元,用于通过对多个第一场景模型中的多个第二子场景模型进行距离场采样,将多个第二子场景模型烘焙成一个场景模型,得到多个第二场景模型的一个场景模型;The second baking unit is configured to bake the plurality of second sub-scene models into one scene model by sampling the distance field of the plurality of second sub-scene models in the plurality of first scene models to obtain a plurality of second scene models a scene model of ;
采样单元,用于按照目标采样精度对多个第一场景模型的多个第三子场景模型进行随机采样,得到多个待烘焙子模型,其中,多个第三子场景模型为相同的模型;第三烘焙单元,用于按照一个批次提交多个待烘焙子模型,将多个待烘焙子模型烘焙成一个场景模型,得到多个第二场景模型的一个场景模型,其中,按照一个批次提交的顶点数为一个第三子场景模型的顶点数。a sampling unit, configured to randomly sample multiple third sub-scene models of the multiple first scene models according to the target sampling accuracy, to obtain multiple sub-models to be baked, wherein the multiple third sub-scene models are the same model; The third baking unit is configured to submit a plurality of sub-models to be baked in one batch, bake the sub-models to be baked into a scene model, and obtain a scene model of the plurality of second scene models, wherein according to a batch The number of vertices submitted is the number of vertices of a third subscene model.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
卸载单元,用于在控制多个第一场景模型通过渐变抖动过渡到多 个第二场景模型之后,在目标流关卡中的全部物体模型均已显示的情况下,卸载目标关卡中的全部物体模型。The unloading unit is used to unload all the object models in the target level under the condition that all the object models in the target flow level have been displayed after controlling the plurality of first scene models to transition to the plurality of second scene models through gradient jittering .
此处需要说明的是,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图1所示的硬件环境中,可以通过软件实现,也可以通过硬件实现,其中,硬件环境包括网络环境。It should be noted here that the examples and application scenarios implemented by the foregoing modules and corresponding steps are the same, but are not limited to the contents disclosed in the foregoing embodiments. It should be noted that, as a part of the device, the above modules may run in the hardware environment as shown in FIG. 1 , and may be implemented by software or hardware, wherein the hardware environment includes a network environment.
根据本申请实施例的又一个方面,还提供了一种用于实施上述模型切换方法的电子设备,该电子设备可以是服务器、终端、或者其组合。According to yet another aspect of the embodiments of the present application, an electronic device for implementing the above model switching method is also provided, where the electronic device may be a server, a terminal, or a combination thereof.
图6是根据本申请实施例的一种可选的电子设备的结构框图,如图6所示,包括处理器602、通信接口604、存储器606和通信总线608,其中,处理器602、通信接口604和存储器606通过通信总线608完成相互间的通信,其中,FIG. 6 is a structural block diagram of an optional electronic device according to an embodiment of the present application. As shown in FIG. 6 , it includes a processor 602, a communication interface 604, a memory 606, and a communication bus 608, wherein the processor 602, the communication interface 604 and the memory 606 communicate with each other through the communication bus 608, wherein,
存储器606,用于存储计算机程序; memory 606 for storing computer programs;
处理器602,用于执行存储器606上所存放的计算机程序时,实现如下步骤:When the processor 602 is used to execute the computer program stored in the memory 606, the following steps are implemented:
S1,在目标客户端上显示目标关卡的多个第一场景模型,其中,多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型;S1, displaying multiple first scene models of the target level on the target client, wherein each first scene model in the multiple first scene models is an LOD model of a scene object;
S2,加载目标关卡待切换到的目标流关卡,其中,目标流关卡中包含多个第二场景模型,多个第二场景模型中的每个第二场景模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;S2, load the target flow level to which the target level is to be switched, wherein the target flow level includes multiple second scene models, and each second scene model in the multiple second scene models is a second scene model in the multiple first scene models The scene model obtained by model merging of some scene models;
S3,在向目标流关卡切换的过程中,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型。S3, in the process of switching to the target flow level, controlling the plurality of first scene models to transition to the plurality of second scene models through gradual dithering.
可选地,在本实施例中,上述的通信总线可以是PCI(Peripheral Component Interconnect,外设部件互连标准)总线、或EISA(Extended Industry Standard Architecture,扩展工业标准结构)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图6中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Optionally, in this embodiment, the above-mentioned communication bus may be a PCI (Peripheral Component Interconnect, Peripheral Component Interconnect Standard) bus, or an EISA (Extended Industry Standard Architecture, Extended Industry Standard Architecture) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 6, but it does not mean that there is only one bus or one type of bus.
通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the above electronic device and other devices.
存储器可以包括RAM,也可以包括非易失性存储器(non-volatile memory),例如,至少一个磁盘存储器。可选地,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include RAM and may also include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
作为一种示例,上述存储器606可以但不限于包括上述模型切换装置中的显示单元502、加载单元504以及控制单元506。此外,还可以包括但不限于上述模型切换装置中的其他模块,本示例中不再赘述。As an example, the above-mentioned memory 606 may include, but is not limited to, the display unit 502 , the loading unit 504 and the control unit 506 in the above-mentioned model switching apparatus. In addition, it may also include but not limited to other modules in the above-mentioned model switching apparatus, which will not be repeated in this example.
上述处理器可以是通用处理器,可以包含但不限于:CPU、NP(Network Processor,网络处理器)等;还可以是DSP(Digital Signal Processing,数字信号处理器)、ASIC(Application Specific Integrated Circuit,专用集成电路)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor can be a general-purpose processor, which can include but is not limited to: CPU, NP (Network Processor, network processor), etc.; can also be DSP (Digital Signal Processing, digital signal processor), ASIC (Application Specific Integrated Circuit, Application-specific integrated circuits), FPGA (Field-Programmable Gate Array, Field Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, and details are not described herein again in this embodiment.
本领域普通技术人员可以理解,图6所示的结构仅为示意,实施上述模型切换方法的设备可以是终端设备,该终端设备可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图6其并不对上述电子设备的结构造成限定。例如,终端设备还可包括比图6中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图6所示的不同的配置。Those of ordinary skill in the art can understand that the structure shown in FIG. 6 is for illustration only, and the device implementing the above model switching method may be a terminal device, and the terminal device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a Handheld computers and terminal equipment such as Mobile Internet Devices (MID) and PAD. FIG. 6 does not limit the structure of the above electronic device. For example, the terminal device may also include more or less components than those shown in FIG. 6 (eg, a network interface, a display device, etc.), or have a different configuration than that shown in FIG. 6 .
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、ROM、RAM、磁盘或光盘等。Those 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, and the storage medium can Including: flash disk, ROM, RAM, magnetic disk or CD, etc.
根据本申请实施例的又一个方面,还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于执行本申请实施例中上述任一项模型切换方法的程序代码。According to yet another aspect of the embodiments of the present application, a storage medium is also provided. Optionally, in this embodiment, the above-mentioned storage medium may be used to execute the program code of any one of the above-mentioned model switching methods in the embodiments of this application.
可选地,在本实施例中,上述存储介质可以位于上述实施例所示的网络中的多个网络设备中的至少一个网络设备上。Optionally, in this embodiment, the foregoing storage medium may be located on at least one network device among multiple network devices in the network shown in the foregoing embodiment.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步 骤的程序代码:Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
S1,在目标客户端上显示目标关卡的多个第一场景模型,其中,多个第一场景模型中的每个第一场景模型为一个场景物体的LOD模型;S1, displaying multiple first scene models of the target level on the target client, wherein each first scene model in the multiple first scene models is an LOD model of a scene object;
S2,加载目标关卡待切换到的目标流关卡,其中,目标流关卡中包含多个第二场景模型,多个第二场景模型中的每个第二场景模型为多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;S2, load the target flow level to which the target level is to be switched, wherein the target flow level includes multiple second scene models, and each second scene model in the multiple second scene models is a second scene model in the multiple first scene models The scene model obtained by model merging of some scene models;
S3,在向目标流关卡切换的过程中,控制多个第一场景模型通过渐变抖动过渡到多个第二场景模型。S3, in the process of switching to the target flow level, controlling the plurality of first scene models to transition to the plurality of second scene models through gradual dithering.
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例中对此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, which will not be repeated in this embodiment.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、ROM、RAM、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to: U disk, ROM, RAM, removable hard disk, magnetic disk, or optical disk, and other mediums that can store program codes.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。If the integrated units in the above-mentioned embodiments are implemented in the form of software functional units and sold or used as independent products, they may be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a storage medium, Several instructions are included to cause 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.
在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned 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, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed client may be implemented in other manners. The apparatus embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of units or modules, and may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例中所提供的方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place or distributed to 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.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。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 alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
以上所述仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only the preferred embodiments of the present application. It should be pointed out that for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can also be made. It should be regarded as the protection scope of this application.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的模型切换装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置的程序/指令(例如,计算机程序/指令和计算机程序产品)。这样的实现本发明的程序/指令可以存储在计算机可读介质上,或者可以一个或者多个信号的形式存在,这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the model switching apparatus according to the embodiment of the present invention. The present invention can also be implemented as a program/instruction (eg, computer program/instruction and computer program product) for an apparatus or apparatus for performing some or all of the methods described herein. Such programs/instructions implementing the present invention may be stored on a computer readable medium, or may exist in the form of one or more signals, such signals may be downloaded from an Internet website, or provided on a carrier signal, or in any form Available in other formats.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology. Information may be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridges, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
图7示意性地示出了可以实现根据本发明的一种模型切换方法的计算机装置/设备/系统,该计算机装置/设备/系统包括处理器710和以存储器720形式的计算机可读介质。存储器720是计算机可读介质的一个示例,其具有用于存储计算机程序/指令731的存储空间730。当所述计算机程序/指令731由处理器710执行时,可实现上文所描述的一种模型切换方法中的各个步骤。FIG. 7 schematically shows a computer apparatus/device/system that can implement a model switching method according to the present invention, the computer apparatus/device/system including a processor 710 and a computer-readable medium in the form of a memory 720 . Memory 720 is an example of a computer-readable medium having storage space 730 for storing computer programs/instructions 731 . When the computer program/instructions 731 are executed by the processor 710, various steps in a model switching method described above can be implemented.
图8示意性地示出了实现根据本发明的方法的计算机程序产品的框图。所述计算机程序产品包括计算机程序/指令810,当所述计算机程序/指令810被诸如图7所示的处理器710之类的处理器执行时,可实现上文所描述的一种模型切换方法中的各个步骤。Figure 8 schematically shows a block diagram of a computer program product implementing the method according to the invention. The computer program product includes a computer program/instructions 810 that, when executed by a processor, such as the processor 710 shown in FIG. 7, can implement a model switching method described above in each step.
上文对本说明书特定实施例进行了描述,其与其它实施例一并涵盖于所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定遵循示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可行的或者有利的。Specific embodiments of this specification have been described above, and other embodiments are intended to be included within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily follow the specific order shown, or sequential order, to achieve desirable results. In certain embodiments, multitasking and parallel processing are also possible or advantageous.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device comprising a series of elements includes not only those elements, but also Other elements not expressly listed, or which are inherent to such a process, method, article of manufacture, or apparatus are also included. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article of manufacture, or device that includes the element.
应可理解,以上所述实施例仅为举例说明本发明之目的而并非对本发明进行限制。在不脱离本发明基本精神及特性的前提下,本领域技术人员还可以通过其他方式来实施本发明。本发明的范围当以后附的权利要求为准,凡在本说明书一个或多个实施例的精神和原则之内所做的任何修改、等同替换、改进等,皆应涵盖其中。It should be understood that the above-mentioned embodiments are only for the purpose of illustrating the present invention and not for limiting the present invention. Those skilled in the art can also implement the present invention in other ways without departing from the basic spirit and characteristics of the present invention. The scope of the present invention shall be determined by the appended claims, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be covered therein.

Claims (12)

  1. 一种模型切换方法,其特征在于,包括:A model switching method, comprising:
    在目标客户端上显示目标关卡的多个第一场景模型,其中,所述多个第一场景模型中的每个第一场景模型为一个场景物体的多细节层次LOD模型;Displaying a plurality of first scene models of the target level on the target client, wherein each first scene model in the plurality of first scene models is a multi-level of detail LOD model of a scene object;
    加载所述目标关卡待切换到的目标流关卡,其中,所述目标流关卡中包含多个第二场景模型,所述多个第二场景模型中的每个第二场景模型为所述多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;Load the target flow level to which the target level is to be switched, wherein the target flow level contains multiple second scene models, and each second scene model in the multiple second scene models is the multiple second scene models A scene model obtained by merging some of the scene models in the first scene model;
    在向所述目标流关卡切换的过程中,控制所述多个第一场景模型通过渐变抖动过渡到所述多个第二场景模型。In the process of switching to the target flow level, the plurality of first scene models are controlled to transition to the plurality of second scene models through gradual dithering.
  2. 根据权利要求1所述的方法,其特征在于,控制所述多个第一场景模型通过渐变抖动过渡到所述多个第二场景模型包括:The method according to claim 1, wherein controlling the plurality of first scene models to transition to the plurality of second scene models through gradual dithering comprises:
    在向所述目标流关卡切换的过渡时间内,调整与目标关卡对应的抖动参数,将调整的所述抖动参数传入到渲染参数中;During the transition time of switching to the target flow level, adjust the jitter parameter corresponding to the target level, and pass the adjusted jitter parameter into the rendering parameter;
    按照所述渲染参数同时渲染所述多个第一场景模型和所述多个第二场景模型,以控制所述多个第一场景模型渲染的像素点逐渐减少,所述多个第二场景模型渲染的像素点逐渐增加。The multiple first scene models and the multiple second scene models are simultaneously rendered according to the rendering parameters, so as to control the pixels rendered by the multiple first scene models to gradually decrease, and the multiple second scene models Rendered pixels gradually increase.
  3. 根据权利要求2所述的方法,其特征在于,在按照所述渲染参数同时渲染所述多个第一场景模型和所述多个第二场景模型之前,所述方法还包括:The method according to claim 2, wherein before rendering the plurality of first scene models and the plurality of second scene models simultaneously according to the rendering parameters, the method further comprises:
    获取所述多个第一场景模型的第一深度图信息和所述多个第二场景模型的第二深度图信息;acquiring first depth map information of the multiple first scene models and second depth map information of the multiple second scene models;
    按照所述第一深度图信息过滤所述多个第一场景模型中处于目标深度范围以外的物体像素,得到多个第一目标模型;Filter object pixels outside the target depth range in the plurality of first scene models according to the first depth map information to obtain a plurality of first target models;
    按照所述第二深度图信息过滤所述多个第二场景模型中处于所述目标深度范围以外的物体像素,得到多个第二目标模型;Filter object pixels outside the target depth range in the plurality of second scene models according to the second depth map information to obtain a plurality of second target models;
    其中,所述多个第一目标模型和所述多个第二目标模型为待渲染的物体模型。Wherein, the plurality of first target models and the plurality of second target models are object models to be rendered.
  4. 根据权利要求3所述的方法,其特征在于,按照所述渲染参数同时渲染所述多个第一场景模型和所述多个第二场景模型包括:The method according to claim 3, wherein rendering the plurality of first scene models and the plurality of second scene models simultaneously according to the rendering parameters comprises:
    按照所述渲染参数,从所述多个第一目标模型和所述多个第二目标模型中选取出与各个像素点所对应的待渲染模型;According to the rendering parameters, the to-be-rendered model corresponding to each pixel is selected from the plurality of first target models and the plurality of second target models;
    在所述各个像素点上渲染为所述各个像素点选取的所述待渲染模型。The to-be-rendered model selected for the respective pixel points is rendered on the respective pixel points.
  5. 根据权利要求1所述的方法,其特征在于,在加载所述目标关卡待切换到的所述目标流关卡之前,所述方法还包括:The method according to claim 1, wherein before loading the target flow level to which the target level is to be switched, the method further comprises:
    检测到所述目标关卡与目标虚拟角色之间的距离由小于目标距离阈值转换为大于或者等于所述目标距离阈值,其中,所述目标虚拟角色为通过所述目标客户端所控制的虚拟角色。It is detected that the distance between the target level and the 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.
  6. 根据权利要求1所述的方法,其特征在于,在加载所述目标关卡待切换到的所述目标流关卡之前,所述方法还包括:The method according to claim 1, wherein before loading the target flow level to which the target level is to be switched, the method further comprises:
    将所述多个第二场景模型中的每个第二场景模型的模型材质配置为目标模型材质,其中,所述目标模型材质具有激活的目标材质属性,所述目标材质属性用于指示在流关卡切换时通过渐变抖动进行模型过渡。The model material of each second scene model in the plurality of second scene models is configured as a target model material, wherein the target model material has an activated target material attribute, and the target material attribute is used to indicate that the flow Model transition through gradient jitter when switching levels.
  7. 根据权利要求1所述的方法,其特征在于,在加载所述目标关卡待切换到的所述目标流关卡之前,所述方法还包括以下之一:The method according to claim 1, wherein before loading the target flow level to which the target level is to be switched, the method further comprises one of the following:
    通过合并所述多个第一场景模型中的多个第一子场景模型的模型顶点、模型贴图和模型材质,将所述多个第一子场景模型烘焙成一个场景模型,得到所述多个第二场景模型的一个场景模型;By merging model vertices, model maps and model materials of multiple first sub-scene models in the multiple first scene models, and baking the multiple first sub-scene models into one scene model, the multiple first sub-scene models are obtained. a scene model of the second scene model;
    通过对所述多个第一场景模型中的多个第二子场景模型进行距离场采样,将所述多个第二子场景模型烘焙成一个场景模型,得到所述多个第二场景模型的一个场景模型;By performing distance field sampling on a plurality of second sub-scene models in the plurality of first scene models, and baking the plurality of second sub-scene models into one scene model, the results of the plurality of second scene models are obtained. a scene model;
    按照目标采样精度对所述多个第一场景模型的多个第三子场景模型进行随机采样,得到多个待烘焙子模型,其中,所述多个第三子场景模型为相同的模型;按照一个批次提交所述多个待烘焙子模型,将所述多个待烘焙子模型烘焙成一个场景模型,得到所述多个第二场景模型的一个场景模型,其中,按照一个批次提交的顶点数为一个所述第三子场景模型的顶点数。Randomly sample multiple third sub-scene models of the multiple first scene models according to the target sampling accuracy to obtain multiple sub-models to be baked, wherein the multiple third sub-scene models are the same model; Submit the plurality of sub-models to be baked in one batch, bake the plurality of sub-models to be baked into a scene model, and obtain a scene model of the plurality of second scene models. The number of vertices is the number of vertices of one of the third sub-scene models.
  8. 根据权利要求1至7中任一项所述的方法,其特征在于,在所述控制所述多个第一场景模型通过渐变抖动过渡到所述多个第二场景模型之后,所述方法还包括:The method according to any one of claims 1 to 7, wherein after the controlling the plurality of first scene models to transition to the plurality of second scene models through gradual dithering, the method further comprises: include:
    在所述目标流关卡中的全部物体模型均已显示的情况下,卸载所述目标关卡中的全部物体模型。Under the condition that all object models in the target flow level have been displayed, all object models in the target level are unloaded.
  9. 一种模型切换装置,其特征在于,包括:A model switching device, characterized in that it includes:
    显示单元,用于在目标客户端上显示目标关卡的多个第一场景模型,其中,所述多个第一场景模型中的每个第一场景模型为一个场景物体的多细节层次LOD模型;a display unit, configured to display multiple first scene models of the target level on the target client, wherein each first scene model in the multiple first scene models is a multi-level of detail LOD model of a scene object;
    加载单元,用于加载所述目标关卡待切换到的目标流关卡,其中,所述目标流关卡中包含多个第二场景模型,所述多个第二场景模型中的每个第二场景模型为所述多个第一场景模型中的部分场景模型进行模型合并所得到的场景模型;A loading unit, configured to load a 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 second scene model in the plurality of second scene models a scene model obtained by model merging for part of the scene models in the plurality of first scene models;
    控制单元,用于在向所述目标流关卡切换的过程中,控制所述多个第一场景模型通过渐变抖动过渡到所述多个第二场景模型。The control unit is configured to control the plurality of first scene models to transition to the plurality of second scene models through gradual dithering during the process of switching to the target flow level.
  10. 一种计算机装置/设备/系统,包括存储器、处理器及存储在存储器上的计算机程序/指令,所述处理器执行所述计算机程序/指令时实现根据权利要求1-8中任一项所述的方法的步骤。A computer device/device/system, comprising a memory, a processor, and a computer program/instruction stored on the memory, the processor implementing the computer program/instruction according to any one of claims 1-8 when the processor executes the computer program/instruction steps of the method.
  11. 一种计算机可读介质,其上存储有计算机程序/指令,所述计算机程序/指令被处理器执行时实现根据权利要求1-8中任一项所述的方法的步骤。A computer-readable medium having stored thereon computer programs/instructions which, when executed by a processor, implement the steps of the method according to any one of claims 1-8.
  12. 一种计算机程序产品,包括计算机程序/指令,所述计算机程序/指令被处理器执行时实现根据权利要求1-8中任一项所述的方法的步骤。A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method according to any one of claims 1-8.
PCT/CN2021/121447 2020-12-16 2021-09-28 Method and device for model switching, electronic device, and storage medium WO2022127275A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011487643.5 2020-12-16
CN202011487643.5A CN112231020B (en) 2020-12-16 2020-12-16 Model switching method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022127275A1 true WO2022127275A1 (en) 2022-06-23

Family

ID=74124099

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/121447 WO2022127275A1 (en) 2020-12-16 2021-09-28 Method and device for model switching, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN112231020B (en)
WO (1) WO2022127275A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115661417A (en) * 2022-12-13 2023-01-31 深圳奥雅设计股份有限公司 Virtual world scene generation method and system in meta-space

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231020B (en) * 2020-12-16 2021-04-20 成都完美时空网络技术有限公司 Model switching method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6191793B1 (en) * 1998-04-01 2001-02-20 Real 3D, Inc. Method and apparatus for texture level of detail dithering
CN108389245A (en) * 2018-02-13 2018-08-10 鲸彩在线科技(大连)有限公司 Rendering intent, device, electronic equipment and the readable storage medium storing program for executing of cartoon scene
CN109960887A (en) * 2019-04-01 2019-07-02 网易(杭州)网络有限公司 Model production method and device, storage medium and electronic equipment based on LOD
CN111105491A (en) * 2019-11-25 2020-05-05 腾讯科技(深圳)有限公司 Scene rendering method and device, computer readable storage medium and computer equipment
CN111729305A (en) * 2020-06-23 2020-10-02 网易(杭州)网络有限公司 Map scene preloading method, model training method, device and storage medium
CN112231020A (en) * 2020-12-16 2021-01-15 成都完美时空网络技术有限公司 Model switching method and device, electronic equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6331856B1 (en) * 1995-11-22 2001-12-18 Nintendo Co., Ltd. Video game system with coprocessor providing high speed efficient 3D graphics and digital audio signal processing
US6778181B1 (en) * 2000-12-07 2004-08-17 Nvidia Corporation Graphics processing system having a virtual texturing array
CN101169871A (en) * 2007-12-03 2008-04-30 北京航空航天大学 HLOD pretreatment method facing to large scale static scene real-time rendering
CN107093202A (en) * 2010-06-30 2017-08-25 巴里·林恩·詹金斯 Stored information is used to determine the method and system of the first grid polygon set
CN106780686B (en) * 2015-11-20 2020-07-10 网易(杭州)网络有限公司 3D model merging and rendering system and method, and terminal
CN106251185A (en) * 2016-08-24 2016-12-21 四川见山科技有限责任公司 VR house property based on UE4 engine is shown and interactive system
CN109285211B (en) * 2018-10-29 2023-03-31 Oppo广东移动通信有限公司 Picture rendering method and device, terminal and storage medium
CN110738721B (en) * 2019-10-12 2023-09-01 四川航天神坤科技有限公司 Three-dimensional scene rendering acceleration method and system based on video geometric analysis

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6191793B1 (en) * 1998-04-01 2001-02-20 Real 3D, Inc. Method and apparatus for texture level of detail dithering
CN108389245A (en) * 2018-02-13 2018-08-10 鲸彩在线科技(大连)有限公司 Rendering intent, device, electronic equipment and the readable storage medium storing program for executing of cartoon scene
CN109960887A (en) * 2019-04-01 2019-07-02 网易(杭州)网络有限公司 Model production method and device, storage medium and electronic equipment based on LOD
CN111105491A (en) * 2019-11-25 2020-05-05 腾讯科技(深圳)有限公司 Scene rendering method and device, computer readable storage medium and computer equipment
CN111729305A (en) * 2020-06-23 2020-10-02 网易(杭州)网络有限公司 Map scene preloading method, model training method, device and storage medium
CN112231020A (en) * 2020-12-16 2021-01-15 成都完美时空网络技术有限公司 Model switching method and device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115661417A (en) * 2022-12-13 2023-01-31 深圳奥雅设计股份有限公司 Virtual world scene generation method and system in meta-space
CN115661417B (en) * 2022-12-13 2023-03-31 深圳奥雅设计股份有限公司 Virtual world scene generation method and system in meta-space

Also Published As

Publication number Publication date
CN112231020B (en) 2021-04-20
CN112231020A (en) 2021-01-15

Similar Documents

Publication Publication Date Title
US11158291B2 (en) Image display method and apparatus, storage medium, and electronic device
WO2022127275A1 (en) Method and device for model switching, electronic device, and storage medium
CA2853212C (en) System, server, and control method for rendering an object on a screen
JP5570421B2 (en) Entertainment apparatus and method
CN108579082A (en) The method, apparatus and terminal of shadow are shown in game
CN110047123A (en) A kind of map rendering method, device, storage medium and computer program product
WO2022148292A1 (en) Method and apparatus for displaying virtual picture of ground surface, storage medium, and electronic device
CN111111167A (en) Sound effect playing method and device in game scene and electronic device
US20230290043A1 (en) Picture generation method and apparatus, device, and medium
CN113952720A (en) Game scene rendering method and device, electronic equipment and storage medium
WO2013038979A1 (en) Game program, game device, and recording medium having game program recorded therein
CN112587921A (en) Model processing method and device, electronic equipment and storage medium
CN105957133B (en) A kind of method and apparatus for loading textures
US20190035134A1 (en) Image processing methods and devices
CN112619160A (en) Image processing method, image processing apparatus, non-volatile storage medium, and electronic apparatus
JP2020201985A (en) Program, computer device and program execution method
CN113318444B (en) Role rendering method and device, electronic equipment and storage medium
CN117111871A (en) Data processing method and device and electronic equipment
JP2017097568A (en) Program, computer device and program execution method
CN114904271A (en) Color gradient map generation method and device, electronic equipment and storage medium
CN113144591A (en) Virtual character edge drawing method and device and electronic equipment
CN117197327A (en) Scene resource loading method, device, equipment and medium
CN113350791A (en) Edge processing method, device, equipment and storage medium of virtual role
CN114648616A (en) Terrain rendering method and device and electronic equipment
Calvo Villazón Strategy2D: Turn-based Strategy Video Game Engine for Mobile Devices

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21905205

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21905205

Country of ref document: EP

Kind code of ref document: A1