A positioning method for three-dimensional model components with adaptive optimal viewing angle
By comprehensively considering various factors of model components in complex three-dimensional scenarios, generating and evaluating candidate observation positions, and adaptively adjusting the camera perspective angle, the problem of difficulty in reducing occlusion and improving interaction efficiency in the prior art is solved, and a better three-dimensional interactive experience is achieved.
Patent Information
- Application Number
- CN202211615172.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-15
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-12-15
AI Technical Summary
The existing three-dimensional visualization technology is difficult to effectively reduce the visual occlusion and interference of surrounding models in complex three-dimensional scenarios, making it difficult for users to view model components and conduct flexible and effective spatial interactions.
By comprehensively considering the position, size, line of sight occlusion relationship and viewing angle orientation priority of the model components, the candidate observation positions of each model component are generated and evaluated, the camera candidate viewing angle with the best evaluation results is selected, and the camera is adaptively adjusted to the viewing angle, so that the viewing angle is in the best position to observe the model components.
Effectively reduce visual occlusion and interference of surrounding models, improve user viewing efficiency of model components, and support flexible and effective spatial interaction, improving the three-dimensional interactive experience.
Smart Images

Figure CN115861578B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional visualization and spatial scene positioning, and specifically, it is a positioning method for three-dimensional model components with adaptive optimal viewing angles. More specifically, it is a method that supports generating and evaluating candidate observation positions of each model component in a complex three-dimensional scene by comprehensively considering factors such as the position, size, line of sight occlusion relationship, and viewing angle orientation priority of the model component, finding the candidate camera viewing angle with the best evaluation result, and adaptively adjusting the camera to the viewing angle so that the viewing angle is in the optimal orientation for observing the model component. Background Art
[0002] As 3D visualization technology is increasingly used in the fields of 3D geographic information, GIS+BIM, intelligent manufacturing, virtual simulation, digital twins, etc., 3D visualization scenes and display objects are becoming more and more complex, and the structure is becoming more and more refined. Especially in some cross-scale 3D applications that include both macroscopic geographic space display and microscopic structural component expression, users need to be able to quickly locate and browse the specified model components in order to view the details of the 3D scene or edit and modify a certain component.
[0003] In existing 3D software or platforms, the execution logic and considerations for spatial positioning of model components are relatively simple. Usually, the camera perspective is moved to the model component range and pointed to the model component center point according to the center point and size of the model component. This perspective switching method does not take into account the environmental factors of the model's location, and often has occlusion and coverage problems, making it difficult for users to view model components, and even more impossible to perform flexible and effective spatial interaction.
[0004] Therefore, it is necessary to develop a positioning method for three-dimensional model components to adapt to the optimal viewing angle, which can reduce the visual occlusion and interference of surrounding models, facilitate users to view model components, and conduct flexible and effective spatial interaction. Summary of the invention
[0005] The purpose of the present invention is to provide a method for positioning a three-dimensional model component at an adaptive optimal viewing angle. The method is a method that comprehensively considers factors such as the position, size, line of sight occlusion relationship, and viewing angle priority of model components in a complex three-dimensional scene involving various internal structural components of the model, reduces visual occlusion and interference of surrounding models, and adaptively positions the camera to the optimal viewing angle for observing model components. The method reduces visual occlusion and interference of surrounding models, facilitates users to view model components, and conducts flexible and effective spatial interaction, which is accurate, efficient, and stable.
[0006] In order to achieve the above object, the technical solution of the present invention is: a positioning method of a three-dimensional model component with an adaptive optimal viewing angle, characterized in that it comprises the following steps:
[0007] Step 1: Obtain the specified model components and basic information of the scene camera, and generate the camera viewing angle parameters for browsing the model accordingly, so that the entire model is included in the viewing angle range and the model display size is maximized;
[0008] Step 2: In this step, discrete points are uniformly generated on the sphere (there are infinite candidate points on the entire sphere, which cannot be traversed and evaluated one by one, so discrete points need to be selected) as candidate viewpoint positions for subsequent further viewpoint evaluation and selection; operations such as neighbor relationship calculation and orientation information acquisition are performed on the discrete candidate points;
[0009] Step 3: Generate candidate viewPoint positions n Evaluation is performed to select the best viewing angle as the final camera viewing angle setting position; the evaluation mainly considers the visibility between the candidate viewing angle position and the model components, as well as the orientation priority of the viewing angle;
[0010] Step 4: After obtaining the optimal viewing angle with better visibility and higher orientation priority through comprehensive evaluation, the 3D scene camera is dynamically set and gradually updated to the optimal viewing angle with better visibility and higher orientation priority (gradual update includes camera position gradual update and camera attitude gradual update);
[0011] In the above technical solution, in step 1, obtaining the specified model components and scene camera basic information includes the following sub-steps:
[0012] Step 1.1: Obtain the coordinate range information of the specified model component, including the maximum and minimum coordinate values in the three axes of x, y, and z: xMax, yMax, zMax, xMin, yMin, and zMin, and on this basis calculate the center point modelCenterPoint of the model component and the radius boundRadius of the model outer sphere. The specific calculation method is shown in the following formulas (1) and (2); At the same time, obtain the basic information of the scene camera, including the vertical field of view angle fovV and the horizontal field of view angle fovH of the camera;
[0013]
[0014]
[0015] Step 1.2: Based on the obtained model and camera basic information, generate the camera viewing angle parameters that can be used to browse the model, including the camera viewing angle observation focus (i.e., the center point of the model component modelCenterPoint), and the distance value sightDis between the camera and the observation focus in order to see the entire model component. When the distance value between the camera and the observation focus is sightDis, the camera frustum boundary is just tangent to the model outer sphere. The calculation method of sightDis is shown in the following formulas (4), (5), and (6):
[0016]
[0017]
[0018] sightDis=Max(sightDisV,sightDisH) (6)
[0019] Wherein: boundRadius is the radius of the model's bounding sphere; sightDisV is the distance between the camera and the model center calculated based on the vertical field of view angle fovV and the radius of the bounding sphere. When the distance between the camera and the center point is this value, the model's bounding sphere is just tangent to the upper and lower interfaces of the frustum; similarly, sightDisH is the distance between the camera and the model center calculated based on the horizontal field of view angle fovH and the radius of the bounding sphere; the final sightDis takes the larger value between sightDisV and sightDisH, so as to ensure that the model's bounding sphere is contained in the frustum in both the horizontal and vertical directions, and the display size is maximized.
[0020] In the above technical solution, the above step 1 obtains the viewing angle parameters for browsing the model, including the viewing angle observation focus modelCenterPoint and the distance value sightDis from the viewing angle to the focus. As long as the camera viewing angle is set to point to the focus and the distance from the focus is sightDis, that is, when the camera viewing angle is located on the sphere with modelCenterPoint as the center and sightDis as the radius, the whole picture of the model component can be browsed. On this basis, step 2 uniformly generates discrete points on the viewing angle sphere as viewing angle candidate positions, and further performs operations such as neighbor relationship calculation and orientation information acquisition on the candidate points, which specifically includes the following sub-steps:
[0021] Step 2.1: Generate discrete points uniformly on the viewing sphere as candidate viewing positions. Use the Fibonacci Grid to uniformly sample the sphere to generate points. The specific generation method is shown in the following formula:
[0022]
[0023]
[0024]
[0025]
[0026] in: is the golden section constant value; N is the total number of generated candidate points; n is the sequence number of the nth candidate point, n∈[1,N]; deltaX n , deltaY n , deltaZ n That is, the calculated coordinate offset value of each candidate point relative to the center point of the sphere is substituted into the view observation focus modelCenterPoint and the distance value of the view from the focus sightDis to obtain the coordinate value of each candidate point. For details, see the following formulas (11) and (12); In formula (11), viewPoint n That is, the final calculated coordinate value of each candidate point, n∈[1,N];
[0027] modelCenterPoint=[x center ,y center , center ] (11)
[0028] viewPoint n =[x center ,y center , z center ]+sightDis×[deltaX n ,deltaY n ,deltaZ n ](12)
[0029] Step 2.2: After generating candidate points on the sphere, further calculate and count the neighboring points of the candidate points for subsequent comprehensive evaluation of the viewing angle; the specific calculation method is based on deltaX n , deltaY n , deltaZ n , calculate the distance between each candidate point and other points, obtain the M nearest points (for example, M can be 18, and can also be adjusted according to actual conditions), and record them.
[0030] In the above technical solution, in step three, the optimal viewing angle is selected as the final camera viewing angle setting position, which specifically includes the following sub-steps:
[0031] Step 3.1: For each viewpoint candidate position viewPoint nEvaluate the visibility of the model components to be browsed; use the three-dimensional ray collision detection method to determine the viewPoint n The ray formed by the point modelCenterPoint is used to intersect the scene. If there is no intersection or the intersecting element is the model component to be browsed, it indicates that the scene can be viewed through. On the contrary, if the intersection and the intersecting element are the surrounding scene elements, the scene cannot be viewed through. Based on this, the visibility evaluation result value visibleScore is obtained. n ;
[0032] For any viewpoint candidate position viewPoint n The visibility evaluation function of is shown in the following formula (13), and the visibility evaluation score of the candidate position is jointly determined by whether it is visible and whether the adjacent M perspectives are visible:
[0033]
[0034] Among them: visible n VisibleScore is the visibility evaluation value between the candidate position n and the model component. If the visibility is clear, the value is 1, and if not, the value is 0; n is the visibility evaluation result value of the viewing angle n; the specific calculation method of the visibility evaluation score of the above candidate position is: if it is visible, then visible n is 1, otherwise it is 0; for the M adjacent points, the visibility score = the number of adjacent points with visibility / the total number of adjacent points; the average of the two is taken to get a value between 0 and 1, which is the visibility evaluation score;
[0035] Step 3.2: For each viewpoint candidate position viewPoint n The posture priority is evaluated. In the present invention, the posture priority evaluation scores are assigned according to the different pitch angles of the observation angle. The specific calculation method is shown in the following formula (14), and the posture priority evaluation result value postureScore is obtained. n ,The evaluation method makes the set viewing angle more inclined to ,observe the model components from a 0-45 degree angle from top down, which is more ,conforming to the user’s usage habits.
[0036]
[0037] Step 3.3: The visibility evaluation values and orientation priority evaluation values of steps 3.1 and 3.2 are combined, and then the highest-scoring perspective is selected from the N candidate perspectives as the final perspective. The comprehensive evaluation formula is as follows:
[0038] maxScore=Max(a×visibleScore n+b×postureScore n ) (15)
[0039] Where: a and b are weighted coefficients of visibility and orientation priority, a and b can both be set to 1, or adjusted according to user preferences; n is the candidate view number, n∈[1,N], maxScore is the highest evaluation value among the N candidate view points, and its corresponding view is selected as the final camera setting view.
[0040] In the above technical solution, in step 4, the three-dimensional scene camera is dynamically set, including the following sub-steps:
[0041] Step 4.1: Get the current camera position parameter curCameraPos = [x c ,y c , z c ] and the attitude parameter value curCameraPos = [heading c ,pitch c ], where heading c 、pitch c are the azimuth and pitch angles of the current camera respectively; at the same time, according to the optimal camera angle viewPoint obtained in the previous step 3.3 n =[x new ,y new , z new ] and the camera's perspective focus modelCenterPoint = [x center ,y center , z center ], calculate the new camera posture parameters curCameraPos = [headig new , pitch new ], where the new camera heading new and pitch new The calculation formula is as follows:
[0042] x=x center -x new (15)
[0043] y=y center -y new (16)
[0044]
[0045]
[0046] Step 4.2: Set the total number of camera gradients K (for example, K is 1000, which can also be adjusted according to actual conditions), use a fixed position and attitude change step, and update the camera once at a fixed interval (for example, set the time interval to 1 millisecond, which can also be adjusted according to actual conditions). This will allow the current camera to smoothly transition to the viewing angle of the model component, completing the execution logic of the camera adapting to the model component. The position and attitude change step value calculation is as follows:
[0047]
[0048]
[0049]
[0050] Compared with the prior art, the present invention has the following advantages:
[0051] (1) The method of the present invention meets the application demand for adaptive browsing and positioning of model components in complex three-dimensional scenes (complex three-dimensional scenes involve scenes including multiple models, and these models include multi-layer structural components from the outside to the inside. The present invention can locate the internal structural components of various models in complex three-dimensional scenes). It creatively solves the problems of confusing drawings and difficulty in interaction caused by occlusion and interference of models around the scene when viewing or editing detailed components in the existing three-dimensional technology system, thereby improving the three-dimensional interactive experience and filling the gap in related technologies.
[0052] (2) The method of the present invention uses the calculation logic of viewing angle generation, line of sight detection, etc., which uses methods such as discretizing the continuous spherical space to select points and quickly judging line of sight based on ray collision detection. While considering the accuracy of the calculation results, it also ensures the overall execution efficiency, making the algorithm more efficient and the effect more stable.
[0053] (3) The method described in the present invention is not limited to a specific three-dimensional platform. All three-dimensional applications involving the positioning of three-dimensional model components and the switching of camera perspectives can be implemented using the logical ideas of the present invention. The algorithm has strong versatility and can be widely promoted and applied. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 The flowchart of an embodiment of the present invention when adaptively positioning a model component in a three-dimensional perspective.
[0055] Figure 2 Schematic diagram of model size and bounding sphere in an embodiment of the present invention.
[0056] Figure 3 Schematic diagram of the camera field of view and the model bounding sphere in an embodiment of the present invention.
[0057] Figure 4 Schematic diagram of camera viewing angle distance parameter calculation in an embodiment of the present invention.
[0058] Figure 5 A schematic diagram of available viewing angles for browsing model components in an embodiment of the present invention.
[0059] Figure 6 Schematic diagram of uniformly interpolating candidate viewing angles using a spherical Fibonacci grid in an embodiment of the present invention.
[0060] Figure 7 Schematic diagram of the neighboring relationship of candidate perspectives in an embodiment of the present invention.
[0061] Figure 8 Schematic diagram of candidate viewing angle through-view detection in an embodiment of the present invention.
[0062] Fig. 9 Schematic diagram of the priority division of candidate viewing angles in an embodiment of the present invention.
[0063] Fig.10 A schematic diagram of candidate perspective generation, evaluation, and selection in an embodiment of the present invention.
[0064] Fig.11 Schematic diagram of the viewing angles of adaptive positioning results of the model components in the embodiment of the present invention using the traditional model and the method of the present invention respectively.
[0065] exist Figure 6 In the equation, E represents the sampling point.
[0066] exist Figure 7 In FIG. 1 , F represents a candidate point in this embodiment; G represents 18 neighboring points of a candidate point in this embodiment of the present invention.
[0067] Fig.10 In Figures (e), (f) and (g), points with larger inner diameters represent viewing angles that allow for line of sight; points with smaller inner diameters represent viewing angles that do not allow for line of sight.
[0068] Fig.10 In Figure (g), point M is the optimal viewing angle.
[0069] exist Figure 8 In the figure, the vertical rectangular structure represents the occluder.
[0070] Figure 2 The left figure in the figure is a schematic diagram of the size structure of the model components in the embodiment of the present invention; Figure 2 The right figure in FIG. 1 is a schematic structural diagram of the minimum outer sphere of the model component in an embodiment of the present invention.
[0071] Figure 4 The left picture in is a schematic diagram of the camera vertical viewing angle distance parameter calculation; Figure 4The right picture in is a schematic diagram of the camera horizontal viewing angle distance parameter calculation;
[0072] Figure 5 The outermost sphere in the figure indicates that the camera can completely see the outer sphere of the model component on this sphere;
[0073] Figure 8 For Figure 5 Schematic diagram of performing candidate perspective line-of-sight detection on the outermost sphere.
[0074] Fig.10 Figure (a) is a schematic diagram of the structure of viewing angle selection in an embodiment of the present invention. Figure 1 ; Fig.10 Figure (b) is a schematic diagram of the structure of viewing angle selection in an embodiment of the present invention. Figure 2 ; Fig.10 Figure (c) is a schematic diagram of the structure of candidate viewing angle selection in an embodiment of the present invention. Figure 1 ; Fig.10 Figure (c) is a schematic diagram of the structure of candidate viewing angle selection in an embodiment of the present invention. Figure 2 ; Fig.10 Figure (d) is a schematic diagram of the structure of candidate viewing angle generation in an embodiment of the present invention; Fig.10 Figure (e) is a schematic diagram of the structure of candidate viewing angle selection in an embodiment of the present invention; Fig.10 Figure (f) is a schematic diagram of the structure of the optimal viewing angle evaluation in an embodiment of the present invention; Fig.10 Figure (g) is a structural schematic diagram of optimal viewing angle generation in an embodiment of the present invention.
[0075] Fig.11 Figure (a) is a result diagram of the model component in this embodiment (i.e., the chair to be positioned and viewed) using a traditional model viewing perspective; Fig.11 Figure (b) is a perspective viewing result diagram of the model component in this embodiment (i.e., the chair to be positioned and viewed) using the method of the present invention to perform adaptive positioning. DETAILED DESCRIPTION
[0076] The following is a detailed description of the implementation of the present invention in conjunction with the accompanying drawings, but they do not constitute a limitation of the present invention and are only used as examples. At the same time, the advantages of the present invention are made clearer and easier to understand through the description.
[0077] The present invention provides a positioning method for adaptive optimal viewing angle of a 3D model component, which can perform adaptive browsing and positioning of model components in complex 3D scenes, thereby improving the 3D interactive experience; it solves the problems of chaotic drawings and difficulty in interaction caused by occlusion interference of models around the scene when viewing or editing detail components in the existing 3D technology system; in the calculation logic of viewing angle generation, line of sight detection and other calculation logics used in the method of the present invention, methods such as discretizing continuous spherical space to select points and rapid line of sight judgment based on ray collision detection are used, while considering the accuracy of the calculation results, the overall execution efficiency is also guaranteed, the algorithm is more efficient, and the effect is more stable; the method is not limited to a specific 3D platform, the algorithm has strong versatility, and can be widely promoted and applied.
[0078] The core problem to be solved by the present invention is to propose a method that can adaptively set the camera perspective to a specified model component in a complex three-dimensional scene. The method comprehensively considers factors such as the position, size, line of sight occlusion relationship, and perspective orientation priority of the model component, so that the set perspective can not only observe the entire model component, but also form a line of sight with the model, greatly reduce the visual occlusion and interference of the surrounding models, and facilitate subsequent detailed viewing and interactive editing of the model component.
[0079] The method of the present invention is not only applicable to the adaptive optimal viewing angle positioning of microscopic small model components, but also applicable to the adaptive optimal viewing angle positioning of models of any size; the algorithm of the present invention is adaptive and has nothing to do with the size of the model; for example, the present invention is applicable to large-size models, for example, when a building is blocked by other buildings, the method of the present invention can also be used to find an unobstructed viewing angle (i.e., locate the adaptive optimal viewing angle); the present invention can also achieve the same positioning effect for micro-scale models.
[0080] Example
[0081] The present invention is now described in detail by taking the present invention being tried out for positioning of an adaptive optimal viewing angle on a chair in an office as an example. The present invention also has a guiding role in the adaptive optimal viewing angle positioning of model components applied to other three-dimensional visualizations and space scenes.
[0082] In this embodiment, a chair is located in an office; the office is located in a central building surrounded by other floors in a commercial district in the city center, and the view is completely blocked. In the existing technology, in a 3D software or platform, the camera view is moved to the range of the model component and pointed to the center point of the model component according to the center point and size of the model component. However, this view switching method does not take into account the environmental factors of the location of the office, and there is a problem of blocking and covering, which makes it difficult for users to view the chair, and it is impossible to perform flexible and effective spatial interaction.
[0083] This embodiment adopts the method of the present invention to adaptively locate the three-dimensional viewing angle to a certain chair, such as Figure 1 As shown, the following steps are included:
[0084] Step 1, obtaining the specified model components and scene camera basic information, and generating the camera viewing angle parameters for browsing the model accordingly, so that the entire model is included in the viewing angle range and the model display size is maximized, including the following sub-steps:
[0085] Step 1.1, obtain the coordinate range information of the specified model component, including the maximum and minimum coordinate values in the three axes of x, y, and z (in meters): xMax, yMax, zMax, xMin, yMin, zMin, and calculate the center point modelCenterPoint of the model component and the radius boundRadius of the model outer sphere on this basis. The specific calculation method is shown in the following formulas (1) and (2). In this embodiment, xMax=0.62, yMax=0.58, zMax=0.72, xMin=0, yMin=0, zMin=0, modelCenterPoint=(0.31, 0.29, 0.36) and boundRadius=0.556596802 Figure 2 As shown; at the same time, this embodiment also obtains the basic information of the scene camera, including the camera's vertical field of view angle fovV = 36° and the horizontal field of view angle fovH = 60°, as shown Figure 3 shown.
[0086]
[0087]
[0088] Step 1.2, based on the obtained model and camera basic information, generate the camera viewing angle parameters that can be used to browse the model, including the camera viewing angle observation focus (i.e., the model component center point modelCenterPoint), and the distance value sightDis from the camera to the observation focus in order to see the entire model component, such as Figure 4 As shown in the figure, when the distance between the camera and the observation focus is sightDis, the boundary of the camera frustum is just tangent to the outer sphere of the model. The calculation method of sightDis is shown in the following formulas (4), (5) and (6):
[0089]
[0090]
[0091] sightDis=Max(sightDisV,sightDisH) (6)
[0092] Among them, boundRadius is the radius of the model bounding sphere, sightDisV=1.801185087 in this embodiment is the distance between the camera and the model center calculated according to the vertical field of view angle fovV and the radius of the bounding sphere. When the distance between the camera and the center point is this value, the model bounding sphere is just tangent to the upper and lower interfaces of the viewing cone; similarly, sigghtDisH=1.113193604 in this embodiment is the distance between the camera and the model center calculated according to the horizontal field of view angle fovH and the radius of the bounding sphere; the final sightDis in this embodiment takes the larger value of sightDisV and sightDisH, which is equal to 1.801185087, thereby ensuring that the model bounding sphere is contained in the viewing cone in both the horizontal and vertical directions, and the display size is maximized.
[0093] Step 2: The above steps obtain the viewing angle parameters for browsing the model, including the viewing angle observation focus modelCenterPoint and the distance value sightDis from the focus. As long as the camera viewing angle is set to point to the focus and the distance from the focus is sightDis, that is, when the camera viewing angle is located on the sphere with modelCenterPoint as the center and sightDis as the radius, the whole model component can be browsed. Figure 5 As shown in . On this basis, this step evenly generates discrete points on the sphere (there are infinite candidate points on the entire sphere, which cannot be traversed and evaluated one by one, so discrete points are required) as candidate viewpoint positions for subsequent further viewpoint evaluation and selection; the discrete candidate points are calculated for neighbor relationships, orientation information acquisition, and other operations. Specifically, it includes the following sub-steps:
[0094] Step 2.1, generate discrete points uniformly on the viewing sphere as candidate viewing positions. Here, the Fibonacci Grid is used to uniformly sample the sphere to generate points. The result is as follows: Figure 6 As shown in , the specific generation method is shown in the following formula:
[0095]
[0096]
[0097]
[0098]
[0099] in: is the golden section constant value; N is the total number of candidate points generated, which is set to 1000 in this embodiment; n is the sequence number of the nth candidate point, n∈[1,N]; deltaX n , deltaY n, deltaZ n That is, the calculated coordinate offset value of each candidate point relative to the center point of the sphere. Substituting the view observation focus modelCenterPoint and the distance value of the view from the focus sightDis, the coordinate value of each candidate point can be obtained, as shown in the following formula (11). n That is, the final calculated coordinate value of each candidate point, n∈[1,N] (this embodiment adopts the method of the present invention to obtain 1000 candidate positions. These 1000 candidate positions form a spherical structure around the model component of this embodiment. On the spherical surface of the spherical structure, the camera can just see the outer sphere of the model component completely from the spherical surface, thereby realizing high-precision positioning and viewing of the model component in an occluded environment).
[0100] modelCenterPoint=[x center ,y center , z center ] (11)
[0101] viewPoint n =[x center ,y center , z center ]+sightDis×[deltaX n , deltaY n , deltaZ n ](12)
[0102] Step 2.2, after generating candidate points on the sphere, further calculate and count the neighboring points of the candidate points for subsequent comprehensive evaluation of the viewing angle. The specific calculation method is based on deltaX n , deltaY n , deltaZ n , calculate the distance between each candidate point and other points, obtain the M nearest points, and record them. In this embodiment, the value of M is 18. Figure 7 , which is a schematic diagram of a candidate point (point F) and 18 neighboring points (point G) in this embodiment.
[0103] Step 3: generate the candidate viewPoint n Evaluation is performed to select the best view as the final camera view setting position. The evaluation mainly considers the visibility between the view candidate position and the model components, as well as the view orientation priority. The specific steps include the following:
[0104] Step 3.1: for each viewpoint candidate position viewPoint nThe visual connection with the model component to be browsed (i.e., a chair in an office on a floor of a central building surrounded by other floors in a commercial district in a downtown area) is evaluated. Figure 8 As shown, using the three-dimensional ray collision detection method, the point viewPoint n The ray formed by the point modelCenterPoint is used to determine the intersection of the scene. If there is no intersection or the intersecting element is a model component to be browsed, it indicates that the scene can be viewed (such as Figure 8 Middle viewPoint i Perspective); On the contrary, if the intersection point and the intersecting elements are surrounding scene elements, they cannot be seen through (such as Figure 8 Middle viewPoint i Perspective). For a certain perspective candidate position viewPoint n The visibility evaluation function of is shown in the following formula, which is determined by whether it is visible and whether the adjacent M perspectives are visible:
[0105]
[0106] In the formula, visible n VisibleScore is the visibility evaluation value between the candidate position n and the model component. If the visibility is clear, the value is 1, and if not, the value is 0; n is the visibility evaluation result value of viewing angle n.
[0107] Step 3.2: for each viewpoint candidate position viewPoint n The orientation priority is evaluated, such as Fig. 9 As shown, in the present invention, the orientation priority evaluation scores are assigned values according to the different pitch angles of the observation angle. The specific calculation method is shown in the following formula (14), and the orientation priority evaluation result value postureScore is obtained. n ,The evaluation method makes the set viewing angle more inclined to ,observe the model components from a 0-45 degree angle from top down, which is more ,conforming to the user’s usage habits.
[0108]
[0109] Step 3.3, the line-of-sight evaluation values and orientation priority evaluation values of steps 3.1 and 3.2 are integrated, and then the highest-scoring viewing angle is selected from N (the value is 1000 in this embodiment) candidate viewing angles as the final viewing angle. The comprehensive evaluation formula is shown in the following formula:
[0110] maxScore=Max(a×visibleScore n +b×postureScore n ) (15)
[0111] Where a and b are weighted coefficients for visibility and orientation priority, both of which are set to 1 in this embodiment and can be adjusted according to user preferences; n is the candidate viewing angle number, n∈[1,N], and maxScore is the highest evaluation value among the N candidate viewing angles, and its corresponding viewing angle is selected as the final camera setting viewing angle. Fig.10 As shown, Fig.10 Figure (a) in Fig.10 Figure (b) shows the surrounding scene of the model component (chair) in this embodiment using stroke and model transparency respectively; Fig.10 Figure (c) in Fig.10 Figure (d) is the result of candidate perspective generation; Fig.10 Figure (e) in Fig.10 Figure (f) is the result of the candidate perspective visibility detection; Fig.10 Point H in Figures c, f, and g is the line-of-sight perspective, and point L is the non-line-of-sight perspective; Fig.10 Figure (g) is the result of comprehensive evaluation of the optimal viewing angle selection. The optimal viewing angle is as follows: Fig.10 As shown in point M in Figure (g).
[0112] Step 4: After obtaining the optimal viewing angle with better visibility and higher orientation priority through comprehensive evaluation, the 3D scene camera is dynamically set and gradually updated to the viewing angle. This includes the following sub-steps:
[0113] Step 4.1, get the current camera position parameter curCameraPos = [x c ,y c , z c ] and the attitude parameter value curCameraPos = [heading c ,pitch c ], where heading c 、pitch c are the azimuth and elevation angles of the current camera respectively. At the same time, according to the optimal camera angle viewPoint obtained in the previous step n =[x new ,y new , z new ] and the camera's perspective focus modelCenterPoint = [x center ,y center , z center ], calculate the new camera posture parameters curCameraPos = [heading new , pitch new ], where the new camera headingnew and pitch new The calculation formula is as follows:
[0114] x=x center -x new (15)
[0115] y=y center -y new (16)
[0116]
[0117]
[0118] Step 4.2, set the total number of camera gradients K. In this embodiment, K is set to 1000. Use a fixed position and posture change step size, and update the camera once at a fixed interval (set to 1 millisecond in this embodiment). This will smoothly transition the current camera to the viewing angle of the model component, completing the execution logic of the camera adapting to the model component. The final result viewing angle is as follows: Fig.11 As shown, Fig.11 The camera angle maintains line of sight with the chair in this embodiment and is in a more suitable observation position. The position and posture change step value calculation is as follows:
[0119]
[0120]
[0121]
[0122] from Fig.11 As can be seen from Figure (b) in the figure, the present embodiment adopts the method of the present invention to accurately locate and view a chair in an office on a floor of a central building surrounded by other floors in a commercial district in the city center from an adaptive optimal viewing angle, thereby solving the problem of high-precision positioning and viewing of model components in an obstructed environment in the present embodiment; and overcoming the problem that the prior art adopts a specific implementation method of model positioning and viewing that does not consider the visibility, and cannot realize the positioning and viewing of model components in an obstructed environment (such as Fig.11 As shown in Figure (a), this figure is a result diagram of the traditional model viewing perspective. The problem of the chair to be positioned and viewed in this embodiment is not seen in this figure.
[0123] Conclusion: This embodiment adopts the method of the present invention to comprehensively consider factors such as the position, size, line of sight occlusion relationship, and view orientation priority of model components in a complex three-dimensional scene, reduce visual occlusion and interference of surrounding models, and adaptively position the camera to the optimal viewing angle for observing model components; and this embodiment adopts the perspective generation, line of sight detection and other calculation logics used by the method of the present invention, and uses methods such as discretizing the continuous spherical space to select points and fast line of sight judgment based on ray collision detection. While considering the accuracy of the calculation results, it also ensures the overall execution efficiency.
[0124] The above is only an embodiment of the present invention and is not intended to limit the present invention. Any modifications and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0125] Other parts not described belong to the prior art.
Claims
1. A method for positioning a three-dimensional model component at an optimal viewing angle, characterized in that: The following steps are included: Step 1: Obtain the specified model components and basic information of the scene camera, and generate the camera viewing angle parameters for browsing the model accordingly, so that the entire model is included in the viewing angle range and the model display size is maximized; Step 2: Generate discrete points uniformly on the spherical surface as candidate viewpoint positions for subsequent further viewpoint evaluation and selection; calculate the neighbor relationship and obtain the orientation information of the discrete candidate points; Step 3: Generate candidate viewPoint positions n An evaluation is performed to select the best viewing angle as the final camera viewing angle setting position; the evaluation considers the visibility between the candidate viewing angle position and the model components, as well as the orientation priority of the viewing angle; Step 4: After obtaining the optimal viewing angle with better visibility and higher orientation priority through comprehensive evaluation, the 3D scene camera is dynamically set and gradually updated to the optimal viewing angle with better visibility and higher orientation priority; In step 1, the specified model components and scene camera basic information are obtained, including the following sub-steps: Step 1.1: Obtain the coordinate range information of the specified model component, including the maximum and minimum coordinate values in the three axes of x, y, and z: xMax, yMax, zMax, xMin, yMin, and zMin, and on this basis calculate the center point modelCenterPoint of the model component and the radius boundRadius of the model outer sphere. The specific calculation method is shown in the following formulas (1) and (2); At the same time, obtain the basic information of the scene camera, including the vertical field of view angle fovV and the horizontal field of view angle fovH of the camera; Step 1.2: Based on the obtained model and camera basic information, generate the camera viewing angle parameters that can be used to browse the model, including the camera viewing angle observation focus, and the distance value sightDis between the camera and the observation focus in order to see all the model components. When the distance value between the camera and the observation focus is sightDis, the camera frustum boundary is just tangent to the model outer sphere. The calculation method of sightDis is shown in the following formulas (4), (5) and (6): sigtDis=Max(sigtDisV,sigtDisH) (6) Where: boundRadius is the radius of the model bounding sphere; sightDisV is the distance between the camera and the model center calculated based on the vertical field of view angle fovV and the bounding sphere radius. When the distance between the camera and the center point is this value, the model bounding sphere is just tangent to the upper and lower interfaces of the frustum; similarly, sightDisH is the distance between the camera and the model center calculated based on the horizontal field of view angle fovH and the bounding sphere radius; the final sightDis takes the larger value between sightDisV and sightDisH, so as to ensure that the model bounding sphere is contained in the frustum in both horizontal and vertical directions, and the display size is maximized; Step 2: evenly generate discrete points on the viewing sphere as viewing angle candidate positions, and further calculate the neighbor relationship and obtain the orientation information of the candidate points, which specifically includes the following sub-steps: Step 2.1: Generate discrete points uniformly on the viewing sphere as candidate viewing positions, and use the Fibonacci grid to uniformly sample the sphere to generate points. The specific generation method is shown in the following formula: in: is the golden section constant value; N is the total number of generated candidate points; n is the sequence number of the nth candidate point, n∈[1,N]; deltaX n , deltaY n , deltaZ n That is, the calculated coordinate offset value of each candidate point relative to the center point of the sphere is substituted into the view observation focus modelCenterPoint and the distance value of the view from the focus sightDis to obtain the coordinate value of each candidate point, as shown in the following formulas (11) and (12); In formula (11), viewPoint n That is, the final calculated coordinate value of each candidate point, n∈[1,N]; modelCenterPoint=[x center ,y center ,from center ] (11) viewPoint n =[x center ,y center ,z center ]+sightDis×[deltaX n ,deltaY n ,deltaZ n ](12) Step 2.2: After generating candidate points on the sphere, further calculate and count the neighboring points of the candidate points for subsequent comprehensive evaluation of the viewing angle; the specific calculation method is based on deltaX n , deltaY n , deltaZ n , calculate the distance between each candidate point and other points, obtain the M nearest points, and record them; In step 3, the optimal viewing angle is selected as the final camera viewing angle setting position, which specifically includes the following sub-steps: Step 3.1: For each viewpoint candidate position viewPoint n Evaluate the visibility of the model components to be browsed; use the three-dimensional ray collision detection method to determine the viewPoint n The ray formed by the point modelCenterPoint is used to intersect the scene. If there is no intersection or the intersecting element is the model component to be browsed, it indicates that the scene can be viewed through. On the contrary, if the intersection and the intersecting element are the surrounding scene elements, the scene cannot be viewed through. Based on this, the visibility evaluation result value visibleScore is obtained. n ; For any viewpoint candidate position viewPoint n The visibility evaluation function of is shown in the following formula (13), and the visibility evaluation score of the candidate position is jointly determined by whether it is visible and whether the adjacent M perspectives are visible: Among them: visible n VisibleScore is the visibility evaluation value between the candidate position n and the model component. If the visibility is clear, the value is 1, and if not, the value is 0; n is the visibility evaluation result value of the viewing angle n; the specific calculation method of the visibility evaluation score of the above candidate position is: if it is visible, then visible n is 1, otherwise it is 0; for the M adjacent points, the visibility score = the number of adjacent points with visibility / the total number of adjacent points; the average of the two is taken to get a value between 0 and 1, which is the visibility evaluation score; Step 3.2: For each viewpoint candidate position viewPoint n The posture priority of the image is evaluated to make the set viewing angle more in line with the user's usage habits. According to the different viewing angles, the orientation priority evaluation scores are assigned respectively. The specific calculation method is shown in the following formula (14), and the orientation priority evaluation result value postureScore is obtained. n ; Step 3.3: The visibility evaluation values and orientation priority evaluation values of steps 3.1 and 3.2 are combined, and then the highest-scoring perspective is selected from the N candidate perspectives as the final perspective. The comprehensive evaluation formula is as follows: maxScore=Max(a×visibleScore n +b×postureScore n ) (15) Where: a and b are weighted coefficients of visibility and orientation priority; n is the candidate view number, n∈[1,N], maxScore is the highest evaluation value among the N candidate view points, and its corresponding view is selected as the final camera setting view; In step 4, the 3D scene camera is dynamically set, including the following sub-steps: Step 4.1: Get the current camera position parameter curCameraPos = [x c ,y c , z c ] and the attitude parameter value curCameraPos = [heading c , pitch c ], where heading c 、pitch c are the azimuth and pitch angles of the current camera respectively; at the same time, according to the optimal camera angle viewPoint obtained in the previous step 3.3 n =[x new ,y new , z new ,] and the camera perspective focus modelCenterPoint = [x center ,y center , z center ], calculate the new camera posture parameters curCameraPos = [heading new , pitch new ], where the new camera heading new and pitch new The calculation formula is as follows: x=x center -x new (16-1) y=y center -and new (16-2) Step 4.2: Set the total number of camera gradients K, use a fixed position and attitude change step, and update the camera once at a fixed interval, so that the current camera is smoothly transitioned to the perspective of viewing the model component, completing the execution logic of the camera adapting to the model component; the position and attitude change step value calculation is as follows:
Citation Information
Patent Citations
Automatic obtaining method of three-dimensional scene optimal view angle based on maximized visual information
CN102254338A
Three-dimensional model optimal view angle selection method adopting particle swarm optimization
CN115471642A