Virtual reality scene rendering method, device, equipment and storage medium
By obtaining the position vector of the optical axis of the virtual camera and the target object, determining the yaw angle and adjusting the rotation angle, and correcting the rotation matrix to redirect the virtual reality scene, the browsing restriction problem of VR equipment when the real space is limited is solved, and the virtual world is realized. The freedom of walking and improved practicality.
Patent Information
- Application Number
- CN202110967704.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-23
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-08-23
AI Technical Summary
When existing VR equipment has limited real-world space, players cannot naturally browse scenes larger than the display space, resulting in reduced practicality.
By obtaining the position vector of the optical axis of the virtual camera and the target object, determining the yaw angle and adjusting the rotation angle, and correcting the rotation matrix to redirect the virtual reality scene, free walking in the virtual world is achieved without exceeding the boundaries of the real space.
It expands the activity space of the virtual world, improves the practicality of VR equipment, and allows players to move freely in the virtual world without exceeding the limitations of real space.
Smart Images

Figure CN113658249B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of virtual reality technology, and in particular relates to a rendering method, device, equipment and storage medium for a virtual reality scene. Background Art
[0002] Virtual Reality (VR) technology is a computer simulation system that can create and experience a virtual world. It uses a computer to generate a simulated environment. It is a multi-source information fusion, interactive three-dimensional dynamic vision and entity behavior system simulation that immerses users in the environment.
[0003] Most current VR devices map the real world to the virtual world in a one-to-one ratio. When the real space is limited, players will be restricted in their movement direction when they encounter barriers, which prevents players from naturally browsing scenes that are larger than the display space, reducing the practicality of VR devices. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device, equipment and storage medium for rendering a virtual reality scene, so as to solve the technical problem in the prior art that when the real space is limited, players cannot naturally browse scenes larger than the display space, thereby reducing the practicality of VR equipment.
[0005] In view of the above problems, the present invention provides a method for rendering a virtual reality scene, comprising:
[0006] Obtaining a position vector of a current position of the target object in the first coordinate system and a position vector of an optical axis of the virtual camera in the first coordinate system;
[0007] Determine the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object;
[0008] Determining an adjusted rotation angle of the target object according to the yaw angle and a preset adjustment coefficient;
[0009] Using the adjustment rotation angle, the first rotation matrix from the first coordinate system to the second coordinate system is corrected to obtain a correction matrix;
[0010] The correction matrix is used to render the current virtual reality scene to obtain a redirected virtual reality scene.
[0011] Furthermore, in the above-mentioned method for rendering a virtual reality scene, determining the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object includes:
[0012] Calculate a second rotation matrix from the position vector of the virtual camera optical axis to the position vector of the current position of the target object;
[0013] The yaw angle of the target object is determined according to the second rotation matrix.
[0014] Furthermore, in the above-mentioned method for rendering a virtual reality scene, the process of setting the adjustment coefficient includes:
[0015] The adjustment coefficient is generated and set according to the angular velocity of the target object, the orientation of the target object and the movable range in the real space.
[0016] Furthermore, in the above-mentioned method for rendering a virtual reality scene, the first rotation matrix from the first coordinate system to the second coordinate system is corrected by adjusting the rotation angle to obtain a correction matrix, including:
[0017] Performing matrix transformation on the adjusted rotation angle to obtain a transformation matrix corresponding to the adjusted rotation angle;
[0018] The product of the conversion matrix and the first rotation matrix is used as the correction matrix.
[0019] Furthermore, in the above-mentioned method for rendering a virtual reality scene, the process of obtaining the position vector of the optical axis of the virtual camera in the first coordinate system includes:
[0020] The product of the third rotation matrix from the second coordinate system to the first coordinate system and the position vector of the virtual camera optical axis is used as the position vector of the virtual camera optical axis in the first coordinate system.
[0021] Furthermore, in the above-mentioned method for rendering a virtual reality scene, obtaining the position vector of the current position of the target object in the first coordinate system and the position vector of the optical axis of the virtual camera in the first coordinate system includes:
[0022] If it is detected that the target object is scanning, the position vector of the current position of the target object in the first coordinate system and the position vector of the optical axis of the virtual camera in the first coordinate system are obtained;
[0023] The process of monitoring whether the target object has a glance includes:
[0024] Obtain a first comparison result between the angular velocity modulus of the target object and a preset threshold, a second comparison result between the sight line displacement of the target object and a preset precision error, and a judgment result of the consistency between the rotation direction of the target object and the gaze direction of the target object; wherein the angular velocity modulus of the target object is determined according to the obtained angular velocity component of the target object, and the sight line displacement of the target object is determined according to the obtained first gaze point coordinates of the target object and the second gaze point coordinates of the target object; the judgment result is determined according to a first product matrix corresponding to the first frame image and a second product matrix corresponding to the second frame image; the first frame image and the second frame image are two adjacent frames; the first product matrix is determined according to the first quaternion of the target object in the first frame image and the first gaze point coordinates of the target object, and the second product matrix is determined according to the second quaternion of the target object in the second frame image and the second gaze point coordinates of the target object;
[0025] Whether the target object has made a scan is determined according to the first comparison result, the second comparison result and the judgment result.
[0026] Furthermore, in the aforementioned virtual reality scene rendering method, determining whether the target object has saccaded according to the first comparison result, the second comparison result and the judgment result includes:
[0027] If the first comparison result indicates that the angular velocity modulus is greater than the preset threshold value, and the second comparison result indicates that the sight line displacement is less than or equal to the preset accuracy error, it is determined that the target object has performed a scan;
[0028] If the first comparison result indicates that the angular velocity modulus is less than or equal to the preset threshold, and the second comparison result indicates that the sight line displacement is greater than a preset accuracy error, it is determined that the target object has performed a scan;
[0029] If the angular velocity modulus of the first comparison result is greater than the preset threshold, the second comparison result indicates that the line of sight displacement is greater than the preset accuracy error, and the judgment result indicates that the rotation direction of the target object is consistent with the gaze direction of the target object, it is determined that the target object has scanned.
[0030] Furthermore, in the above-mentioned method for rendering a virtual reality scene, the first product matrix is determined according to the first quaternion of the target object in the first frame image and the first gaze point coordinates of the target object, including:
[0031] Converting the first quaternion of the target object into a fourth rotation matrix;
[0032] According to the first gaze point coordinates of the target object, an angle between the first sight line and the posture coordinate axis of the first coordinate system is obtained and set as a first Euler angle, and the first Euler angle is converted into a fifth rotation matrix;
[0033] The product of the fourth rotation matrix and the fifth rotation matrix serves as the first product matrix.
[0034] Furthermore, in the above-mentioned method for rendering a virtual reality scene, the second product matrix is determined according to the second quaternion of the target object in the second frame image and the second gaze point coordinates of the target object, including:
[0035] Converting the second quaternion of the target object into a sixth rotation matrix;
[0036] According to the coordinates of the second gaze point of the target object, an angle between the second sight line and the posture coordinate axis of the first coordinate system is obtained and set as a second Euler angle, and the second Euler angle is converted into a seventh rotation matrix;
[0037] The product of the sixth rotation matrix and the seventh rotation matrix is used as the second product matrix.
[0038] Furthermore, in the above-mentioned method for rendering a virtual reality scene, the judgment result is determined according to a first product matrix corresponding to the first frame image and a second product matrix corresponding to the second frame image, including:
[0039] If the first product matrix is equal to the second product matrix, determining that the rotation direction of the target object is inconsistent with the gaze direction of the target object;
[0040] If the product of the first product matrix and the second product matrix is not equal to the second product matrix, it is determined that the rotation direction of the target object is consistent with the gaze direction of the target object.
[0041] The present invention also provides a rendering device for a virtual reality scene, comprising:
[0042] An acquisition module, used to acquire a position vector of a current position of a target object in a first coordinate system and a position vector of an optical axis of a virtual camera in the first coordinate system;
[0043] A yaw angle determination module, used to determine the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object;
[0044] A rotation angle determination module, used to determine the adjusted rotation angle of the target object according to the yaw angle and a preset adjustment coefficient;
[0045] A correction module, used to correct the first rotation matrix from the first coordinate system to the second coordinate system by adjusting the rotation angle to obtain a correction matrix;
[0046] The redirection module is used to render the current virtual reality scene using the correction matrix to obtain a redirected virtual reality scene.
[0047] The present invention also provides a rendering device for a virtual reality scene, characterized in that it includes a memory and a controller;
[0048] The memory stores a computer program, and when the computer program is executed by the controller, the steps of the method for rendering a virtual reality scene as described in any one of the above items are implemented.
[0049] The present invention also provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method for rendering a virtual reality scene as described in any one of the above items are implemented.
[0050] Compared with the prior art, one or more embodiments of the above scheme may have the following advantages or beneficial effects:
[0051] The rendering method, device, equipment and storage medium of the virtual reality scene of the present invention determine the yaw angle of the target object based on obtaining the position vector of the virtual camera optical axis in the first coordinate system and the position vector of the current position of the target object in the first coordinate system, and determine the adjusted rotation angle of the target object based on the yaw angle and a preset adjustment coefficient. Then, the first rotation matrix from the first coordinate system to the second coordinate system is corrected using the adjusted rotation angle, and the current virtual reality scene is rendered using the obtained correction matrix to obtain a redirected virtual reality scene, thereby achieving deflection of the virtual reality scene, guiding the target object to walk freely in the virtual world without exceeding the boundary of the real space, expanding the activity space of the virtual world, and improving the practicality of the VR device.
[0052] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0054] Figure 1 A flowchart of an embodiment of a method for rendering a virtual reality scene of the present invention;
[0055] Figure 2 It is a schematic diagram of the relationship between the position vector of the virtual camera optical axis, the position vector of the current position of the target object and the yaw angle;
[0056] Figure 3 A schematic diagram of the motion trajectory of the target object in the virtual reality scene before and after redirection;
[0057] Figure 4 It is a structural schematic diagram of an embodiment of a rendering device for a virtual reality scene of the present invention. DETAILED DESCRIPTION
[0058] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.
[0059] Embodiment 1
[0060] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention provides a method for rendering a virtual reality scene.
[0061] Figure 1 FIG. 1 is a flow chart of an embodiment of a method for rendering a virtual reality scene of the present invention, as shown in FIG. Figure 1 As shown, the rendering method of the virtual reality scene of this embodiment may specifically include the following steps:
[0062] 100. Obtain a position vector of a current position of a target object in a first coordinate system and a position vector of an optical axis of a virtual camera in the first coordinate system;
[0063] In a specific implementation process, the position sensor can be used to obtain the coordinates of the current position of the target object in the first coordinate system, and according to the center coordinates of the first coordinate system and the coordinates of the current position of the target object, a position vector whose center points to the current position of the target object in the first coordinate system is obtained as the position vector Vector1 (x, y, z) of the current position of the target object in the first coordinate system. The position sensor can be installed on the head, feet and other body parts of the target object. The position sensor can also be installed on a headscarf or clothes worn by the user, which is not specifically limited in this embodiment.
[0064] It should be noted that in this embodiment, the coordinates of the current position of the target object in the first coordinate system can also be obtained by using the surrounding environment sensor, such as using the reflection principle of an infrared sensor to obtain the coordinates of the current position of the target object in the first coordinate system, which will not be explained one by one here.
[0065] In a specific implementation process, the third rotation matrix Rotation from the second coordinate system to the first coordinate system can be w-to-c -1 The product of the position vector Vector(0,0,z) of the virtual camera optical axis is used as the position vector Vector2(x,y,z) of the virtual camera optical axis in the first coordinate system.
[0066] Among them, Vector2(x,y,z)=Rotation w-to-c -1 *Vector(0,0,z).
[0067] It should be noted that the first coordinate system is the coordinate system corresponding to the real space, that is, the coordinate system of the real world, and the real space is the activity space of the target object. The second coordinate system is the coordinate system of the virtual space, that is, the coordinate system of the virtual camera corresponding to the virtual world.
[0068] 101. Determine the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object;
[0069] In a specific implementation process, the second rotation matrix Rotation from the position vector of the virtual camera optical axis to the position vector of the current position of the target object can be calculated. v2-to-v1 ; According to the second rotation matrix Rotation v2-to-v1 , determine the yaw angle yaw of the target object.
[0070] Figure 2 Schematic diagram of the relationship between the position vector of the virtual camera optical axis, the position vector of the current position of the target object and the yaw angle.
[0071] 102. Determine an adjustment rotation angle of the target object according to the yaw angle and a preset adjustment coefficient;
[0072] In a specific implementation process, the adjustment coefficient can be generated and set according to the angular velocity of the target object, the orientation of the target object and the movable range of the real space, and then the product of the yaw angle and the adjustment coefficient is used as the adjustment rotation angle of the target object.
[0073] The calculation formula for generating the adjustment coefficient is as follows:
[0074]
[0075] Among them, a represents the adjustment coefficient, and yaw represents the yaw angle. Indicates the direction of the target object, Angularspeed yThe y-axis component of the angular velocity of the target object, and k represents the movable range in the real space.
[0076] The calculation formula of the adjustment rotation angle of the target object is as follows:
[0077]
[0078] The larger the angular velocity of the target object, the faster it is currently rotating. The larger the angle that can be adjusted in each frame, that is, the larger the adjustment angle. The larger the yaw angle, the smaller the current direction is pointing to the center and does not require much adjustment, that is, the smaller the adjustment angle. The smaller the area of the real space, the larger the adjustment range of each frame, that is, the larger the adjustment angle.
[0079] In a specific implementation process, the area of the real space can be considered as a plan, or it can be calculated by automatic visual recognition, and this embodiment does not make specific restrictions. The area of the real space can be obtained by calculating formula (3):
[0080] k=(1 / S)×r / R (3)
[0081] Among them, S represents the area of the real space, r represents the distance from the current position of the target object to the center of the real space, and R represents the shortest distance from the edge of the real space to the real space. That is to say, for a circular space, the distance from the circular space to the center is the radius. In this case, R can be the radius of the circular space. For a non-circular space, there are multiple distances from the edge of the non-circular space to the center. In this case, just select the shortest distance.
[0082] 103. Using the adjusted rotation angle of the target object, correct the first rotation matrix from the first coordinate system to the second coordinate system to obtain a correction matrix;
[0083] In a specific implementation process, the adjusted rotation angle can be transformed into a matrix to obtain a transformation matrix Rotation corresponding to the adjusted rotation angle. fix ; The obtained transformation matrix Rotation fix The product of the first rotation matrix from the first coordinate system to the second coordinate system is used as the correction matrix Rotation c-to-w -1 *Rotation fix .
[0084] 104. Render the current virtual reality scene using the correction matrix to obtain a redirected virtual reality scene.
[0085] After obtaining the correction matrix, the correction matrix can be used to render the current virtual reality scene to obtain a redirected virtual reality scene. In this way, the virtual reality scene can be deflected, thereby guiding the target object to walk roughly in a straight line in the virtual world according to the deflected virtual reality scene, while actually constantly circling in the real space, achieving the effect of breaking through the limitations of the real space.
[0086] Figure 3 is a schematic diagram of the motion trajectory of the target object in the virtual reality scene before and after redirection, such as Figure 3 The original motion trajectory shown is line OA, and the adjusted trajectory is line OB.
[0087] The rendering method of the virtual reality scene of the present embodiment determines the yaw angle of the target object by obtaining the position vector of the virtual camera optical axis in the first coordinate system and the position vector of the current position of the target object in the first coordinate system, and determines the adjusted rotation angle of the target object according to the yaw angle and a preset adjustment coefficient. Then, the first rotation matrix from the first coordinate system to the second coordinate system is corrected by using the adjusted rotation angle, so as to render the current virtual reality scene by using the obtained correction matrix to obtain a redirected virtual reality scene, thereby realizing the deflection of the virtual reality scene, guiding the target object to walk freely in the virtual world without exceeding the boundary of the real space, expanding the activity space of the virtual world, and improving the practicality of the VR device.
[0088] In a specific implementation process, saccadic inhibition is a visual characteristic of the human eye. It is a kind of eye movement when both eyes move quickly at the same time, which may be accompanied by the movement of the head, neck or other parts of the body. When saccadic inhibition occurs, visual sensitivity will be greatly reduced, and spatial perception ability will also be greatly reduced. When saccadic inhibition occurs, visual sensitivity will be greatly reduced, and spatial perception ability will also be greatly reduced. Therefore, when saccadic inhibition occurs, the virtual reality scene can be redirected using the rendering method of the virtual reality scene of the present application.
[0089] Specifically, step 100 of "obtaining the position vector of the current position of the target object in the first coordinate system and the position vector of the virtual camera optical axis in the first coordinate system" may include: if it is detected that the target object has glanced, obtaining the position vector of the current position of the target object in the first coordinate system and the position vector of the virtual camera optical axis in the first coordinate system.
[0090] In a specific implementation process, the process of monitoring whether the target object has made a glance includes:
[0091] (a) obtaining a first comparison result of the angular velocity modulus of the target object and a preset threshold, a second comparison result of the sight line displacement of the target object and a preset accuracy error, and a judgment result of the consistency between the rotation direction of the target object and the gaze direction of the target object;
[0092] Specifically, the angular velocity component of the target object, the first quaternion of the target object, the second quaternion of the target object, the first gaze point coordinates of the target object and the second gaze point coordinates of the target object can be obtained; wherein the first quaternion of the target object and the second quaternion of the target object are the quaternions in two adjacent frames of images; the first gaze point coordinates of the target object and the second gaze point coordinates of the target object are the gaze point coordinates in two adjacent frames of images.
[0093] In a specific implementation process, the gyroscope module can be used to collect the angular velocity component of the target object, the first quaternion of the target object, and the second quaternion of the target object. The eye tracking module can be used to collect the first gaze point coordinates of the target object and the second gaze point coordinates of the target object.
[0094] In a specific implementation process, it can be determined whether the determined angular velocity modulus is greater than a preset threshold, whether the sight line displacement of the target object is greater than a preset precision error, and whether the rotation direction of the target object is opposite to the gaze direction of the target object based on the determined first product matrix corresponding to the first frame image and the second product matrix corresponding to the second frame image.
[0095] In a specific implementation process, the angular velocity modulus can be determined according to the angular velocity component of the target object. The corresponding calculation formula is as follows:
[0096]
[0097] Angularspeed represents the angular velocity of the target object. x Represents the x-axis component of the angular velocity of the target object, Angularspeed y Represents the y-axis component of the angular velocity of the target object, Angularspeed z The y-axis component of the angular velocity of the target object is represented. After obtaining the angular velocity modulus, it can be determined whether the determined angular velocity modulus is greater than a preset threshold, wherein the threshold is related to the accuracy of the gyroscope module. The higher the accuracy of the gyroscope module, the smaller the threshold, and the lower the accuracy of the gyroscope module, the larger the threshold.
[0098] The displacement between the first gaze point coordinates and the second gaze point coordinates of the target object can be determined as the sight line displacement of the target object. After obtaining the sight line displacement, it can be determined whether the sight line displacement of the target object is greater than a preset accuracy error.
[0099] A first product matrix can be determined according to the first quaternion of the target object and the first gaze point coordinates of the target object, and a second product matrix can be determined according to the second quaternion of the target object and the second gaze point coordinates of the target object. And according to the determined first product matrix corresponding to the first frame image and the second product matrix corresponding to the second frame image, it is determined whether the rotation direction of the target object is opposite to the gaze direction of the target object.
[0100] In a specific implementation process, the first quaternion of the target object can be converted into a fourth rotation matrix Matrix1; according to the first gaze point coordinates of the target object, the angle between the first line of sight and the posture coordinate axis of the first coordinate system is set as the first Euler angle, and the first Euler angle is converted into the fifth rotation matrix Rotation1; the product of the fourth rotation matrix Matrix1 and the fifth rotation matrix Rotation1 is used as the first product matrix.
[0101] Similarly, the second quaternion of the target object is converted into the sixth rotation matrix Matrix2; according to the second gaze point coordinates of the target object, the angle between the second line of sight and the posture coordinate axis of the first coordinate system is set as the second Euler angle, and the second Euler angle is converted into the seventh rotation matrix Rotation2; the product of the sixth rotation matrix Matrix2 and the seventh rotation matrix Rotation2 is used as the second product matrix.
[0102] In a specific implementation process, if the first product matrix is equal to the second product matrix, it is determined that the rotation direction of the target object is inconsistent with the gaze direction of the target object; if the product of the first product matrix and the second product matrix is not equal to the second product matrix, it is determined that the rotation direction of the target object is consistent with the gaze direction of the target object.
[0103] (b) Determine whether the target object has made a scan based on the first comparison result, the second comparison result and the judgment result.
[0104] In a specific implementation process, if the first comparison result indicates that the angular velocity modulus is greater than a preset threshold, and the second comparison result indicates that the sight displacement is less than or equal to a preset accuracy error, it is determined that the target object has saccaded;
[0105] If the first comparison result indicates that the angular velocity modulus is less than or equal to a preset threshold value, and the second comparison result indicates that the sight displacement is greater than a preset precision error, it is determined that the target object has performed a scan;
[0106] If the angular velocity modulus of the first comparison result is greater than a preset threshold, the second comparison result indicates that the sight displacement is greater than a preset precision error, and the judgment result indicates that the rotation direction of the target object is consistent with the gaze direction of the target object, it is determined that the target object has saccaded;
[0107] If the angular velocity modulus of the first comparison result is greater than a preset threshold, the second comparison result indicates that the sight displacement is greater than a preset precision error, and the judgment result indicates that the rotation direction of the target object is inconsistent with the gaze direction of the target object, it is determined that the target object has not made a saccade;
[0108] If the first comparison result indicates that the angular velocity modulus is less than or equal to a preset threshold, and the second comparison result indicates that the sight line displacement is less than or equal to a preset accuracy error, it is determined that the target object has not performed a scan.
[0109] It should be noted that the method of the embodiment of the present invention can be performed by a single device, such as a computer or a server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present invention, and the multiple devices will interact with each other to complete the method.
[0110] Embodiment 2
[0111] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention provides a rendering device for a virtual reality scene.
[0112] Figure 4 FIG. 1 is a schematic diagram of a structure of an embodiment of a rendering device for a virtual reality scene of the present invention. Figure 4 As shown, the rendering device of the virtual reality scene of this embodiment may include an acquisition module 40, a yaw angle determination module 41, a rotation angle determination module 42, a correction module 43 and a redirection module 44.
[0113] An acquisition module 40 is used to acquire a position vector of a current position of a target object in a first coordinate system and a position vector of an optical axis of a virtual camera in the first coordinate system;
[0114] In a specific implementation process, the acquisition module 40 can use a position sensor to acquire the coordinates of the current position of the target object in the first coordinate system, and obtain a position vector with the center of the first coordinate system pointing to the current position of the target object based on the center coordinates of the first coordinate system and the coordinates of the current position of the target object as the position vector of the current position of the target object in the first coordinate system.
[0115] The acquisition module 40 may also use the product of the third rotation matrix from the second coordinate system to the first coordinate system and the position vector of the virtual camera optical axis as the position vector of the virtual camera optical axis in the first coordinate system.
[0116] A yaw angle determination module 41, used to determine the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object;
[0117] Specifically, the yaw angle determination module 41 may calculate a second rotation matrix from the position vector of the virtual camera optical axis to the position vector of the current position of the target object; and determine the yaw angle of the target object according to the second rotation matrix.
[0118] A rotation angle determination module 42, configured to determine an adjusted rotation angle of the target object according to the yaw angle and a preset adjustment coefficient;
[0119] In a specific implementation process, the rotation angle determination module 42 can generate the adjustment coefficient according to the angular velocity of the target object, the orientation of the target object and the movable range in the real space, and determine the adjusted rotation angle of the target object according to the yaw angle and the preset adjustment coefficient.
[0120] A correction module 43, used to correct the first rotation matrix from the first coordinate system to the second coordinate system by using the adjustment rotation angle to obtain a correction matrix;
[0121] In a specific implementation process, the correction module 43 may perform matrix transformation on the adjusted rotation angle to obtain a transformation matrix corresponding to the adjusted rotation angle; and use the product of the transformation matrix and the first rotation matrix as the correction matrix.
[0122] The redirection module 44 is used to render the current virtual reality scene using the correction matrix to obtain a redirected virtual reality scene.
[0123] The rendering device of the virtual reality scene of the present embodiment determines the yaw angle of the target object by acquiring the position vector of the optical axis of the virtual camera in the first coordinate system and the position vector of the current position of the target object in the first coordinate system, and determines the adjusted rotation angle of the target object according to the yaw angle and the preset adjustment coefficient. Then, the first rotation matrix from the first coordinate system to the second coordinate system is corrected by using the adjusted rotation angle, and the current virtual reality scene is rendered by using the obtained correction matrix to obtain a redirected virtual reality scene, thereby realizing the deflection of the virtual reality scene, guiding the target object to walk freely in the virtual world without exceeding the boundary of the real space, expanding the activity space of the virtual world, and improving the practicality of the VR device.
[0124] In a specific implementation process, the acquisition module 40 is specifically used to acquire the position vector of the current position of the target object in the first coordinate system and the position vector of the optical axis of the virtual camera in the first coordinate system if the target object is detected to have glanced. The monitoring process of whether the target object has glanced includes:
[0125] (a) obtaining a first comparison result of the angular velocity modulus of the target object and a preset threshold, a second comparison result of the sight line displacement of the target object and a preset accuracy error, and a judgment result of the consistency between the rotation direction of the target object and the gaze direction of the target object;
[0126] Specifically, the angular velocity component of the target object, the first quaternion of the target object, the second quaternion of the target object, the first gaze point coordinates of the target object and the second gaze point coordinates of the target object can be obtained; wherein the first quaternion of the target object and the second quaternion of the target object are the quaternions in two adjacent frames of images; the first gaze point coordinates of the target object and the second gaze point coordinates of the target object are the gaze point coordinates in two adjacent frames of images.
[0127] In a specific implementation process, the gyroscope module can be used to collect the angular velocity component of the target object, the first quaternion of the target object, and the second quaternion of the target object. The eye tracking module can be used to collect the first gaze point coordinates of the target object and the second gaze point coordinates of the target object.
[0128] In a specific implementation process, it can be determined whether the determined angular velocity modulus is greater than a preset threshold, whether the sight line displacement of the target object is greater than a preset precision error, and whether the rotation direction of the target object is opposite to the gaze direction of the target object based on the determined first product matrix corresponding to the first frame image and the second product matrix corresponding to the second frame image.
[0129] In a specific implementation process, the angular velocity modulus can be determined according to the angular velocity component of the target object. The corresponding formula (4) is:
[0130] The displacement between the first gaze point coordinates and the second gaze point coordinates of the target object can be determined as the sight line displacement of the target object. After obtaining the sight line displacement, it can be determined whether the sight line displacement of the target object is greater than a preset accuracy error.
[0131] A first product matrix can be determined according to the first quaternion of the target object and the first gaze point coordinates of the target object, and a second product matrix can be determined according to the second quaternion of the target object and the second gaze point coordinates of the target object. And according to the determined first product matrix corresponding to the first frame image and the second product matrix corresponding to the second frame image, it is determined whether the rotation direction of the target object is opposite to the gaze direction of the target object.
[0132] In a specific implementation process, the first quaternion of the target object can be converted into a fourth rotation matrix Matrix1; according to the first gaze point coordinates of the target object, the angle between the first line of sight and the posture coordinate axis of the first coordinate system is set as the first Euler angle, and the first Euler angle is converted into the fifth rotation matrix Rotation1; the product of the fourth rotation matrix Matrix1 and the fifth rotation matrix Rotation1 is used as the first product matrix.
[0133] Similarly, the second quaternion of the target object is converted into the sixth rotation matrix Matrix2; according to the second gaze point coordinates of the target object, the angle between the second line of sight and the posture coordinate axis of the first coordinate system is set as the second Euler angle, and the second Euler angle is converted into the seventh rotation matrix Rotation2; the product of the sixth rotation matrix Matrix2 and the seventh rotation matrix Rotation2 is used as the second product matrix.
[0134] In a specific implementation process, if the first product matrix is equal to the second product matrix, it is determined that the rotation direction of the target object is inconsistent with the gaze direction of the target object; if the product of the first product matrix and the second product matrix is not equal to the second product matrix, it is determined that the rotation direction of the target object is consistent with the gaze direction of the target object.
[0135] (b) Determine whether the target object has made a scan based on the first comparison result, the second comparison result and the judgment result.
[0136] In a specific implementation process, if the first comparison result indicates that the angular velocity modulus is greater than a preset threshold, and the second comparison result indicates that the sight displacement is less than or equal to a preset accuracy error, it is determined that the target object has saccaded;
[0137] If the first comparison result indicates that the angular velocity modulus is less than or equal to a preset threshold value, and the second comparison result indicates that the sight displacement is greater than a preset precision error, it is determined that the target object has performed a scan;
[0138] If the angular velocity modulus of the first comparison result is greater than a preset threshold, the second comparison result indicates that the sight displacement is greater than a preset precision error, and the judgment result indicates that the rotation direction of the target object is consistent with the gaze direction of the target object, it is determined that the target object has saccaded;
[0139] If the angular velocity modulus of the first comparison result is greater than a preset threshold, the second comparison result indicates that the sight displacement is greater than a preset precision error, and the judgment result indicates that the rotation direction of the target object is inconsistent with the gaze direction of the target object, it is determined that the target object has not made a saccade;
[0140] If the first comparison result indicates that the angular velocity modulus is less than or equal to a preset threshold, and the second comparison result indicates that the sight line displacement is less than or equal to a preset accuracy error, it is determined that the target object has not performed a scan.
[0141] The device of the above embodiment is used to implement the corresponding method in the above embodiment. Its specific implementation scheme can refer to the method recorded in the above embodiment and the relevant description in the method embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0142] Embodiment 3
[0143] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention provides a rendering device for a virtual reality scene, and the rendering device for the virtual reality scene includes a memory and a controller;
[0144] The memory stores a computer program, which, when executed by the controller, implements the steps of the method for rendering a virtual reality scene in the above embodiment.
[0145] Embodiment 4
[0146] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention provides a storage medium.
[0147] The storage medium of this embodiment stores a computer program, and when the computer program is executed by the controller, the steps of the method for rendering a virtual reality scene in the above embodiment are implemented.
[0148] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0149] It should be noted that, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "plurality" refers to at least two.
[0150] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0151] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0152] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0153] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0154] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0155] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0156] Although the embodiments disclosed in the present invention are as above, the contents described are only embodiments adopted for facilitating the understanding of the present invention and are not intended to limit the present invention. Any technician in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present invention, but the protection scope of the present invention shall still be subject to the scope defined in the attached claims.
Claims
1. A method for rendering a virtual reality scene, characterized in that: include: Obtaining a position vector of a current position of the target object in the first coordinate system and a position vector of an optical axis of the virtual camera in the first coordinate system; Determine the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object; Determining an adjusted rotation angle of the target object according to the yaw angle and a preset adjustment coefficient; Using the adjustment rotation angle, the first rotation matrix from the first coordinate system to the second coordinate system is corrected to obtain a correction matrix; The correction matrix is used to render the current virtual reality scene to obtain a redirected virtual reality scene.
2. The method for rendering a virtual reality scene according to claim 1, characterized in that: Determining the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object includes: Calculate a second rotation matrix from the position vector of the virtual camera optical axis to the position vector of the current position of the target object; The yaw angle of the target object is determined according to the second rotation matrix.
3. The method for rendering a virtual reality scene according to claim 1, characterized in that: The process of setting the adjustment coefficient includes: The adjustment coefficient is generated and set according to the angular velocity of the target object, the orientation of the target object and the movable range in the real space.
4. The method for rendering a virtual reality scene according to claim 1, characterized in that: The first rotation matrix from the first coordinate system to the second coordinate system is corrected by adjusting the rotation angle to obtain a correction matrix, including: Performing matrix transformation on the adjusted rotation angle to obtain a transformation matrix corresponding to the adjusted rotation angle; The product of the conversion matrix and the first rotation matrix is used as the correction matrix.
5. The method for rendering a virtual reality scene according to claim 1, characterized in that: The process of obtaining the position vector of the virtual camera optical axis in the first coordinate system includes: The product of the third rotation matrix from the second coordinate system to the first coordinate system and the position vector of the virtual camera optical axis is used as the position vector of the virtual camera optical axis in the first coordinate system.
6. The method for rendering a virtual reality scene according to claim 1, characterized in that: Obtaining the position vector of the current position of the target object in the first coordinate system and the position vector of the optical axis of the virtual camera in the first coordinate system, including: If it is detected that the target object is scanning, the position vector of the current position of the target object in the first coordinate system and the position vector of the optical axis of the virtual camera in the first coordinate system are obtained; The process of monitoring whether the target object has a glance includes: Obtain a first comparison result between the angular velocity modulus of the target object and a preset threshold, a second comparison result between the sight line displacement of the target object and a preset precision error, and a judgment result of the consistency between the rotation direction of the target object and the gaze direction of the target object; wherein the angular velocity modulus of the target object is determined according to the obtained angular velocity component of the target object, and the sight line displacement of the target object is determined according to the obtained first gaze point coordinates of the target object and the second gaze point coordinates of the target object; the judgment result is determined according to a first product matrix corresponding to the first frame image and a second product matrix corresponding to the second frame image; the first frame image and the second frame image are two adjacent frames; the first product matrix is determined according to the first quaternion of the target object in the first frame image and the first gaze point coordinates of the target object, and the second product matrix is determined according to the second quaternion of the target object in the second frame image and the second gaze point coordinates of the target object; Whether the target object has made a scan is determined according to the first comparison result, the second comparison result and the judgment result.
7. The method for rendering a virtual reality scene according to claim 6, characterized in that: Determining whether the target object has a scan according to the first comparison result, the second comparison result, and the judgment result includes: If the first comparison result indicates that the angular velocity modulus is greater than the preset threshold value, and the second comparison result indicates that the sight line displacement is less than or equal to the preset accuracy error, it is determined that the target object has performed a scan; If the first comparison result indicates that the angular velocity modulus is less than or equal to the preset threshold, and the second comparison result indicates that the sight line displacement is greater than a preset accuracy error, it is determined that the target object has performed a scan; If the angular velocity modulus of the first comparison result is greater than the preset threshold, the second comparison result indicates that the line of sight displacement is greater than the preset accuracy error, and the judgment result indicates that the rotation direction of the target object is consistent with the gaze direction of the target object, it is determined that the target object has scanned.
8. The method for rendering a virtual reality scene according to claim 6, characterized in that: The first product matrix is determined according to the first quaternion of the target object in the first frame image and the first gaze point coordinates of the target object, including: Converting the first quaternion of the target object into a fourth rotation matrix; According to the first gaze point coordinates of the target object, an angle between the first sight line and the posture coordinate axis of the first coordinate system is obtained and set as a first Euler angle, and the first Euler angle is converted into a fifth rotation matrix; The product of the fourth rotation matrix and the fifth rotation matrix serves as the first product matrix.
9. The method for rendering a virtual reality scene according to claim 6, characterized in that: The second product matrix is determined according to the second quaternion of the target object in the second frame image and the second gaze point coordinates of the target object, including: Converting the second quaternion of the target object into a sixth rotation matrix; According to the coordinates of the second gaze point of the target object, an angle between the second sight line and the posture coordinate axis of the first coordinate system is obtained and set as a second Euler angle, and the second Euler angle is converted into a seventh rotation matrix; The product of the sixth rotation matrix and the seventh rotation matrix is used as the second product matrix.
10. The method for rendering a virtual reality scene according to claim 6, characterized in that: The judgment result is determined according to a first product matrix corresponding to the first frame image and a second product matrix corresponding to the second frame image, including: If the first product matrix is equal to the second product matrix, determining that the rotation direction of the target object is inconsistent with the gaze direction of the target object; If the product of the first product matrix and the second product matrix is not equal to the second product matrix, it is determined that the rotation direction of the target object is consistent with the gaze direction of the target object.
11. A rendering device for a virtual reality scene, characterized in that: include: An acquisition module, used to acquire a position vector of a current position of a target object in a first coordinate system and a position vector of an optical axis of a virtual camera in the first coordinate system; A yaw angle determination module, used to determine the yaw angle of the target object according to the position vector of the virtual camera optical axis and the position vector of the current position of the target object; A rotation angle determination module, used to determine the adjusted rotation angle of the target object according to the yaw angle and a preset adjustment coefficient; A correction module, used to correct the first rotation matrix from the first coordinate system to the second coordinate system by using the adjustment rotation angle to obtain a correction matrix; The redirection module is used to render the current virtual reality scene using the correction matrix to obtain a redirected virtual reality scene.
12. A rendering device for a virtual reality scene, characterized in that: including a memory and a controller; The memory stores a computer program, which, when executed by the controller, implements the steps of the method for rendering a virtual reality scene according to any one of claims 1 to 10.
13. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for rendering a virtual reality scene according to any one of claims 1 to 10 are implemented.
