Game scene generation method and device, computer device and storage medium
By deploying automated scripts in the game engine to read the model positions and hierarchical relationships in the modeling software and automatically update the game scene, the problem of lost model information in the game engine is solved, improving generation efficiency and display effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-11-11
- Publication Date
- 2026-07-10
AI Technical Summary
In existing technologies, game engines do not fully support standard 3D format files, resulting in the loss of model information. This requires readjustment and export in DCC software, which wastes manpower and resources.
Deploying automated scripts in the game engine allows for automatic updates to the game scene by reading model location information and hierarchical relationships from the modeling software, thus avoiding repetitive import and export operations.
It improves the efficiency of game scene generation, avoids scene errors caused by the loss of model information, and ensures the display effect of game scenes.
Smart Images

Figure CN115591239B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game processing technology, specifically to a game scene generation method, apparatus, computer device, and storage medium (computer-readable storage medium). Background Technology
[0002] Currently, when asset artists create game scenes in game engines such as UE (Unreal Engine) and Unity, they first create the scene model assets in DCC (Digital Content Creation) software, then export standard 3D format files such as OBJ or FBX, and then import them into the game engine to obtain the corresponding game scene.
[0003] However, while standard 3D file formats like OBJ or FBX are well supported within DCC software, differences in memory and CPU optimizations, as well as in the rendering pipeline and underlying model architecture, mean that game engines like Unreal Engine (UE) do not fully support these standard 3D file formats, easily resulting in the loss of model information. Therefore, when adjustments are needed to models in imported game scenes, it is often necessary to readjust the scene model assets in DCC software, then re-export and re-import, which is wasteful of time and resources and quite cumbersome. Summary of the Invention
[0004] Therefore, it is necessary to provide a game scene generation method, apparatus, computer equipment, and storage medium to address the aforementioned technical problems, thereby resolving the technical issues of complex processes and high costs associated with adjusting game scenes within a game engine.
[0005] Firstly, this application provides a game scene generation method, applied in a game engine, the method comprising:
[0006] An initial game scene is generated based on the model position information corresponding to each 3D model in the preset modeling software; the initial game scene contains an initial model corresponding to each 3D model.
[0007] In response to a model modification instruction for the target model in the initial model, the hierarchical relationship between the three-dimensional models is read from the preset modeling software;
[0008] Based on the hierarchical relationship, determine the associated model corresponding to the target model from the initial model;
[0009] The target game scene is obtained by modifying the target model and the associated model in the initial game scene according to the model modification instructions.
[0010] Secondly, this application provides a game scene generation device, disposed in a game engine, the device comprising:
[0011] The generation module is used to generate an initial game scene based on the model position information corresponding to each 3D model in the preset modeling software; the initial game scene contains an initial model corresponding to each 3D model respectively;
[0012] The reading module is used to read the hierarchical relationship between the three-dimensional models from the preset modeling software in response to the model modification command of the target model in the initial model;
[0013] A determining module is used to determine the associated model corresponding to the target model from the initial model based on the hierarchical relationship;
[0014] The modification module is used to modify the target model and the associated model in the initial game scene according to the model modification instructions to obtain the target game scene.
[0015] Thirdly, this application also provides a computer device, characterized in that the computer device comprises:
[0016] One or more processors;
[0017] Memory; and
[0018] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the game scene generation method provided by any of the above.
[0019] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps of the game scene generation method provided in any of the above claims.
[0020] Fifthly, embodiments of this application provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the game scene generation method provided above.
[0021] The game scene generation method provided in this application mainly runs in a game engine. After generating an initial game scene based on the model position information corresponding to each 3D model in the modeling software, if a model modification instruction for the target model in the initial game scene is received, the hierarchical relationship between the 3D models can be read from the preset modeling software. This allows the associated model corresponding to the target model to be determined in the initial game scene, and the target model and associated model are synchronously modified according to the model modification instruction to obtain the modified game scene. This effectively avoids the problem of scene disorder caused by the loss of model information when modifying the game scene in the game engine. While ensuring the display effect of the game scene, it effectively improves the creation efficiency of the game scene. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This application provides a flowchart illustrating the steps of a game scene generation method.
[0024] Figure 2 A flowchart illustrating the steps of rendering a model based on environmental configuration information, provided in an embodiment of this application;
[0025] Figure 3 This is a flowchart illustrating the steps for generating a game scene based on the space occupied by scene resources, as provided in an embodiment of this application.
[0026] Figure 4 A flowchart illustrating the steps for modifying a target model and an associated model based on model modification instructions, provided in an embodiment of this application.
[0027] Figure 5(a) is a schematic diagram of the initial modeling scene in a modeling software provided in an embodiment of this application;
[0028] Figure 5(b) is a schematic diagram of the initial game scene in a game engine provided in an embodiment of this application;
[0029] Figure 6 This is a schematic diagram illustrating another step in generating a game scene according to an embodiment of this application.
[0030] Figure 7 This application provides a schematic diagram of a process for updating a game scene based on a 3D model, as illustrated in an embodiment of the present application.
[0031] Figure 8This is a schematic diagram of the structure of a game scene generation device provided in an embodiment of this application;
[0032] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0035] In the description of this application, the word "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0036] To facilitate understanding of the complete implementation scheme of the game scene generation method provided in the embodiments of this application, the implementation scenario of the game scene generation method is first described in detail below.
[0037] To address the problem in existing technologies where importing scene model resources created within DCC software into a game engine often results in data loss, necessitating modification of the scene model resources within DCC software and subsequent re-export and re-import when updating the game scene within the game engine, this application addresses this issue by deploying automated scripts within the game engine. This establishes an information channel between the scripts and the modeling software, automatically retrieving relevant information from the 3D modeling software when updating the game scene within the game engine. This eliminates the need for repeated import and export operations, effectively improving the efficiency of game scene generation within the game engine.
[0038] Specifically, such as Figure 1 As shown, Figure 1 This application provides a flowchart illustrating a game scene generation method, which is mainly applied to game engines and includes steps S110-140, as detailed below:
[0039] S110 generates the initial game scene based on the model position information corresponding to each 3D model in the preset modeling software.
[0040] In this embodiment, the preset modeling software is typically one of 3DMax, Maya, or AutoCAD. Of course, the preset modeling software can also be other DCC software that supports standard 3D format files such as OBJ or FBX, which will not be elaborated here.
[0041] In this embodiment, in the preset modeling software, the model position information corresponding to each 3D model is usually in the form of a four-dimensional vector (x, y, z, w) composed of 3D coordinates (x, y, z) and homogeneous coordinates w, used to achieve scaling, rotation, and translation of the 3D model position. However, since the coordinate system used in the modeling software is different from the coordinate system used in the game engine, it is necessary to use the coordinate system transformation matrix, which describes the coordinate system difference between the coordinate system used in the modeling software and the coordinate system used in the game engine, to transform the coordinate information corresponding to each 3D model in the preset modeling software. This results in the position information of each model in the game engine, and the corresponding model is generated at the corresponding coordinate position in the game engine, thus forming the initial game scene.
[0042] It should be noted that the initial game scene here is formed only based on the model position information corresponding to each 3D model in the preset modeling software. That is, the scene only contains a number of initial models that correspond to the model positions in the preset modeling software.
[0043] Building upon this foundation, to further enrich the effects of the game scenes generated by the game engine, in addition to containing several initial models corresponding to the model positions in the preset modeling software, the game scene will also render the initial models in the game scene based on the scene attribute information configured for each 3D model in the preset modeling software. This results in a richer game scene with rendering effects such as lighting and materials. Specifically, generating the initial game scene based on the model position information corresponding to each 3D model in the preset modeling software mainly includes the following two steps:
[0044] (1) Based on the model position information corresponding to each three-dimensional model in the preset modeling software, an initial model corresponding to each three-dimensional model is created in the preset scene, that is, the position vector coordinates corresponding to each three-dimensional model in the preset modeling software are mapped to the game engine, thereby creating an initial model corresponding to the three-dimensional model at the corresponding position in the game engine.
[0045] (2) Based on the environment configuration information corresponding to each 3D model in the preset modeling software, render each initial model to generate the initial game scene. Specifically, the environment configuration information mainly includes information related to cameras, lighting, materials, etc. Figure 2 As shown, Figure 2 The flowchart illustrating the steps for rendering a model based on environment configuration information provided in this application embodiment mainly includes steps S210 to 240, as detailed below:
[0046] S210, extract the position matrix, Z-axis orientation and focal length of each camera in the preset modeling software to obtain scene camera configuration information.
[0047] In this embodiment, since the general format requirements for cameras in modeling software are relatively uniform, each camera can be traversed through a script to obtain information such as the position matrix, Z-axis orientation, and focal length of each camera, thereby obtaining scene camera configuration information. This information can then be used to create cameras with the same parameters at corresponding positions in the game scene, thereby enabling control over the game screen.
[0048] S220, extract the color temperature, RGB and orientation information of each light in the preset modeling software to obtain scene lighting configuration information.
[0049] In this embodiment of the application, similar to cameras, the general format requirements for lights in modeling software are also relatively uniform. Therefore, a script can be used to traverse each light and obtain general information such as the color temperature and RGB of the light. In addition, for rectangular lights and surface light sources, their orientation information also needs to be recorded to obtain scene light configuration information, which can be used to create lights with the same parameters at the corresponding positions in the game scene, thereby achieving the light rendering effect of the model.
[0050] S230, Extract the material information and physical rendering parameters corresponding to each 3D model in the preset modeling software to obtain model configuration information.
[0051] In this embodiment, for the material information corresponding to the model, a script can first be used to obtain all the material ball information and read PBR (Physically-Based-Rendering) information, such as diffuse, specular, normal, metallic and other attributes and texture information. Then, based on the upstream and downstream node information connected to the material ball, the model situation assigned to each material ball is determined, that is, the relationship between the model and the material is found, thereby determining the material information and physical rendering parameters corresponding to each 3D model, so as to complete the material assignment of the initial model in the game scene in the subsequent process, and combine the lights created in the game scene to achieve the light rendering effect of the model based on the PBR information.
[0052] S240, the initial model is rendered according to the scene camera configuration information, the scene lighting configuration information and the model configuration information to generate the initial game scene.
[0053] In this embodiment, the initial model in the scene is rendered based on the scene camera configuration information, scene lighting configuration information and model configuration information extracted above, so as to obtain an initial game scene with richer visual effects.
[0054] Furthermore, considering that the game scene generation method provided in this application is mainly to avoid repeated import and export operations on the modeling software, that is, when there are many scene model resources in the modeling software, it can significantly reduce workload and time costs, while when there are few scene model resources in the modeling software, by modifying the 3D model within the modeling software, it can better complete the update of the game screen in the game engine without significantly increasing the time consumption. Therefore, as another optional implementation of the embodiments of this application, it is possible to determine whether to continue processing using the game scene generation method provided in this proposal based on the space occupied by the scene resources corresponding to the initial modeling scene in the preset modeling software. Specifically, as shown in the example... Figure 3 As shown, Figure 3 The flowchart illustrating the steps for generating a game scene based on scene resource space usage provided in this application embodiment mainly includes steps S310 to 320, as detailed below:
[0055] S310: Obtain the scene resource space occupied by the initial modeling scene in the preset modeling software.
[0056] In this embodiment of the application, the scene resource space occupied can be understood as the model size of all model information contained in a certain modeling scene in the modeling software. Typically, the scene resource space occupied by a modeling scene in the modeling software is about several GB.
[0057] S320, if the space occupied by the scene resources is greater than the preset space threshold, then an initial game scene is generated based on the model position information corresponding to each three-dimensional model in the initial modeling scene.
[0058] In this embodiment, if the space occupied by scene resources corresponding to the initial modeling scene in the preset modeling software is greater than a preset space threshold, it indicates that the initial modeling scene contains a large number of model resources, and repeated import and export will consume a lot of time. Therefore, the game scene generation method provided in this application can be executed, that is, the initial game scene is generated according to the model position information corresponding to each 3D model in the initial modeling scene. Thus, when a model modification instruction for the target model in the initial model is received, the associated model corresponding to the target model can be determined according to the hierarchical relationship between each 3D model in the preset modeling software, and the initial game scene can be updated. Conversely, if the space occupied by scene resources corresponding to the initial modeling scene in the preset modeling software is less than or equal to the preset space threshold, it indicates that the amount of model resources contained in the initial modeling scene is relatively small, and repeated import and export will not significantly increase the time consumption. In this case, when responding to a model modification instruction for the target model in the initial model, the user can be reminded to modify the original 3D model in the preset modeling software, and the modified model can be re-imported into the game engine to generate a scene with better performance.
[0059] Specifically, the space threshold here can be set based on actual needs, such as the import and export time required for modeling scenarios under different resource space occupancy conditions. This will not be elaborated further in the embodiments of this application.
[0060] When the initial modeling scene has a high resource footprint, the game scene generation method provided in this application can be used to process it, which can significantly reduce time costs and significantly improve the efficiency of game scene generation.
[0061] Furthermore, it should be noted that, in order to better utilize the model position information corresponding to the 3D model to generate the initial game scene, as a feasible embodiment of this application, the 3D model can be parsed and exported to obtain a first format file containing the model position information, so that it can be imported into the game engine to generate the initial game scene. Specifically, this implementation scheme will be given in another embodiment later.
[0062] S120, in response to the model modification instruction for the target model in the initial model, read the hierarchical relationship between the three-dimensional models from the preset modeling software.
[0063] It should be noted that in existing technologies, standard 3D format files such as FBX also record the hierarchical relationships between models. However, compared to the standardized four-dimensional coordinate vectors of models in FBX files, the hierarchical relationships between models are more complex. Furthermore, game engines and modeling software have certain differences in their rendering pipelines and underlying model architectures. Therefore, when importing FBX files into a game engine, the hierarchical relationships between models may be lost. This means that when modifying a model in the game scene within the game engine, modifications must be made in the modeling software; otherwise, the lost hierarchical relationships will cause model errors in the game scene. Based on this, in this embodiment, after receiving a model modification instruction for a target model in the game scene, the game engine reads the hierarchical relationships between various 3D models from the preset modeling software through a deployed script to avoid model errors in the game scene.
[0064] Specifically, the target model refers to the model selected by the user when inputting model modification commands. This model is one or more models from the initial models in the initial game scene of the game engine. Specifically, when a model modification command is received for the target model, the script reads the hierarchical relationships between the various 3D models from the preset modeling software. Here, hierarchical relationships refer to associative management such as parent-child nested relationships. For example, upper-level organizational hierarchies typically contain lower-level object models; that is, moving or modifying the position of models in upper-level groups will synchronously affect the position information of lower-level object models.
[0065] Of course, similar to generating the initial game scene mentioned above, in order to more easily realize the reading of the hierarchical relationship between the three-dimensional models in the modeling software, as another optional embodiment of this application, the three-dimensional models can also be parsed and exported to obtain a second format file containing the hierarchical relationship between the three-dimensional models, so that the game engine can use the hierarchical relationship to complete the filtering of related models and thus realize the updating of the models. This implementation scheme will be given in another embodiment later.
[0066] S130, determine the associated model corresponding to the target model from the initial model according to the hierarchical relationship.
[0067] In this embodiment of the application, as can be seen from the foregoing description, based on the hierarchical relationship between the three-dimensional models read from the preset modeling software, the game engine can select the model that needs to be modified together with the target model from the initial model. This model is the associated model corresponding to the target model.
[0068] S140, Modify the target model and the associated model in the initial game scene according to the model modification instruction to obtain the target game scene.
[0069] In this embodiment, after selecting the associated model corresponding to the target model from the initial model of the initial game scene, the game engine further modifies both the target model and the associated model according to the model modification instructions. Specifically, considering that the model modification instructions are applied to the target model, the specific hierarchical relationship between the target model and the associated model also needs to be considered when actually processing the associated model. Specifically, as... Figure 4 , Figure 4 The flowchart illustrating the steps for modifying the target model and associated model based on model modification instructions provided in this application embodiment specifically includes steps S410 to 440:
[0070] S410, the model position information of the target model is transformed according to the rotation and translation matrix corresponding to the model modification instruction to obtain the transformed target model.
[0071] In this embodiment, the model modification instructions typically involve rotation, translation, and scaling of the model. Generally, different matrices can be used to describe these operations, such as rotation matrices, translation matrices, and scaling matrices. By using the rotation and translation matrices corresponding to the model modification instructions to perform matrix multiplication on the model position information of the target model, the transformed model position information can be obtained.
[0072] S420, Based on the association matrix between the target model and the associated model in the hierarchical relationship, the rotation and translation matrix is adjusted to obtain the adjusted rotation and translation matrix.
[0073] In the embodiments of this application, the hierarchical relationship is usually recorded in the form of a matrix to record the relationship between the target model and the associated model. For example, in the simplest case, when the target model and the associated model have the simplest relative fixed relationship, that is, when the relative position is fixed, the association matrix can be an identity matrix to ensure that the adjusted rotation and translation matrix is the same as the rotation and translation matrix, thereby realizing the same rotation, translation and scaling operations on the associated model as on the target model.
[0074] S430, the model position information of the associated model is transformed according to the adjusted rotation and translation matrix to obtain the transformed associated model.
[0075] In this embodiment of the application, similar to the aforementioned step S410, matrix multiplication is performed on the model position information of the target model based on the adjusted rotation and translation matrix to obtain the model position information of the transformed associated model.
[0076] S440, Based on the transformed target model and the transformed association model, generate the target game scene.
[0077] In this embodiment, the positions of the target model and associated model of the initial game scene in the game engine are adjusted to the changed positions, and the target game scene can be finally generated.
[0078] To facilitate understanding of the implementation effect diagram of the game scene generation method provided in the embodiments of this application, as shown in Figure 5, Figure 5(a) shows a scene diagram of the initial modeling scene in a modeling software, while Figure 5(b) shows a scene diagram of the initial game scene in a game engine.
[0079] The game scene generation method provided in this application mainly runs in a game engine. After generating an initial game scene based on the model position information corresponding to each 3D model in the modeling software, if a model modification instruction for the target model in the initial game scene is received, the hierarchical relationship between the 3D models can be read from the preset modeling software. This allows the associated model corresponding to the target model to be determined in the initial game scene, and the target model and associated model are synchronously modified according to the model modification instruction to obtain the modified game scene. This effectively avoids the problem of scene disorder caused by the loss of model information when modifying the game scene in the game engine. While ensuring the display effect of the game scene, it effectively improves the creation efficiency of the game scene.
[0080] Furthermore, as another optional embodiment of this application, the model position information corresponding to each 3D model in the modeling software and the hierarchical relationship between the 3D models can be obtained by parsing and exporting each 3D model in the modeling software and storing them in different file formats. Specifically, such as... Figure 6 As shown, Figure 6 This application provides another flowchart illustrating the steps for generating a game scene, specifically including steps S610 to S630:
[0081] S610, parse the 3D model in the preset modeling software to generate a first format file containing model position information and a second format file containing the hierarchical relationship between the 3D models.
[0082] Based on the preset export function of modeling software, it is possible to parse the 3D model in the preset modeling software and output standard 3D format files such as OBJ and FBX files. Building upon this, the embodiments of this application achieve a similar effect to the preset export function through scripts, enabling the parsing of 3D models in the preset modeling software. However, unlike the preset export function of the modeling software, the embodiments of this application export a first format file containing model location information and a second format file containing the hierarchical relationships between the various 3D models, so that the required data information can be read from the corresponding format files according to different needs.
[0083] Specifically, considering that the model position information corresponding to the 3D model usually exists in the form of a standardized four-dimensional coordinate vector, the model position information corresponding to the 3D model can be stored in the more standardized FBX format file. Correspondingly, the hierarchical relationship between the 3D models is stored in the source language that allows users to define their own markup language, namely XML format file.
[0084] Of course, it should be noted that in addition to the information mentioned above, modeling software also includes a lot of attribute information related to the 3D model or modeling scene, such as the environmental configuration information provided above, such as scene camera configuration information, scene lighting configuration information, model configuration information, or other descriptive information such as scene size ratio, scene name, version status, etc. This information can usually be parsed into different format files in a custom way. The specific implementation scheme will be given in the complete implementation process provided later.
[0085] S620: Read the model position information from the first format file and generate the initial game scene.
[0086] In this embodiment of the application, after exporting an FBX format file containing model position information based on a script, the game engine reads the model position information in the FBX format file and generates an initial game scene based on the relevant description of the aforementioned step S110. This embodiment of the application will not be described again here.
[0087] S630, in response to a model modification instruction for the target model in the initial model, reads the hierarchical relationship between the three-dimensional models from the second format file.
[0088] In this embodiment, when the game engine receives a model modification instruction from the user, it reads the hierarchical relationship between the 3D models from the previously exported second format file containing the hierarchical relationship between the 3D models, and updates the game scene in the game engine based on the relevant descriptions of the aforementioned steps S130 and S140. This embodiment will not be described in detail here.
[0089] This application embodiment, by parsing each 3D model in the modeling software and exporting them in different format files, can retain version record information. Specifically, after generating a first format file containing model location information, the user can also update the 3D model in the modeling software. At this time, the game engine will use the format file to record the user's model update operations on the 3D model in the modeling software and update the game scene in the game engine accordingly. Specifically, for example... Figure 7 As shown, Figure 7 A flowchart illustrating the steps for updating a game scene based on a 3D model, as provided in this application embodiment, specifically includes steps S701 to S720:
[0090] S710, in response to the model update instruction of the target 3D model in the preset modeling software, the target format file corresponding to the target 3D model in the first format file is updated to obtain the updated first format file.
[0091] In this embodiment of the application, when the preset modeling software receives a model update instruction for the target 3D model, the script will not re-parse all 3D models and export new format files, but will only update the target format file corresponding to the target 3D model in the first format file. That is, it only records the relevant information of the updated model and completes the recording of the model by marking the target format file with the corresponding update mark.
[0092] S720: Read the model position information in the first format file and generate the initial game scene according to the update identifiers corresponding to each file in the first format file.
[0093] In this embodiment of the application, based on this, when the game engine reads the first format file, it will filter out the latest version of the file according to the update identifier corresponding to each file in the first format file, and generate the initial game scene based on the model position information in these files.
[0094] The method provided in this application embodiment allows for the independent recording of model updates in preset modeling software. Based on the update identifier, it enables the comparison and rollback of different versions of game scenes in the game engine, thereby effectively improving user operability.
[0095] To facilitate understanding of the game scene generation method provided in the embodiments of this application, the following will be based on the foregoing Figures 1 to 7 The provided content offers a complete implementation flow for a game scene generation method. This method stores each object model in the modeling software as an FBX file and records other object model-related content, such as camera, material, and lighting information, in a corresponding XML description file. Specifically, it includes the following steps:
[0096] (1) Export from modeling software:
[0097] In modeling software, common standard objects in the scene are exported as four main parts at independent levels: model, camera, light, and material.
[0098] Among them, the general format requirements for cameras in modeling software are relatively uniform. Each camera can be traversed through a Python script to obtain information such as its 4*4 normalized matrix in world space, Z-axis orientation, focal length, and near and far planes, and then directly recorded in an XML description file.
[0099] The lights can also be generated using Python scripts and general information such as color temperature and RGB values can be obtained. For rectangular lights and surface light sources, their orientation information needs to be recorded and recorded in an XML description file.
[0100] The material export process begins by using Python to batch retrieve information from all material spheres and read basic PBR information, such as diffuse, specular, normal, metallic properties, and texture information. Then, it retrieves information about the upstream and downstream nodes connected to each material sphere, such as the ramp gradient map and its properties, and records the model assets assigned to each material sphere.
[0101] For the models in the scene, first obtain the 4×4 model space matrix of each model in the modeling software, and record the 4×4 model space matrix directly in the FBX file. In addition, if a model is under the group level, the model space matrix of the group can be associated with the model space matrix of the model, so as to associate and store the models of the same group in the XML description file.
[0102] In addition, other general information can be recorded in the XML description file, such as model name, FBX file path, scene size ratio, scene name size, version status, etc.
[0103] For each object, an FBX file and an XML file will be used to describe it, and they will be stored in the overall scene folder;
[0104] (2) Model updates in modeling software
[0105] For each object information in the above four main categories, an export status is added: Modified, Added, Deleted. Types that have not undergone any operation will not be changed. Each export will compare with historical comparison information. For example, if there are 50 models in a modeling scene, but only one model has been modified, only that model will be exported in the new version's scene folder. Other unchanged models will still be located in the historical version's scene folder, thus enabling quick switching between different versions for comparison and effectively improving configuration flexibility.
[0106] (3) Importing the UE engine
[0107] When importing into the UE engine, the script will iterate through the scene folder records of each version. If there are model change records in higher versions, the record records of lower versions will be ignored. At the same time, the latest version file data, namely FBX files and XML files, will be used to generate the game scene in the game engine.
[0108] Specifically, based on the coordinate system difference between the coordinate system used in the modeling software and the coordinate system used in the game engine, that is, by adjusting the four-dimensional vector of the model extracted from the FBX file using the coordinate system transformation matrix, an initial model can be obtained in the game engine scene that is completely consistent with the model position in the modeling software. The materials, cameras, and lights recorded in the XML file are then used to complete the material assignment and rendering of the initial model.
[0109] (4) Scene updates in the UE engine
[0110] Upon receiving a model modification instruction for the target model in the game scene of the UE engine, the UE engine will filter out the associated models in the game scene that are related to the target model based on the model hierarchy relationship in the XML file exported from the modeling software. Then, according to the model modification instruction, it will complete the changes to the target model and associated models in the initial game scene to obtain the final target game scene.
[0111] To better implement the game scene generation method provided in this application embodiment, based on the game scene generation method provided in this application embodiment, this application embodiment also provides a game scene generation device, such as... Figure 8 As shown, the game scene generation device 800 includes:
[0112] The generation module 810 is used to generate an initial game scene based on the model position information corresponding to each three-dimensional model in the preset modeling software; the initial game scene contains an initial model corresponding to each three-dimensional model respectively;
[0113] The reading module 820 is used to read the hierarchical relationship between the three-dimensional models from the preset modeling software in response to the model modification instruction of the target model in the initial model;
[0114] The determining module 830 is used to determine the associated model corresponding to the target model from the initial model according to the hierarchical relationship;
[0115] Modification module 840 is used to modify the target model and the associated model in the initial game scene according to the model modification instruction to obtain the target game scene.
[0116] In some embodiments of this application, before generating the initial game scene based on the model position information corresponding to each 3D model in the preset modeling software, the generation module 810 is further configured to parse the 3D model in the preset modeling software, generate a first format file containing model position information, and a second format file containing the hierarchical relationship between the 3D models; read the model position information in the first format file to generate the initial game scene.
[0117] The reading module 820 is further configured to read the hierarchical relationship between the three-dimensional models from the second format file in response to a model modification instruction for the target model in the initial model.
[0118] In some embodiments of this application, after the generation module 810 parses the 3D model in the preset modeling software and generates a first format file containing model position information, it is further configured to update the target format file corresponding to the target 3D model in the first format file in response to the model update instruction of the target 3D model in the preset modeling software, thereby obtaining the updated first format file; read the first format file, and generate an initial game scene according to the update identifier corresponding to each file in the first format file.
[0119] In some embodiments of this application, the modification module 840 is configured to transform the model position information of the target model according to the rotation and translation matrix corresponding to the model modification instruction to obtain a transformed target model; adjust the rotation and translation matrix according to the association matrix between the target model and the associated model in the hierarchical relationship to obtain an adjusted rotation and translation matrix; transform the model position information of the associated model according to the adjusted rotation and translation matrix to obtain a transformed associated model; and generate a target game scene based on the transformed target model and the transformed associated model.
[0120] In some embodiments of this application, the generation module 810 is used to create an initial model corresponding to each of the three-dimensional models in a preset scene according to the model position information corresponding to each three-dimensional model in the preset modeling software; and to render each of the initial models according to the environment configuration information corresponding to each three-dimensional model in the preset modeling software to generate an initial game scene.
[0121] In some embodiments of this application, the generation module 810 is used to extract the position matrix, Z-axis orientation, and focal length of each camera in the preset modeling software to obtain scene camera configuration information; extract the color temperature, RGB, and orientation information of each light in the preset modeling software to obtain scene lighting configuration information; extract the material information and physical rendering parameters of each 3D model in the preset modeling software to obtain model configuration information; and render the initial model according to the scene camera configuration information, the scene lighting configuration information, and the model configuration information to generate an initial game scene.
[0122] In some embodiments of this application, before generating the initial game scene based on the model position information corresponding to each 3D model in the preset modeling software, the generation module 810 is also used to obtain the scene resource space occupied by the initial modeling scene in the preset modeling software; if the scene resource space occupied is greater than a preset space threshold, then the initial game scene is generated based on the model position information corresponding to each 3D model in the initial modeling scene.
[0123] Specific limitations regarding the game scene generation device can be found in the limitations of the game scene generation method described above, and will not be repeated here. Each module in the aforementioned game scene generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0124] In some embodiments of this application, the game scene generation device 800 can be implemented as a computer program, and the computer program can be implemented in, for example... Figure 9 The computer device shown is running the program. The computer device's memory can store the various program modules that make up the game scene generation device 800, for example, Figure 8 The diagram shows a generation module 810, a reading module 820, a determining module 830, and a modification module 840. The computer program comprised of these modules causes the processor to execute the steps in the game scene generation methods of the various embodiments of this application described in this specification.
[0125] For example, Figure 9 The computer equipment shown can be used as follows Figure 8The generation module 810 in the game scene generation apparatus 800 shown executes step S110. The computer device can execute step S120 via the reading module 820. The computer device can execute step S130 via the determining module 830. The computer device can execute step S140 via the modifying module 840. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with external computer devices via a network connection. When the computer program is executed by the processor, it implements a game scene generation method.
[0126] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0127] In some embodiments of this application, a computer device is provided, including one or more processors; memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to perform the following steps:
[0128] An initial game scene is generated based on the model position information corresponding to each 3D model in the preset modeling software; the initial game scene contains an initial model corresponding to each 3D model.
[0129] In response to a model modification instruction for the target model in the initial model, the hierarchical relationship between the three-dimensional models is read from the preset modeling software;
[0130] Based on the hierarchical relationship, determine the associated model corresponding to the target model from the initial model;
[0131] The target game scene is obtained by modifying the target model and the associated model in the initial game scene according to the model modification instructions.
[0132] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: parsing the three-dimensional model in the preset modeling software to generate a first format file containing model position information and a second format file containing the hierarchical relationship between the three-dimensional models; reading the model position information in the first format file to generate an initial game scene; and reading the hierarchical relationship between the three-dimensional models from the second format file in response to a model modification instruction for the target model in the initial model.
[0133] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: in response to the model update instruction of the target three-dimensional model in the preset modeling software, the target format file corresponding to the target three-dimensional model in the first format file is updated to obtain the updated first format file; the first format file is read, and an initial game scene is generated according to the update identifier corresponding to each file in the first format file.
[0134] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: transforming the model position information of the target model according to the rotation and translation matrix corresponding to the model modification instruction to obtain the transformed target model; adjusting the rotation and translation matrix according to the association matrix between the target model and the associated model in the hierarchical relationship to obtain the adjusted rotation and translation matrix; transforming the model position information of the associated model according to the adjusted rotation and translation matrix to obtain the transformed associated model; and generating a target game scene based on the transformed target model and the transformed associated model.
[0135] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: creating an initial model corresponding to each of the three-dimensional models in a preset scene according to the model position information corresponding to each of the three-dimensional models in the preset modeling software; rendering each of the initial models according to the environment configuration information corresponding to each of the three-dimensional models in the preset modeling software to generate an initial game scene.
[0136] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: extracting the position matrix, Z-axis orientation, and focal length corresponding to each camera in the preset modeling software to obtain scene camera configuration information; extracting the color temperature, RGB, and orientation information corresponding to each light in the preset modeling software to obtain scene lighting configuration information; extracting the material information and physical rendering parameters corresponding to each three-dimensional model in the preset modeling software to obtain model configuration information; and rendering the initial model according to the scene camera configuration information, the scene lighting configuration information, and the model configuration information to generate an initial game scene.
[0137] In some embodiments of this application, when the processor executes the computer program, it also performs the following steps: obtaining the scene resource space occupied by the initial modeling scene in the preset modeling software; if the scene resource space occupied is greater than the preset space threshold, generating an initial game scene based on the model position information corresponding to each three-dimensional model in the initial modeling scene.
[0138] In some embodiments of this application, a computer-readable storage medium is provided, storing a computer program that is loaded by a processor, causing the processor to perform the following steps:
[0139] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: parsing the three-dimensional model in the preset modeling software to generate a first format file containing model position information and a second format file containing the hierarchical relationship between the three-dimensional models; reading the model position information in the first format file to generate an initial game scene; and reading the hierarchical relationship between the three-dimensional models from the second format file in response to a model modification instruction for the target model in the initial model.
[0140] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: in response to the model update instruction of the target three-dimensional model in the preset modeling software, the target format file corresponding to the target three-dimensional model in the first format file is updated to obtain the updated first format file; the first format file is read, and an initial game scene is generated according to the update identifier corresponding to each file in the first format file.
[0141] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: transforming the model position information of the target model according to the rotation and translation matrix corresponding to the model modification instruction to obtain the transformed target model; adjusting the rotation and translation matrix according to the association matrix between the target model and the associated model in the hierarchical relationship to obtain the adjusted rotation and translation matrix; transforming the model position information of the associated model according to the adjusted rotation and translation matrix to obtain the transformed associated model; and generating a target game scene based on the transformed target model and the transformed associated model.
[0142] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: creating an initial model corresponding to each of the three-dimensional models in a preset scene according to the model position information corresponding to each of the three-dimensional models in the preset modeling software; rendering each of the initial models according to the environment configuration information corresponding to each of the three-dimensional models in the preset modeling software to generate an initial game scene.
[0143] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: extracting the position matrix, Z-axis orientation, and focal length corresponding to each camera in the preset modeling software to obtain scene camera configuration information; extracting the color temperature, RGB, and orientation information corresponding to each light in the preset modeling software to obtain scene lighting configuration information; extracting the material information and physical rendering parameters corresponding to each three-dimensional model in the preset modeling software to obtain model configuration information; and rendering the initial model according to the scene camera configuration information, the scene lighting configuration information, and the model configuration information to generate an initial game scene.
[0144] In some embodiments of this application, when the processor executes the computer program, it also performs the following steps: obtaining the scene resource space occupied by the initial modeling scene in the preset modeling software; if the scene resource space occupied is greater than the preset space threshold, generating an initial game scene based on the model position information corresponding to each three-dimensional model in the initial modeling scene.
[0145] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0146] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] The above provides a detailed description of a game scene generation method, apparatus, computer device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for generating game scenes, characterized in that, When applied in a game engine, the method includes: The three-dimensional model in the preset modeling software is parsed to generate a first format file containing model location information and a second format file containing the hierarchical relationship between the three-dimensional models; the first format file is an FBX format file and the second format file is an XML format file. An initial game scene is generated based on the model position information corresponding to each 3D model in the preset modeling software; the initial game scene contains an initial model corresponding to each 3D model. In response to a model modification instruction for the target model in the initial model, the hierarchical relationship between the three-dimensional models is read from the preset modeling software; Based on the hierarchical relationship, determine the associated model corresponding to the target model from the initial model; The target game scene is obtained by modifying the target model and the associated model in the initial game scene according to the model modification instructions. The step of generating an initial game scene based on the model position information corresponding to each 3D model in the preset modeling software includes: Read the model position information from the first format file to generate the initial game scene; The step of responding to a model modification instruction for the target model in the initial model by reading the hierarchical relationship between the three-dimensional models from the preset modeling software includes: In response to a model modification instruction for the target model in the initial model, the hierarchical relationship between the three-dimensional models is read from the second format file.
2. The game scene generation method according to claim 1, characterized in that, After parsing the 3D model in the preset modeling software and generating a first format file containing model location information, the method includes: In response to the model update command of the target 3D model in the preset modeling software, the target format file corresponding to the target 3D model in the first format file is updated to obtain the updated first format file; The step of reading the model position information from the first format file and generating the initial game scene includes: Read the model position information from the first format file, and generate the initial game scene according to the update identifiers corresponding to each file in the first format file.
3. The game scene generation method according to claim 1, characterized in that, The step of modifying the target model and the associated model in the initial game scene according to the model modification instruction to obtain the target game scene includes: The model position information of the target model is transformed according to the rotation and translation matrix corresponding to the model modification instruction to obtain the transformed target model; Based on the association matrix between the target model and the associated model in the hierarchical relationship, the rotation and translation matrix is adjusted to obtain the adjusted rotation and translation matrix; The model position information of the associated model is transformed according to the adjusted rotation and translation matrix to obtain the transformed associated model; Based on the transformed target model and the transformed association model, a target game scene is generated.
4. The game scene generation method according to claim 1, characterized in that, The step of generating an initial game scene based on the model position information corresponding to each 3D model in the preset modeling software includes: Based on the model position information corresponding to each 3D model in the preset modeling software, an initial model corresponding to each 3D model is created in the preset scene; Based on the environment configuration information corresponding to each 3D model in the preset modeling software, each initial model is rendered to generate an initial game scene.
5. The game scene generation method according to claim 4, characterized in that, The step of rendering each initial model according to the environment configuration information corresponding to each 3D model in the preset modeling software to generate an initial game scene includes: Extract the position matrix, Z-axis orientation, and focal length of each camera in the preset modeling software to obtain scene camera configuration information; Extract the color temperature, RGB and orientation information of each light in the preset modeling software to obtain scene lighting configuration information; Extract the material information and physical rendering parameters corresponding to each 3D model in the preset modeling software to obtain the model configuration information; The initial model is rendered based on the scene camera configuration information, the scene lighting configuration information, and the model configuration information to generate the initial game scene.
6. The game scene generation method according to claim 1, characterized in that, The step of generating an initial game scene based on the model position information corresponding to each 3D model in the preset modeling software includes: Obtain the scene resource space occupied by the initial modeling scene in the preset modeling software; If the space occupied by the scene resources is greater than the preset space threshold, then the initial game scene is generated based on the model position information corresponding to each 3D model in the initial modeling scene.
7. The game scene generation method according to any one of claims 1 to 6, characterized in that, The preset modeling software is one of 3DMax, Maya, or AutoCAD, and the game engine is one of Unreal Engine or Unity Engine.
8. A game scene generation device, characterized in that, The device, located within the game engine, includes: The generation module is used to parse the 3D models in the preset modeling software and generate a first format file containing model position information and a second format file containing the hierarchical relationship between the 3D models; the first format file is an FBX format file and the second format file is an XML format file; an initial game scene is generated according to the model position information corresponding to each 3D model in the preset modeling software; the initial game scene contains an initial model corresponding to each 3D model respectively; The reading module is used to read the hierarchical relationship between the three-dimensional models from the preset modeling software in response to the model modification command of the target model in the initial model; A determining module is used to determine the associated model corresponding to the target model from the initial model based on the hierarchical relationship; The modification module is used to modify the target model and the associated model in the initial game scene according to the model modification instruction to obtain the target game scene; The step of generating an initial game scene based on the model position information corresponding to each 3D model in the preset modeling software includes: Read the model position information from the first format file to generate the initial game scene; The step of responding to a model modification instruction for the target model in the initial model by reading the hierarchical relationship between the three-dimensional models from the preset modeling software includes: In response to a model modification instruction for the target model in the initial model, the hierarchical relationship between the three-dimensional models is read from the second format file.
9. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps of the game scene generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to perform the steps of the game scene generation method according to any one of claims 1 to 7.