Virtual scene generation method and device, computer equipment and storage medium
By obtaining the configuration parameters in the user configuration file, the virtual scenes are generated automatically, which solves the problem of inefficient virtual scene generation in the existing technology, and achieves fast and efficient and diversified virtual scene generation.
Patent Information
- Application Number
- CN202510247123.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-03-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to quickly and efficiently generate diverse virtual three-dimensional scenes, and the manual creation process is inefficient, which cannot meet the need to quickly generate a large number of different virtual scenes.
By obtaining the configuration file specified by the user, reading the configuration parameters in the configuration file. The configuration file is a default configuration file or a custom configuration file uploaded by the user, and determining the initial virtual scene and virtual objects and roles based on the scene, object and role parameters, realizing automated virtual scene generation.
It improves the generation efficiency of virtual scenes and realizes flexible scenario expansion. Users can quickly generate high-quality virtual scenes to meet the needs of different application scenarios.
Smart Images

Figure CN119722963A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method, device, computer equipment and storage medium for generating a virtual scene. Background Art
[0002] Virtual 3D scene construction refers to the creation and presentation of a virtual environment with a sense of 3D through computer technology and graphics principles. It can be applied in application scenarios such as game development, virtual reality applications, augmented reality applications, and simulation training. One of the important challenges of virtual 3D technology is to create virtual scenes efficiently and quickly. It requires the support of rapid prototyping of diverse scenes from simple to complex, from abstract to concrete, to adapt to the changing needs of different application scenarios. At the same time, in order to provide a richer and more varied user experience, the ability to clearly and conveniently randomly generate and initialize virtual scenes becomes particularly important. This not only means that a variety of environmental layouts need to be automatically generated according to preset rules or user input, but also that the initial state of these scenes needs to be set reasonably to facilitate subsequent interaction and exploration.
[0003] In the related art, object models are usually created manually through 3D modeling software, and then texture mapping, lighting and shadows are added to the object models to generate 3D virtual scenes. However, this method requires generating virtual scenes one by one, which is inefficient and cannot meet the needs of quickly generating a large number of different virtual scenes.
[0004] Therefore, how to realize an efficient, flexible and scalable virtual scene generation method is a problem that needs to be solved urgently in this field. Summary of the invention
[0005] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes a method, device, computer equipment and storage medium for generating a virtual scene to improve the generation efficiency of the virtual scene and enable flexible expansion.
[0006] In a first aspect, the present application provides a method for generating a virtual scene, the method comprising: Obtain a configuration file specified by a user, and read configuration parameters in the configuration file; the configuration file is a default configuration file or a custom configuration file uploaded by a user, and the configuration parameters include at least scene parameters, object parameters, and role parameters; Determining an initial virtual scene and scene restriction conditions in the initial virtual scene based on the scene parameters; Under the constraints of the scene restriction condition, determining a virtual object to be added to the initial virtual scene based on the object parameters; Determining a virtual character to be generated based on the initial virtual scene with virtual objects added thereto and the character parameters; A target virtual scene is generated by rendering based on the initial virtual scene, the virtual objects and the virtual character.
[0007] In the above technical solution, by obtaining the configuration file specified by the user and reading the configuration parameters in the configuration file, the configuration file is a default configuration file or a custom configuration file uploaded by the user, so that the generation of the virtual scene is highly flexible and easy to use. The user can choose the default configuration to quickly generate the scene, or upload a custom configuration to achieve personalized needs; the configuration parameters include at least scene parameters, object parameters and role parameters. In other words, the complex creation process of the virtual scene is modularized and divided into three major parts: scene, object and role, ensuring the standardization of parameters of the three core elements of scene, object and role, thereby providing complete and accurate basic data for the subsequent generation process; then, based on the scene parameters, the initial virtual scene and the scene restrictions in the initial virtual scene are determined, and the initial scene framework is determined through the scene parameters to provide objects in the scene with a complete and accurate basic data. The addition of entities and characters provides a carrier to ensure the integrity and consistency of the scene, while the introduction of scene restrictions effectively avoids logical conflicts in the arrangement of virtual objects or characters, and improves the rationality and realism of the generated scene; under the constraints of scene restrictions, the virtual objects added to the initial virtual scene are determined based on the object parameters, and then the virtual characters to be generated are determined based on the initial virtual scene with the virtual objects added and the character parameters, which can automatically complete complex object and character arrangement tasks and improve generation efficiency and intelligence; finally, based on the initial virtual scene, virtual objects and virtual characters, the target virtual scene is rendered and generated, the content in the configuration file specified by the user is restored, and a functionally complete and beautiful virtual scene is provided, so that users can not only realize personalized needs, but also quickly generate high-quality virtual scenes to meet the needs of different application scenarios.
[0008] The above virtual scene generation method, by providing a unified configuration file parsing solution, is compatible with various virtual platforms such as UE, Unity and Omniverse, and has strong expansion capabilities. In addition, the virtual scene generation framework based on the above embodiment has good expansion capabilities. Users only need to modify the configuration file to update the scene without adjusting the core algorithm or service. Regardless of scene generation, storage or restoration, each module implements standardized operations through relationship configuration files to ensure high consistency of the generated results and restoration effects.
[0009] According to one embodiment of the present application, the initial virtual scene includes multiple sub-scenes, and when at least one of the virtual object and the virtual character is placed in the initial virtual scene, it is placed in each sub-scene in sequence based on the priorities corresponding to the multiple sub-scenes.
[0010] In the above embodiment, by referencing the sub-scene priority, the placement of virtual objects and virtual characters is made more logical, and the random placement of virtual objects or virtual characters is prevented from causing scene confusion, thereby improving the rationality and aesthetics of the overall layout; and the user does not need to manually refine the distribution of objects and characters in each sub-scene, and the computer device can automatically complete the layout based on the priority, thereby simplifying the operation process and improving ease of use.
[0011] In a second aspect, the present application provides a device for generating a virtual scene, the device comprising: An acquisition module is used to acquire a configuration file specified by a user and read configuration parameters in the configuration file; the configuration file is a default configuration file or a custom configuration file uploaded by a user, and the configuration parameters include at least scene parameters, object parameters and role parameters; A determination module, configured to determine an initial virtual scene and scene restriction conditions in the initial virtual scene based on the scene parameters; The determination module is further used to determine the virtual object added to the initial virtual scene based on the object parameters under the constraints of the scene restriction condition; The determination module is further used to determine the virtual character to be generated based on the initial virtual scene with the virtual object added and the character parameters; A generation module is used to render and generate a target virtual scene based on the initial virtual scene, the virtual object and the virtual character.
[0012] In the above technical solution, by obtaining the configuration file specified by the user and reading the configuration parameters in the configuration file, the configuration file is a default configuration file or a custom configuration file uploaded by the user, so that the generation of the virtual scene is highly flexible and easy to use. The user can choose the default configuration to quickly generate the scene, or upload a custom configuration to achieve personalized needs; the configuration parameters include at least scene parameters, object parameters and role parameters. In other words, the complex creation process of the virtual scene is modularized and divided into three major parts: scene, object and role, ensuring the standardization of parameters of the three core elements of scene, object and role, thereby providing complete and accurate basic data for the subsequent generation process; then, based on the scene parameters, the initial virtual scene and the scene restrictions in the initial virtual scene are determined, and the initial scene framework is determined through the scene parameters to provide objects in the scene with a complete and accurate basic data. The addition of entities and characters provides a carrier to ensure the integrity and consistency of the scene, while the introduction of scene restrictions effectively avoids logical conflicts in the arrangement of virtual objects or characters, and improves the rationality and realism of the generated scene; under the constraints of scene restrictions, the virtual objects added to the initial virtual scene are determined based on the object parameters, and then the virtual characters to be generated are determined based on the initial virtual scene with the virtual objects added and the character parameters, which can automatically complete complex object and character arrangement tasks and improve generation efficiency and intelligence; finally, based on the initial virtual scene, virtual objects and virtual characters, the target virtual scene is rendered and generated, the content in the configuration file specified by the user is restored, and a functionally complete and beautiful virtual scene is provided, so that users can not only realize personalized needs, but also quickly generate high-quality virtual scenes to meet the needs of different application scenarios.
[0013] In a third aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating a virtual scene as described in the first aspect above is implemented.
[0014] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for generating a virtual scene as described in the first aspect above.
[0015] In a fifth aspect, the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method for generating a virtual scene as described in the first aspect above.
[0016] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method for generating a virtual scene as described in the first aspect above.
[0017] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which: Figure 1 is a flowchart of a method for generating a virtual scene provided in some embodiments of the present application; Figure 2 It is a schematic diagram of a framework of parameters of a virtual character provided in some embodiments of the present application; Figure 3 is a flowchart of a method for generating a virtual scene provided in some other embodiments of the present application; Figure 4 It is a schematic diagram of a framework of a virtual scene generation process provided in some embodiments of the present application; Figure 5 is a schematic diagram of the structure of a virtual scene generation device provided in some embodiments of the present application; Figure 6 It is a schematic diagram of the structure of a computer device provided in some embodiments of the present application. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0020] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as those commonly understood by technicians in the technical field of this application; the terms used in this application and in the specification of the application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different users, rather than to describe a specific order or a primary and secondary relationship.
[0021] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0022] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", and "attached" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0023] The term "and / or" in this application is only a description of the association relationship of associated users, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated users are in an "or" relationship.
[0024] The term "multiple" as used in the present application refers to more than two (including two). Similarly, the term "multiple groups" refers to more than two groups (including two groups), and the term "multiple sheets" refers to more than two sheets (including two sheets).
[0025] The following is a detailed description of the method for generating a virtual scene provided by the embodiment of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0026] The method for generating a virtual scene provided in an embodiment of the present application may be executed by a computer device or a functional module or functional entity in the computer device that can implement the method for generating a virtual scene. The computer device may be a terminal device or a server. The method may be executed by the terminal device or the server, or may be executed in collaboration with the terminal device and the server.
[0027] The following describes the method for generating a virtual scene provided in an embodiment of the present application by taking a computer device as an example of an execution subject.
[0028] A virtual scene refers to a three-dimensional space environment simulated by computer technology, which can be a simulation, abstraction or fiction of the real world. This space environment includes various virtual objects and virtual characters. For example, the environment in the virtual scene includes but is not limited to at least one of the sky or land, and the land includes one or more environmental elements such as forests, hills, deserts, oceans, cities or ruins.
[0029] Virtual objects are objects created by computer programs and data in virtual scenes. The shape of virtual objects can be simple basic geometric shapes, such as a combination of basic geometric shapes such as cubes, spheres, cylinders, etc., or extremely complex irregular shapes. Virtual objects have material properties, such as metal texture, wood texture, or transparent glass texture. In some virtual scenes, virtual objects can also be given physical properties to simulate their behavior in the real world. For example, in a virtual scene driven by a physics engine, a virtual sphere can be given physical properties such as mass and elasticity, so that it can roll, bounce, collide with other objects and follow the laws of physics like a real sphere.
[0030] A virtual character is a user with life characteristics or behavioral performance created by computer technology in a virtual environment. It can simulate the appearance of humans, animals or other creatures, and can usually perform actions, display behaviors, and interact with the environment or users.
[0031] In some embodiments, the virtual character may be an embodied intelligent agent, or a user interacting with an embodied intelligent agent. Among them, the embodied intelligent agent can be divided into a general intelligent agent and a universal intelligent agent. The general intelligent agent only has skin and skeleton limbs, etc., and is provided with modal data input of multiple dimensions, such as visual data input or auditory data input. Compared with the general intelligent agent, the universal intelligent agent can be set to have a higher degree of intelligence, such as values, abilities, etc.
[0032] like Figure 1 As shown, the method for generating the virtual scene includes: steps 110 to 150.
[0033] Step 110, obtaining a configuration file specified by the user, and reading configuration parameters in the configuration file; the configuration file is a default configuration file or a custom configuration file uploaded by the user; the configuration parameters include at least scene parameters, object parameters and role parameters.
[0034] The configuration file refers to a file used to store virtual scene related settings and parameters. The configuration file records various information required to build and display virtual scenes in a specific format (such as XML, JSON, etc.), and is an important data source for virtual scene construction and presentation. The configuration file includes at least scene parameters, object parameters, and role parameters. The specific scene parameters, object parameters, and role parameters will be described later.
[0035] Specifically, the computer device obtains a configuration file specified by the user, and reads the configuration parameters in the configuration file, thereby extracting the configuration parameters related to the scene, the object, and the role respectively. The configuration parameters in the configuration file can be default parameters, or user-defined parameters, etc. In some embodiments, the configuration file is a default configuration file or a user-uploaded custom configuration file. For example, the user uploads a custom configuration file through a configuration page, and the custom configuration file describes the user-defined initial virtual scene. For another example, the user browses a plurality of default virtual scenes provided in the configuration page on the configuration page, and selects one of the default virtual scenes as the initial virtual scene.
[0036] Exemplarily, taking the computer device as a terminal device, obtaining the configuration file specified by the user includes: in response to the user's selection operation on any configuration file in the configuration list in the configuration page, determining the configuration file specified by the user; and / or, in response to the configuration identifier input by the user, calling the configuration file matching the configuration identifier from the server, and determining the called configuration file as the user-specified configuration file; the called configuration file includes the configuration file pre-uploaded to the server by the user through the preset interface. Exemplarily, the preset interface is, for example, a GRPC protocol interface, so as to achieve efficient and fast transmission of files.
[0037] In some embodiments, the initial virtual scene may be provided with a number of default virtual objects by default, such as one or more of walls, doors, floors, and ceilings.
[0038] In some embodiments, after specifying a configuration file, the user can modify or adjust the configurable items in the configuration file, thereby updating the configuration parameters in the configuration file. The configurable items are items that can be configured in the configuration file, such as the type, quantity, position, etc. of virtual objects or virtual characters. The user can modify the configurable items in the configuration file to achieve customized configuration of the virtual scene.
[0039] In some embodiments, the user can individually specify at least one of the scene model file, object model file, and role model file. For example, the user selects at least one of the scene model file, one or more object model files, and one or more role model files provided by default, or the user can also upload at least one of the scene model file, one or more object model files, and one or more role model files through a preset interface, and call the uploaded model file through at least one of the scene identifier, object identifier, and role identifier returned by the computer device. Exemplarily, the computer device provides a GRPC interface for uploading model files (for example, it can be a scene model file, an object model file, or a role model file, etc.). After the user uploads the model file through the interface, the computer device returns a model UID, and then the object can be loaded through the UID.
[0040] Step 120: Determine an initial virtual scene and scene restriction conditions in the initial virtual scene based on the scene parameters.
[0041] Among them, the scene parameters define the overall structure, boundary conditions and rules of the virtual scene, and are the core foundation for generating the virtual scene framework. Exemplarily, the scene parameters include but are not limited to one or more of basic attributes, visual and rendering settings, dynamic configuration options, etc. Among them, the basic attributes include but are not limited to scene identification (such as scene name), scene model (scene template or file path used, etc.) and scene boundaries (physical boundaries of the scene, such as length, width, height, etc.). Visual and rendering settings include but are not limited to scene camera parameters (such as initial camera position, viewing angle range, etc.), lighting conditions (such as light source type, light intensity, color, shadow range, etc. in the scene). Dynamic configuration options are optional, for example, you can set the interactive area (the area range where virtual characters and virtual objects can interact), the space occupation range that can be randomly generated in the scene, etc. (such as the random range of bookshelf objects is 3*3*2, etc.).
[0042] The computer device loads a default virtual scene model based on the scene parameters, generates an initial virtual scene, and determines the scene restriction conditions of the initial virtual scene. The default virtual scene model, for example, includes an empty room, including default virtual objects (such as walls, doors, floors, etc.). Alternatively, the default virtual scene model may also be a scene model of a park, a shopping mall, a forest, etc.
[0043] Among them, the scene restriction conditions are used to describe the configuration rules that objects in the scene need to follow during the addition process. Scene restriction conditions include, but are not limited to, space usage rules, etc. For example, the scene restriction conditions limit one or more configuration rules such as the distance requirements between objects (such as furniture and walls), and the available range in which objects can be placed in the initial virtual scene. For example, the scene restriction conditions restrict that walls cannot penetrate objects, furniture cannot be suspended in the air, etc. For another example, the scene restriction conditions can also restrict at least one of the scene whitelist or the scene blacklist, wherein the scene blacklist is used to record virtual objects that are prohibited from being added to the initial virtual scene, and the scene whitelist is used to provide virtual objects that can be added to the initial virtual scene. The scene blacklist and scene whitelist can be pre-configured or user-defined.
[0044] Thus, based on the scene restriction conditions, the computer device can automatically generate a virtual scene that meets the user's needs and has a reasonable layout. For example, if the configuration file specified by the user corresponds to an initial virtual scene of a room environment with two bedrooms and a living room, the computer device can generate an initial virtual scene according to the scene restriction conditions of the room environment, in which the distance between the sofa and the coffee table meets the preset distance requirements, and based on the available range of the objects that can be placed, these virtual objects will be reasonably placed in the corresponding room, such as the sofa and the coffee table will be placed in the living room instead of the kitchen, the stove will be placed in the kitchen instead of the balcony, and so on.
[0045] Moreover, when the scene restriction conditions are met, the computer device still maintains a certain degree of randomness when generating the virtual scene, thereby being able to flexibly generate a large number of different virtual scenes. For example, the distance between the sofa and the coffee table can be random if it meets the preset distance requirements; or the position of the sofa and the coffee table can be random, and so on.
[0046] Step 130 : Under the constraints of the scene restriction conditions, determine the virtual objects to be added to the initial virtual scene based on the object parameters.
[0047] Under the constraints of the scene constraints, the computer device generates virtual objects based on object parameters and in accordance with preset rules and adds them to the initial virtual scene. For example, the object parameters indicate the relevant parameters of a coffee table, such as size, color, material, etc. Under the constraints of the scene constraints, the coffee table should be set between the sofa and the TV by default, so the computer device determines a reasonable position through calculation and completes the adding operation.
[0048] Among them, object parameters describe the basic attributes, functional attributes, and relationships (i.e., relationship and position rules) of virtual objects with other virtual objects or scenes, and are the basis for constructing virtual objects in scene generation. Exemplarily, the basic attributes of object parameters include, but are not limited to, object identification (e.g., object name, etc.), object type, size attributes (specific size parameters such as width, height, and depth of the object), position attributes (including the position of the object in the scene (x, y, z), etc.), material attributes (including material type (such as metal, wood, plastic, etc.), color, texture mapping, etc.), and rotation attributes (such as rotation angle (yaw, pitch, roll), etc.) and one or more thereof.
[0049] Exemplarily, the functional attributes include one or more of the operability, edibility, and rigid body attributes of the virtual object. Operability refers to whether the virtual object can interact with the character (such as whether the door can be opened and closed). Edibility is used to describe whether the virtual object has attributes such as satiety value and thirst quenching value, and is usually used to describe attributes such as food and fruit. Rigid body attributes determine whether the object enables physical properties (such as gravity, collision, inertia, etc.).
[0050] Exemplarily, the relationship and position rules include, for example, the relative position of objects (such as a TV must be against a wall, a book must be placed in a bookshelf, etc.), position priority (referring to the area or room type that is given priority when placing, such as a coffee table is placed in the living room first, or a chair is placed near a table first, etc.), object group relationship, and object restriction conditions, etc. Among them, the object group relationship refers to the formation of a specific relationship group between a virtual object and other virtual objects, for example, TV A and remote control A are bound to the same group, TV B and remote control C, remote control D are bound to the same group, and so on. As a result, virtual objects can be quickly located in the subsequent search for objects or restoration of scenes.
[0051] The object restriction condition includes but is not limited to at least one of an object blacklist and an object whitelist. The object blacklist is used to record areas where objects cannot be placed, and the object whitelist records areas where objects can be placed. For example, the object blacklist records that plates are not allowed to appear on the table. The object blacklist and object whitelist can be pre-configured or user-defined.
[0052] Step 140: Determine the virtual character to be generated based on the initial virtual scene with virtual objects added and the character parameters.
[0053] The character parameters are used for the properties, behaviors, positions and relationships of the virtual character in the scene, and are the core basis for character generation. Figure 2As shown, the role parameters of the virtual character include but are not limited to one or more of the basic attributes, behavior parameters, functional attributes, relationship and position rules, etc. of the virtual character.
[0054] Among them, the basic attributes include but are not limited to one or more of the virtual character identification (such as the name of the virtual character, such as "Character 1", etc.), posture (including the character's initial position and orientation, etc., for example, standing next to the window and facing out of the window), appearance (referring to the character's appearance characteristics, including but not limited to hairstyle, facial features, height, body shape, etc., which can be achieved through skinning and bones, etc.), etc.
[0055] The behavior parameters include, but are not limited to, the default actions of the virtual character (such as standing, walking, sitting, etc.) and interactive actions (such as picking up objects, turning on and off lights, etc.). The default actions and interactive actions can be obtained from a pre-configured action library, for example.
[0056] Functional attributes include the configurable capabilities and rendering settings of the virtual character. Based on the configurable capabilities, the virtual characters can be divided into general characters and universal characters. General characters only have basic skinning and skeleton movements, while universal characters are additionally configured with one or more of the character's values, intelligent attributes, and decision-making capabilities, which are particularly suitable for the intelligent characters mentioned above. Rendering settings are, for example, the first-person or third-person rendering camera position and parameters set on the virtual character.
[0057] The relationship and position rules of virtual characters include, but are not limited to, one or more of relative positions and action restrictions. Relative position refers to the positional relationship between the virtual character and other objects or virtual characters when the virtual character is generated, such as the character sitting on the sofa, or 1 meter away from other characters. Action restrictions can be used to restrict the actions of virtual characters in specific scenes, including but not limited to limiting the actions that virtual characters can perform, limiting the position range when the action is performed, or limiting the actions that can be performed within a specific position range, etc. For example, the character cannot perform the action of climbing over the fence on the balcony, or the action of taking a shower in the living room, etc. For example, character 1 cannot perform action A, character 2 cannot perform action B, etc.
[0058] Therefore, through the clear definition of object parameters, character parameters and scene parameters, computer equipment can achieve efficient generation and rendering of virtual scenes while meeting diverse user needs.
[0059] Step 150: Render and generate a target virtual scene based on the initial virtual scene, virtual objects and virtual characters.
[0060] The computer device integrates the initial scene, virtual objects and virtual characters, and renders to generate a complete target virtual scene. The computer device can read the scene parameters, object parameters and character parameters in the configuration file, initialize the virtual engine, and add the virtual objects and virtual characters to the initial virtual scene to complete the rendering.
[0061] Among them, the virtual engine includes but is not limited to one or more of Unity, UE, Omniverse, etc.
[0062] Exemplarily, before rendering the target virtual scene, the computer device determines that all configurations and parameters are correctly loaded, and reads the configuration parameters, including scene parameters, object parameters, and character parameters. Then, the computer device can check the data integrity and validity to determine whether the data format and value range are reasonable and correct, whether the configuration parameters meet the configuration rules and restrictions, etc. After that, the computer device initializes the virtual rendering engine and renders the virtual objects and virtual characters respectively.
[0063] Exemplarily, the computer device adds the virtual object to the initial virtual scene based on the object parameters and under the constraints of the scene constraints, and completes the rendering. For example, if the absolute position is configured, the computer device directly places the object at the specified coordinates according to the absolute position. If the absolute position is not specified, the computer device generates the position based on the relative position rule or randomly. The computer device calculates the occupied space of the object to ensure that it does not collide with other objects. The computer device can also load preset materials, texture maps or color attributes for each object. If the random material option is configured, the computer device randomly selects from the candidate materials and decides whether to allow duplication according to the configuration. The computer device can also enable physical properties such as rigid body collision, gravity, inertia and other classical mechanical properties according to the object property configuration, and add corresponding event response mechanisms for objects with interactive functions (such as doors and switches). If the placement of the virtual object does not meet the expected position and relationship or there is a conflict, the computer device returns an error prompt or readjusts the object layout, etc.
[0064] Exemplarily, the computer device generates and renders a virtual character according to the character parameter configuration. Among them, the computer device can calculate the character posture, calculate the initial coordinates and orientation of the character according to the relative position description or random generation rules in the character configuration, and ensure that the character position does not conflict with the configuration rules or restrictions (such as the character cannot be suspended or through the wall). In addition, the computer device performs appearance rendering of the virtual character, loads the character skin, skeleton model and appearance features (such as hairstyle, facial features, clothing, etc.). If random features (such as hairstyle or clothing color) are configured, the computer device randomly generates according to the selected probability distribution. Afterwards, the computer device can initialize the character state, such as setting the initial state of the character (such as satiety value, desire value), configuring the character action library and perception ability (such as visual camera, hearing range). Finally, the computer device verifies the character rendering effect, checks whether the character meets the configuration requirements, such as whether the posture, orientation, appearance features, etc. are correct, or ensures the relationship between the character and the scene objects (such as whether the character is standing in the correct position), etc.
[0065] Exemplarily, the computer device integrates the initial virtual scene, virtual objects and virtual characters to complete the final rendering of the target virtual scene. The computer device can generate the final 3D scene output by calling the API of the rendering engine. The computer device can also adjust the rendering details (such as the number of polygons, texture resolution) according to performance requirements, such as optimizing scene loading time and rendering efficiency (such as reducing the number of polygons, merging texture maps), or dynamically adjusting the rendering accuracy of near and far objects through LOD (level of detail) technology, etc.
[0066] Finally, the computer device saves the target virtual scene as a rendering result (such as a 3D scene file). If it is a real-time application, the computer device can also start dynamic rendering, and the user can interact with the scene instantly.
[0067] In some embodiments, the computer device calls an interface to store the generated virtual scene as a relationship configuration file. The file records in detail the properties, positions, and operation history of the objects and characters in the scene. Later, when the user chooses to restore the scene, the computer device can parse the stored relationship configuration file, generate the objects and characters in the virtual scene one by one, and place them in the corresponding positions, and finally restore the complete virtual scene.
[0068] The method for generating a virtual scene provided in an embodiment of the present application obtains a configuration file specified by a user and reads configuration parameters in the configuration file. The configuration file is a default configuration file or a custom configuration file uploaded by the user, so that the generation of the virtual scene is highly flexible and easy to use. The user can choose the default configuration to quickly generate the scene, or realize personalized needs by uploading a custom configuration; the configuration parameters include at least scene parameters, object parameters and role parameters. In other words, the complex creation process of the virtual scene is modularized and divided into three major parts: scene, object and role, to ensure the standardization of parameters of the three core elements of scene, object and role, thereby providing complete and accurate basic data for the subsequent generation process; thereafter, the initial virtual scene and the scene restriction conditions in the initial virtual scene are determined based on the scene parameters, and the initial scene framework is determined through the scene parameters. , providing a carrier for adding objects and characters to the scene, ensuring the integrity and consistency of the scene, and the introduction of scene restrictions effectively avoids logical conflicts in the arrangement of virtual objects or characters, and improves the rationality and realism of the generated scene; under the constraints of scene restrictions, the virtual objects added to the initial virtual scene are determined based on the object parameters, and then the virtual characters to be generated are determined based on the initial virtual scene with the virtual objects added and the character parameters, which can automatically complete complex object and character arrangement tasks and improve generation efficiency and intelligence; finally, based on the initial virtual scene, virtual objects and virtual characters, the target virtual scene is rendered and generated, the content in the configuration file specified by the user is restored, and a functionally complete and beautiful virtual scene is provided, so that users can not only realize personalized needs, but also quickly generate high-quality virtual scenes to meet the needs of different application scenarios.
[0069] The above-mentioned method for generating virtual scenes, by providing a unified configuration file parsing solution, can be compatible with various virtual platforms such as UE, Unity and Omniverse, and has strong expansion capabilities. In addition, based on the configuration and relationship-based scene generation and reconstruction algorithm and generation framework in the above-mentioned embodiment, it has good expansion capabilities. Users only need to modify the configuration file to update or add new model files without adjusting the core algorithm or service. Regardless of scene generation, storage or restoration, each module implements standardized operations through the relationship configuration file, and based on the relationship expression of virtual objects in the configuration parameters, it can realize the relationship reasoning and random generation of objects in the scene, greatly improving the generation efficiency and the richness of the generated scene.
[0070] In some embodiments, the scene parameters include at least a scene identifier and a scene camera position; determining the initial virtual scene based on the scene parameters includes: determining an initial display perspective based on the scene camera position; acquiring scene data that matches the scene identifier, and generating an initial virtual scene displayed at the initial display perspective based on the scene data.
[0071] Specifically, the computer device can determine the scene environment to be generated based on the scene identification, such as urban street scenes, home interiors, etc. In virtual scene generation technology, the scene identification and display perspective directly affect the generation effect of the virtual environment and the user experience. In traditional methods, the loading of scene data and the setting of perspective lack flexibility and intelligence, and users often need to manually adjust the perspective, which takes a lot of time. Therefore, the present application also configures the scene camera position to define the initial display camera position, including one or more of the camera's coordinates (x, y, z), orientation (pitch, yaw, roll) and focal length.
[0072] Then, the computer device calculates the initial display angle according to the scene camera position parameters. And, according to the scene identifier, the computer device retrieves the scene data matching the identifier from the scene database. The scene data may include a variety of model files (such as FBX, OBJ) and texture data (such as PNG, JPG), etc. Thus, the computer device can obtain the initial virtual scene based on the scene data and the initial display angle. For example, the rendering engine loads key objects according to the display angle determined by the scene camera position to ensure that the user sees the core area or important objects in the initial screen.
[0073] In the above embodiment, by calculating the initial display perspective based on the scene camera position, it is ensured that the user can see the key areas or important objects immediately after the virtual scene is loaded, without the need to adjust the perspective, thereby optimizing the user experience; and the scene identification matching mechanism enables the computer device to quickly retrieve and load the corresponding scene data, reducing the loading time and improving the generation efficiency. The embodiment of the present application supports adding new scenes by extending the scene identification and data matching, such as users custom uploading scene model files and obtaining the scene identification returned by the background, which can meet the user's custom needs.
[0074] In virtual scene construction, it is usually necessary to introduce rule restrictions to ensure the coordination between the added virtual objects and the overall structure of the scene. The setting of scene restriction conditions can effectively avoid the addition of unreasonable objects, thereby ensuring the consistency and logic of the scene. At the same time, the position attribute of the object is an important parameter for the interaction between the object and the scene. Reasonable object placement can enhance the realism of the scene and the user experience.
[0075] To this end, in some embodiments, under the constraints of scene restrictions, the virtual objects to be added to the initial virtual scene are determined based on object parameters, including: based on the constraints of the scene restrictions, determining at least one of a scene whitelist or a scene blacklist corresponding to the initial virtual scene; the scene blacklist is used to record virtual objects that are prohibited from being added to the initial virtual scene, and the scene whitelist is used to provide virtual objects that can be added to the initial virtual scene; under the constraints of at least one of the scene whitelist or the scene blacklist, based on the configured object type, randomly determining the target virtual object to be added to the initial virtual scene; based on the position attribute, determining the placement position of the target virtual object in the initial virtual scene.
[0076] Specifically, the computer device can randomly select target objects from the scene whitelist based on the scene whitelist, and these target objects need to belong to the configured object category. For example, randomly select a sofa or a coffee table in a home scene. Alternatively, the computer device can also use a scene blacklist to randomly select target objects from the category after excluding objects in the scene blacklist. For example, randomly select other available objects after excluding industrial machinery in a home scene. The scene whitelist and the scene blacklist can be used separately or simultaneously.
[0077] After selecting the virtual object to be added, the computer device determines the specific position of the virtual object in the scene based on the position attribute in the object parameters. For example, in a living room scene, the coffee table is placed in front of the sofa, 50 cm away from the edge of the sofa; in an office scene, the chair is placed behind the desk, with the center points aligned, and so on.
[0078] In the above embodiments, by defining a scene whitelist or blacklist, adding virtual objects that conflict with the scene logic or aesthetics can be avoided, thereby ensuring the overall rationality and coordination of the scene; and, by a randomized object selection mechanism based on scene constraints, a variety of scene layouts can be generated, increasing the richness and randomness of the virtual scene; furthermore, based on position attributes and scene constraints, the placement position of the target virtual object can be accurately determined, reducing the time waste caused by manual position adjustment, while improving the realism of the scene.
[0079] In a virtual scene, the placement of objects has an important impact on the realism and logic of the scene. The position attributes of an object can be divided into two types: absolute position and relative position. The absolute position clearly specifies the position of an object in the scene through predefined coordinates, while the relative position needs to be dynamically calculated based on the existing positions of other objects. To this end, in some embodiments, based on the position attribute, the placement position of the target virtual object in the initial virtual scene is determined, including: when the position attribute indicates the absolute position of the object, the target virtual object is placed at the absolute position in the initial virtual scene.
[0080] Specifically, the computer device determines whether the configured position attribute indicates an absolute position or a relative position. If it is an absolute position, the computer device places the target virtual object at the corresponding position of the initial virtual scene. For example, if the computer device determines that the absolute position of the sofa is (10,5,0), the sofa is directly placed at the coordinates (10,5,0) in the scene.
[0081] In the case where the position attribute indicates the relative position of the object, the computer device determines at least one virtual object that has a matching relationship with the target virtual object among the virtual objects that have been added in the initial virtual scene; determines the object placeable range of the target virtual object based on the placement position of the at least one virtual object in the initial virtual scene; and randomly places the target virtual object within the object placeable range.
[0082] There may be a matching relationship between virtual objects, and the matching relationship may be the object group relationship in the aforementioned embodiment, that is, a virtual object forms a specific relationship group with other virtual objects, such as TV A and remote control A are in the same group. Alternatively, the matching relationship may be a pre-configured matching relationship, such as a matching relationship between a coffee table and a sofa, a matching relationship between a table and a chair, etc.
[0083] For example, the computer device confirms that the attribute of the coffee table is a relative position, and searches for virtual objects placed in the scene to find a sofa that matches the coffee table. The computer device calculates the placement range of the coffee table based on the placement position and size of the sofa. For example, the position range of the coffee table is a 50*20*10 space range in front of the sofa, then the placement range of the coffee table can be, for example: x∈[10,14], y∈[5,7], z=0. Within this placement range, the computer device can randomly select a specific position to place the coffee table, such as (12,6,0). In addition, the position of the coffee table can be random, such as facing the sofa, or rotated at a certain angle, etc.
[0084] In the above embodiment, by separately processing the absolute position and the relative position, flexible and diverse object placement requirements are achieved. In the case of absolute position, the object can be accurately placed at the position specified by the user to meet the scene requirements for a fixed layout. In the case of relative position, calculations are performed based on the layout of existing objects in the scene to ensure that the placement of new objects complies with the scene logic and space constraints, thereby improving the rationality of scene generation. In addition, by randomly selecting specific positions, the diversity of scene generation is increased to avoid scene monotony caused by a single layout.
[0085] The existing virtual objects that match the virtual object to be placed may be one or more. To this end, in some embodiments, based on the placement position of at least one virtual object in the initial virtual scene, determining the placement range of the target virtual object includes: determining the pre-configured priority of at least one virtual object respectively; determining the virtual object with the highest priority among the at least one virtual object, and determining the placement range of the target virtual object based on the placement position of the virtual object with the highest priority in the initial virtual scene.
[0086] Specifically, the computer device selects the virtual object with the highest priority according to the priorities of the existing virtual objects that match the target virtual object, determines its placement position in the initial virtual scene, and further determines the placement range of the target virtual object based on the placement position.
[0087] For example, the computer device reads the priority of the virtual object and determines that the virtual objects matching the target virtual object floor lamp are sofa and TV cabinet, among which the sofa has the highest priority. Then the computer device calculates the placement range of the floor lamp based on the placement position of the virtual object with the highest priority (sofa): in front of the sofa or in the left and right sides. Then the computer device can randomly place the floor lamp in front of the sofa or in the left and right sides.
[0088] In the above embodiment, through the setting of priority, the placement range of the target object can be dynamically adjusted according to different scene requirements and priority settings to adapt to diverse layout requirements. It is suitable for complex scenes with multiple objects and multiple priorities. By gradually defining the placement range, the conflict problem in the complex layout is solved, and unnecessary placement calculations can be reduced, the placement range of the target object can be quickly determined, and the scene generation efficiency is improved.
[0089] In the process of generating virtual scenes, the reasonable placement and posture configuration of characters are important links that affect the authenticity and logic of the scene. To this end, through the relative position definition in the character parameters, the placement position of the character can be associated with the position of the virtual objects that already exist in the scene, thereby ensuring that the generation of the character meets the scene requirements. For example, in the scene, the character needs to "stand by the table" or "sit on the sofa". By reading the placement position of the virtual object and its relative relationship parameters with the character, the placement range of the character is dynamically generated, and combined with the specific posture, the precise placement of the character is finally achieved. As a result, not only the efficiency of scene generation is improved, but also the rationality of the virtual scene and the user experience are enhanced.
[0090] To this end, in some embodiments, the character parameters include the relative position of the character; based on the initial virtual scene with the virtual objects added and the character parameters, the virtual character to be generated is determined, including: based on the placement position and relative position parameters of the virtual objects in the initial virtual scene with the virtual objects added, the character placement range of the virtual character is determined; within the character placement range, the posture of the virtual character is determined; and the virtual character is placed within the character placement range according to the posture.
[0091] Specifically, the computer device reads the parameters of virtual objects in the scene, such as the position and orientation of a sofa. Based on the "relative position of the character" setting in the character parameters, such as "sitting on the sofa", the computer device dynamically calculates the character's placement range, such as the plane range of the sofa seat, according to the relationship between the position of the sofa and the orientation of the character. Thus, within this preventable range, the computer device calculates the character's posture data, including the character's coordinate position and orientation, based on the character's default posture (such as "sitting posture") or the posture parameters specified by the user. If the posture is not specified, the computer device can randomly select a posture that meets the placement requirements.
[0092] In the above embodiment, by parsing the relative position parameters of the character and the placement position of the virtual object, the placement range and posture of the virtual character can be automatically generated, thereby improving the efficiency of scene generation, and based on the relationship parameters between the placement position of the virtual object and the character, the rationality of the character placement is ensured; at the same time, the user can customize the relative position and posture of the character, and the computer device is allowed to automatically generate default parameters to adapt to the needs of diverse application scenarios.
[0093] In related virtual scene generation technologies, the placement of objects and characters is usually based on a unified plan of the global scene, lacking detailed management of scene partitions, which may lead to uneven resource distribution or irrational logic. To this end, in some embodiments, the initial virtual scene includes multiple sub-scenes, and when at least one of the virtual objects and virtual characters is placed in the initial virtual scene, it is placed in each sub-scene in turn based on the priorities corresponding to the multiple sub-scenes.
[0094] That is, the initial virtual scene is divided into multiple sub-scenes, and each sub-scene is assigned a corresponding priority. When adding virtual objects or characters, the computer device places them in order according to the priority order of each sub-scene, ensuring that the scene layout is more reasonable, coordinated and in line with user expectations.
[0095] Exemplarily, the computer device divides the initial virtual scene into multiple sub-scenes, for example: sub-scene 1: living room area, sub-scene 2: kitchen area, sub-scene 3: bedroom area, sub-scene 4: outdoor garden. The computer device sets a priority for each sub-scene, for example: living room (highest priority) > kitchen > bedroom > outdoor garden. When the computer device places virtual objects or virtual characters, take the placement of virtual objects as an example, for example, object A is a TV, the object type is living room furniture, object B is a refrigerator, the object type is kitchen furniture, object C is a book, the object type is a general object, and it can be placed in multiple sub-scenes. Then the computer device places them in order according to the object category and scene priority, first placing the TV (object A) in sub-scene 1 (living room) and arranging it close to the wall, placing the refrigerator (object B) in sub-scene 2 (kitchen) and close to the power socket, and then placing the book (object C) by default on the bookshelf of sub-scene 1 (living room) with the highest priority; if the bookshelf is full, it is placed on the bedside table of sub-scene 3 (bedroom), and so on. The placement of virtual characters is similar. If there is insufficient space in a high-priority sub-scene, the computer device will reallocate objects or characters according to the sub-priority to avoid problems such as stacking and crowding of objects or characters in the scene, thus improving the intelligence of virtual scene generation. For example, if a sub-scene has a high priority but a book cannot be placed on the bookshelf in the living room, it will be automatically moved to the bedroom.
[0096] In the above embodiment, by introducing sub-scenes and their priorities, the placement of virtual objects and characters is made more logical, preventing random placement of objects or characters from causing scene confusion, and improving the rationality and aesthetics of the overall layout. In addition, the user does not need to manually refine the distribution of objects and characters in each sub-scene, and the computer device can automatically complete the layout based on the priority, simplifying the operation process and improving ease of use.
[0097] In a specific embodiment, scene creation may include single-step creation of virtual objects / virtual characters and complete creation of virtual scenes. In single-step creation of virtual objects / virtual characters, users can customize the properties of virtual objects / virtual characters, such as position, size, color, etc., and the computer device generates the corresponding virtual objects / virtual characters according to the user input. In complete creation of virtual scenes, users can select preset scene templates or custom scenes, and the computer device automatically generates the entire virtual scene. Afterwards, the computer device saves the virtual scene and its properties as a data file of relational virtual object properties and postures, and the file content includes a virtual object property set and scene operation steps, wherein the virtual object property set includes object name, position, size, color and other properties, and the scene operation steps record a series of operations in the process of creating the scene, which is used to restore the scene. When the scene needs to be restored, the computer device can read the configuration file and restore the virtual scene according to the file content. For example, the computer device parses the virtual object properties and operation steps in the file, generates virtual objects one by one and places them in the corresponding positions.
[0098] For example, Figure 3 As shown in the figure, the virtual scene generation process includes the following modules: scene configuration, role configuration, object configuration, calculation and rendering, etc. In the process of scene configuration, users can choose to upload a custom scene file to define the overall framework of the virtual scene, and select the scene type, that is, select a suitable scene from the predefined scene types (for example, city, forest, room, etc.). At the same time, users can configure scene parameters and set specific parameters related to the scene, such as scene size, lighting effects or camera position, etc.
[0099] In the process of configuring a character, the user can upload a character model file, such as a 3D model file of a character, to customize the character's appearance. In addition, the user can configure the character parameters and associations to define the character's behavior, appearance, or association parameters with the scene. Finally, the user selects the character to join the scene, which means that the configured character is loaded into the specified virtual scene.
[0100] In the process of configuring virtual objects, users can upload 3D model files of virtual objects to enrich the scene content. In addition, users can configure object parameters and associations, and set relevant parameters of objects, such as the type, size, and position attributes (absolute position or relative position) of the object. Finally, users select objects to add to the scene and add the configured objects to the appropriate positions of the virtual scene.
[0101] After that, the computer device performs the configuration, that is, integrates the parameters of the scene, role, and virtual object to complete the final configuration. The computer device first parses the configuration parameters, calculates and generates the scene, then calculates and generates the virtual role, then calculates and generates the virtual object, and finally calls the virtual engine to load the virtual scene model to generate a complete virtual world model containing the scene, role, and object. Thus, the overall process connects the scene configuration, role configuration, object configuration, and calculation generation into a closed loop, supporting full-link operations from basic configuration to virtual world generation.
[0102] In the above process, the generation and creation of virtual scenes is divided into three parts, namely, the character creation part, the object creation part and the scene creation part. Figure 4 As shown, virtual characters can include general characters and universal characters, and virtual objects can be uploaded by users, or selected by users as object models with default configurations. Virtual objects can be divided into edible objects, operable objects, and general objects, etc. Scenes can also be uploaded by users, or selected by users as scene models with default configurations.
[0103] The virtual scene generation method provided in the embodiment of the present application can be executed by a virtual scene generation device. In the embodiment of the present application, the virtual scene generation device executing the virtual scene generation method is taken as an example to illustrate the virtual scene generation device provided in the embodiment of the present application.
[0104] The present application also provides a virtual scene generation device, which is applied to a computer device. Figure 5 As shown, the virtual scene generation device includes an acquisition module 501, a determination module 502 and a generation module 503. Among them: The acquisition module 501 is used to acquire the configuration file specified by the user and read the configuration parameters in the configuration file; the configuration file is a default configuration file or a custom configuration file uploaded by the user, and the configuration parameters at least include scene parameters, object parameters and role parameters.
[0105] The determination module 502 is used to determine the initial virtual scene and the scene restriction conditions in the initial virtual scene based on the scene parameters.
[0106] The determination module 502 is further configured to determine the virtual objects to be added to the initial virtual scene based on the object parameters under the constraints of the scene restriction conditions.
[0107] The determination module 502 is further used to determine the virtual character to be generated based on the initial virtual scene with the virtual objects added and the character parameters.
[0108] The generation module 503 is used to render and generate a target virtual scene based on the initial virtual scene, virtual objects and virtual characters.
[0109] According to the virtual scene generation device provided by the embodiment of the present application, by obtaining a configuration file specified by the user and reading the configuration parameters in the configuration file, the configuration file is a default configuration file or a custom configuration file uploaded by the user, so that the generation of the virtual scene is highly flexible and easy to use. The user can choose the default configuration to quickly generate the scene, or realize personalized needs by uploading a custom configuration; the configuration parameters include at least scene parameters, object parameters and role parameters. In other words, the complex creation process of the virtual scene is modularized and divided into three major parts: scene, object and role, ensuring the parameter standardization of the three core elements of scene, object and role, thereby providing complete and accurate basic data for the subsequent generation process; thereafter, the initial virtual scene and the scene restriction conditions in the initial virtual scene are determined based on the scene parameters, and the initial scene frame is determined by the scene parameters. The framework provides a carrier for adding objects and characters to the scene, ensuring the integrity and consistency of the scene, and the introduction of scene restrictions effectively avoids logical conflicts in the arrangement of virtual objects or characters, and improves the rationality and realism of the generated scene; under the constraints of scene restrictions, the virtual objects added to the initial virtual scene are determined based on the object parameters, and then the virtual characters to be generated are determined based on the initial virtual scene with the virtual objects added and the character parameters, which can automatically complete complex object and character arrangement tasks and improve the generation efficiency and intelligence; finally, based on the initial virtual scene, virtual objects and virtual characters, the target virtual scene is rendered and generated, the content in the configuration file specified by the user is restored, and a functionally complete and beautiful virtual scene is provided, so that users can not only realize personalized needs, but also quickly generate high-quality virtual scenes to meet the needs of different application scenarios.
[0110] In some embodiments, the scene parameters include at least a scene identifier and a scene camera position; the determination module is also used to determine an initial display perspective based on the scene camera position; obtain scene data matching the scene identifier, and generate an initial virtual scene displayed at the initial display perspective based on the scene data.
[0111] In some embodiments, the object parameters include at least the object type and the position attribute; the determination module is further used to determine at least one of the scene whitelist or the scene blacklist corresponding to the initial virtual scene based on the constraints of the scene restriction conditions; the scene blacklist is used to record virtual objects that are prohibited from being added to the initial virtual scene, and the scene whitelist is used to provide virtual objects that can be added to the initial virtual scene; under the constraints of at least one of the scene whitelist or the scene blacklist, the target virtual object to be added to the initial virtual scene is randomly determined based on the configured object type; based on the position attribute, the placement position of the target virtual object in the initial virtual scene is determined.
[0112] In some embodiments, the position attribute includes an absolute position of an object and a relative position of an object; the determination module is further used to place the target virtual object at an absolute position in the initial virtual scene when the position attribute indicates the absolute position of the object; when the position attribute indicates the relative position of the object, determine at least one virtual object that has a matching relationship with the target virtual object among the virtual objects added in the initial virtual scene; determine an object placeable range of the target virtual object based on the placement position of at least one virtual object in the initial virtual scene; and randomly place the target virtual object within the object placeable range.
[0113] In some embodiments, the determination module is further used to respectively determine the pre-configured priority of at least one virtual object; determine the virtual object with the highest priority among the at least one virtual object, and determine the placement range of the target virtual object based on the placement position of the virtual object with the highest priority in the initial virtual scene.
[0114] In some embodiments, the character parameters include the relative position of the character; the determination module is also used to determine the character placement range of the virtual character based on the placement position and relative position parameters of the virtual objects in the initial virtual scene to which the virtual objects are added; within the character placement range, determine the posture of the virtual character; and place the virtual character within the character placement range according to the posture.
[0115] In some embodiments, the initial virtual scene includes multiple sub-scenes, and when at least one of the virtual objects and virtual characters is placed in the initial virtual scene, it is placed in each sub-scene in sequence based on the priorities corresponding to the multiple sub-scenes.
[0116] The generation device of the virtual scene in the embodiment of the present application can be a computer device, or a component in the computer device, such as an integrated circuit or a chip. The computer device can be a terminal device or a server. Exemplarily, the computer device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted computer device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (Ultra-mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (Personal Computer, PC), a television (Television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0117] The virtual scene generation device in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0118] The virtual scene generation device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0119] In some embodiments, Figure 6 As shown, the embodiment of the present application also provides a computer device 600, including a processor 601, a memory 602, and a computer program stored in the memory 602 and executable on the processor 601. When the program is executed by the processor 601, each process of the above-mentioned method embodiments is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0120] It should be noted that the computer device in the embodiment of the present application includes the mobile computer device and the non-mobile computer device mentioned above.
[0121] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned virtual scene generation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0122] The processor is the processor in the computer device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0123] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned method for generating a virtual scene when executed by a processor.
[0124] The processor is the processor in the computer device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0125] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned virtual scene generation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0126] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0127] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0129] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0130] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0131] Unless otherwise specified, all embodiments and optional embodiments of the present application can be combined with each other to form a new technical solution.
[0132] Unless otherwise specified, all technical features and optional technical features of this application can be combined with each other to form a new technical solution.
[0133] If there is no special explanation, all steps of the present application can be performed sequentially or randomly, preferably sequentially. For example, the method includes steps (a) and (b), which means that the method may include steps (a) and (b) performed sequentially, or may include steps (b) and (a) performed sequentially. For example, it is mentioned that the method may also include step (c), which means that step (c) can be added to the method in any order. For example, the method may include steps (a), (b) and (c), or may include steps (a), (c) and (b), or may include steps (c), (a) and (b), etc.
[0134] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for generating a virtual scene, characterized in that: The method comprises: Obtain a configuration file specified by a user, and read configuration parameters in the configuration file; the configuration file is a default configuration file or a custom configuration file uploaded by a user, and the configuration parameters include at least scene parameters, object parameters, and role parameters; Determine an initial virtual scene and scene restriction conditions in the initial virtual scene based on the scene parameters; Under the constraints of the scene restriction condition, determining a virtual object to be added to the initial virtual scene based on the object parameters; Determining a virtual character to be generated based on the initial virtual scene with virtual objects added thereto and the character parameters; A target virtual scene is generated by rendering based on the initial virtual scene, the virtual objects and the virtual character.
2. The method according to claim 1, characterized in that The scene parameters include at least a scene identifier and a scene camera position; and determining the initial virtual scene based on the scene parameters includes: Based on the scene camera position, determining an initial display perspective; Scene data matching the scene identifier is acquired, and an initial virtual scene displayed at the initial display viewing angle is generated based on the scene data.
3. The method according to claim 1, characterized in that The object parameters include at least object type and location attributes; The step of determining, under the constraint of the scene restriction condition, the virtual object to be added to the initial virtual scene based on the object parameters comprises: Based on the constraints of the scene restriction condition, determining at least one of a scene whitelist or a scene blacklist corresponding to the initial virtual scene; the scene blacklist is used to record virtual objects that are prohibited from being added to the initial virtual scene, and the scene whitelist is used to provide virtual objects that can be added to the initial virtual scene; Under the constraints of at least one of the scene whitelist or the scene blacklist, randomly determining a target virtual object to be added to the initial virtual scene based on the configured object type; Based on the position attribute, a placement position of the target virtual object in the initial virtual scene is determined.
4. The method according to claim 3, characterized in that The position attribute includes an absolute position of an object and a relative position of an object; and determining the placement position of the target virtual object in the initial virtual scene based on the position attribute includes: In a case where the position attribute indicates an absolute position of an object, placing the target virtual object at the absolute position in the initial virtual scene; In a case where the position attribute indicates a relative position of an object, determining at least one virtual object that has a matching relationship with the target virtual object among virtual objects that have been added to the initial virtual scene; Determining an object placement range of the target virtual object based on a placement position of the at least one virtual object in the initial virtual scene; The target virtual object is randomly placed within the object placement range.
5. The method according to claim 4, characterized in that The determining, based on the placement position of the at least one virtual object in the initial virtual scene, a placement range of the target virtual object includes: respectively determining a preconfigured priority of the at least one virtual object; A virtual object with the highest priority is determined among the at least one virtual object, and a placeable range of the target virtual object is determined based on a placement position of the virtual object with the highest priority in the initial virtual scene.
6. The method according to claim 1, characterized in that The character parameters include the relative position of the character; and determining the virtual character to be generated based on the initial virtual scene with the virtual object added and the character parameters includes: Determining a character placement range of the virtual character based on the placement position of the virtual object in the initial virtual scene to which the virtual object is added and the relative position parameter; Determining the position and posture of the virtual character within the character placement range; The virtual character is placed within the character placement range according to the posture.
7. The method according to any one of claims 1 to 6, characterized in that The initial virtual scene includes a plurality of sub-scenes. When at least one of the virtual object and the virtual character is placed in the initial virtual scene, it is placed in each sub-scene in sequence based on the priorities corresponding to the plurality of sub-scenes.
8. A device for generating a virtual scene, characterized in that: The device comprises: An acquisition module is used to acquire a configuration file specified by a user and read configuration parameters in the configuration file; the configuration file is a default configuration file or a custom configuration file uploaded by a user, and the configuration parameters include at least scene parameters, object parameters and role parameters; A determination module, configured to determine an initial virtual scene and scene restriction conditions in the initial virtual scene based on the scene parameters; The determination module is further used to determine the virtual object added to the initial virtual scene based on the object parameters under the constraints of the scene restriction condition; The determination module is further used to determine the virtual character to be generated based on the initial virtual scene with the virtual object added and the character parameters; A generation module is used to render and generate a target virtual scene based on the initial virtual scene, the virtual object and the virtual character.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for generating a virtual scene according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a virtual scene as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Virtual scene generation method and device, equipment and storage medium
CN112784002A
Virtual space large-scale scene construction method and system
CN118379418A
Video sequence generation method and device, computer equipment and storage medium
CN119233047A
3D scene model generation method and device, electronic equipment and storage medium
CN119399373A
Methods and systems for off-device image frame rendering in augmented reality applications
US11574449B1
Cited By
Generation optimization method and device of intelligent body three-dimensional virtual scene, equipment and medium
CN120014209A