A virtual character processing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202611185609.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-10-30
AI Technical Summary
然而,由于虚拟角色的骨骼动画系统会驱动角色执行各类姿态变化,当虚拟角色处于特定动作姿态或被相机从特定视角观察时,角色身体的敏感部位(如裙底、胸前等)可能进入相机的可视范围,从而出现走光现象(即虚拟角色模型的局部区域暴露于可视空间中,下文统称走光),影响游戏画面的合规性、美观性和用户的观感体验
[0009]采用本申请实施例的方案,可以通过在虚拟角色的目标部位存在遮挡需求的情况下,根据虚拟角色当前播放的角色动画,确定对目标部位的遮挡方向;计算拍摄虚拟角色的虚拟相机的相机方向与遮挡方向之间的目标角度;基于预设角度与预设显示控制参数之间的对应关系,确定与目标角度匹配的目标显示控制参数;基于目标显示控制参数,对与虚拟角色关联的遮挡元素实例进行渲染处理,以在虚拟角色的目标部位上呈现遮挡视觉效果。如此,可以通过对遮挡元素实例的渲染,避免出现虚拟角色的走光现象。
Smart Images

Figure CN122998722A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of virtual character processing technology, and in particular to a virtual character processing method, apparatus, electronic device and storage medium. Background Technology
[0002] In 3D online games, virtual characters are typically composed of a character model and various cosmetic elements (such as tops, pants, skirts, etc.) fitted onto the model to support flexible appearance customization. Users can adjust the visual presentation of the virtual character by changing different cosmetic elements. However, because the skeletal animation system of the virtual character drives various pose changes, when the virtual character is in a specific pose or is observed by the camera from a specific angle, sensitive parts of the character's body (such as under the skirt, chest, etc.) may enter the camera's field of view, resulting in "wardrobe malfunction" (i.e., a local area of the virtual character model is exposed in the visible space, hereinafter referred to as "wardrobe malfunction"), which affects the compliance, aesthetics, and user experience of the game screen. Summary of the Invention
[0003] This application provides a virtual character processing method, device, electronic device, and storage medium, which avoids the phenomenon of virtual characters exposing themselves by dynamically changing the visual occlusion effect according to the character's posture and viewpoint.
[0004] In a first aspect, embodiments of this application provide a method for processing virtual characters, the method comprising: When there is a need to occlude a target part of a virtual character, the occlusion direction for the target part is determined based on the character animation currently being played by the virtual character. Calculate the target angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction; Based on the correspondence between preset angles and preset display control parameters, target display control parameters that match the target angle are determined. Based on the target display control parameters, the occlusion element instances associated with the virtual character are rendered to present an occlusion visual effect on the target part of the virtual character.
[0005] Secondly, embodiments of this application provide a virtual character processing device, the device comprising: The direction determination module is used to determine the occlusion direction of the target part of the virtual character based on the currently playing character animation when there is an occlusion requirement for the target part of the virtual character. An angle determination module is used to calculate the target angle between the camera direction of the virtual camera that captures the virtual character and the occlusion direction; The parameter determination module is used to determine the target display control parameters that match the target angle based on the correspondence between the preset angle and the preset display control parameters; The rendering module is used to render instances of occlusion elements associated with the virtual character based on the target display control parameters, so as to present an occlusion visual effect on the target part of the virtual character.
[0006] Thirdly, embodiments of this application also provide an electronic device, which includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of any of the virtual character processing methods.
[0007] Fourthly, embodiments of this application also provide a computer-readable storage medium including a computer program, which, when run on an electronic device, causes the electronic device to perform the steps of any of the virtual character processing methods.
[0008] Fifthly, embodiments of this application also provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the electronic device to perform the steps of any of the virtual character processing methods provided in embodiments of this application.
[0009] The solution adopted in this application embodiment can determine the occlusion direction of the target part of the virtual character based on the currently playing character animation when there is a need for occlusion of the target part; calculate the target angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction; determine the target display control parameters matching the target angle based on the correspondence between preset angles and preset display control parameters; and render the occlusion element instances associated with the virtual character based on the target display control parameters to present an occlusion visual effect on the target part of the virtual character. In this way, by rendering the occlusion element instances, the phenomenon of the virtual character being exposed can be avoided. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1This is a schematic diagram of an implementation environment scenario for the virtual character processing method provided in this application embodiment; Figure 2 This is a schematic flowchart of one embodiment of the virtual character processing method provided in this application. Figure 3 This is a schematic diagram of the display effect of the occlusion particle system of the virtual character processing method provided in this application, which changes with the angle between the camera direction and the occlusion direction. The angle between the camera direction and the occlusion direction decreases sequentially from left to right, and the opacity and scaling ratio of the occlusion particle system increase sequentially.
[0012] Figure 4 This is a schematic diagram of the structure of the virtual character processing device provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. At the same time, in the description of the embodiments of this application, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0014] This application provides a virtual character processing method, apparatus, electronic device, and computer-readable storage medium. Specifically, this embodiment will be described from the perspective of a virtual character processing apparatus, which can be integrated into an electronic device. That is, the virtual character processing method of this application embodiment can be executed by an electronic device. Optionally, the electronic device may include a terminal device. The terminal device may be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, game console, or personal computer (PC), etc.
[0015] The virtual character processing method provided in this application can be applied to systems such as virtual character processing systems. This virtual character processing system can include a player terminal device and a server. The terminal can be a device that includes both receiving and transmitting hardware, i.e., a device with receiving and transmitting hardware capable of performing bidirectional communication over a bidirectional communication link. The player terminal device and the server can communicate bidirectionally via a network.
[0016] Optionally, the server can be a standalone server, or a server network or server cluster, including but not limited to computers, network hosts, single network servers, multiple network server sets, or cloud servers composed of multiple servers. Cloud servers consist of a large number of computers or network servers based on cloud computing.
[0017] In one embodiment of this disclosure, the virtual character processing method can run on a local terminal device or a server. When the virtual character processing method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0018] For example, when this virtual character processing method runs on a terminal, the terminal device stores a game application and uses it to render virtual scenes in the game. The terminal device is used to interact with the user through the screen, such as downloading, installing, and running the game application. The way the terminal device provides the screen to the user can be varied; for example, it can render the display on the terminal device's screen or present the screen through holographic projection. For instance, the terminal device can include a touchscreen display and a processor. The touchscreen display is used to present the screen and receive operation commands generated by the user interacting with the screen, which includes game graphics. The processor is used to run the game, generate the screen, respond to operation commands, and control the display of the screen on the touchscreen display.
[0019] For example, when this virtual character processing method runs on a server, it can be cloud gaming. Cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game application and the game screen presentation are separate. The storage and execution of the virtual character processing method are completed on the cloud gaming server. The game screen presentation is completed on the cloud gaming client. The cloud gaming client is mainly used for receiving and sending game data and presenting the game screen. For example, the cloud gaming client can be a display device with data transmission capabilities close to the user, such as a mobile terminal, television, computer, PDA, or personal digital assistant. However, the terminal device for processing game data is the cloud gaming server in the cloud. When playing the game, the user operates the cloud gaming client to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the cloud gaming client via the network, and finally, the cloud gaming client decodes and outputs the game screen.
[0020] Please see Figure 1 , Figure 1 This is a schematic diagram of a virtual character processing system provided in an embodiment of this application. The system may include at least one terminal, at least one server, at least one database, and a network. The user's terminal can connect to different game servers via the network. The terminal is any device with computing hardware capable of supporting and executing software products corresponding to the game. Furthermore, when the system includes multiple terminals, multiple servers, and multiple networks, different terminals can connect to each other through different networks and servers. The network can be a wireless network or a wired network, such as a wireless local area network (WLAN), local area network (LAN), cellular network, 2G network, 3G network, 4G network, 5G network, etc. Additionally, different terminals can also connect to other terminals or servers using their own Bluetooth networks or hotspot networks. For example, multiple users can connect online through different terminals via appropriate networks and synchronize with each other to support multiplayer games. Furthermore, the system may include multiple databases coupled to different servers, and can continuously store information related to the game environment in the databases while different users are playing multiplayer games online.
[0021] This application provides a virtual character processing method, which can be executed by a terminal or a server. This application example illustrates the virtual character processing method executed by a terminal. The terminal may include a touchscreen display and a processor (of course, the terminal may also use peripherals such as a mouse or keyboard as input devices; this example only uses a touchscreen display). The touchscreen display is used to present the screen and receive operation commands generated by the user's actions on the screen. When the user operates the screen through the touchscreen display, the screen can control the local content of the terminal in response to the received operation commands, or it can control the content of a peer server in response to the received operation commands. For example, the operation commands generated by the user's actions on the screen may include commands to launch a game application. The processor is configured to launch the game application after receiving the user's command to launch the game application. Furthermore, the processor is configured to render and draw the screen associated with the game on the touchscreen display. The touchscreen display is a multi-touch sensitive screen capable of sensing touch or swipe operations performed simultaneously by multiple points on the screen. When the user performs touch operations on the screen using their finger, the screen, upon detecting the touch operation, controls different virtual objects on the game screen to perform actions corresponding to the touch operation. For example, the game can be any of the following: casual game, action game, role-playing game, strategy game, sports game, puzzle game, etc. The game can include a virtual scene drawn on a graphical user interface displayed on the screen. Furthermore, the virtual scene can include one or more virtual objects, such as virtual characters, controlled by the user (or player). Additionally, the virtual scene can include one or more obstacles, such as railings, ditches, walls, etc., to restrict the movement of virtual objects, for example, restricting the movement of one or more objects to a specific area within the virtual scene. Optionally, the virtual scene can also include one or more elements, such as skills, scores, character health status, energy, etc., to provide assistance to the player, offer virtual services, increase scores related to player performance, etc. Furthermore, the graphical user interface displayed on the screen can present one or more indicators to provide guidance information to the player. For example, the game can include virtual objects controlled by the player and one or more other virtual objects (such as enemy characters). In one embodiment, one or more other virtual objects are controlled by other players in the game. For example, one or more other virtual objects can be controlled by computer devices, such as robots using artificial intelligence (AI) algorithms, to achieve a human-computer interaction mode. For example, virtual objects possess various skills or abilities that game players use to achieve objectives. For instance, a virtual object might possess one or more weapons, items, tools, etc., that can be used to eliminate other objects in the game. Such skills or abilities can be activated by the game player using one of several preset touch operations on the terminal's touchscreen display.The processor can be configured to respond to operation commands generated by the user's touch operation to display the corresponding game screen.
[0022] It should be noted that, Figure 1 The schematic diagram of the virtual character processing system shown is merely an example. The virtual character processing system and scenario described in this application embodiment are for the purpose of more clearly illustrating the technical solutions of this application embodiment and do not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.
[0023] The following detailed description is provided in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal device as an example. It should be noted that the order of description in the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the accompanying drawings.
[0024] Specifically, please refer to Figure 2 , Figure 2 This application provides a virtual character processing method, the specific flow of which can be summarized in steps 101 to 104, wherein: Step 101: If there is a need to occlude the target part of the virtual character, determine the occlusion direction of the target part based on the character animation currently being played by the virtual character.
[0025] In this context, a virtual character refers to a controllable dynamic object within a virtual environment. Optionally, this dynamic object can be a virtual human, virtual animal, an anime character, etc. This virtual character is either controlled by the player through an input device, or it can be artificial intelligence (AI) trained and set up for combat in a virtual environment, or a non-player character (NPC) set up for combat in a virtual environment. In one possible implementation, the user can control the virtual character to move within the virtual environment, for example, controlling the virtual character to run, jump, crawl, etc.
[0026] The target body part refers to a specific body area in the 3D model of a virtual character that requires occlusion. Target body parts include, but are not limited to, the buttocks, chest, and other body areas of the virtual character that need to be occluded.
[0027] Character animation refers to the collection of animation data that drives a 3D model of a virtual character to perform specific actions or posture changes. Character animation encompasses various animation types, including but not limited to state machines and montage. A state machine is a system used to manage animation state transitions. It controls the character's animation performance by defining different states (such as walking, running, jumping, etc.) and transition conditions between states. State machines are typically static; the animation sequence is fixed within each state and cannot be dynamically adjusted at runtime. Montage, on the other hand, is a method for dynamically playing character animations. It allows for the insertion and playback of animations (such as dancing animations, interactive animations, etc.) under specific conditions. It can be used in conjunction with state machines, achieving more flexible animation control through a slot mechanism. Animation clips can be quickly invoked and played without modifying the state machine.
[0028] The occlusion direction refers to the direction vector in the world space where the virtual character is located, which is used to approximately represent the direction from the exposed area of the target part to the bone associated with the target part. It is used to compare with the camera direction of the virtual camera to calculate the target angle.
[0029] It should be noted that the occlusion direction changes dynamically depending on the character animation currently being played by the virtual character. Under different animation types (such as state machine animation and montage animation), the system adopts differentiated technical paths to determine the occlusion direction. For specific determination methods, please refer to the embodiment description in step 101 below.
[0030] Here, the animation curve refers to the curve track attached to the character's animation (such as the Animation Curve in a UE animation sequence, which can be obtained in real time by the animation instance), used to record numerical changes over time during animation playback. In this embodiment, the animation curve can be used to assist in calculating the occlusion direction of the virtual character when playing state machine animation.
[0031] Animation instances can be animation blueprint instances in the engine (such as AnimInstance in UE), used to manage the animation state and animation curve sampling of virtual characters at runtime.
[0032] Specifically, the step "determine the occlusion direction of the target part based on the currently playing character animation of the virtual character" includes: determining the occlusion direction of the target part based on the animation type of the currently playing character animation and the current animation frame of the character animation. The animation type of the character animation includes, but is not limited to, state machines and montages.
[0033] The current animation frame indicates the current playback position of the character animation and can be represented as a frame index (integer), cumulative playback time (seconds), or normalized playback progress (a floating-point value between 0 and 1). Those skilled in the art can select any of the above representation methods as the input to the current animation frame depending on the engine implementation, and this application does not impose any restrictions on this.
[0034] In some embodiments, when the character animation belongs to the first animation type, the determination of the occlusion direction is based on the first rotation information of the target bone. The first animation type is used to indicate montage animation. The target bone is used to indicate the bone in the virtual character associated with the target body part. For example, when the target body part is the virtual character's hip, the target bone can be the pelvis bone of the virtual character; when the target body part is the virtual character's chest, the target bone can be the thoracic bone or the spinal bone of the virtual character. The specific association can be configured according to the actual model's skeletal structure and is not limited here.
[0035] Under this technical approach, the step "determine the occlusion direction of the target part based on the animation type of the currently playing character animation and the current animation frame of the character animation" may include: if the animation type of the character animation is a first animation type, obtaining the first rotation information of the target bone in the character animation based on the current animation frame of the character animation, wherein the target bone is used to indicate the bone in the virtual character associated with the target part; mapping the bone space direction vector of the target bone to the world space where the virtual character is located based on the first rotation information to obtain the world space direction vector of the target bone; and determining the occlusion direction of the virtual character based on the world space direction vector of the target bone.
[0036] The first rotation information is used to indicate the actual rotation posture of the target bone in the current animation frame, and comprehensively reflects the cumulative transformation results of the animation drive, physical simulation and controller input on the bone.
[0037] For example, the pelvic bone of the virtual character is located, and the actual rotation posture of the pelvic bone in the current animation frame is obtained. Then, the bone space direction vector of the pelvic bone (used to approximately represent the direction from the exposed area of the target part to the bone, which is a vector (0, -1, 0) in this embodiment, and the specific direction value depends on the model bone coordinate system and the orientation of the target part) is transformed into world space through this rotation value, thereby obtaining the world space direction vector of the target bone. Finally, based on the world space direction vector of the target bone, the occlusion direction of the target part of the virtual character is determined. It should be noted that the first rotation information of the target bone can be obtained through engine interfaces such as GetSocketRotation and GetBoneRotation, and this application does not limit this.
[0038] In some embodiments, when the character animation belongs to the second animation type, the determination of the occlusion direction is based on the rotation information determined by the animation instance of the virtual character. The second animation type is used to indicate the state machine animation.
[0039] Under this technical approach, the step "determine the occlusion direction of the target part based on the animation type of the currently playing character animation and the current animation frame of the character animation" can include: if the animation type of the character animation is the second animation type, obtaining the animation instance of the virtual character and obtaining the animation curve matching the animation instance; obtaining the rotation angle corresponding to the current animation frame of the character animation from the animation curve; rotating the second direction vector of the virtual character around the rotation axis by the rotation angle, using the axis containing the first direction vector of the virtual character as the rotation axis, to obtain the rotated vector; and determining the occlusion direction of the virtual character based on the rotated vector. Here, the first direction vector indicates the rightward vector of the character, and the second direction vector indicates the upward vector of the character.
[0040] It should be noted that obtaining the rotation angle corresponding to the current animation frame from the animation curve can be achieved by sampling the animation curve by passing in the frame index, the cumulative playback time, or the normalized playback progress. This application does not impose any restrictions on this.
[0041] For example, an animation instance of a virtual character is obtained, and the rotation angle of the animation curve in the current animation frame is obtained by sampling the animation instance; the character's rightward vector (i.e., the character's first direction vector) and the character's upward vector (i.e., the character's second direction vector) are obtained, and the character's upward vector is rotated around the axis where the character's rightward vector is located by the rotation angle, thereby obtaining the occlusion direction when playing the state machine animation.
[0042] It should be noted that this application employs differentiated occlusion direction determination strategies for different animation types, primarily based on the technical characteristics of each animation type and their corresponding visual performance requirements. For state machine animations, these animations are typically used to represent real-time player actions on virtual characters (e.g., running, walking). During the playback of such animations, the target skeleton (e.g., the pelvis) frequently changes its rotational posture with the character's movements. If the occlusion direction is determined directly based on the first rotation information of the skeleton, the occlusion element instances positioned at the target location will experience severe shaking or excessively rapid shifts due to the high-frequency changes in the skeleton, affecting the stability of the visual performance and the player's viewing experience. Therefore, for state machine animations, an occlusion direction determination scheme based on animation curves is adopted. By obtaining the rotation angle corresponding to the current animation frame from the animation curve and performing controllable rotation based on the character's direction vector, the magnitude of the occlusion direction change is constrained by the animation curve, thereby achieving a smoother and more stable occlusion effect. For montage animations, these animations are typically used to represent specific action segments of virtual characters (e.g., skill release, special posture display). In this type of animation playback, the target part often needs to precisely follow the actual rotation posture of the skeleton to ensure a high degree of consistency between the occluding element instance and the character's body posture. Therefore, for montage animation, an occlusion direction determination scheme based on the first rotation information of the target skeleton is adopted. By directly mapping the direction vector in the skeleton space to the world space, the world space direction vector of the target skeleton is obtained, thereby achieving precise occlusion of the target part. Through the above classification processing, the precise matching between the occlusion direction and the skeleton posture can be guaranteed in montage animation scenes, while effectively suppressing the jitter problem of occluding element instances caused by high-frequency changes in the skeleton in state machine animation scenes, taking into account both occlusion accuracy and visual stability under different animation types.
[0043] In some embodiments, before the step "when there is an occlusion requirement for the target part of the virtual character, determine the occlusion direction for the target part based on the currently playing character animation of the virtual character", the virtual character processing further includes: in response to a clothing component switching event of the virtual character, determining the component name of the clothing component equipped by the virtual character after switching; obtaining a preset set of component names of clothing components configured with occlusion requirements; and determining that there is an occlusion requirement for the target part of the virtual character when a target component name matching the component name is identified in the preset set of component names, wherein the target part is used to indicate the part associated with the clothing component to which the target component name belongs.
[0044] Among them, the clothing component switching event refers to the event that performs modification operations on the clothing components already loaded on the virtual character. Modification operations include operation types that can cause changes in the appearance of the virtual character, such as replacing, adding, deleting, or adjusting the attributes of clothing components.
[0045] In this application, the detection of clothing component switching events is linked to the specific functional implementation of the project. Any function call involving a change in the state of the clothing component must trigger the corresponding switching detection so that the system can promptly capture the changed state of the clothing component and perform the associated processing. In other words, any function that might cause a change in the clothing component should be included in the scope of switching event detection.
[0046] For example, the most common scenario for triggering clothing component switching events is when players actively initiate a dress-up operation through the interactive interface. In addition, animation-driven events can also trigger clothing component switching; for example, during the playback of a dress-up animation, when the animation timeline reaches a preset fixed frame, the system automatically switches the virtual character's current clothing to the target clothing. This clothing switching triggered by the animation frame also falls under the category of clothing component switching events.
[0047] The preset component name set refers to a pre-configured set of naming data used to identify clothing components with occlusion requirements. The component name may include the resource identifier, display name, or other identification information that can uniquely identify the clothing component.
[0048] In this application, the virtual character's clothing consists of multiple clothing components, each with a unique component name. In the UE engine embodiment, the component name may specifically be the skeletal mesh resource name corresponding to the clothing component. A preset component name set records the component names of clothing components with occlusion requirements (e.g., the skeletal mesh resource names corresponding to certain short skirts, low-cut tops, etc.; this embodiment uses the skeletal mesh resource name corresponding to a mini-skirt as an example). When performing occlusion detection, the system compares and matches the component name of the currently loaded clothing component of the virtual character with the preset names in this set to identify the target clothing component with occlusion requirements, thereby triggering the occlusion direction determination and occlusion element instance configuration process for the preset target area (the virtual character's buttocks in this embodiment). In some embodiments, the preset component name set may also record the target area identifier corresponding to each component name, allowing different clothing components to trigger occlusion processing for different target areas. The preset component name set can be customized and dynamically updated according to the virtual character's clothing configuration rules and different visual performance requirements. For example, the preset component name set can be implemented through the UE's data table assets, or through structured configuration files such as JSON and XML, and this application does not limit it in this way.
[0049] The target component name is used to indicate the component name that exists in the preset component name set and matches a certain clothing component currently equipped by the virtual character.
[0050] Thus, when the virtual character's clothing components change, by comparing the name of the currently loaded clothing component with the preset set of component names, it can be determined whether the virtual character has an occlusion requirement, and when it is determined that the virtual character has an occlusion requirement, occlusion processing for the target part is enabled.
[0051] Step 102: Calculate the target angle between the camera direction of the virtual camera shooting the virtual character and the occlusion direction.
[0052] The target angle refers to the angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction. The target angle is used to characterize the degree of exposure of the target part of the virtual character relative to the virtual camera from the current viewpoint: the smaller the target angle, the closer the camera direction of the virtual camera is to the occlusion direction, and the higher the degree of exposure of the target part; conversely, the larger the target angle, the further the camera direction deviates from the occlusion direction, and the lower the degree of exposure of the target part.
[0053] Specifically, the step "calculating the target angle between the camera direction of the virtual camera shooting the virtual character and the occlusion direction" may include: determining the vector dot product value between the camera direction of the virtual camera shooting the virtual character and the occlusion direction; performing angle transformation based on the vector dot product value, and using the transformed angle value as the target angle.
[0054] Step 103: Based on the correspondence between the preset angle and the preset display control parameters, determine the target display control parameters that match the target angle.
[0055] The preset angle refers to a pre-defined angle variable value that is mapped to the display control parameters. It can be a discrete angle threshold, continuous angle sampling points, or an angle range divided by a threshold. The range of the preset angle is consistent with the range of the target angle, both using the angle between the camera direction and the occlusion direction as the measurement benchmark. The specific value and division method of the preset angle can be configured according to visual performance requirements. For example, multiple angle boundary points can be set so that small angle ranges correspond to complete occlusion, large angle ranges correspond to unoccluded states, and intermediate angle ranges correspond to partial occlusion transition states.
[0056] The preset display control parameters refer to the display control parameters pre-configured for the occluded element instance. These preset display control parameters are pre-established with preset angles, serving as the dependent variable values used for rendering the occluded element instance and directly affecting its visual presentation attributes in the rendering pipeline. For example, the preset display control parameters include, but are not limited to, transparency and scaling ratio, and may also include color blending coefficients, clipping thresholds, or other rendering parameters capable of dynamically changing the occlusion effect; this application does not impose any limitations on these. Each preset angle (or angle range, angle sampling point) corresponds to a set of preset display control parameters, thereby constructing a mapping rule between the angle independent variable and the display control parameters.
[0057] Among them, the target display control parameters refer to the actual control parameters used for rendering the occluded element instance in the current frame, which are determined by querying the correspondence between the preset angle and the preset display control parameters based on the target angle.
[0058] In this way, by matching the target angle with the preset angle, the corresponding preset display control parameters are retrieved as the target display control parameters, and the rendering control is performed on the occlusion element instances (such as particle instances, meshes or faces) configured on the target part based on the target display control parameters, thereby achieving dynamic adaptation of the occlusion effect to the change of the character's posture.
[0059] Step 104: Based on the target display control parameters, render the instances of occlusion elements associated with the virtual character to present an occlusion visual effect on the target part of the virtual character.
[0060] Among them, the instances of occlusion elements include, but are not limited to, particle instances implemented based on particle systems, dynamically generated static meshes, or procedurally generated patches. Their specifics can be adjusted according to the actual situation, and no restrictions are imposed here.
[0061] In some embodiments, the virtual character processing method further includes: in response to the fact that there is no occlusion requirement for the target part of the virtual character, controlling the occlusion element instance to be in an invisible state, and releasing the rendering resources of the occlusion element instance.
[0062] The virtual character processing method provided in this application can determine the occlusion direction of the target part of the virtual character based on the currently playing character animation when there is an occlusion requirement for the target part; calculate the target angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction; determine the target display control parameters matching the target angle based on the correspondence between preset angles and preset display control parameters; and render the occlusion element instances associated with the virtual character based on the target display control parameters to present an occlusion visual effect on the target part of the virtual character. In this way, by rendering the occlusion element instances, the phenomenon of the virtual character being exposed can be avoided.
[0063] Research has revealed that in 3D online games, character models are typically composed of multiple replaceable clothing components (such as tops, pants, and skirts) to support diverse dress-up gameplay. Players can customize their character's appearance by changing different clothing components. However, because the skeletal animation system of the character model drives various actions such as running, jumping, sitting, and falling, under certain poses or camera angles, areas such as the underskirt and chest of the character model may be exposed, resulting in wardrobe malfunctions. This means that sensitive areas of the character model not covered by clothing are seen by the player, affecting the game's compliance with regulations, aesthetics, and user experience. This problem is particularly pronounced when characters wear skirts, due to the combined effect of the skirt's physical simulation and skeletal animation, especially during large movements, specific sitting poses, or montage animations. Furthermore, different combinations of clothing components can also lead to varying degrees of exposure risks; for example, certain top and skirt combinations may result in the exposure of the inner model under certain animations.
[0064] Currently, the industry mainly adopts the following methods to address the issue of preventing game characters from accidentally exposing themselves: (1) Fixed underwear patch scheme: A fixed underwear model is directly built in the sensitive area of the character model. No matter what kind of clothing the character is wearing, the underwear model is always visible.
[0065] (2) Skirt bottom panel masking solution: Add an opaque panel to the bottom inside of a specific skirt model to mask the sensitive area as a safety short.
[0066] (3) Camera restriction scheme: By limiting the maximum downward angle of the camera or prohibiting observation from a specific angle, the exposure of the camera can be avoided.
[0067] (4) Special effects occlusion scheme: Use particle effects to occlude private parts.
[0068] However, all of the above-mentioned existing technical solutions have varying degrees of drawbacks: (1) The fixed underwear model scheme lacks flexibility and cannot dynamically adjust the occlusion effect according to the character's current actual clothing and action status. Even when there is no need for occlusion, it continues to be displayed, which is easy to produce unnatural visual effects.
[0069] (2) The skirt bottom panel solution has poor versatility. Different clothing styles require separate production of corresponding safety pants models, resulting in high maintenance costs and difficulty in adapting to various clothing combinations and complex animation scenes.
[0070] (3) The camera restriction scheme severely weakens the player's control over the viewpoint and the freedom of interaction, and is especially unsuitable for open-world games that emphasize free exploration.
[0071] (4) Most existing special effects occlusion schemes are static occlusions. The transparency and scaling ratio of particles are only related to their own motion effects and are not dynamically adjusted according to the spatial relationship between the camera and the character, making it difficult to achieve a fine and natural occlusion effect.
[0072] In summary, none of the existing solutions have been able to comprehensively consider the character's current clothing components, the type of animation being played, and the real-time spatial relationship between the camera and the character, thus failing to achieve intelligent and dynamic anti-exposure occlusion.
[0073] To address the shortcomings of existing anti-exposure solutions for game characters, such as insufficient flexibility, poor versatility, limited freedom of view, and inability to dynamically adjust based on character clothing and animation status, this application proposes a virtual character processing method aimed at solving at least one of the following problems: automatically determining whether anti-exposure occlusion needs to be enabled based on the combination of clothing components currently worn by the character; dynamically selecting an appropriate algorithm to determine whether there is a risk of exposure based on the type of animation the character is playing (including determining whether it is currently a state machine animation or a montage animation); and dynamically controlling the visibility of the occlusion based on the real-time spatial angle relationship between the camera direction and the occlusion direction, so that the occlusion effect appears naturally when needed and disappears smoothly when not needed.
[0074] This application uses a specific implementation of an occlusion element instance (i.e., a particle instance implemented based on a particle system) as an example for analysis and explanation, proposing a dynamic anti-exposure method for game characters based on the Niagara particle system (a particle effects system in the UE engine). Its core technical principle is as follows: During character initialization, a Niagara particle system instance is attached to the skeleton of the corresponding occlusion part (i.e., the target part) of the character. This particle system is dedicated to rendering occlusion effects and is initially set to paused and invisible. When the character changes clothing, a pre-configured data table (i.e., a set of preset component names) is queried through a data table-driven clothing component detection mechanism to determine whether the current clothing combination needs to enable occlusion effects. During runtime update, different algorithms are selected to calculate the occlusion direction based on the currently playing montage animation or state machine animation of the character. Subsequently, the angular relationship between the camera direction and the occlusion direction is calculated in real time, and combined with the dynamic mapping scheme of curve assets (i.e., the correspondence between preset angles and preset display control parameters), parameters (i.e., display control parameters) used to control the transparency (Opacity) and scaling (Scale) of the Niagara particle system material are obtained, thereby achieving a smooth gradient of the occlusion effect. When it is determined that occlusion is no longer needed, the particle system is paused and made invisible to release rendering resources; when the character is destroyed, the particle system is recycled back to the object pool for subsequent reuse.
[0075] Here, curve assets refer to configurable data assets that exist independently of character animation and are used to store the mapping relationship between input and output values, such as the Curve Float asset in the UE engine. The curve asset records the non-linear mapping relationship between independent variables (such as the target angle) and dependent variables (such as the opacity and scaling ratio of the occluding element instance) in the form of a pre-edited curve. At runtime, the corresponding dependent variable value can be obtained by sampling the input independent variable value, which serves as the target display control parameter.
[0076] In this embodiment, the mapping relationship recorded by the curve asset satisfies the following monotonicity characteristics: when the target angle increases, the corresponding opacity and scaling ratio decrease; when the target angle decreases, the corresponding opacity and scaling ratio increase. That is, the curve asset is a monotonically decreasing curve (which may include a plateau segment and a smooth transition segment), so that the occlusion visual effect is fully presented when the camera is facing the occlusion direction (high risk of light leakage), and the occlusion visual effect naturally disappears when the camera is away from the occlusion direction (no risk of light leakage).
[0077] In other embodiments, the mapping relationship may also take other forms that enable the occlusion effect to be dynamically adjusted according to the camera's viewpoint, such as lookup tables, piecewise functions, or other mapping carriers; the specific form of the curve asset is not limited to Curve Float assets in the UE, but may also be implemented by configurable resources with similar mapping functions in other game engines, and this application does not limit this.
[0078] The technical solution of this application is described in detail below with reference to specific embodiments and blueprint flow. This embodiment is implemented based on Unreal Engine (UE) Blueprints and the Niagara particle system. Unreal Engine refers to a 3D game development engine. Blueprint refers to the visual scripting system in the UE engine, and the Niagara particle system refers to the particle effects system in the UE engine, used to create visual effects. In this embodiment, the following function calls are made in the event graph of the character blueprint (BP_Character): Event Begin Play: When a character class instance is created, the functions for initializing the character clothing component (Set Char All Skel Mesh Comp Part) and initializing the occlusion particle system (InitCover Underwear) are called sequentially.
[0079] Character Clothing Change Event: Calls the function to set the occlusion detection flag (Set ShouldCover Underwear). The Character Clothing Change Event is a custom event triggered in response to changes in the character's clothing components within the game.
[0080] Event Tick per Frame: Executed every frame during the lifespan of the character instance, calling the Update Cover Underwear function. It should be noted that, to reduce computational overhead, the calling frequency can be reduced, for example, by performing the update once every two frames or at a preset frame interval; this application does not impose any restrictions on this.
[0081] Destroyed Event: The character instance is destroyed, and the Destroy Cover Underwear function is called.
[0082] Specifically, the process of initializing the character costume component function includes: Step SA1: Call the function "Get Components By Class," setting the parameters as follows: Target is a reference to the character class (self), and Component Class is a Skeletal Mesh Component. Then, call the "Set" function, saving the return value array to the character blueprint's member variable, "Character Part." The "Get Components By Class" function retrieves all components of a specific type for the current Actor. The component class parameter is set to the Skeletal Mesh Component class to obtain object references for all Skeletal Mesh Components. The return value array is the output of the "Get Components By Class" function, containing object references for all Skeletal Mesh Components for the current Actor. The elements in the "Character Part" array are Skeletal Mesh Components; the meaning of each element is explained in subsequent step SB1. The purpose of this step is to retrieve all Skeletal Mesh Components mounted on the character and merge them into an array, temporarily storing it in the "Character Part" Skeletal Mesh Component array.
[0083] Step SA2: Call the array traversal loop function (For Each Loop), with the parameter set to: an array of character clothing components. Call the Get Display Name function, with the parameter set to: an object representing an array element. The purpose of this step is to traverse the array of character clothing skeleton mesh components and obtain the display name of each component.
[0084] Step SA3: Call the "Add Item To Array" function to add the display names obtained in Step SA2 to the "Character Part Name" array sequentially, until the iteration in Step SA2 is complete. The purpose of this step is to save the display names of each component to the name array.
[0085] The above steps can be used to initialize two arrays: an array of character clothing components that indicates the character clothing skeleton mesh components, and an array of character clothing component names that indicates the names of the character clothing skeleton mesh components.
[0086] Specifically, the process of initializing the occlusion particle system function includes: Step SB1: Obtain a reference to the character's core skeletal mesh component (Mesh(Character Mesh0)). The character class (BP_Character) is a Blueprint class that inherits from the Character class. The Mesh(Character Mesh0) component inherited from the Character class is the character's core skeletal mesh component, while its child Part_XXX components are the character's clothing skeletal mesh components.
[0087] Step SB2: Call the function `Spawn System Attached` to create a Niagara particle system instance and attach it to the pelvic bone of the character's core skeleton mesh component. Specific parameters are set as follows: System Template is set to a reference to the Niagara particle system (NS_3C_AntiEmptied), Attach to Component is set to the character's core skeleton mesh component, Attach PointName is set to the pelvic bone, and the rest remain at their default function values. The purpose of this step is to create a Niagara particle system instance of the specified class and attach it to the pelvic bone of the character's core skeleton mesh component.
[0088] Step SB3: Save the Niagara particle system component reference returned by the function that creates and attaches the particle system instance to the character blueprint member variable Occlusion Particle System Component Reference (NS_CoverUnderwear) for use in subsequent update and destruction operations.
[0089] Step SB4: Call the Set Paused function to set the pause state to true, so that the particle system does not perform simulation updates, thus saving computational resources.
[0090] Step SB5: Call the Set Visibility function to set the visibility to false, that is, the particle system component is set to invisible, ensuring that the particle system will not be rendered and displayed in the initial state.
[0091] Through the above initialization process, the particle system occlusion to prevent light leakage is prepared when the character is created, but it is initially invisible and in a paused state, without generating any rendering and calculation overhead.
[0092] Specifically, when the virtual character experiences the aforementioned clothing component switching event, the system triggers the following occlusion determination process, namely, the process of setting the occlusion determination flag function specifically includes: Step SC1: Execute multiple decision branches sequentially using a sequence node.
[0093] Step SC2: Obtain the array of character clothing components and iterate through each component one by one using the array traversal loop function. For each component, call the function to get its display name, and then call two string splitting functions (Split) sequentially to split the string using "." and " " (space) respectively, extracting the component's standardized name (i.e., the skeletal mesh asset name). Subsequently, obtain the array element reference corresponding to the current traversal index (ArrayIndex) by reading the node by reference (Get (a ref)), and write the extracted standardized name back to the reference using the function to write the string node by reference (Set String (by ref)). Unlike the initialization phase, this step can accurately obtain the standardized names of all clothing currently worn by the character when the character clothing components change.
[0094] Step SC3: Obtain the array of character clothing component names after the above processing, and iterate through it one by one using the second array traversal loop function. For each component name, call the Get Data Table Row function, using the component name as the row name, to query the Cover Underwear Mesh data table (DT_CoverUnderwear_Mesh) to see if the component needs to be covered to prevent wardrobe malfunctions. When a matching row is found, determine whether the component needs to be covered using the conditional branch node (Branch); if so, increment the Cover Underwear Mesh counter (CoverUnderwear_Num); if no matching row is found, do nothing. Through this process, the total number of components that need to be covered in the current character's clothing is finally calculated.
[0095] Step SC4: At the end of the traversal in step SC3, the statistical results are evaluated: if the counter for components to be occluded is greater than or equal to 1 (i.e., at least one component needs to be occluded), the occlusion enable flag (ShouldCoverUnderwear_Mesh) is set to true; otherwise, it is set to false. Finally, the counter for components to be occluded is reset to 0 as the initial state for the next call.
[0096] Through the above-mentioned clothing component detection and judgment mechanism, the system can accurately identify under what clothing combination the anti-exposure cover needs to be activated, thereby avoiding the use of a "one-size-fits-all" approach and achieving more refined and intelligent cover control.
[0097] Specifically, the process of updating the occlusion effect function includes: The occlusion effect is updated in real time during each frame update event (Event Tick) of the character blueprint. The specific steps are as follows: Step SD1 (Precondition Check): First, check the flag that should be enabled for occlusion. If its value is false, it means that the clothing currently being worn does not need to be occluded, so skip all subsequent logic and return immediately; only when this variable is true will the subsequent process continue.
[0098] Step SD2 (Calculation of Particle System Material Opacity and Scaling Ratio - Core Algorithm): a) For montage animation, the character's core skeleton mesh component calls the Get Socket Rotation function, setting the socket name input parameter (InSocketName) to the pelvic bone to obtain the rotation of the character's pelvic bone in world space. Then, this rotation is used as the rotation input parameter (InRotator) of the Rotate Vector function to rotate the pelvic bone's bone space direction vector (used to approximately represent the direction from the exposed area of the target part to the bone, in this embodiment it is a vector (0, -1, 0), the specific direction value depends on the model's bone coordinate system convention and the orientation of the target part) into world space, thereby obtaining the occlusion direction.
[0099] b) For State Machine animation, the character's core skeleton mesh component calls the `Get Anim Instance` function to obtain the character's animation instance, and then uses the `Get CurveValue` function to read the value of the animation curve's occlusion direction rotation angle (`CoverUnderwear_RotateAngle`). This animation curve is used to calculate the occlusion direction when the character plays the State Machine animation. Subsequently, the `GetActor Up Vector` function is called to obtain the character's up vector, the `Get Actor RightVector` function is called to obtain the character's right vector, and the `Rotate Vector Around Axis` function is called to rotate the character's up vector around the character's right vector by the angle recorded by the occlusion direction rotation angle of the animation curve. The rotation result is the character's occlusion direction under the State Machine animation.
[0100] The state machine animation did not follow the same approach as the montage animation. The reasons are explained in the previous section on the differentiation strategy, and will not be repeated here.
[0101] In the forward running animation, the animation curve value is set to 10°; in the forward sprint animation, this value is set to 30°, used to calculate the occlusion direction of the character in the corresponding state machine animation. The reason for setting it to 10° for forward running is that this value roughly matches the degree of body tilt of the character in a running posture, allowing the occlusion direction to conform to the actual body posture. This configuration is closely related to the specific animation content: for example, in the sprint animation of this article, because the character's forward tilt is significantly greater than in a normal forward running motion, the corresponding angle configuration is also larger, set to 30°.
[0102] c) Use the montage decision flag (Is Montage) to determine whether the current occlusion direction should follow the calculation in step a or step b. The montage decision flag can be updated by calling the montage playback state query function (Is AnyMontage Playing). This step is used to dynamically select the occlusion calculation algorithm. The montage decision flag is a Boolean variable; it is true if the character is playing a montage animation in the current frame; otherwise, it is false if the character is not playing a montage animation (i.e., playing a state machine animation). This step is executed every frame during the character instance's lifetime.
[0103] d) Camera orientation calculation.
[0104] Specifically, the camera manager calls the Get Camera Rotation function to obtain the camera rotation, and the camera rotation calls the Get Forward Vector function to obtain the camera's forward vector (i.e., the camera direction). e) Calculate the angle between the occlusion direction and the camera direction.
[0105] Specifically, the dot product between the occlusion direction and the camera direction is calculated using vector dot product, and then the dot product is converted into an angle value using the inverse cosine function (ACOSd). The angle value is the angle between the occlusion direction and the camera direction.
[0106] f) Using the calculated angle value as input parameters (InTime), pass in the angle-to-opacity curve asset (Curve_CoverUnderwear_AngleToOpacity) and the angle-to-scale curve asset (Curve_CoverUnderwear_AngleToScale) to obtain the curve mapping values, and set them as particle opacity variables (NS_Opacity) and particle scale variables (NS_Scale). The curve assets are pre-configured with the mapping relationship between the angle value and the particle opacity and scale, resulting in a non-linear and natural transition between the occlusion effect and the viewpoint.
[0107] Step SD3: Niagara particle system parameter control, specifically including the following: a) Call the Set Niagara Variable (Float) function to set the particle opacity variable value to the particle opacity variable of the Niagara particle system component, thereby controlling the transparency of the particle material; b) Similarly, call the Niagara floating-point variable setting function to set the particle scaling ratio variable value into the particle scaling ratio variable of the particle system, thereby controlling the scaling ratio of the particles.
[0108] Visibility management can also be performed on particle systems, including the following: a) Check if the particle opacity variable is greater than 0 through the conditional branch node; b) If the value is greater than 0 (the occlusion effect needs to be displayed) and the particle system is currently in a paused state (Is Paused), then call the pause state setting function to set the pause state to false to continue particle updates, and call the visibility setting function to set the visibility to true to make the particle system visible. c) If the value is 0 (no occlusion effect is needed) and the particle system is not currently paused, then call the function to set the pause state to pause the particle system, and call the function to set the visibility to make the particle system invisible.
[0109] In this way, by dynamically managing the paused and visible states of the particle system, rendering and computing resources are fully released when occlusion is not required.
[0110] Specifically, when a character is destroyed or enters a scene where the anti-exposure function is not required, the process of cleaning up and recycling the occlusion particle system is executed. That is, the process of destroying the occlusion particle system function specifically includes: Step SE1: Check whether the member variable occludes the particle system component reference is valid by using the validity check node (Is Valid).
[0111] Step SE2: If successful, first call the "Release to Pool" function to release the Niagara particle system component back into the object pool. The object pool mechanism avoids frequent creation and destruction operations, reduces the overhead of memory allocation and garbage collection, and improves system performance, especially in scenarios with a large number of characters existing simultaneously.
[0112] Step SE3: Then call the Destroy Component function to destroy the Niagara particle system component and release the resources occupied by the component.
[0113] Step SE4: If the validity check result is invalid, skip the above steps and end directly.
[0114] Thus, the virtual character processing method provided in this application embodiment can achieve the following: Figure 3 The occlusion effect shown depicts a dynamic and smooth change in the opacity and scaling of the occlusion particle system as the angle between the camera direction and the occlusion direction changes. In reality, the change in the occlusion particle system can be described as follows: from left to right, the angle between the camera direction and the occlusion direction decreases sequentially, while the opacity and scaling of the occlusion particle system increase sequentially.
[0115] In other embodiments, when the occlusion element instance is a static mesh, a patch, or other rendering carrier, equivalent dynamic and smooth changes can be achieved by corresponding rendering parameters (such as material transparency, mesh scaling, etc.), and this application does not impose any restrictions on this.
[0116] This application provides a dual-judgment mechanism based on clothing component detection and animation detection. It intelligently determines whether anti-exposure occlusion needs to be enabled based on the character's actual clothing status and the currently playing animation, thus avoiding the "one-size-fits-all" approach of traditional solutions. By calculating the spatial angle between the camera direction and the occlusion direction in real time, and combining it with pre-configured curve assets, the angle is non-linearly mapped to the transparency and scaling parameters of the occlusion effect. This makes the appearance and disappearance of the occlusion effect smooth and natural, avoiding abrupt flickering or jumps, and significantly improving the visual experience.
[0117] By configuring data tables and curve assets, designers and artists can flexibly adjust anti-exposure rules without modifying program code, and the system has good scalability and maintainability. The occlusion particle system is paused and made invisible when it is determined that it is not needed, thereby completely releasing related rendering and computing resources; during the destruction phase, an object pool mechanism is used for recycling and reuse, reducing the overhead caused by frequent memory allocation and garbage collection, and significantly reducing the overall performance burden in multiplayer online scenes with a large number of characters.
[0118] Unlike traditional solutions that restrict camera angles to avoid visual discomfort, this application allows players to observe the character from any angle and ensures the appropriateness of the content through a dynamic occlusion mechanism, balancing content compliance with the gaming experience. The occlusion effect is achieved using the Niagara particle system. Compared to traditional mesh occlusion solutions, the particle system offers greater flexibility and can achieve richer visual effects through material parameters (such as smooth semi-transparent transitions and soft edges), resulting in a more natural overall visual effect.
[0119] Thus, the virtual character processing method, device, electronic device, and storage medium provided in this application embodiment can achieve at least the following technical effects: By combining a dual determination mechanism of clothing component detection and character animation type recognition, it can intelligently determine whether to enable anti-exposure occlusion under the actual clothing and action posture of the virtual character, avoiding the "one-size-fits-all" treatment of traditional solutions; by calculating the spatial angle between the camera direction and the occlusion direction in real time, and combining the nonlinear mapping relationship between the preset angle and the display control parameters, the occlusion effect presents a natural transition under different viewing angles, avoiding abrupt flickering or jumps; by externalizing the relevant configurations (such as component names and angle mappings) as configurable data, the anti-exposure rules can be flexibly adjusted without modifying the program code, possessing good scalability and maintainability; and, the solution of this application does not restrict the player's freedom of perspective, ensuring content compliance while taking into account the game experience.
[0120] This application also provides a virtual character processing device. This virtual character processing device can be integrated into a terminal device. For example, such as... Figure 4 As shown, the virtual character processing device may include: The direction determination module 201 is used to determine the occlusion direction of the target part based on the currently playing character animation when there is an occlusion requirement for the target part of the virtual character. Angle determination module 202 is used to calculate the target angle between the camera direction of the virtual camera that captures the virtual character and the occlusion direction; The parameter determination module 203 is used to determine the target display control parameters that match the target angle based on the correspondence between the preset angle and the preset display control parameters; The rendering module 204 is used to render instances of occlusion elements associated with the virtual character based on the target display control parameters, so as to present an occlusion visual effect on the target part of the virtual character.
[0121] In some embodiments, the direction determination module 201 determines the occlusion direction of the target part based on the character animation currently being played by the virtual character, including: The direction determination submodule is used to determine the occlusion direction of the target part based on the animation type of the currently playing character animation and the current animation frame of the character animation.
[0122] In some embodiments, the direction determination submodule includes: The first information acquisition unit is used to acquire the first rotation information of the target bone in the character animation based on the current animation frame of the character animation when the animation type of the character animation is the first animation type. The target bone is used to indicate the bone in the virtual character associated with the target part. The vector mapping unit is used to map the bone space direction vector of the target bone to the world space where the virtual character is located based on the first rotation information, so as to obtain the world space direction vector of the target bone. The first direction determination unit is used to determine the occlusion direction of the virtual character based on the world space direction vector of the target skeleton.
[0123] In some embodiments, the direction determination submodule includes: The curve acquisition unit is used to acquire the animation instance of the virtual character and the animation curve that matches the animation instance when the animation type of the character animation is the second animation type. Angle determination unit is used to obtain the rotation angle corresponding to the current animation frame of the character animation from the animation curve; The vector determination unit is used to rotate the virtual character's second direction vector (indicating the character's upward vector) around the rotation axis by the rotation angle, with the axis containing the virtual character's first direction vector (indicating the character's rightward vector) as the rotation axis, to obtain the rotated vector. The second direction determination unit is used to determine the occlusion direction of the virtual character based on the rotated vector.
[0124] In some embodiments, the angle determining module 202 includes: The dot product value determination unit is used to determine the vector dot product value between the camera direction and the occlusion direction of the virtual camera used to capture the virtual character. The transformation unit is used to perform angle transformation based on the vector dot product value and use the transformed angle value as the target angle.
[0125] In some embodiments, the target display control parameters include at least one of the following: the transparency of the occluded element instance and the scaling ratio.
[0126] In some embodiments, prior to the direction determination module 201, the virtual character processing device further includes: The component name determination unit is used to determine the component name of the clothing component equipped by the virtual character after switching in response to the clothing component switching event of the virtual character. The collection acquisition unit is used to acquire a set of preset component names for clothing components configured with occlusion requirements; The requirement identification unit is used to determine that there is an occlusion requirement for the target part of the virtual character when a target component name matching the component name is identified in the preset set of component names. The target part is used to indicate the part associated with the clothing component to which the target component name belongs.
[0127] The solution adopted in this application embodiment can be implemented by the direction determination module 201 determining the occlusion direction of the target part of the virtual character based on the currently playing character animation when there is an occlusion requirement for the target part of the virtual character; the angle determination module 202 calculating the target angle between the camera direction of the virtual camera shooting the virtual character and the occlusion direction; the parameter determination module 203 determining the target display control parameters matching the target angle based on the correspondence between preset angles and preset display control parameters; and the rendering module 204 rendering the occlusion element instances associated with the virtual character based on the target display control parameters to present the occlusion visual effect on the target part of the virtual character. In this way, by rendering the occlusion element instances, the phenomenon of the virtual character being exposed can be avoided.
[0128] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Alternatively, the electronic device can be a server.
[0129] like Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0130] The processor 301 is the control center of the electronic device 300. It connects various parts of the electronic device 300 via various interfaces and lines. By running or loading software programs and / or units stored in the memory 302, and by calling data stored in the memory 302, it executes various functions and processes data of the electronic device 300, thereby providing overall monitoring of the electronic device 300. The processor 301 can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the methods, steps, and logic diagrams disclosed in the embodiments of this application.
[0131] In this embodiment, the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more applications into the memory 302 according to the following steps, and the processor 301 runs the applications stored in the memory 302 to realize various functions, such as: When there is a need to occlude the target part of the virtual character, the occlusion direction of the target part is determined based on the character animation currently being played by the virtual character. Calculate the target angle between the camera direction of the virtual camera used to photograph the virtual character and the occlusion direction; Based on the correspondence between preset angles and preset display control parameters, determine the target display control parameters that match the target angle; Based on the target display control parameters, the occlusion element instances associated with the virtual character are rendered to present an occlusion visual effect on the target part of the virtual character.
[0132] The electronic device provided in this application can determine the occlusion direction of a target part of a virtual character based on the currently playing character animation when there is a need for occlusion. It then calculates the target angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction; determines target display control parameters matching the target angle based on the correspondence between preset angles and preset display control parameters; and renders the occlusion element instances associated with the virtual character based on the target display control parameters to present an occlusion visual effect on the target part of the virtual character. In this way, rendering the occlusion element instances can prevent the virtual character from being exposed.
[0133] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0134] Optional, such as Figure 5 As shown, the electronic device 300 also includes: a touch display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0135] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.
[0136] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0137] Audio circuitry 305 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and then processed by processor 301 before being transmitted via radio frequency circuitry 304 to, for example, another electronic device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0138] The input unit 306 can be used to receive user touch operations, user gaze points on the screen, etc.
[0139] Power supply 307 is used to supply power to various components of electronic device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0140] although Figure 5 As not shown in the diagram, the electronic device 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0141] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0142] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0143] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the virtual character processing methods provided in this application. The computer program can execute the following steps of the virtual character processing method: When there is a need to occlude the target part of the virtual character, the occlusion direction of the target part is determined based on the character animation currently being played by the virtual character. Calculate the target angle between the camera direction of the virtual camera used to photograph the virtual character and the occlusion direction; Based on the correspondence between preset angles and preset display control parameters, determine the target display control parameters that match the target angle; Based on the target display control parameters, the occlusion element instances associated with the virtual character are rendered to present an occlusion visual effect on the target part of the virtual character.
[0144] Using the computer-readable storage medium provided in this application embodiment, when there is a need to occlude a target part of a virtual character, the occlusion direction of the target part can be determined based on the currently playing character animation; the target angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction can be calculated; based on the correspondence between preset angles and preset display control parameters, target display control parameters matching the target angle can be determined; and based on the target display control parameters, the occlusion element instances associated with the virtual character can be rendered to present an occlusion visual effect on the target part of the virtual character. Thus, by rendering the occlusion element instances, the phenomenon of the virtual character being exposed can be avoided.
[0145] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0146] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0147] Since the computer program stored in the computer-readable storage medium can execute any of the virtual character processing methods provided in the embodiments of this application, it can achieve the beneficial effects that any of the virtual character processing methods provided in the embodiments of this application can achieve, as detailed in the preceding embodiments, and will not be repeated here.
[0148] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.
[0149] In the above embodiments of the virtual character processing device, computer-readable storage medium, electronic device, and computer program product, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes and beneficial effects of the virtual character processing device, computer-readable storage medium, computer program product, electronic device, and their corresponding units described above can be referred to the description of the virtual character processing method in the above embodiments, and will not be repeated here.
[0150] The foregoing has provided a detailed description of a virtual character processing method, apparatus, electronic device, computer-readable storage medium, and computer program product provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for processing virtual characters, characterized in that, The method includes: When there is a need to occlude a target part of a virtual character, the occlusion direction for the target part is determined based on the character animation currently being played by the virtual character. Calculate the target angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction; Based on the correspondence between preset angles and preset display control parameters, target display control parameters that match the target angle are determined. Based on the target display control parameters, the occlusion element instances associated with the virtual character are rendered to present an occlusion visual effect on the target part of the virtual character.
2. The virtual character processing method according to claim 1, characterized in that, Determining the occlusion direction of the target area based on the currently playing character animation of the virtual character includes: Based on the animation type of the currently playing character animation of the virtual character and the current animation frame of the character animation, the occlusion direction of the target part is determined.
3. The virtual character processing method according to claim 2, characterized in that, Determining the occlusion direction of the target part based on the animation type of the currently playing character animation of the virtual character and the current animation frame of the character animation includes: When the character animation belongs to the first animation type, the first rotation information of the target bone in the character animation is obtained according to the current animation frame of the character animation, wherein the target bone is used to indicate the bone in the virtual character associated with the target part; Based on the first rotation information, the bone space direction vector of the target bone is mapped to the world space where the virtual character is located, so as to obtain the world space direction vector of the target bone; Based on the world space direction vector of the target skeleton, the occlusion direction of the virtual character is determined.
4. The virtual character processing method according to claim 2, characterized in that, The step of determining the occlusion direction of the target part based on the animation type of the currently playing character animation of the virtual character and the current animation frame of the character animation includes: If the animation type of the character animation is the second animation type, obtain the animation instance of the virtual character and obtain the animation curve that matches the animation instance; Obtain the rotation angle corresponding to the current animation frame of the character's animation from the animation curve; Using the axis containing the first direction vector of the virtual character as the axis of rotation, rotate the second direction vector of the virtual character around the axis of rotation by the rotation angle to obtain the rotated vector; The occlusion direction of the virtual character is determined based on the rotated vector.
5. The virtual character processing method according to claim 1, characterized in that, The calculation of the target angle between the camera direction of the virtual camera capturing the virtual character and the occlusion direction includes: Determine the vector dot product between the camera direction of the virtual camera capturing the virtual character and the occlusion direction; Angle transformation is performed based on the vector dot product value, and the transformed angle value is used as the target angle.
6. The virtual character processing method according to claim 1, characterized in that, The target display control parameters include at least one of the transparency and scaling ratio of the occluded element instance.
7. The virtual character processing method according to any one of claims 1 to 6, characterized in that, If there is a need to occlude a target part of the virtual character, before determining the occlusion direction of the target part based on the currently playing character animation, the method further includes: In response to the clothing component switching event of the virtual character, determine the component name of the clothing component equipped by the virtual character after switching; Get the set of preset component names for clothing components that have occlusion requirements; If a target component name matching the component name is identified in the preset component name set, it is determined that the target part of the virtual character has an occlusion requirement, wherein the target part is used to indicate the part associated with the clothing component to which the target component name belongs.
8. A virtual character processing device, characterized in that, The device includes: The direction determination module is used to determine the occlusion direction of the target part of the virtual character based on the currently playing character animation when there is an occlusion requirement for the target part of the virtual character. An angle determination module is used to calculate the target angle between the camera direction of the virtual camera that captures the virtual character and the occlusion direction; The parameter determination module is used to determine the target display control parameters that match the target angle based on the correspondence between the preset angle and the preset display control parameters; The rendering module is used to render instances of occlusion elements associated with the virtual character based on the target display control parameters, so as to present an occlusion visual effect on the target part of the virtual character.
9. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of the virtual character processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It includes a computer program that, when run on an electronic device, causes the electronic device to perform the steps of the virtual character processing method according to any one of claims 1 to 7.
