Material rendering method and device, equipment, storage medium and program product
By setting and constraining simulation of the rendered material model and animation data, the problem of low material rendering efficiency in the existing technology is solved, and more efficient and realistic motion animation rendering effect is achieved.
Patent Information
- Application Number
- CN202410047270.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-11
- Publication Date
- 2025-07-11
AI Technical Summary
The prior art has low rendering efficiency in material rendering, especially motion animation, which affects the material rendering efficiency and the presentation effect of motion animation.
By setting parameters of the rendered material model and animation data, a constraint simulation method is adopted, including distance constraints, bending constraints, self-collision constraints, capsule collision constraints and continuous collision detection constraints. Combining physical simulation parameters such as stretching, bending, elasticity, etc., material rendering is performed frame by frame to improve rendering efficiency and effect.
It improves the flexibility and efficiency of material rendering, improves the rendering effect of motion animation, can more accurately simulate the movement and collision of materials, and enhances the vividness of rendering.
Smart Images

Figure CN120298563A_ABST
Abstract
Description
Technical Field
[0001] This application relates to data rendering technology in the field of computer applications, and particularly to a material rendering method, apparatus, device, storage medium, and program product. Background Art
[0002] In a virtual scene, the processing of presenting the motion animation of a material to be rendered is often involved, and the presentation of the motion animation is achieved by performing material rendering on the material to be rendered. Generally speaking, in order to perform material rendering on the material to be rendered, a finite element method is usually adopted; however, when the finite element method is used for material rendering, the material rendering efficiency is affected, and thus the rendering efficiency of the motion animation is also affected. Summary of the Invention
[0003] Embodiments of this application provide a material rendering method, apparatus, device, storage medium, and program product, which can improve the rendering efficiency of motion animations.
[0004] The technical solution of the embodiments of this application is implemented as follows:
[0005] Embodiments of this application provide a material rendering method, the method comprising:
[0006] Responding to a parameter setting operation for a material model to be rendered and animation data to be rendered, obtaining rendering parameters, where the rendering parameters include the number of animation frames and physical simulation parameters;
[0007] For each rendering frame corresponding to the number of animation frames, performing the following processing:
[0008] Determining, from the animation data to be rendered, frame animation data corresponding to the rendering frame;
[0009] Based on the current position information of the material model to be rendered and the frame animation data, performing constraint simulation on the physical simulation parameters to obtain frame position information;
[0010] Obtaining, from the frame position information corresponding to each rendering frame, a sequence of frame position information corresponding to the number of animation frames;
[0011] Based on the sequence of frame position information, presenting the motion animation of the material to be rendered in a virtual scene.
[0012] Embodiments of this application provide a material rendering apparatus, the material rendering apparatus comprising:
[0013] A parameter setting module, configured to respond to a parameter setting operation for a material model to be rendered and animation data to be rendered, and obtain rendering parameters, where the rendering parameters include the number of animation frames and physical simulation parameters;
[0014] A constraint simulation module, configured to perform the following processing for each to-be-rendered frame corresponding to the number of animation frames: determine, from the to-be-rendered animation data, frame animation data corresponding to the to-be-rendered frame; perform constraint simulation on the physical simulation parameters based on the current position information of the to-be-rendered material model and the frame animation data to obtain frame position information;
[0015] An information acquisition module, configured to obtain a sequence of frame position information corresponding to the number of animation frames from the frame position information corresponding to each to-be-rendered frame;
[0016] An animation presentation module, configured to present a motion animation of the to-be-rendered material in a virtual scene based on the sequence of frame position information.
[0017] In an embodiment of the present application, the constraint simulation includes at least one of the following: distance constraint, bending constraint, self-collision constraint, capsule collision constraint, and continuous collision detection constraint. Among them, the distance constraint is used to constrain the distance between adjacent simulation particles in the to-be-rendered material, the bending constraint is used to constrain the bending angle of the to-be-rendered material, the self-collision constraint is used to constrain the position information of each part of the to-be-rendered material when a collision occurs inside the to-be-rendered material, the capsule collision constraint is used to constrain the connection relationship between the to-be-rendered material and the connection object of the to-be-rendered material, and the continuous collision detection constraint is used to constrain the continuous collision information of the to-be-rendered material during movement.
[0018] In an embodiment of the present application, the physical simulation parameters include at least one of the following: a first stretching parameter, a second stretching parameter, a shear parameter, a bending parameter, an elastic parameter, a motion stiffness parameter, a motion range parameter, a rotational inertia parameter, and a translational inertia parameter. Among them, the first stretching parameter is used to control the stretching degree of the to-be-rendered material in the first direction, the second stretching parameter is used to control the stretching degree of the to-be-rendered material in the second direction, the shear parameter is used to control the deformation degree of the to-be-rendered material in a plane, the bending parameter is used to control the bending degree of the to-be-rendered material, the elastic parameter is used to control the elastic degree of the to-be-rendered material, the motion stiffness parameter is used to control the motion stiffness of the to-be-rendered material, the motion range parameter is used to control the motion range of the to-be-rendered material, the rotational inertia parameter is used to control the rotational inertia of the to-be-rendered material, and the translational inertia parameter is used to control the translational inertia of the to-be-rendered material.
[0019] In an embodiment of the present application, the constraint simulation module is further configured to perform constraint simulation on the physical simulation parameters based on the current position information of the material model to be rendered and the frame animation data, so as to obtain the initial frame position information; adjust the initial frame position information in combination with environmental parameters to obtain the frame position information, where the environmental parameters include one or both of a gravity parameter and an air resistance parameter.
[0020] In an embodiment of the present application, the constraint simulation module is further configured to traverse N sub-frames to be rendered of the frame to be rendered, and for each traversed sub-frame to be rendered, perform the following processing, where N is a positive integer greater than 1: determine, from the frame animation data, sub-frame animation data corresponding to the sub-frame to be rendered; perform constraint simulation on the physical simulation parameters based on the position information to be moved of the material model to be rendered and the sub-frame animation data, so as to obtain sub-frame position information, where the position information to be moved is determined by the current position information; and determine the sub-frame position information obtained at the end of the traversal as the frame position information.
[0021] In an embodiment of the present application, the parameter to be rendered further includes a sub-frame iteration number M, where M is a positive integer greater than 1, and the constraint simulation module is further configured to divide the sub-frame to be rendered into M simulation time periods based on the sub-frame iteration number M; traverse the M simulation time periods, and for each traversed simulation time period, perform the following processing: determine, from the sub-frame animation data, simulation animation data corresponding to the simulation time period; perform constraint simulation on the physical simulation parameters based on the position information to be simulated of the material model to be rendered and the simulation animation data, so as to obtain simulation position information, where the position information to be simulated is determined by the position information to be moved; and determine the simulation position information obtained at the end of the traversal as the sub-frame position information.
[0022] In an embodiment of the present application, the sub-frame iteration number M is greater than a specified iteration number; the parameter setting module is further configured to calculate the model complexity of the material model to be rendered and the performance of the rendering device; and obtain the sub-frame iteration number M that is negatively correlated with the model complexity and positively correlated with the performance of the rendering device.
[0023] In an embodiment of the present application, the physical simulation parameter includes a softness parameter, and the softness parameter is used to control the softness of the material model to be rendered, and the softness parameter is greater than a specified softness.
[0024] In an embodiment of the present application, the material rendering device further includes a model subdivision module, configured to obtain the subdivision level of the initial material model, where the subdivision level is the level to which the initial material model is to be subdivided; determine the vertices to be inserted on the mesh of the initial material model based on the subdivision level; and subdivide the initial material model based on the vertices to be inserted to obtain the material model to be rendered.
[0025] In an embodiment of the present application, the animation presentation module is further configured to, in response to a rendering preview operation for the frame position information sequence, present a preview animation of the material to be rendered based on the frame position information sequence; in response to a parameter correction operation for the preview animation, obtain simulation correction parameters, obtain a target position information sequence based on the simulation correction parameters, and present the motion animation of the material to be rendered in the virtual scene based on the target position information sequence; and in response to a confirmation operation for the preview animation, present the motion animation of the material to be rendered corresponding to the frame position information sequence in the virtual scene.
[0026] In an embodiment of the present application, the material rendering device further includes a format conversion module, configured to convert a rendering resource to be converted into a material resource to be rendered in a specified data format, where the rendering resource to be converted includes a material model to be converted and animation data to be converted, the material resource to be rendered includes the material model to be rendered and the animation data to be rendered, the material model to be converted corresponds to the material model to be rendered, and the animation data to be converted corresponds to the animation data to be rendered;
[0027] In an embodiment of the present application, the animation presentation module is further configured to convert the frame position information sequence into presentation data in the specified data format; and present the motion animation of the material to be rendered in the virtual scene by loading the presentation data.
[0028] An embodiment of the present application provides an electronic device for material rendering, where the electronic device includes:
[0029] A memory, configured to store computer-executable instructions or a computer program;
[0030] A processor, configured to implement the material rendering method provided by the embodiment of the present application when executing the computer-executable instructions or the computer program stored in the memory.
[0031] An embodiment of the present application provides a computer-readable storage medium, storing computer-executable instructions or a computer program, where the computer-executable instructions or the computer program are configured to implement the material rendering method provided by the embodiment of the present application when being executed by a processor.
[0032] An embodiment of the present application provides a computer program product, including computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the material rendering method provided by the embodiment of the present application is implemented.
[0033] The embodiment of the present application has at least the following beneficial effects: When performing animation rendering on a material model to be rendered and animation data to be rendered, in each frame to be rendered, physical model parameters set are constrained and simulated based on the frame animation data and the current movement position, implementing a process of physical simulation based on the set parameters to achieve material rendering, which can improve the material rendering efficiency; thus, when using the set parameters to perform material rendering on the material to be rendered in a motion animation, the rendering efficiency of the motion animation can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a schematic architecture diagram of the material rendering system provided by the embodiment of the present application;
[0035] Figure 2 is a kind of Figure 1 schematic structural diagram of the terminal in
[0036] Figure 3 is a schematic flow chart of the material rendering method provided by the embodiment of the present application Figure 1 ;
[0037] Figure 4 is a schematic flow chart of the constraint simulation provided by the embodiment of the present application;
[0038] Figure 5 is a schematic flow chart of the material rendering method provided by the embodiment of the present application Figure 2 ;
[0039] Figure 6 is a schematic flow chart of the material rendering method provided by the embodiment of the present application Figure 3 ;
[0040] Figure 7 is a schematic diagram of an exemplary cloth to be simulated provided by the embodiment of the present application;
[0041] Figure 8 is a schematic diagram of another exemplary cloth to be simulated provided by the embodiment of the present application;
[0042] Figure 9 is a schematic diagram of an exemplary baking parameter setting provided by the embodiment of the present application;
[0043] Figure 10 is an exemplary simulation schematic provided by the embodiment of the present application Figure 1 ;
[0044] Figure 11 is an exemplary simulation schematic provided by an embodiment of the present application Figure 2 ;
[0045] Figure 12 is an exemplary simulation schematic provided by an embodiment of the present application Figure 3 ;
[0046] Figure 13 is an exemplary simulation schematic provided by an embodiment of the present application Figure 4 ;
[0047] Figure 14 is an exemplary blueprint configuration schematic diagram provided by an embodiment of the present application;
[0048] Figure 15 is an exemplary operation schematic diagram provided by an embodiment of the present application;
[0049] Figure 16 is an exemplary simulation process schematic diagram provided by an embodiment of the present application;
[0050] Figure 17 is an exemplary model effect schematic diagram provided by an embodiment of the present application. Detailed implementation manners
[0051] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be construed as limitations on the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application.
[0052] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0053] In the following description, the terms "first / second" are used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first / second" can be interchanged with a specific order or sequence when permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0054] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of that module or unit.
[0055] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0056] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0057] 1) Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results. That is to say, artificial intelligence is a comprehensive technology in computer science, used to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence enables machines to have the functions of perception, reasoning, and decision-making by studying the design principles and implementation methods of various intelligent machines.
[0058] It should be noted that artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, mechatronics, etc. Among them, pre-trained models are also known as large models and basic models; after fine-tuning, pre-trained models can be widely applied to downstream tasks in various directions of artificial intelligence. Artificial intelligence software technologies include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning. In the embodiments of the present application, material rendering can also be achieved through artificial intelligence technology.
[0059] In addition, with the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in multiple fields. For example, smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless, autonomous driving, drones, digital twins, virtual humans, robots, artificial intelligence-generated content (AIGC), conversational interaction, smart healthcare, smart customer service, and games. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role. The material rendering method provided in the embodiments of this application will describe the application of artificial intelligence technology in material rendering.
[0060] 2) Responsive to, which is used to represent the conditions or states on which the executed operations depend. When the dependent conditions or states are met, the one or more operations to be executed can be real-time or can have a set delay; without special instructions, there is no limit on the execution order of the multiple operations to be executed.
[0061] 3) Virtual scene, which can be a simulation environment of the real world, or a semi-simulated and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5D virtual scene, or a three-dimensional virtual scene. The embodiments of this application do not limit the dimension of the virtual scene. For example, the virtual scene can include a virtual sky, a virtual land, a virtual ocean, etc. The virtual land can include environmental elements such as a virtual desert and a virtual city. Users can control virtual objects to move in this virtual scene.
[0062] 4) Virtual object, which is the image of various people and objects that can interact in a virtual scene, or a movable object in a virtual scene. Among them, the movable object can be a virtual character, a virtual animal, an anime character, and a virtual prop, etc., such as the characters and animals displayed in a virtual scene; the virtual object can also be a virtual image in a virtual scene that represents the user. A virtual scene can include multiple virtual objects, and each virtual object has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene. In the embodiments of this application, the material to be rendered can be information related to the clothing and hair of a virtual object.
[0063] 5) Control, which is a triggerable piece of information displayed in the form of a region, a button, an icon, a link, text, a selection box, an input box, a tab, etc.; among them, the triggering method can be contact triggering, non-contact triggering, or instruction-receiving triggering, etc.; in addition, various controls in the embodiments of this application can be a single control or the general term for multiple controls.
[0064] 6) An operation is a way to trigger a device to perform processing. For example, click operation, double-click operation, long-press operation, swipe operation, gesture operation, received trigger instructions, etc. Additionally, various operations in the embodiments of this application can be a single operation or a collective term for multiple operations; and various operations in the embodiments of this application can be touch operations or non-touch operations.
[0065] 7) A client is an application program running on a device that provides various services. For example, a game client, an animation production client, a clothing production client, and so on.
[0066] 8) Universal Scene Description (USD) is a file format for describing virtual scenes, used to achieve scene data interaction and sharing between multiple application software, providing a common data exchange method for digital media and animation production, etc. USD stores and manages scene descriptions using a hierarchical data organization method; and USD supports various object types, such as geometries, materials, animations, lights, etc.; and USD can also effectively describe the properties and behaviors of each object. In addition, USD supports layering and referencing of virtual scenes, thereby being able to effectively describe virtual scene data. Additionally, USD can efficiently implement data compression (compression ratio higher than the specified compression ratio) and loading (loading speed greater than the specified speed), improving the rendering speed. It should also be noted that USD supports digital media content production tools DCC, and data can be exported in text format for inspection. Therefore, the embodiments of this application can use USD for data exchange.
[0067] 9) Material physical simulation is a computer simulation technology based on physical principles, used to simulate the physical behavior and movement of materials in the real world. Through material physical simulation, physical properties such as the elasticity, friction, and air resistance of materials can be simulated to enhance the realism of the material simulation effect; exemplarily, when the material is cloth, in a game, material physical simulation is cloth physical simulation, which can be used to simulate the movement and deformation of items such as the clothes, hair, and canvas accessories of virtual characters to increase the realism and visual effect of the virtual scene.
[0068] 10) Offline material physical simulation refers to the calculation and simulation of the physical behavior of materials in advance before applying the materials in the fields of computer graphics and animation to generate realistic material animation effects. Different from real-time material physical simulation, which is a real-time calculation process, offline material physical simulation is an offline calculation process. Therefore, offline material physical simulation can first perform physical simulation in the background and then save the results as an animation sequence. Offline material physical simulation is usually used in fields such as film production, animation production, game production, and simulation to improve the simulation accuracy and visual quality. When performing offline material physical simulation, first model the material to be simulated, including defining the shape, material properties, and physical properties of the material to be simulated, etc.; then, simulate the material to be simulated through the offline material physical simulation algorithm and the modeling results. Here, considering factors such as the elasticity, gravity, and collision of the material, generate the dynamic behavior of the material under different circumstances. Through offline material physical simulation, the fineness of material physical simulation can be improved, and thus the rendering quality of the material can be improved.
[0069] 11) A material physical simulation tool (such as, Solver) is used to simulate the behavior and movement of materials; that is, according to physical laws and constraint conditions, calculate the movement and deformation of materials under given conditions. The material physical simulation tool generates the dynamic effects of materials by simulating the interaction of materials with external forces, collisions, gravity, and other factors. In the fields of computer graphics and animation, material physical simulation tools are often used to generate material animation effects in game development, film production, virtual reality, etc. In the embodiments of the present application, the material physical simulation tool for material rendering can be based on extended physical-based dynamics (XPBD), and combined with the physical properties of materials such as mass, elasticity, and friction, as well as the collision and interaction with other objects, to generate the real behavior and deformation of materials in the animation.
[0070] It should be noted that in a virtual scene, the processing of presenting the motion animation of the material to be rendered is often involved, and the presentation of the motion animation is achieved by performing material rendering on the material to be rendered. Generally speaking, in order to perform material rendering on the material to be rendered, the finite element method is usually adopted; however, when using the finite element method for material rendering, the material rendering efficiency is affected.
[0071] Exemplarily, when the material to be rendered is cloth, in order to achieve cloth rendering, an offline cloth solver (such as Marvelous Designer) can be used. The offline cloth solver is a three-dimensional virtual clothing design tool applied to fields such as fashion design, game development, and film and television production. The offline cloth solver includes an offline cloth simulation function, and through the offline cloth simulation function, cloth can be realistically simulated on a computer. When performing cloth simulation through the offline cloth simulation function of the offline cloth solver, first, a cloth model is created, and a drawing tool or an imported three-dimensional cloth model can be used to create the shape and structure of the cloth model; then, the material properties of the cloth model are determined, such as elasticity, friction, etc.; here, the offline cloth simulation function of the offline cloth solver can also be used to simulate the behavior of the cloth. Among them, the offline cloth simulation function of the offline cloth solver uses a physics engine to calculate physical properties such as the folding, wrinkling, and movement of the cloth, and performs simulation calculations based on the set starting position and actions of the cloth to generate an animation sequence of the cloth; thus, the animation sequence can be exported (such as exported in file formats such as FBX, OBJ, etc.) for cloth presentation. However, since the offline cloth solver implements cloth simulation based on finite elements, it affects the performance of the cloth model and also affects the cloth simulation effect; for example, for the cloth simulation of multiple layers, multiple wrinkles, and multiple accessories, the offline cloth solver has a problem of multi-layer penetration. In addition, the offline cloth solver is a closed-source tool with simulation limitations and cannot achieve specified simulation of cloth, which affects the flexibility of cloth simulation.
[0072] Based on this, the embodiments of the present application provide a material rendering method, device, equipment, computer-readable storage medium, and computer program product, which can improve the flexibility, efficiency, and effect of material rendering and improve the rendering effect of motion animations. The following describes an exemplary application of the electronic device for material rendering (hereinafter simply referred to as the material rendering device) provided by the embodiments of the present application. The material rendering device provided by the embodiments of the present application can be implemented as various types of terminals such as smartphones, smart watches, laptops, tablets, desktop computers, smart home appliances, set-top boxes, intelligent vehicle-mounted devices, portable music players, personal digital assistants, dedicated messaging devices, intelligent voice interaction devices, portable game devices, and smart speakers, or can be implemented as a server, or can also be implemented as a combination of the two. The following will describe an exemplary application when the material rendering device is implemented as a terminal.
[0073] See Figure 1 , Figure 1 is a schematic diagram of the architecture of the material rendering system provided by the embodiments of the present application; as Figure 1As shown, in the material rendering system 100, the terminal 200 and the terminal 400 are connected to the server 600 through the network 300. The network 300 can be a wide area network, a local area network, or a combination of both. In addition, the material rendering system 100 further includes a database 500 for providing data support to the server 600; and, Figure 1 FIG. shows a case where the database 500 is independent of the server 600. In addition, the database 500 can also be integrated in the server 600, which is not limited in the embodiments of the present application.
[0074] The terminal 400 is configured to, in response to a parameter setting operation for the material model to be rendered and the animation data to be rendered (exemplarily showing the graphical interface 410-1 to describe the parameter setting interface), obtain the parameters to be rendered, where the parameters to be rendered include the number of animation frames and physical simulation parameters; perform the following processing for each frame to be rendered corresponding to the number of animation frames: determine the frame animation data corresponding to the frame to be rendered from the animation data to be rendered; based on the current position information of the material model to be rendered and the frame animation data, perform constraint simulation on the physical simulation parameters to obtain the frame position information; obtain the frame position information sequence corresponding to the number of animation frames from the frame position information of each frame to be rendered, and send the frame position information sequence to the terminal 200 through the network 300 and the server 600.
[0075] The terminal 200 is configured to present the motion animation of the material to be rendered in the virtual scene based on the frame position information sequence (exemplarily showing the graphical interface 210-1).
[0076] It should be noted that, Figure 1 FIG. shows the process of presenting the motion animation of the material to be rendered in the virtual scene based on the frame position information sequence on the terminal 200. The terminal 400 itself can also present the motion animation of the material to be rendered in the virtual scene based on the frame position information sequence.
[0077] In some embodiments, the server 600 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, which are not limited in the embodiments of the present application.
[0078] See Figure 2 , Figure 2 is a schematic structural diagram of a terminal provided by an embodiment of the present application; as Figure 1 inFigure 2 As shown, the terminal 400 includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together through a bus system 440. It can be understood that the bus system 440 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 2 Various buses are labeled as bus system 440 .
[0079] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0080] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0081] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0082] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0083] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0084] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0085] A network communication module 452 for reaching other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wi-Fi (Wireless Fidelity), Universal Serial Bus (USB), etc.
[0086] A presentation module 453 for enabling the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with the user interface 430 (e.g., a display screen, a speaker, etc.).
[0087] An input processing module 454 for detecting and translating one or more user inputs or interactions from one of the one or more input devices 432.
[0088] In some embodiments, the material rendering device provided by the embodiments of the present application may be implemented in software. Figure 2 Shown is a material rendering device 455 stored in the memory 450, which may be software in the form of a program and a plug-in, etc., including the following software modules: a parameter setting module 4551, a constraint simulation module 4552, an information acquisition module 4553, an animation presentation module 4554, a model subdivision module 4555, and a format conversion module 4556. These modules are logical, so they can be combined arbitrarily or further split according to the functions to be implemented. The functions of each module will be described below.
[0089] In some embodiments, the material rendering device provided by the embodiments of the present application may be implemented in hardware. As an example, the material rendering device provided by the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the material rendering method provided by the embodiments of the present application. For example, a processor in the form of a hardware decoding processor may employ one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field-Programmable Gate Arrays (FPGAs), or other electronic components.
[0090] In some embodiments, the terminal can implement the material rendering method provided in the embodiments of the present application by running various computer-executable instructions or computer programs. For example, the computer-executable instructions can be commands at the microprogram level, machine instructions, or software instructions. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (APPlication, APP), that is, a program that needs to be installed in the operating system to run, such as a material rendering APP; it can also be a small program that can be embedded in any APP, that is, a program that only needs to be downloaded to the browser environment to run. In short, the above computer-executable instructions can be instructions in any form, and the above computer programs can be application programs, modules, or plugins in any form.
[0091] Next, the material rendering method provided in the embodiments of the present application will be described in conjunction with the exemplary applications and implementations of the material rendering device provided in the embodiments of the present application. In addition, the material rendering method provided in the embodiments of the present application is applied to various material rendering scenarios such as cloud technology, artificial intelligence, intelligent transportation, vehicle-mounted, animation, and games.
[0092] See Figure 3 , Figure 3 is the flowchart of the material rendering method provided in the embodiments of the present application Figure 1 , where Figure 3 the execution subject of each step in Figure 3 will be described in conjunction with the steps shown.
[0093] Step 101, in response to a parameter setting operation for the material model to be rendered and the animation data to be rendered, obtain the parameters to be rendered.
[0094] In the embodiments of the present application, the material rendering device presents a parameter setting control for the material resource to be rendered. When parameters for rendering the material to be rendered are set for the material resource to be rendered, the material rendering device also receives a parameter setting operation for the material resource to be rendered; at this time, the material rendering device responds to the parameter setting operation and obtains the parameters set through the parameter setting operation, thereby obtaining the parameters to be rendered.
[0095] It should be noted that the material resources to be rendered refer to the resources used to render the material to be rendered, including the model of the material to be rendered and the animation data to be rendered; among them, the model of the material to be rendered is the modeling result of the material to be rendered, representing the shape, material type, texture and other attributes of the material to be rendered, and can be a material model constructed based on the business before the material rendering process; the animation data to be rendered represents the motion information of the model of the material to be rendered, such as the motion direction, motion speed, etc., and can be the motion information determined based on the business before the material rendering process. The parameter setting control is used to set the rendering parameters for the material resources to be rendered, and the parameter setting operation refers to the operation used to set the rendering parameters of the material to be rendered. The rendering parameters to be set refer to the rendering parameters of the material to be rendered, including the number of animation frames and the physical simulation parameters; among them, the number of animation frames refers to the number of motion frames of the material to be rendered, and the physical simulation parameters refer to the parameters used to perform physical simulation on the material to be rendered, and the physical simulation refers to the material physical simulation; here, the material physical simulation can be real-time material physical simulation or offline material physical simulation, and the embodiments of the present application do not limit this. In addition, the material to be rendered can be a rigid material, a flexible material, or a combination of the two; when the material to be rendered is a flexible material, the material to be rendered can be a flexible ornament, such as clothes, hair, etc.
[0096] In the embodiments of the present application, the physical simulation parameters include at least one of the following: a first stretching parameter, a second stretching parameter, a shear parameter, a bending parameter, an elastic parameter, a motion stiffness parameter, a motion range parameter, a rotational inertia parameter, and a translational inertia parameter. Among them, the first stretching parameter is used to control the stretching degree of the material to be rendered in the first direction; the second stretching parameter is used to control the stretching degree of the material to be rendered in the second direction; the shear parameter is used to control the deformation degree of the material to be rendered in the plane; the bending parameter is used to control the bending degree of the material to be rendered; the elastic parameter is used to control the elastic degree of the material to be rendered, and the motion stiffness parameter is used to control the motion stiffness of the material to be rendered; the motion range parameter is used to control the motion range of the material to be rendered; the rotational inertia parameter is used to control the rotational inertia of the material to be rendered; the translational inertia parameter is used to control the translational inertia of the material to be rendered. Here, the first direction can be the first dimension direction of the two-dimensional space, the second direction can be the second dimension direction of the two-dimensional space, and the first dimension direction and the second dimension direction are perpendicular to each other.
[0097] It can be understood that since the physical simulation parameters include at least one of the first stretching parameter, the second stretching parameter, the shear parameter, the bending parameter, the elastic parameter, the motion stiffness parameter, the motion range parameter, the rotational inertia parameter, and the translational inertia parameter, therefore, it is possible to perform material rendering from at least one dimension of stretching, bending, elasticity, motion stiffness, motion range, rotational inertia, and translational inertia, and thus the realism of the material rendering can be improved.
[0098] In an embodiment of the present application, the physical simulation parameters include softness parameters, and the softness parameters are used to control the softness of the material to be rendered; when the material to be rendered is a flexible material, if the softness parameter is greater than the specified softness, the material rendering effect of the material to be rendered can be improved.
[0099] In an embodiment of the present application, for each frame to be rendered corresponding to the number of animation frames, the material rendering device performs the following processing (Steps 102 and 103).
[0100] It should be noted that the number of animation frames refers to the number of motion frames of the material to be rendered. Thus, the material to be rendered corresponds to the number of animation frames of the animation frames to be rendered; here, each animation frame to be rendered is referred to as a frame to be rendered. The material rendering model traverses the frames to be rendered of the number of animation frames based on the order between the animation frames, and performs the following material physical simulation processing for each traversed frame to be rendered.
[0101] Step 102: Determine the frame animation data corresponding to the frame to be rendered from the animation data to be rendered.
[0102] In an embodiment of the present application, the animation data to be rendered corresponds to the motion information of the entire animation, and the entire animation includes the number of animation frames of the frames to be rendered. Thus, the material rendering device can determine the motion information corresponding to the traversed frame to be rendered from the animation data to be rendered, and refer to the motion information corresponding to the traversed frame to be rendered in the animation data to be rendered as the frame animation data; therefore, the frame animation data represents the motion information of the material to be rendered at the frame to be rendered, including at least one of the following information: motion direction, motion speed, rotation direction, rotation speed, acceleration, and friction. Moreover, each frame to be rendered corresponds to a frame animation data, and the number of animation frames of the frame animation data is the animation data to be rendered.
[0103] Step 103: Based on the current position information of the material model to be rendered and the frame animation data, perform a constraint simulation on the physical simulation parameters to obtain the frame position information.
[0104] In an embodiment of the present application, when the traversed frame to be rendered is the first frame to be rendered, the current position information is the position information of the material model to be rendered in the resource to be rendered, which can be the position information preset based on the service; when the traversed frame to be rendered is other than the first frame to be rendered, the current position information is the position information corresponding to the previous frame to be rendered of the traversed frame to be rendered. Here, after the material rendering device obtains the current position information and the frame animation data of the traversed frame to be rendered, it performs a physical simulation on the position information of the material model to be rendered at the traversed frame to be rendered, and moreover, performs the physical simulation in a constrained manner to estimate the position information of the material model to be rendered at the traversed frame to be rendered. Finally, the estimated position information is referred to as the frame position information.
[0105] It should be noted that constraint simulation refers to the process of performing physical simulation of materials by means of constraints. The way of constraints means that in the process of the physical model of materials, at least one of distance, bending angle, position, connection relationship, self-collision, capsule collision, and continuous collision is used to limit the material to be rendered. Constraint simulation includes at least one of the following: distance constraint, bending constraint, self-collision constraint, capsule collision constraint, and continuous collision detection constraint. Among them, the distance constraint is used to constrain the distance between adjacent simulation particles in the material to be rendered; the bending constraint is used to constrain the bending angle of the material to be rendered; the self-collision constraint is used to constrain the position information of each part of the material to be rendered when a collision occurs inside the material to be rendered; the capsule collision constraint is used to constrain the connection relationship between the material to be rendered and the connection object of the material to be rendered; the continuous collision detection constraint is used to constrain the continuous collision information of the material to be rendered during the movement process. Here, the simulation particle is the smallest component of the material to be rendered, and each part of each part of the material to be rendered includes at least one simulation particle.
[0106] It can be understood that since the constraint simulation includes at least one of the distance constraint, bending constraint, self-collision constraint, capsule collision constraint, and continuous collision detection constraint, thus, it is possible to constrain the physical simulation of materials from at least one dimension of distance, bending angle, self-collision, capsule collision, and continuous collision, and further, it is possible to improve the quality of material rendering.
[0107] In step 103 of the embodiment of the present application, the material rendering device performs constraint simulation on the physical simulation parameters based on the current position information of the material model to be rendered and the frame animation data, and obtains the frame position information, including: the material rendering device first performs constraint simulation on the physical simulation parameters based on the current position information of the material model to be rendered and the frame animation data to obtain the frame initial position information; then combines the environmental parameters to adjust the frame initial position information to obtain the frame position information.
[0108] It should be noted that the frame initial position information is the position information estimated by combining the current position information, frame animation data, and physical simulation parameters, and refers to the position information to be adjusted in combination with the environmental information; the environmental information is described by environmental parameters; among them, the environmental parameters include one or both of the gravity parameter and the air resistance parameter, the gravity parameter is determined based on the gravity of the material model to be rendered, and the air resistance parameter is determined based on the scene environment of the virtual scene. That is to say, at each moment corresponding to the frame to be rendered, the material rendering device first determines the initial position information, and then optimizes the initial position information in combination with the environmental parameters to obtain the frame position information.
[0109] It can be understood that the material rendering device predicts the position information of the material model to be rendered in a constrained manner based on the frame granularity and the set physical simulation parameters, and updates the position information for each frame to be rendered, enabling fast and accurate material physical simulation; therefore, the efficiency and quality of material physical simulation can be improved.
[0110] See Figure 4 , Figure 4 which is a schematic flow diagram of constrained simulation provided by an embodiment of the present application. Among them, Figure 4 the execution entity of each step in Figure 4 is the material rendering device; as Figure 4 shown, in the embodiment of the present application, step 103 can be implemented through steps 1031 to 1034; that is, the material rendering device performs constrained simulation on the physical simulation parameters based on the current position information of the material model to be rendered and the frame animation data, and obtains the frame position information, including steps 1031 to 1034, which will be described separately below.
[0111] Step 1031: Traverse the N sub-frames to be rendered of the frame to be rendered.
[0112] In the embodiment of the present application, the material rendering device can perform constrained simulation based on the frame to be rendered, or can perform constrained simulation based on the sub-frames to be rendered of the frame to be rendered. The embodiment of the present application does not limit this. When the material rendering device performs constrained simulation based on the sub-frames to be rendered of the frame to be rendered, the frame to be rendered can be divided into N sub-frames to be rendered; where N is a positive integer greater than 1, and the sub-frame to be rendered is one Nth of the frame to be rendered; here, the material rendering device traverses the N sub-frames to be rendered and performs constrained simulation based on the sub-frames to be rendered.
[0113] In the embodiment of the present application, for each traversed sub-frame to be rendered, the material rendering device performs the following processing (steps 1032 and 1033).
[0114] Step 1032: Determine the sub-frame animation data corresponding to the sub-frame to be rendered from the frame animation data.
[0115] In the embodiment of the present application, the frame animation data corresponds to the motion information of the entire frame to be rendered, and the entire frame to be rendered includes N sub-frames to be rendered. Thus, the material rendering device can determine the motion information corresponding to the traversed sub-frame to be rendered from the frame animation data, and call the motion information corresponding to the traversed sub-frame to be rendered in the frame animation data as the sub-frame animation data; therefore, the sub-frame animation data represents the motion information of the material to be rendered at the sub-frame to be rendered, and each sub-frame to be rendered corresponds to a sub-frame animation data, and the N sub-frame animation data is the frame animation data.
[0116] Step 1033: Based on the to-be-moved position information of the to-be-rendered material model and the sub-frame animation data, perform a constraint simulation on the physical simulation parameters to obtain the sub-frame position information.
[0117] In the embodiment of the present application, the to-be-moved position information is determined by the current position information; when the to-be-rendered sub-frame traversed is the first to-be-rendered sub-frame in the to-be-rendered frames, the to-be-moved position information is the current position information; when the to-be-rendered sub-frame traversed is other to-be-rendered sub-frames except the first to-be-rendered sub-frame, the to-be-moved position information is the position information corresponding to the previous to-be-rendered sub-frame of the to-be-rendered sub-frame traversed, and the position information corresponding to the previous to-be-rendered sub-frame is determined step by step (i.e., for the to-be-rendered sub-frame) based on the current position information, or is the current position information. Here, after the material rendering device obtains the to-be-moved position information and the sub-frame animation data of the to-be-rendered sub-frame traversed, it performs a physical simulation on the position information of the to-be-rendered material model at the to-be-rendered sub-frame traversed, and moreover, performs the physical simulation in a constrained manner to estimate the position information of the to-be-rendered material model at the to-be-rendered sub-frame traversed. Finally, the estimated position information is called the sub-frame position information.
[0118] It should be noted that the material rendering device can first perform a constraint simulation by combining the to-be-moved position information, the sub-frame animation data, and the physical simulation parameters, and then adjust the position information obtained by the constraint simulation based on the environmental information to obtain the sub-frame position information.
[0119] It can be understood that the material rendering device performs material physical simulation in units of sub-frames, improving the accuracy of the material physical simulation, and thus being able to improve the fidelity of the material physical simulation.
[0120] In the embodiment of the present application, the to-be-rendered parameters further include the sub-frame iteration number M, where M is a positive integer greater than 1, and the sub-frame iteration number M refers to the number of times of material physical simulation to be performed corresponding to the to-be-rendered sub-frame. Thus, referring further to Figure 4 , step 1033 can be implemented through steps 10331 to 10334; that is, the material rendering device performs a constraint simulation on the physical simulation parameters based on the to-be-moved position information of the to-be-rendered material model and the sub-frame animation data to obtain the sub-frame position information, including steps 10331 to 10334, and the following will separately describe each step.
[0121] Step 10331: Based on the sub-frame iteration number M, divide the to-be-rendered sub-frame into M simulation time periods.
[0122] In an embodiment of the present application, the material rendering device may perform constraint simulation in units of sub-frames to be rendered, or may perform constraint simulation in units of the division result of the sub-frames to be rendered. The embodiments of the present application do not limit this. When the material rendering device performs constraint simulation in units of the division result of the sub-frames to be rendered, the sub-frames to be rendered are divided to obtain M simulation time periods, and the simulation time period is one Mth of the sub-frames to be rendered; wherein, the M simulation time periods correspond one-to-one to the sub-frame iteration times M, that is to say, in each simulation time period, one sub-iteration process is executed, and the sub-iteration process refers to the physical simulation of the material corresponding to the simulation moment.
[0123] In an embodiment of the present application, the material rendering device traverses the M simulation time periods, and for each traversed simulation time period, the following processing (step 10332 and step 10333) is performed.
[0124] Step 10332: Determine the simulation animation data corresponding to the simulation time period from the sub-frame animation data.
[0125] In an embodiment of the present application, the sub-frame animation data corresponds to the motion information of the entire sub-frame to be rendered, and the entire sub-frame to be rendered includes M simulation time periods. Thus, the material rendering device can determine the motion information corresponding to the traversed simulation time period from the sub-frame animation data, and call the motion information corresponding to the traversed simulation time period in the sub-frame animation data as the simulation animation data; therefore, the simulation animation data represents the motion information of the material to be rendered in the simulation time period, and each simulation time period corresponds to one simulation animation data, and the M simulation animation data are the sub-frame animation data.
[0126] Step 10333: Based on the position information to be simulated of the material model to be rendered and the simulation animation data, perform constraint simulation on the physical simulation parameters to obtain the simulated position information.
[0127] In an embodiment of the present application, the position information to be simulated is determined by the position information to be moved; when the traversed simulation time period is the first simulation time period in the sub-frame to be rendered, the position information to be simulated is the position information to be moved; when the traversed simulation time period is other simulation time periods except the first simulation time period, the position information to be simulated is the position information corresponding to the previous simulation time period of the traversed simulation time period, and the position information corresponding to the previous simulation time period is determined step by step (i.e., for the sub-frame to be rendered) based on the position information to be moved, or is the position information to be moved. Here, after the material rendering device obtains the position information to be simulated and the simulation time animation data of the traversed simulation time period, it performs physical simulation on the position information of the material model to be rendered at the traversed simulation time period, and performs physical simulation in a constrained manner to estimate the position information of the material model to be rendered at the traversed simulation time period. Finally, the estimated position information is called the simulated position information.
[0128] It should be noted that the material rendering device can first perform constraint simulation by combining the position information to be simulated, the simulation animation data, and the physical simulation parameters, and then adjust the position information obtained by the constraint simulation based on the environmental information to obtain the simulated position information.
[0129] It can be understood that the material rendering device performs material physical simulation in units of simulation time periods, improving the accuracy of the material physical simulation, and thus being able to improve the realism of the material physical simulation.
[0130] Step 10334: Determine the simulated position information obtained at the end of the traversal as the sub-frame position information.
[0131] In the embodiment of the present application, when the material rendering device finishes traversing M simulation time periods, the simulated position information determined for the last traversed simulation time period is the sub-frame position information.
[0132] It should be noted that the number of sub-frame iterations M is greater than the specified number of iterations; in this way, the step size of the constraint simulation can be reduced, and the accuracy of the material physical simulation can be improved.
[0133] Step 1034: Determine the sub-frame position information obtained at the end of the traversal as the frame position information.
[0134] In the embodiment of the present application, when the material rendering device finishes traversing N sub-frames to be rendered, the sub-frame position information determined for the last traversed sub-frame to be rendered is the frame position information.
[0135] It can be understood that when the constraint simulation includes self-collision constraints, by refining the frame to be rendered, the frequency of self-collision detection can be improved, thereby reducing the probability of penetration and improving the rendering effect; when the constraint simulation includes capsule collision constraints, by refining the frame to be rendered, the frequency of capsule collision detection can be improved, thereby reducing the probability of material detachment and improving the rendering effect.
[0136] Step 104: Obtain a sequence of frame position information corresponding to the number of animation frames from the frame position information corresponding to each frame to be rendered.
[0137] In the embodiment of the present application, the material rendering device determines the frame position information of the frames to be rendered one by one. When the number of frame position information equal to the number of animation frames is obtained, based on the time information corresponding to the frames to be rendered, the number of frame position information equal to the number of animation frames is combined into a sequence of frame position information.
[0138] It should be noted that the frame position information represents the position information of the material model to be rendered in each frame to be rendered, and the sequence of frame position information represents the sequence of position information of the material model to be rendered in the number of frames to be rendered equal to the number of animation frames.
[0139] Step 105. Based on the frame position information sequence, present the motion animation of the material to be rendered in the virtual scene.
[0140] In the embodiment of the present application, in the virtual scene, the material rendering device sequentially presents the material model to be rendered according to the time sequence of the frames to be rendered according to the frame position information sequence, that is, the motion animation of the material to be rendered is presented in the virtual scene. Among them, the number of frames included in the motion animation is the number of animation frames.
[0141] It can be understood that when performing animation rendering on the material model to be rendered and the animation data to be rendered, the physical model parameters set are constrained and simulated based on the frame animation data and the current motion position in each frame to be rendered, realizing a process of material rendering based on the set parameters; thereby, the rendering efficiency can be improved. In addition, based on the set physical simulation parameters, the material physical simulation is performed frame by frame in a constrained manner, which can flexibly and accurately simulate the material to be rendered and improve the material rendering fidelity.
[0142] See Figure 5 , Figure 5 is the flowchart of the material rendering method provided by the embodiment of the present application Figure 2 , where Figure 5 the execution subject of each step in Figure 5 is the material rendering device; as
[0143] Step 1051. In response to the rendering preview operation for the frame position information sequence, present the preview animation of the material to be rendered based on the frame position information sequence.
[0144] In the embodiment of the present application, when the constraint simulation is offline material physical simulation, after obtaining the frame position information sequence, the animation corresponding to the frame position information sequence is previewed first. Here, when performing animation preview for the frame position information, the material rendering device also receives the rendering preview operation for the frame position information sequence; at this time, the material rendering device responds to the rendering preview operation and presents the animation corresponding to the position information sequence in a preview manner, that is, the preview animation is presented. That is to say, the preview animation refers to the result presented when previewing the material rendering animation of the material model to be rendered based on the frame position information.
[0145] Step 1052A: In response to a parameter correction operation for the preview animation, obtain simulated correction parameters, obtain a target position information sequence based on the simulated correction parameters, and present a motion animation of the material to be rendered in the virtual scene based on the target position information sequence.
[0146] In the embodiment of the present application, if there is a material rendering problem in the presented preview animation, when correcting the physical simulation parameters for the material rendering problem, the material rendering device also receives a parameter correction operation for the preview animation; at this time, the material rendering device responds to the parameter correction operation and obtains re-set parameters. Here, the re-obtained parameters for the material physical model are called simulated correction parameters.
[0147] It should be noted that the process of the material rendering device determining the target position information sequence of the material model to be rendered based on the simulated correction parameters is similar to the process of determining the frame position information sequence of the material model to be rendered based on the physical simulation parameters, and the embodiment of the present application will not repeat the description here. In addition, the motion animation of the material to be rendered presented by the material rendering device in the virtual scene based on the target position information sequence can be an animation corresponding to the target position information sequence, or an animation presented after parameter correction of the animation previewed based on the target position information sequence. The embodiment of the present application does not limit this.
[0148] Step 1052B: In response to a confirmation operation for the preview animation, present a motion animation of the material to be rendered corresponding to the frame position information sequence in the virtual scene.
[0149] In the embodiment of the present application, if the presented preview animation meets the material rendering service requirements, when determining that the frame position information sequence is used as the material rendering result for the preview animation, the material rendering device also receives a confirmation operation for the preview animation; at this time, the material rendering device responds to the confirmation operation, determines the frame position information sequence as the material rendering result, and presents a motion animation of the material to be rendered corresponding to the frame position information sequence in the virtual scene.
[0150] It can be understood that since the material rendering result for presenting the motion animation can be determined through preview, the quality and efficiency of material rendering can be improved.
[0151] In the embodiment of the present application, before the material rendering device obtains the parameters to be rendered in response to a parameter setting operation for the material model to be rendered and the animation data to be rendered, the material rendering method further includes a process of determining the sub-frame iteration number M; the process of determining the sub-frame iteration number M includes: the material rendering device first calculates the model complexity of the material model to be rendered and the performance of the rendering device; and obtains the sub-frame iteration number M that is negatively correlated with the model complexity and positively correlated with the performance of the rendering device.
[0152] It should be noted that the model complexity refers to the complexity of the material model to be rendered determined from at least one of the style, area, number of meshes, number of layers, etc.; the rendering device performance refers to the device performance of the material rendering device.
[0153] It can be understood that since the number of sub-frame iterations M is negatively correlated with the model complexity and positively correlated with the rendering device performance, a balance point is determined between the rendering accuracy and the rendering efficiency during the material rendering process, and thus the material rendering effect can be improved while ensuring the material rendering efficiency.
[0154] See Figure 6 , Figure 6 is the flowchart of the material rendering method provided by the embodiment of the present application Figure 3 , where Figure 6 the execution subject of each step in Figure 6 is the material rendering device; as
[0155] Step 106: Obtain the subdivision level of the initial material model.
[0156] In the embodiment of the present application, the model of the material to be rendered initially obtained by the material rendering device is the initial material model; in order to improve the accuracy of the initial material model, the material rendering device obtains the subdivision level of the initial material model; where the subdivision level is the level to be subdivided of the initial material model, and different subdivision levels correspond to different numbers of newly added vertices; for example, when the subdivision level is level one, it is determined that one new vertex is added to the model mesh. In addition, the subdivision level can be determined based on the actual business.
[0157] Step 107: Determine the vertices to be inserted on the mesh of the initial material model based on the subdivision level.
[0158] It should be noted that the material rendering device determines the number of vertices to be newly added corresponding to the subdivision level of the initial material model based on the correspondence between the subdivision level and the number of vertices, and then determines the corresponding number of vertices on the mesh of the initial material model, thus completing the determination of the vertices to be inserted; it is easy to know that the number of vertices included in the vertices to be inserted is the number of vertices to be newly added.
[0159] Step 108: Subdivide the initial material model based on the vertices to be inserted to obtain the material model to be rendered.
[0160] In the embodiment of the present application, the material rendering device subdivides the mesh of the initial material model into multiple meshes based on the vertices to be inserted, and uses the initial material model with the mesh subdivision completed as the material model to be rendered.
[0161] It can be understood that after obtaining the initial material model, the material rendering device performs mesh subdivision on the initial material model to obtain the material model to be rendered. Since the accuracy of the material model to be rendered is higher than that of the initial material model, performing material rendering based on the material model to be rendered can improve the material rendering effect.
[0162] In the embodiment of the present application, before the material rendering device obtains the rendering parameters in response to the parameter setting operation for the material model to be rendered and the animation data to be rendered, the material rendering method further includes determining format conversion processing: the material rendering device converts the rendering resource to be converted into a material resource to be rendered in a specified data format. Accordingly, based on the frame position information sequence, the material rendering device presents the motion animation of the material to be rendered in the virtual scene, including: the material rendering device first converts the frame position information sequence into the data to be presented in a specified data format; then loads the data to be presented to present the motion animation of the material to be rendered in the virtual scene.
[0163] It should be noted that the rendering resource to be converted includes the material model to be converted and the animation data to be converted, the material resource to be rendered includes the material model to be rendered and the animation data to be rendered, the material model to be converted corresponds to the material model to be rendered, and the animation data to be converted corresponds to the animation data to be rendered; the specified data format is the data format for rendering the motion animation, for example, the USD format.
[0164] It can be understood that performing format conversion before material rendering enables material rendering to be performed on the material model to be rendered in any format. Additionally, after obtaining the simulation result by completing the constraint simulation, performing format conversion on the simulation result enables the simulation result to be applied to the animation rendering application of any material to be rendered. In this way, the generality of material rendering can be improved.
[0165] Next, an exemplary application of the embodiment of the present application in an actual application scenario will be described. This exemplary application describes the process of data exchange based on USD for offline physical simulation of cloth, which can improve the cloth simulation accuracy and quality of the game plot cutscene animation. It is easy to know that the embodiment of the present application is applicable to any material rendering scenario. Here, the offline physical simulation process of cloth in the game plot cutscene animation is used as an example for description.
[0166] In the game plot cutscene, the virtual cloth of the game character includes characteristics such as high precision (greater than the specified precision), large area (greater than the specified area), multi-layer cloth, multiple folds, and multiple decorations. To improve the cloth rendering effect in the game plot cutscene, cloth offline physical simulation is used for cloth simulation.
[0167] Exemplarily, refer to Figure 7 , Figure 7 which is a schematic diagram of an exemplary cloth to be simulated provided by an embodiment of the present application. As Figure 7 shown, the cloth model 7-2 (referred to as the material model to be rendered) shown in the interface 7-1 includes characteristics such as high precision, multiple layers, and multiple styles.
[0168] Refer to Figure 8 , Figure 8 which is another schematic diagram of an exemplary cloth to be simulated provided by an embodiment of the present application. As Figure 8 shown, the cloth model 8-2 shown in the interface 8-1 includes characteristics such as high precision, large area, multiple layers, and multiple styles.
[0169] It should be noted that in order to improve the compatibility and generality of the cloth simulation results, USD is used for data exchange. That is, the data to be simulated of the cloth to be simulated (the art resource model and the animation file, referred to as the material resources to be rendered) are converted into USD data and then the offline cloth physical simulation is performed on the USD data, and the cloth simulation results are described by USD data. In addition, since USD is a general data exchange format that can realize the conversion between various data formats, and the offline cloth physical simulation tool often reads the data to be simulated at different times through multiple steps. Therefore, using USD to describe the data to be simulated can improve the readability and processing efficiency of the data to be simulated, and can also improve the executability of the offline cloth physical simulation.
[0170] In the embodiment of the present application, the data to be simulated can be converted into USD data by combining a scripting language (for example, Python script) and a USD script interface (USDPython API), including the following steps:
[0171] 1) Environment setting.
[0172] It should be noted that by installing the dependency library, the calling environment of the scripting language and the USD script interface is set up.
[0173] 2) Based on the set environment, write a scripting language for the data to be simulated, and call the USD script interface through the interface call module (PXR module) to perform the following processing: First, create a new USD scene using the scene creation method (Usd.Stage.CreateNew()), then define the root node of the USD scene using the root node definition method (UsdGeom.Xform.Define()), and finally, import the data to be simulated into the root node of the USD scene using the data import method (UsdGeom.Import()), and set scene attributes such as materials, textures, and animation properties in the USD scene after importing the data based on the data to be simulated.
[0174] 3) Use the save method (Usd.Stage.Save()) to save the set USD scene as a USD file, and specify the path and file name of the output file for this USD file.
[0175] It should be noted that at this time, the data to be simulated has been converted into USD format data, and the USD file to be simulated (or called the USD file to be baked) has been obtained. In the editor, this USD file can be directly loaded by calling the USD script interface to perform offline cloth physical simulation; among them, the editor is an offline cloth physical simulation tool.
[0176] In the embodiment of the present application, the process of converting the baked data obtained after simulation into a USD file includes the following steps:
[0177] 1) Create a USD scene.
[0178] It should be noted that in the editor program, USD header files required for data conversion are included (for example, pxr / usd / usd / stage.h and pxr / usd / usdGeom / xform.h). Based on the USD header files, call the scene creation method (UsdStage::CreateNew()) through the USD program interface to create a new USD scene (the created USD scene can be an object of the UsdStageRefPtr type).
[0179] 2) Create an object to be serialized.
[0180] It should be noted that an object to be serialized is created for the baked data (it can be a transformation node created based on an object of the UsdGeomXform type, and this transformation node is set with a transformation matrix).
[0181] 3) Serialize the object to be serialized based on the USD scene.
[0182] It should be noted that the object to be serialized created is added to the created scene through the USD program interface. Among them, the definition method (UsdStage::DefinePrim()) can be used to define the node for adding the object to be serialized in the created scene, and the metadata setting method (UsdPrim::SetMetadata()) can be used to set metadata for the object to be serialized.
[0183] 4) Save the USD file.
[0184] It should be noted that the modified scene is saved as a USD file through the USD program interface; here, based on the specified path and file name of the output file, the export method (UsdStage::Export()) can be used to export the scene as a USD file; and, the USD program interface is called in the game to deserialize the USD file to provide the baked data to the animation module for playback.
[0185] The following describes the offline cloth physical simulation process.
[0186] When performing offline cloth physical simulation, each frame (referred to as the frame to be rendered) is divided into N (for example, 16 or 64) sub-frames (referred to as the sub-frames to be rendered); among them, each frame refers to a frame during the game operation (for example, 30 frames per second or 60 frames per second. When it is 30 frames per second, a frame is 33 milliseconds (ms), and when it is 60 frames per second, a frame is 16 milliseconds). By subdividing each frame of the game operation into multiple sub-frames and performing offline cloth physical simulation based on each sub-frame, the cloth simulation effect can be improved.
[0187] In the embodiment of the present application, the editor is initialized first, and then the position and rotation information of the fixed particles (referred to as the current position information) are obtained from the editor; based on the obtained position and rotation information, for each of the N sub-frames corresponding to a frame, the following offline cloth physical simulation processing is performed: based on the obtained position and rotation information, the interpolation position and rotation information of the current sub-frame are calculated; based on the interpolation position and rotation information of the current sub-frame, the inertial position of the simulated particles is calculated; the inertial position is adjusted by applying gravity and air resistance (referred to as environmental parameters) to obtain the final position of the current sub-frame (referred to as the sub-frame position information). Among them, the fixed particles refer to the particles in the cloth to be simulated whose current position information is known, and the simulated particles refer to the particles in the cloth to be simulated whose position information at the next moment is to be estimated.
[0188] In the embodiments of the present application, to improve the accuracy of offline cloth physical simulation, the sub-frame can be subdivided by the number of sub-iterations. And the following processing is performed during each sub-iteration of the sub-frame: Project Constraints (referred to as constraint simulation) are performed on the set baking parameters (referred to as the number of animation frames and physical simulation parameters) based on the position information of the previous sub-iteration to obtain the velocity information of the current sub-iteration, and the position information of the current sub-iteration is determined based on the velocity information.
[0189] It should be noted that the offline cloth physical simulation provided by the embodiments of the present application is a position-based dynamics simulation method for simulating physical effects such as elasticity, deformation, and collision. Projection constraint is a technique for simulating the constraint relationship between objects; in the offline cloth physical simulation provided by the embodiments of the present application, projection constraint is used to limit the position or shape of the cloth within a certain range; here, by calculating and updating the position of the cloth during each sub-iteration to make the cloth meet the constraint conditions, the interaction and constraint effects between the cloths can be simulated.
[0190] In the embodiments of the present application, the constraint types include Distance Constraints, Bending Constraint, Selfcollision Constraint, Capsule Constraint, and CCD Constraint. Each type of constraint will be described separately below.
[0191] Distance constraint is used to limit the distance between two objects within a specific range. For example, it can be used to simulate springs, ropes, and connected objects, etc. By calculating and adjusting the distance between the objects, the stability of the distance can be maintained. Among them, the distance constraint can be used to constrain the distance between adjacent parts of the cloth, and can also be used to constrain the distance between the cloth and its adjacent objects.
[0192] Bending constraint is a constraint relationship for simulating the bending deformation of an object, usually used to simulate the bending behavior of flexible rods, ropes, and cloths, etc. By calculating and adjusting the shape and angle of the object, the stability and authenticity of the bending constraint can be maintained.
[0193] Self-collision constraint is a constraint relationship for simulating internal collisions of an object, usually applied to simulate flexible objects such as soft bodies and cloths; when different parts of an object collide, the self-collision constraint can detect and adjust the position and shape of the object to reduce internal penetration and crossing situations.
[0194] Capsule collision constraint, a constraint relationship used to simulate the connection relationship between objects. It is usually used to simulate joints and connected objects, etc.; the capsule collision constraint regards the connection point between two objects as a capsule shape, and by calculating and adjusting the position and rotation of the objects, the stability and authenticity of the constraint are maintained.
[0195] Continuous collision detection constraint, used to simulate the constraint relationship of continuous collisions of objects during movement. By detecting and handling collisions at each time step of the object's movement, the accuracy and stability of the simulation are maintained; the continuous collision detection constraint is used to simulate moving, rotating, and colliding objects to reduce the occurrence of penetration and enhance the authenticity of the collision effect.
[0196] It should be noted that some constraints are projected in each sub-iteration, while some constraints are projected in some iterations; for example, the self-collision constraint is projected in the last iteration of each frame. Also, the constraint is projected at least once in each sub-iteration; for example, the capsule collision constraint is projected multiple times, interspersed among other types of constraints.
[0197] In the embodiments of the present application, when performing offline cloth physical simulation, the baking parameters include the horizontal stretch parameter (Horizon Stretch Param, referred to as the first stretch parameter), the vertical stretch parameter (Vertical Stretch Param, referred to as the second stretch parameter), the shear parameter (Shear Param), the bend parameter (Bend Param), the elastic parameter (Elastic), the motion stiffness parameter (Constrain Motion Stiffness), the motion scale parameter (Constrain Motion Scale, referred to as the moment of inertia parameter), the moment of inertia scale (Rotation Inertia Scale, referred to as the moment of inertia parameter), the translational inertia scale (Translat Inertia Scale, referred to as the translational inertia parameter), and the number of recorded frames (Record Frame Num, referred to as the number of animation frames). Each baking parameter will be described separately below.
[0198] The horizontal stretch parameter is used to control the stretching behavior of the cloth in the horizontal direction. By adjusting the horizontal stretch parameter, the softness and deformation degree of the cloth in the horizontal direction can be changed. Among them, the horizontal direction is the horizontal direction corresponding to the animation presentation perspective.
[0199] The vertical stretch parameter is used to control the stretching behavior of the cloth in the vertical direction. By adjusting the vertical stretch parameter, the softness and deformation degree of the cloth in the vertical direction can be changed. Among them, the vertical direction is the vertical direction corresponding to the animation presentation perspective.
[0200] Shearing parameters, which are used to control the shearing behavior of the fabric, that is, the shearing deformation of the fabric in the plane. By adjusting the shearing parameters, the shearing strength and deformation effect of the fabric can be changed.
[0201] Bending parameters, which are used to control the bending behavior of the fabric, that is, the bending deformation of the fabric in the plane. By adjusting the bending parameters, the bending strength and deformation effect of the fabric can be changed.
[0202] Elastic parameters, which are used to control the elastic behavior of the fabric, that is, the ability of the fabric to return to its original state. By adjusting the elastic parameters, the elastic degree and rebound effect of the fabric can be changed.
[0203] Motion stiffness parameters, which are used to control the motion stiffness of the fabric constraint. By adjusting the motion stiffness parameters, the stiffness and stability of the fabric constraint can be changed.
[0204] Motion scaling parameters, which are used to adjust the motion range of the fabric constraint. By adjusting the motion scaling parameters, the motion range and limitation of the fabric constraint can be controlled.
[0205] Rotational inertia scaling, which is used to adjust the rotational inertia of the fabric. By adjusting the rotational inertia scaling, the inertia and stability of the fabric during rotation can be changed.
[0206] Translational inertia scaling, which is used to adjust the translational inertia of the fabric. By adjusting the translational inertia scaling, the inertia and stability of the fabric during translation can be changed.
[0207] Recording frame number, which is used to specify the number of frames of the animation to be generated offline. By setting the recording frame number, the number of frames of the animation generated during the offline baking process can be determined for subsequent use.
[0208] Exemplarily, refer to Figure 9 , Figure 9 is a schematic diagram of an exemplary baking parameter setting provided by an embodiment of the present application; as Figure 9 shown, in the interface 9-1, baking parameters 9-2 are shown, including horizontal stretching parameter 9-21, vertical stretching parameter 9-22, shearing parameter 9-23, bending parameter 9-24, elastic parameter 9-25, motion stiffness parameter 9-26, motion scaling parameter 9-27, rotational inertia scaling 9-28, translational inertia scaling 9-29, and recording frame number 9-210. Among them, the horizontal stretching parameter 9-21, vertical stretching parameter 9-22, shearing parameter 9-23, and bending parameter 9-24 all include properties of compliance, damp, range, and scale.
[0209] It can be understood that by adjusting the baking parameters, the behavior and effect of the fabric can be precisely controlled to achieve fine adjustment of fabric simulation from dimensions such as stretching, shearing, bending, elasticity, and constraint, thereby enhancing the fabric simulation effect.
[0210] In the embodiments of the present application, the fabric simulation effect can also be optimized in terms of the number of sub-iterations, softness (also known as the softness parameter), and the number of vertices. Among them, the number of sub-iterations is a configuration parameter. By increasing the number of sub-iterations and reading the number of sub-iterations during the baking process to increase the number of sub-iteration executions, the situation of collision penetration (that is, the situation where an object partially or completely passes through another object) can be reduced; the softness is a configuration parameter. By increasing the softness, the softness of the fabric can be enhanced during the simulation process by reading this parameter; the number of vertices refers to the number of vertices in the fabric model to be rendered. By increasing the number of vertices of the mesh in the fabric model to be rendered, the fabric accuracy can be improved and the rendering effect of wrinkles can be enhanced.
[0211] The process of optimization based on the number of sub-iterations is described below.
[0212] It should be noted that the number of sub-iterations refers to the number of iterations performed in each simulation time step, where one simulation time step corresponds to one sub-frame. By increasing the number of sub-iterations, the movement and collision of the fabric can be accurately simulated. When the number of sub-iterations increases, the time interval divided by the simulation time step decreases. Conducting fabric simulation within this time interval (referred to as the simulation period) can accurately capture the movement and collision details of the material to be rendered, reducing the occurrence of non-realistic effects such as collision penetration and detachment.
[0213] During the fabric simulation in each sub-iteration process, calculations and updates are performed according to the movement state and constraint conditions of the fabric; through multiple sub-iterations, the position and shape of the fabric can be gradually adjusted to meet the constraint conditions and physical laws; when the set number of sub-iterations is reached, the fabric simulation for this simulation time step ends, and the final simulation result for this simulation time step is obtained.
[0214] It can be understood that the higher the number of sub-iterations, the smaller the sub-iteration step size; at this time, the detection intervals of self-collision and capsule collision are also smaller, enhancing the frequency of collision detection. Thus, the intervals of self-collision and capsule collision can be reduced, and the probability of penetration can be lowered; increasing the number of sub-iterations can also reduce the detachment phenomenon of the fabric (that is, the fabric exhibits unstable movement or position during the simulation process); sub-iteration is a fine-grained division of the simulation process, and the real physical behavior is approximated through multiple sub-iterations. By increasing the number of sub-iterations, the simulation process is more accurate, and the movement and collision effects of the fabric are more realistic, thereby improving the accuracy and stability of the simulation. Among them, self-collision refers to the collision between different parts within an object, and capsule collision refers to the collision between the fabric and the capsule shape.
[0215] It should be noted that increasing the number of sub-iterations will also increase the computational workload. Therefore, when selecting the number of sub-iterations, it is necessary to determine the simulation effect and computational performance according to specific circumstances to find a suitable balance point. Here, the number of sub-iterations can be adjusted according to the complexity of the cloth to be simulated, the simulation requirements, and the computational resources to achieve the best simulation effect.
[0216] Exemplarily, referring to Figure 10 , Figure 10 is an exemplary simulation diagram provided by an embodiment of the present application Figure 1 ; as Figure 10 shown, the cloth simulation result 10-1 is the simulation effect with the number of sub-iterations being 8, and there is a problem of detachment.
[0217] Referring to Figure 11 , Figure 11 is an exemplary simulation diagram provided by an embodiment of the present application Figure 2 ; as Figure 11 shown, the cloth simulation result 11-1 is the simulation effect with the number of sub-iterations being 20, and there is a problem of collision penetration.
[0218] Referring to Figure 12 , Figure 12 is an exemplary simulation diagram provided by an embodiment of the present application Figure 3 ; as Figure 12 shown, the cloth simulation result 12-1 is the simulation effect with the number of sub-iterations being 30, and the problems of cloth detachment and collision penetration are solved.
[0219] The process of optimization based on softness is described below.
[0220] It should be noted that in cloth simulation, softness refers to the softness of the cloth, which is a concept opposite to stiffness. The value range of softness is usually from 0 to 1, and the larger the value, the softer the cloth, and a more natural and flowing effect can be presented. Since the stiffness multiplier and the limit are parameters used to adjust the stretch of the cloth, where the stiffness multiplier is used to adjust the stiffness of the cloth, and the limit is used to limit the maximum degree of the cloth when stretched; therefore, here, these parameters of softness, stiffness multiplier, and limit are used to control the softness and stretch of the cloth. The softer the cloth, the softer it is. Therefore, in the scenario of soft cloth, the softness of the cloth can be enhanced by increasing the value of softness.
[0221] The process of optimization based on the number of vertices is described below.
[0222] It should be noted that the higher the number of vertices of the cloth model, the higher the accuracy of the model, the finer the wrinkle details of the simulation effect, and the better the final simulation effect. Therefore, the number of vertices is positively correlated with the cloth simulation effect. Improving the accuracy of cloth simulation can accurately capture fine wrinkles and deformation details, making the final simulation effect realistic and delicate. During the simulation process, adding vertices or mesh subdivision can capture the fine deformation and wrinkle effects of the cloth, thus enhancing the authenticity of cloth simulation.
[0223] Exemplarily, refer to Figure 13 , Figure 13 which is an exemplary simulation schematic diagram provided by an embodiment of the present application. Figure 4 As Figure 13 shown, the accuracy of the cloth simulation result 13-1 is higher than that of the cloth simulation result 13-2, and the simulation effect of the cloth simulation result 13-1 is superior to that of the cloth simulation result 13-2 in terms of wrinkle detail simulation.
[0224] Next, the editor provided by the embodiment of the present application will be described.
[0225] The function configurations of the editor provided by the embodiment of the present application are flexible. Refer to Figure 14 , Figure 14 which is an exemplary blueprint configuration schematic diagram provided by an embodiment of the present application; as Figure 14 shown, during the cloth simulation shown in the interface 14-1, the timeline 14-12 is determined based on the animation data 14-11. Under the control of the timeline 14-12, the baking module 14-13 performs offline cloth physical simulation based on the cloth model 14-14, the animation data 14-11, and the game character skeleton information 14-15.
[0226] The editor provided by the embodiment of the present application includes a one-key export and debugging function, which can improve the effect and efficiency of offline cloth simulation.
[0227] Exemplarily, refer to Figure 15 , Figure 15 which is an exemplary operation schematic diagram provided by an embodiment of the present application; as Figure 15 shown, in the interface 15-1, in response to the triggering operation of the debugging control 15-11, a function list 15-12 is presented; among them, the function list 15-12 includes a control 15-14 (save offline debugging data) and a control 15-13 (play offline debugging data). That is to say, one-key export of baking data can be achieved through the control 15-14, and one-key debugging of baking data can be achieved through the control 15-13.
[0228] It can be understood that by setting baking parameters and then through one-key debugging, the fabric simulation effect can be improved by resetting the baking parameters, thereby improving the fabric baking effect and efficiency.
[0229] In the embodiments of the present application, by setting baking parameters in the editor and then performing projection constraints on the baking parameters based on various types of constraints, a process of offline fabric physical simulation based on a display position update method is realized, which can improve the fabric simulation efficiency.
[0230] Exemplarily, refer to Figure 16 , Figure 16 is a schematic diagram of an exemplary simulation process provided by the embodiments of the present application; as Figure 16 shown, interface 16-1 shows the process of fabric baking. As shown by progress bar 16-11, 30% of the fabric to be rendered 16-12 has been baked.
[0231] It should be noted that using the material rendering method provided by the embodiments of the present application to perform Figure 16 the fabric simulation of the fabric to be rendered 16-12 in takes 23 minutes, while using Marvelous Designer takes 6 hours. Thus, it shows that the material rendering method provided by the embodiments of the present application has higher efficiency compared to Marvelous Designer.
[0232] When the simulation shown in Figure 16 is completed, refer to Figure 17 , Figure 17 is a schematic diagram of an exemplary model effect provided by the embodiments of the present application; as Figure 17 shown, the fabric simulation result 17-2 shown in interface 17-1 can meet the requirements of offline simulation of fabrics with multiple layers, multiple folds, and multiple accessories.
[0233] It can be understood that, on the one hand, the material rendering method provided by the embodiments of the present application is based on the XPBD algorithm, which can be applied to simulation scenarios of complex fabric structures, meet the fabric simulation requirements of multiple layers, multiple folds, and multiple accessories, ensure the full realization of functions, and provide higher flexibility and customization. On the other hand, the XPBD algorithm can handle complex fabric structures and details, improving the accuracy and realism of fabric simulation. On the other hand, the XPBD algorithm uses an explicit position update method, which can reduce the calculation time of offline fabric physical simulation and improve the simulation efficiency. Therefore, the fabric simulation process provided by the embodiments of the present application can reduce fabric simulation consumption and improve the applicable range, efficiency, and realism of fabric simulation in fabric production in fields such as games, simulations, and films.
[0234] Next, continue to describe the exemplary structure of the implementation of the material rendering device 455 provided by the embodiments of the present application as software modules. In some embodiments, asFigure 2 As shown, the software modules stored in the material rendering device 455 of the memory 450 may include:
[0235] A parameter setting module 4551, configured to obtain to-be-rendered parameters in response to a parameter setting operation for a to-be-rendered material model and to-be-rendered animation data, where the to-be-rendered parameters include the number of animation frames and physical simulation parameters;
[0236] A constraint simulation module 4552, configured to perform the following processing for each to-be-rendered frame corresponding to the number of animation frames: determine frame animation data corresponding to the to-be-rendered frame from the to-be-rendered animation data; perform constraint simulation on the physical simulation parameters based on the current position information of the to-be-rendered material model and the frame animation data to obtain frame position information;
[0237] An information acquisition module 4553, configured to obtain a sequence of frame position information corresponding to the number of animation frames from the frame position information corresponding to each to-be-rendered frame;
[0238] An animation presentation module 4554, configured to present a motion animation of the to-be-rendered material in a virtual scene based on the sequence of frame position information.
[0239] In an embodiment of the present application, the constraint simulation includes at least one of the following: distance constraint, bending constraint, self-collision constraint, capsule collision constraint, and continuous collision detection constraint, where the distance constraint is used to constrain the distance between adjacent simulation particles in the to-be-rendered material, the bending constraint is used to constrain the bending angle of the to-be-rendered material, the self-collision constraint is used to constrain the position information of each part of the to-be-rendered material when a collision occurs inside the to-be-rendered material, the capsule collision constraint is used to constrain the connection relationship between the to-be-rendered material and a connection object of the to-be-rendered material, and the continuous collision detection constraint is used to constrain the continuous collision information of the to-be-rendered material during movement.
[0240] In an embodiment of the present application, the physical simulation parameters include at least one of the following: a first stretching parameter, a second stretching parameter, a shear parameter, a bending parameter, an elastic parameter, a motion stiffness parameter, a motion range parameter, a rotational inertia parameter, and a translational inertia parameter. Among them, the first stretching parameter is used to control the stretching degree of the material to be rendered in the first direction, the second stretching parameter is used to control the stretching degree of the material to be rendered in the second direction, the shear parameter is used to control the deformation degree of the material to be rendered in the plane, the bending parameter is used to control the bending degree of the material to be rendered, the elastic parameter is used to control the elastic degree of the material to be rendered, the motion stiffness parameter is used to control the motion stiffness of the material to be rendered, the motion range parameter is used to control the motion range of the material to be rendered, the rotational inertia parameter is used to control the rotational inertia of the material to be rendered, and the translational inertia parameter is used to control the translational inertia of the material to be rendered.
[0241] In an embodiment of the present application, the constraint simulation module 4552 is further configured to perform constraint simulation on the physical simulation parameters based on the current position information of the material model to be rendered and the frame animation data, so as to obtain frame initial position information; adjust the frame initial position information in combination with environmental parameters to obtain the frame position information, where the environmental parameters include one or both of a gravity parameter and an air resistance parameter.
[0242] In an embodiment of the present application, the constraint simulation module 4552 is further configured to traverse N to-be-rendered sub-frames of the to-be-rendered frame, and for each traversed to-be-rendered sub-frame, perform the following processing, where N is a positive integer greater than 1: determine sub-frame animation data corresponding to the to-be-rendered sub-frame from the frame animation data; perform constraint simulation on the physical simulation parameters based on the to-be-moved position information of the material model to be rendered and the sub-frame animation data to obtain sub-frame position information, where the to-be-moved position information is determined by the current position information; determine the sub-frame position information obtained at the end of the traversal as the frame position information.
[0243] In an embodiment of the present application, the rendering parameter to be processed further includes the number of sub-frame iterations M, where M is a positive integer greater than 1. The constraint simulation module 4552 is further configured to divide the sub-frame to be rendered into M simulation time periods based on the number of sub-frame iterations M; traverse the M simulation time periods, and for each traversed simulation time period, perform the following processing: determine the simulation animation data corresponding to the simulation time period from the sub-frame animation data; perform constraint simulation on the physical simulation parameters based on the position information to be simulated of the material model to be rendered and the simulation animation data, to obtain the simulated position information, where the position information to be simulated is determined by the position information to be moved; determine the simulated position information obtained at the end of the traversal as the sub-frame position information.
[0244] In an embodiment of the present application, the number of sub-frame iterations M is greater than a specified number of iterations; the parameter setting module 4551 is further configured to calculate the model complexity of the material model to be rendered and the performance of the rendering device; obtain the number of sub-frame iterations M that is negatively correlated with the model complexity and positively correlated with the performance of the rendering device.
[0245] In an embodiment of the present application, the physical simulation parameter includes a softness parameter, which is used to control the softness of the material to be rendered, and the softness parameter is greater than a specified softness.
[0246] In an embodiment of the present application, the material rendering device 455 further includes a model subdivision module 4555, which is configured to obtain the subdivision level of the initial material model, where the subdivision level is the level of the initial material model to be subdivided; determine the vertices to be inserted on the mesh of the initial material model based on the subdivision level; and subdivide the initial material model based on the vertices to be inserted to obtain the material model to be rendered.
[0247] In an embodiment of the present application, the animation presentation module 4554 is further configured to, in response to a rendering preview operation on the frame position information sequence, present a preview animation of the material to be rendered based on the frame position information sequence; in response to a parameter correction operation on the preview animation, obtain simulation correction parameters, obtain a target position information sequence based on the simulation correction parameters, and present the motion animation of the material to be rendered in the virtual scene based on the target position information sequence; and in response to a confirmation operation on the preview animation, present the motion animation of the material to be rendered corresponding to the frame position information sequence in the virtual scene.
[0248] In an embodiment of the present application, the material rendering device 455 further includes a format conversion module 4556, which is configured to convert a rendering resource to be converted into a rendering material resource in a specified data format. The rendering resource to be converted includes a material model to be converted and animation data to be converted. The rendering material resource includes the rendering material model and the rendering animation data. The material model to be converted corresponds to the rendering material model, and the animation data to be converted corresponds to the rendering animation data.
[0249] In an embodiment of the present application, the animation presentation module 4554 is further configured to convert the sequence of frame position information into presentation data in the specified data format; by loading the presentation data, present the motion animation of the rendering material in the virtual scene.
[0250] An embodiment of the present application provides a computer program product, which includes computer-executable instructions or a computer program. The computer-executable instructions or the computer program are stored in a computer-readable storage medium. A processor of a material rendering device reads the computer-executable instructions or the computer program from the computer-readable storage medium, and the processor executes the computer-executable instructions or the computer program, so that the material rendering device executes the material rendering method described above in the embodiments of the present application.
[0251] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions or a computer program are stored. When the computer-executable instructions or the computer program are executed by a processor, the processor will be caused to execute the material rendering method provided in the embodiments of the present application. For example, Figure 3 the material rendering method shown.
[0252] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, flash memory, magnetic surface memory, optical disc, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0253] In some embodiments, the computer-executable instructions may be in the form of a program, software, software module, script, or code, and may be written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0254] By way of example, the computer-executable instructions may or may not correspond to a file in a file system, and may be stored as part of a file that holds other programs or data. For example, they may be stored in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program under discussion, or in multiple cooperating files (e.g., files that store one or more modules, subroutines, or code portions).
[0255] By way of example, the computer-executable instructions may be deployed to execute on one electronic device (in which case, this one electronic device is the material rendering device), or on multiple electronic devices located at one location (in which case, the multiple electronic devices located at one location are the material rendering device), or on multiple electronic devices distributed across multiple locations and interconnected by a communication network (in which case, the multiple electronic devices distributed across multiple locations and interconnected by a communication network are the material rendering device).
[0256] It can be understood that in the embodiments of the present application, data related to rendering parameters and virtual objects, etc. are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions.
[0257] In summary, when the embodiments of the present application perform animation rendering on a material model to be rendered and animation data to be rendered, in each frame to be rendered, constraint simulation is performed on the set physical model parameters based on the frame animation data and the current movement position, realizing a process of material rendering based on the set parameters; thus, the rendering efficiency can be improved. In addition, performing constraint simulation for each frame to be rendered can improve the flexibility and effect of material rendering.
[0258] The above description is only for the embodiments of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are all included in the protection scope of the present application.
Claims
1. A material rendering method, characterized in that, The method includes: In response to a parameter setting operation for a material model to be rendered and animation data to be rendered, obtaining rendering parameters to be rendered, where the rendering parameters to be rendered include the number of animation frames and physical simulation parameters; For each frame to be rendered corresponding to the number of animation frames, perform the following processing: Determine, from the animation data to be rendered, frame animation data corresponding to the frame to be rendered; Based on the current position information of the material model to be rendered and the frame animation data, perform a constrained simulation on the physical simulation parameters to obtain frame position information; Obtain a sequence of frame position information corresponding to the number of animation frames from the frame position information corresponding to each frame to be rendered; Based on the sequence of frame position information, present a motion animation of the material to be rendered in a virtual scene.
2. The method according to claim 1, wherein The performing a constrained simulation on the physical simulation parameters based on the current position information of the material model to be rendered and the frame animation data to obtain frame position information includes: Based on the current position information of the material model to be rendered and the frame animation data, perform a constrained simulation on the physical simulation parameters to obtain initial frame position information; Adjust the initial frame position information in combination with environmental parameters to obtain the frame position information, where the environmental parameters include one or both of a gravity parameter and an air resistance parameter.
3. The method according to claim 1, characterized in that, The performing a constrained simulation on the physical simulation parameters based on the current position information of the material model to be rendered and the frame animation data to obtain frame position information includes: Traverse N sub-frames to be rendered of the frame to be rendered, and for each traversed sub-frame to be rendered, perform the following processing, where N is a positive integer greater than 1: Determine, from the frame animation data, sub-frame animation data corresponding to the sub-frame to be rendered; Based on the position information to be moved of the material model to be rendered and the sub-frame animation data, perform a constrained simulation on the physical simulation parameters to obtain sub-frame position information, where the position information to be moved is determined by the current position information; Determine the sub-frame position information obtained at the end of the traversal as the frame position information.
4. The method according to claim 3, characterized in that, The rendering parameters to be rendered further include a sub-frame iteration number M, where M is a positive integer greater than 1, and the performing a constrained simulation on the physical simulation parameters based on the position information to be moved of the material model to be rendered and the sub-frame animation data to obtain sub-frame position information includes: Based on the sub-frame iteration number M, divide the sub-frame to be rendered into M simulation time periods; Traverse the M simulation time periods, and for each traversed simulation time period, perform the following processing: Determine, from the sub-frame animation data, simulation animation data corresponding to the simulation time period; Based on the position information to be simulated of the material model to be rendered and the simulation animation data, perform a constrained simulation on the physical simulation parameters to obtain simulation position information, where the position information to be simulated is determined by the position information to be moved; Determine the simulation position information obtained at the end of the traversal as the sub-frame position information.
5. The method according to claim 4, characterized in that, The sub-frame iteration number M is greater than a specified iteration number; Before obtaining the to-be-rendered parameters in response to the parameter setting operation for the to-be-rendered material model and the to-be-rendered animation data, the method further includes: Calculating the model complexity of the to-be-rendered material model and the performance of the rendering device; Obtaining the sub-frame iteration count M that is negatively correlated with the model complexity and positively correlated with the performance of the rendering device.
6. The method according to any one of claims 1 to 5, characterized in that, The physical simulation parameter includes a softness parameter, and the softness parameter is used to control the softness of the to-be-rendered material, and the softness parameter is greater than a specified softness.
7. The method according to any one of claims 1 to 5, characterized in that, Before obtaining the to-be-rendered parameters in response to the parameter setting operation for the to-be-rendered material model and the to-be-rendered animation data, the method further includes: Obtaining the subdivision level of the initial material model, where the subdivision level is the level at which the initial material model is to be subdivided; Determining vertices to be inserted on the mesh of the initial material model based on the subdivision level; Subdividing the initial material model based on the vertices to be inserted to obtain the to-be-rendered material model.
8. The method according to any one of claims 1 to 5, characterized in that, The presenting, in the virtual scene, the motion animation of the to-be-rendered material based on the frame position information sequence includes: In response to a rendering preview operation for the frame position information sequence, presenting a preview animation of the to-be-rendered material based on the frame position information sequence; In response to a parameter correction operation for the preview animation, obtaining simulation correction parameters, obtaining a target position information sequence based on the simulation correction parameters, and presenting the motion animation of the to-be-rendered material in the virtual scene based on the target position information sequence; In response to a confirmation operation for the preview animation, presenting the motion animation of the to-be-rendered material corresponding to the frame position information sequence in the virtual scene.
9. The method according to any one of claims 1 to 5, characterized in that Before obtaining the to-be-rendered parameters in response to the parameter setting operation for the to-be-rendered material model and the to-be-rendered animation data, the method further includes: Converting the to-be-converted rendering resource into a to-be-rendered material resource in a specified data format, where the to-be-converted rendering resource includes a to-be-converted material model and to-be-converted animation data, the to-be-rendered material resource includes the to-be-rendered material model and the to-be-rendered animation data, the to-be-converted material model corresponds to the to-be-rendered material model, and the to-be-converted animation data corresponds to the to-be-rendered animation data; The presenting, in the virtual scene, the motion animation of the to-be-rendered material based on the frame position information sequence includes: Converting the frame position information sequence into to-be-presented data in the specified data format; Presenting the motion animation of the to-be-rendered material in the virtual scene by loading the to-be-presented data.
10. A material rendering device, characterized in that, The material rendering device includes: A parameter setting module, configured to obtain to-be-rendered parameters in response to a parameter setting operation for the to-be-rendered material model and the to-be-rendered animation data, where the to-be-rendered parameters include the number of animation frames and physical simulation parameters; A constraint simulation module, configured to perform the following processing for each to-be-rendered frame corresponding to the number of animation frames: determine, from the to-be-rendered animation data, frame animation data corresponding to the to-be-rendered frame; perform constraint simulation on the physical simulation parameters based on the current position information of the to-be-rendered material model and the frame animation data to obtain frame position information; An information acquisition module, configured to obtain a sequence of frame position information corresponding to the number of animation frames from the frame position information corresponding to each to-be-rendered frame; An animation presentation module, configured to present a motion animation of the to-be-rendered material in a virtual scene based on the sequence of frame position information.
11. An electronic device for material rendering, characterized in that, The electronic device includes: A memory, configured to store computer-executable instructions or a computer program; A processor, configured to implement the material rendering method according to any one of claims 1 to 9 when executing the computer-executable instructions or the computer program stored in the memory.
12. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or the computer program are executed by the processor, the material rendering method according to any one of claims 1 to 9 is implemented.
13. A computer program product, comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or the computer program are executed by the processor, the material rendering method according to any one of claims 1 to 9 is implemented.