Aspects described herein provide resource processing techniques. The technique may include: obtaining spatial change information of a virtual character; obtaining static resource data of a hair resource of the virtual character in a second game scenario; obtaining dynamic resource data of the hair resource in the second game scenario based on the static resource data and the spatial change information; and performing physical simulation on the hair resource based on the dynamic resource data. In the aspects described herein, a world space coordinate system can be introduced into TressFx, to help the hair resource follow movement of the virtual character, to implement real movement performance.
Legal claims defining the scope of protection, as filed with the USPTO.
. A resource processing method, the method being executed by a computer device, and comprising:
. The method according to, wherein one game scenario corresponds to one image frame, and the image frame is configured for describing the game scenario from an image dimension, and the determining comprises:
. The method according to, wherein the determining comprises determining displacement information and rotation information, the dynamic resource data of the hair resource in the second game scenario comprises dynamic position information and dynamic direction information, and
. The method according to, wherein the performing physical simulation on the hair resource based on the dynamic resource data comprises:
. The method according to, further comprising:
. The method according to, wherein the optimizing the spatial change information based on the movement information, to obtain optimized spatial change information comprises:
. The method according to, wherein the hair resource is a virtual hair attached to the virtual character, the virtual hair is formed by a plurality of strand segments connected in a chain manner, and each strand segment is formed by two vertexes connected through a virtual spring; and
. The method according to, further comprising:
. The method according to, further comprising:
. The method according to, wherein a vertex of the hair resource is set with an elasticity attribute, and the method further comprises:
. The method according to, further comprising:
. The method according to, further comprising:
. The method according to, further comprising:
. One or more non-transitory computer readable media storing computer readable instructions which, when executed by a processor, configure a data processing system to perform:
. The computer readable media according to, wherein one game scenario corresponds to one image frame, and the image frame is configured for describing the game scenario from an image dimension, and the determining comprises:
. The computer readable media according to, wherein the determining comprises determining displacement information and rotation information, the dynamic resource data of the hair resource in the second game scenario comprises dynamic position information and dynamic direction information, and
. The computer readable media according to, wherein the performing physical simulation on the hair resource based on the dynamic resource data comprises:
. The computer readable media according to, further comprising:
. The computer readable media according to, wherein the optimizing the spatial change information based on the movement information, to obtain optimized spatial change information comprises:
. A system, comprising:
Complete technical specification and implementation details from the patent document.
This application is a Continuation Application of PCT Application PCT/CN2024/090736, filed Apr. 30, 2024, which claims priority to Chinese Patent Application No. 202310747712.9, filed Jun. 21, 2023, each entitled “RESOURCE PROCESSING METHOD AND APPARATUS, DEVICE, MEDIUM, AND PROGRAM PRODUCT” and each of which is incorporated herein by reference in its entirety.
This application relates to the field of computer technologies, in particular, to the field of games, and specifically, to a resource processing technology.
A TressFx (strand rendering) head hair framework is a hair rendering solution based on physical simulation. Open source TressFx may be integrated into various in-house developed rendering engines to implement hair rendering, so that the TressFx hair rendering solution is widely used.
Currently, although the TressFx uses a spring-mass system to simulate each hair, to achieve a realistic and perfect hair dynamic effect, the TressFx still has some disadvantages. For example, when simulating movement of a virtual character, the TressFx keeps a position of the virtual character unchanged, that is, the virtual character implements actions such as walking, running, and jumping at a same position. Consequently, in a movement process of the virtual character, a hair resource of the virtual character and the virtual character remain relatively fixed all the time, thereby failing to reflect a dynamic offset of the hair resource.
Therefore, when the TressFx is integrated into the in-house developed rendering engine, the TressFx is optimized, to facilitate improving a hair rendering effect of the in-house developed rendering engine.
Aspects described herein provide a resource processing method and apparatus, a device, a medium, and a program product, which can introduce a world space coordinate system into TressFx, to help a hair resource follow movement of a virtual character, to implement real movement performance.
According to one aspect, an aspect described herein provides a resource processing method, the method being performed by a computer device, and the method including:
According to another aspect, an aspect described herein provides a resource processing apparatus, the apparatus being deployed on a computer device, and the apparatus including:
According to another aspect, an aspect described herein provides a computer device, the computer device including:
According to another aspect, an aspect described herein provides a computer-readable storage medium, the computer-readable storage medium having a computer program stored therein, and the computer program being applicable for being loaded and executed by a processor to implement the foregoing resource processing method.
According to another aspect, an aspect described herein provides a computer program product, the computer program product including a computer program, and the computer program, when executed by a processor, implementing the foregoing resource processing method.
In the aspects described herein, the spatial change information of the virtual character in the world space coordinate system may be obtained when the virtual character moves from the first game scenario to the second game scenario, and the spatial change information reflects a position change of the virtual character when moving in the world space. Then, acting the spatial change information on the static resource data of the hair resource of the virtual character in the second game scenario is supported, to obtain the dynamic resource data of the hair resource in the second game scenario, the static resource data being configured for reflecting a static characteristic of the hair resource when the virtual character in the second game scenario is in a static state, and the dynamic resource data being configured for reflecting a dynamic characteristic that the hair resource moves with the virtual character. Finally, physical simulation may be performed on the hair resource based on the dynamic resource data of the hair resource. The physical simulation enables the hair resource to simulate movement performance in the real world in the process in which the virtual character moves from the first game scenario to the second game scenario. In other words, the hair resource simulates the movement performance in the real world in the process in which the virtual character moves from the first game scenario to the second game scenario based on the physical simulation. It can be learned that, in the aspects described herein, world space simulation is added to the TressFx. The spatial change information of the virtual character moving from the first game scenario to the second game scenario acts on the static resource data of the hair resource, to obtain the dynamic resource data of the hair resource in the second game scenario, thereby more accurately controlling, based on the dynamic resource data, the hair resource to dynamically offset with the movement of the virtual character, so that the hair resource in the game world simulates and restores movement performance of the hair resource in the real world as much as possible, thereby improving naturalness and realism of the hair resource in the game scenario in which the virtual character moves.
The following clearly and completely describes the technical solutions in aspects described herein with reference to the accompanying drawings in aspects described herein. The described aspects are only some of the aspects described herein rather than all of the aspects. All other aspects obtained by a person of ordinary skill in the art based on aspects described herein without creative efforts shall fall within the protection scope described herein.
Aspects described herein provide a resource processing solution. Specifically, the solution is a solution of physical simulation of a hair resource based on a TressFx framework. The following briefly describes technical terms and related concepts involved in the aspects described herein.
The physical simulation of the hair resource may be briefly referred to as hair physical simulation, is a computer graphics technology based on the principle of physics, and is configured for simulating a dynamic behavior of the hair resource (or a hair for short) or another elongated soft object. The hair may include, but is not limited to, head hairs (such as hair styles of various shapes (such as a ponytail, a bun, or a braid)), fringes (such as a side-swept fringe or a blunt fringe) of various shapes, temples, beard (such as a moustache or whiskers), fine hairs, and the like. Subsequent aspects described herein are described by using an example in which the hair resource is a head hair resource. This is specifically described herein.
The hair physical simulation mainly describes each hair resource by using a spring-mass system, and considers impact of an external factor such as gravity or wind on movement of the hair resource, to simulate a movement effect of the hair resource as much as possible when the hair resource is affected by the external factor in a real world. In the spring-mass system, one hair resource is considered to be formed by a plurality of vertexes (or referred to as particles) connected to a spring. Each vertex on one hair resource has a position vector and a velocity vector, and two adjacent vertexes are connected through the spring. When the vertex on the hair resource is subjected to an external force generated by the external factor, changes in a position and a velocity of the vertex can prompt movement and deformation of the hair resource as a whole, thereby simulating movement performance of the hair in the real world.
TressFx is a technology for implementing the hair physical simulation, and is specifically a head hair and hair rendering technology based on the physical simulation. The TressFx mainly implements a realistic dynamic movement effect of the hair based on a position-based dynamics (PBD) technology. The PBD is a physical simulation technology based on a constraint condition (or referred to as a constraint for short). A series of constraint conditions are imposed on each particle, to control movement of the particle to simulate a dynamic behavior of an object formed by the particle. Each particle in the PBD has a position vector and a velocity vector, and adjacent particles may be connected through the spring. The spring may be configured for representing an interaction caused after two connected particles are subjected to different types of forces. The force herein may include, but is not limited to, an external force such as gravity, air resistance, wind, or a pulling force.
In addition, the hair resource in the PBD may further be subject to various constraint conditions, the constraint conditions include, but are not limited to, a length limitation, an angle limitation, a global shape constraint, a gravity constraint, a local shape constraint, a movement following constraint, and the like. In this way, in a process of performing physical simulation on the hair resource, iterative calculation is performed based on various set constraint conditions, and a calculation result is applied to related particles forming the hair resource, to control movement of the related particles through the various constraint conditions, thereby ensuring movement authenticity of the hair resource. In addition, in addition to the foregoing various characteristics of the PBD, the TressFx further supports graphics processing unit (GPU) acceleration and multi-thread parallel processing. Compared with another hair rendering technology supporting central processing unit (CPU) processing and single-thread processing, hair rendering efficiency can be effectively improved.
To better understand the TressFx, the following briefly describes a basic principle of the TressFx with reference to a hair resource shown in. As shown in, the TressFx equivalently attaches each hair resource (for example, one head hair) to a virtual hair (or referred to as a strand) on a virtual character (actor), and the virtual character (specifically, a head of the virtual character) is an attached object (hair-attached object) of the hair resource. The virtual hair is a continuous segment formed by a plurality of strand segments connected in a chain manner, each strand segment is formed by two endpoints connected through a virtual spring, and an endpoint of each strand segment is used as a vertex. For example, a strandshown inincludes 10 continuous strand segments (which are respectively a strand segment→a strand segment→ . . . →a strand segment), the strand segmentis directly attached to the virtual character through a vertex, and the strand segment→ . . . →the strand segmentare sequentially connected to the strand segment. In an actual virtual scenario, if the hair resource moving with the virtual character needs to be simulated, movement of the vertex of the hair resource needs to be controlled to facilitate the hair resource to simulate movement performance of real hair in the real world.
.
To make the physical simulation for the hair resource be closer to a real phenomenon and improve realism and authenticity of the hair resource, the following constraints are further imposed on physical movement of the hair resource, to perform physical calculation on the hair resource. These constraints include, but are not limited to:
The foregoing (a) to (g) are illustrative constraints set by the TressFx for the physical movement of the hair resource. In addition, considering that a quantity of hair resources of the virtual character is large, to reduce a physical calculation amount of the hair resource, the TressFx further supports dividing the hair resource into a guide strand and a follow strand. In the physical simulation, dynamics simulation, wind field simulation, and the like need to be implemented for the guide strand. The guide strand generates a physical simulation result of the follow strand through offset, and collision detection and correction are performed on all strands. For an illustrative schematic diagram of generating the follow strand from the guide strand, refer to. As shown in, in an actual physical simulation process, the foregoing various types of physical simulation calculations are implemented for a guide strand, then a corresponding follow strandmay be generated by offsetting (for example, offsetting the position) the guide strand. In this way, a hair volume of the virtual character can be ensured while the calculation amount is reduced.
In an actual application, the TressFx provides a complete hair resource simulation solution, but some simulation solutions provided by the TressFx still worth optimizing and expanding. To better deal with a faster and more complex animation situation and improve the authenticity of the hair resource after open-source TressFx is integrated into an in-house developed rendering engine, in the aspects described herein, an encapsulated head hair simulation framework TressFx is extended, and some problems in the TressFx are optimized. The following briefly describes extensions and improvement points of the resource processing solution provided in the aspects described herein for the TressFx, and the extensions and the improvement points are described in detail in subsequent aspects.
Considering that displacement of the virtual character may affect the vertex of a hair resource, as described above, when the hair resource follows the movement of the attached object, the pulling acceleration may affect the head hair position. However, the physical simulation implemented by the TressFx needs to keep the virtual character from moving. For example, the virtual character performs actions such as walking, running, and jumping in place. In an actual scenario, the virtual character usually moves. For example, the virtual character runs from a first virtual scenario to a second virtual scenario, that is, the movement of the virtual character causes displacement in the world space. In this way, when the TressFx does not support the displacement in the world space, if the virtual character performs an action such as running, the hair resource of the virtual character and the virtual character always keep a relatively fixed posture, and a dynamic offset effect that the hair resource changes with the movement of the virtual character cannot be reflected.
Based on this, to better control the shape and the movement of the hair resource in the movement process of the virtual character, in the aspects described herein, world space simulation and a global offset function are added to the TressFx. The world space simulation and the global offset function can be used to effectively analyze an impact of the displacement of the virtual character on the vertex of the hair resource, and perform adaptability and personalized adjustment based on different movement situations of the virtual character, so that movement of the hair resource can achieve an optimal effect. Technical means of the world space simulation and the global offset function are added to the TressFx, so that a position, a direction, and an overall shape of the hair resource can be controlled more accurately, and more realistic movement performance can be implemented.
In the aspects described herein, in the movement process of the virtual character, spatial change information of the virtual character may be obtained. The spatial change information indicates a position change of the virtual character in a world space coordinate system when the virtual character moves from a first game scenario to a second game scenario. Then, the hair resource of the virtual character stores static resource data in each game scenario, and the static resource data may be configured for reflecting a static characteristic of the hair resource when the virtual character is in a static state in the second game scenario. In this case, dynamic resource data of the hair resource in the second game scenario may be generated based on the static resource data and the obtained spatial change information, and the dynamic resource data is configured for reflecting a dynamic characteristic that the hair resource moves with the virtual character. Finally, physical simulation is performed on the hair resource based on the dynamic resource data, so that in the process in which the virtual character moves from the first game scenario to the second game scenario, the hair resource simulates movement performance in the real world.
It can be learned that, in the aspects described herein, world space simulation is added to the TressFx. The spatial change information of the virtual character moving from the first game scenario to the second game scenario acts on the static resource data of the hair resource, to obtain the dynamic resource data of the hair resource in the second game scenario, thereby more accurately controlling, based on the dynamic resource data, the hair resource to dynamically offset with the movement of the virtual character, so that the hair resource in the game world simulates and restores movement performance of the hair resource in the real world as much as possible, thereby improving naturalness and realism of the hair resource in the game scenario in which the virtual character moves.
1. A dynamic effect of the hair resource is optimized, including aspects such as fluttering, lateral movement, and fine hair dynamics. To achieve a more realistic hair simulation effect, in the TressFx, a physical engine is used to simulate a movement process of the hair, and an impact caused by factors such as the gravity, the air resistance, and the displacement of the virtual character on the movement of the hair resource is considered. Further, considering that a quantity of parameters corresponding to various factors provided by the TressFx is large, the aspects described herein support optimizing a calculation process through methods such as modifying the local shape constraint through parameter controlling and skinning data after animation, thereby enhancing the hair simulation effect of the virtual character in the movement process.
2. The plurality of hair resources can form the hair resource set, and the hair resource set may present a fixed shape (or a specific shape). For example, the fixed shape of the hair resource set includes any one of the following: the virtual ponytail, the virtual bun, and the virtual braid. For ease of description, an example in which the fixed shape of the hair resource set is the virtual ponytail (or the ponytail for short) is used. In the TressFx, if the virtual character performs quick squatting action (for example, from squatting to standing, or from standing to squatting) in place, the virtual ponytail easily has problems that a root of the ponytail is lifted, ends of the ponytail spreads out, the ponytail lacks a sense of drape, the ponytail is elongated, and the like in the movement process of the virtual character. Therefore, the aspects described herein provide various technical means to better control an overall shape of the virtual ponytail and the collision problem, and adjust the length constraint to optimize a lengthening effect.
For example, when resolving the problem that the virtual ponytail is easily lifted and lacks the sense of drape, parameters such as an elasticity coefficient and a gravity parameter are added to prevent the ponytail from being lifted and enhance the sense of drape of the ponytail. For another example, when resolving the problem that tail ends of the ponytail easily spreads out, a coefficient may be added to the local shape constraint to accurately identify tail ends of the ponytail, and an overall shape of tail ends of the ponytail is further fixed by adding the constraint, thereby preventing tail ends of the ponytail from spreading out and appearing unnatural in the movement process of the virtual character. For another example, when the TressFx deals with impact caused by a velocity change, there is actually only a position change amount that finally participates in calculation to change the vertex position in the hair resource. This calculation manner may cause hair resource lengthening. Even if the length constraint can relieve the problem of strand lengthening to some extent, stiffness and damping of the hair resource are small, and the acceleration is excessively large. When a sudden change in velocity is excessively large, there is still an apparent lengthening phenomenon. The aspects described herein supports adjusting a calculation sequence between the various constraint conditions to relieve the problem of strand lengthening, and also supports correcting the constraint formula of the length constraint, which is similar to adding a stiffness coefficient to relieve the problem of strand lengthening.
3. In the TressFx, vibration velocity propagation VSP is an important calculation process in the physical simulation. Currently, a calculation amount of the VSP is large. The aspects described herein supports modifying the calculation process of the VSP, and specializing a calculation manner of the VSP. Therefore, a better velocity vibration transmission effect can be obtained while improving calculation efficiency to implement a hair simulation process more quickly.
4. A hair resource generation policy is optimized: In a generation solution that is provided by the TressFx and that is of a parallel hair resource using 64 hair resources as a group, in the aspects described herein, a redundant hair resource included in the last generation group are no longer overlapped rendered and displayed, but display space of the redundant hair resource is changed to hide the redundant hair resource, thereby avoiding problems such as hair thickening caused by overlapping rendering, ensuring quality and reliability of the generated hair resource, and improving authenticity of hair rendering.
In the aspects described herein, the in-house developed rendering engine provided in the aspects described herein implements hair resource rendering based on the TressFx. Compared with a hair piece model, using a continuous curve to represent a virtual hair can better capture real and subtle movement and change of the hair resource, and present a more natural and realistic effect. In addition, using continuous curve modeling can accurately control overall modeling, thereby improving flexibility of modeling control. For a schematic diagram of comparison between an illustrative hair resource rendered by using the hair piece model and a hair resource rendered by using the TressFx, refer to FIG. 2. In addition, in the aspects described herein, a means such as world space simulation is added to the TressFx, so that an art designer can more accurately learn of a position, a direction, and an overall shape of the vertex in the hair resource, thereby implementing more realistic movement performance. Further, in the aspects described herein, some existing solutions in the TressFx are optimized. Compared with an original solution in the TressFx, a position and a direction of each vertex of the hair resource can be controlled and learned more accurately, thereby effectively grasping an entire shape of a hair resource plan of the hair resource. In conclusion, in the aspects described herein, through expansion and optimization of the foregoing technologies, performance and an effect of hair resource simulation are further improved based on the TressFx, a use range and an effect of the hair resource simulation solution in an actual application are expanded, and an effect requirement of a 3A game (that is, a game with high development costs, a long development period, and high resource consumption) is satisfied.
As described above, the resource processing solution provided in the aspects described herein is provided based on the TressFx framework. Therefore, the resource processing solution provided in this aspect described herein is universal and applicable to all application scenarios in which the TressFx framework is integrated and hair resource rendering needs to be performed. The application scenario may include, but is not limited to, a game scenario, a digital person scenario, a virtual reality (VR) scenario, an augmented reality (AR) scenario, and the like.
In a possible implementation, the application scenario may be the game scenario. There are a variety of game characters in the game scenario, and a game player may perform movements such as running, jumping, and flying by manipulating the game character. The resource processing solution provided in the aspects described herein is used to render the hair resource of the game character in a movement process, so that a dynamic effect of the hair resource can simulate, as much as possible, dynamic performance of the hair that needs to be presented when the game character performs movement in a real environment, and highly restore movement performance of the hair resource. For example, in a process in which a game character in the game scenario runs quickly, a hair resource of the game character dynamically changes with the game character. When the game character runs to the right, a root vertex of the hair resource of the game character is connected to a head model of the game character, but a tail vertex of the hair resource is always located at a left side of the root vertex. When the game character suddenly stops, the tail vertex of the hair resource is located at a right side of the root vertex due to inertia.
In a possible implementation, the application scenario may be the digital person scenario. A digital person or a virtual person is a digital character image that is close to a human image and that is created by using the digital technologies. The digital person may be applied to various fields, including but not limited to, applied to an audio/video call. In this case, a real person during the audio/video call may be converted into the digital person, and the digital person simulates a hair style, an expression, an action, and the like of the real person, or applied to a guided human-computer interaction scenario. In this scenario, the digital person may explain (for example, intelligently explain in a museum) content to a user, prompt an action (for example, prompt the user to perform some operations in an interface), or the like. An application field of the digital person is not limited in the aspects described herein. When the digital person may be applied to any application field, physical simulation may be performed on a hair resource of the digital person by using the resource processing solution provided in the aspects described herein, to pursue a more realistic and detailed hair rendering effect, thereby providing immersive experience for the user.
In a possible implementation, the application scenario may be the VR scenario or the AR scenario. VR and AR are two simulation technologies that can bring the user into a virtual world. A difference between the AR and the VR is that, the AR adds digital information to the real world, so that the user experiences abundant and interactive digital information in an original environment, while the VR completely isolates the real world, and places the user into a virtual environment. In the VR scenario or the AR scenario, the virtual character may need to be rendered in the virtual world. For example, the virtual character may be a person or an animal carrying the hair resource. In this case, the resource processing solution provided in the aspects described herein may be used to render the hair resource of the virtual character, to improve realism of the virtual character in the VR scenario or the AR scenario and improve immersive experience of the user.
The foregoing descriptions are merely illustrative descriptions of an application scenario to which the aspects described herein are applicable, and do not limit the application scenario to which the aspects described herein are applicable.
The aspects described herein support execution of the resource processing solution by a computer device. The computer device may be any device on which the in-house developed rendering engine is deployed. The in-house developed rendering engine integrates the TressFx framework, and uses this solution to expand and optimize the framework. The computer device may be a terminal device, and the terminal device may include, but is not limited to, devices such as a smartphone, a tablet computer, a portable personal computer, a mobile Internet device (MID for short), an in-vehicle device, and a head-mounted device. Types of the terminal device are not limited in the aspects described herein, and are described herein. In some aspects, the computer device may be a server. The server may be an independent physical server, or may be a server cluster or a distributed system including a plurality of physical servers, or may be a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a content delivery network, and big data and an artificial intelligence platform. A specific type of the server is not limited in the aspects described herein.
Based on the foregoing described resource processing solution, the aspects described herein provide a more detailed resource processing method. It can be known from the foregoing descriptions that in the resource processing solution provided in the aspects described herein, the TressFx is mainly extended and optimized. An extended part (that is, the world space simulation and the global offset function are added to the TressFx) for the TressFx is described in detail below with reference to.is a schematic flowchart of a resource processing method according to an illustrative aspect described herein. The resource processing method may be performed by the computer device described above, and the resource processing method may include, but is not limited to, operations shown in operation Sto operation S.
Operation S: Obtain spatial change information of a virtual character.
The spatial change information of the virtual character may indicate a position change of the virtual character in a world space coordinate system when the virtual character moves from a first game scenario to a second game scenario. In other words, the spatial change information represents a change situation of a position of the virtual character when the virtual character moves in the world space coordinate system. A game scenario in this aspect described herein may correspond to an image frame, that is, one game scenario corresponds to one image frame. The image frame may be configured for describing the game scenario from an image dimension. Therefore, when a plurality of consecutive image frames are played in sequence, a dynamic process in which the virtual character moves from one game scenario to another game scenario can be presented.
This aspect described herein supports obtaining the spatial change information of the virtual character through different image frames including a movement process of the virtual character. In a possible implementation, a first image frame corresponding to the first game scenario when the virtual character is in the first game scenario may be obtained, and first spatial position information of the virtual character in the first image frame in the world space coordinate system is calculated, the first spatial position information indicating a spatial position of the virtual character in the first game scenario. Similarly, a second image frame corresponding to the second game scenario when the virtual character is in the second game scenario may be obtained, and second spatial position information of the virtual character in the second image frame in the world space coordinate system is calculated, the second spatial position information indicating a spatial position of the virtual character in the second game scenario. In a 3D (Dimensions) game (that is, a game in which an operation is implemented by using spatial three-dimensional calculation technologies), the spatial position information (for example, the first spatial position information and the second spatial position information) described above may be represented as (x, y, z). x represents a position of the virtual character on a horizontal axis x of the world space coordinate system, y represents a position of the virtual character on a vertical axis y of the world space coordinate system, and z represents a position of the virtual character on a depth axis z of the world space coordinate system. When x=0, y=0, and z=0, a point (0, 0, 0) is an origin of the world space coordinate system. Finally, the spatial change information of the virtual character may be calculated based on the first spatial position information of the virtual character in the first game scenario and the second spatial position information of the virtual character in the second game scenario.
For an illustrative schematic diagram of an illustrative world space coordinate system, refer to. As shown in, for ease of description, a dotis used to represent the virtual character. It is assumed that the first spatial position information of the virtual character in the first game scenario is represented as (x, y, z). When the virtual character moves from the first game scenario to the second game scenario, it is assumed that the second spatial position information of the virtual character in the second game scenario is represented as (x, y, z). Values on same axes in the first spatial position information (x, y, z) and the second spatial position information (x, y, z) are subtracted (for example, a position xon the horizontal axis-a position xon the horizontal axis, position yon the vertical axis-position yon the vertical axis, and a position zon the depth axis-a position zon the depth axis). A value obtained by subtraction is a movement distance of the virtual character on the axis, and a sign (for example, a positive sign “+” or a negative sign “−”) obtained by subtraction indicates a movement direction of the virtual character along the axis.
Operation S: Obtain static resource data of a hair resource of the virtual character in the second game scenario.
Operation S: Obtain dynamic resource data of the hair resource in the second game scenario based on the static resource data and the spatial change information.
In operation Sand operation S: 1. The hair resource of the virtual character has the static resource data (specifically, static resource data of a root vertex of each hair resource) in each image frame (that is, the game scenario), and the static resource data may be configured for reflecting a static characteristic of the hair resource when the virtual character is in a static state in the corresponding game scenario. The static resource data may specifically include static position information and static direction information of the hair resource, and the static characteristic is represented through the static position information and the static direction information. The static position information indicates a position of the hair resource when the virtual character keeps static in the game scenario, and the static direction information indicates a direction (the direction of the hair resource may be simply understood as a rotation angle of an attached object to which the hair resource is attached, for example, if the attached object is a head model of the virtual character, the rotation angle may be a rotation angle of the head model) of the hair resource when the virtual character keeps static in the game scenario.
2. The spatial change information of the virtual character between two image frames (for example, the first image frame and the second image frame described above) when the virtual character moves may be represented in a matrix form, and spatial change information in the matrix form includes displacement information and rotation information of the virtual character between the two image frames. The displacement information in the spatial change information indicates information such as a displacement distance and a displacement direction generated when the virtual character moves from the first game scenario to the second game scenario. For example, the displacement information indicates that the virtual character moves by 10 meters (the displacement distance) along a positive direction (the displacement direction) of the x axis of the world space coordinate system when the virtual character moves from the first game scenario to the second game scenario. The rotation information in the spatial change information indicates a rotation angle of the head model of the virtual character in the world space coordinate system when the virtual character moves from the first game scenario to the second game scenario. In a visual effect, the head model of the virtual character rotates, such as the rotation caused by tilting the head to look to the left or raising the head to look up. For an illustrative schematic diagram that the virtual character displaces and rotates at the same time when the virtual character moves from the first game scenario to the second game scenario, refer to. As shown in a first figure shown in, when the virtual character changes from facing forward to raising the head to the upper left corner, it is determined that the head model of the virtual character rotates. In this case, the spatial change information includes the rotation information (such as the rotation angle and the rotation direction) of the head model of the virtual character. As shown in a second image shown in, when the virtual character changes from being static facing a side to turning the head and running, the head model of the virtual character not only displaces but also rotates. In this case, the spatial position information includes the displacement information (for example, the displacement direction and the displacement distance) and the rotation information.
Based on the foregoing basic introduction to the static resource data and the spatial change information, after the static resource data of the hair resource of the virtual character in the second game scenario (or the second image frame), and the spatial change information of the virtual character in the world space coordinate system when the virtual character moves from the first game scenario (or the first image frame) to the second game scenario are obtained, the spatial change information may act on the static resource data, to obtain new data through calculation. The new data is spatial position data of the hair resource with global spatial variation (the static resource data includes only a static position of a skin in the head model, and does not include the displacement information, the rotation information, and the like). As described above, the spatial change information may be represented as a matrix, and then the foregoing process of acting the spatial change information on the static resource data may be understood as multiplying the matrix by the static resource data. A possible implementation may include, but is not limited to: determining static position information of the hair resource in the second game scenario from the static resource data, and determining dynamic position information of the hair resource in the second game scenario based on the static position information and the displacement information in the spatial change information. Similarly, the static direction information of the hair resource in the second game scenario is determined from the static resource data, and the dynamic direction information of the hair resource in the second game scenario is determined based on the static direction information and the rotation information in the spatial change information. In this way, the dynamic resource data (that is, the new data) of the hair resource in the second game scenario is formed based on the dynamic position information and the dynamic direction information obtained in the foregoing two operations. The dynamic resource data is configured for reflecting a dynamic characteristic that the hair resource moves with the virtual character. For example, if the virtual character moves to the left, ends of the hair resource move to the left at a movement velocity slightly behind the virtual character, to simulate movement performance of the hair resource moving with the virtual character in the real world.
It can be learned that, the spatial change information generated by the virtual character in the movement process acts on the static resource data of the hair resource of the virtual character in the second image frame, so that the hair resources can be converted from the static resource data to the dynamic resource data, thereby driving the hair resource to follow the movement of the virtual character based on the dynamic resource data to present a corresponding dynamic effect. This manner not only has advantages of simple and convenient calculation, but also can control the movement of the hair resource more accurately, thereby improving the dynamic effect that the hair resource moves with the virtual character in the real world.
Unknown
October 16, 2025
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.