CN113384880A - Virtual scene display method, device, computer equipment and storage medium - Google Patents
Virtual scene display method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN113384880A CN113384880A CN202011233140.5A CN202011233140A CN113384880A CN 113384880 A CN113384880 A CN 113384880A CN 202011233140 A CN202011233140 A CN 202011233140A CN 113384880 A CN113384880 A CN 113384880A
- Authority
- CN
- China
- Prior art keywords
- dimensional virtual
- virtual object
- coordinate system
- virtual
- dimensional
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/55—Controlling game characters or game objects based on the game progress
- A63F13/56—Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Processing Or Creating Images (AREA)
Abstract
本申请实施例公开了一种虚拟场景显示方法、装置、计算机设备及存储介质,属于计算机技术领域。该方法包括:显示第一虚拟场景图像,第一虚拟场景图像由虚拟摄像机对虚拟场景进行拍摄得到,虚拟摄像机所拍摄的图像呈现近大远小的效果;响应于虚拟摄像机的视场角发生变化,基于二维虚拟对象在第一虚拟场景图像中的第一显示位置,获取二维虚拟对象的第二显示位置,显示第二虚拟场景图像,在第二虚拟场景图像中的第二显示位置上显示有二维虚拟对象。在虚拟摄像机的视场角发生变化时,对虚拟场景图像中的二维虚拟对象的显示位置进行修正,虚拟场景图像既呈现三维效果,又能保证二维虚拟对象的显示位置准确,从而提升了虚拟场景的显示效果。
The embodiments of the present application disclose a virtual scene display method, device, computer equipment and storage medium, which belong to the technical field of computers. The method includes: displaying a first virtual scene image, the first virtual scene image is obtained by photographing the virtual scene by a virtual camera, and the image photographed by the virtual camera presents the effect of large near and far small; in response to the change of the field of view of the virtual camera , based on the first display position of the two-dimensional virtual object in the first virtual scene image, obtain the second display position of the two-dimensional virtual object, display the second virtual scene image, and display the second virtual scene image at the second display position in the second virtual scene image A two-dimensional virtual object is displayed. When the field of view of the virtual camera changes, the display position of the two-dimensional virtual object in the virtual scene image is corrected. The virtual scene image not only presents a three-dimensional effect, but also ensures that the display position of the two-dimensional virtual object is accurate, thereby improving the performance of the two-dimensional virtual object. The display effect of the virtual scene.
Description
技术领域technical field
本申请实施例涉及计算机技术领域,特别涉及一种虚拟场景显示方法、装置、计算机设备及存储介质。The embodiments of the present application relate to the field of computer technologies, and in particular, to a virtual scene display method, apparatus, computer device, and storage medium.
背景技术Background technique
随着计算机技术的发展,电子游戏的种类越来越丰富多样。在一些电子游戏中,由虚拟正交相机拍摄虚拟场景,显示拍摄到的虚拟场景图像。但在该虚拟场景图像包括虚拟场景中的虚拟物品,均是以虚拟物品的原尺寸显示的,例如,在虚拟场景图像中包括多个相同的虚拟椅子,无论虚拟椅子在虚拟场景图像中任何位置,多个虚拟椅子均是以相同的尺寸进行显示,从而导致虚拟场景图像缺乏层次感,显示效果差。With the development of computer technology, the types of video games are becoming more and more diverse. In some video games, a virtual scene is captured by a virtual orthographic camera, and the captured image of the virtual scene is displayed. However, the virtual scene image including the virtual items in the virtual scene is displayed in the original size of the virtual item. For example, the virtual scene image includes multiple identical virtual chairs, no matter where the virtual chairs are in the virtual scene image. , multiple virtual chairs are displayed in the same size, resulting in a lack of hierarchy in the virtual scene image and poor display effect.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种虚拟场景显示方法、装置、计算机设备及存储介质,能够提升虚拟场景的显示效果。所述技术方案如下:Embodiments of the present application provide a method, apparatus, computer equipment and storage medium for displaying a virtual scene, which can improve the display effect of the virtual scene. The technical solution is as follows:
一方面,提供了一种虚拟场景显示方法,所述方法包括:In one aspect, a method for displaying a virtual scene is provided, the method comprising:
显示第一虚拟场景图像,所述第一虚拟场景图像包括虚拟场景中的二维虚拟对象,所述第一虚拟场景图像由虚拟摄像机对所述虚拟场景进行拍摄得到,所述虚拟摄像机所拍摄的图像呈现近大远小的效果;A first virtual scene image is displayed, the first virtual scene image includes a two-dimensional virtual object in the virtual scene, the first virtual scene image is obtained by shooting the virtual scene by a virtual camera, and the image captured by the virtual camera is The image presents the effect of near big and far small;
响应于所述虚拟摄像机的视场角发生变化,基于所述二维虚拟对象在所述第一虚拟场景图像中的第一显示位置,获取所述二维虚拟对象的第二显示位置;Acquiring a second display position of the two-dimensional virtual object based on the first display position of the two-dimensional virtual object in the first virtual scene image in response to the change in the field of view of the virtual camera;
显示第二虚拟场景图像,在所述第二虚拟场景图像中的所述第二显示位置上显示有所述二维虚拟对象。A second virtual scene image is displayed, and the two-dimensional virtual object is displayed on the second display position in the second virtual scene image.
另一方面,提供了一种虚拟场景显示装置,所述装置包括:In another aspect, a virtual scene display device is provided, the device comprising:
图像显示模块,用于显示第一虚拟场景图像,所述第一虚拟场景图像包括虚拟场景中的二维虚拟对象,所述第一虚拟场景图像由虚拟摄像机对所述虚拟场景进行拍摄得到,所述虚拟摄像机所拍摄的图像呈现近大远小的效果;An image display module, configured to display a first virtual scene image, where the first virtual scene image includes a two-dimensional virtual object in the virtual scene, and the first virtual scene image is obtained by photographing the virtual scene by a virtual camera. The image captured by the virtual camera presents the effect of near big and far small;
第一位置获取模块,用于响应于所述虚拟摄像机的视场角发生变化,基于所述二维虚拟对象在所述第一虚拟场景图像中的第一显示位置,获取所述二维虚拟对象的第二显示位置;a first position acquisition module, configured to acquire the two-dimensional virtual object based on the first display position of the two-dimensional virtual object in the first virtual scene image in response to the change of the field of view of the virtual camera the second display position of ;
所述图像显示模块,还用于显示第二虚拟场景图像,在所述第二虚拟场景图像中的所述第二显示位置上显示有所述二维虚拟对象。The image display module is further configured to display a second virtual scene image, and the two-dimensional virtual object is displayed on the second display position in the second virtual scene image.
在一种可能实现方式中,所述第一位置获取模块,包括:In a possible implementation, the first location acquisition module includes:
第一矩阵确定单元,用于响应于所述虚拟摄像机的视场角由第一视场角变化为第二视场角,基于所述第一视场角及所述第二视场角,确定所述二维虚拟对象对应的视场角变换矩阵,所述视场角变换矩阵用于指示所述虚拟摄像机的视场角变化的情况;a first matrix determination unit, configured to determine, in response to the change of the view angle of the virtual camera from the first view angle to the second view angle, based on the first view angle and the second view angle A field of view angle transformation matrix corresponding to the two-dimensional virtual object, where the field of view angle transformation matrix is used to indicate the change of the field of view angle of the virtual camera;
第一位置获取单元,用于基于所述第一显示位置及所述视场角变换矩阵,获取所述二维虚拟对象的第二显示位置。A first position obtaining unit, configured to obtain a second display position of the two-dimensional virtual object based on the first display position and the viewing angle transformation matrix.
在另一种可能实现方式中,所述第一矩阵确定单元,用于将所述第一视场角的投影矩阵与所述第二视场角的投影矩阵进行融合,得到所述视场角变换矩阵。In another possible implementation, the first matrix determination unit is configured to fuse the projection matrix of the first angle of view and the projection matrix of the second angle of view to obtain the angle of view Transformation matrix.
在另一种可能实现方式中,所述第一位置获取单元,用于基于所述第一视场角,确定所述二维虚拟对象的参考点在第一坐标系下的目标坐标,所述第一坐标系为所述虚拟相机在所述第一视场角下的坐标系;获取所述二维虚拟对象在所述第一坐标系下的第一偏移矩阵,所述第一偏移矩阵包括所述二维虚拟对象的多个点与所述参考点在所述第一坐标系下的偏移量,所述多个点构成所述二维虚拟对象;基于所述目标坐标、所述第一偏移矩阵及所述视角变换矩阵,确定所述第二显示位置。In another possible implementation manner, the first position acquisition unit is configured to determine, based on the first angle of view, the target coordinates of the reference point of the two-dimensional virtual object in the first coordinate system, the The first coordinate system is the coordinate system of the virtual camera under the first field of view; obtain a first offset matrix of the two-dimensional virtual object under the first coordinate system, the first offset The matrix includes offsets between multiple points of the two-dimensional virtual object and the reference point in the first coordinate system, and the multiple points constitute the two-dimensional virtual object; based on the target coordinates, the The first offset matrix and the viewing angle transformation matrix are used to determine the second display position.
在另一种可能实现方式中,所述第一位置获取单元,用于获取所述二维虚拟对象在第二坐标系下的第二偏移矩阵,所述第二坐标系为所述二维虚拟对象的坐标系,所述第二偏移矩阵包括所述二维虚拟对象的多个点与所述参考点在所述第二坐标系下的偏移量;对所述第二偏移矩阵进行坐标系变换,得到所述第一偏移矩阵。In another possible implementation, the first position acquiring unit is configured to acquire a second offset matrix of the two-dimensional virtual object in a second coordinate system, where the second coordinate system is the two-dimensional the coordinate system of the virtual object, the second offset matrix includes the offsets between the multiple points of the two-dimensional virtual object and the reference point in the second coordinate system; for the second offset matrix Perform coordinate system transformation to obtain the first offset matrix.
在另一种可能实现方式中,所述第一位置获取单元,用于获取所述二维虚拟对象的参考点在第二坐标系下的参考坐标,所述第二坐标系为所述二维虚拟对象的坐标系;对所述参考坐标进行坐标系变换,得到所述目标坐标。In another possible implementation, the first position acquiring unit is configured to acquire the reference coordinates of the reference point of the two-dimensional virtual object in a second coordinate system, and the second coordinate system is the two-dimensional The coordinate system of the virtual object; the coordinate system transformation is performed on the reference coordinates to obtain the target coordinates.
在另一种可能实现方式中,所述装置还包括:In another possible implementation, the apparatus further includes:
变化量确定模块,用于确定所述第二显示位置与所述第一显示位置之间的位置变化量;a change amount determination module, configured to determine the position change amount between the second display position and the first display position;
位置调整模块,用于根据所述位置变化量,调整所述二维虚拟对象在所述虚拟场景中的位置;a position adjustment module, configured to adjust the position of the two-dimensional virtual object in the virtual scene according to the position change;
场景渲染模块,用于渲染所述虚拟摄像机在视场角变化后拍摄到的虚拟场景,得到所述第二虚拟场景图像。A scene rendering module, configured to render the virtual scene captured by the virtual camera after the angle of view is changed, to obtain the second virtual scene image.
在另一种可能实现方式中,所述二维虚拟对象手持的二维虚拟物品;所述装置还包括:In another possible implementation, the two-dimensional virtual object is held by the two-dimensional virtual object; the apparatus further includes:
第二位置获取模块,用于基于所述二维虚拟物品与所述二维虚拟对象在所述第一虚拟场景图像中的相对显示位置,获取所述二维虚拟物品的第三显示位置;a second position obtaining module, configured to obtain a third display position of the two-dimensional virtual item based on the relative display positions of the two-dimensional virtual item and the two-dimensional virtual object in the first virtual scene image;
物品显示模块,用于在所述第二虚拟场景图像中所述第三显示位置上,显示所述二维虚拟物品。The item display module is configured to display the two-dimensional virtual item on the third display position in the second virtual scene image.
在另一种可能实现方式中,所述第二位置获取模块,包括:In another possible implementation manner, the second location acquisition module includes:
第二矩阵确定单元,用于响应于所述虚拟摄像机的视场角由第一视场角变化为第二视场角,基于所述第一视场角及所述第二视场角,确定所述二维虚拟对象对应的视场角变换矩阵,所述视场角变换矩阵用于指示所述虚拟摄像机的视场角变化的情况;A second matrix determining unit, configured to determine, in response to the change of the view angle of the virtual camera from the first view angle to the second view angle, based on the first view angle and the second view angle A field of view angle transformation matrix corresponding to the two-dimensional virtual object, where the field of view angle transformation matrix is used to indicate the change of the field of view angle of the virtual camera;
第二位置获取单元,用于基于所述相对显示位置及所述视场角变换矩阵,获取所述二维虚拟物品的所述第三显示位置。A second position obtaining unit, configured to obtain the third display position of the two-dimensional virtual item based on the relative display position and the viewing angle transformation matrix.
在另一种可能实现方式中,所述第二位置获取单元,用于获取所述二维虚拟对象的参考点与所述二维虚拟物品的参考点在第一坐标系下的目标偏移量,所述第一坐标系为所述虚拟相机在所述第一视场角下的坐标系;获取所述二维虚拟物品在所述第一坐标系下的第三偏移矩阵,所述第三偏移矩阵包括所述二维虚拟物品的多个点与所述二维虚拟对象的参考点在所述第一坐标系下的偏移量,所述多个点构成所述二维虚拟物品;基于所述目标偏移量、所述第三偏移矩阵及所述视角变换矩阵,确定所述第三显示位置。In another possible implementation, the second position acquisition unit is configured to acquire a target offset between the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual item in the first coordinate system , the first coordinate system is the coordinate system of the virtual camera under the first field of view; the third offset matrix of the two-dimensional virtual item under the first coordinate system is obtained, and the third offset matrix is obtained. The three offset matrix includes the offsets between a plurality of points of the two-dimensional virtual object and a reference point of the two-dimensional virtual object in the first coordinate system, and the plurality of points constitute the two-dimensional virtual object ; determining the third display position based on the target offset, the third offset matrix and the viewing angle transformation matrix.
在另一种可能实现方式中,所述第二位置获取单元,用于获取所述二维虚拟对象的参考点与所述二维虚拟物品的参考点在第三坐标系下的参考偏移量,所述第三坐标系为所述二维虚拟物品的坐标系;对所述参考偏移量进行坐标系变换,得到所述目标偏移量。In another possible implementation, the second position acquisition unit is configured to acquire a reference offset between the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual item in a third coordinate system , the third coordinate system is the coordinate system of the two-dimensional virtual item; the coordinate system transformation is performed on the reference offset to obtain the target offset.
在另一种可能实现方式中,所述第二位置获取单元,用于获取所述二维虚拟物品在第三坐标系下的第四偏移矩阵,所述第三坐标系为所述二维虚拟物品的坐标系,所述第四偏移矩阵包括所述二维虚拟物品的多个点与所述二维虚拟对象的参考点在所述第三坐标系下的偏移量;对所述第四偏移矩阵进行坐标系变换,得到所述第三偏移矩阵。In another possible implementation, the second position acquisition unit is configured to acquire a fourth offset matrix of the two-dimensional virtual item in a third coordinate system, where the third coordinate system is the two-dimensional the coordinate system of the virtual item, the fourth offset matrix includes the offsets between the multiple points of the two-dimensional virtual item and the reference point of the two-dimensional virtual object under the third coordinate system; The fourth offset matrix performs coordinate system transformation to obtain the third offset matrix.
另一方面,提供了一种计算机设备,所述计算机设备包括处理器和存储器,所述存储器中存储有至少一条计算机程序,所述至少一条计算机程序由所述处理器加载并执行以实现如上述方面所述的虚拟场景显示方法中所执行的操作。In another aspect, a computer device is provided, the computer device includes a processor and a memory, the memory stores at least one computer program, the at least one computer program is loaded and executed by the processor to achieve the above The operations performed in the virtual scene display method described in the aspect.
另一方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条计算机程序,所述至少一条计算机程序由处理器加载并执行以实现如上述方面所述的虚拟场景显示方法中所执行的操作。In another aspect, a computer-readable storage medium is provided, and at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to realize the virtual The scene shows the actions performed in the method.
再一方面,提供了一种计算机程序产品或计算机程序,所述计算机程序产品或计算机程序包括计算机程序代码,所述计算机程序代码存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机程序代码,处理器执行所述计算机程序代码,使得所述计算机设备实现如上述方面所述的虚拟场景显示方法中所执行的操作。In yet another aspect, a computer program product or computer program is provided, the computer program product or computer program comprising computer program code stored in a computer-readable storage medium. The processor of the computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device implements the operations performed in the virtual scene display method described in the above aspects.
本申请实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided in the embodiments of the present application include at least:
本申请实施例提供的方法、装置、计算机设备及存储介质,在保证虚拟场景图像呈现近大远小的效果的前提下,在虚拟摄像机的视场角发生变化时,对虚拟场景图像中的二维虚拟对象的显示位置进行修正,使得在视场角变化后得到的虚拟场景图像中,按照修正的显示位置显示该二维虚拟对象,虚拟场景图像既呈现三维效果,又能保证二维虚拟对象的显示位置准确,从而提升了虚拟场景的显示效果。With the method, device, computer equipment and storage medium provided by the embodiments of the present application, on the premise that the virtual scene image presents the effect of being near big and far small, when the field of view of the virtual camera changes, the two images in the virtual scene image are changed. The display position of the 3D virtual object is corrected, so that in the virtual scene image obtained after the change of the field of view, the 2D virtual object is displayed according to the corrected display position, and the virtual scene image not only presents the 3D effect, but also ensures the 2D virtual object The display position is accurate, thereby improving the display effect of the virtual scene.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请实施例的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some implementations of the embodiments of the present application. For example, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1是本申请实施例提供的一种实施环境的结构示意图;1 is a schematic structural diagram of an implementation environment provided by an embodiment of the present application;
图2是本申请实施例提供的一种虚拟场景显示方法的流程图;2 is a flowchart of a method for displaying a virtual scene provided by an embodiment of the present application;
图3是本申请实施例提供的一种虚拟场景显示方法的流程图;3 is a flowchart of a method for displaying a virtual scene provided by an embodiment of the present application;
图4是本申请实施例提供的一种虚拟场景图像的示意图;4 is a schematic diagram of a virtual scene image provided by an embodiment of the present application;
图5是本申请实施例提供的一种虚拟场景图像的示意图;5 is a schematic diagram of a virtual scene image provided by an embodiment of the present application;
图6是本申请实施例提供的一种虚拟场景图像的示意图;6 is a schematic diagram of a virtual scene image provided by an embodiment of the present application;
图7是本申请实施例提供的一种虚拟场景图像的示意图;7 is a schematic diagram of a virtual scene image provided by an embodiment of the present application;
图8是本申请实施例提供的一种虚拟场景图像的示意图;8 is a schematic diagram of a virtual scene image provided by an embodiment of the present application;
图9是本申请实施例提供的一种三维场景下的虚拟场景图像的示意图;9 is a schematic diagram of a virtual scene image in a three-dimensional scene provided by an embodiment of the present application;
图10是本申请实施例提供的一种虚拟场景显示装置的结构示意图;10 is a schematic structural diagram of a virtual scene display device provided by an embodiment of the present application;
图11是本申请实施例提供的一种虚拟场景显示装置的结构示意图;11 is a schematic structural diagram of a virtual scene display device provided by an embodiment of the present application;
图12是本申请实施例提供的一种终端的结构示意图;FIG. 12 is a schematic structural diagram of a terminal provided by an embodiment of the present application;
图13是本申请实施例提供的一种服务器的结构示意图。FIG. 13 is a schematic structural diagram of a server provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
本申请所使用的术语“第一”、“第二”、“第三”、“第四”等可在本文中用于描述各种概念,但除非特别说明,这些概念不受这些术语限制。这些术语仅用于将一个概念与另一个概念区分。举例来说,在不脱离本申请的范围的情况下,可以将第一偏移矩阵称为第二偏移矩阵,且类似地,可将第二偏移矩阵称为第一偏移矩阵。The terms "first", "second", "third", "fourth", etc. used in this application may be used herein to describe various concepts, but these concepts are not limited by these terms unless otherwise specified. These terms are only used to distinguish one concept from another. For example, a first offset matrix may be referred to as a second offset matrix, and similarly, a second offset matrix may be referred to as a first offset matrix, without departing from the scope of this application.
本申请所使用的术语“至少一个”、“多个”、“每个”、“任一”,至少一个包括一个、两个或两个以上,多个包括两个或两个以上,而每个是指对应的多个中的每一个,任一是指多个中的任意一个。举例来说,多个点包括3个点,而每个是指这3个点中的每一个点,任一是指这3个点中的任意一个,是第一个点,或者,是第二个点,或者,是第三个点。As used in this application, the terms "at least one", "plurality", "each" and "any", at least one includes one, two or more, multiple includes two or more, and each Each refers to each of the corresponding plurality, and any refers to any one of the plurality. For example, a plurality of points includes 3 points, and each refers to each of the 3 points, either refers to any of the 3 points, is the first point, or is the first point The second point, or, the third point.
本申请实施例提供的虚拟场景显示方法,能够用于计算机设备中。可选地,该计算机设备为终端或服务器。可选地,该服务器是独立的物理服务器,或者,是多个物理服务器构成的服务器集群或者分布式系统,或者,是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN(Content Delivery Network,内容分发网络)、以及大数据和人工智能平台等基础云计算服务的云服务器。可选地,该终端是智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表等,但并不局限于此。The virtual scene display method provided by the embodiment of the present application can be used in a computer device. Optionally, the computer device is a terminal or a server. Optionally, the server is an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, Cloud servers for cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms. Optionally, the terminal is a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto.
图1是本申请实施例提供的一种实施环境的结构示意图,如图1所示,该系统包括终端101和服务器102,该终端101与服务器102能够通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。FIG. 1 is a schematic structural diagram of an implementation environment provided by an embodiment of the present application. As shown in FIG. 1 , the system includes a terminal 101 and a
服务器102为终端101提供虚拟场景图像,终端101能够显示服务器102提供的虚拟场景图像,并且终端101能够对虚拟场景进行控制,服务器102用于为终端101提供后台支持,能够根据终端101对虚拟场景的控制进行后台处理。The
可选地,终端101安装有游戏应用,服务器102为该游戏应用提供服务,通过该游戏应用,终端101与服务器102能够进行交互。服务器102为终端101提供服务,以使终端101能够显示虚拟场景图像,并能够对虚拟场景图像进行操作,如控制虚拟对象进行攻击或移动。Optionally, the terminal 101 is installed with a game application, the
本申请实施例提供的方法,可用于多种场景。The methods provided in the embodiments of the present application can be used in various scenarios.
例如,横版游戏场景下:For example, in a horizontal game scenario:
计算机设备上运行有横版游戏应用,通过该计算机设备运行的横版游戏应用,能够控制虚拟场景中的二维虚拟对象进行左右移动,在调整横版游戏中的虚拟摄像机的视场角时,采用本申请实施例提供的方法,显示横版游戏的虚拟场景图像,以使在虚拟场景图像呈现近大远小的效果的情况下,且在虚拟场景图像中准确地显示二维虚拟对象,既保证了虚拟场景图像呈现的三维效果,又能保证虚拟场景图像中的二维虚拟对象的显示位置准确,从而提升了虚拟场景的显示效果。A horizontal version game application runs on the computer device, and the horizontal version game application running on the computer device can control the two-dimensional virtual object in the virtual scene to move left and right, and when adjusting the field of view of the virtual camera in the horizontal version game, Using the method provided by the embodiment of the present application, the virtual scene image of the horizontal game is displayed, so that the two-dimensional virtual object is accurately displayed in the virtual scene image under the condition that the virtual scene image presents the effect of near big and far small. The three-dimensional effect presented by the virtual scene image is guaranteed, and the display position of the two-dimensional virtual object in the virtual scene image is accurate, thereby improving the display effect of the virtual scene.
图2是本申请实施例提供的一种虚拟场景显示方法的流程图,应用于计算机设备中,如图2所示,该方法包括:2 is a flowchart of a method for displaying a virtual scene provided by an embodiment of the present application, which is applied to a computer device. As shown in FIG. 2 , the method includes:
201、计算机设备显示第一虚拟场景图像。201. The computer device displays a first virtual scene image.
其中,第一虚拟场景图像包括虚拟场景中的二维虚拟对象,第一虚拟场景图像由虚拟摄像机对虚拟场景进行拍摄得到,虚拟摄像机所拍摄的图像呈现近大远小的效果。例如,在虚拟场景图像中包括多个相同的二维虚拟物品,与虚拟摄像机距离近的二维虚拟物品显示的尺寸大,与虚拟摄像机距离远的二维虚拟物品显示的尺寸小。The first virtual scene image includes two-dimensional virtual objects in the virtual scene, the first virtual scene image is obtained by photographing the virtual scene by a virtual camera, and the image photographed by the virtual camera presents the effect of being near and far. For example, a virtual scene image includes multiple identical 2D virtual items, the 2D virtual items that are close to the virtual camera are displayed in a larger size, and the 2D virtual items that are far away from the virtual camera are displayed in small sizes.
202、计算机设备响应于虚拟摄像机的视场角发生变化,基于二维虚拟对象在第一虚拟场景图像中的第一显示位置,获取二维虚拟对象的第二显示位置。202. The computer device acquires a second display position of the two-dimensional virtual object based on the first display position of the two-dimensional virtual object in the first virtual scene image in response to the change in the field of view of the virtual camera.
其中,虚拟摄像机的视场角用于指示虚拟摄像机所能拍摄到的范围,视场角越大,拍摄到的范围越大,视场角越小,拍摄到的范围越小。第一显示位置用于指示该二维虚拟对象在第一虚拟场景图像中的位置,第二显示位置用于指示虚拟摄像机在视场角变化后所拍摄到的第二虚拟场景图像中,二维虚拟对象的显示位置。The field of view of the virtual camera is used to indicate the range that the virtual camera can capture. The larger the field of view, the larger the captured range, and the smaller the field of view, the smaller the captured range. The first display position is used to indicate the position of the two-dimensional virtual object in the first virtual scene image, and the second display position is used to indicate that in the second virtual scene image captured by the virtual camera after the angle of view changes, the two-dimensional The display position of the virtual object.
由于虚拟摄像机所拍摄的图像呈现近大远小的效果,因此,在采用该虚拟摄像机拍摄虚拟场景时,如果该虚拟摄像机的视场角发生改变,会导致虚拟场景图像中的二维虚拟对象的位置发生变化,使得虚拟场景图像中的二维虚拟对象的显示位置,与该二维虚拟对象在虚拟场景中的位置不同,因此,在该虚拟摄像机的视场角发生变化时,需要重新确定二维虚拟对象的第二显示位置,以保证在视场角变化后得到的虚拟场景图像中,该二维虚拟对象的显示位置准确。Since the image captured by the virtual camera presents the effect of being near big and far small, when the virtual camera is used to shoot a virtual scene, if the field of view of the virtual camera is changed, it will cause the two-dimensional virtual object in the virtual scene image to be blurred. The position changes, so that the display position of the two-dimensional virtual object in the virtual scene image is different from the position of the two-dimensional virtual object in the virtual scene. Therefore, when the field of view of the virtual camera changes, it is necessary to re-determine two The second display position of the two-dimensional virtual object is ensured in the virtual scene image obtained after the angle of view is changed, and the display position of the two-dimensional virtual object is accurate.
203、计算机设备显示第二虚拟场景图像,在第二虚拟场景图像中的第二显示位置上显示有二维虚拟对象。203. The computer device displays a second virtual scene image, and a two-dimensional virtual object is displayed on a second display position in the second virtual scene image.
在本申请实施例中,该二维虚拟对象的第一显示位置在虚拟场景中所对应的位置,与该二维虚拟对象的第二显示位置在虚拟场景中所对应的位置相同。通过在第二虚拟场景图像中的第二显示位置上,显示该二维虚拟对象,使得在第二虚拟场景图像中的显示位置与该二维虚拟对象在虚拟场景中的位置对应,保证了该二维虚拟对象的显示位置准确。In the embodiment of the present application, the position corresponding to the first display position of the two-dimensional virtual object in the virtual scene is the same as the position corresponding to the second display position of the two-dimensional virtual object in the virtual scene. By displaying the two-dimensional virtual object at the second display position in the second virtual scene image, so that the display position in the second virtual scene image corresponds to the position of the two-dimensional virtual object in the virtual scene, the The display position of 2D virtual objects is accurate.
本申请实施例提供的方法,在保证虚拟场景图像呈现近大远小的效果的前提下,在虚拟摄像机的视场角发生变化时,对虚拟场景图像中的二维虚拟对象的显示位置进行修正,使得在视场角变化后得到的虚拟场景图像中,按照修正的显示位置显示该二维虚拟对象,虚拟场景图像既呈现三维效果,又能保证二维虚拟对象的显示位置准确,从而提升了虚拟场景的显示效果。The method provided by the embodiment of the present application, on the premise of ensuring that the virtual scene image presents the effect of large near and far small, when the field of view of the virtual camera changes, the display position of the two-dimensional virtual object in the virtual scene image is corrected , so that the two-dimensional virtual object is displayed according to the corrected display position in the virtual scene image obtained after the change of the field of view. The virtual scene image not only presents the three-dimensional effect, but also ensures the accurate display position of the two-dimensional virtual object, thereby improving The display effect of the virtual scene.
图3是本申请实施例提供的一种虚拟场景显示方法的流程图,应用于计算机设备中,如图3所示,该方法包括:FIG. 3 is a flowchart of a method for displaying a virtual scene provided by an embodiment of the present application, which is applied to a computer device. As shown in FIG. 3 , the method includes:
301、计算机设备显示第一虚拟场景图像,第一虚拟场景图像包括虚拟场景中的二维虚拟对象。301. The computer device displays a first virtual scene image, where the first virtual scene image includes a two-dimensional virtual object in the virtual scene.
在本申请实施例中,通过该虚拟摄像机拍摄虚拟场景,使得到的虚拟场景图像呈现透视的效果,即呈现近大远小的效果,并且对虚拟场景图像中的二维虚拟对象进行了修正,二维虚拟对象自身不产生透视的效果。例如,虚拟场景图像中的二维虚拟对象按照所处的位置的缩放比例进行显示,使得虚拟场景图像呈现近大远小的透视效果,但二维虚拟对象的自身不同部位的缩放比例相等,即二维虚拟对象自身不产生透视的效果。In the embodiment of the present application, the virtual scene is captured by the virtual camera, so that the obtained virtual scene image presents the effect of perspective, that is, the effect of near big and far small, and the two-dimensional virtual object in the virtual scene image is corrected, The two-dimensional virtual object itself does not produce the effect of perspective. For example, the two-dimensional virtual object in the virtual scene image is displayed according to the zoom ratio of its position, so that the virtual scene image presents a perspective effect of near, large and far, but the zoom ratio of different parts of the two-dimensional virtual object is equal, that is The two-dimensional virtual object itself does not produce the effect of perspective.
可选地,该虚拟摄像机为虚拟透视相机。该虚拟透视相机对虚拟场景进行拍摄后,得到的虚拟场景图像呈现透视效果,即该虚拟场景图像呈现近大远小的效果。在本申请实施例中,在该第一虚拟场景图像中,除了二维虚拟对象外,其他部分的虚拟场景均呈现近大远小的效果,且该二维虚拟对象未呈现透视效果。Optionally, the virtual camera is a virtual perspective camera. After the virtual scene is photographed by the virtual perspective camera, the obtained virtual scene image presents a perspective effect, that is, the virtual scene image presents the effect of being large near and far and small. In the embodiment of the present application, in the first virtual scene image, except for the two-dimensional virtual object, other parts of the virtual scene show the effect of being near big and far small, and the two-dimensional virtual object does not show a perspective effect.
二维虚拟对象在虚拟场景图像中呈现二维的显示效果,可选地,该二维虚拟对象为虚拟人物、虚拟动物等。在一种可能实现方式中,该二维虚拟对象在虚拟场景中对应有三维虚拟对象,基于该虚拟摄像机拍摄虚拟场景,对拍摄到的虚拟场景进行渲染,得到该第一虚拟场景图像,以使该第一虚拟场景图像中呈现二维虚拟对象。The two-dimensional virtual object presents a two-dimensional display effect in the virtual scene image. Optionally, the two-dimensional virtual object is a virtual character, a virtual animal, or the like. In a possible implementation manner, the two-dimensional virtual object corresponds to a three-dimensional virtual object in the virtual scene, and the virtual scene is photographed based on the virtual camera, and the photographed virtual scene is rendered to obtain the first virtual scene image, so that the A two-dimensional virtual object is presented in the first virtual scene image.
302、计算机设备响应于虚拟摄像机的视场角由第一视场角变化为第二视场角,基于第一视场角及第二视场角,确定二维虚拟对象对应的视场角变换矩阵。302. In response to the change of the field of view of the virtual camera from the first angle of view to the second angle of view, the computer device determines the conversion of the field of view corresponding to the two-dimensional virtual object based on the first angle of view and the second angle of view matrix.
其中,该第一视场角为虚拟摄像机变化之前的视场角,第二视场角为虚拟摄像机变化之后的视场角。视场角变换矩阵用于指示虚拟摄像机的视场角变化的情况。通过第一视场角及第二视场角,确定指示虚拟摄像机的视场角变化的情况的视场角变换矩阵,以便后续根据该视场角变换矩阵确定二维虚拟对象的显示位置。The first angle of view is the angle of view before the virtual camera is changed, and the second angle of view is the angle of view after the change of the virtual camera. The field of view transformation matrix is used to indicate the change of the field of view of the virtual camera. Through the first angle of view and the second angle of view, a view angle transformation matrix indicating the change of the view angle of the virtual camera is determined, so that the display position of the two-dimensional virtual object can be subsequently determined according to the view angle transformation matrix.
在一种可能实现方式中,该步骤302包括:将第一视场角的投影矩阵与第二视场角的投影矩阵进行融合,得到视场角变换矩阵。其中,投影矩阵用于指示虚拟摄像机拍摄到的虚拟场景投影到虚拟场景图像中的矩阵,不同的视场角对应的投影矩阵不同,即第一视场角的投影矩阵与第二视场角的投影矩阵不同。In a possible implementation manner, the
可选地,获取视场角变换矩阵的过程包括:确定第一视场角的投影矩阵的逆矩阵,将第二视场角的投影矩阵与该逆矩阵之间的乘积,确定为该视场角变换矩阵。Optionally, the process of obtaining the transformation matrix of the viewing angle includes: determining the inverse matrix of the projection matrix of the first viewing angle, and determining the product between the projection matrix of the second viewing angle and the inverse matrix as the viewing field. Angle transformation matrix.
可选地,第一视场角的投影矩阵Mx、第二视场角的投影矩阵My及视场角变换矩阵Tview,满足以下关系:Optionally, the projection matrix M x of the first angle of view, the projection matrix M y of the second angle of view, and the angle of view transformation matrix T view satisfy the following relationship:
其中,表示第一视场角的投影矩阵Mx的逆矩阵;x表示第一视场角;y表示第二视场角。in, Represents the inverse matrix of the projection matrix M x for the first field of view; x represents the first field of view; y represents the second field of view.
303、计算机设备基于第一视场角,确定二维虚拟对象的参考点在第一坐标系下的目标坐标。303. The computer device determines, based on the first angle of view, the target coordinates of the reference point of the two-dimensional virtual object in the first coordinate system.
其中,第一坐标系为虚拟摄像机在第一视场角下的坐标系。二维虚拟对象的参考点为二维虚拟对象的任一点,可选地,该二维虚拟对象的参考点为二维虚拟对象的第二坐标系下的原点。Wherein, the first coordinate system is the coordinate system of the virtual camera under the first field of view angle. The reference point of the two-dimensional virtual object is any point of the two-dimensional virtual object. Optionally, the reference point of the two-dimensional virtual object is the origin in the second coordinate system of the two-dimensional virtual object.
通过二维虚拟对象的参考点,及虚拟摄像机在第一视场角下的第一坐标系,即可确定该二维虚拟对象的参考点在该第一坐标系下的目标坐标,以便后续通过该目标坐标确定二维虚拟对象在虚拟摄像机的视场角变化后的显示位置。Through the reference point of the two-dimensional virtual object and the first coordinate system of the virtual camera under the first field of view, the target coordinates of the reference point of the two-dimensional virtual object in the first coordinate system can be determined, so as to facilitate subsequent The target coordinates determine the display position of the two-dimensional virtual object after the viewing angle of the virtual camera is changed.
在一种可能实现方式中,该步骤303包括:获取二维虚拟对象的参考点在第二坐标系下的参考坐标,对参考坐标进行坐标系变换,得到目标坐标。In a possible implementation manner, the
其中,第二坐标系为二维虚拟对象的坐标系,该二维虚拟对象的参考点在不同的坐标系下具有不同的坐标值,将该参考点在第二坐标系下的坐标,称为参考坐标,将该参考点在第一坐标系下的坐标,称为目标坐标。The second coordinate system is the coordinate system of the two-dimensional virtual object, and the reference point of the two-dimensional virtual object has different coordinate values in different coordinate systems, and the coordinates of the reference point in the second coordinate system are called Reference coordinates, the coordinates of the reference point in the first coordinate system are called target coordinates.
可选地,第二坐标系下的原点为该二维虚拟对象的参考点,则对该第二坐标系下的原点的坐标进行坐标系变换,得到该原点在第一坐标系下的目标坐标。Optionally, the origin under the second coordinate system is the reference point of the two-dimensional virtual object, then the coordinate system transformation is performed on the coordinates of the origin under the second coordinate system to obtain the target coordinates of the origin under the first coordinate system. .
可选地,第二坐标系下的原点的坐标O″view及该原点在第一坐标系下的目标坐标Oview,满足以下关系:Optionally, the coordinate O ″ view of the origin under the second coordinate system and the target coordinate O view of the origin under the first coordinate system satisfy the following relationship:
Oview=O″view·T0;O view =O″ view ·T 0 ;
其中,T0表示从二维虚拟对象的第二坐标系到虚拟摄像机的第一坐标系的变换矩阵。例如,第二坐标系下的原点的坐标为(0,0,0),则该坐标O″view=(0,0,0,1),其中,1为指示标识,用于指示坐标O″view中的前三个元素为坐标。Wherein, T 0 represents a transformation matrix from the second coordinate system of the two-dimensional virtual object to the first coordinate system of the virtual camera. For example, the coordinates of the origin in the second coordinate system are (0, 0, 0), then the coordinates O" view = (0, 0, 0, 1), where 1 is an indicator for indicating the coordinate O" The first three elements in the view are coordinates.
304、计算机设备获取二维虚拟对象在第一坐标系下的第一偏移矩阵。304. The computer device acquires a first offset matrix of the two-dimensional virtual object in the first coordinate system.
其中,第一偏移矩阵包括二维虚拟对象的多个点与参考点在第一坐标系下的偏移量。在本申请实施例中,二维虚拟对象是由多个点构成,每个点与参考点之间的偏移量,表示每个点与该参考点之间的相对位置,通过确定二维虚拟对象的多个点与二维虚拟对象的参考点之间的偏移量,即确定了该二维虚拟对象的多个点与该参考点之间的相对位置,也即是确定了该二维虚拟对象与该参考点的相对位置。Wherein, the first offset matrix includes offsets between the multiple points of the two-dimensional virtual object and the reference point in the first coordinate system. In the embodiment of the present application, the two-dimensional virtual object is composed of multiple points, and the offset between each point and the reference point represents the relative position between each point and the reference point. By determining the two-dimensional virtual object The offset between the multiple points of the object and the reference point of the two-dimensional virtual object, that is, the relative position between the multiple points of the two-dimensional virtual object and the reference point is determined, that is, the two-dimensional virtual object is determined. The relative position of the virtual object to this reference point.
在一种可能实现方式中,该步骤304包括:获取二维虚拟对象在第二坐标系下的第二偏移矩阵,对第二偏移矩阵进行坐标系变换,得到第一偏移矩阵。In a possible implementation manner,
其中,第二坐标系为二维虚拟对象的坐标系,第二偏移矩阵包括二维虚拟对象的多个点与参考点在第二坐标系下的偏移量。例如,二维虚拟对象的参考点为第二坐标系的原点,则在第二坐标系下,二维虚拟对象的多个点与该原点之间的偏移量构成了该第二偏移矩阵,以表示该二维虚拟对象与该原点的相对位置。Wherein, the second coordinate system is a coordinate system of a two-dimensional virtual object, and the second offset matrix includes the offsets between a plurality of points of the two-dimensional virtual object and a reference point in the second coordinate system. For example, the reference point of the two-dimensional virtual object is the origin of the second coordinate system, then in the second coordinate system, the offsets between the multiple points of the two-dimensional virtual object and the origin constitute the second offset matrix , to represent the relative position of the two-dimensional virtual object and the origin.
通过确定第二坐标系下的第二偏移矩阵,将第二坐标系下的第二偏移矩阵转换至第一坐标系下,得到该第一偏移矩阵。The first offset matrix is obtained by determining the second offset matrix under the second coordinate system, and converting the second offset matrix under the second coordinate system to the first coordinate system.
305、计算机设备基于目标坐标、第一偏移矩阵及视角变换矩阵,确定第二显示位置。305. The computer device determines the second display position based on the target coordinates, the first offset matrix, and the viewing angle transformation matrix.
其中,第二显示位置用于表示在虚拟摄像机的视场角变化后,二维虚拟对象在虚拟场景图像中的显示位置。The second display position is used to indicate the display position of the two-dimensional virtual object in the virtual scene image after the field of view of the virtual camera changes.
在确定虚拟摄像机的视场角由第一视场角变化为第二视场角后,由于目标坐标为二维虚拟对象的参考点在第一坐标系下的坐标,第一偏移矩阵能够表示二维虚拟对象的多个点与该参考点在第一坐标系下的相对位置,视角变换矩阵指示虚拟摄像机的视场角变化情况,则通过该目标坐标、第一偏移矩阵及视角变换矩阵,即可确定在虚拟摄像机的视场角变化为第二视场角后,二维虚拟对象的第二显示位置,以使后续能够在第二虚拟场景图像的第二显示位置上显示该二维虚拟对象。After determining that the field of view of the virtual camera is changed from the first field of view to the second field of view, since the target coordinates are the coordinates of the reference point of the two-dimensional virtual object in the first coordinate system, the first offset matrix can represent The relative positions of the multiple points of the two-dimensional virtual object and the reference point in the first coordinate system, and the viewing angle transformation matrix indicates the change of the viewing angle of the virtual camera, then through the target coordinates, the first offset matrix and the viewing angle transformation matrix , the second display position of the two-dimensional virtual object can be determined after the field of view of the virtual camera is changed to the second field of view, so that the two-dimensional virtual object can be displayed on the second display position of the second virtual scene image subsequently. virtual object.
在一种可能实现方式中,目标坐标Oview、第一偏移矩阵Vview、视场角变换矩阵Tview及第二显示位置P″view,满足以下关系:In a possible implementation manner, the target coordinate O view , the first offset matrix V view , the field angle transformation matrix T view and the second display position P " view , satisfy the following relationship:
P″view=Oview+Vview·Tview; P "view =O view +V view ·T view ;
其中,x用于表示第一视场角;y用于表示第二视场角。Wherein, x is used to represent the first angle of view; y is used to represent the second angle of view.
可选地,二维虚拟对象的参考点为二维虚拟对象的第二坐标系的原点,则该第一偏移矩阵Vview满足以下关系:Optionally, the reference point of the two-dimensional virtual object is the origin of the second coordinate system of the two-dimensional virtual object, then the first offset matrix V view satisfies the following relationship:
Vview=(Plocal·xyz,0)·T0;V view = (P local · xyz, 0) · T 0 ;
其中,Plocal表示二维虚拟对象在第二坐标系下的原点;x、y、z分别表示二维虚拟对象的每个点在第二坐标系下的x轴、y轴及z轴的坐标值;Plocal·xyz表示二维虚拟对象的每个点与第二坐标系的原点在第二坐标系下的偏移量;0为指示标识,用于指示Plocal·xyz为向量;T0表示从二维虚拟对象的第二坐标系到虚拟摄像机的第一坐标系的变换矩阵。Among them, P local represents the origin of the two-dimensional virtual object in the second coordinate system; x, y, and z represent the coordinates of the x-axis, y-axis and z-axis of each point of the two-dimensional virtual object in the second coordinate system, respectively value; P local xyz represents the offset between each point of the two-dimensional virtual object and the origin of the second coordinate system in the second coordinate system; 0 is an indicator, used to indicate that P local xyz is a vector; T 0 Represents a transformation matrix from the second coordinate system of the two-dimensional virtual object to the first coordinate system of the virtual camera.
需要说明的是,本申请实施例是以二维虚拟对象的目标坐标、第一偏移矩阵来确定二维虚拟对象的第二显示位置进行说明的,而在另一实施例中,无需执行步骤303-305,能够采取其他方式,基于第一显示位置及视场角变换矩阵,获取二维虚拟对象的第二显示位置。It should be noted that the embodiment of the present application is described by determining the second display position of the two-dimensional virtual object by the target coordinates of the two-dimensional virtual object and the first offset matrix, and in another embodiment, no steps need to be performed.
需要说明的是,本申请实施例是以虚拟对象对应的视场角变换矩阵来确定二维虚拟对象的第二显示位置进行说明的,而在另一实施例中,无需执行步骤302-305,响应于虚拟摄像机的视场角发生变化,能够采取其他方式,基于二维虚拟对象在第一虚拟场景图像中的第一显示位置,获取二维虚拟对象的第二显示位置。It should be noted that, in the embodiment of the present application, the second display position of the two-dimensional virtual object is determined by the field angle transformation matrix corresponding to the virtual object. In another embodiment, steps 302 to 305 need not be performed. In response to the change of the field of view of the virtual camera, other methods can be adopted to obtain the second display position of the two-dimensional virtual object based on the first display position of the two-dimensional virtual object in the first virtual scene image.
306、计算机设备显示第二虚拟场景图像,在第二虚拟场景图像中的第二显示位置上显示有二维虚拟对象。306. The computer device displays a second virtual scene image, and a two-dimensional virtual object is displayed on a second display position in the second virtual scene image.
其中,第二虚拟场景图像中包括该虚拟摄像机在视场角变化后,所能拍摄到的虚拟场景及位于该虚拟场景中的二维虚拟对象,且该二维虚拟对象在第二显示位置上显示,以保证二维虚拟对象的显示位置正确,与该二维虚拟对象在虚拟场景中的位置对应。在本申请实施例中,如果仅是虚拟摄像机的视场角发生变化,而虚拟对象在虚拟场景中的位置未改变,则二维虚拟对象在虚拟场景图像中的显示位置可能发生变化,但该二维虚拟对象的第二显示位置与二维虚拟对象的第一显示位置,在虚拟场景中所对应的位置相同。Wherein, the second virtual scene image includes a virtual scene that the virtual camera can capture after the angle of view changes and a two-dimensional virtual object located in the virtual scene, and the two-dimensional virtual object is on the second display position display to ensure that the display position of the two-dimensional virtual object is correct and corresponds to the position of the two-dimensional virtual object in the virtual scene. In the embodiment of the present application, if only the field of view of the virtual camera changes, but the position of the virtual object in the virtual scene does not change, the display position of the two-dimensional virtual object in the virtual scene image may change, but this The second display position of the two-dimensional virtual object is the same as the first display position of the two-dimensional virtual object in the virtual scene.
在一种可能实现方式中,在步骤306之前,该方法还包括:确定第二显示位置与第一显示位置之间的位置变化量,根据位置变化量,调整二维虚拟对象在虚拟场景中的位置,渲染虚拟摄像机在视场角变化后拍摄到的虚拟场景,得到第二虚拟场景图像。In a possible implementation manner, before
通过二维虚拟对象的第一显示位置及第二显示位置,即可确定该二维虚拟对象在虚拟摄像机的视场角变化后的位置变化量,通过位置变化量对二维虚拟对象的显示位置进行调整,以保证显示的第二虚拟场景图像中的二维虚拟对象的显示位置准确。According to the first display position and the second display position of the two-dimensional virtual object, the position change amount of the two-dimensional virtual object after the field angle of the virtual camera is changed can be determined, and the display position of the two-dimensional virtual object can be determined by the position change amount. The adjustment is performed to ensure that the display position of the two-dimensional virtual object in the displayed second virtual scene image is accurate.
在一种可能实现方式中,该步骤306包括:根据第二显示位置,确定二维虚拟对象在剪裁坐标系下的第四显示位置,根据该第四显示位置,渲染虚拟摄像机在第二视场角拍摄到的虚拟场景,得到该第二虚拟场景图像,以使在第二虚拟场景图像中第三显示位置上,显示二维虚拟物品。In a possible implementation manner, the
可选地,第二显示位置P″′view、第一视场角的投影矩阵Mx及二维虚拟对象在剪裁坐标系下的第四显示位置Pclip,满足以下关系:Optionally, the second display position P"' view , the projection matrix M x of the first field of view, and the fourth display position P clip of the two-dimensional virtual object in the clipping coordinate system satisfy the following relationship:
Pclip=P″view·Mx;P clip =P″ view ·M x ;
可选的,确定二维虚拟对象在剪裁坐标系下的第四位置Pclip的过程包括:根据第一视场角的投影矩阵Mx、第二视场角的投影矩阵My、二维虚拟对象在第一坐标系下的目标坐标Oview,确定二维虚拟对象在第一坐标系下的第三坐标O′view。在虚拟摄像机的视场角变化后,该第三坐标O′view转换到剪裁坐标系下的位置与视场角变化后的虚拟场景图像中二维虚拟对象的显示位置对应。该第一视场角的投影矩阵Mx、第二视场角的投影矩阵My、目标坐标Oview、第三坐标O′view,满足以下关系:Optionally, the process of determining the fourth position P clip of the two-dimensional virtual object in the clipping coordinate system includes: according to the projection matrix M x of the first field of view, the projection matrix M y of the second field of view, the two-dimensional virtual The target coordinate O view of the object under the first coordinate system determines the third coordinate O' view of the two-dimensional virtual object under the first coordinate system. After the view angle of the virtual camera is changed, the position of the third coordinate O' view converted to the clipping coordinate system corresponds to the display position of the two-dimensional virtual object in the virtual scene image after the view angle change. The projection matrix M x of the first angle of view, the projection matrix My y of the second angle of view, the target coordinate O view , and the third coordinate O' view satisfies the following relationship:
Oview·Mx=O′view·My;O view ·M x =O' view ·M y ;
其中,x用于表示第一视场角;y用于表示第二视场角;表示第二视场角的投影矩阵My的逆矩阵。Wherein, x is used to represent the first angle of view; y is used to represent the second angle of view; Represents the inverse of the projection matrix M y for the second field of view.
则第二显示位置P″′view、第一视场角的投影矩阵Mx及二维虚拟对象在剪裁坐标系下的第四显示位置Pclip,满足以下关系:Then the second display position P″′ view , the projection matrix M x of the first field of view, and the fourth display position P clip of the two-dimensional virtual object in the clipping coordinate system satisfy the following relationship:
Pclip=P″view·Mx;P clip =P″ view ·M x ;
其中,x表示第一视场角;y表示第二视场角;Mx表示第一视场角的投影矩阵;Oview表示目标坐标;My表示第二视场角的投影矩阵;表示第一视场角的投影矩阵Mx的逆矩阵;Vview表示第一偏移矩阵。Wherein, x represents the first angle of view; y represents the second angle of view; M x represents the projection matrix of the first angle of view; O view represents the target coordinate; M y represents the projection matrix of the second angle of view; represents the inverse matrix of the projection matrix M x for the first field of view; Vview represents the first offset matrix.
需要说明的是,本申请实施例仅是以在虚拟摄像机的视场角变化后,确定二维虚拟对象的位置进行说明的,响应于虚拟场景中包括二维虚拟物品,确定在虚拟场景图像中的位置与上述确定二维虚拟对象的过程类似,在此不再赘述。It should be noted that the embodiments of the present application are only described by determining the position of the two-dimensional virtual object after the field of view of the virtual camera changes. The position of the 2D virtual object is similar to the above-mentioned process of determining the two-dimensional virtual object, and will not be repeated here.
另外,上述实施例中仅是以在虚拟摄像机的视场角变化后,确定二维虚拟对象的位置进行说明的,而在另一实施例中,虚拟场景中的虚拟对象手持二维虚拟物品,则在步骤302之后,该方法还包括以下步骤307-310:In addition, in the above-mentioned embodiment, the position of the two-dimensional virtual object is determined after the field of view of the virtual camera is changed. In another embodiment, the virtual object in the virtual scene holds a two-dimensional virtual object, Then after
307、计算机设备获取二维虚拟对象的参考点与二维虚拟物品的参考点在第一坐标系下的目标偏移量。307. The computer device acquires the target offset between the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual item in the first coordinate system.
在本申请实施例中,由于二维虚拟对象手持二维虚拟物品,因此,为了保证虚拟摄像机的视场角变化后,二维虚拟物品的位置与二维虚拟对象的位置显示准确,因此,通过二维虚拟物品与二维虚拟对象之间的相对显示位置,来确定二维虚拟物品的显示位置,以保证二维虚拟物品在虚拟摄像机的视场角变化的虚拟场景图像中的显示位置准确。In the embodiment of the present application, since the two-dimensional virtual object holds the two-dimensional virtual object, in order to ensure that the position of the two-dimensional virtual object and the position of the two-dimensional virtual object are displayed accurately after the field of view of the virtual camera changes, therefore, by The relative display position between the two-dimensional virtual item and the two-dimensional virtual object is used to determine the display position of the two-dimensional virtual item, so as to ensure that the display position of the two-dimensional virtual item in the virtual scene image with the change of the field of view of the virtual camera is accurate.
其中,二维虚拟物品的参考点为二维虚拟物品的任一点,可选地,二维虚拟物品的参考点为该二维虚拟物品的第三坐标系的原点。目标偏移量用于表示二维虚拟对象的参考点与该二维虚拟物品的参考点在该第一坐标系下的偏移向量。可选地,该目标偏移量用向量表示。The reference point of the two-dimensional virtual item is any point of the two-dimensional virtual item, and optionally, the reference point of the two-dimensional virtual item is the origin of the third coordinate system of the two-dimensional virtual item. The target offset is used to represent the offset vector between the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual item in the first coordinate system. Optionally, the target offset is represented by a vector.
在一种可能实现方式中,该步骤307包括:获取二维虚拟对象的参考点与二维虚拟物品的参考点在第三坐标系下的参考偏移量,对参考偏移量进行坐标系变换,得到目标偏移量。In a possible implementation manner, step 307 includes: acquiring a reference offset between the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual item in the third coordinate system, and performing coordinate system transformation on the reference offset , get the target offset.
其中,第三坐标系为二维虚拟物品的坐标系。参考偏移量用于指示在第三坐标系下,二维虚拟对象的参考点与二维虚拟物品的参考点之间的偏移量。可选地,该参考偏移量用向量的形式表示。在确定第三坐标系下的参考偏移量后,通过将第三坐标系下的参考偏移量转换为第一坐标系下,得到该目标偏移量。The third coordinate system is the coordinate system of the two-dimensional virtual item. The reference offset is used to indicate the offset between the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual item in the third coordinate system. Optionally, the reference offset is represented in the form of a vector. After the reference offset in the third coordinate system is determined, the target offset is obtained by converting the reference offset in the third coordinate system into the first coordinate system.
可选地,确定该二维虚拟对象的参考点在第三坐标系下的第一坐标,及二维虚拟对象的参考点在第三坐标系下的第二坐标,将该第一坐标与第二坐标之间的差值,确定该参考偏移量。Optionally, determine the first coordinate of the reference point of the two-dimensional virtual object in the third coordinate system, and the second coordinate of the reference point of the two-dimensional virtual object in the third coordinate system, and determine the first coordinate with the first coordinate. The difference between the two coordinates determines the reference offset.
308、计算机设备获取二维虚拟物品在第一坐标系下的第三偏移矩阵。308. The computer device acquires a third offset matrix of the two-dimensional virtual item in the first coordinate system.
其中,第三偏移矩阵包括二维虚拟物品的多个点与二维虚拟对象的参考点在第一坐标系下的偏移量。在本申请实施例中,二维虚拟物品是由多个点构成,每个点与参考点之间的偏移量,表示每个点与该参考点之间的相对位置,通过确定二维虚拟物品的多个点与二维虚拟物品的参考点之间的偏移量,即可确定该二维虚拟物品的多个点与该参考点之间的相对位置,即可确定该二维虚拟物品与该参考点的相对位置。Wherein, the third offset matrix includes offsets between the multiple points of the two-dimensional virtual object and the reference point of the two-dimensional virtual object in the first coordinate system. In the embodiment of the present application, the two-dimensional virtual item is composed of multiple points, and the offset between each point and the reference point represents the relative position between each point and the reference point. By determining the two-dimensional virtual item The offset between the multiple points of the item and the reference point of the 2D virtual item can determine the relative position between the multiple points of the 2D virtual item and the reference point, and the 2D virtual item can be determined relative position to this reference point.
在一种可能实现方式中,该步骤308包括:获取二维虚拟物品在第三坐标系下的第四偏移矩阵,对第四偏移矩阵进行坐标系变换,得到第三偏移矩阵。In a possible implementation manner, step 308 includes: acquiring a fourth offset matrix of the two-dimensional virtual item in a third coordinate system, and performing coordinate system transformation on the fourth offset matrix to obtain a third offset matrix.
其中,第三坐标系为二维虚拟物品的坐标系,第四偏移矩阵包括二维虚拟物品的多个点与二维虚拟对象的参考点在第三坐标系下的偏移量。例如,二维虚拟物品的参考点为第三坐标系的原点,则在第三坐标系下,二维虚拟物品的多个点与该原点之间的偏移量构成了该第三偏移矩阵,以表示该二维虚拟物品与该原点的相对位置。The third coordinate system is the coordinate system of the two-dimensional virtual object, and the fourth offset matrix includes the offsets between the points of the two-dimensional virtual object and the reference point of the two-dimensional virtual object in the third coordinate system. For example, the reference point of the two-dimensional virtual item is the origin of the third coordinate system, then in the third coordinate system, the offsets between the multiple points of the two-dimensional virtual item and the origin constitute the third offset matrix , to represent the relative position of the 2D virtual item and the origin.
在第三坐标系下,确定该二维虚拟物品的每个点与该二维虚拟物品的参考点之间的偏移量,即可获取到该第四偏移矩阵,通过对该第四偏移矩阵进行变换,将该第四偏移矩阵变换至第一坐标系下,得到该第三偏移矩阵。In the third coordinate system, by determining the offset between each point of the two-dimensional virtual item and the reference point of the two-dimensional virtual item, the fourth offset matrix can be obtained. The shift matrix is transformed, and the fourth offset matrix is transformed into the first coordinate system to obtain the third offset matrix.
可选地,获取二维虚拟物品在第三坐标系下的第五偏移矩阵,获取二维虚拟对象的参考点与二维虚拟物品的参考点在第三坐标系下的参考偏移量,基于第五偏移矩阵与参考偏移量,确定第四偏移矩阵。其中,第五偏移矩阵包括二维虚拟物品的多个点与维虚拟物品的参考点在第三坐标系下的偏移量。Optionally, obtaining the fifth offset matrix of the two-dimensional virtual object in the third coordinate system, and obtaining the reference offset of the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual object in the third coordinate system, Based on the fifth offset matrix and the reference offset, a fourth offset matrix is determined. Wherein, the fifth offset matrix includes offsets between a plurality of points of the two-dimensional virtual item and a reference point of the two-dimensional virtual item in the third coordinate system.
可选地,将第五偏移矩阵与参考偏移量的差值,确定为该第四偏移矩阵。Optionally, the difference between the fifth offset matrix and the reference offset is determined as the fourth offset matrix.
309、计算机设备基于目标偏移量、第三偏移矩阵及视角变换矩阵,确定第三显示位置。309. The computer device determines a third display position based on the target offset, the third offset matrix, and the viewing angle transformation matrix.
其中,第三显示位置用于表示在虚拟摄像机的视场角变化后,二维虚拟物品在虚拟场景图像中的显示位置。The third display position is used to indicate the display position of the two-dimensional virtual item in the virtual scene image after the viewing angle of the virtual camera changes.
在确定二维虚拟物品的目标偏移量、第三偏移矩阵及视角变换矩阵后,即可确定虚拟摄像机在视场角变化后,该二维虚拟物品在虚拟场景图像中的位置,及第三显示位置。After determining the target offset of the two-dimensional virtual item, the third offset matrix and the viewing angle transformation matrix, the position of the two-dimensional virtual item in the virtual scene image after the change of the field of view of the virtual camera can be determined, and the third Three display positions.
在确定虚拟摄像机的视场角由第一视场角变化为第二视场角后,由于目标偏移量为二维虚拟对象的参考点与该二维虚拟物品的参考点在第一坐标系下的偏移向量,第三偏移矩阵能够表示二维虚拟物品的多个点与二维虚拟对象的参考点在第一坐标系下的相对位置,视角变换矩阵指示虚拟摄像机的视场角变化情况,则通过该目标偏移量、第三偏移矩阵及视角变换矩阵,即可确定在虚拟摄像机的视场角变化为第二视场角后,二维虚拟物品的第三显示位置,以使后续能够在第二虚拟场景图像的第三显示位置上显示该二维虚拟物品。After it is determined that the field of view of the virtual camera is changed from the first field of view to the second field of view, since the target offset is the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual object in the first coordinate system The offset vector below, the third offset matrix can represent the relative positions of multiple points of the two-dimensional virtual object and the reference point of the two-dimensional virtual object in the first coordinate system, and the perspective transformation matrix indicates the change of the field of view of the virtual camera situation, then through the target offset, the third offset matrix and the viewing angle transformation matrix, the third display position of the two-dimensional virtual item can be determined after the viewing angle of the virtual camera is changed to the second viewing angle. The two-dimensional virtual item can be subsequently displayed on the third display position of the second virtual scene image.
在一种可能实现方式中,目标偏移量Qview、第三偏移矩阵视场角变换矩阵Tview及第三显示位置P″′view,满足以下关系:In a possible implementation, the target offset Q view , the third offset matrix The viewing angle transformation matrix T view and the third display position P″′ view satisfy the following relationship:
其中,x用于表示第一视场角;y用于表示第二视场角。Wherein, x is used to represent the first angle of view; y is used to represent the second angle of view.
需要说明的是,本申请实施例是以二维虚拟物品的目标偏移量、第三偏移矩阵来确定二维虚拟物品的第三显示位置进行说明的,而在另一实施例中,无需执行步骤307-309,能够采取其他方式,基于相对显示位置及视场角变换矩阵,获取二维虚拟物品的第三显示位置。It should be noted that the embodiment of the present application is described by determining the third display position of the two-dimensional virtual item by the target offset of the two-dimensional virtual item and the third offset matrix. After steps 307-309 are performed, other methods can be adopted to obtain the third display position of the two-dimensional virtual item based on the relative display position and the field of view angle transformation matrix.
需要说明的是,本申请实施例是以虚拟对象对应的视场角变换矩阵来确定二维虚拟物品的第三显示位置进行说明的,而在另一实施例中,无需执行步骤302、307-309,能够采取其他方式,基于二维虚拟物品与二维虚拟对象在第一虚拟场景图像中的相对显示位置,获取二维虚拟物品的第三显示位置。It should be noted that the embodiment of the present application is described by determining the third display position of the two-dimensional virtual item by the field angle transformation matrix corresponding to the virtual object. In another embodiment, steps 302 and 307- 309. Other methods can be adopted to obtain a third display position of the two-dimensional virtual item based on the relative display positions of the two-dimensional virtual item and the two-dimensional virtual object in the first virtual scene image.
310、计算机设备在第二虚拟场景图像中第三显示位置上,显示二维虚拟物品。310. The computer device displays a two-dimensional virtual item at a third display position in the second virtual scene image.
在确定二维虚拟物品在第二虚拟场景图像中的第三显示位置后,在第三显示位置上显示该二维虚拟物品,以保证虚拟摄像机的视场角变化后,该二维虚拟物品的位置显示准确。After determining the third display position of the two-dimensional virtual item in the second virtual scene image, display the two-dimensional virtual item on the third display position to ensure that after the field of view of the virtual camera changes, the two-dimensional virtual item's The location is displayed accurately.
需要说明的是,本申请实施例仅以二维虚拟对象手持的二维虚拟物品进行说明的,而在另一实施例中,该二维虚拟物品包括二维子虚拟物品,则通过确定该二维子虚拟物品与所属的二维虚拟对象之间的关系,确定该二维子虚拟物品的显示位置,之后,在第二场景图像中显示该二维子虚拟物品。It should be noted that the embodiments of the present application are only described with a two-dimensional virtual item held by a two-dimensional virtual object. In another embodiment, the two-dimensional virtual item includes a two-dimensional sub-virtual The relationship between the two-dimensional sub-virtual item and the two-dimensional virtual object to which it belongs determines the display position of the two-dimensional sub-virtual item, and then displays the two-dimensional sub-virtual item in the second scene image.
本申请实施例提供的方法能够使显示的虚拟场景能够体现三维的虚拟效果,且二维虚拟对象未发生变形,从而保证虚拟场景的显示效果。The method provided by the embodiment of the present application can enable the displayed virtual scene to reflect a three-dimensional virtual effect, and the two-dimensional virtual object is not deformed, thereby ensuring the display effect of the virtual scene.
在本申请实施例中,虚拟场景中包括三维虚拟对象,通过三维虚拟摄像机对虚拟场景进行渲染,使得虚拟场景呈现三维的显示效果,并对三维虚拟对象进行渲染,得到三维虚拟对象对应的二维虚拟对象,使得在虚拟场景图像中呈现的二维虚拟对象的显示效果,与正交相机渲染的显示效果相同,并且对二维虚拟对象的显示位置进行修正,以保证虚拟场景图像中二维虚拟对象的显示位置,与三维虚拟对象在三维虚拟场景中的位置相同。In the embodiment of the present application, the virtual scene includes a 3D virtual object, the virtual scene is rendered by a 3D virtual camera, so that the virtual scene presents a 3D display effect, and the 3D virtual object is rendered to obtain a 2D corresponding to the 3D virtual object. Virtual object, so that the display effect of the two-dimensional virtual object presented in the virtual scene image is the same as the display effect rendered by the orthogonal camera, and the display position of the two-dimensional virtual object is corrected to ensure the two-dimensional virtual object in the virtual scene image. The display position of the object is the same as the position of the 3D virtual object in the 3D virtual scene.
本申请实施例提供的方法,在保证虚拟场景图像呈现近大远小的效果的前提下,在虚拟摄像机的视场角发生变化时,对虚拟场景图像中的二维虚拟对象的显示位置进行修正,使得在视场角变化后得到的虚拟场景图像中,按照修正的显示位置显示该二维虚拟对象,虚拟场景图像既呈现三维效果,又能保证二维虚拟对象的显示位置准确,从而提升了虚拟场景的显示效果。The method provided by the embodiment of the present application, on the premise of ensuring that the virtual scene image presents the effect of large near and far small, when the field of view of the virtual camera changes, the display position of the two-dimensional virtual object in the virtual scene image is corrected , so that the two-dimensional virtual object is displayed according to the corrected display position in the virtual scene image obtained after the change of the field of view. The virtual scene image not only presents the three-dimensional effect, but also ensures the accurate display position of the two-dimensional virtual object, thereby improving The display effect of the virtual scene.
并且,在二维虚拟对象手持虚拟物品时,通过二维虚拟物品与二维虚拟对象在第一虚拟场景图像中的相对显示位置,来确定二维虚拟对象在视场角变化后得到的虚拟场景图像中的显示位置,保证了虚拟场景图像中二维虚拟对象与二维虚拟物品的显示位置贴合,提升了虚拟场景的显示效果。In addition, when the two-dimensional virtual object holds the virtual object, the relative display position of the two-dimensional virtual object and the two-dimensional virtual object in the first virtual scene image is used to determine the virtual scene obtained by the two-dimensional virtual object after the angle of view changes. The display position in the image ensures that the display positions of the two-dimensional virtual object and the two-dimensional virtual item in the virtual scene image fit together, which improves the display effect of the virtual scene.
基于上述实施例提供的方法,在虚拟摄像机的视场角发生变化后,例如,虚拟摄像机的第一视场角为5度,第二视场角为90度,如果直接基于虚拟摄像机的第一视场角和第二视场角,来确定任一位置Pview在第二视场角的坐标系下的位置P′view,则位置Pview、位置P′view满足以下关系:Based on the method provided by the above embodiment, after the field of view of the virtual camera changes, for example, the first field of view of the virtual camera is 5 degrees, and the second field of view is 90 degrees. The angle of view and the second angle of view are used to determine the position P' view of any position P view in the coordinate system of the second angle of view , then the position P view and the position P' view satisfy the following relationship:
其中,Pview用于表示在虚拟摄像机的视场角变化前的坐标系下的位置,P′view用于表示在虚拟摄像机的视场角变化后的坐标系下的位置,M5用于表示变化后的视场角为5的投影矩阵,用于表示变化后的视场角为90的投影矩阵的逆矩阵。Among them, P view is used to represent the position in the coordinate system before the angle of view of the virtual camera is changed, P' view is used to represent the position in the coordinate system after the angle of view of the virtual camera is changed, and M 5 is used to represent The projection matrix of the changed field of view is 5, The inverse of the projection matrix used to represent the changed field of view of 90.
通过上述关系,将位置Pview转换为第二视场角的坐标系下的位置P′view后,按照位置P′view显示二维虚拟对象的虚拟场景图像,如图4所示,在虚拟摄像机所拍摄的图像呈现近大远小的效果的情况下,如果虚拟摄像机的视场角发生变化,使得该虚拟场景图像中的虚拟对象的显示位置发生偏移,导致虚拟场景图像中的二维虚拟对象的显示位置不准确。因此,为了保证虚拟场景图像中的二维虚拟对象的显示位置准确,基于上述实施例提供的方法,确定虚拟摄像机的视场角发生变化后的二维虚拟对象的显示位置,以使虚拟场景图像中二维虚拟对象按照确定的显示位置进行显示,如图5所示,以保证二维虚拟对象的显示位置准确。Through the above relationship, after the position P view is converted into the position P' view in the coordinate system of the second field of view, the virtual scene image of the two-dimensional virtual object is displayed according to the position P' view , as shown in Fig. 4, in the virtual camera In the case where the captured image presents the effect of being near big and far small, if the field of view of the virtual camera changes, the display position of the virtual object in the virtual scene image is shifted, resulting in a two-dimensional virtual scene in the virtual scene image. Objects are displayed in inaccurate positions. Therefore, in order to ensure that the display position of the two-dimensional virtual object in the virtual scene image is accurate, based on the method provided by the above embodiment, the display position of the two-dimensional virtual object after the field angle of the virtual camera is changed is determined, so that the virtual scene image The middle two-dimensional virtual object is displayed according to the determined display position, as shown in FIG. 5 , so as to ensure that the display position of the two-dimensional virtual object is accurate.
基于上述实施例提供的虚拟场景显示方法,计算机设备包括CPU(CentralProcessing Unit,中央处理器)、Constant Buffer(常量缓冲器)及顶点着色器。Based on the virtual scene display method provided by the above embodiment, the computer device includes a CPU (Central Processing Unit, central processing unit), a Constant Buffer (constant buffer) and a vertex shader.
通过该CPU获取虚拟摄像机变化前后的第一视场角和第二视场角,根据该第一视场角和第二视场角,确定视场角变换矩阵Tview中的参数的值,将向量发送至Constant Buffer,以供顶点着色器使用。The CPU obtains the first field of view angle and the second field of view angle before and after the virtual camera changes, and determines the value of the parameter in the field of view angle transformation matrix T view according to the first field of view angle and the second field of view. vector Sent to the Constant Buffer for use by the vertex shader.
在本申请实施例中,二维虚拟对象及二维虚拟物品均具有对应的顶点着色器,在虚拟摄像机的视场角变化后,对于二维虚拟对象的顶点着色器,从ConstantBuffer获取向量,确定视场角变换矩阵Tview,并执行上述步骤303-305,确定二维虚拟对象的第二显示位置。对于二维虚拟物品的顶点着色器,从Constant Buffer获取向量,确定视场角变换矩阵Tview,并执行上述步骤307-309,确定二维虚拟物品的第三显示位置。In this embodiment of the present application, both the two-dimensional virtual object and the two-dimensional virtual item have corresponding vertex shaders. After the field of view of the virtual camera changes, for the vertex shader of the two-dimensional virtual object, a vector is obtained from ConstantBuffer to determine The viewing angle transformation matrix T view is obtained, and the above steps 303-305 are executed to determine the second display position of the two-dimensional virtual object. For the vertex shader of the 2D virtual item, obtain the vector from the Constant Buffer, determine the field angle transformation matrix T view , and execute the above steps 307-309 to determine the third display position of the 2D virtual item.
另外,在确定二维虚拟物品的第三显示位置时,通过CPU调用GetParentRelativeLocation(获取父物体相对坐标)函数,确定该二维虚拟物品所属的父物体,响应于父物体是虚拟对象,则确定该二维虚拟对象相对于该二维虚拟物品的坐标,从而确定二维虚拟物品相对于二维虚拟对象的目标偏移量,以便后续通过二维虚拟物品的顶点着色器,确定二维虚拟物品的第三显示位置。In addition, when the third display position of the two-dimensional virtual item is determined, the function of GetParentRelativeLocation (obtaining the relative coordinates of the parent object) is called by the CPU to determine the parent object to which the two-dimensional virtual item belongs. The coordinates of the two-dimensional virtual object relative to the two-dimensional virtual object, so as to determine the target offset of the two-dimensional virtual object relative to the two-dimensional virtual object, so that the vertex shader of the two-dimensional virtual object can be used to determine the position of the two-dimensional virtual object. The third display position.
另外,基于上述实施例提供的方法,如果在虚拟场景中包括二维虚拟物品,且二维虚拟物品未被二维虚拟对象手持,则在确定二维虚拟物品的显示位置时,与上述确定二维虚拟对象的显示位置的方法类似;如果在虚拟场景中包括二维虚拟物品,且二维虚拟对象手持该二维虚拟物品,则在确定二维虚拟物品的显示位置时,按照上述确定二维虚拟对象手持的二维虚拟物品的显示位置。由于虚拟场景中的二维虚拟对象可能拾取虚拟场景中的虚拟物品,或者,二维虚拟对象可能会丢弃手持的二维虚拟物品,为了避免在二维虚拟对象拾取或者丢弃二维虚拟物品的瞬间,显示的虚拟场景图像发生跳变,因此,在目标偏移量中增加一个维度,该维度的值用于表示开关值,CPU对目标偏移量的开关值进行渐变设置,例如,开关值包括2和3,2表示该坐标值为二维虚拟物品下的坐标值,3表示该二维虚拟对象的参考点在二维虚拟物品的坐标系下的值,则通过将开关值由设置2.1、2.3、2.5、2.7、2.9,使得虚拟场景图像中显示的二维虚拟对象在拾取或丢弃二维虚拟物品时,虚拟场景图像的显示未发生跳变,从而保证虚拟场景的显示效果。In addition, based on the method provided by the above embodiment, if the virtual scene includes a two-dimensional virtual item, and the two-dimensional virtual item is not held by the two-dimensional virtual object, then when determining the display position of the two-dimensional virtual item, it is the same as the above-mentioned determination two. The method for displaying the position of the 2D virtual object is similar; if a 2D virtual item is included in the virtual scene, and the 2D virtual object holds the 2D virtual item, then when determining the display position of the 2D virtual item, the 2D virtual item is determined as described above. The display position of the 2D virtual item held by the virtual object. Since the 2D virtual object in the virtual scene may pick up the virtual item in the virtual scene, or the 2D virtual object may discard the 2D virtual item held in hand, in order to avoid the moment when the 2D virtual object picks up or discards the 2D virtual item , the displayed virtual scene image jumps. Therefore, a dimension is added to the target offset, and the value of this dimension is used to represent the switch value. The CPU performs gradient settings on the switch value of the target offset. For example, the switch value includes 2 and 3, 2 indicates that the coordinate value is the coordinate value under the two-dimensional virtual object, and 3 indicates the value of the reference point of the two-dimensional virtual object under the coordinate system of the two-dimensional virtual object, then by setting the switch value from 2.1, 2.3, 2.5, 2.7, 2.9, so that when the two-dimensional virtual object displayed in the virtual scene image picks up or discards the two-dimensional virtual item, the display of the virtual scene image does not jump, thereby ensuring the display effect of the virtual scene.
另外,基于本申请实施例提供的方法,将二维虚拟对象的目标坐标及二维虚拟物品的参考点的坐标均设置成虚拟摄像机的坐标系下的固定值,则虚拟场景图像能够呈现正交的显示效果,按照横版场景的方式显示虚拟场景。In addition, based on the method provided by the embodiment of the present application, the target coordinates of the two-dimensional virtual object and the coordinates of the reference point of the two-dimensional virtual item are both set to fixed values in the coordinate system of the virtual camera, then the virtual scene image can present an orthogonal image The display effect is displayed, and the virtual scene is displayed in the way of horizontal scene.
另外,本申请实施例提供的方法,既能够应用于横版游戏中,也能够应用于俯视视角的IO游戏中,均能够提升虚拟场景的显示效果。In addition, the method provided by the embodiment of the present application can be applied to both a horizontal game and an IO game from a top-down perspective, both of which can improve the display effect of the virtual scene.
如图6所示,基于上述实施例供的方法,在虚拟场景图像中显示的虚拟物体均呈现远大近小的效果,即虚拟场景图像呈现透视的效果。在虚拟摄像机的视场角变化后,虚拟场景图像中的正方体601会产生变形,即正方体601呈现了透视的效果,通过本申请实施例提供的方法,确定正方体602在虚拟摄像机的视场角变化后的虚拟场景图像中的显示位置,并按照确定的显示位置,在虚拟场景图像中显示该正方体602,即该正方体602未产生变形,修正了该正方体的透视效果,使得正方体602的显示位置准确。As shown in FIG. 6 , based on the method provided in the above-mentioned embodiment, the virtual objects displayed in the virtual scene image all present the effect of being far and near, that is, the virtual scene image presents the effect of perspective. After the field of view of the virtual camera changes, the
图7和图8均为虚拟场景图像的示意图,如图7所示,二维虚拟对象701和二维虚拟对象702与虚拟摄像机具有相同的距离,则二维虚拟对象701和二维虚拟对象702相比,二维虚拟对象701和二维虚拟对象702的自身未发生变形,即二维虚拟对象701和二维虚拟对象702均未产生透视效果。如图8所示,虚拟场景图像中不同位置的二维虚拟对象的尺寸太小可能不同,即二维虚拟对象801与虚拟摄像机的距离近,二维虚拟对象802与虚拟摄像机的距离远,则在该第二虚拟场景图像中,二维虚拟对象801显示尺寸大,二维虚拟对象802显示尺寸小。并且,基于本申请实施例提供的方法,虚拟摄像机能够自由运镜,例如虚拟摄像机的位置改变,或者虚拟摄像机旋转拍摄角度,使得虚拟场景图像中能够呈现不同的场景图像,使得虚拟场景能够体现出三维的显示效果,如图8所示,虚拟场景图像呈现二维虚拟对象的背部,并且保证了虚拟场景图像呈现近大远小的效果,并且二维虚拟对象的自身不产生透视的效果。7 and 8 are schematic diagrams of virtual scene images. As shown in FIG. 7 , the two-dimensional
基于本申请实施例提供的方法,能够实现横版渲染模式和三维渲染模式的自由切换,图9是一种三维场景下的虚拟场景图像,如图9所示,虚拟对象701和虚拟对象702属于同一个虚拟对象,通过对虚拟对象进行运镜处理,使得虚拟对象702相对于虚拟对象701旋转了角度,使得虚拟对象自身能够呈现三维的效果展示。通过本申请实施例提供的方法,既能够实现横版渲染的显示效果,又能够显示三维渲染模式,能够在多种渲染方案之间灵活切换,保证了虚拟场景显示的灵活性。Based on the method provided by this embodiment of the present application, it is possible to freely switch between the horizontal rendering mode and the 3D rendering mode. FIG. 9 is a virtual scene image in a 3D scene. As shown in FIG. 9 , the
图10是本申请实施例提供的一种虚拟场景显示装置的结构示意图,如图10所示,该装置包括:FIG. 10 is a schematic structural diagram of a virtual scene display device provided by an embodiment of the present application. As shown in FIG. 10 , the device includes:
图像显示模块1001,用于显示第一虚拟场景图像,第一虚拟场景图像包括虚拟场景中的二维虚拟对象,第一虚拟场景图像由虚拟摄像机对虚拟场景进行拍摄得到,虚拟摄像机所拍摄的图像呈现近大远小的效果;The
第一位置获取模块1002,用于响应于虚拟摄像机的视场角发生变化,基于二维虚拟对象在第一虚拟场景图像中的第一显示位置,获取二维虚拟对象的第二显示位置;a first
图像显示模块1001,还用于显示第二虚拟场景图像,在第二虚拟场景图像中的第二显示位置上显示有二维虚拟对象。The
在一种可能实现方式中,如图11所示,第一位置获取模块1002,包括:In a possible implementation manner, as shown in FIG. 11 , the first
第一矩阵确定单元1021,用于响应于虚拟摄像机的视场角由第一视场角变化为第二视场角,基于第一视场角及第二视场角,确定二维虚拟对象对应的视场角变换矩阵,视场角变换矩阵用于指示虚拟摄像机的视场角变化的情况;The first
第一位置获取单元1022,用于基于第一显示位置及视场角变换矩阵,获取二维虚拟对象的第二显示位置。The first
在另一种可能实现方式中,第一矩阵确定单元1021,用于将第一视场角的投影矩阵与第二视场角的投影矩阵进行融合,得到视场角变换矩阵。In another possible implementation manner, the first
在另一种可能实现方式中,第一位置获取单元1022,用于基于第一视场角,确定二维虚拟对象的参考点在第一坐标系下的目标坐标,第一坐标系为虚拟相机在第一视场角下的坐标系;获取二维虚拟对象在第一坐标系下的第一偏移矩阵,第一偏移矩阵包括二维虚拟对象的多个点与参考点在第一坐标系下的偏移量,多个点构成二维虚拟对象;基于目标坐标、第一偏移矩阵及视角变换矩阵,确定第二显示位置。In another possible implementation manner, the first
在另一种可能实现方式中,第一位置获取单元1022,用于获取二维虚拟对象在第二坐标系下的第二偏移矩阵,第二坐标系为二维虚拟对象的坐标系,第二偏移矩阵包括二维虚拟对象的多个点与参考点在第二坐标系下的偏移量;对第二偏移矩阵进行坐标系变换,得到第一偏移矩阵。In another possible implementation manner, the first
在另一种可能实现方式中,第一位置获取单元1022,用于获取二维虚拟对象的参考点在第二坐标系下的参考坐标,第二坐标系为二维虚拟对象的坐标系;对参考坐标进行坐标系变换,得到目标坐标。In another possible implementation manner, the first
在另一种可能实现方式中,如图11所示,装置还包括:In another possible implementation manner, as shown in FIG. 11 , the apparatus further includes:
变化量确定模块1003,用于确定第二显示位置与第一显示位置之间的位置变化量;A change
位置调整模块1004,用于根据位置变化量,调整二维虚拟对象在虚拟场景中的位置;a
场景渲染模块1005,用于渲染虚拟摄像机在视场角变化后拍摄到的虚拟场景,得到第二虚拟场景图像。The
在另一种可能实现方式中,二维虚拟对象手持的二维虚拟物品;如图11所示,装置还包括:In another possible implementation manner, a two-dimensional virtual object held by a two-dimensional virtual object; as shown in FIG. 11 , the apparatus further includes:
第二位置获取模块1006,用于基于二维虚拟物品与二维虚拟对象在第一虚拟场景图像中的相对显示位置,获取二维虚拟物品的第三显示位置;The second
物品显示模块1007,用于在第二虚拟场景图像中第三显示位置上,显示二维虚拟物品。The
在另一种可能实现方式中,如图11所示,第二位置获取模块1006,包括:In another possible implementation manner, as shown in FIG. 11 , the second
第二矩阵确定单元1061,用于响应于虚拟摄像机的视场角由第一视场角变化为第二视场角,基于第一视场角及第二视场角,确定二维虚拟对象对应的视场角变换矩阵,视场角变换矩阵用于指示虚拟摄像机的视场角变化的情况;The second
第二位置获取单元1062,用于基于相对显示位置及视场角变换矩阵,获取二维虚拟物品的第三显示位置。The second
在另一种可能实现方式中,第二位置获取单元1062,用于获取二维虚拟对象的参考点与二维虚拟物品的参考点在第一坐标系下的目标偏移量,第一坐标系为虚拟相机在第一视场角下的坐标系;获取二维虚拟物品在第一坐标系下的第三偏移矩阵,第三偏移矩阵包括二维虚拟物品的多个点与二维虚拟对象的参考点在第一坐标系下的偏移量,多个点构成二维虚拟物品;基于目标偏移量、第三偏移矩阵及视角变换矩阵,确定第三显示位置。In another possible implementation, the second
在另一种可能实现方式中,第二位置获取单元1062,用于获取二维虚拟对象的参考点与二维虚拟物品的参考点在第三坐标系下的参考偏移量,第三坐标系为二维虚拟物品的坐标系;对参考偏移量进行坐标系变换,得到目标偏移量。In another possible implementation, the second
在另一种可能实现方式中,第二位置获取单元1062,用于获取二维虚拟物品在第三坐标系下的第四偏移矩阵,第三坐标系为二维虚拟物品的坐标系,第四偏移矩阵包括二维虚拟物品的多个点与二维虚拟对象的参考点在第三坐标系下的偏移量;对第四偏移矩阵进行坐标系变换,得到第三偏移矩阵。In another possible implementation manner, the second
需要说明的是:上述实施例提供的虚拟场景显示装置,仅以上述各功能模块的划分进行举例说明,实际应用中,能够根据需要而将上述功能分配由不同的功能模块完成,即将计算机设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的虚拟场景显示装置与虚拟场景显示方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that: the virtual scene display device provided by the above embodiment is only illustrated by the division of the above functional modules. In practical applications, the above functions can be allocated to different functional modules according to needs. The internal structure is divided into different functional modules to complete all or part of the functions described above. In addition, the virtual scene display device and the virtual scene display method embodiments provided by the above embodiments belong to the same concept, and the specific implementation process thereof is detailed in the method embodiments, which will not be repeated here.
本申请实施例还提供了一种计算机设备,该计算机设备包括处理器和存储器,存储器中存储有至少一条计算机程序,该至少一条计算机程序由处理器加载并执行以实现上述实施例的虚拟场景显示方法中所执行的操作。An embodiment of the present application further provides a computer device, the computer device includes a processor and a memory, and the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to realize the virtual scene display of the above embodiment the action performed in the method.
可选地,计算机设备提供为终端。图12示出了本申请一个示例性实施例提供的终端1200的结构框图。该终端1200可以是便携式移动终端,比如:智能手机、平板电脑、MP3播放器(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、笔记本电脑或台式电脑。终端1200还可能被称为用户设备、便携式终端、膝上型终端、台式终端等其他名称。Optionally, the computer equipment is provided as a terminal. FIG. 12 shows a structural block diagram of a terminal 1200 provided by an exemplary embodiment of the present application. The terminal 1200 may be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, the
终端1200包括有:处理器1201和存储器1202。The terminal 1200 includes: a
处理器1201可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器1201可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器1201也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central ProcessingUnit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器1201可以集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器1201还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The
存储器1202可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器1202还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器1202中的非暂态的计算机可读存储介质用于存储至少一个计算机程序,该至少一个计算机程序用于被处理器1201所执行以实现本申请中方法实施例提供的虚拟场景显示方法。
在一些实施例中,终端1200还可选包括有:外围设备接口1203和至少一个外围设备。处理器1201、存储器1202和外围设备接口1203之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口1203相连。具体地,外围设备包括:射频电路1204、显示屏1205、摄像头组件1206、音频电路1207、定位组件1208和电源1209中的至少一种。In some embodiments, the terminal 1200 may optionally further include: a peripheral device interface 1203 and at least one peripheral device. The
外围设备接口1203可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器1201和存储器1202。在一些实施例中,处理器1201、存储器1202和外围设备接口1203被集成在同一芯片或电路板上;在一些其他实施例中,处理器1201、存储器1202和外围设备接口1203中的任意一个或两个可以在单独的芯片或电路板上实现,本实施例对此不加以限定。The peripheral device interface 1203 may be used to connect at least one peripheral device related to I/O (Input/Output) to the
射频电路1204用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路1204通过电磁信号与通信网络以及其他通信设备进行通信。射频电路1204将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路1204包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块卡等等。射频电路1204可以通过至少一种无线通信协议来与其它终端进行通信。该无线通信协议包括但不限于:万维网、城域网、内联网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或WiFi(Wireless Fidelity,无线保真)网络。在一些实施例中,射频电路1204还可以包括NFC(Near Field Communication,近距离无线通信)有关的电路,本申请对此不加以限定。The
显示屏1205用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏1205是触摸显示屏时,显示屏1205还具有采集在显示屏1205的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器1201进行处理。此时,显示屏1205还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏1205可以为一个,设置在终端1200的前面板;在另一些实施例中,显示屏1205可以为至少两个,分别设置在终端1200的不同表面或呈折叠设计;在另一些实施例中,显示屏1205可以是柔性显示屏,设置在终端1200的弯曲表面上或折叠面上。甚至,显示屏1205还可以设置成非矩形的不规则图形,也即异形屏。显示屏1205可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-EmittingDiode,有机发光二极管)等材质制备。The
摄像头组件1206用于采集图像或视频。可选地,摄像头组件1206包括前置摄像头和后置摄像头。前置摄像头设置在终端的前面板,后置摄像头设置在终端的背面。在一些实施例中,后置摄像头为至少两个,分别为主摄像头、景深摄像头、广角摄像头、长焦摄像头中的任意一种,以实现主摄像头和景深摄像头融合实现背景虚化功能、主摄像头和广角摄像头融合实现全景拍摄以及VR(Virtual Reality,虚拟现实)拍摄功能或者其它融合拍摄功能。在一些实施例中,摄像头组件1206还可以包括闪光灯。闪光灯可以是单色温闪光灯,也可以是双色温闪光灯。双色温闪光灯是指暖光闪光灯和冷光闪光灯的组合,可以用于不同色温下的光线补偿。The
音频电路1207可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器1201进行处理,或者输入至射频电路1204以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在终端1200的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器1201或射频电路1204的电信号转换为声波。扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路1207还可以包括耳机插孔。
定位组件1208用于定位终端1200的当前地理位置,以实现导航或LBS(LocationBased Service,基于位置的服务)。定位组件1208可以是基于美国的GPS(GlobalPositioning System,全球定位系统)、中国的北斗系统或俄罗斯的伽利略系统的定位组件。The
电源1209用于为终端1200中的各个组件进行供电。电源1209可以是交流电、直流电、一次性电池或可充电电池。当电源1209包括可充电电池时,该可充电电池可以是有线充电电池或无线充电电池。有线充电电池是通过有线线路充电的电池,无线充电电池是通过无线线圈充电的电池。该可充电电池还可以用于支持快充技术。The
在一些实施例中,终端1200还包括有一个或多个传感器1210。该一个或多个传感器1210包括但不限于:加速度传感器1211、陀螺仪传感器1212、压力传感器1213、指纹传感器1214、光学传感器1215以及接近传感器1216。In some embodiments, the terminal 1200 also includes one or more sensors 1210 . The one or more sensors 1210 include, but are not limited to, an acceleration sensor 1211 , a gyro sensor 1212 , a pressure sensor 1213 , a fingerprint sensor 1214 , an optical sensor 1215 , and a proximity sensor 1216 .
加速度传感器1211可以检测以终端1200建立的坐标系的三个坐标轴上的加速度大小。比如,加速度传感器1211可以用于检测重力加速度在三个坐标轴上的分量。处理器1201可以根据加速度传感器1211采集的重力加速度信号,控制显示屏1205以横向视图或纵向视图进行用户界面的显示。加速度传感器1211还可以用于游戏或者用户的运动数据的采集。The acceleration sensor 1211 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the
陀螺仪传感器1212可以检测终端1200的机体方向及转动角度,陀螺仪传感器1212可以与加速度传感器1211协同采集用户对终端1200的3D动作。处理器1201根据陀螺仪传感器1212采集的数据,可以实现如下功能:动作感应(比如根据用户的倾斜操作来改变UI)、拍摄时的图像稳定、游戏控制以及惯性导航。The gyroscope sensor 1212 can detect the body direction and rotation angle of the terminal 1200 , and the gyroscope sensor 1212 can cooperate with the acceleration sensor 1211 to collect 3D actions of the user on the
压力传感器1213可以设置在终端1200的侧边框和/或显示屏1205的下层。当压力传感器1213设置在终端1200的侧边框时,可以检测用户对终端1200的握持信号,由处理器1201根据压力传感器1213采集的握持信号进行左右手识别或快捷操作。当压力传感器1213设置在显示屏1205的下层时,由处理器1201根据用户对显示屏1205的压力操作,实现对UI界面上的可操作性控件进行控制。可操作性控件包括按钮控件、滚动条控件、图标控件、菜单控件中的至少一种。The pressure sensor 1213 may be disposed on the side frame of the terminal 1200 and/or the lower layer of the
指纹传感器1214用于采集用户的指纹,由处理器1201根据指纹传感器1214采集到的指纹识别用户的身份,或者,由指纹传感器1214根据采集到的指纹识别用户的身份。在识别出用户的身份为可信身份时,由处理器1201授权该用户执行相关的敏感操作,该敏感操作包括解锁屏幕、查看加密信息、下载软件、支付及更改设置等。指纹传感器1214可以被设置在终端1200的正面、背面或侧面。当终端1200上设置有物理按键或厂商Logo时,指纹传感器1214可以与物理按键或厂商Logo集成在一起。The fingerprint sensor 1214 is used to collect the user's fingerprint, and the
光学传感器1215用于采集环境光强度。在一个实施例中,处理器1201可以根据光学传感器1215采集的环境光强度,控制显示屏1205的显示亮度。具体地,当环境光强度较高时,调高显示屏1205的显示亮度;当环境光强度较低时,调低显示屏1205的显示亮度。在另一个实施例中,处理器1201还可以根据光学传感器1215采集的环境光强度,动态调整摄像头组件1206的拍摄参数。Optical sensor 1215 is used to collect ambient light intensity. In one embodiment, the
接近传感器1216,也称距离传感器,设置在终端1200的前面板。接近传感器1216用于采集用户与终端1200的正面之间的距离。在一个实施例中,当接近传感器1216检测到用户与终端1200的正面之间的距离逐渐变小时,由处理器1201控制显示屏1205从亮屏状态切换为息屏状态;当接近传感器1216检测到用户与终端1200的正面之间的距离逐渐变大时,由处理器1201控制显示屏1205从息屏状态切换为亮屏状态。A proximity sensor 1216 , also called a distance sensor, is provided on the front panel of the
本领域技术人员可以理解,图12中示出的结构并不构成对终端1200的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。Those skilled in the art can understand that the structure shown in FIG. 12 does not constitute a limitation on the terminal 1200, and may include more or less components than the one shown, or combine some components, or adopt different component arrangements.
可选地,计算机设备提供为服务器。图13是本申请实施例提供的一种服务器的结构示意图,该服务器1300可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(Central Processing Units,CPU)1301和一个或一个以上的存储器1302,其中,存储器1302中存储有至少一条计算机程序,至少一条计算机程序由处理器1301加载并执行以实现上述各个方法实施例提供的方法。当然,该服务器还可以具有有线或无线网络接口、键盘及输入输出接口等部件,以便进行输入输出,该服务器还可以包括其他用于实现设备功能的部件,在此不做赘述。Optionally, the computer device is provided as a server. FIG. 13 is a schematic structural diagram of a server provided by an embodiment of the present application. The
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有至少一条计算机程序,该至少一条计算机程序由处理器加载并执行以实现上述实施例的虚拟场景显示方法中所执行的操作。Embodiments of the present application further provide a computer-readable storage medium, where at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to implement the virtual scene display method of the above embodiment operations performed in .
本申请实施例还提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机程序代码,该计算机程序代码存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机程序代码,处理器执行该计算机程序代码,使得该计算机设备实现如上述实施例的虚拟场景显示方法中所执行的操作。Embodiments of the present application also provide a computer program product or computer program, where the computer program product or computer program includes computer program code, and the computer program code is stored in a computer-readable storage medium. The processor of the computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device implements the operations performed in the virtual scene display method of the above-mentioned embodiment.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium can be read-only memory, magnetic disk or optical disk, etc.
以上所述仅为本申请实施例的可选实施例,并不用以限制本申请实施例,凡在本申请实施例的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only optional embodiments of the embodiments of the present application, and are not intended to limit the embodiments of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the embodiments of the present application shall be Included within the scope of protection of this application.
Claims (15)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011233140.5A CN113384880B (en) | 2020-11-06 | 2020-11-06 | Virtual scene display method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011233140.5A CN113384880B (en) | 2020-11-06 | 2020-11-06 | Virtual scene display method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113384880A true CN113384880A (en) | 2021-09-14 |
CN113384880B CN113384880B (en) | 2025-06-24 |
Family
ID=77616529
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011233140.5A Active CN113384880B (en) | 2020-11-06 | 2020-11-06 | Virtual scene display method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113384880B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113852838A (en) * | 2021-09-24 | 2021-12-28 | 北京字跳网络技术有限公司 | Video data generation method, apparatus, electronic device, and readable storage medium |
CN114205532A (en) * | 2022-02-21 | 2022-03-18 | 广州三七极创网络科技有限公司 | Shooting method, device, equipment and medium of virtual camera |
CN114779940A (en) * | 2022-05-07 | 2022-07-22 | 大连理工大学 | User field angle adjusting method and system suitable for three-dimensional VR scene |
CN115379195A (en) * | 2022-08-26 | 2022-11-22 | 维沃移动通信有限公司 | Video generation method and device, electronic equipment and readable storage medium |
US12159338B1 (en) * | 2023-10-06 | 2024-12-03 | Htc Corporation | Method for controlling avatar in virtual environment by determining a difference in poses between a target object and a reference object, host, and computer readable storage medium |
WO2025119226A1 (en) * | 2023-12-05 | 2025-06-12 | 北京字跳网络技术有限公司 | Image processing method, apparatus, device, readable storage medium, and product |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2010082933A1 (en) * | 2009-01-16 | 2010-07-22 | World Golf Tour, Inc. | Position estimation refinement |
CN102164274A (en) * | 2011-04-26 | 2011-08-24 | 石黎 | Vehicle-mounted virtual panoramic system with variable field of view |
CN111420402A (en) * | 2020-03-18 | 2020-07-17 | 腾讯科技(深圳)有限公司 | Virtual environment picture display method, device, terminal and storage medium |
-
2020
- 2020-11-06 CN CN202011233140.5A patent/CN113384880B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2010082933A1 (en) * | 2009-01-16 | 2010-07-22 | World Golf Tour, Inc. | Position estimation refinement |
CN102164274A (en) * | 2011-04-26 | 2011-08-24 | 石黎 | Vehicle-mounted virtual panoramic system with variable field of view |
CN111420402A (en) * | 2020-03-18 | 2020-07-17 | 腾讯科技(深圳)有限公司 | Virtual environment picture display method, device, terminal and storage medium |
Non-Patent Citations (1)
Title |
---|
"CF:新版本-烛龙,双击鼠标右键可开启16倍镜", Retrieved from the Internet <URL:https://www.bilibili.com/video/BV1ub41147C3/?spm_id_from=333.337.search-card.all.click&vd_source=5cd74de20ed05a078c637d5a77857fe2> * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113852838A (en) * | 2021-09-24 | 2021-12-28 | 北京字跳网络技术有限公司 | Video data generation method, apparatus, electronic device, and readable storage medium |
CN113852838B (en) * | 2021-09-24 | 2023-08-11 | 北京字跳网络技术有限公司 | Video data generation method, device, electronic device and readable storage medium |
US12356054B2 (en) | 2021-09-24 | 2025-07-08 | Beijing Zitiao Network Technology Co., Ltd. | Video data generation method and apparatus, electronic device, and readable storage medium |
CN114205532A (en) * | 2022-02-21 | 2022-03-18 | 广州三七极创网络科技有限公司 | Shooting method, device, equipment and medium of virtual camera |
CN114779940A (en) * | 2022-05-07 | 2022-07-22 | 大连理工大学 | User field angle adjusting method and system suitable for three-dimensional VR scene |
CN115379195A (en) * | 2022-08-26 | 2022-11-22 | 维沃移动通信有限公司 | Video generation method and device, electronic equipment and readable storage medium |
CN115379195B (en) * | 2022-08-26 | 2023-10-03 | 维沃移动通信有限公司 | Video generation method, device, electronic device and readable storage medium |
US12159338B1 (en) * | 2023-10-06 | 2024-12-03 | Htc Corporation | Method for controlling avatar in virtual environment by determining a difference in poses between a target object and a reference object, host, and computer readable storage medium |
WO2025119226A1 (en) * | 2023-12-05 | 2025-06-12 | 北京字跳网络技术有限公司 | Image processing method, apparatus, device, readable storage medium, and product |
Also Published As
Publication number | Publication date |
---|---|
CN113384880B (en) | 2025-06-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11962930B2 (en) | Method and apparatus for controlling a plurality of virtual characters, device, and storage medium | |
CN109712224B (en) | Virtual scene rendering method and device and intelligent device | |
US20210058612A1 (en) | Virtual reality display method, device, system and storage medium | |
CN111768454B (en) | Pose determination method, pose determination device, pose determination equipment and storage medium | |
CN110841285B (en) | Interface element display method and device, computer equipment and storage medium | |
CN110427110B (en) | Live broadcast method and device and live broadcast server | |
CN113384880B (en) | Virtual scene display method, device, computer equipment and storage medium | |
CN111464749B (en) | Method, device, equipment and storage medium for image synthesis | |
CN109166150B (en) | Pose acquisition method and device storage medium | |
CN111897429A (en) | Image display method, device, computer equipment and storage medium | |
CN110288689B (en) | Method and device for rendering electronic map | |
CN110839174A (en) | Image processing method and device, computer equipment and storage medium | |
WO2022134632A1 (en) | Work processing method and apparatus | |
CN111598981B (en) | Character model display method, device, equipment and storage medium | |
CN111385525B (en) | Video monitoring method, device, terminal and system | |
CN108848405B (en) | Image processing method and device | |
CN110853128A (en) | Virtual object display method and device, computer equipment and storage medium | |
WO2022199102A1 (en) | Image processing method and device | |
CN111192072A (en) | User grouping method and device and storage medium | |
CN112967261B (en) | Image fusion method, device, equipment and storage medium | |
CN110971840B (en) | Video mapping method and device, computer equipment and storage medium | |
CN114581477A (en) | Map area merging method, device, electronic device and storage medium | |
CN115552400A (en) | Sliding verification method, image generation method, device, equipment and storage medium | |
CN110660031B (en) | Image sharpening method and device and storage medium | |
CN110443841B (en) | Method, device and system for measuring ground depth |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40052222 Country of ref document: HK |
|
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |