Special effect patch control method and device, equipment, storage medium and program product
By dynamically adjusting the position of special effects panels, the problem of display instability caused by changes in the field of view in virtual scenes is solved. This achieves automatic adaptation and stable display of special effects panels when the field of view changes, improving visual consistency and immersion.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2025-12-04
- Publication Date
- 2026-05-12
AI Technical Summary
In virtual scenes, the display of special effects patches is unstable and cannot maintain consistency and integrity when the field of view changes, resulting in visual performance degradation.
By acquiring the distance, field of view angle, and reference height between the target effect patch and the virtual camera, the position of the effect patch is dynamically adjusted to adapt to changes in the field of view angle. The new distance is calculated using trigonometric geometric relationships and tangent values, and the movement of the effect patch is automatically controlled.
It achieves automatic adaptation and stable display of special effects images when camera parameters change, improving visual consistency and immersion, reducing production complexity and increasing the efficiency of content creation.
Smart Images

Figure CN122006236A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to methods, devices, equipment, storage media, and program products for controlling special effects panels. Background Technology
[0002] In virtual scenes such as games, to enhance the visual impact and immersion, developers often place special effects panels near the screen (virtual camera), such as shockwaves, sword flashes, and environmental dust. One of the core design goals of these on-screen effects is to stably and fully fill a specific area of the screen under different viewing angles and conditions, in order to achieve the desired artistic expression.
[0003] In related technologies, when the field of view of a virtual camera is fixed, a stable and appropriately sized visual effect can be achieved by pre-setting the distance between the special effects panel and the camera. However, in practical applications, to create specific dramatic effects, such as highlighting a boss unit or switching perspectives, the field of view of the virtual camera often needs to be dynamically adjusted. Once the field of view changes, according to the principle of perspective, the display ratio of the original special effects panel on the screen will change accordingly, resulting in unexpected magnification or shrinkage. This prevents it from perfectly adapting to the current screen window, thus disrupting the consistency and integrity of the visual presentation. Summary of the Invention
[0004] In view of this, this application provides a method, apparatus, device, storage medium, and program product for controlling special effects patches to solve the problem of unstable special effects display.
[0005] In a first aspect, this application provides a method for controlling a special effects patch, comprising: acquiring a first distance between the target special effects patch and a virtual camera, a first field of view angle corresponding to the virtual camera, and a reference height corresponding to the target special effects patch; acquiring a second field of view angle after the change in the first field of view angle; determining a second distance between the target special effects patch and the virtual camera at the second field of view angle based on the second field of view angle and the reference height; and controlling the movement of the target special effects patch based on the offset between the second distance and the first distance.
[0006] In one optional implementation, obtaining the reference height corresponding to the target special effects patch includes: determining the reference height corresponding to the target special effects patch based on the positional relationship between the first distance and the first field of view angle.
[0007] In one optional implementation, determining the reference height corresponding to the target special effects patch based on the positional relationship between the first distance and the first field of view angle includes: obtaining a first visual parameter value characterized by a first tangent value of the first field of view angle; and determining the reference height of the target special effects patch based on the fusion result of the first distance and the first visual parameter value.
[0008] In one alternative implementation, determining a second distance between the target effect patch and the virtual camera at the second field of view angle, based on the second field of view angle and the reference height, includes: obtaining a second visual parameter value characterized by a second tangent value of the second field of view angle; and determining a ratio between the reference height and the second visual parameter value, using the ratio to characterize the second distance.
[0009] In one optional implementation, controlling the movement of the target effect patch based on the offset between the second distance and the first distance includes: determining the movement direction of the target effect patch based on the offset between the second distance and the first distance; and controlling the target effect patch to move a third distance in the movement direction, the third distance being the same as the offset.
[0010] In one optional implementation, it is determined whether the target effect patch contains multiple sub-effect patches; when the target effect patch contains multiple sub-effect patches, a first target distance between each sub-effect patch and the virtual camera and a first target reference height corresponding to each sub-effect patch are obtained; in response to a change from a first field of view to a second field of view, a second target distance between each sub-effect patch and the virtual camera at the second field of view is determined; based on a first target offset between the second target distance and each first target distance, the movement of each sub-effect patch is controlled.
[0011] In one optional implementation, if the positional difference of multiple sub-effect patches in the depth direction is less than a preset threshold, the multiple sub-effect patches are determined as a whole effect patch; the third target distance between the whole effect patch and the virtual camera, and the second target reference height corresponding to the whole effect patch are obtained; in response to the change from the first field of view to the second field of view, the fourth target distance between the whole effect patch and the virtual camera at the second field of view is determined; and the movement of the whole effect patch is controlled based on the second target offset between the fourth target distance and the third target distance.
[0012] Secondly, this application provides a control device for a special effects patch, comprising: a first acquisition module for acquiring a first distance between the target special effects patch and a virtual camera, a first field of view angle corresponding to the virtual camera, and a reference height corresponding to the target special effects patch; a second acquisition module for acquiring a second field of view angle after a change in the first field of view angle; a first determination module for determining a second distance between the target special effects patch and the virtual camera at the second field of view angle based on the second field of view angle and the reference height; and a first control module for controlling the movement of the target special effects patch based on the offset between the second distance and the first distance.
[0013] Thirdly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the control method for the special effects patch of the first aspect or any corresponding embodiment described above.
[0014] Fourthly, this application provides a computer-readable storage medium storing computer instructions for causing a computer to execute the control method for special effects patches described in the first aspect or any corresponding embodiment.
[0015] Fifthly, this application provides a computer program product, including computer instructions for causing a computer to execute the control method for special effects patches described in the first aspect or any corresponding embodiment.
[0016] The special effects patch control method provided in this application dynamically acquires the first distance, first field of view angle, and reference height between the target special effects patch and the virtual camera. When the field of view angle changes, a new second distance is determined based on the reference height and the second field of view angle. Then, the movement of the special effects patch is automatically controlled by the offset between the first and second distances. This achieves automatic adaptation and stable maintenance of the special effects display effect when camera parameters change, effectively avoiding problems such as effect scaling or abnormal positioning caused by changes in the field of view angle, and significantly improving the consistency and immersion of the visual presentation. At the same time, this process does not require manual frame-by-frame intervention, greatly reducing production complexity and improving the efficiency and adaptability of content creation. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application; Figure 2 This is a schematic flowchart of a first method for controlling special effects patches according to an embodiment of this application; Figure 3 This is a second flowchart illustrating the control method for special effects patches according to an embodiment of this application; Figure 4 This is a schematic diagram illustrating the principle of deriving the special effect reference height and new distance according to the embodiments of this application; Figure 5 This is a schematic diagram illustrating the error display effect of special effects without the adaptive scheme according to an embodiment of this application; Figure 6 This is a schematic diagram illustrating the correct effect of special effects display using an adaptive scheme according to an embodiment of this application; Figure 7 This is a structural block diagram of the control device for special effects patches according to an embodiment of this application; Figure 8 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0021] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0022] As one optional application scenario in this application embodiment, Figure 1 This diagram illustrates an application scenario of a control system for special effects patches. For example... Figure 1 As shown, the system may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.
[0023] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.
[0024] Taking role-playing games or combat games as an example, the terminal device has the corresponding game application installed. By running the application, a virtual scene including a virtual camera and on-screen effects can be rendered and displayed to the player using the terminal device's graphical user interface. For example, the virtual scene can be a simulated three-dimensional (3D) virtual space battle scene or environmental effect scene; the virtual scene displayed to the player can include boss battles, skill releases, and other scenes, where on-screen effects (such as aurora, energy barriers, etc.) are used to enhance the visual presentation.
[0025] Furthermore, the graphical user interface can also display the virtual camera's field of view (FOV), which may be dynamically adjusted according to the game's plot. For example, during a boss battle, to emphasize the boss's imposing presence, the virtual camera's FOV may increase or decrease, causing effects that originally filled the screen to scale or shift position, failing to perfectly fit the current screen window.
[0026] In some games, on-screen effects are typically designed with fixed positions or adjusted manually via keyframes (K-frames). Continuing with the example of combat games, when the virtual camera's field of view (FOV) changes, if the effects don't adapt accordingly, issues such as effects shrinking, enlarging, or shifting off-center from the screen may occur, affecting visual consistency and immersion. This fixed or manual adjustment method requires effects artists to pre-align the positions frame-by-frame for each FOV change, resulting in a large workload and poor flexibility. If the FOV is adjusted later, the effects need to be re-created, making it difficult to adapt to dynamic scene requirements.
[0027] The special effects patch control method provided in this application dynamically determines the required offset after a change in FOV based on the distance between the special effects patch and the virtual camera, the field of view angle, and the reference height, and automatically controls the movement of the special effects patch. This adaptive adjustment method does not require manual intervention, which not only reduces the workload of special effects production, but also ensures that the special effects fill the screen in real time under different FOVs, improving the visual performance and the player's gaming experience.
[0028] According to an embodiment of this application, a method for controlling special effects patches is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0029] This embodiment provides a method for controlling special effects patches, which can be used in electronic devices, such as computer 101, mobile terminal 102, etc. Figure 2 This is a flowchart of a control method for special effects patches according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps: Step S201: Obtain the first distance between the target effect patch and the virtual camera, the first field of view angle corresponding to the virtual camera, and the reference height corresponding to the target effect patch.
[0030] A target effect panel refers to an effect element that requires adaptive FOV adjustment, typically a plane (panel) or a visual effect composed of a system of particles. In games, it might be part of a full-screen effect, such as aurora, fog, or halo. A virtual camera refers to the camera object used to render the scene in a game; it determines the player's field of view, perspective, and FOV. The virtual camera's position, rotation, and FOV changes affect how the effect appears on screen. The initial distance refers to the distance between the target effect panel and the virtual camera, usually the straight-line distance from the center point (or parent node) of the effect panel to the camera lens position. This distance is used to initially calculate the effect's size. Specifically, in game engines (such as Unity), the initial distance between the target effect panel and the virtual camera is usually obtained by accessing the effect panel's Transform component. An effect panel typically has a parent node (potentially a camera or other reference point), and the initial distance refers to the relative distance between the effect panel and the virtual camera, especially along the Z-axis. During implementation, the script reads the `Transform.position` property of the effect mask and the virtual camera, and then calculates the Euclidean distance between them. Since effect masks often have a fixed parent-child relationship with the virtual camera, the initial distance can be directly obtained from the effect mask's local position (`localPosition`), especially the Z-axis value, as this represents the depth distance of the effect mask relative to its parent node (the virtual camera). For example, in Unity, this distance can be directly obtained using `transform.localPosition.z`.
[0031] The first field of view (FOV) refers to the initial FOV value of the virtual camera, i.e., the field of view angle before any changes. It is usually expressed in degrees (°) and determines the width of the camera's field of view. Specifically, in game engines, the virtual camera component has a public property representing the FOV; for example, in Unity, it can be obtained via `Camera.fieldOfView`. Obtaining the first FOV typically occurs before the effects patch is initialized or before the FOV changes. The script caches the current camera's FOV value as the first FOV. In practice, the script might directly read the FOV property of a camera object (such as `Camera.main` or a camera with a specific label). This value is used for subsequent calculations of the baseline height, so it's crucial to ensure it's accurately recorded before any FOV changes.
[0032] The reference height refers to a crucial reference value calculated based on the initial state, used to deduce new distances later. It is a fixed length quantity representing a characteristic dimension of the effect patch at a specific location (usually its center point) to the boundary of the virtual camera's view frustum. Specifically, obtaining the reference height is a process of derivation and calculation based on the initial state, rather than directly reading a preset value. Using the obtained first distance and first field of view angle, a characteristic dimension required to achieve a specific display effect (such as filling the screen) is derived backward through trigonometric relationships. This calculation process correlates spatial distance with viewpoint parameters, ultimately outputting a length value as the reference height. This reference height is a crucial bridging quantity; it encapsulates the visual performance target in the initial state and serves as an invariant standard in subsequent steps to maintain the stability of that target under different viewpoints.
[0033] In step S202, in response to a change in the first field of view angle, the changed second field of view angle is obtained.
[0034] The second field of view (FOV) refers to the new FOV value after a change in the virtual camera's FOV, i.e., the changed field of view. Specifically, responding to changes in the FOV is an event-driven or state-monitoring process. In program implementation, this can be achieved by setting a listener or callback function on the camera's FOV parameter; once a modification to this parameter is detected, the subsequent process is triggered. Alternatively, it can be achieved by polling in the main loop, continuously comparing the current FOV value with the previously recorded first FOV. Once the change is confirmed, the program re-accesses the virtual camera's FOV attribute and reads the updated value, i.e., the second FOV. This step ensures that the system can perceive changes in the environment and capture the latest viewpoint state information.
[0035] Step S203: Based on the second field of view angle and the reference height, determine the second distance between the target effect patch and the virtual camera at the second field of view angle.
[0036] The second distance refers to the new distance at which the target effect patch should be located so that it can still fill the screen under the second field of view. Specifically, based on the baseline height as an unchanging standard, and combined with the acquired second field of view representing the new perspective conditions, the triangular geometry is reconstructed. By solving this new geometric model, it is possible to deduce how far the target effect patch should be from the virtual camera under the new field of view so that it can still present the screen display effect corresponding to the same baseline height as the initial state. The length between this calculated new position and the camera is the second distance.
[0037] Step S204: Based on the offset between the second distance and the first distance, control the movement of the target effect patch.
[0038] Offset refers to the difference between a first distance and a second distance. This offset is typically applied along the local Z-axis of the virtual camera to adjust the position of the target effect patch, ensuring it correctly fills the screen even after changes in FOV. Specifically, controlling the movement of the effect patch is the process of translating the determined offset into actual spatial behavior. First, the algebraic difference between the second and first distances is determined, yielding the offset. This offset is a directed vector, typically defined along the forward axis (such as the Z-axis) of the virtual camera's local coordinate system, as the core purpose of this operation is to adjust the depth distance between the effect and the camera. Subsequently, by modifying the position attributes of the target effect patch, the calculated offset is applied to its current spatial position. This position update operation causes the effect patch to translate in 3D space, precisely adapting to the new camera field of view and ultimately maintaining the desired screen-filling effect visually.
[0039] The special effects patch control method provided in this application dynamically acquires the first distance, first field of view angle, and reference height between the target special effects patch and the virtual camera. When the field of view angle changes, a new second distance is determined based on the reference height and the second field of view angle. Then, the movement of the special effects patch is automatically controlled by the offset between the first and second distances. This achieves automatic adaptation and stable maintenance of the special effects display effect when camera parameters change, effectively avoiding problems such as effect scaling or abnormal positioning caused by changes in the field of view angle, and significantly improving the consistency and immersion of the visual presentation. At the same time, this process does not require manual frame-by-frame intervention, greatly reducing production complexity and improving the efficiency and adaptability of content creation.
[0040] This embodiment provides a method for controlling special effects patches, which can be used in electronic devices, such as computer 101, mobile terminal 102, etc. Figure 3 This is a flowchart of a control method for special effects patches according to an embodiment of this application, such as... Figure 3 As shown, the process includes the following steps: Step S301: Obtain the first distance between the target effect patch and the virtual camera, the first field of view angle corresponding to the virtual camera, and the reference height corresponding to the target effect patch.
[0041] Specifically, for details on obtaining the first distance between the target effect patch and the virtual camera, and the first field of view angle corresponding to the virtual camera, please refer to [link to relevant documentation]. Figure 2 Step S201 of the illustrated embodiment will not be described again here.
[0042] Specifically, the reference height corresponding to the target effect patch is obtained, including: Step a: Based on the positional relationship between the first distance and the first field of view angle, determine the reference height corresponding to the target effect patch.
[0043] Positional relationship refers to the geometric relationship between the target effect patch and the virtual camera in three-dimensional space, their relative orientation and distance, and the virtual camera's field of view (FOV). Specifically, through geometric modeling, a key reference quantity for maintaining visual invariance is calculated from a spatial relationship. The target effect patch, the virtual camera, and the camera's frustum are abstracted into a simple geometric model. In this model, the first distance (distance from the effect to the camera) and the first field of view angle (the camera's initial FOV) together define a right-angled triangle or sector relationship. Based on the visual target that the target effect patch can fill the screen under the current FOV, using the principles of trigonometry, the known first distance and first field of view angle are used as input, and through specific mathematical operations, a characteristic dimension that can represent the visual target under this geometric configuration is solved. This calculated characteristic dimension is defined as the reference height, which encapsulates the visual performance requirements in the initial state and will serve as a constant standard in subsequent steps.
[0044] The control method for special effects patches provided in this application determines the reference height by clearly defining the positional relationship between a first distance and a first field of view angle, thus achieving dynamic and automated calculation of the reference height. This mechanism does not require external measurement or manual preset; instead, it cleverly utilizes the known geometric relationship between the camera and the special effects patch to derive the reference height in real time. This not only avoids errors and inconsistencies that may arise from manual input, ensuring the accuracy and reliability of the reference height data, but also creates a complete closed-loop system for the entire adjustment process. The system can complete all calculations solely based on its own real-time acquired and interrelated parameters, thereby achieving adaptive dynamic adjustment of the height.
[0045] In some alternative implementations, step a above includes: Step a1: Obtain the first visual parameter value represented by the first tangent value of the first field of view angle.
[0046] The first visual parameter value is a parameterized representation of the mathematical transformation result of the first field-of-view angle. It is a dimensionless numerical value obtained by calculating the first field-of-view angle (an angle value) using the tangent function (tan). Specifically, the first field-of-view angle of the virtual camera is read, then used as an input parameter, and the tangent function (tan) in the mathematical library is called for calculation. The result returned by the function, i.e., the tangent value of that angle, is a dimensionless numerical value. This value is named the first visual parameter value; it serves as a mathematical representation of the angle, preparing for subsequent fusion calculations with distance.
[0047] Step a2: Based on the fusion result of the first distance and the first visual parameter value, determine the reference height of the target effect patch.
[0048] The fusion result refers to the output value obtained by combining the first distance and the first visual parameter value through a specific mathematical operation. Specifically, it is the process of combining spatial distance with viewpoint parameters to generate the required reference value. Here, fusion specifically refers to a particular mathematical operation, namely multiplication. The obtained first distance is multiplied by the calculated first visual parameter value. According to the principles of trigonometric geometry, the result of this multiplication operation has the dimension of length in physical terms, which directly corresponds to the reference height in the aforementioned geometric model. Therefore, this product is determined as the reference height of the target effect patch, completing the derivation from the original parameters to the key reference value.
[0049] In the above embodiments, by introducing a visual parameter characterized by the tangent of the first field of view angle and fusing it with a first distance to determine the reference height, this application constructs a stable and reliable technical parameter conversion mechanism. By establishing a deterministic correlation between the field of view angle and the distance parameter, the automated acquisition of reference height data is achieved, effectively avoiding inconsistencies that may arise from relying on manual presets or external measurements. This technical approach enables the system to directly derive key reference data based on its inherent visual parameters, ensuring that the reference height value is highly matched with the current visual environment. This provides an accurate and consistent parameter basis for subsequent real-time adjustments, thereby significantly improving the adaptability and performance stability of the entire system under different operating environments.
[0050] Step S302: In response to a change in the first field of view angle, the changed second field of view angle is obtained. See details below. Figure 2 Step S202 of the illustrated embodiment will not be described again here.
[0051] Step S303: Based on the second field of view angle and the reference height, determine the second distance between the target effect patch and the virtual camera at the second field of view angle.
[0052] Specifically, step S303 includes: Step S3031: Obtain the second visual parameter value represented by the second tangent value of the second field of view angle.
[0053] The second visual parameter value is obtained by performing the same mathematical transformation on the changed second field-of-view angle. It is also the tangent of the second field-of-view angle and serves as the input parameter for calculating the new distance. Specifically, when the virtual camera's field-of-view angle is detected to have changed to the second field-of-view angle, the mathematical transformation is performed again: the new second field-of-view angle value is read and calculated using the tangent function. The resulting new tangent value is defined as the second visual parameter value, representing the new viewpoint conditions and serving as the input parameter for calculating the new distance.
[0054] Step S3032: Determine the ratio between the reference height and the second visual parameter value, and use the ratio to characterize the second distance.
[0055] The calculated and saved constant reference height representing the initial visual target is used as the dividend, and the newly acquired second visual parameter value is used as the divisor for division. Based on the inverse relationship of trigonometric geometry, this ratio also has the physical dimension of length. It directly gives the new distance between the target effect patch and the virtual camera that should be located to maintain the screen fill effect corresponding to the original reference height under the new second field of view. Therefore, this ratio is directly used as the second distance.
[0056] The control method for special effects patches provided in this application introduces a visual parameter characterized by the tangent of a second field of view angle and establishes a ratio relationship between this parameter and a predetermined reference height to directly represent the second distance. This application constructs an efficient and reliable technical parameter conversion mechanism. By establishing a deterministic correlation between the reference height and the new field of view angle parameter, the automatic and accurate derivation of the new distance required by the target special effects patch when the field of view conditions change is achieved. This technical approach enables the system to quickly and accurately determine the position information adapted to the new field of view conditions based on stable reference parameters and changing visual parameters, ensuring the consistency and reliability of the spatial position calculation of the special effects patch under different visual environments. This provides crucial and accurate data support for subsequent real-time position adjustment, significantly enhancing the accuracy and stability of the system's adaptive adjustment.
[0057] Step S304: Based on the offset between the second distance and the first distance, control the movement of the target effect patch.
[0058] Specifically, step S304 includes: Step S3041: Determine the movement direction of the target effect patch based on the offset between the second distance and the first distance.
[0059] The direction of movement refers to the direction of the displacement vector determined by the mathematical sign of the offset. Specifically, the offset is calculated as the algebraic difference between the second distance and the first distance. Then, the direction of movement is determined by judging the mathematical sign (positive or negative) of this offset. The rule is that the sign of the offset directly indicates the direction of movement along the depth axis (such as the Z-axis) of the virtual camera's local coordinate system. Specifically, a positive offset indicates that the effect patch needs to move in the positive direction of the camera's depth axis (away from the camera), while a negative offset indicates that it needs to move in the negative direction of the camera's depth axis (closer to the camera). In this way, the calculation result of a scalar is interpreted as a movement command with a clear spatial direction.
[0060] Step S3042: Control the target effect patch to move a third distance in the moving direction. The third distance is the same as the offset.
[0061] The third distance refers to the magnitude of the actual displacement vector that the target effect patch needs to move. Specifically, the calculated offset is directly used as the third distance, which already includes the direction of movement (by its sign) and the magnitude of movement (by its absolute value) determined in the previous steps. Subsequently, by modifying the spatial coordinate properties of the target effect patch, this third distance is applied to the object as a displacement vector. The direction of this displacement vector is defined by the previously determined direction (the camera's local Z-axis), and its magnitude is equal to the absolute value of the offset. Through this one-time position update, the target effect patch is precisely repositioned, thus achieving visual adaptation to changes in the camera's field of view (FOV).
[0062] The control method for special effects patches provided in this application constructs a complete and reliable position adjustment execution scheme by introducing a mechanism for determining the movement direction and a precise correspondence between the movement distance and the offset. First, this application determines the movement direction of the special effects patch based on the calculated offset, ensuring the accuracy of the position adjustment in spatial orientation. Then, it controls the special effects patch to move along this direction by a third distance exactly consistent with the offset, ensuring the accuracy of the position adjustment in displacement. This control mechanism, which combines clear direction and precise distance, allows the special effects patch to be stably and reliably adjusted to the expected position, effectively avoiding possible pose deviations during adjustment. This technique enhances the determinism and predictability of the system's control over the special effects position, significantly improving the consistency and stability of visual performance, thereby ensuring the accurate realization of the screen filling effect under different viewing conditions.
[0063] In some alternative implementations, the reference height may correspond to half the height value of the target effect patch in its initial state. For example... Figure 4 As shown in the figure, the dashed line represents the reference height of the target effect patch (i.e., half the effect height, denoted as H / 2), which is a constant reference value. Specifically, The first distance is represented (the initial distance between the target effect patch and the virtual camera). Characterizes the first field of view angle (initial FOV). Characterizes the second field of view angle (the changed FOV). Based on trigonometric geometry, it is determined by the first distance. Compared to the first field of view The tangent value can be used to calculate the reference height H / 2, i.e., H / 2 = ×tan Then, taking H / 2 as an invariant, and combining it with the second field of view angle... The second distance can be derived from the tangent value. (The special effects require the new distance after the FOV changes) = (H / 2) / tan ), ultimately through offset = Achieve precise adjustment of the special effects position.
[0064] Furthermore, the aforementioned calculation process (including steps S301 to S304) is triggered only once when a change in the virtual camera's FOV is detected, rather than being updated every frame. This event-driven processing method ensures minimal computational overhead and does not significantly impact game performance, making it suitable for real-time rendering scenes. Figure 5 and Figure 6 As shown, Figure 5 As a result of not adopting the erroneous effect of this application, when the FOV of the virtual camera changes, the on-screen effects exhibit scaling offset, failing to fully fill the screen and resulting in a disjointed visual presentation. Figure 6 To ensure the correct effect after adopting this application, the offset is dynamically calculated and the position of the special effect is adjusted. Even if the FOV changes, the special effect can still accurately adapt to the screen size, perfectly fill the display area, and maintain the consistency and immersion of the visual performance.
[0065] In some optional implementations, the method for controlling the above-mentioned special effects patches further includes: Step b1: Determine whether the target effect face contains multiple sub-effect faces.
[0066] Child effect panels refer to the individual effect components or panel units contained within a complex effect as a whole (parent node). They combine to form a complete visual effect, but can have their own independent positional attributes in space. Specifically, by accessing the internal hierarchy of the target effect panel, it checks whether it contains next-level performance units. It iterates through all direct or indirect child objects of the effect object and determines whether these child objects are themselves independent effect panels based on preset rules (e.g., identifying whether specific visual effect components, such as particle systems or mesh renderers, are attached). If one or more such child effect units are identified, the target effect panel is determined to contain multiple child effect panels. This is essentially an automated reconnaissance of the internal structure of the effect asset.
[0067] Step b2: When the target effect patch contains multiple sub-effect patches, obtain the first target distance between each sub-effect patch and the virtual camera, as well as the first target reference height corresponding to each sub-effect patch.
[0068] The first target distance is the specific application of the first distance concept to sub-effect patches. It refers to the initial distance between each independent sub-effect patch and the virtual camera in a scene with multiple sub-effects. The first target reference height is the specific application of the reference height concept to sub-effect patches. It refers to the reference height value calculated independently for each sub-effect based on its own first target distance and initial first field of view angle. Specifically, for each identified sub-effect patch, initial state data acquisition and calculation are performed as if processing a single independent effect. That is, the first target distance (the independent distance from the sub-effect to the virtual camera) of each sub-effect patch is calculated one by one, and based on this distance and a unified initial first field of view angle, the corresponding first target reference height is calculated independently for each sub-effect using the same algorithm as for a single effect (e.g., distance multiplied by tan(FOV)). This process ensures that each sub-unit has its own set of initial parameters.
[0069] Step b3: In response to the change from the first field of view to the second field of view, determine the distance between each sub-effect patch and the second target of the virtual camera under the second field of view.
[0070] The second target distance is a specific application of the second distance concept to sub-effect patches. It refers to the distance that each sub-effect patch should maintain with the virtual camera under the new viewpoint, calculated independently based on its own first target reference height and the new second field of view angle. Specifically, when the camera's FOV changes, a distance inverse calculation is independently performed for each sub-effect patch with the previously established parameter set. For each sub-effect, using its own first target reference height (as an unchanging standard) calculated and saved in the above steps and the new second field of view angle, the second target distance that each sub-effect should be at under the new technology conditions is calculated through the same inverse operation (e.g., reference height divided by tan(new FOV)). This process is highly parallelized, and the calculation of each sub-effect is independent of each other.
[0071] Step b4: Based on the first target offset between the second target distance and each first target distance, control the movement of each sub-effect patch.
[0072] The first target offset is a specific application of the offset concept to sub-effect planes. It refers to the difference between the second target distance and the first target distance for each sub-effect plane. Specifically, a unique first target offset is calculated for each sub-effect plane, which is its own second target distance minus its own first target distance. Then, the sign of each offset determines its respective movement direction (forward or backward along the camera's Z-axis). Finally, the program drives each sub-effect plane to move independently according to its calculated direction and size (the absolute value of the offset). Through this collective but independent position update, all components of the complex effect can adapt to the new FOV, and their relative positional relationships are maintained.
[0073] In the above embodiments, by establishing a unified processing mechanism for multiple sub-effect panels, the applicability of the method is effectively expanded and the adjustment efficiency of complex effect combinations is improved. This application first automatically identifies the composite effect structure by determining whether the target effect panel contains multiple sub-effect panels; then, by acquiring the distance and reference height parameters of each sub-effect panel in parallel, it lays a data foundation for subsequent collaborative adjustment; by independently calculating and applying the offset of each sub-effect panel, it ensures that each component in the composite effect can achieve accurate positional adaptation when the field of view changes. This layered processing mechanism not only ensures the overall visual harmony of the composite effect but also significantly enhances the adaptability of this application to different effect structures, enabling the system to efficiently handle complex scenes containing multiple sub-effects, greatly improving its practicality and applicability.
[0074] In some optional implementations, the method for controlling the above-mentioned special effects patches further includes: Step c1: If the positional difference of multiple sub-effect patches in the depth direction is less than a preset threshold, then the multiple sub-effect patches are determined as the overall effect patch.
[0075] The preset threshold is a pre-defined distance value used to determine if the positional differences between multiple sub-effect patches in the camera's depth direction are sufficiently small. If the positional difference is less than this threshold, these sub-effects are considered nearly integrated in depth and can be merged for processing. A unified effect patch refers to a set of sub-effects where the positional differences in the depth direction are less than the preset threshold; these sub-effects are then treated as a unified, indivisible set of effects. Specifically, the positional distribution of this set of sub-effect patches along the virtual camera's depth axis (usually the Z-axis) is calculated, and the maximum positional difference in depth between them is identified. This maximum difference is then compared to a predefined preset threshold. If the calculated positional difference is less than this threshold, these sub-effects are considered almost "coplanar" in depth, and therefore redefined from a set of independent individuals into a new logical entity, the unified effect patch, for subsequent unified processing.
[0076] Step c2: Obtain the distance between the overall special effects patch and the virtual camera to the third target, and the reference height of the second target corresponding to the overall special effects patch.
[0077] The third target distance is the initial distance between the entire effect and the virtual camera when multiple sub-effects are treated as a single effect patch. The second target reference height is a unified reference height calculated for the entire effect patch based on the third target distance and the initial first field of view angle. Specifically, a distance representing the overall position of this newly defined overall effect patch needs to be calculated. This can typically be obtained by averaging the depth positions of all sub-effects or by directly using the position of its parent node. Then, using this third target distance representing the entire effect and the initial first field of view angle, the second target reference height representing the entire effect set is calculated using the exact same algorithm as for a single effect. In this way, the entire group has its own set of unified representation parameters.
[0078] Step c3: In response to the change from the first field of view to the second field of view, determine the distance between the overall special effects patch and the fourth target of the virtual camera in the second field of view.
[0079] The fourth target distance is the new distance that the entire set of sub-effects should maintain relative to the virtual camera under the new second field of view when multiple sub-effects are treated as a single effect patch. Specifically, after the FOV changes, the grouped second target reference height and the new second field of view are used as input to perform a distance inverse calculation identical to that for a single effect. The calculated result is the fourth target distance, which represents the unified target distance relative to the virtual camera that the entire effect set (as a rigid whole) should maintain in order to preserve visual performance under the new technology.
[0080] Step c4: Based on the second target offset between the fourth target distance and the third target distance, control the movement of the overall special effects patch.
[0081] The second target offset is the difference between the fourth target distance and the third target distance of the overall effect patch. Specifically, the overall second target offset is calculated as the fourth target distance minus the third target distance. Then, the overall movement direction (forward or backward along the camera's Z-axis) is determined based on the sign of this offset. Finally, the program applies this unified movement direction and displacement magnitude as a rigid transformation to all sub-effect patches contained within the overall effect patch. In this way, all sub-effects are moved synchronously, and their relative positions are strictly maintained, thus achieving more efficient adaptive adjustment of the entire complex effect.
[0082] In the above embodiments, by establishing a holistic processing mechanism for sub-effect patches with similar positions in the depth direction, the efficiency and coordination of composite effect adjustment are significantly improved. This application intelligently identifies eligible sub-effect patches as a unified overall effect patch by determining whether the positional difference in the depth direction of multiple sub-effect patches is less than a preset threshold, thereby achieving coordinated control of closely related effect components. This holistic processing method effectively reduces the operational complexity caused by repetitive calculations and independent adjustments by obtaining unified distance parameters and reference heights of the overall effect patch and calculating a single target offset based on changes in the field of view. This technical approach not only ensures the relative positional relationship of each component in the composite effect in visual space but also ensures the coordination and consistency between effect components through unified control, thereby significantly enhancing the overall performance stability and visual integrity of complex effect combinations when the field of view changes, while improving processing efficiency.
[0083] This embodiment also provides a control device for special effects patches, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0084] This embodiment provides a control device for special effects patches, such as... Figure 7 As shown, it includes: The first acquisition module 701 is used to acquire the first distance between the target effect patch and the virtual camera, the first field of view angle corresponding to the virtual camera, and the reference height corresponding to the target effect patch. The second acquisition module 702 is used to acquire the changed second field of view angle in response to a change in the first field of view angle. The first determining module 703 is used to determine the second distance between the target effect patch and the virtual camera at the second field of view angle based on the second field of view angle and the reference height. The first control module 704 is used to control the movement of the target effect patch based on the offset between the second distance and the first distance.
[0085] In some optional implementations, the first acquisition module 701 includes: The first acquisition submodule is used to determine the reference height corresponding to the target effect patch based on the positional relationship between the first distance and the first field of view angle.
[0086] In some optional implementations, the acquisition submodule includes: The acquisition unit is used to acquire a first visual parameter value characterized by a first tangent value of a first field of view angle; A determining unit is used to determine the reference height of the target effect patch based on the fusion result of the first distance and the first visual parameter value.
[0087] In some alternative implementations, the first determining module 703 includes: The second acquisition submodule is used to acquire the second visual parameter value represented by the second tangent value of the second field of view angle; The first determining submodule is used to determine the ratio between the reference height and the second visual parameter value, and the ratio is used to characterize the second distance.
[0088] In some alternative implementations, the first control module 704 includes: The second determining submodule is used to determine the movement direction of the target effect patch based on the offset between the second distance and the first distance; The control submodule is used to control the target effect patch to move a third distance in the direction of movement. The third distance is the same as the offset.
[0089] In some alternative implementations, the control device for the special effects panels further includes: The judgment module is used to determine whether the target special effect panel contains multiple sub-special effect panels; The third acquisition module is used to acquire the first target distance between each sub-effect patch and the virtual camera, and the first target reference height corresponding to each sub-effect patch, when the target effect patch contains multiple sub-effect patches. The second determining module is used to determine the distance between each sub-effect patch and the virtual camera to the second target under the second field of view angle in response to the change from the first field of view angle to the second field of view angle. The second control module is used to control the movement of each sub-effect patch based on the first target offset between the second target distance and each first target distance.
[0090] In some alternative implementations, the control device for the special effects panels further includes: The third determining module is used to determine the multiple sub-effect patches as the overall effect patch if the positional difference in the depth direction of multiple sub-effect patches is less than a preset threshold. The fourth acquisition module is used to acquire the distance between the overall special effects patch and the virtual camera to the third target, and the reference height of the second target corresponding to the overall special effects patch; The fourth determination module is used to determine the distance between the overall special effects patch and the fourth target of the virtual camera in the second field of view in response to the change from the first field of view to the second field of view. The third control module is used to control the movement of the overall special effects patch based on the second target offset between the fourth target distance and the third target distance.
[0091] The special effects panel control device provided in this application embodiment can execute the special effects panel control method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0092] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0093] The following is a detailed reference. Figure 8 The diagram illustrates a structural schematic suitable for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 801, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 802 or a program loaded from memory 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the electronic device. The processor 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0094] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0095] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a memory 808, or installed from a ROM 802. When the computer program is executed by the processor 801, it performs the functions defined in the control method for special effects patches according to embodiments of this application.
[0096] Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0097] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the control method for the special effects panels shown in the above embodiments is implemented.
[0098] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0099] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method for controlling special effects patches, characterized in that, The method includes: Obtain the first distance between the target effect patch and the virtual camera, the first field of view angle corresponding to the virtual camera, and the reference height corresponding to the target effect patch; In response to a change in the first field of view angle, the changed second field of view angle is obtained; Based on the second field of view angle and the reference height, determine the second distance between the target effect patch and the virtual camera at the second field of view angle; The movement of the target effect patch is controlled based on the offset between the second distance and the first distance.
2. The method according to claim 1, characterized in that, Obtaining the reference height corresponding to the target effect patch includes: Based on the positional relationship between the first distance and the first field of view angle, the reference height corresponding to the target special effects patch is determined.
3. The method according to claim 2, characterized in that, Determining the reference height corresponding to the target special effects patch based on the positional relationship between the first distance and the first field of view angle includes: Obtain a first visual parameter value represented by a first tangent value of the first field of view angle; Based on the fusion result of the first distance and the first visual parameter value, the reference height of the target special effect patch is determined.
4. The method according to any one of claims 1 to 3, characterized in that, Determining the second distance between the target effect patch and the virtual camera at the second field of view angle, based on the second field of view angle and the reference height, includes: Obtain a second visual parameter value characterized by a second tangent value of the second field of view angle; Determine the ratio between the reference height and the second visual parameter value, and use the ratio to characterize the second distance.
5. The method according to claim 1, characterized in that, The step of controlling the movement of the target special effects patch based on the offset between the second distance and the first distance includes: The movement direction of the target special effects patch is determined based on the offset between the second distance and the first distance; The target effect patch is controlled to move a third distance in the moving direction, the third distance being the same as the offset.
6. The method according to claim 1, characterized in that, The method further includes: Determine whether the target effect patch contains multiple sub-effect patches; When the target effect patch contains multiple sub-effect patches, obtain the first target distance between each sub-effect patch and the virtual camera, and the first target reference height corresponding to each sub-effect patch; In response to a change from the first field of view to the second field of view, the distance between each of the sub-effect patches and the second target of the virtual camera at the second field of view is determined; The movement of each of the sub-effect patches is controlled based on the first target offset between the second target distance and each of the first target distances.
7. The method according to claim 6, characterized in that, The method further includes: If the positional difference of the multiple sub-effect patches in the depth direction is less than a preset threshold, then the multiple sub-effect patches are determined as an overall effect patch; Obtain the third target distance between the overall special effects patch and the virtual camera, and the second target reference height corresponding to the overall special effects patch; In response to a change from the first field of view to the second field of view, the distance between the overall special effects patch and the fourth target of the virtual camera at the second field of view is determined; The movement of the overall special effects patch is controlled based on the second target offset between the fourth target distance and the third target distance.
8. A control device for special effects panels, characterized in that, The device includes: The first acquisition module is used to acquire the first distance between the target effect patch and the virtual camera, the first field of view angle corresponding to the virtual camera, and the reference height corresponding to the target effect patch. The second acquisition module is used to acquire the changed second field of view angle in response to a change in the first field of view angle. The first determining module is used to determine the second distance between the target effect patch and the virtual camera at the second field of view angle based on the second field of view angle and the reference height. The first control module is used to control the movement of the target special effects patch based on the offset between the second distance and the first distance.
9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the control method for the special effects facets according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the control method for the special effects facets according to any one of claims 1 to 7.
11. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the control method for the special effects facets according to any one of claims 1 to 7.