Shooting method and device of virtual camera, electronic equipment and storage medium
By obtaining multiple virtual objects positions and gaze points in the virtual scene, and controlling the virtual camera for shooting, the problem of poor scene effects caused by single object focus in the prior art is solved, and the shooting effect of the virtual camera is improved.
Patent Information
- Application Number
- CN202510562669.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-07-29
AI Technical Summary
In virtual camera control, focusing only on one virtual object leads to poor scene effects, especially when there is interaction between virtual objects, it is difficult for the prior art to take into account the shooting effects of multiple objects.
By obtaining the positions of at least two virtual objects in the virtual scene, determining the camera gaze point corresponding to the animation frame to be shot, and obtaining shooting parameters of the virtual camera, controlling the virtual camera to shoot based on this information to improve the scene effect.
In the interactive behavior scene between multiple virtual objects, the scene effect of camera shooting is improved, and the actions and interaction behavior of multiple virtual objects can be better taken into account.
Smart Images

Figure CN120381664A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of virtual camera shooting, and particularly relates to a shooting method, device, electronic device, and storage medium for a virtual camera. Background Art
[0002] In the wave of the Internet, entertainment projects are becoming increasingly important in people's lives. To meet the requirements for presenting scene effects in some entertainment projects (such as animated movies and games), it is necessary to control the virtual camera of the shooting scene to prompt the camera to cooperate to produce some special camera movement effects.
[0003] Currently, when controlling a virtual camera, generally, for the virtual object currently in focus, manual control is used to move the virtual camera. However, in some scenes, there are corresponding interaction behaviors between virtual objects. If only one virtual object is focused on for camera control, the scene effect obtained by the camera shooting will be poor. Summary of the Invention
[0004] Embodiments of the present application provide a shooting method, device, electronic device, and storage medium for a virtual camera, which can improve the scene effect obtained by camera shooting.
[0005] In a first aspect, embodiments of the present application provide a shooting method for a virtual camera. The method includes:
[0006] Obtain the object positions of at least two virtual objects in the virtual scene;
[0007] Based on the object positions of at least two virtual objects, determine the camera fixation point corresponding to the animation frame to be shot, where the camera fixation point is the fixation point of the virtual camera shooting the virtual scene;
[0008] Obtain the shooting parameters of the virtual camera;
[0009] Based on the shooting parameters and the camera fixation point, control the virtual camera to shoot the virtual scene to obtain a first animation frame.
[0010] In a second aspect, embodiments of the present application provide a shooting device for a virtual camera. The device includes:
[0011] A position acquisition module, configured to obtain the object positions of at least two virtual objects in the virtual scene;
[0012] A fixation point determination module, configured to determine the camera fixation point corresponding to the animation frame to be shot based on the object positions of at least two virtual objects, where the camera fixation point is the fixation point of the virtual camera shooting the virtual scene;
[0013] A parameter acquisition module, configured to acquire the shooting parameters of the virtual camera described above;
[0014] A shooting module, configured to control the virtual camera to shoot the virtual scene based on the shooting parameters and the camera fixation point described above, so as to obtain a first animation frame.
[0015] In a third aspect, an embodiment of the present application further provides an electronic device, including a memory storing multiple instructions; a processor loads the instructions from the memory to execute the steps of any one of the virtual camera shooting methods provided by the embodiments of the present application.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps of any one of the virtual camera shooting methods provided by the embodiments of the present application.
[0017] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program or instructions, and when the computer program or instructions are executed by a processor, the steps in any one of the virtual camera shooting methods provided by the embodiments of the present application are implemented.
[0018] By adopting the solution of the embodiment of the present application, it is possible to acquire the object positions of at least two virtual objects in a virtual scene; based on the object positions of the at least two virtual objects, determine the camera fixation point corresponding to the animation frame to be shot, where the camera fixation point is the fixation point of the virtual camera shooting the virtual scene; acquire the shooting parameters of the virtual camera; and based on the shooting parameters and the camera fixation point, control the virtual camera to shoot the virtual scene to obtain a first animation frame, so as to control the virtual camera by introducing a fixation point in a scene with multiple virtual objects, thereby improving the scene effect obtained by the camera shooting. Description of the Drawings
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1 It is a schematic flowchart of an embodiment of the virtual camera shooting method provided by the embodiment of the present application;
[0021] Figure 2 It is a schematic diagram of the camera fixation point provided by the embodiment of the present application;
[0022] Figure 3 It is a schematic diagram of the shooting parameters provided by the embodiment of the present application;
[0023] Figure 4 It is a schematic structural diagram of the shooting device of the virtual camera provided in the embodiment of the present application;
[0024] Figure 5 It is a schematic structural diagram of the electronic device provided in the embodiment of the present application. Detailed implementation manners
[0025] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, terms such as "first" and "second" are only used for distinguishing descriptions, and cannot be understood as indicating or implying relative importance. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "a plurality" is two or more, unless otherwise specifically defined.
[0026] The embodiment of the present application provides a shooting method, device, electronic device and computer-readable storage medium for a virtual camera.
[0027] Specifically, this embodiment will be described from the perspective of the shooting device of the virtual camera. The shooting device of the virtual camera can be specifically integrated in the electronic device, that is, the shooting method of the virtual camera in the embodiment of the present application can be executed by the electronic device. Optionally, the electronic device may include: a terminal device. The terminal device may be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a game console, or a personal computer (PC), etc.
[0028] The shooting method of the virtual camera provided in the embodiment of the present application can be applied to a shooting system such as a virtual camera. Among them, the shooting system of the virtual camera may include a player terminal device and a server. The terminal may be a device that includes both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. The player terminal device and the server can perform two-way communication through a network.
[0029] Optionally, the server may be an independent server, or a server network or server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. Among them, the cloud server is composed of a large number of computers or network servers based on cloud computing (Cloud Computing).
[0030] The following will be described in detail with reference to the accompanying drawings. In this embodiment, the execution subject is a terminal device. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown in the drawings.
[0031] The shooting method of the virtual camera in this embodiment includes obtaining the object positions of at least two virtual objects in the virtual scene; determining the camera fixation point corresponding to the animation frame to be shot based on the object positions of the at least two virtual objects, where the camera fixation point is the fixation point of the virtual camera shooting the virtual scene; obtaining the shooting parameters of the virtual camera; and controlling the virtual camera to shoot the virtual scene based on the shooting parameters and the camera fixation point to obtain the first animation frame, which can improve the scene effect obtained by the camera shooting.
[0032] Please refer to Figure 1 , taking the terminal as an example for illustration. This embodiment provides a shooting method of a virtual camera. The specific process of the shooting method of the virtual camera can be as follows in steps 101 to 104, where:
[0033] Step 101: Obtain the object positions of at least two virtual objects in the virtual scene.
[0034] Among them, the object position is the position where the virtual object is located in the virtual scene, and the object position of the virtual object can be specifically indicated by position coordinates.
[0035] It should be noted that the virtual scene is a virtual scene displayed (or provided) when the application program runs on the terminal or the server. Optionally, the virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5D virtual scene, or a three-dimensional virtual scene. The embodiments of the present application do not limit the dimension of the virtual scene. For example, the virtual scene can include the sky, land, ocean, etc. The land can include environmental elements such as deserts and cities, and users can control the virtual object to move in the virtual scene.
[0036] It should be noted that the above virtual object refers to a dynamic object or a static object in a virtual scene. The virtual object can be an object that can be controlled by the user or an object that cannot be controlled by the user. Optionally, the virtual object can be a virtual character, a virtual animal, an anime character, etc. The virtual object can be a virtual avatar in the virtual scene that represents the user. The virtual scene can include at least one virtual object, and each virtual object has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene. In a possible implementation, the user can control the virtual object to move in the virtual scene. For example, the user can control the virtual object to run, jump, crawl, etc., and can also control the virtual object to use skills, virtual props, etc. provided by the application to fight with other game characters.
[0037] In some embodiments, in a scene where the above at least two virtual objects can perform specific interaction behaviors with each other, the above at least two virtual objects include a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the current device, and the second virtual object is a virtual object controlled by another terminal device.
[0038] Among them, the current terminal is the terminal controlled by the current user through the game account, that is, it means that the first virtual object is the virtual object controlled by the current user.
[0039] Among them, the other terminal can be the terminal controlled by another user through the user account, that is, it means that the second virtual object is the virtual object controlled by another user. Or, the other terminal can also be the game server, that is, it means that the second virtual object is an NPC character provided by the game server, which can be specifically set according to requirements and will not be limited here.
[0040] It can be understood that in a scene where the above at least two virtual objects can perform specific interaction behaviors with each other, by controlling the virtual camera to perform camera movement targeting the above at least two virtual objects, it is possible to make the virtual camera take into account multiple virtual objects and specific interaction behaviors between the virtual objects during the camera movement. For example, if the above at least two virtual objects are mutually hostile virtual objects, during the process of controlling the camera movement of the virtual camera, it is possible to take into account the hostile behaviors between the mutually hostile virtual objects (for example, a virtual character releases an attack skill, and the camera can follow the release trajectory of the attack skill for shooting to achieve the degree of taking into account different virtual objects based on the degree of interaction behavior), so as to make the scene effect captured by the camera be presented better.
[0041] Step 102: Determine the camera fixation point corresponding to the animation frame to be captured based on the object positions of at least two of the above virtual objects. The camera fixation point is the fixation point at which the virtual camera captures the virtual scene.
[0042] It should be noted that, in order to enable the terminal to understand the degree of balance between different virtual objects in an animation frame, the terminal can introduce the camera fixation point corresponding to the animation frame to be captured. This camera fixation point can be the fixation point of a virtual camera when shooting a virtual scene, that is, it indicates the position that the virtual camera focuses on when shooting the virtual scene, so as to indicate the content that the virtual camera needs to shoot currently based on the camera fixation point, that is, the content to be presented in the animation frame to be captured.
[0043] In this embodiment, the camera fixation point is determined based on the object positions of at least two virtual objects, so as to indicate the degree of balance between virtual objects through the camera fixation point. That is, if the camera fixation point is closer to a virtual object, the degree of balance of the virtual object being approached is greater, and thus the proportion of the virtual object being approached in the animation frame to be captured is also heavier.
[0044] Exemplarily, as Figure 2 shown, Figure 2 the virtual scene shown includes at least two virtual characters, namely character A and character B. And a camera fixation point is set between character A and character B, that is, Figure 2 point A in it. If point A is at the center of character A and character B, it means that the current degree of balance between character A and character B is the same. If point A is closer to character A, it means that the current degree of balance of character A is greater. If point A is closer to character B, it means that the current degree of balance of character B is greater.
[0045] In some embodiments, determining the camera fixation point corresponding to the animation frame to be captured based on the object positions of at least two of the above virtual objects may include: obtaining a fixation point position indication parameter corresponding to the animation frame to be captured; determining the camera fixation point corresponding to the animation frame to be captured within the position range corresponding to at least two of the above object positions based on the fixation point position indication parameter.
[0046] Among them, the fixation point position indication parameter is used to indicate the relative position information of the fixation point of the virtual camera in the virtual scene in the animation frame.
[0047] In this embodiment, it can be set that the fixation point position indication parameter refers to the relative position between at least two virtual objects. Then, based on this fixation point position indication parameter, the camera fixation point corresponding to the fixation point position indication parameter can be determined from the position range composed of the object positions of at least two virtual objects.
[0048] It can be understood that the fixation point position indication parameter can be the same or different in different virtual scenes, and it can be specifically determined according to the degree of balance between virtual objects in the corresponding virtual scene by the user, which is not limited here.
[0049] Specifically, the above-mentioned fixation point position indication parameter may include a preset ratio coefficient, which is used to indicate the relative position of the camera fixation point between object positions. For example, the fixation point position indication parameter may be 1 / 2 to indicate the central position of the camera fixation point between object positions.
[0050] Specifically, the above-mentioned fixation point position indication parameter may include a value within the parameter value range, which is composed of at least two critical values, and each critical value corresponds to the object position of a virtual object, that is, the parameter value range matches the position range corresponding to the above object position, and there is a mapping relationship between the two.
[0051] Exemplarily, as Figure 2 shown, the above-mentioned fixation point position indication parameter may be a floating-point number with a value range of 0 to 1. When the fixation point position indication parameter is 0, it can be explained that point A is used to indicate the concerned role A. When the fixation point position indication parameter is 1, it can be explained that point A is used to indicate the concerned role B. When the fixation point position indication parameter is 0.5, it can be explained that point A is used to indicate the central position between the concerned role A and role B.
[0052] Specifically, determining the camera fixation point corresponding to the to-be-shot animation frame within the position ranges corresponding to at least two of the above object positions based on the above-mentioned fixation point position indication parameter may include: determining the position difference vector between at least two of the above object positions; determining the product between the position difference vector and the above-mentioned fixation point position indication parameter; and determining the camera fixation point corresponding to the to-be-shot animation frame based on the above object position and the above product.
[0053] Exemplarily, based on Figure 2 the example shown, if the position of role A is set as location_a and the position of role B is set as location_b, then the position difference vector diretion can be obtained by calculating the difference between location_a and location_b.
[0054] Then, by setting the fixation point position indication parameter as focus_point, the position of the camera fixation point focus_location can be calculated, that is, focus_location = location_a + diretion * focus_point.
[0055] Step 103, obtain the shooting parameters of the above virtual camera.
[0056] Among them, the above shooting parameters are used to indicate the parameters when the virtual camera shoots the virtual scene.
[0057] It is understandable that the fixation point position indication parameters can be the same or different in different virtual scenarios, and can be specifically determined according to the user's requirements for the scene effects of the corresponding virtual scenarios, which are not limited herein.
[0058] Specifically, the above shooting parameters may include camera pose indication parameters to determine the camera pose of the virtual camera based on the camera pose indication parameters. Alternatively, the above shooting parameters may directly include the camera pose of the virtual camera to directly control the virtual camera using the camera pose of the virtual camera.
[0059] Among them, the above camera pose indication parameters may include, but are not limited to, the camera shooting angle and the camera arm length.
[0060] Among them, the above camera shooting angle is used to indicate the shooting pose of the virtual camera when shooting the virtual scene. The camera shooting angle may be Euler angles, which include, but are not limited to, the yaw angle, the pitch angle, the roll angle, etc., and can be specifically set according to requirements, which are not limited herein. For example, the value range of the above camera shooting angle may be -180° to 180°, or 0° to 360°.
[0061] Among them, the above yaw angle refers to the angle at which the camera rotates around the vertical axis (usually the upward direction of the camera itself), which describes the left - right rotation direction of the camera; the above pitch angle refers to the angle at which the camera rotates around the horizontal axis (usually the left - right direction of the camera), which describes the upward or downward viewing direction of the camera; the above roll angle refers to the angle at which the camera rotates around the front - back axis (usually the lens direction of the camera), which determines the horizontal tilt of the camera.
[0062] It should be noted that for the changes in three - dimensional space, the above camera shooting angle includes a first camera shooting angle belonging to the target plane (such as the horizontal plane formed by the X - axis and the Y - axis), and a second camera shooting angle in the vertical direction (such as the Z - axis) relative to the above target plane.
[0063] Among them, the above camera arm length is used to indicate the distance between the virtual camera and the camera fixation point, and the value range of the camera arm length can be positive rational numbers.
[0064] Exemplarily, as Figure 3 shown, Figure 3 the virtual scene shown includes character C and character D, and a camera fixation point is set between character C and character D, that is, Figure 3 point B in Figure 3 the distance between the virtual camera in Figure 3 and point B is the camera arm length, and
[0065] Step 104: Based on the above shooting parameters and the above camera fixation point, control the above virtual camera to shoot the above virtual scene to obtain a first animation frame.
[0066] In this embodiment, after obtaining the shooting parameters and the camera fixation point of the virtual camera, the terminal can control the virtual camera to shoot the above virtual scene, so that the virtual camera can take into account multiple virtual characters during the shooting process. For example, the first animation frame captured by the virtual camera can not only display the actions of the first virtual character corresponding to the current terminal, but also take into account the actions of the second virtual characters corresponding to other terminals.
[0067] In some embodiments, the above shooting parameters include camera pose indication parameters. The controlling the above virtual camera to shoot the above virtual scene based on the above shooting parameters and the above camera fixation point to obtain a first animation frame may include: determining the camera pose of the above virtual camera based on the above camera pose indication parameters and the above camera fixation point; controlling the above virtual camera to face the above camera fixation point to shoot the above virtual scene based on the above camera pose, so as to capture the content around the camera fixation point in the virtual scene.
[0068] Among them, the above camera pose is used to indicate the position and / or posture of the virtual camera when shooting the virtual scene. Through the camera pose, the virtual camera can be controlled to maintain the corresponding posture at the corresponding position during shooting, so as to capture the content that meets the expectations.
[0069] It can be understood that the above camera pose is obtained based on the camera fixation point. Therefore, when controlling the virtual camera based on the camera pose, the virtual camera can face the above camera fixation point to shoot the above virtual scene.
[0070] Specifically, the above camera pose indication parameters include the camera shooting angle and the camera arm length. The determining the camera pose of the above virtual camera based on the above camera pose indication parameters and the above camera fixation point may include: determining the direction vector of the above virtual camera facing the above camera fixation point based on the above camera shooting angle and the above camera fixation point; determining the relative position vector between the above virtual camera and the above camera fixation point based on the above direction vector and the above camera arm length; determining the camera pose of the above virtual camera based on the above camera fixation point and the above relative position vector.
[0071] Exemplarily, based on Figure 3 the example shown, if the camera shooting angle is set to addition_yaw, the camera fixation point can be used as the starting point, and addition_yaw can be converted into the direction vector addtion_yaw_diretion of the virtual camera facing the camera fixation point.
[0072] Then, set the camera arm length to arm_length and the position of the camera's focus point to focus_location, and the camera pose camera_location of the above virtual camera can be calculated, that is, camera_location = focus_location + addtion_yaw_diretion * arm_length.
[0073] Specifically, for the changes in the three-dimensional space, the above camera shooting angles may include a first camera shooting angle belonging to the target plane and a second camera shooting angle in the vertical direction relative to the above target plane; the above determining the direction vector of the above virtual camera facing the above camera focus point based on the above camera shooting angles and the above camera focus point may include: determining a first direction vector of the above virtual camera facing the above camera focus point based on the above first camera shooting angle and the above camera focus point; determining a second direction vector of the above virtual camera facing the above camera focus point based on the above second camera shooting angle and the above camera focus point; and fusing the above first direction vector and the above second direction vector to determine the direction vector of the above virtual camera facing the above camera focus point in the three-dimensional space.
[0074] In some embodiments, the above first animation frame is a key frame, and the key frames adjacent to the above first animation frame include a second animation frame. The method may further include: interpolating between the camera focus points corresponding to the above first animation frame and the above second animation frame to obtain an interpolated focus point; interpolating between the shooting parameters corresponding to the above first animation frame and the above second animation frame to obtain interpolated shooting parameters; and controlling the above virtual camera to shoot the above virtual scene based on the above interpolated focus point and the above interpolated shooting parameters to obtain a third animation frame between the above first animation frame and the above second animation frame.
[0075] In this embodiment, the focus points and shooting parameters corresponding to the animation frames between key frames can be obtained by interpolation between key frames, so as to control the virtual camera to shoot the content corresponding to the animation frames between key frames based on the focus points and shooting parameters obtained by interpolation for the virtual scene.
[0076] As can be seen from the above content, by obtaining the object positions of at least two virtual objects in the virtual scene; determining the camera focus point corresponding to the animation frame to be shot based on the object positions of at least two of the above virtual objects, where the above camera focus point is the focus point of the virtual camera shooting the above virtual scene; obtaining the shooting parameters of the above virtual camera; and controlling the above virtual camera to shoot the above virtual scene based on the above shooting parameters and the above camera focus point to obtain a first animation frame, thereby controlling the virtual camera by introducing a focus point in the scene of multiple virtual objects to improve the scene effect obtained by the camera shooting.
[0077] This embodiment also provides a shooting device for a virtual camera, and the shooting device for the virtual camera can be specifically integrated in a terminal device. For example, as Figure 4 shown, the shooting device for the virtual camera may include:
[0078] A position acquisition module 401, configured to acquire the object positions of at least two virtual objects in a virtual scene;
[0079] A fixation point determination module 402, configured to determine a camera fixation point corresponding to an animation frame to be shot based on the object positions of at least two of the above virtual objects, where the camera fixation point is the fixation point at which the virtual camera shoots the virtual scene;
[0080] A parameter acquisition module 403, configured to acquire shooting parameters of the virtual camera;
[0081] A shooting module 404, configured to control the virtual camera to shoot the virtual scene based on the shooting parameters and the camera fixation point, to obtain a first animation frame.
[0082] In some embodiments, the fixation point determination module 402 is specifically configured to:
[0083] Acquire a fixation point position indication parameter corresponding to the animation frame to be shot;
[0084] Determine a camera fixation point corresponding to the animation frame to be shot within a position range corresponding to the object positions of at least two of the above based on the fixation point position indication parameter.
[0085] In some embodiments, the fixation point determination module 402 is specifically configured to:
[0086] Determine a position difference vector between the object positions of at least two of the above;
[0087] Determine a product between the position difference vector and the fixation point position indication parameter;
[0088] Determine a camera fixation point corresponding to the animation frame to be shot based on the object positions and the product.
[0089] In some embodiments, the shooting parameters include camera pose indication parameters, and the shooting module 404 is specifically configured to:
[0090] Determine a camera pose of the virtual camera based on the camera pose indication parameter and the camera fixation point;
[0091] Control the virtual camera to shoot the virtual scene towards the camera fixation point based on the camera pose.
[0092] In some embodiments, the above camera pose indication parameters include the camera shooting angle and the camera arm length, and the shooting module 404 is specifically configured to:
[0093] Based on the above camera shooting angle and the above camera fixation point, determine the direction vector of the above virtual camera towards the above camera fixation point;
[0094] Based on the above direction vector and the above camera arm length, determine the relative position vector between the above virtual camera and the above camera fixation point;
[0095] Based on the above camera fixation point and the above relative position vector, determine the camera pose of the above virtual camera.
[0096] In some embodiments, the above camera shooting angle includes a first camera shooting angle belonging to a target plane and a second camera shooting angle with respect to the vertical direction of the above target plane; the shooting module 404 is specifically configured to:
[0097] Based on the above first camera shooting angle and the above camera fixation point, determine the first direction vector of the above virtual camera towards the above camera fixation point;
[0098] Based on the above second camera shooting angle and the above camera fixation point, determine the second direction vector of the above virtual camera towards the above camera fixation point;
[0099] Fuse the above first direction vector and the above second direction vector to determine the direction vector of the above virtual camera towards the above camera fixation point in three-dimensional space.
[0100] In some embodiments, the above first animation frame is a key frame, and the key frames adjacent to the above first animation frame include a second animation frame. The shooting device of the above virtual camera further includes an interpolation module, and the interpolation module is specifically configured to:
[0101] Interpolate between the camera fixation points corresponding to the above first animation frame and the above second animation frame to obtain an interpolated fixation point;
[0102] Interpolate between the shooting parameters corresponding to the above first animation frame and the above second animation frame to obtain interpolated shooting parameters;
[0103] Based on the above interpolated fixation point and the above interpolated shooting parameters, control the above virtual camera to shoot the above virtual scene to obtain a third animation frame located between the above first animation frame and the above second animation frame.
[0104] In some embodiments, the above at least two virtual objects include a first virtual object and a second virtual object. The above first virtual object is a virtual object controlled by the current device, and the above second virtual object is a virtual object controlled by other terminal devices.
[0105] As can be seen from the above, by obtaining the object positions of at least two virtual objects in a virtual scene; based on the object positions of the at least two virtual objects, determining the camera fixation point corresponding to the animation frame to be captured, where the camera fixation point is the fixation point at which a virtual camera captures the virtual scene; obtaining the shooting parameters of the virtual camera; and based on the shooting parameters and the camera fixation point, controlling the virtual camera to capture the virtual scene to obtain a first animation frame. Thus, in a scene with multiple virtual objects, the virtual camera is controlled by introducing a fixation point to improve the scene effect obtained by camera shooting.
[0106] Correspondingly, an embodiment of the present application further provides an electronic device. The electronic device may be a terminal, and the terminal may be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), or a personal digital assistant (PDA). Alternatively, the electronic device may be a server.
[0107] As Figure 5 shown, Figure 5 is a schematic structural diagram of the electronic device provided by an embodiment of the present application. The electronic device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. Among them, the processor 501 is electrically connected to the memory 502. Those skilled in the art can understand that the structural diagram of the electronic device shown in the figure does not constitute a limitation on the electronic device, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0108] The processor 501 is the control center of the electronic device 500, connecting various parts of the entire electronic device 500 through various interfaces and lines. By running or loading software programs and / or units stored in the memory 502, and by calling data stored in the memory 502, the processor 501 executes various functions of the electronic device 500 and processes data, thereby monitoring the entire electronic device 500. The processor 501 may be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
[0109] In an embodiment of the present application, the processor 501 in the electronic device 500 will load the instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions, such as:
[0110] Obtain the object positions of at least two virtual objects in the virtual scene;
[0111] Based on the object positions of at least two of the above virtual objects, determine the camera fixation point corresponding to the animation frame to be captured, where the camera fixation point is the fixation point of the virtual camera when shooting the virtual scene;
[0112] Obtain the shooting parameters of the virtual camera;
[0113] Based on the shooting parameters and the camera fixation point, control the virtual camera to shoot the virtual scene to obtain the first animation frame.
[0114] Thus, the electronic device 500 provided in this embodiment can bring the following technical effects: improving the scene effect obtained by camera shooting.
[0115] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, which will not be elaborated here.
[0116] Optionally, as Figure 5 shown, the electronic device 500 further includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. Among them, the processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507 respectively. Those skilled in the art can understand that Figure 5 the structure of the electronic device shown in
[0117] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, 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, videos, and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations of the user on or near it (such as operations of the user using any suitable object or accessory such as a finger or a stylus on or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the user, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 501, and can receive and execute the commands sent by the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In the embodiments of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two independent components to implement input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to implement the input function.
[0118] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other electronic devices through wireless communication, and transmit and receive signals with the network device or other electronic devices.
[0119] The audio circuit 505 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 505 can transmit the electrical signal converted from the received audio data to the speaker, and the speaker converts it into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and then converted into audio data. After the audio data is output to the processor 501 for processing, it is sent to another electronic device through the radio frequency circuit 504, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between the peripheral earphone and the electronic device.
[0120] The input unit 506 can be used to receive input digital, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0121] The power supply 507 is used to supply power to each component of the electronic device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 507 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0122] Although Figure 5 not shown in the figure, the electronic device 500 may also include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.
[0123] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0124] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0125] For this reason, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored. The computer programs can be loaded by a processor to execute any one of the shooting methods of a virtual camera provided by the embodiments of the present application. The computer programs can execute the following steps of the shooting method of the virtual camera:
[0126] Obtain the object positions of at least two virtual objects in the virtual scene;
[0127] Based on the object positions of at least two of the above virtual objects, determine the camera fixation point corresponding to the animation frame to be shot, where the camera fixation point is the fixation point of the virtual camera shooting the virtual scene;
[0128] Obtain the shooting parameters of the above virtual camera;
[0129] Based on the above shooting parameters and the above camera fixation point, control the above virtual camera to shoot the above virtual scene to obtain a first animation frame.
[0130] It can be seen that the computer program can be loaded by the processor to execute any one of the shooting methods of the virtual camera provided by the embodiments of the present application, thus bringing the following technical effects: improving the scene effect obtained by camera shooting.
[0131] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, which will not be elaborated here.
[0132] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
[0133] Since the computer program stored in the computer-readable storage medium can execute any one of the shooting methods of the virtual camera provided by the embodiments of the present application, therefore, the beneficial effects that can be achieved by any one of the shooting methods of the virtual camera provided by the embodiments of the present application can be realized. For details, refer to the previous embodiments, which will not be elaborated here.
[0134] According to one aspect of the present application, there is also provided a computer program product or computer program. The computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the methods provided in the various alternative implementations in the above embodiments.
[0135] In the above embodiments of the shooting device, computer-readable storage medium, electronic device, and computer program product of the virtual camera, the descriptions of each embodiment have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes and the beneficial effects that can be brought by the shooting device, computer-readable storage medium, computer program product, electronic device, and their corresponding units of the virtual camera described above can refer to the description of the shooting method of the virtual camera in the above embodiments, which will not be elaborated here specifically.
[0136] The above has introduced in detail a shooting method, device, electronic device, computer-readable storage medium, and computer program product of a virtual camera provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A shooting method for a virtual camera, characterized in that, The method includes: Obtaining the object positions of at least two virtual objects in the virtual scene; Based on the object positions of at least two of the virtual objects, determining a camera fixation point corresponding to an animation frame to be captured, where the camera fixation point is the fixation point at which a virtual camera captures the virtual scene; Obtaining the shooting parameters of the virtual camera; Based on the shooting parameters and the camera fixation point, controlling the virtual camera to capture the virtual scene to obtain a first animation frame.
2. The shooting method of the virtual camera according to claim 1, characterized in that The determining a camera fixation point corresponding to an animation frame to be captured based on the object positions of at least two of the virtual objects includes: Obtaining a fixation point position indication parameter corresponding to the animation frame to be captured; Based on the fixation point position indication parameter within the position range corresponding to at least two of the object positions, determining the camera fixation point corresponding to the animation frame to be captured.
3. The shooting method of the virtual camera according to claim 2, characterized in that, The determining the camera fixation point corresponding to the animation frame to be captured based on the fixation point position indication parameter within the position range corresponding to at least two of the object positions includes: Determining a position difference vector between at least two of the object positions; Determining the product between the position difference vector and the fixation point position indication parameter; Based on the object positions and the product, determining the camera fixation point corresponding to the animation frame to be captured.
4. The shooting method of the virtual camera according to claim 1, characterized in that, The shooting parameters include a camera pose indication parameter, and the controlling the virtual camera to capture the virtual scene based on the shooting parameters and the camera fixation point to obtain a first animation frame includes: Based on the camera pose indication parameter and the camera fixation point, determining the camera pose of the virtual camera; Based on the camera pose, controlling the virtual camera to face the camera fixation point to capture the virtual scene.
5. The shooting method of the virtual camera according to claim 4, characterized in that, The camera pose indication parameter includes a camera shooting angle and a camera arm length, and the determining the camera pose of the virtual camera based on the camera pose indication parameter and the camera fixation point includes: Based on the camera shooting angle and the camera fixation point, determining a first direction vector in which the virtual camera faces the camera fixation point; Based on the first direction vector and the camera arm length, determining a relative position vector between the virtual camera and the camera fixation point; Based on the camera fixation point and the relative position vector, determining the camera pose of the virtual camera.
6. The shooting method of the virtual camera according to claim 5, characterized in that, The camera shooting angle includes a first camera shooting angle belonging to a target plane and a second camera shooting angle with respect to the vertical direction of the target plane; The determining a first direction vector in which the virtual camera faces the camera fixation point based on the camera shooting angle and the camera fixation point includes: Based on the first camera shooting angle and the camera fixation point, determining a first direction vector in which the virtual camera faces the camera fixation point; Based on the second camera shooting angle and the camera fixation point, determining a second direction vector in which the virtual camera faces the camera fixation point; Fusing the first direction vector and the second direction vector to determine a direction vector in three-dimensional space in which the virtual camera faces the camera fixation point.
7. The shooting method of the virtual camera according to claim 1, characterized in that, The first animation frame is a key frame, and the key frames adjacent to the first animation frame include a second animation frame. The method further includes: Interpolating between the camera fixation points corresponding to the first animation frame and the second animation frame to obtain an interpolated fixation point; Interpolating between the shooting parameters corresponding to the first animation frame and the second animation frame to obtain interpolated shooting parameters; Based on the interpolated fixation point and the interpolated shooting parameters, controlling the virtual camera to shoot the virtual scene to obtain a third animation frame between the first animation frame and the second animation frame.
8. The shooting method of the virtual camera according to any one of claims 1 to 7, characterized in that, The at least two virtual objects include a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the current device, and the second virtual object is a virtual object controlled by other terminal devices.
9. A shooting device for a virtual camera, characterized in that, The device includes: A position acquisition module for acquiring the object positions of at least two virtual objects in the virtual scene; A fixation point determination module for determining the camera fixation point corresponding to the animation frame to be shot based on the object positions of at least two of the virtual objects. The camera fixation point is the fixation point at which the virtual camera shoots the virtual scene; A parameter acquisition module for acquiring the shooting parameters of the virtual camera; A shooting module for controlling the virtual camera to shoot the virtual scene based on the shooting parameters and the camera fixation point to obtain a first animation frame.
10. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps of the shooting method of the virtual camera according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the shooting method of the virtual camera according to any one of claims 1 to 8.