Camera collision detection method, device and equipment and computer storage medium
By obtaining the parameter information of the main camera in the three-dimensional scene, determining the picture display area and the collision area of the collision camera, and obtaining and detecting the vertices of the three-dimensional model, the problems of large calculation volume and detection error in the existing technology are solved, and the efficiency of camera collision detection is improved. accuracy.
Patent Information
- Application Number
- CN202310168901.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2024-08-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing camera collision detection methods require a large amount of calculations and have large detection errors for irregularly shaped objects, resulting in inaccurate detection results.
By obtaining the parameter information of the main camera in the three-dimensional scene, the collision area between the picture display area and the collision camera is determined, and the vertices of the three-dimensional model are obtained from this area to detect the collision between the vertices and the collision area of the collision camera.
The collision detection process is simplified, the accuracy of detection is improved, and the problem of large calculation amount is avoided.
Smart Images

Figure CN118552610A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of three-dimensional scene application technology, and specifically relates to a camera collision detection method, device, equipment and computer storage medium. Background Art
[0002] Computer graphics is a science that uses mathematical algorithms to convert two-dimensional or three-dimensional graphics into raster forms for computer displays. It mainly studies how to represent graphics in computers, as well as the relevant principles and algorithms for using computers to calculate, process and display graphics.
[0003] When applying computer graphics to construct a three-dimensional scene, it is necessary to perform collision detection on the camera to avoid the occurrence of model penetration. The existing collision detection method is based on the AABB hierarchical bounding box collision detection method, and its main principle is to determine whether a collision occurs by whether the object bounding box intersects with the camera's ray.
[0004] However, existing collision detection methods require constructing rays along the camera contour to determine whether they intersect with the object's bounding box, resulting in a large amount of computation. Moreover, when dealing with irregularly shaped objects, existing collision detection methods may also have detection errors, resulting in inaccurate detection results. Summary of the invention
[0005] The present application provides a camera collision detection method, device, equipment and computer storage medium to solve the defects of large amount of calculation and detection error in the prior art.
[0006] On the one hand, the present application provides a camera collision detection method, comprising:
[0007] Acquire parameter information of a main camera in a three-dimensional scene, the parameter information including: an observation point, a near section, a far section and a viewing angle of the observation point of the main camera;
[0008] Determining a picture display area of the main camera and a collision area of the collision camera according to the parameter information;
[0009] Acquire vertices of a three-dimensional model located within the picture display area from the three-dimensional scene;
[0010] A collision detection is performed based on the collision area between the vertex and the collision camera.
[0011] Optionally, determining the image display area of the main camera and the collision area of the collision camera according to the parameter information includes:
[0012] Determining a picture display area of the main camera according to a near cross section of the main camera, a far cross section of the main camera, and a viewing angle of the observation point;
[0013] A collision area of the collision camera is determined according to the observation point of the main camera and the near cross section.
[0014] Optionally, determining the collision area of the collision camera according to the observation point of the main camera and the near cross section includes:
[0015] Taking the observation point of the main camera as the near section of the collision camera;
[0016] Extending the near section of the main camera by a preset distance in a direction away from the observation point to obtain the far section of the collision camera;
[0017] A collision area of the collision camera is determined according to a near cross section of the collision camera, a far cross section of the collision camera, and a viewing angle of the main camera.
[0018] Optionally, determining the collision area of the collision camera according to the near cross section of the collision camera, the far cross section of the collision camera and the viewing angle of the main camera includes:
[0019] The area enclosed by the near section of the collision camera, the far section of the collision camera, and the extension line of the viewing angle of the observation point of the main camera is used as the collision area of the collision camera.
[0020] Optionally, acquiring vertices of the three-dimensional model located in the picture display area from the three-dimensional scene includes:
[0021] Obtaining vertex information of the three-dimensional model in the three-dimensional scene in a world coordinate system;
[0022] According to the vertex information, the vertices located in the picture display area are determined.
[0023] Optionally, performing collision detection according to a collision area between the vertex and the collision camera includes:
[0024] Performing coordinate transformation on the vertices in the screen display area and the collision area of the collision camera to obtain the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system;
[0025] Collision detection is performed based on the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
[0026] Optionally, performing collision detection according to the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system includes:
[0027] Determine whether the vertex in the view coordinate system is located in the collision area of the collision camera in the view coordinate system;
[0028] If so, determining that the three-dimensional model corresponding to the vertex collides with the collision camera;
[0029] If not, it is determined that there is no collision between the three-dimensional model corresponding to the vertex and the collision camera.
[0030] In a second aspect, the present application provides a camera collision detection device, comprising:
[0031] An acquisition module, used to acquire parameter information of a main camera in a three-dimensional scene, wherein the parameter information includes: an observation point, a near section, a far section and a viewing angle of the observation point of the main camera;
[0032] A determination module, used to determine the image display area of the main camera and the collision area of the collision camera according to the parameter information;
[0033] The acquisition module is further used to acquire vertices of the three-dimensional model located in the picture display area from the three-dimensional scene;
[0034] A detection module is used to perform collision detection according to a collision area between the vertex and the collision camera.
[0035] Optionally, the determination module is specifically used to determine the screen display area of the main camera based on the near section of the main camera, the far section of the main camera and the viewing angle of the observation point; and determine the collision area of the collision camera based on the observation point of the main camera and the near section.
[0036] Optionally, the determination module is specifically configured to use the observation point of the main camera as the near cross section of the collision camera;
[0037] Extending the near section of the main camera by a preset distance in a direction away from the observation point to obtain the far section of the collision camera;
[0038] A collision area of the collision camera is determined according to a near cross section of the collision camera, a far cross section of the collision camera, and a viewing angle of the main camera.
[0039] Optionally, the determination module is specifically configured to use an area enclosed by a near section of the collision camera, a far section of the collision camera, and an extension line of a viewing angle of an observation point of the main camera as the collision area of the collision camera.
[0040] Optionally, the acquisition module is specifically used to acquire vertex information of the three-dimensional model in the three-dimensional scene in a world coordinate system;
[0041] The determination module is further used to determine the vertices located in the picture display area according to the vertex information.
[0042] Optionally, the camera collision detection device further includes: a conversion module;
[0043] The conversion module is used to perform coordinate conversion on the vertices in the screen display area and the collision area of the collision camera to obtain the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system;
[0044] The detection module is specifically used to perform collision detection according to the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
[0045] Optionally, the camera collision detection device further includes: a judgment module;
[0046] The judgment module is used to judge whether the vertex in the view coordinate system is located in the collision area of the collision camera in the view coordinate system;
[0047] The determination module is further configured to determine that a collision occurs between the three-dimensional model corresponding to the vertex and the collision camera when the vertex in the view coordinate system is located in a collision area of the collision camera in the view coordinate system;
[0048] The determination module is further configured to determine that there is no collision between the three-dimensional model corresponding to the vertex and the collision camera when the vertex in the view coordinate system is not located in the collision area of the collision camera in the view coordinate system.
[0049] In a third aspect, the present application provides a camera collision detection device, comprising:
[0050] Memory;
[0051] processor;
[0052] Wherein, the memory stores computer-executable instructions;
[0053] The processor executes the computer-executable instructions stored in the memory to implement the camera collision detection method as described in the first aspect and various possible implementations of the first aspect.
[0054] In a fourth aspect, the present application provides a computer storage medium having computer execution instructions stored thereon, wherein the computer execution instructions are executed by a processor to implement the camera collision detection method as described in the first aspect and various possible implementations of the first aspect.
[0055] The camera collision detection method provided by the present application obtains parameter information of a main camera in a three-dimensional scene, wherein the parameter information includes: an observation point, a near section, a far section and a viewing angle of the observation point of the main camera; according to the parameter information, a screen display area of the main camera and a collision area of a collision camera are determined; vertices of a three-dimensional model located in the screen display area are obtained from the three-dimensional scene; and collision detection is performed based on the vertices and the collision area of the collision camera. The method avoids the defects of large amount of calculation and detection error existing in the prior art, simplifies the process of collision detection, and improves the accuracy of collision detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0057] Figure 1 This is the process of the camera collision detection method provided by this application Figure 1 ;
[0058] Figure 2 This is the process of the camera collision detection method provided by this application Figure 2 ;
[0059] Figure 3 It is a schematic diagram of the screen display area provided by this application;
[0060] Figure 4 This is the process of the camera collision detection method provided by this application Figure 3 ;
[0061] Figure 5 is a structural schematic diagram of a camera collision detection device provided by the present application;
[0062] Figure 6 It is a structural schematic diagram of the camera collision detection device provided in this application.
[0063] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0065] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein, for example.
[0066] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0067] Computer graphics is a science that uses mathematical algorithms to convert two-dimensional or three-dimensional graphics into raster forms for computer displays. It mainly studies how to represent graphics in computers, as well as the relevant principles and algorithms for using computers to calculate, process and display graphics.
[0068] Graphics are usually composed of geometric elements such as points, lines, surfaces, and volumes, and non-geometric attributes such as grayscale, color, line type, and line width. From a processing technology perspective, graphics can be divided into two categories: one is based on line information, such as engineering drawings, contour maps, and wireframe drawings of surfaces, and the other is light and dark graphics, which are usually called realistic graphics.
[0069] The main purpose of computer graphics is to use computers to produce pleasing and realistic graphics. To this end, it is necessary to establish a geometric representation of the scene described by the graphics, and then use a certain lighting model to calculate the lighting effect under the imaginary light source, texture, and material properties to produce realistic graphics.
[0070] When applying computer graphics to construct a three-dimensional scene, it is necessary to perform collision detection on the camera to avoid the occurrence of model penetration. The existing collision detection method is based on the AABB hierarchical bounding box collision detection method, and its main principle is to determine whether a collision occurs by whether the object bounding box intersects with the camera's ray.
[0071] However, existing collision detection methods require constructing rays along the camera contour to determine whether they intersect with the object's bounding box, resulting in a large amount of computation. Moreover, when dealing with irregularly shaped objects, existing collision detection methods may also have detection errors, resulting in inaccurate detection results.
[0072] In response to the above problems, the present application provides a camera collision detection method, which determines the collision area of the screen display area and the collision area of the collision camera based on the parameter information of the main camera, and performs collision detection based on the vertices of the three-dimensional model in the screen display area, and then based on the vertices and the collision area of the collision camera, thereby avoiding the defects of large amount of calculation and detection errors in the prior art, simplifying the collision detection process, and improving the accuracy of collision detection.
[0073] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0074] Figure 1 The process of the camera collision detection method provided in the embodiment of the present application Figure 1 .like Figure 1 As shown, the camera collision detection method provided in this embodiment includes:
[0075] S101: Acquire parameter information of a main camera in a three-dimensional scene, wherein the parameter information includes: an observation point, a near section, a far section, and a viewing angle of the observation point of the main camera.
[0076] The 3D scene is a virtual 3D space, and the main camera is essentially a virtual camera. The observation point of the main camera is equivalent to the user's eyes, the near section of the main camera is equivalent to the closest place the user can see, the far section of the main camera is equivalent to the farthest place the user can see, and the viewing angle of the observation point is equivalent to the angle the user can see.
[0077] S102: Determine, according to the parameter information, a picture display area of the main camera and a collision area of a collision camera.
[0078] The screen display area refers to the area captured by the main camera, which is also the area to be rendered and displayed on the screen. The collision camera is used to detect collision phenomena, and the collision area is the area used to detect collisions. The collision area can be, for example, the area captured by the collision camera.
[0079] The corresponding screen display area and the collision area of the collision camera can be determined according to the parameter information of the main camera. The implementation method of determining the screen display area can, for example, determine the screen display area according to the near section of the main camera and the far section of the main camera, and the area surrounded by the near section of the main camera, the far section of the main camera, and the extension line of the viewing angle of the main camera's observation point can also be regarded as the screen display area of the main camera. This application does not impose any restrictions on this.
[0080] The implementation method of determining the collision area of the collision camera may be, for example, determining the collision area of the collision camera based on the observation point of the main camera, the viewing angle of the observation point, and the near section of the main camera, or considering the partial area between the near section of the main camera and the far section of the main camera as the collision area of the collision camera. This application does not impose any restrictions on this.
[0081] S103: Acquire vertices of a three-dimensional model located in the picture display area from the three-dimensional scene.
[0082] The intersection of three or more edges of the three-dimensional model is called a vertex. The execution time of this embodiment is a scene in which the three-dimensional model in the three-dimensional scene is displayed by a virtual camera. Therefore, the three-dimensional model has been pre-set in the three-dimensional scene.
[0083] After the screen display area is determined, the vertices within the screen display area are obtained.
[0084] It can be understood that in this step, the position of the vertices needs to be considered. Whether the three-dimensional models corresponding to the vertices are all within the display area of the screen can be used as a basis for consideration or not.
[0085] For example, if part of the 3D model A is located in the screen display area, the vertices of the part of the 3D model A located in the screen display area can be obtained, or all the vertices of the 3D model A can be obtained. This application does not limit this, as long as all the vertices located in the screen display area can be obtained.
[0086] S104: performing collision detection according to the collision area between the vertex and the collision camera.
[0087] After the vertices in the screen display area and the collision area of the collision camera are determined, collision detection can be performed based on the vertices and the collision area.
[0088] For example, whether there is a collision phenomenon can be determined based on whether there is a vertex in the collision area of the collision camera, or when the distance between the vertex and the collision area is less than a preset distance, it can be determined that there is a collision phenomenon, etc. The present application does not impose any special restrictions on the specific implementation method of collision detection.
[0089] The camera collision detection method provided in the present embodiment obtains parameter information of a main camera in a three-dimensional scene, wherein the parameter information includes: an observation point, a near section, a far section and a viewing angle of the observation point of the main camera; according to the parameter information, a screen display area of the main camera and a collision area of a collision camera are determined; vertices of a three-dimensional model located in the screen display area are obtained from the three-dimensional scene; and collision detection is performed based on the vertices and the collision area of the collision camera. The method avoids the defects of large amount of calculation and detection error existing in the prior art, simplifies the process of collision detection, and improves the accuracy of collision detection.
[0090] Figure 2 The process of the camera collision detection method provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, the camera collision detection method is described in detail. The camera collision detection method shown in this embodiment includes:
[0091] S201: Acquire parameter information of a main camera in a three-dimensional scene, wherein the parameter information includes: an observation point, a near section, a far section, and a viewing angle of the observation point of the main camera.
[0092] Step S201 is similar to the above step S101 and will not be described again.
[0093] S202: Determine a picture display area of the main camera according to the near section of the main camera, the far section of the main camera, and the viewing angle of the observation point.
[0094] The image display area of the main camera may be determined based on the near section of the main camera, the far section of the main camera, and the viewing angle of the observation point.
[0095] For example, Figure 3 Schematic diagram of the screen display area provided in this embodiment. Figure 3 As shown, the image display area of the main camera is an area surrounded by the near section of the main camera, the far section of the main camera, and the extension line of the viewing angle of the main camera's observation point.
[0096] S203: Determine a collision area of the collision camera according to the observation point of the main camera and the near cross section.
[0097] Among them, the preset distance can be pre-set according to actual needs. In this step, the collision area of the collision camera can be jointly determined according to the observation point of the main camera and the near section of the main camera. For example, the area surrounded by the observation point, the near section of the main camera and the extension line of the viewing angle of the observation point can be used as the collision area of the collision camera. This embodiment does not impose any special restrictions on the specific implementation method of determining the collision area of the collision camera according to the observation point of the main camera and the near section of the main camera.
[0098] Exemplarily, a possible implementation is given here. The observation point of the main camera is used as the near section of the collision camera; the near section of the main camera is extended by a preset distance in the direction away from the observation point to obtain the far section of the collision camera; the collision area of the collision camera is determined according to the near section of the collision camera, the far section of the collision camera and the viewing angle of the main camera.
[0099] Continue to refer to Figure 3 ,like Figure 3 As shown, the gray area is the collision area of the collision camera. The reason why the near section of the main camera is not used as the far section of the collision camera here is to retain a certain redundancy. It can be understood that when presenting a three-dimensional scene, it is necessary to maintain a certain redundant distance between the user's "eyes" and the "objects" seen to prevent the user model from penetrating into the three-dimensional model. In the picture "seen" by the user, the closest picture is the three-dimensional model located at the near section of the main camera. If there is a three-dimensional model A at the near section of the main camera, then in the content displayed on the screen, the user's "eyes" completely overlap with the outer surface of the three-dimensional model A, that is, the user is "sticking" to the three-dimensional model A. At this time, it can also be regarded as a penetration phenomenon. Therefore, when determining the area for detecting collision, it is necessary to extend the near section of the main camera by a preset distance in the direction away from the observation point, so that there is a sense of distance between the user's "eyes" and the three-dimensional model.
[0100] It can be understood that the observation point of the main camera is the same as the observation point of the collision camera, and the viewing angle of the main camera's observation point is the same as the viewing angle of the collision camera's observation point. This is done to better detect whether there is a collision in the screen display area.
[0101] Optionally, the area enclosed by the near section of the collision camera, the far section of the collision camera, and the extension line of the viewing angle of the observation point of the main camera may be used as the collision area of the collision camera.
[0102] S204: Obtain vertex information of the three-dimensional model in the three-dimensional scene in a world coordinate system.
[0103] The vertex information may include, for example, the correspondence between the vertex and the three-dimensional model, and the position information of the vertex in the world coordinate system. The world coordinate system refers to the coordinate system in the three-dimensional scene. For example, the coordinates of vertex A in the world coordinate system (1, 1, 1) means that the coordinates of vertex A in the three-dimensional scene are (1, 1, 1).
[0104] S205: Determine the vertices located in the picture display area according to the vertex information.
[0105] After acquiring the vertex information in the three-dimensional scene, it can be determined whether the vertex is located in the screen display area according to the position information of the vertex in the world coordinate system and the position information of the screen display area.
[0106] The purpose of this step is to find all vertices within the screen display area. Since the displayed area is the screen display area, it is only necessary to find the vertices within the screen display area, and then perform collision detection based on the vertices within the screen display area. Compared with the existing technology, it saves computing power and improves the efficiency of collision detection.
[0107] S206: performing coordinate transformation on the vertices in the screen display area and the collision area of the collision camera to obtain the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
[0108] After all vertices located in the screen display area are determined, it is necessary to perform coordinate transformation on the vertices and the collision area of the collision camera.
[0109] It can be understood that the vertices and collision areas of the collision camera in the above steps are all obtained in the world coordinate system, and their coordinates are also based on the coordinates of the world coordinate system. When displaying, it is displayed based on the view coordinate system, so it is necessary to perform coordinate conversion on the vertices and the collision area of the collision camera to obtain the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
[0110] S207: Perform collision detection according to the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
[0111] After coordinate transformation of the vertices and the collision area is performed to obtain the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system, collision detection can be performed based on the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
[0112] For example, based on the view coordinate system, it can be determined whether there is a vertex in the collision area of the collision camera to determine whether there is a collision phenomenon, or it can be determined that there is a collision phenomenon when the distance between the vertex in the view coordinate system and the collision area in the view coordinate system is less than a preset distance. This application does not impose any special restrictions on the specific implementation method of collision detection.
[0113] The camera collision detection method provided in this embodiment determines the collision area of the collision camera according to the observation point of the main camera and the near cross-section of the main camera, thereby reducing the detection area of the collision detection and saving computing power; at the same time, since the observation point and viewing angle of the main camera and the collision camera are the same, when detecting according to the collision area of the collision camera, the collision situation in the main camera can be fully reflected, which simplifies the collision detection process and improves the accuracy of collision detection.
[0114] Figure 4 The process of the camera collision detection method provided in this embodiment is Figure 3 .like Figure 4 As shown, in this embodiment Figure 2 Based on the embodiment, a detailed description is given of performing collision detection based on the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system. The camera collision detection method shown in this embodiment includes:
[0115] S301: Determine whether the vertex in the view coordinate system is located in the collision area of the collision camera in the view coordinate system; if so, execute step S302, if not, execute step S303.
[0116] Among them, it can be determined whether the vertex in the view coordinate system is within the collision area in the view coordinate system to determine whether there is a collision.
[0117] S302: Determine whether the three-dimensional model corresponding to the vertex collides with the collision camera.
[0118] Among them, when the vertex is within the collision area, it indicates that the three-dimensional model corresponding to the vertex has collided with the collision camera, that is, there is currently a penetration phenomenon; therefore, it can be determined that the three-dimensional model corresponding to the vertex has collided with the collision camera.
[0119] S303: Determine whether the three-dimensional model corresponding to the vertex has no collision with the collision camera.
[0120] When the vertex is not within the collision area, it indicates that the three-dimensional model corresponding to the vertex does not collide with the collision camera; therefore, it can be determined that the three-dimensional model corresponding to the vertex does not collide with the collision camera.
[0121] The camera collision detection method provided in this embodiment determines whether the vertex in the view coordinate system is located in the collision area of the collision camera in the view coordinate system. When the vertex in the view coordinate system is located in the collision area, that is, there is a vertex in the collision area of the collision camera, it is determined that the three-dimensional model corresponding to the vertex has collided with the collision camera, indicating that there is currently a model penetration phenomenon. Compared with the existing method, this method is simpler to obtain and calculate parameters and has a higher accuracy rate.
[0122] Figure 5 This is a schematic diagram of the structure of the camera collision detection device provided in this application. Figure 5 As shown, the present application provides a camera collision detection device, the camera collision detection device 300 includes:
[0123] An acquisition module 301 is used to acquire parameter information of a main camera in a three-dimensional scene, wherein the parameter information includes: an observation point, a near section, a far section and a viewing angle of the observation point of the main camera;
[0124] A determination module 302, configured to determine a picture display area of the main camera and a collision area of the collision camera according to the parameter information;
[0125] The acquisition module 301 is further used to acquire vertices of the three-dimensional model located in the picture display area from the three-dimensional scene;
[0126] The detection module 303 is used to perform collision detection according to the collision area between the vertex and the collision camera.
[0127] Optionally, the determination module 302 is specifically used to determine the screen display area of the main camera based on the near section of the main camera, the far section of the main camera and the viewing angle of the observation point; and determine the collision area of the collision camera based on the observation point of the main camera and the near section.
[0128] Optionally, the determination module 302 is specifically configured to use the observation point of the main camera as the near cross section of the collision camera;
[0129] Extending the near section of the main camera by a preset distance in a direction away from the observation point to obtain the far section of the collision camera;
[0130] A collision area of the collision camera is determined according to a near cross section of the collision camera, a far cross section of the collision camera, and a viewing angle of the main camera.
[0131] Optionally, the determining module 302 is specifically configured to use an area enclosed by a near section of the collision camera, a far section of the collision camera, and an extension line of the viewing angle of the main camera's observation point as the collision area of the collision camera.
[0132] Optionally, the acquisition module 301 is specifically used to acquire vertex information of the three-dimensional model in the three-dimensional scene in a world coordinate system;
[0133] The determination module 302 is further configured to determine the vertices located within the screen display area according to the vertex information.
[0134] Optionally, the camera collision detection device further includes: a conversion module 304;
[0135] The conversion module 304 is used to perform coordinate conversion on the vertices in the screen display area and the collision area of the collision camera to obtain the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system;
[0136] The detection module 303 is specifically configured to perform collision detection according to the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
[0137] Optionally, the camera collision detection device further includes: a judgment module 305;
[0138] The judging module 305 is used to judge whether the vertex in the view coordinate system is located in the collision area of the collision camera in the view coordinate system;
[0139] The determination module 302 is further configured to determine that a collision occurs between the three-dimensional model corresponding to the vertex and the collision camera when the vertex in the view coordinate system is located in a collision area of the collision camera in the view coordinate system;
[0140] The determination module 302 is further configured to determine that there is no collision between the three-dimensional model corresponding to the vertex and the collision camera when the vertex in the view coordinate system is not located in the collision area of the collision camera in the view coordinate system.
[0141] Figure 6 This is a schematic diagram of the structure of the camera collision detection device provided in this application. Figure 6 As shown, the present application provides a camera collision detection device, and the camera collision detection device 400 includes: a receiver 401, a transmitter 402, a processor 403 and a memory 404.
[0142] Receiver 401, used for receiving instructions and data;
[0143] A transmitter 402, used for sending instructions and data;
[0144] Memory 404, for storing computer-executable instructions;
[0145] The processor 403 is used to execute the computer-executable instructions stored in the memory 404 to implement the various steps performed by the camera collision detection method in the above embodiment. For details, please refer to the relevant description in the above camera collision detection method embodiment.
[0146] Optionally, the memory 404 may be independent or integrated with the processor 403 .
[0147] When the memory 404 is independently provided, the electronic device further includes a bus for connecting the memory 404 and the processor 403 .
[0148] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, a camera collision detection method as performed by the above-mentioned camera collision detection device is implemented.
[0149] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0150] So far, the technical solution of the present application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments, and the above embodiments are only used to illustrate the technical solution of the present application rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A camera collision detection method, characterized in that: include: Acquire parameter information of a main camera in a three-dimensional scene, the parameter information including: an observation point, a near section, a far section and a viewing angle of the observation point of the main camera; Determining a picture display area of the main camera and a collision area of the collision camera according to the parameter information; Acquire vertices of a three-dimensional model located within the picture display area from the three-dimensional scene; A collision detection is performed based on the collision area between the vertex and the collision camera.
2. The method according to claim 1, characterized in that The determining, according to the parameter information, a picture display area of the main camera and a collision area of the collision camera includes: Determining a picture display area of the main camera according to a near cross section of the main camera, a far cross section of the main camera, and a viewing angle of the observation point; A collision area of the collision camera is determined according to the observation point of the main camera and the near cross section.
3. The method according to claim 2, characterized in that The step of determining the collision area of the collision camera according to the observation point of the main camera and the near cross section includes: Taking the observation point of the main camera as the near section of the collision camera; Extending the near section of the main camera by a preset distance in a direction away from the observation point to obtain the far section of the collision camera; A collision area of the collision camera is determined according to a near cross section of the collision camera, a far cross section of the collision camera, and a viewing angle of the main camera.
4. The method according to claim 3, characterized in that The determining the collision area of the collision camera according to the near cross section of the collision camera, the far cross section of the collision camera and the viewing angle of the main camera comprises: The area enclosed by the near section of the collision camera, the far section of the collision camera, and the extension line of the viewing angle of the observation point of the main camera is used as the collision area of the collision camera.
5. The method according to claim 1, characterized in that The acquiring, from the three-dimensional scene, vertices of the three-dimensional model located in the picture display area comprises: Obtaining vertex information of the three-dimensional model in the three-dimensional scene in a world coordinate system; According to the vertex information, the vertices located in the picture display area are determined.
6. The method according to claim 5, characterized in that The performing collision detection according to the collision area between the vertex and the collision camera includes: Performing coordinate transformation on the vertices in the screen display area and the collision area of the collision camera to obtain the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system; Collision detection is performed according to the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system.
7. The method according to claim 6, characterized in that The performing collision detection according to the vertices in the view coordinate system and the collision area of the collision camera in the view coordinate system includes: Determine whether the vertex in the view coordinate system is located in the collision area of the collision camera in the view coordinate system; If so, determining that the three-dimensional model corresponding to the vertex collides with the collision camera; If not, it is determined that there is no collision between the three-dimensional model corresponding to the vertex and the collision camera.
8. A camera collision detection device, characterized in that: include: An acquisition module, used to acquire parameter information of a main camera in a three-dimensional scene, wherein the parameter information includes: an observation point, a near section, a far section and a viewing angle of the observation point of the main camera; A determination module, used to determine the image display area of the main camera and the collision area of the collision camera according to the parameter information; The acquisition module is further used to acquire vertices of the three-dimensional model located in the picture display area from the three-dimensional scene; A detection module is used to perform collision detection according to a collision area between the vertex and the collision camera.
9. A camera collision detection device, characterized in that: include: Memory; processor; Wherein, the memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the camera collision detection method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores computer executable instructions, and when the computer executable instructions are executed by the processor, they are used to implement the camera collision detection method according to any one of claims 1 to 7.
