A control method and system for camera to follow the movement and roaming of a three-dimensional model
By using model follow-up and roaming plug-ins and visual interfaces in three-dimensional scenes, efficient, accurate, real-time and flexible control of the camera moving and roaming with the three-dimensional model is achieved, and the problems of high costs, long cycles and high thresholds in the existing technology are solved.
Patent Information
- Application Number
- CN202410089926.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-23
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-01-23
AI Technical Summary
In the prior art, the control cost of moving and roaming with the three-dimensional model of cameras is high, the cycle is long, and the threshold for development and use is high, making it difficult to achieve efficient, accurate, real-time and flexible control.
The dynamic link library written in code and settable attributes provide model follow-up and roaming plug-ins. Combined with the visual interface, project participants can flexibly set the settable attributes of the camera moving and roaming with the three-dimensional model, and call the plug-in to achieve efficient, accurate, real-time and flexible control of the camera.
It reduces project costs, shortens project development cycle, improves the real-time, accuracy and flexibility of the camera's movement and roaming control along with the three-dimensional model, and improves the camera's follow-up and surround effect of the three-dimensional model.
Smart Images

Figure CN118097073B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of three-dimensional scene construction and presentation, and more specifically, to a control method and system for a camera to move and roam following a three-dimensional model. Background Art
[0002] In 3D scenes, it is a common requirement to implement model following and roaming functions. However, since each model has different sizes, shapes and movement modes, it is impossible to use a unified parameter setting. Therefore, it is usually necessary for R&D engineers to perform coding customization development based on project requirements and model properties, and then the coding is tested by test engineers and accepted by project managers. This customized development model requires a lot of manpower and time, with high costs and long construction periods, making it difficult to meet the rapidly growing demand and causing competitive disadvantages.
[0003] In order to meet this challenge, some companies are currently exploring more flexible technical solutions, such as introducing visual editing tools and interactive interfaces, so that project managers and implementation engineers can more intuitively participate in the development and adjustment of model following and roaming functions. This approach reduces the dependence on development engineers to a certain extent, improves team collaboration efficiency, and better meets project needs. Alternatively, some companies are studying the use of machine learning and artificial intelligence technologies to achieve automatic learning and adjustment of model behavior, in order to further improve the efficiency and flexibility of 3D scene development. However, with the growing demand for 3D scene development, these existing technical solutions have failed to achieve efficient and flexible control of the camera following the movement and roaming of the 3D model, and the project cost and cycle are difficult to be effectively controlled. The threshold for use is still high, making it an important issue facing the current industry to find a more efficient and flexible control method for the camera to follow the movement and roaming of the 3D model, as well as a development method.
[0004] To sum up, it can be seen that for the control of the camera following the movement and roaming of the three-dimensional model, the existing technology still needs the participation of multiple personnel such as R&D engineers, test engineers and project managers to realize the customized development of model following and roaming functions, resulting in high costs, long cycles and inability to respond quickly; the development and use thresholds are high, and other positions except R&D engineers are not competent. When the company carries out multiple projects at the same time, due to the high demand for personnel, it is easy to cause the problem of insufficient personnel.
[0005] Based on this, it is necessary to introduce a new method and system, which provides a model following and roaming plug-in that can meet various project needs through a dynamic link library written in code and configurable properties, and allows project participants to flexibly set the configurable properties of the camera following the movement and roaming of the three-dimensional model according to their needs through a visual interface, and call the model following and roaming plug-in to quickly complete the efficient, accurate, real-time and flexible control of the camera following the movement and roaming of the three-dimensional model, so as to solve the technical problems of high project cost, long cycle, high development and use threshold in the existing technology, thereby reducing project costs, shortening project development cycles, and improving the real-time, accuracy and flexibility of the camera following the movement and roaming of the three-dimensional model, as well as the camera's following and surround effects on the three-dimensional model. Summary of the invention
[0006] In response to the technical problems mentioned above, the present invention provides a control method and system for a camera to follow the movement and roaming of a three-dimensional model. A model following and roaming plug-in that can meet various project requirements is provided through a dynamic link library written in code and configurable properties. At the same time, a visual interface is used to allow project participants to flexibly set the configurable properties of the camera following the movement and roaming of the three-dimensional model as required, and call the model following and roaming plug-in to quickly complete the efficient, accurate, real-time and flexible control of the camera following the movement and roaming of the three-dimensional model, so as to solve the technical problems existing in the prior art, such as high project cost, long cycle, and high development and use thresholds.
[0007] The present invention provides a control method for a camera to follow a three-dimensional model to move and roam. The method comprises: S1, prefabricating a model following and roaming plug-in: prefabricating a model following and roaming plug-in according to the logic processing of the three-dimensional model following and roaming and the settable properties of the three-dimensional model; S2, adding a plug-in to the model and setting the initial value of the camera position: in a three-dimensional model editing scene, in response to an application request, adding the model following roaming plug-in to the three-dimensional model, and obtaining and initializing the initial value of the camera position corresponding to the three-dimensional model according to the model size data and the model shape data of the three-dimensional model; S3, determining a default view value: according to the application request, determining the node connection relationship between the model following roaming plug-in and external data, determining the position and angle of the camera and the default view value according to the fixed view value, and dynamically adjusting the default view value; S4, model following and surrounding: based on the model following roaming plug-in, receiving a start following and surrounding event trigger instruction in real time, and driving the camera to start following or surrounding with the model as the center according to the event type and action category of the start following and surrounding event.
[0008] Optionally, in step S1, the three-dimensional model can set properties, including: camera parameters, model shape data, camera position and model data, the position and angle of the camera in the three-dimensional scene, and the axis, direction, initial angle and speed of automatic rotation; wherein the camera parameters include: observation position, observation height, camera distance, longitude and latitude; the model data include: model length, model height and model height.
[0009] Preferably, the step S2 further includes: S21, based on the three-dimensional model editing scene, responding to the application request, adding the model follow roaming plug-in to the three-dimensional model; S22, automatically acquiring the model size data and model shape data of the three-dimensional model, and the offset value of the camera position based on the model follow roaming plug-in; S23, calculating and determining the center point of the three-dimensional model according to the model size data and the model shape data, and offsetting the coordinates (x, y, z) of the center point according to the offset value to obtain the initial value of the camera position; S24, storing the coordinates (x, y, z) of the center point, the offset value and the initial value of the camera position.
[0010] Preferably, in step S23, the step of calculating and determining the center point of the three-dimensional model according to the model size data and the model shape data further includes: S23-1, based on the model following roaming plug-in, calling the three-dimensional rendering engine through the interface, traversing each vertex of the three-dimensional model, and respectively obtaining the position data of each vertex; S23-2, according to the position of each vertex, respectively determining the maximum value MaxX and the minimum value MinX of x, the maximum value MaxY and the minimum value MinY of y, the maximum value MaxZ and the minimum value MinZ of z, and the coordinates (x, y, z) of the center point;
[0011] in,
[0012] but
[0013] The coordinates of the center point are
[0014] Preferably, the step S3 further includes: S31, based on the three-dimensional scene, according to the application request, obtaining camera parameters and model data, and determining the node connection mode and the storage address of external data; S32, determining the position and angle of the camera in the three-dimensional scene according to the camera parameters and the model data, and generating a default view value; S33, using the storage address of the external data, establishing a connection relationship between the model follower roaming plug-in and the external data through the node connection mode, and responding to the user's default view value update request in real time through the connection relationship, and dynamically updating the default view value; wherein the fixed view value includes the camera parameters and the model data; the camera parameters include: observation position, observation height, camera distance, longitude and latitude; the model data includes: model length, model height and model height; the position and the angle are both a set of data, and the default view value is a set of fixed viewing angle values in the array corresponding to the position and the angle, and is dynamically adjusted through the connection relationship according to the user's default view value update request.
[0015] Preferably, in step S4, the step of receiving the start following and surround event trigger instruction in real time based on the model following roaming plug-in, and driving the camera to start following or surround with the model as the center according to the event type and action category of the start following and surround event further includes: S4-1, based on the model following roaming plug-in, receiving the start following and surround event trigger instruction in real time, parsing the start following and surround event trigger instruction, and determining the event type of the start following and surround event, and the action category; S4-2, according to the parsing result of the start following and surround event trigger instruction, obtaining the initial position of the camera to start following or surround with the model as the center; S4-3, according to the event type and the action category, driving the camera to start following or surround from the initial position with the model as the center; wherein the event type includes: follow event and surround event; the action category includes: manual surround mode and automatic surround mode.
[0016] Preferably, the step of driving the camera to follow or surround from the initial position with the model as the center according to the event type and the action category in S4-3 includes the step of following event processing, specifically: when the event type is a following event, according to the parsing results of the start following and surround event triggering instructions, the initial position, initial angle and reset parameters are obtained, and the initial binding position of the camera is determined; 1) according to the position information of the initial position (x1, y1, z1), the binding position (w1, m1, n1) of the camera starting to follow is determined through the model following roaming plug-in calculation, the three-dimensional model and the camera are bound based on the initial position of the three-dimensional model and the initial binding position of the camera, and the positional relationship between the model and the camera is determined; 2) in the process of the camera following the model as the center, based on the model following The roaming plug-in obtains the new position information (x2, y2, z2) of each frame of the 3D model movement in real time, and based on the new position information (x2, y2, z2), calculates the real-time updated binding position (w2, m2, n2) of the camera in real time according to the positional relationship between the 3D model and the camera, and transmits the real-time updated binding position to the camera, thereby completing the camera full follow-up movement centered on the model; 3) when receiving a trigger instruction for ending the follow-up event, the 3D model is restored to its initial position according to the reset parameter, and the camera is restored to its initial binding position at the beginning of the follow-up, and the binding relationship between the 3D model and the camera is released, and the processing result of the follow-up release is returned; wherein the positional relationship is (Lx, Ly, Lz), Lx=x1-w1, Ly=y1-m1, Lz=z1-n1.
[0017] Preferably, the step of driving the camera to follow or surround the model from the initial position according to the event type and the action category in S4-3 includes a step of processing a surround event, specifically: when the event type is a surround event, driving the camera to surround the model from the initial position according to the action category;
[0018] If the action category is a manual surround mode, 1) the model following roaming plug-in responds to the user's manual surround request and obtains the initial angle and reset parameters manually set by the user, as well as the surround direction of the camera relative to the three-dimensional model; 2) the model following roaming plug-in uses the initial angle, the initial position manually set by the user, and the surround direction to drive the camera to start from the initial position manually set by the user and surround the three-dimensional model with the three-dimensional model as the center according to the initial angle and the surround direction;
[0019] If the surround mode is the automatic surround mode, 1) the model follower roaming plug-in is used to respond to the automatic surround request in real time, and the axis, direction, initial angle and speed of the automatic surround, as well as the current position of the camera are obtained;
[0020] 2) The model following roaming plug-in uses the speed, the axis, the initial angle and the direction to drive the camera to automatically orbit around the three-dimensional model starting from the current position according to the axis, the initial angle, the direction and the speed with the three-dimensional model as the center; 3) When an instruction to end the automatic orbit event is received, the surround control of the camera is ended through the model following roaming plug-in, and the camera is restored to the initial position; wherein the axis includes: X-axis, Y-axis and Z-axis; the direction includes: clockwise or counterclockwise.
[0021] Preferably, the angle is the angle formed by the direction of the camera's rotation and the axial direction, and the specific steps of obtaining the initial angle are: obtaining an observation position {LookAtX, LookAtY, LookAtZ}, a camera distance r, a longitude α, and a latitude β; obtaining the initial angle {LookDirX, LookDirY, LookDirZ} according to the coordinates of the observation position {LookAtX, LookAtY, LookAtZ}, the camera distance r, the longitude α, and the latitude β;
[0022] in,
[0023] LookDirX = LookAtX - PosX;
[0024] LookDirY = LookAtY - PosY;
[0025] LookDirZ = LookAtZ - PosZ;
[0026] PosX=LookAtX+r×cos(β)×sin(α);
[0027] PosY=LookAtY+r×sin(β);
[0028] PosZ=LookAtZ+r×cos(β)×cos(α).
[0029] Correspondingly, the present invention also provides a control system for a camera to follow the movement and roaming of a three-dimensional model, the system comprising a plug-in prefabrication module, a plug-in initial setting module, a view dynamic adjustment module and a model following and surrounding module;
[0030] in,
[0031] The plug-in prefabrication module is used to prefabricate model following and roaming plug-ins: according to the logic processing of 3D model following and roaming and the configurable properties of the 3D model, the model following and roaming plug-in is prefabricated;
[0032] The plug-in initial setting module is used to add a plug-in to the model and set the initial value of the camera position: in the 3D model editing scene, in response to an application request, add the model follow roaming plug-in to the 3D model, and obtain and initialize the initial value of the camera position corresponding to the 3D model according to the model size data and the model shape data of the 3D model;
[0033] The view dynamic adjustment module is used to determine the default view value: determine the node connection relationship between the model following roaming plug-in and the external data according to the application request, determine the position and angle of the camera and the default view value according to the fixed view value, and dynamically adjust the default view value;
[0034] The model following and surrounding module is used for model following and surrounding: based on the model following roaming plug-in, it receives the start following and surrounding event triggering instructions in real time, and drives the camera to start following or surrounding with the model as the center according to the event type and action category of the start following and surrounding event.
[0035] By applying the above technical scheme, the present invention realizes providing a model following and roaming plug-in that can meet various project needs through a dynamic link library written in code and configurable properties. At the same time, through a visual interface, project participants can flexibly set the configurable properties of the camera following the movement and roaming of the three-dimensional model according to needs, and call the model following and roaming plug-in to quickly complete the efficient, accurate, real-time and flexible control of the camera following the movement and roaming of the three-dimensional model, thereby solving the technical problems of high project cost, long cycle, high development and use threshold in the prior art, thereby reducing project costs, shortening project development cycles, and improving the real-time, accuracy and flexibility of the camera following the movement and roaming of the three-dimensional model, as well as the camera following and surround effects on the three-dimensional model. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 A schematic flow chart of a method for controlling a camera to move and roam following a three-dimensional model, provided in an embodiment of the present invention, is shown;
[0038] Figure 2 A schematic diagram of the structure of a control system for a camera to move and roam following a three-dimensional model, according to an embodiment of the present invention, is shown. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] The present invention provides a control method for a camera to follow the movement and roaming of a three-dimensional model. Figure 1 As shown, the method comprises the following steps:
[0041] S1, prefabricated model following and roaming plug-in: based on the logical processing of 3D model following and roaming and the configurable properties of 3D models, prefabricated model following roaming plug-in.
[0042] In this embodiment, in step S1, the three-dimensional model can set properties, including: camera parameters, model shape data, camera position and model data, the position and angle of the camera in the three-dimensional scene, and the axis, direction, initial angle and speed of automatic surround;
[0043] in,
[0044] The camera parameters include: observation position, observation height, camera distance, longitude and latitude;
[0045] The model data includes: model length, model height and model height.
[0046] It should be noted that in actual application scenarios, project personnel can flexibly set the configurable attributes of the three-dimensional model as needed according to the actual needs of the project, namely the camera parameters, model shape data, camera position and model data mentioned in the present invention, the position and angle of the camera in the three-dimensional scene, and the axis, direction, initial angle and speed of automatic surround. Other configurable attributes that are set also fall within the scope of protection of the present invention.
[0047] The model follow and roam plug-in is a dynamic link library (DLL) written in code, which contains the logic processing of follow and roam and configurable properties. These configurable properties can be added to the 3D model to enable it to have the functions of follow and roam. Through the model follow and roam plug-in, the user can set various parameters on the model to achieve different follow and roam effects.
[0048] During actual operation, the Model Following and Roaming plug-in calculates and transmits the position information of the model in each frame to the camera. In the following state, the camera will make corresponding adjustments according to the position and posture of the model to ensure that the model is always within the camera's field of view. In this way, users can freely rotate and move around the 3D model to achieve more flexible observation and presentation effects. In the roaming state, the camera can orbit around the model at a default offset position, or orbit around the moving model at any angle. This plug-in can realize dynamic interaction between the model and the camera, allowing users to explore and observe the model more freely, providing an immersive experience. In short, the Model Following and Roaming plug-in implements the interaction logic and parameter settings between the model and the camera through code writing, providing users with a more flexible and convenient way to observe and present the model.
[0049] S2, adding a plug-in to the model and setting the initial value of the camera position: in the three-dimensional model editing scene, in response to the application request, adding the model follow roaming plug-in to the three-dimensional model, and obtaining and initializing the initial value of the camera position corresponding to the three-dimensional model based on the model size data and model shape data of the three-dimensional model.
[0050] In this embodiment, the step S2 further includes:
[0051] S21, based on the three-dimensional model editing scene, responding to the application request, adding the model follow roaming plug-in to the three-dimensional model;
[0052] S22, automatically acquiring model size data and model shape data of the three-dimensional model, and an offset value of a camera position based on the model following roaming plug-in;
[0053] S23, calculating and determining the center point of the three-dimensional model according to the model size data and the model shape data, and offsetting the coordinates (x, y, z) of the center point according to the offset value to obtain the initial value of the camera position;
[0054] S24, storing the coordinates (x, y, z) of the center point, the offset value and the initial value of the camera position.
[0055] In this embodiment, in step S23, the step of calculating and determining the center point of the three-dimensional model according to the model size data and the model shape data further includes:
[0056] S23-1, based on the model following roaming plug-in, calling the 3D rendering engine through the interface, traversing each vertex of the 3D model, and respectively obtaining the position data of each vertex;
[0057] S23-2, according to the positions of the vertices, respectively determine the maximum value MaxX and the minimum value MinX of x, the maximum value MaxY and the minimum value MinY of y, the maximum value MaxZ and the minimum value MinZ of z, and the coordinates (x, y, z) of the center point;
[0058] in,
[0059] but
[0060] The coordinates of the center point are
[0061] It should be noted that in three-dimensional scene editing, it is a common requirement to add the model follow roaming plug-in for the model that needs to be followed and surrounded. The model follow roaming plug-in can automatically obtain information such as the model size and model shape of the model, calculate the center point, and then set the camera position with these information data as the default value. At the same time, the user or project staff can adjust the offset value of the camera according to the provided configurable parameters and set the camera to a suitable position. In order to support users to set the adjusted value as the initial value for subsequent reset, the function of saving user settings is added to the model follow roaming plug-in, so that users can save the adjusted value as the default view value for reset operation when needed. The design of this plug-in can greatly simplify the process of users setting the camera position when editing three-dimensional scenes, improve user experience, and reduce users' operations on complex parameters. The customizable plug-in design can better meet user needs and improve editing efficiency.
[0062] Calculate the coordinates (x, y, z) of the center point by calling the interface of the 3D rendering engine, as follows: Each model contains a number of vertices, and the vertices contain data describing the positions of the vertices. By traversing each vertex, the maximum value MaxX and the minimum value MinX of x, the maximum value MaxY and the minimum value MinY of y, the maximum value MaxZ and the minimum value MinZ of z, and the coordinates (x, y, z) of the center point can be obtained.
[0063] in,
[0064] but
[0065] The coordinates of the center point are
[0066] S3, determining the default view value: determining the node connection relationship between the model following roaming plug-in and the external data according to the application request, determining the position and angle of the camera and the default view value according to the fixed view value, and dynamically adjusting the default view value.
[0067] In this embodiment, the step S3 further includes:
[0068] S31, based on the three-dimensional scene and according to the application request, obtaining camera parameters and model data, and determining a node connection method and a storage address of external data;
[0069] S32, determining the position and angle of the camera in the three-dimensional scene according to the camera parameters and the model data, and generating a default view value;
[0070] S33, using the storage address of the external data, establishing a connection relationship between the model follower roaming plug-in and the external data through the node connection mode, and responding to the user's default view value update request in real time through the connection relationship, and dynamically updating the default view value;
[0071] in,
[0072] The fixed view value includes the camera parameters and the model data;
[0073] The camera parameters include: observation position, observation height, camera distance, longitude and latitude;
[0074] The model data includes: model length, model height and model height;
[0075] The position and the angle are both a set of data, and the default view value is a set of fixed viewing angle values in an array corresponding to the position and the angle, which is dynamically adjusted through the connection relationship according to the user's default view value update request.
[0076] It should be noted that in 3D scene editing, the fixed view value is composed of adjustable observation height, camera distance, longitude and latitude parameters and model length, width and height external data. These parameters together determine the position and angle of the camera in the scene. The position and angle here are an array, and the default value is dynamically modified according to different application scenarios. The default view value is both a fixed and a variable perspective. Users can dynamically adjust the perspective according to actual needs to better observe and edit 3D scenes.
[0077] In order to achieve real-time update of the default view value, it is necessary to connect the external data with the plug-in through the node connection method so as to pass the real-time modified view value to the model follow roaming plug-in. The node connection method is implemented by the interface drag and drop method. This method of realizing real-time connection by the interface drag and drop method allows users to dynamically adjust the default view value according to the actual situation without programming. Compared with the existing programming and writing code solution, it improves the user editing efficiency and responds to user needs quickly. At the same time, the real-time connection can also realize the real-time flexible switching of fixed viewing angles, so that users can observe and edit three-dimensional scenes more flexibly. Fixed view value is a very important concept in three-dimensional scene editing. It can help users better observe and edit scenes, improve editing efficiency and user experience. Through the real-time connection method, users can dynamically adjust the default view value according to actual needs, thereby realizing real-time and flexible switching of fixed viewing angles, making the editing process more flexible and efficient.
[0078] S4, model following and surround: based on the model following roaming plug-in, receive the start following and surround event triggering instructions in real time, and drive the camera to start following or surround with the model as the center according to the event type and action category of the start following and surround event.
[0079] In this embodiment, in step S4, the step of receiving the start following and surround event triggering instruction in real time based on the model following roaming plug-in, and driving the camera to start following or surround with the model as the center according to the event type and action category of the start following and surround event further includes:
[0080] S4-1, based on the model following roaming plug-in, receiving the start following and surround event triggering instruction in real time, parsing the start following and surround event triggering instruction, and determining the event type of the start following and surround event, and the action category;
[0081] S4-2, according to the analysis result of the start following and surround event triggering instruction, obtaining the initial position of the camera starting to follow or surround with the model as the center;
[0082] S4-3, according to the event type and the action category, driving the camera to follow or surround from the initial position with the model as the center;
[0083] in,
[0084] The event types include: follow-up events and surround events;
[0085] The action categories include: manual surround mode and automatic surround mode.
[0086] In this embodiment, the step of driving the camera to follow or surround the model from the initial position based on the event type and the action category in S4-3 includes a step of following event processing, specifically:
[0087] When the event type is a follow event, the initial position, initial angle and reset parameters are obtained according to the analysis results of the start follow and surround event trigger instructions, and the initial binding position of the camera is determined;
[0088] 1) According to the position information (x1, y1, z1) of the initial position, the binding position (w1, m1, n1) of the camera starting to follow is determined by the model following roaming plug-in, the 3D model and the camera are bound based on the initial position of the 3D model and the initial binding position of the camera, and the positional relationship between the model and the camera is determined;
[0089] 2) In the process of following the camera with the model as the center, the new position information (x2, y2, z2) of each frame of the three-dimensional model movement is obtained in real time based on the model following roaming plug-in, and based on the new position information (x2, y2, z2), the real-time updated binding position (w2, m2, n2) of the camera is calculated in real time according to the positional relationship between the three-dimensional model and the camera, and the real-time updated binding position is transmitted to the camera, thereby completing the complete following movement of the camera with the model as the center;
[0090] 3) When receiving a trigger instruction for ending the following event, the three-dimensional model is restored to the initial position according to the reset parameter, the camera is restored to the initial binding position at the beginning of following, and the binding relationship between the three-dimensional model and the camera is released, and the processing result of the following release is returned;
[0091] Among them, the positional relationship is (Lx, Ly, Lz), Lx=x1-w1, Ly=y1-m1, Lz=z1-n1.
[0092] In this embodiment, the step of driving the camera to follow or surround the model from the initial position according to the event type and the action category in S4-3 includes a step of surrounding event processing, specifically:
[0093] When the event type is a surround event, driving the camera to surround from the initial position with the model as the center according to the action category;
[0094] If the action category is manual surround mode, then
[0095] 1) Responding to a user's manual surround request through the model following roaming plug-in, obtaining the initial angle and reset parameters manually set by the user, and the surround direction of the camera relative to the three-dimensional model;
[0096] 2) The model following roaming plug-in uses the initial angle, the initial position manually set by the user, and the surround direction to drive the camera to start from the initial position manually set by the user and surround the three-dimensional model with the three-dimensional model as the center according to the initial angle and the surround direction;
[0097] If the surround mode is automatic surround mode,
[0098] 1) Responding to the automatic surround request in real time through the model following roaming plug-in, obtaining the axis, direction, initial angle and speed of the automatic surround, and the current position of the camera;
[0099] 2) the model following roaming plug-in uses the speed, the axis, the initial angle and the direction to drive the camera to automatically orbit around the three-dimensional model starting from the current position according to the axis, the initial angle, the direction and the speed with the three-dimensional model as the center;
[0100] 3) When receiving an instruction to end the automatic surround event, the surround control of the camera is ended through the model following roaming plug-in, and the camera is restored to the initial position;
[0101] The axial direction includes: X-axis, Y-axis and Z-axis; the direction includes: clockwise or counterclockwise.
[0102] In this embodiment, the angle is the angle formed by the direction of the camera's rotation and the axial direction, and the specific steps for obtaining the initial angle are:
[0103] Get the observation position as {LookAtX, LookAtY, LookAtZ}, the camera distance as r, the longitude as α and the latitude as β;
[0104] According to the coordinates of the observation position {LookAtX, LookAtY, LookAtZ}, the camera distance is r, the longitude α and the latitude β, the initial angle is obtained as {LookDirX, LookDirY, LookDirZ};
[0105] in,
[0106] LookDirX = LookAtX - PosX;
[0107] LookDirY = LookAtY - PosY;
[0108] LookDirZ = LooKAtZ - PosZ;
[0109] PosX=LookAtX+r×cos(β)×sin(α);
[0110] PosY=LookAtY+r×sin(β);
[0111] PosZ=LookAtZ+r×cos(β)×cos(α).
[0112] In order to facilitate those skilled in the art to have a deeper understanding of the control method for the camera to follow the movement and roaming of the three-dimensional model provided by the present invention, the control method for the camera to follow the movement and roaming of the three-dimensional model is now further supplemented.
[0113] The surround function (i.e., action category) of the model follow roaming plug-in includes two modes: manual surround mode and automatic surround mode. In the manual surround mode, the user needs to set the initial angle and reset parameters. The initial angle, as the starting position of the surround, supports dynamic adjustment and can also be understood as the zero point of the surround. However, this zero point is affected by the dynamically adjusted initial angle and is a dynamic value. Each modification will affect the initial position of the camera when it starts to surround. The reset parameter can be implemented as a trigger event that provides a one-key return to the initial value during the manual surround process. As an event, when applied, it is necessary to output an event to the model follow roaming plug-in according to the button in the scene that can be triggered by the mouse or hotkey, triggering the model follow roaming plug-in to reset the manual roaming camera to the set parameter position, and the reset parameter of the model follow roaming plug-in determines the user's recovery to the specific initial position during the manual surround process.
[0114] During manual surround, users can modify the initial value of the setting by operating with a mouse or other input device, but cannot directly restore to the default value. However, through the initial value of the setting, users can easily restore to a specific angle, providing a convenient way to manage the position of the camera.
[0115] The automatic surround mode involves modifying the speed, axis, direction, loop and number of loop parameters. The speed can be a variable speed, and the user can modify the speed value in a linear or nonlinear dynamic manner during the surround process to generate a richer surround effect. This allows users to create dynamic surround effects with different speed changes according to specific needs. The axis refers to the direction in which the camera can rotate in three-dimensional space. Different axes can achieve surrounds in different directions centered on the model. Users can control the camera to surround clockwise or counterclockwise by setting the direction parameters, thereby achieving a variety of surround effects. These detailed setting parameters and functions provide users with a wealth of operating options, allowing users to control the camera's surround behavior more flexibly and efficiently when editing three-dimensional scenes, thereby achieving richer and more vivid perspective transformation effects.
[0116] After the parameter setting is completed, the relevant events are triggered to start following and surrounding. The triggering events include starting following and ending following. The core purpose of the design of the model following roaming plug-in is to complete specific work by dragging the interface, reducing the workload and difficulty of camera following and surrounding development. The model following roaming plug-in is all events except parameter setting. The function of the model following roaming plug-in is realized by controlling the interactive button to output the trigger event, and these trigger action buttons interact. Based on this, the user can trigger the control event with hot keys or buttons. When the start following event is triggered, the camera is bound to the model and completely follows the movement of the model. In this process, the user can also rotate at any angle with the three-dimensional model as the center point to achieve more free observation. When the following needs to be ended, the ending following event must be triggered to separate the camera from the model without affecting each other. Surrounding events are also controlled by two events, start and end. The control method is similar to the following event. The specific control method can be set by the user according to specific needs. The design of these functions enables users to more flexibly control the following and surrounding behaviors of the camera and model, so as to better achieve the desired observation and presentation effects.
[0117] By applying the above technical scheme, a model following roaming plug-in is prefabricated according to the logical processing of three-dimensional model following and roaming and the configurable properties of the three-dimensional model; in the three-dimensional model editing scene, in response to an application request, the model following roaming plug-in is added to the three-dimensional model, and the initial value of the camera position corresponding to the three-dimensional model is obtained and initialized according to the model size data and the model shape data of the three-dimensional model; according to the application request, the node connection relationship between the model following roaming plug-in and the external data is determined, the position and angle of the camera and the default view value are determined according to the fixed view value, and the default view value is dynamically adjusted; based on the model following roaming plug-in, the start following and surround event trigger instructions are received in real time, and according to the event type of the start following and surround event, the start following and surround event is triggered. And the action category drives the camera to start following or roaming with the model as the center, and realizes the model following and roaming plug-ins that can meet various project needs through the dynamic link library written in code and the configurable properties. At the same time, through the visual interface, the project participants can flexibly set the configurable properties of the camera following the movement and roaming of the three-dimensional model according to the needs, and call the model following and roaming plug-ins to quickly complete the efficient, accurate, real-time and flexible control of the camera following the movement and roaming of the three-dimensional model, which solves the technical problems of high project cost, long cycle, high development and use threshold in the existing technology, thereby reducing project costs, shortening project development cycles, and improving the real-time, accuracy and flexibility of the camera following the movement and roaming of the three-dimensional model, as well as the camera following and surrounding effects on the three-dimensional model.
[0118] In addition, by lowering the threshold for use, the user range can be expanded and the ability of related companies to undertake 3D scene projects can be improved, thereby shortening the project cycle and accelerating the promotion of 3D scene applications. This interface setting method allows non-R&D engineers such as project managers or implementation engineers to easily operate without having to have a deep understanding of coding development.
[0119] Through the interface-based setting method, users can set and adjust parameters through an intuitive graphical interface without having to understand the specific coding details. In this way, non-technical personnel such as project managers or implementation engineers can also make flexible settings according to project requirements to achieve different follow and surround effects. This method further greatly reduces the threshold for use, allowing more people to participate in the development and application of 3D scene projects, and can also cultivate and attract more talents more quickly, improve the team's development capabilities and project delivery efficiency. At the same time, this will also help promote 3D scene applications to more fields and industries, enhance competitiveness and influence in the market, and achieve camera follow and surround effects on models through interface-based setting methods.
[0120] Corresponding to the control method of the camera following the movement and roaming of the three-dimensional model in one embodiment of the present invention, the present invention also discloses a control system for the camera following the movement and roaming of the three-dimensional model, such as Figure 2 As shown, the system includes a plug-in prefabrication module, a plug-in initial setting module, a view dynamic adjustment module and a model follow-up surround module;
[0121] in,
[0122] The plug-in prefabrication module is used to prefabricate model following and roaming plug-ins: according to the logic processing of 3D model following and roaming and the configurable properties of the 3D model, the model following and roaming plug-in is prefabricated;
[0123] The plug-in initial setting module is used to add a plug-in to the model and set the initial value of the camera position: in the 3D model editing scene, in response to an application request, add the model follow roaming plug-in to the 3D model, and obtain and initialize the initial value of the camera position corresponding to the 3D model according to the model size data and the model shape data of the 3D model;
[0124] The view dynamic adjustment module is used to determine the default view value: determine the node connection relationship between the model following roaming plug-in and the external data according to the application request, determine the position and angle of the camera and the default view value according to the fixed view value, and dynamically adjust the default view value;
[0125] The model following and surrounding module is used for model following and surrounding: based on the model following roaming plug-in, it receives the start following and surrounding event triggering instructions in real time, and drives the camera to start following or surrounding with the model as the center according to the event type and action category of the start following and surrounding event.
[0126] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0127] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A method for controlling a camera to move and roam following a three-dimensional model, characterized in that: The method comprises: S1, prefabricated model following and roaming plug-in: according to the logic processing of 3D model following and roaming and the configurable properties of 3D model, prefabricated model following roaming plug-in; S2, adding a plug-in to the model and setting an initial value of the camera position: in the 3D model editing scene, in response to an application request, adding the model follow-up roaming plug-in to the 3D model, and obtaining and initializing the initial value of the camera position corresponding to the 3D model according to the model size data and the model shape data of the 3D model; S3, determining a default view value: determining a node connection relationship between the model following roaming plug-in and external data according to the application request, determining a position and angle of a camera and a default view value according to a fixed view value, and dynamically adjusting the default view value; S4, model following and surround: based on the model following roaming plug-in, receiving the start following and surround event triggering instruction in real time, and driving the camera to start following or surround with the model as the center according to the event type and action category of the start following and surround event; in, The step of S3 further comprises: S31, based on the three-dimensional scene and according to the application request, obtaining camera parameters and model data, and determining a node connection method and a storage address of external data; S32, determining the position and angle of the camera in the three-dimensional scene according to the camera parameters and the model data, and generating a default view value; S33, using the storage address of the external data, establishing a connection relationship between the model following roaming plug-in and the external data through the node connection mode, and responding to the user's default view value update request in real time through the connection relationship, and dynamically updating the default view value; in, The fixed view value includes the camera parameters and the model data; The camera parameters include: observation position, observation height, camera distance, longitude and latitude; The model data includes: model length, model height and model height; The position and the angle are both a set of data, and the default view value is a set of fixed viewing angle values in an array corresponding to the position and the angle, which is dynamically adjusted through the connection relationship according to the user's default view value update request.
2. The method according to claim 1, characterized in that In step S1, the three-dimensional model can set properties, including: camera parameters, model shape data, camera position and model data, the position and angle of the camera in the three-dimensional scene, and the axis, direction, initial angle and speed of automatic surround; in, The camera parameters include: observation position, observation height, camera distance, longitude and latitude; The model data includes: model length, model height and model height.
3. The method according to claim 1, characterized in that The step of S2 further comprises: S21, based on the three-dimensional model editing scene, responding to the application request, adding the model follow roaming plug-in to the three-dimensional model; S22, automatically acquiring model size data and model shape data of the three-dimensional model, and an offset value of a camera position based on the model following roaming plug-in; S23, calculating and determining the center point of the three-dimensional model according to the model size data and the model shape data, and offsetting the coordinates (x, y, z) of the center point according to the offset value to obtain the initial value of the camera position; S24, storing the coordinates (x, y, z) of the center point, the offset value and the initial value of the camera position.
4. The method according to claim 3, characterized in that In step S23, the step of calculating and determining the center point of the three-dimensional model according to the model size data and the model shape data further includes: S23-1, based on the model following roaming plug-in, calling the three-dimensional rendering engine through the interface, traversing each vertex of the three-dimensional model, and respectively obtaining the position data of each vertex; S23-2, according to the positions of the vertices, respectively determine the maximum value MaxX and the minimum value MinX of x, the maximum value MaxY and the minimum value MinY of y, the maximum value MaxZ and the minimum value MinZ of z, and the coordinates (x, y, z) of the center point; in, but The coordinates of the center point are 5. The method according to claim 1, characterized in that In step S4, the step of receiving the start following and surround event triggering instruction in real time based on the model following roaming plug-in, and driving the camera to start following or surround with the model as the center according to the event type and action category of the start following and surround event further includes: S4-1, based on the model following roaming plug-in, receiving the start following and surround event triggering instruction in real time, parsing the start following and surround event triggering instruction, and determining the event type of the start following and surround event, and the action category; S4-2, according to the analysis result of the start following and surround event triggering instruction, obtaining the initial position of the camera starting to follow or surround with the model as the center; S4-3, according to the event type and the action category, driving the camera to follow or surround from the initial position with the model as the center; in, The event types include: follow-up events and surround events; The action categories include: manual surround mode and automatic surround mode.
6. The method according to claim 5, characterized in that The step of driving the camera to follow or surround the model from the initial position according to the event type and the action category in S4-3 includes a step of following event processing, specifically: When the event type is a follow event, the initial position, initial angle and reset parameters are obtained according to the analysis results of the start follow and surround event trigger instructions, and the initial binding position of the camera is determined; 1) According to the position information (x1, y1, z1) of the initial position, the binding position (w1, m1, n1) of the camera starting to follow is determined by the model following roaming plug-in, the 3D model and the camera are bound based on the initial position of the 3D model and the initial binding position of the camera, and the positional relationship between the model and the camera is determined; 2) In the process of following the camera with the model as the center, the new position information (x2, y2, z2) of each frame of the three-dimensional model movement is obtained in real time based on the model following roaming plug-in, and based on the new position information (x2, y2, z2), the real-time updated binding position (w2, m2, n2) of the camera is calculated in real time according to the positional relationship between the three-dimensional model and the camera, and the real-time updated binding position is transmitted to the camera, thereby completing the complete following movement of the camera with the model as the center; 3) When receiving a trigger instruction for ending the following event, the three-dimensional model is restored to the initial position according to the reset parameter, the camera is restored to the initial binding position at the beginning of following, and the binding relationship between the three-dimensional model and the camera is released, and the processing result of the following release is returned; Among them, the positional relationship is (Lx, Ly, Lz), Lx=x1-w1, Ly=y1-m1, Lz=z1-n1.
7. The method according to claim 5, characterized in that The step of driving the camera to follow or surround the model from the initial position according to the event type and the action category in S4-3 includes a step of processing a surround event, specifically: When the event type is a surround event, driving the camera to surround from the initial position with the model as the center according to the action category; If the action category is manual surround mode, then 1) Responding to a user's manual surround request through the model following roaming plug-in, obtaining the initial angle and reset parameters manually set by the user, and the surround direction of the camera relative to the three-dimensional model; 2) The model following roaming plug-in uses the initial angle, the initial position manually set by the user, and the surround direction to drive the camera to start from the initial position manually set by the user and surround the three-dimensional model with the three-dimensional model as the center according to the initial angle and the surround direction; If the surround mode is automatic surround mode, 1) Responding to the automatic surround request in real time through the model following roaming plug-in, obtaining the axis, direction, initial angle and speed of the automatic surround, and the current position of the camera; 2) the model following roaming plug-in uses the speed, the axis, the initial angle and the direction to drive the camera to automatically orbit around the three-dimensional model starting from the current position according to the axis, the initial angle, the direction and the speed with the three-dimensional model as the center; 3) When receiving an instruction to end the automatic surround event, the surround control of the camera is ended through the model following roaming plug-in, and the camera is restored to the initial position; The axial direction includes: X-axis, Y-axis and Z-axis; the direction includes: clockwise or counterclockwise.
8. The method according to claim 1, characterized in that The angle is the angle formed by the direction of the camera's rotation and the axial direction. The specific steps for obtaining the initial angle are: Get the observation position as {LookAtX, LookAtY, LookAtZ}, the camera distance as r, the longitude as α and the latitude as β; According to the coordinates of the observation position {LookAtX, LookAtY, LookAtZ}, the camera distance is r, the longitude α and the latitude β, the initial angle is obtained as {LookDirX, LookDirY, LookDirZ}; in, LookDirX = LookAtX - PosX; LookDirY = LookAtY - PosY; LookDirZ = LookAtZ - PosZ; PosX=LookAtX+r×cos(β)×sin(α); PosY=LookAtY+r×sin(β); PosZ=LookAtZ+r×cos(β)×cos(α).
9. A system for implementing the control method of claim 1 for a camera to move and roam following a three-dimensional model, characterized in that: The system includes a plug-in prefabrication module, a plug-in initial setting module, a view dynamic adjustment module and a model follow-up surround module; in, The plug-in prefabrication module is used to prefabricate model following and roaming plug-ins: according to the logic processing of 3D model following and roaming and the configurable properties of the 3D model, the model following and roaming plug-in is prefabricated; The plug-in initial setting module is used to add a plug-in to the model and set the initial value of the camera position: in the 3D model editing scene, in response to an application request, add the model follow roaming plug-in to the 3D model, and obtain and initialize the initial value of the camera position corresponding to the 3D model according to the model size data and the model shape data of the 3D model; The view dynamic adjustment module is used to determine the default view value: determine the node connection relationship between the model following roaming plug-in and the external data according to the application request, determine the position and angle of the camera and the default view value according to the fixed view value, and dynamically adjust the default view value; The model following and surrounding module is used for model following and surrounding: based on the model following roaming plug-in, it receives the start following and surrounding event triggering instructions in real time, and drives the camera to start following or surrounding with the model as the center according to the event type and action category of the start following and surrounding event; The step of determining the node connection relationship between the model following the roaming plug-in and the external data according to the application request, determining the position and angle of the camera and the default view value according to the fixed view value, and dynamically adjusting the default view value further includes: S31, based on the three-dimensional scene and according to the application request, obtaining camera parameters and model data, and determining a node connection method and a storage address of external data; S32, determining the position and angle of the camera in the three-dimensional scene according to the camera parameters and the model data, and generating a default view value; S33, using the storage address of the external data, establishing a connection relationship between the model following roaming plug-in and the external data through the node connection mode, and responding to the user's default view value update request in real time through the connection relationship, and dynamically updating the default view value; in, The fixed view value includes the camera parameters and the model data; The camera parameters include: observation position, observation height, camera distance, longitude and latitude; The model data includes: model length, model height and model height; The position and the angle are both a set of data, and the default view value is a set of fixed viewing angle values in an array corresponding to the position and the angle, which is dynamically adjusted through the connection relationship according to the user's default view value update request.
Citation Information
Patent Citations
Path planning method, system and device for scene roaming, and storage medium
CN116452718A
Apparatus and method of generating electronic three-dimensional walkthrough environment
US10616483B1