Virtual camera control method, apparatus and electronic device
Patent Information
- Application Number
- CN202311130276.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2043-09-04
AI Technical Summary
但是,该方式得到的拼接的拍摄结果较为生硬,导致相机拍摄结果不自然
[0010] This invention provides a virtual camera control method, device, and electronic device. First, it acquires the spherical information of a target model to be photographed and a preset polyhedral sphere. The spherical information of the preset polyhedral sphere includes: the first surface swept across the preset polyhedral sphere during the virtual camera's shooting process based on a preset camera motion trajectory; then, it determines the center position of the target model and the initial position of the virtual camera; next, based on the center position of the target model and the initial position of the camera, it creates a target polyhedral sphere with the same topological structure as the preset polyhedral sphere; within the target polyhedral sphere, it determines a target surface corresponding to the first surface swept across by the virtual camera based on the preset camera motion trajectory; then, based on the target surface, it determines the target camera motion trajectory for the virtual camera to photograph the target model and controls the virtual camera to photograph the target model based on the target camera motion trajectory. In this method, by mapping the spherical information of the preset polyhedral sphere, which matches the preset camera motion trajectory, onto the surface of the target polyhedral sphere, a target camera motion trajectory suitable for photographing the target model can be obtained. This allows the method to automatically adapt camera motion trajectories to different object models, improving the camera's shooting effect.
Smart Images

Figure CN117379785B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of camera animation production technology, and in particular to a control method, device and electronic device for a virtual camera. Background Technology
[0002] In game development, it's often necessary to create camera animations for certain object models while the game is running. These object models can be architectural models, character models, etc. As game content becomes increasingly rich, different players may encounter different situations within the same game scene. For example, in the same dialogue sequence, player A might encounter two short character models, while player B might encounter two character models of different heights. If only a pre-set set of camera animations is used to capture the game scene corresponding to player A and player B, the camera capture results will be poor.
[0003] In related technologies, object models are typically categorized into multiple object types based on their volume within the game scene. Then, a corresponding camera animation is created for each object type. During gameplay, the appropriate camera animation is used based on the object type being filmed. The camera footage captured by these animations is then stitched together to obtain the final image. However, this method produces a rather abrupt and unnatural stitched image. Summary of the Invention
[0004] The purpose of this invention is to provide a control method, device, and electronic device for a virtual camera, so that the camera's motion trajectory can automatically adapt to object models of different volumes, thereby improving the camera's shooting effect.
[0005] In a first aspect, the present invention provides a method for controlling a virtual camera, the method comprising: acquiring spherical information of a target model to be photographed and a preset polyhedral sphere; wherein the spherical information of the preset polyhedral sphere includes: a first surface swept across the preset polyhedral sphere during the process of the virtual camera shooting based on a preset camera motion trajectory; determining the center position corresponding to the target model and the initial position of the virtual camera; creating a target polyhedral sphere with the same topological structure as the preset polyhedral sphere based on the center position corresponding to the target model and the initial position of the camera; determining a target surface in the target polyhedral sphere corresponding to the first surface swept across by the virtual camera based on the preset camera motion trajectory; determining the target camera motion trajectory for the virtual camera to photograph the target model based on the target surface, and controlling the virtual camera to photograph the target model based on the target camera motion trajectory.
[0006] Secondly, the present invention provides a control device for a virtual camera, the device comprising: an information acquisition module for acquiring spherical information of a target model to be photographed and a preset polyhedral sphere; wherein the spherical information of the preset polyhedral sphere includes: a first surface swept across the preset polyhedral sphere during the virtual camera's shooting process based on a preset camera motion trajectory; a position determination module for determining the center position corresponding to the target model and the initial camera position of the virtual camera; a sphere creation module for creating a target polyhedral sphere with the same topological structure as the preset polyhedral sphere based on the center position corresponding to the target model and the initial camera position; a target surface determination module for determining, within the target polyhedral sphere, a target surface corresponding to the first surface swept across by the virtual camera based on the preset camera motion trajectory; and a trajectory determination module for determining, based on the target surface, the target camera motion trajectory for the virtual camera to photograph the target model, and controlling the virtual camera to photograph the target model based on the target camera motion trajectory.
[0007] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, and the processor executing the machine-executable instructions to implement the above-described virtual camera control method.
[0008] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the above-described virtual camera control method.
[0009] The embodiments of the present invention bring the following beneficial effects:
[0010] This invention provides a virtual camera control method, device, and electronic device. First, it acquires the spherical information of a target model to be photographed and a preset polyhedral sphere. The spherical information of the preset polyhedral sphere includes: the first surface swept across the preset polyhedral sphere during the virtual camera's shooting process based on a preset camera motion trajectory; then, it determines the center position of the target model and the initial position of the virtual camera; next, based on the center position of the target model and the initial position of the camera, it creates a target polyhedral sphere with the same topological structure as the preset polyhedral sphere; within the target polyhedral sphere, it determines a target surface corresponding to the first surface swept across by the virtual camera based on the preset camera motion trajectory; then, based on the target surface, it determines the target camera motion trajectory for the virtual camera to photograph the target model and controls the virtual camera to photograph the target model based on the target camera motion trajectory. In this method, by mapping the spherical information of the preset polyhedral sphere, which matches the preset camera motion trajectory, onto the surface of the target polyhedral sphere, a target camera motion trajectory suitable for photographing the target model can be obtained. This allows the method to automatically adapt camera motion trajectories to different object models, improving the camera's shooting effect.
[0011] Other features and advantages of the invention will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.
[0012] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0013] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in 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 the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0014] Figure 1 A flowchart illustrating a virtual camera control method provided in an embodiment of the present invention;
[0015] Figure 2 This is a schematic diagram of a pre-defined polyhedral sphere provided in an embodiment of the present invention;
[0016] Figure 3 This is a schematic diagram of another preset polyhedral sphere provided in an embodiment of the present invention;
[0017] Figure 4 A schematic diagram of a first surface provided in an embodiment of the present invention;
[0018] Figure 5 This is a schematic diagram of a target polyhedral sphere provided in an embodiment of the present invention;
[0019] Figure 6 A schematic diagram of a target surface provided in an embodiment of the present invention;
[0020] Figure 7 This is a schematic diagram illustrating the calculation of displacement offset value according to an embodiment of the present invention;
[0021] Figure 8 This is a schematic diagram of the structure of a virtual camera control device provided in an embodiment of the present invention;
[0022] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0024] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0025] In game development, it's often necessary to create camera animations for certain object models while the game is running. These object models can be architectural models, character models, etc. As game content becomes increasingly rich, different players may encounter different situations within the same game scene. For example, in the same dialogue sequence, player A might encounter two short character models, while player B might encounter two character models of different heights. If only a pre-set set of camera animations is used to capture the game scene corresponding to player A and player B, it won't meet the shooting requirements, resulting in poor camera capture quality.
[0026] Therefore, during the game development process, it is necessary to fully consider all possibilities and provide a camera motion animation that can satisfy all possibilities, or use technical means to dynamically generate accurate camera animation.
[0027] Three methods are provided in the relevant technologies;
[0028] The first approach is to consider as many possibilities as possible within the game and use a single camera animation that covers most situations to showcase the performance. However, due to the complexity of the game, if a single camera animation is to cover all situations, then that camera animation must be simple enough, or the animation style will be subject to many constraints, and it may even be impossible to find a single camera animation that covers all situations.
[0029] The second method involves categorizing object models into multiple object types based on their volume within the game scene. Then, a corresponding camera animation is created for each object type. During gameplay, the appropriate camera animation is used based on the object type being photographed. The camera footage from these animations is then stitched together to obtain the final image. However, this method produces a somewhat abrupt and unnatural stitched image.
[0030] The third method is to generate camera animations simply using programmatic commands. However, camera animations generated by programmatic commands are generally quite monotonous. For example, they can only specify moving from position A to position B, or rotating by the X angle. If you want to obtain richer camera animations, the programmatic commands will become extremely complex.
[0031] To address the aforementioned issues, embodiments of the present invention provide a virtual camera control method, device, and electronic device, which can be applied to game animation production scenarios.
[0032] To facilitate understanding of the embodiments of the present invention, a virtual camera control method disclosed in the embodiments of the present invention will first be described in detail, such as... Figure 1 As shown, the method includes the following steps:
[0033] Step S102: Obtain the target model to be photographed and the sphere information of the preset polyhedral sphere; wherein, the sphere information of the preset polyhedral sphere includes: the first surface swept by the virtual camera in the preset polyhedral sphere during the shooting process based on the preset camera motion trajectory.
[0034] The target model to be photographed is the actual object model captured by the virtual camera. This target model can be a building model, a character model, a plant model, etc., and is not specifically limited here. The preset polyhedron is generated based on the camera position of the virtual camera. This preset polyhedron is a polyhedron with a topological structure and a shape similar to a sphere. The surface of the preset polyhedron contains multiple triangular faces. The higher the subdivision level of the preset polyhedron, the more triangular faces the surface of the preset polyhedron contains, which is more conducive to improving the accuracy of subsequent calculations.
[0035] The aforementioned pre-defined polyhedral sphere information records the triangular faces swept across the surface of the pre-defined polyhedral sphere by the virtual camera's viewpoint during the process of capturing the model based on the pre-defined camera motion trajectory. These swept triangular faces are designated as the first surface. In specific implementations, the sphere information also records other information related to the first surface; the specific details of this other information can be determined based on development requirements. The aforementioned pre-defined motion trajectory can also be understood as a camera motion template. Based on the camera motion template and the sphere information of the pre-defined polyhedral sphere, the target camera motion trajectory for capturing the target model can be obtained. Both the pre-defined camera motion trajectory and the target camera motion trajectory include the camera orientation of the virtual camera during the shooting process, and may also include the camera position.
[0036] Specifically, the aforementioned preset camera motion trajectory can be the motion trajectory of a virtual camera set by the user according to their needs, or it can be the motion trajectory of a virtual camera shooting the object model from a specified angle upwards, downwards, leftwards, or rightwards. It can also be the motion trajectory of the virtual camera shooting the reference model, for example, shooting the reference model from left to right or from top to bottom. The reference model can be set according to R&D needs or user requirements.
[0037] Step S104: Determine the center position of the target model and the initial position of the virtual camera.
[0038] In practical implementation, the center position corresponding to the target model can be the center of the target model's volume, the center of the target model's smallest bounding box, or a center position calculated through other methods, depending on the development requirements. The initial position of the virtual camera mentioned above is also the starting position for the virtual camera to capture images.
[0039] Step S106: Based on the center position of the target model and the initial position of the camera, create a target polyhedron with the same topological structure as the preset polyhedron.
[0040] In practice, the target polyhedron is created in the same way as the preset polyhedron, and their topological structure and texture information are identical. However, the preset polyhedron is built based on the camera's initial position and a reference model, while the target polyhedron is built based on the camera's initial position and a target model. Therefore, the size and position of the preset and target polyhedrons differ. The fact that the target and preset polyhedrons have the same topological structure can be understood as meaning they contain the same number of triangular faces, and the relative positions of these triangular faces are identical.
[0041] In one specific embodiment, since the preset polyhedral sphere is established with the initial position of the camera as its center and the distance between the initial position of the camera and the center position of the corresponding reference model as its radius, a target polyhedral sphere with the same topological structure as the preset polyhedral sphere can be established with the initial position of the camera as its center and the distance between the initial position of the camera and the center position of the corresponding target model as its radius. This method ensures that the sphere information of the preset polyhedral sphere can be mapped onto the target polyhedral sphere, facilitating subsequent calculation of the target camera's motion trajectory.
[0042] Step S108: In the target polyhedral sphere, determine the target surface corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory.
[0043] Since the target polyhedral sphere and the preset polyhedral sphere have the same topological structure and texture information, the sphere information of the preset polyhedral sphere can be mapped onto the target polyhedral sphere. Then, within the target polyhedral sphere, the target surface corresponding to the first surface scanned by the virtual camera based on the preset camera motion trajectory can be determined. Alternatively, it can be understood as restoring a surface consistent with the preset polyhedral sphere on the target polyhedral sphere based on the previously recorded sphere information, thereby obtaining the target surface corresponding to the first surface scanned by the virtual camera based on the preset camera motion trajectory on the target polyhedral sphere.
[0044] Step S110: Based on the target surface, determine the target camera motion trajectory for the virtual camera to capture the target model, and control the virtual camera to capture the target model based on the target camera motion trajectory.
[0045] In practical implementation, the target surface corresponding to the first surface swept by the virtual camera in the target polyhedral sphere based on the preset camera motion trajectory can be used to inversely calculate the target camera motion trajectory of the virtual camera for the target model, so that the target motion trajectory of the virtual camera is suitable for shooting the target model.
[0046] The present invention provides a virtual camera control method that maps the sphere information of a preset polyhedron that matches the preset camera motion trajectory onto the surface of a target polyhedron to obtain a target camera motion trajectory suitable for shooting the target model. This method can automatically adapt the camera motion trajectory to different object models, thereby improving the camera shooting effect.
[0047] The following embodiments focus on describing the method for determining the sphere information of a preset polyhedral sphere.
[0048] Specifically, the sphere information of the aforementioned preset polyhedral sphere is determined through the following steps 10-13:
[0049] Step 10: Determine the center position of the reference model and the initial position of the virtual camera.
[0050] Specifically, the aforementioned reference model can be any model, determined according to development needs. When determining the center position of the reference model, it is necessary to generate the minimum bounding box of the reference model; then, the center position of the minimum bounding box is determined as the center position of the reference model. This minimum bounding box can be the minimum bounding cube of the reference model, or the minimum bounding sphere, etc. In practical applications, the virtual camera in the software is actually a positional attribute, essentially a point; therefore, the coordinates corresponding to the initial position of the virtual camera are also the initial position of the virtual camera.
[0051] Step 11: Create a preset polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the reference model and the initial position of the camera as the radius; the surface of the preset polyhedral sphere includes multiple triangular faces.
[0052] In practical implementation, the preset polyhedron can be a regular polyhedron or a general polyhedron. A regular polyhedron has a uniform topological structure, while a general polyhedron typically has poles; the area closer to the poles is smaller, and the topology is sparser near the equator. Specifically, using a regular polyhedron as the preset polyhedron simplifies subsequent calculations and better ensures the consistency of the topological structure between the target polyhedron and the preset polyhedron.
[0053] like Figure 2 The diagram shown is a schematic diagram of a pre-defined polyhedral sphere provided in an embodiment of the present invention. Figure 2 The character models in the text are also reference models. Figure 2 The arrow in the diagram starts at the camera's initial position and points to the center of the reference model. This center position is also the center point of the reference model's minimum bounding box. The minimum bounding box of the reference model is... Figure 2 The cuboid surrounding the central reference model. Figure 2 A sphere containing multiple triangles is also known as a pre-defined polyhedral sphere.
[0054] In an optional embodiment, the subdivision level of the preset polyhedron can be adjusted to more accurately record and reconstruct the camera motion trajectory in subsequent steps. That is, increasing the subdivision level of the polyhedron allows for more precise calculation of the camera rotation angle relative to the target model using a higher number of faces. Based on this, an input operation regarding the sphere's subdivision level needs to be responded to, and the target subdivision level of the triangular faces on the surface of the preset polyhedron is determined based on the input operation. Then, based on the target subdivision level, a preset polyhedron is created with the initial camera position as its center and the distance between the center position of the reference model and the initial camera position as its radius. The number of triangular faces on the surface of the preset polyhedron matches the target subdivision level.
[0055] In practice, the input operations described above can be determined based on R&D needs. For example, it could be inputting a specific number or selecting a specific subdivision level. Specifically, the higher the target subdivision level, the more triangular faces the surface of the preset polyhedron contains. For example... Figure 3 The diagram shown is a schematic diagram of another preset polyhedral sphere provided in an embodiment of the present invention. Figure 3 and Figure 2 The comparison shows that, Figure 3 The number of triangular faces contained in the surface of the pre-defined polyhedron is greater than Figure 2 The pre-defined polyhedron in the text, that is... Figure 3 The subdivision level of the preset polyhedron in the middle is greater than Figure 2 The preset subdivision levels of the polyhedron.
[0056] Step 12: Control the virtual camera to shoot the reference model based on the preset camera motion trajectory. During the shooting process, determine the first surface that the virtual camera sweeps through among the multiple triangular faces contained in the preset polyhedral sphere.
[0057] In practical implementation, the aforementioned preset camera motion trajectory can be determined according to R&D requirements or user settings. Specifically, during the process of the virtual camera capturing the reference model based on the preset camera motion trajectory, the movement trajectory of a designated point in the virtual camera within the multiple triangular faces contained in the preset polyhedral sphere is determined (that is, the designated point in the virtual camera emits a ray, and the path swept by this ray within the preset polyhedral sphere is determined as the movement trajectory); then, the triangular faces traversed by the movement trajectory within the preset polyhedral sphere are determined as the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere. The aforementioned designated point can be any point in the virtual camera; for example, the designated point can be the center point of the virtual camera.
[0058] like Figure 4 The diagram shown is a schematic representation of a first surface provided in an embodiment of the present invention. Assuming the preset camera motion trajectory sweeps from the left to the right of the reference model, the surface of the preset polyhedral sphere whose topological structure is recorded by the midpoint of the virtual camera is as follows: Figure 4 The light gray area in the image is shown, where, Figure 4 The light gray triangle behind the reference model in the first image is the first surface swept across the preset polyhedral sphere by the virtual camera when it captures the reference model based on the preset camera motion trajectory. Figure 4 The two spherical surfaces on the right side of the middle section divide the pre-designed polyhedral sphere into two parts at the angle of the equator. Figure 4 The light gray area within the box in the last image is the first surface of the preset polyhedron.
[0059] Step 13: Save the vertex information of the first surface to the sphere information of the preset polyhedron.
[0060] In practical implementation, the vertex information mentioned above includes the vertex index or vertex position of the vertices belonging to the first surface. The first surface can be determined from the preset polyhedral sphere using the vertex information stored in the sphere information.
[0061] In an optional embodiment, to ensure the consistent vertex order of each created polyhedron, it is necessary to determine the vertex sequence number of the vertices in the preset polyhedron based on a preset vertex sequence setting rule; wherein, each triangular face in the preset polyhedron consists of three vertices. Based on this, the vertex information of the first surface can be determined as the vertex sequence number of the corresponding vertex on the first surface, and then the vertex sequence number of the corresponding vertex on the first surface is recorded and saved to the sphere information of the preset polyhedron. Specifically, the aforementioned preset vertex sequence setting rule can be determined according to R&D needs or set according to user requirements. For example, the preset vertex sequence setting rule can be to assign sequence numbers to vertices one by one, starting from the top or bottom of the polyhedron.
[0062] In one specific embodiment, the preset vertex order setting rule can be to define the vertex corresponding to the positive Y-axis (equivalent to the top) of the virtual camera as index 0 (that is, the vertex number is 0), and the surrounding points as index [1,2,3,4,5]. Then, using these 5 vertices as the center, the numbers of other directly connected points are defined sequentially, and the defined points are skipped. The rule is similar in the -Y-axis direction (equivalent to the bottom), but in order to distinguish the upper and lower halves of the polyhedron, the vertex numbers of the lower half are negative.
[0063] In another optional embodiment, during the process of the virtual camera shooting the reference model based on the preset camera motion trajectory, the dwell time of the virtual camera on the first surface contained in the preset polyhedral sphere is also recorded; the dwell time corresponding to the first surface is associated with the vertex information of the first surface and saved to the sphere information of the preset polyhedral sphere.
[0064] In practice, the virtual camera's dwell time on each first surface during shooting may be the same or different, depending on the preset camera motion trajectory. To record and reconstruct the rotation rate of the camera's motion trajectory in the time dimension, it is necessary to record the virtual camera's dwell time on each first surface. For example, within the range of [0-10] frames, the virtual camera's motion trajectory is always on first surface A, while within the range of [10-30] frames, the virtual camera's motion trajectory is always within the range of multiple surfaces B. This method helps to correctly reconstruct the sphere information subsequently.
[0065] The following examples focus on how to create a target polyhedral sphere and how to determine the target surface within the target polyhedral sphere.
[0066] Specifically, the aforementioned sphere information includes the target subdivision level of the triangular faces on the surface of the preset polyhedral sphere; the specific process of creating a target polyhedral sphere with the same topological structure as the preset polyhedral sphere based on the center position corresponding to the target model and the initial position of the camera may include: creating a target polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the target model and the initial position of the camera as the radius, based on the target subdivision level corresponding to the preset polyhedral sphere; wherein, the number of triangular faces contained on the surface of the target polyhedral sphere matches the target subdivision level, that is, the topological structure of the target polyhedral sphere is the same as the topological structure of the preset polyhedral sphere.
[0067] In practical implementation, it is necessary to obtain the position and volume of the target model, and then determine the minimum bounding box of the target model based on its position and volume. The position of the midpoint of the minimum bounding box of the target model is then determined as the center position of the target model. This minimum bounding box can be the minimum circumscribed cube of the target model, or it can be the minimum circumscribed sphere, etc.
[0068] The method for creating the target polyhedron is the same as that for creating the preset polyhedron, because it yields a target polyhedron with the same topological structure as the preset polyhedron. For example... Figure 5 The diagram shown is a schematic representation of a target polyhedral sphere provided in an embodiment of the present invention. Figure 5 The object model in the model is also the target model. Figure 5 The arrow in the diagram starts at the camera's initial position and points to the center of the target model. This center position is also the center point of the target model's minimum bounding box. The target model's minimum bounding box is... Figure 5 The cuboid surrounding the target model. Figure 5 A sphere containing multiple triangles is also known as a target polyhedron, and the subdivision level of the target polyhedron is the same as that of the preset polyhedron.
[0069] In an optional embodiment, if the user does not want to generate the target camera motion trajectory of the target model based on the preset camera motion trajectory, they only need to rotate the target polyhedron in a certain axis.
[0070] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere includes: the vertex indices of the vertices corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory (equivalent to the vertex information of the first surface); the vertex indices of the vertices in the target polyhedral sphere are the same as the vertex indices of the corresponding vertices in the preset polyhedral sphere. Based on this, the specific process of determining the target surface corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory in the target polyhedral sphere may include: determining the target surface corresponding to the first surface in the target polyhedral sphere according to the vertex indices of the vertices corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory.
[0071] Since the target polyhedron has the same topological structure and vertex order information as the preset polyhedron, the target surface that is consistent with the first surface can be restored on the target polyhedron based on the vertex information of the first surface recorded in the sphere information of the preset polyhedron.
[0072] like Figure 6 The diagram shown is a schematic representation of a target surface provided in an embodiment of the present invention. Figure 6 The light gray area in the image represents the target surface of the multifaceted sphere. Figure 6 The light gray triangle behind the target model in the first image is the target surface within the polyhedral sphere. Figure 6 The two spherical surfaces on the right side of the center divide the polyhedral sphere into two parts at the angle of the equator. Figure 6 The light gray area within the box in the last image is the target surface within the target polyhedron.
[0073] The above method utilizes the property that the surface topology of a polyhedron has equal area, and under controllable precision, it can accurately record and calculate the camera motion trajectory when shooting the target model.
[0074] The following examples focus on describing how to determine the motion trajectory of the target camera.
[0075] Specifically, the aforementioned target camera motion trajectory includes the camera orientation; the specific process of determining the target camera motion trajectory for capturing the target model using a virtual camera based on the target surface may include: determining the center point of the target surface and pointing the virtual camera orientation toward the center point of the target surface; and determining the camera orientation during the process of capturing the target model using a virtual camera based on the direction of the virtual camera orientation on each target surface.
[0076] In practical implementation, the center point of the target surface needs to be used as the camera target point, which is also the position that the virtual camera is pointing towards. Obtaining the center point of each target surface means obtaining the position that the virtual camera is pointing towards on each target surface. According to the preset time sequence of the camera's motion trajectory passing through each first surface, the time sequence of the virtual camera passing through each target surface can be determined. By sorting the center points of the target surfaces according to the time sequence, the camera orientation during the process of the virtual camera shooting the target model can be obtained.
[0077] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere includes: the dwell time of the virtual camera on the first surface of the preset polyhedral sphere when it photographs the reference model based on the preset camera motion trajectory; the specific process of determining the camera orientation during the virtual camera's photographing of the target model may further include: determining the dwell time of the target surface corresponding to the first surface based on the dwell time corresponding to the first surface; for each target surface, determining the orientation change rate of the virtual camera's camera orientation from the direction of the current target surface to the direction of the next target surface based on the dwell time corresponding to the current target surface; and determining the camera orientation during the virtual camera's photographing of the target model based on the orientation change rate and the direction of the virtual camera's camera orientation on each target surface.
[0078] In practical implementation, the method for determining the orientation change rate can be determined according to the research and development needs. For example, the distance between the center point of the current target surface and the center point of the next target surface can be divided by the dwell time corresponding to the current target surface. The result of the division can then be determined as the orientation change rate of the virtual camera as it changes from pointing to the current target surface to pointing to the next target surface. Alternatively, the orientation change rate can be set according to the dwell time.
[0079] For example, after obtaining the pointing angle of the virtual camera (which is equivalent to the angle at which the virtual camera points towards the center point of the target surface), the dwell time is recorded in the sphere information, and the value of the center point of the two target surfaces is calculated using the difference. For example, if the position coordinates of the center points of target surface A and target surface B are [1,1] and [2,2] respectively, then the difference is [1.5,1.5]. The time range (equivalent to the dwell time) of target surface A is [0,10] frames, and the time range of target surface B is [10,30] frames. Therefore, the number of frames from the center point of target surface A to the difference point of the center point of target surface AB is 10 frames, and so on.
[0080] In an optional embodiment, the target camera motion trajectory also includes the camera position; the preset camera motion trajectory includes the camera position during the process of the virtual camera shooting the reference model; after determining the camera orientation during the process of the virtual camera shooting the target model, it is also necessary to determine the displacement offset value between the center position corresponding to the target model and the center position corresponding to the reference model; the displacement offset value and the camera position during the process of the virtual camera shooting the reference model are used to obtain the camera position during the process of the virtual camera shooting the target model.
[0081] In practical implementation, the distance between the center position of the target model and the center position of the reference model can be determined as the displacement offset value. For example... Figure 7 The diagram shown is a schematic diagram of a displacement offset value calculation provided by an embodiment of the present invention. Figure 7 The circle at the beginning of the diagram represents the center position of the reference model, and the circle pointed to by the arrow represents the center position of the target model. The distance between the two center positions is defined as the displacement offset value.
[0082] It should be noted that the calculation of camera orientation and camera position in the target camera motion trajectory in this invention are independent of each other and do not affect each other. By combining the camera position and camera orientation during the virtual camera's capture of the target model, the final target camera motion trajectory for capturing the target model can be obtained.
[0083] This method, by recording a set of two-dimensional data (equivalent to sphere information) and performing a camera reverse engineering process, can adapt a preset camera motion trajectory to the target camera motion trajectory of a new volume target model, thus improving the efficiency of obtaining a camera motion trajectory adapted to the target model. Simultaneously, this method can flexibly fuse the preset camera motion trajectory and the target camera motion trajectory, thereby controlling the degree and timing of the camera's orientation towards the target model, and can improve the subdivision of the topology to obtain more accurate camera orientation results.
[0084] In addition, the present invention is versatile, that is, the method of generating the topology structure and the camera target inverse algorithm in the present invention can be used in game runtime as well as in offline production processes.
[0085] Corresponding to the above method embodiments, this invention provides a control device for a virtual camera, such as... Figure 8 As shown, the device includes:
[0086] The information acquisition module 80 is used to acquire the target model to be photographed and the sphere information of the preset polyhedral sphere; wherein, the sphere information of the preset polyhedral sphere includes: the first surface swept by the virtual camera in the preset polyhedral sphere during the shooting process based on the preset camera motion trajectory;
[0087] The position determination module 81 is used to determine the center position of the target model and the initial position of the virtual camera.
[0088] The sphere creation module 82 is used to create a target polyhedron with the same topological structure as the preset polyhedron, based on the center position of the target model and the initial position of the camera.
[0089] The target surface determination module 83 is used to determine the target surface in the target multifaceted sphere that corresponds to the first surface swept by the virtual camera based on the preset camera motion trajectory;
[0090] The trajectory determination module 84 is used to determine the target camera motion trajectory for the virtual camera to capture the target model based on the target surface, and to control the virtual camera to capture the target model based on the target camera motion trajectory.
[0091] In the aforementioned virtual camera control device, by mapping the sphere information of a preset polyhedron that matches the preset camera motion trajectory onto the surface of the target polyhedron, a target camera motion trajectory suitable for shooting the target model can be obtained. This method enables the camera motion trajectory to automatically adapt to different object models, thereby improving the camera shooting effect.
[0092] Specifically, the aforementioned device further includes an information determination module, comprising: a position determination unit for determining the center position of the reference model and the initial position of the virtual camera; a sphere creation unit for creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius; the surface of the preset polyhedral sphere includes multiple triangular faces; a first face determination unit for controlling the virtual camera to photograph the reference model based on a preset camera motion trajectory, and during the photographing process, determining the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere; and an information storage unit for storing the vertex information of the first surface into the sphere information of the preset polyhedral sphere.
[0093] Furthermore, the aforementioned position determination unit is used to: generate the minimum bounding box of the reference model; and determine the center position of the minimum bounding box of the reference model as the center position corresponding to the reference model.
[0094] In a specific implementation, the aforementioned device further includes a subdivision module, configured to: before creating a preset polyhedral sphere with the initial camera position as its center and the distance between the center position of the reference model and the initial camera position as its radius, respond to an input operation regarding the subdivision level of the sphere, and determine the target subdivision level of the triangular faces of the surface of the preset polyhedral sphere based on the input operation. Accordingly, the aforementioned sphere creation unit is configured to: create a preset polyhedral sphere with the initial camera position as its center and the distance between the center position of the reference model and the initial camera position as its radius, based on the target subdivision level; wherein the number of triangular faces contained on the surface of the preset polyhedral sphere matches the target subdivision level.
[0095] Furthermore, the aforementioned first surface determination unit is used to: determine the movement trajectory of a designated point in the virtual camera within the multiple triangular faces contained in the preset polyhedral sphere during the process of the virtual camera shooting the reference model based on the preset camera motion trajectory; and determine the triangular faces traversed by the movement trajectory within the preset polyhedral sphere as the first surface swept by the virtual camera within the multiple triangular faces contained in the preset polyhedral sphere.
[0096] Furthermore, the above-mentioned device also includes a vertex information storage module, used for: determining the vertex number of the vertices in the preset polyhedron based on a preset vertex order setting rule; wherein, the triangular face in the preset polyhedron is composed of three vertices; the step of saving the vertex information of the first surface to the sphere information of the preset polyhedron includes: recording the vertex number of the vertex corresponding to the first surface, and saving the recording result to the sphere information of the preset polyhedron.
[0097] In a specific implementation, the above device also includes a time information storage module, used to: record the dwell time of the virtual camera on the first surface contained in the preset polyhedral sphere during the process of the virtual camera shooting the reference model based on the preset camera motion trajectory; and associate the dwell time corresponding to the first surface with the vertex information of the first surface and save it to the sphere information of the preset polyhedral sphere.
[0098] Furthermore, the aforementioned sphere information includes the target subdivision level of the triangular faces of the surface of the preset polyhedral sphere; the aforementioned sphere creation module 82 is used to: create a target polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the target model and the initial position of the camera as the radius, based on the target subdivision level corresponding to the preset polyhedral sphere; wherein, the number of triangular faces contained on the surface of the target polyhedral sphere matches the target subdivision level.
[0099] In a specific implementation, the sphere information of the aforementioned preset polyhedral sphere includes: the vertex number of the vertex corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory; the vertex number of the vertex in the target polyhedral sphere is the same as the vertex number of the vertex corresponding to the position in the preset polyhedral sphere; the aforementioned target surface determination module 83 is used to: determine the target surface corresponding to the first surface in the target polyhedral sphere based on the vertex number of the vertex corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory.
[0100] Furthermore, the aforementioned target camera motion trajectory includes the camera orientation; the aforementioned trajectory determination module 84 is used to: determine the center point of the target surface, and point the virtual camera orientation toward the center point of the target surface; based on the direction of the virtual camera orientation on each target surface, determine the camera orientation during the process of the virtual camera shooting the target model.
[0101] In a specific implementation, the sphere information of the aforementioned preset polyhedral sphere includes: the dwell time of the virtual camera on the first surface of the preset polyhedral sphere when shooting the reference model based on the preset camera motion trajectory; the trajectory determination module 84 is further configured to: determine the dwell time of the target surface corresponding to the first surface based on the dwell time of the first surface; for each target surface, determine the orientation change rate of the virtual camera's orientation from the direction of the current target surface to the direction of the next target surface based on the dwell time of the current target surface; and determine the camera orientation of the virtual camera during the process of shooting the target model based on the orientation change rate and the direction of the virtual camera's orientation on each target surface.
[0102] Furthermore, the aforementioned target camera motion trajectory also includes the camera position; the preset camera motion trajectory includes the camera position during the process of the virtual camera shooting the reference model; the aforementioned trajectory determination module 84 is also used to: after determining the camera orientation during the process of the virtual camera shooting the target model based on the orientation change rate and the direction of the virtual camera's camera orientation on each target surface, determine the displacement offset value between the center position corresponding to the target model and the center position corresponding to the reference model; multiply the displacement offset value by the camera position during the process of the virtual camera shooting the reference model to obtain the camera position during the process of the virtual camera shooting the target model.
[0103] The virtual camera control device provided in this disclosure has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.
[0104] This invention also provides an electronic device, such as... Figure 9As shown, the electronic device includes a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, which executes the machine-executable instructions to implement the virtual camera control method described above.
[0105] Specifically, the aforementioned virtual camera control method includes: acquiring the sphere information of the target model to be photographed and a preset polyhedral sphere; wherein, the sphere information of the preset polyhedral sphere includes: the first surface swept by the virtual camera in the preset polyhedral sphere during the shooting process based on the preset camera motion trajectory; determining the center position corresponding to the target model and the initial position of the virtual camera; creating a target polyhedral sphere with the same topological structure as the preset polyhedral sphere based on the center position corresponding to the target model and the initial position of the camera; determining the target surface in the target polyhedral sphere corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory; determining the target camera motion trajectory for the virtual camera to photograph the target model based on the target surface, and controlling the virtual camera to photograph the target model based on the target camera motion trajectory.
[0106] In the above-mentioned virtual camera control method, by mapping the sphere information of a preset polyhedron that matches the preset camera motion trajectory onto the surface of the target polyhedron, a target camera motion trajectory suitable for shooting the target model can be obtained. This method can automatically adapt the camera motion trajectory to different object models, thereby improving the camera shooting effect.
[0107] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere is determined in the following manner: determining the center position of the reference model and the initial position of the virtual camera; creating a preset polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the reference model and the initial position of the camera as the radius; the surface of the preset polyhedral sphere includes multiple triangular faces; controlling the virtual camera to photograph the reference model based on the preset camera motion trajectory, and during the photographing process, determining the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere; and saving the vertex information of the first surface into the sphere information of the preset polyhedral sphere.
[0108] In an optional embodiment, the step of determining the center position corresponding to the reference model includes: generating the minimum bounding box of the reference model; and determining the center position of the minimum bounding box of the reference model as the center position corresponding to the reference model.
[0109] In an optional embodiment, before the step of creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius, the method further includes: responding to an input operation for a subdivision level of the sphere, and determining a target subdivision level for the triangular faces of the surface of the preset polyhedral sphere based on the input operation; the step of creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius includes: creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius based on the target subdivision level; wherein the number of triangular faces contained on the surface of the preset polyhedral sphere matches the target subdivision level.
[0110] In an optional embodiment, the step of determining the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere during the shooting process includes: determining the movement trajectory of a designated point in the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere during the process of the virtual camera shooting the reference model based on the preset camera motion trajectory; and determining the triangular faces passed by the movement trajectory in the preset polyhedral sphere as the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere.
[0111] In an optional embodiment, the above method further includes: determining the vertex number of the vertices in the preset polyhedron based on a preset vertex order setting rule; wherein the triangular face in the preset polyhedron is composed of three vertices; the step of saving the vertex information of the first surface to the sphere information of the preset polyhedron includes: recording the vertex number of the vertex corresponding to the first surface, and saving the recording result to the sphere information of the preset polyhedron.
[0112] In an optional embodiment, the method further includes: during the process of the virtual camera shooting the reference model based on a preset camera motion trajectory, recording the dwell time of the virtual camera on the first surface contained in the preset polyhedral sphere; and associating the dwell time corresponding to the first surface with the vertex information of the first surface and saving it to the sphere information of the preset polyhedral sphere.
[0113] In an optional embodiment, the above-mentioned sphere information includes the target subdivision level of the triangular faces of the surface of the preset polyhedral sphere; the step of creating a target polyhedral sphere with the same topological structure as the preset polyhedral sphere based on the center position corresponding to the target model and the initial position of the camera includes: creating a target polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the target model and the initial position of the camera as the radius, based on the target subdivision level corresponding to the preset polyhedral sphere; wherein, the number of triangular faces contained on the surface of the target polyhedral sphere matches the target subdivision level.
[0114] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere includes: the vertex number of the vertex corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory; the vertex number of the vertex in the target polyhedral sphere is the same as the vertex number of the corresponding vertex in the preset polyhedral sphere; the step of determining the target surface corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory in the target polyhedral sphere includes: determining the target surface corresponding to the first surface in the target polyhedral sphere according to the vertex number of the vertex corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory.
[0115] In an optional embodiment, the target camera motion trajectory includes the camera orientation; the step of determining the target camera motion trajectory of the virtual camera capturing the target model based on the target surface includes: determining the center point of the target surface, pointing the virtual camera orientation toward the center point of the target surface; and determining the camera orientation during the virtual camera capturing the target model based on the direction of the virtual camera orientation on each target surface.
[0116] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere includes: the dwell time of the virtual camera on the first surface of the preset polyhedral sphere when shooting the reference model based on the preset camera motion trajectory; the step of determining the camera orientation during the virtual camera shooting the target model based on the direction of the virtual camera on each target surface includes: determining the dwell time corresponding to the target surface corresponding to the first surface based on the dwell time corresponding to the first surface; for each target surface, determining the orientation change rate of the virtual camera's camera orientation from the direction of the current target surface to the direction of the next target surface based on the dwell time corresponding to the current target surface; and determining the camera orientation during the virtual camera shooting the target model based on the orientation change rate and the direction of the virtual camera's camera orientation on each target surface.
[0117] In an optional embodiment, the target camera motion trajectory further includes the camera position; the preset camera motion trajectory includes the camera position during the process of the virtual camera shooting the reference model; after the step of determining the camera orientation during the process of the virtual camera shooting the target model based on the orientation change rate and the direction of the virtual camera's orientation on each target surface, the method further includes: determining the displacement offset value between the center position corresponding to the target model and the center position corresponding to the reference model; multiplying the displacement offset value by the camera position during the process of the virtual camera shooting the reference model to obtain the camera position during the process of the virtual camera shooting the target model.
[0118] Furthermore, Figure 9 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 101, the communication interface 103 and the memory 100 connected via the bus 102.
[0119] The memory 100 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0120] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. Processor 101 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 100, and processor 101 reads information from memory 100 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0121] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the aforementioned virtual camera control method. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0122] Specifically, the aforementioned virtual camera control method includes: acquiring the sphere information of the target model to be photographed and a preset polyhedral sphere; wherein, the sphere information of the preset polyhedral sphere includes: the first surface swept by the virtual camera in the preset polyhedral sphere during the shooting process based on the preset camera motion trajectory; determining the center position corresponding to the target model and the initial position of the virtual camera; creating a target polyhedral sphere with the same topological structure as the preset polyhedral sphere based on the center position corresponding to the target model and the initial position of the camera; determining the target surface in the target polyhedral sphere corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory; determining the target camera motion trajectory for the virtual camera to photograph the target model based on the target surface, and controlling the virtual camera to photograph the target model based on the target camera motion trajectory.
[0123] In the above-mentioned virtual camera control method, by mapping the sphere information of a preset polyhedron that matches the preset camera motion trajectory onto the surface of the target polyhedron, a target camera motion trajectory suitable for shooting the target model can be obtained. This method can automatically adapt the camera motion trajectory to different object models, thereby improving the camera shooting effect.
[0124] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere is determined in the following manner: determining the center position of the reference model and the initial position of the virtual camera; creating a preset polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the reference model and the initial position of the camera as the radius; the surface of the preset polyhedral sphere includes multiple triangular faces; controlling the virtual camera to photograph the reference model based on the preset camera motion trajectory, and during the photographing process, determining the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere; and saving the vertex information of the first surface into the sphere information of the preset polyhedral sphere.
[0125] In an optional embodiment, the step of determining the center position corresponding to the reference model includes: generating the minimum bounding box of the reference model; and determining the center position of the minimum bounding box of the reference model as the center position corresponding to the reference model.
[0126] In an optional embodiment, before the step of creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius, the method further includes: responding to an input operation for a subdivision level of the sphere, and determining a target subdivision level for the triangular faces of the surface of the preset polyhedral sphere based on the input operation; the step of creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius includes: creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius based on the target subdivision level; wherein the number of triangular faces contained on the surface of the preset polyhedral sphere matches the target subdivision level.
[0127] In an optional embodiment, the step of determining the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere during the shooting process includes: determining the movement trajectory of a designated point in the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere during the process of the virtual camera shooting the reference model based on the preset camera motion trajectory; and determining the triangular faces passed by the movement trajectory in the preset polyhedral sphere as the first surface swept by the virtual camera among the multiple triangular faces contained in the preset polyhedral sphere.
[0128] In an optional embodiment, the above method further includes: determining the vertex number of the vertices in the preset polyhedron based on a preset vertex order setting rule; wherein the triangular face in the preset polyhedron is composed of three vertices; the step of saving the vertex information of the first surface to the sphere information of the preset polyhedron includes: recording the vertex number of the vertex corresponding to the first surface, and saving the recording result to the sphere information of the preset polyhedron.
[0129] In an optional embodiment, the method further includes: during the process of the virtual camera shooting the reference model based on a preset camera motion trajectory, recording the dwell time of the virtual camera on the first surface contained in the preset polyhedral sphere; and associating the dwell time corresponding to the first surface with the vertex information of the first surface and saving it to the sphere information of the preset polyhedral sphere.
[0130] In an optional embodiment, the above-mentioned sphere information includes the target subdivision level of the triangular faces of the surface of the preset polyhedral sphere; the step of creating a target polyhedral sphere with the same topological structure as the preset polyhedral sphere based on the center position corresponding to the target model and the initial position of the camera includes: creating a target polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the target model and the initial position of the camera as the radius, based on the target subdivision level corresponding to the preset polyhedral sphere; wherein, the number of triangular faces contained on the surface of the target polyhedral sphere matches the target subdivision level.
[0131] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere includes: the vertex number of the vertex corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory; the vertex number of the vertex in the target polyhedral sphere is the same as the vertex number of the corresponding vertex in the preset polyhedral sphere; the step of determining the target surface corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory in the target polyhedral sphere includes: determining the target surface corresponding to the first surface in the target polyhedral sphere according to the vertex number of the vertex corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory.
[0132] In an optional embodiment, the target camera motion trajectory includes the camera orientation; the step of determining the target camera motion trajectory of the virtual camera capturing the target model based on the target surface includes: determining the center point of the target surface, pointing the virtual camera orientation toward the center point of the target surface; and determining the camera orientation during the virtual camera capturing the target model based on the direction of the virtual camera orientation on each target surface.
[0133] In an optional embodiment, the sphere information of the aforementioned preset polyhedral sphere includes: the dwell time of the virtual camera on the first surface of the preset polyhedral sphere when shooting the reference model based on the preset camera motion trajectory; the step of determining the camera orientation during the virtual camera shooting the target model based on the direction of the virtual camera on each target surface includes: determining the dwell time corresponding to the target surface corresponding to the first surface based on the dwell time corresponding to the first surface; for each target surface, determining the orientation change rate of the virtual camera's camera orientation from the direction of the current target surface to the direction of the next target surface based on the dwell time corresponding to the current target surface; and determining the camera orientation during the virtual camera shooting the target model based on the orientation change rate and the direction of the virtual camera's camera orientation on each target surface.
[0134] In an optional embodiment, the target camera motion trajectory further includes the camera position; the preset camera motion trajectory includes the camera position during the process of the virtual camera shooting the reference model; after the step of determining the camera orientation during the process of the virtual camera shooting the target model based on the orientation change rate and the direction of the virtual camera's orientation on each target surface, the method further includes: determining the displacement offset value between the center position corresponding to the target model and the center position corresponding to the reference model; multiplying the displacement offset value by the camera position during the process of the virtual camera shooting the reference model to obtain the camera position during the process of the virtual camera shooting the target model.
[0135] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal device, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0136] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0137] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for controlling a virtual camera, characterized in that, The method includes: Acquire the spherical information of the target model to be photographed and the preset polyhedral sphere; wherein, the spherical information of the preset polyhedral sphere includes: the first surface swept by the virtual camera in the preset polyhedral sphere during the shooting process based on the preset camera motion trajectory; Determine the center position of the target model and the initial position of the virtual camera; Based on the center position of the target model and the initial position of the camera, a target polyhedron with the same topological structure as the preset polyhedron is created. Within the target polyhedral sphere, a target surface corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory is determined; Based on the target surface, determine the target camera motion trajectory for the virtual camera to capture the target model, and control the virtual camera to capture the target model based on the target camera motion trajectory; The sphere information of the preset polyhedral sphere is determined in the following manner: determining the center position of the reference model and the initial position of the virtual camera; creating a preset polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the reference model and the initial position of the camera as the radius; the surface of the preset polyhedral sphere includes multiple triangular faces; controlling the virtual camera to photograph the reference model based on the preset camera motion trajectory, and during the photographing process, determining the first surface swept by the virtual camera among the multiple triangular faces included in the preset polyhedral sphere; and saving the vertex information of the first surface into the sphere information of the preset polyhedral sphere.
2. The method according to claim 1, characterized in that, The step of determining the center position corresponding to the reference model includes: Generate the minimum bounding box of the reference model; The center position of the minimum bounding box of the reference model is determined as the center position of the reference model.
3. The method according to claim 1, characterized in that, Before the step of creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius, the method further includes: In response to an input operation targeting a sphere subdivision level, a target subdivision level for the triangular facets of the surface of the preset polyhedral sphere is determined based on the input operation; The step of creating a preset polyhedral sphere with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius includes: Based on the target subdivision level, a preset polyhedral sphere is created with the initial position of the camera as its center and the distance between the center position of the reference model and the initial position of the camera as its radius; wherein the number of triangular faces contained on the surface of the preset polyhedral sphere matches the target subdivision level.
4. The method according to claim 1, characterized in that, The step of determining the first surface swept by the virtual camera among the plurality of triangular faces contained in the preset polyhedral sphere during the shooting process includes: During the process of the virtual camera capturing the reference model based on the preset camera motion trajectory, the movement trajectory of a designated point in the virtual camera within the plurality of triangular faces contained in the preset polyhedral sphere is determined. The triangular facets traversed by the movement trajectory within the preset polyhedral sphere are determined as the first surface swept by the virtual camera among the plurality of triangular facets contained in the preset polyhedral sphere.
5. The method according to claim 1, characterized in that, The method further includes: Based on a preset vertex order setting rule, the vertex number of the vertices in the preset polyhedron is determined; wherein, the triangular face of the preset polyhedron is composed of three vertices; The step of saving the vertex information of the first surface to the sphere information of the preset polyhedron includes: recording the vertex number of the vertex corresponding to the first surface, and saving the recording result to the sphere information of the preset polyhedron.
6. The method according to claim 1, characterized in that, The method further includes: During the process of the virtual camera capturing the reference model based on the preset camera motion trajectory, the dwell time of the virtual camera on the first surface contained in the preset polyhedral sphere is recorded; The dwell time corresponding to the first surface is associated with the vertex information of the first surface and saved to the sphere information of the preset polyhedron.
7. The method according to claim 1, characterized in that, The sphere information includes the target subdivision level of the triangular facets of the surface of the preset polyhedral sphere; The step of creating a target polyhedron with the same topological structure as the preset polyhedron based on the center position of the target model and the initial position of the camera includes: Based on the target subdivision level corresponding to the preset polyhedral sphere, a target polyhedral sphere is created with the initial position of the camera as the center and the distance between the center position of the target model and the initial position of the camera as the radius; wherein, the number of triangular faces contained on the surface of the target polyhedral sphere matches the target subdivision level.
8. The method according to claim 1, characterized in that, The sphere information of the preset polyhedron includes: the vertex number of the vertex corresponding to the first surface swept by the virtual camera based on the motion trajectory of the preset camera; the vertex numbers of the vertices in the target polyhedron are the same as the vertices corresponding to the positions in the preset polyhedron; The step of determining the target surface in the target polyhedral sphere that corresponds to the first surface swept by the virtual camera based on the preset camera motion trajectory includes: Based on the vertex number of the vertex corresponding to the first surface swept by the virtual camera according to the preset camera motion trajectory, the target surface corresponding to the first surface is determined in the target polyhedron.
9. The method according to claim 1, characterized in that, The target camera's motion trajectory includes the camera's orientation; The step of determining the target camera motion trajectory of the virtual camera capturing the target model based on the target surface includes: Determine the center point of the target surface, and orient the virtual camera toward the center point of the target surface; The camera orientation of the virtual camera during the process of photographing the target model is determined based on the direction of the camera orientation of the virtual camera on each target surface.
10. The method according to claim 9, characterized in that, The sphere information of the preset polyhedral sphere includes: the dwell time of the virtual camera on the first surface of the preset polyhedral sphere when the virtual camera takes pictures of the reference model based on the preset camera motion trajectory; The step of determining the camera orientation during the process of the virtual camera capturing the target model based on the camera orientation of the virtual camera on each target surface includes: Based on the dwell time corresponding to the first surface, determine the dwell time corresponding to the target surface corresponding to the first surface; For each target surface, based on the dwell time corresponding to the current target surface, determine the rate of change of the virtual camera's orientation from the direction of the current target surface to the direction of the next target surface; Based on the rate of change of orientation and the direction of the virtual camera on each target surface, the camera orientation during the process of the virtual camera capturing the target model is determined.
11. The method according to claim 10, characterized in that, The target camera motion trajectory also includes the camera position; the preset camera motion trajectory includes the camera position during the process of the virtual camera shooting the reference model; After the step of determining the camera orientation during the process of the virtual camera capturing the target model based on the orientation change rate and the direction of the virtual camera's camera orientation on each target surface, the method further includes: Determine the displacement offset between the center position of the target model and the center position of the reference model; The displacement offset value is multiplied by the camera position during the process of the virtual camera capturing the reference model to obtain the camera position during the process of the virtual camera capturing the target model.
12. A control device for a virtual camera, characterized in that, The device includes: The information acquisition module is used to acquire the spherical information of the target model to be photographed and the preset polyhedral sphere; wherein, the spherical information of the preset polyhedral sphere includes: the first surface swept by the virtual camera in the preset polyhedral sphere during the shooting process based on the preset camera motion trajectory; The position determination module is used to determine the center position of the target model and the initial position of the virtual camera; The sphere creation module is used to create a target polyhedron with the same topological structure as the preset polyhedron, based on the center position corresponding to the target model and the initial position of the camera. The target surface determination module is used to determine, within the target multifaceted sphere, a target surface corresponding to the first surface swept by the virtual camera based on the preset camera motion trajectory; The trajectory determination module is used to determine the target camera motion trajectory for the virtual camera to capture the target model based on the target surface, and to control the virtual camera to capture the target model based on the target camera motion trajectory; The sphere information of the preset polyhedral sphere is determined in the following manner: determining the center position of the reference model and the initial position of the virtual camera; creating a preset polyhedral sphere with the initial position of the camera as the center and the distance between the center position of the reference model and the initial position of the camera as the radius; the surface of the preset polyhedral sphere includes multiple triangular faces; controlling the virtual camera to photograph the reference model based on the preset camera motion trajectory, and during the photographing process, determining the first surface swept by the virtual camera among the multiple triangular faces included in the preset polyhedral sphere; and saving the vertex information of the first surface into the sphere information of the preset polyhedral sphere.
13. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the virtual camera control method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the virtual camera control method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Virtual camera control method and device and computer equipment
CN113908543A
Virtual camera control method and device, electronic equipment and storage medium
CN114681918A