[go: up one dir, main page]

CN113384880A - Virtual scene display method, device, computer equipment and storage medium - Google Patents

Virtual scene display method, device, computer equipment and storage medium Download PDF

Info

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
Application number
CN202011233140.5A
Other languages
Chinese (zh)
Other versions
CN113384880B (en
Inventor
唐声福
宋伟鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011233140.5A priority Critical patent/CN113384880B/en
Publication of CN113384880A publication Critical patent/CN113384880A/en
Application granted granted Critical
Publication of CN113384880B publication Critical patent/CN113384880B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/56Computing 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
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features 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/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods 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

本申请实施例公开了一种虚拟场景显示方法、装置、计算机设备及存储介质,属于计算机技术领域。该方法包括:显示第一虚拟场景图像,第一虚拟场景图像由虚拟摄像机对虚拟场景进行拍摄得到,虚拟摄像机所拍摄的图像呈现近大远小的效果;响应于虚拟摄像机的视场角发生变化,基于二维虚拟对象在第一虚拟场景图像中的第一显示位置,获取二维虚拟对象的第二显示位置,显示第二虚拟场景图像,在第二虚拟场景图像中的第二显示位置上显示有二维虚拟对象。在虚拟摄像机的视场角发生变化时,对虚拟场景图像中的二维虚拟对象的显示位置进行修正,虚拟场景图像既呈现三维效果,又能保证二维虚拟对象的显示位置准确,从而提升了虚拟场景的显示效果。

Figure 202011233140

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.

Figure 202011233140

Description

虚拟场景显示方法、装置、计算机设备及存储介质Virtual scene display method, device, computer equipment and storage medium

技术领域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 server 102, and the terminal 101 and the server 102 can communicate directly or indirectly through wired or wireless communication. connection, and this application does not limit it.

服务器102为终端101提供虚拟场景图像,终端101能够显示服务器102提供的虚拟场景图像,并且终端101能够对虚拟场景进行控制,服务器102用于为终端101提供后台支持,能够根据终端101对虚拟场景的控制进行后台处理。The server 102 provides the terminal 101 with a virtual scene image, and the terminal 101 can display the virtual scene image provided by the server 102, and the terminal 101 can control the virtual scene. The control is processed in the background.

可选地,终端101安装有游戏应用,服务器102为该游戏应用提供服务,通过该游戏应用,终端101与服务器102能够进行交互。服务器102为终端101提供服务,以使终端101能够显示虚拟场景图像,并能够对虚拟场景图像进行操作,如控制虚拟对象进行攻击或移动。Optionally, the terminal 101 is installed with a game application, the server 102 provides services for the game application, and through the game application, the terminal 101 and the server 102 can interact. The server 102 provides services for the terminal 101, so that the terminal 101 can display a virtual scene image, and can perform operations on the virtual scene image, such as controlling a virtual object to attack or move.

本申请实施例提供的方法,可用于多种场景。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 step 302 includes: fusing the projection matrix of the first field of view with the projection matrix of the second field of view to obtain a conversion matrix of the field of view. The projection matrix is used to indicate the matrix for projecting the virtual scene captured by the virtual camera into the virtual scene image. The projection matrices corresponding to different field of view angles are different, that is, the projection matrix of the first field of view angle and the The projection matrix is different.

可选地,获取视场角变换矩阵的过程包括:确定第一视场角的投影矩阵的逆矩阵,将第二视场角的投影矩阵与该逆矩阵之间的乘积,确定为该视场角变换矩阵。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:

Figure BDA0002765865340000091
Figure BDA0002765865340000091

其中,

Figure BDA0002765865340000092
表示第一视场角的投影矩阵Mx的逆矩阵;x表示第一视场角;y表示第二视场角。in,
Figure BDA0002765865340000092
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 step 303 includes: acquiring the reference coordinates of the reference point of the two-dimensional virtual object in the second coordinate system, and performing coordinate system transformation on the reference coordinates to obtain the target coordinates.

其中,第二坐标系为二维虚拟对象的坐标系,该二维虚拟对象的参考点在不同的坐标系下具有不同的坐标值,将该参考点在第二坐标系下的坐标,称为参考坐标,将该参考点在第一坐标系下的坐标,称为目标坐标。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·T0O 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, step 304 includes: acquiring a second offset matrix of the two-dimensional virtual object in the second coordinate system, and performing coordinate system transformation on the second offset matrix to obtain the first offset matrix.

其中,第二坐标系为二维虚拟对象的坐标系,第二偏移矩阵包括二维虚拟对象的多个点与参考点在第二坐标系下的偏移量。例如,二维虚拟对象的参考点为第二坐标系的原点,则在第二坐标系下,二维虚拟对象的多个点与该原点之间的偏移量构成了该第二偏移矩阵,以表示该二维虚拟对象与该原点的相对位置。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

Figure BDA0002765865340000111
P "view =O view +V view ·T view ;
Figure BDA0002765865340000111

其中,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)·T0V 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. Steps 303 to 305 , other methods can be adopted to obtain the second display position of the two-dimensional virtual object based on the first display position and the viewing angle transformation matrix.

需要说明的是,本申请实施例是以虚拟对象对应的视场角变换矩阵来确定二维虚拟对象的第二显示位置进行说明的,而在另一实施例中,无需执行步骤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 step 306, the method further includes: determining a position change amount between the second display position and the first display position, and adjusting the position change of the two-dimensional virtual object in the virtual scene according to the position change amount position, and render the virtual scene captured by the virtual camera after the angle of view is changed to obtain a second virtual scene image.

通过二维虚拟对象的第一显示位置及第二显示位置,即可确定该二维虚拟对象在虚拟摄像机的视场角变化后的位置变化量,通过位置变化量对二维虚拟对象的显示位置进行调整,以保证显示的第二虚拟场景图像中的二维虚拟对象的显示位置准确。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 step 306 includes: determining a fourth display position of the two-dimensional virtual object in the clipping coordinate system according to the second display position, and rendering the virtual camera in the second field of view according to the fourth display position The virtual scene captured from the corner is used to obtain the second virtual scene image, so that a two-dimensional virtual item is displayed on the third display position in the second virtual scene image.

可选地,第二显示位置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·MxP 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·MyO view ·M x =O' view ·M y ;

Figure BDA0002765865340000131
Figure BDA0002765865340000131

其中,x用于表示第一视场角;y用于表示第二视场角;

Figure BDA0002765865340000132
表示第二视场角的投影矩阵My的逆矩阵。Wherein, x is used to represent the first angle of view; y is used to represent the second angle of view;
Figure BDA0002765865340000132
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·MxP clip =P″ view ·M x ;

Figure BDA0002765865340000133
Figure BDA0002765865340000133

其中,x表示第一视场角;y表示第二视场角;Mx表示第一视场角的投影矩阵;Oview表示目标坐标;My表示第二视场角的投影矩阵;

Figure BDA0002765865340000134
表示第一视场角的投影矩阵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;
Figure BDA0002765865340000134
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 step 302, the method further includes the following steps 307-310:

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、第三偏移矩阵

Figure BDA0002765865340000152
视场角变换矩阵Tview及第三显示位置P″′view,满足以下关系:In a possible implementation, the target offset Q view , the third offset matrix
Figure BDA0002765865340000152
The viewing angle transformation matrix T view and the third display position P″′ view satisfy the following relationship:

Figure BDA0002765865340000151
Figure BDA0002765865340000151

其中,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:

Figure BDA0002765865340000171
Figure BDA0002765865340000171

其中,Pview用于表示在虚拟摄像机的视场角变化前的坐标系下的位置,P′view用于表示在虚拟摄像机的视场角变化后的坐标系下的位置,M5用于表示变化后的视场角为5的投影矩阵,

Figure BDA0002765865340000172
用于表示变化后的视场角为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,
Figure BDA0002765865340000172
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中的参数的值,将向量

Figure BDA0002765865340000173
发送至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
Figure BDA0002765865340000173
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 cube 601 in the virtual scene image will be deformed, that is, the cube 601 presents a perspective effect, and the method provided by the embodiment of the present application is used to determine the change of the field of view of the cube 602 in the virtual camera. and display the cube 602 in the virtual scene image according to the determined display position, that is, the cube 602 is not deformed, and the perspective effect of the cube is corrected, so that the display position of the cube 602 is accurate .

图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 virtual object 701 and the two-dimensional virtual object 702 have the same distance from the virtual camera, then the two-dimensional virtual object 701 and the two-dimensional virtual object 702 In contrast, the two-dimensional virtual object 701 and the two-dimensional virtual object 702 are not deformed themselves, that is, neither the two-dimensional virtual object 701 nor the two-dimensional virtual object 702 produces a perspective effect. As shown in FIG. 8 , the size of the two-dimensional virtual objects at different positions in the virtual scene image may be too small, that is, the distance between the two-dimensional virtual object 801 and the virtual camera is short, and the distance between the two-dimensional virtual object 802 and the virtual camera is far, then In the second virtual scene image, the display size of the two-dimensional virtual object 801 is large, and the display size of the two-dimensional virtual object 802 is small. Moreover, based on the method provided by the embodiment of the present application, the virtual camera can move freely, for example, the position of the virtual camera is changed, or the shooting angle of the virtual camera is rotated, so that different scene images can be presented in the virtual scene image, so that the virtual scene can reflect For the three-dimensional display effect, as shown in FIG. 8 , the virtual scene image presents the back of the two-dimensional virtual object, and it is ensured that the virtual scene image presents the effect of being near big and far small, and the two-dimensional virtual object itself does not produce a perspective effect.

基于本申请实施例提供的方法,能够实现横版渲染模式和三维渲染模式的自由切换,图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 virtual object 701 and the virtual object 702 belong to For the same virtual object, by performing mirror motion processing on the virtual object, the virtual object 702 is rotated relative to the virtual object 701 by an angle, so that the virtual object itself can present a three-dimensional effect display. The method provided by the embodiment of the present application can not only realize the display effect of horizontal rendering, but also can display the three-dimensional rendering mode, and can flexibly switch between various rendering schemes, which ensures the flexibility of virtual scene display.

图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 image display module 1001 is used to display a first virtual scene image, 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 Present the effect of near big and far small;

第一位置获取模块1002,用于响应于虚拟摄像机的视场角发生变化,基于二维虚拟对象在第一虚拟场景图像中的第一显示位置,获取二维虚拟对象的第二显示位置;a first position obtaining module 1002, configured 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 in response to the change of the field of view of the virtual camera;

图像显示模块1001,还用于显示第二虚拟场景图像,在第二虚拟场景图像中的第二显示位置上显示有二维虚拟对象。The image display module 1001 is further configured to display a second virtual scene image, and a two-dimensional virtual object is displayed on the second display position in the second virtual scene image.

在一种可能实现方式中,如图11所示,第一位置获取模块1002,包括:In a possible implementation manner, as shown in FIG. 11 , the first position acquisition module 1002 includes:

第一矩阵确定单元1021,用于响应于虚拟摄像机的视场角由第一视场角变化为第二视场角,基于第一视场角及第二视场角,确定二维虚拟对象对应的视场角变换矩阵,视场角变换矩阵用于指示虚拟摄像机的视场角变化的情况;The first matrix determination unit 1021 is configured to, in response to the change of the field of view angle of the virtual camera from the first field of view angle to the second field of view angle, determine the corresponding two-dimensional virtual object based on the first field of view angle and the second field of view angle The field of view angle transformation matrix is used to indicate the change of the field of view angle of the virtual camera;

第一位置获取单元1022,用于基于第一显示位置及视场角变换矩阵,获取二维虚拟对象的第二显示位置。The first position obtaining unit 1022 is configured to obtain the second display position of the two-dimensional virtual object based on the first display position and the viewing angle transformation matrix.

在另一种可能实现方式中,第一矩阵确定单元1021,用于将第一视场角的投影矩阵与第二视场角的投影矩阵进行融合,得到视场角变换矩阵。In another possible implementation manner, the first matrix determination unit 1021 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 transformation matrix of the angle of view.

在另一种可能实现方式中,第一位置获取单元1022,用于基于第一视场角,确定二维虚拟对象的参考点在第一坐标系下的目标坐标,第一坐标系为虚拟相机在第一视场角下的坐标系;获取二维虚拟对象在第一坐标系下的第一偏移矩阵,第一偏移矩阵包括二维虚拟对象的多个点与参考点在第一坐标系下的偏移量,多个点构成二维虚拟对象;基于目标坐标、第一偏移矩阵及视角变换矩阵,确定第二显示位置。In another possible implementation manner, the first position obtaining unit 1022 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 a first coordinate system, where the first coordinate system is a virtual camera The coordinate system under the first field of view angle; obtain the first offset matrix of the two-dimensional virtual object under the first coordinate system, and the first offset matrix includes multiple points of the two-dimensional virtual object and the reference point at the first coordinate The offset under the system is determined, and a plurality of points constitute a two-dimensional virtual object; the second display position is determined based on the target coordinates, the first offset matrix and the viewing angle transformation matrix.

在另一种可能实现方式中,第一位置获取单元1022,用于获取二维虚拟对象在第二坐标系下的第二偏移矩阵,第二坐标系为二维虚拟对象的坐标系,第二偏移矩阵包括二维虚拟对象的多个点与参考点在第二坐标系下的偏移量;对第二偏移矩阵进行坐标系变换,得到第一偏移矩阵。In another possible implementation manner, the first position obtaining unit 1022 is configured to obtain a second offset matrix of the two-dimensional virtual object in a second coordinate system, where the second coordinate system is the coordinate system of the two-dimensional virtual object, and the first position 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; the coordinate system transformation is performed on the second offset matrix to obtain the first offset matrix.

在另一种可能实现方式中,第一位置获取单元1022,用于获取二维虚拟对象的参考点在第二坐标系下的参考坐标,第二坐标系为二维虚拟对象的坐标系;对参考坐标进行坐标系变换,得到目标坐标。In another possible implementation manner, the first position obtaining unit 1022 is configured to obtain the reference coordinates of the reference point of the two-dimensional virtual object in the second coordinate system, and the second coordinate system is the coordinate system of the two-dimensional virtual object; The reference coordinates are transformed into the coordinate system to obtain the target coordinates.

在另一种可能实现方式中,如图11所示,装置还包括:In another possible implementation manner, as shown in FIG. 11 , the apparatus further includes:

变化量确定模块1003,用于确定第二显示位置与第一显示位置之间的位置变化量;A change amount determination module 1003, configured to determine the position change amount between the second display position and the first display position;

位置调整模块1004,用于根据位置变化量,调整二维虚拟对象在虚拟场景中的位置;a position adjustment module 1004, configured to adjust the position of the two-dimensional virtual object in the virtual scene according to the position change;

场景渲染模块1005,用于渲染虚拟摄像机在视场角变化后拍摄到的虚拟场景,得到第二虚拟场景图像。The scene rendering module 1005 is configured to render the virtual scene captured by the virtual camera after the angle of view is changed to obtain a second virtual scene image.

在另一种可能实现方式中,二维虚拟对象手持的二维虚拟物品;如图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 position obtaining module 1006 is configured to obtain the 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;

物品显示模块1007,用于在第二虚拟场景图像中第三显示位置上,显示二维虚拟物品。The item display module 1007 is configured to display a two-dimensional virtual item at the third display position in the second virtual scene image.

在另一种可能实现方式中,如图11所示,第二位置获取模块1006,包括:In another possible implementation manner, as shown in FIG. 11 , the second location acquisition module 1006 includes:

第二矩阵确定单元1061,用于响应于虚拟摄像机的视场角由第一视场角变化为第二视场角,基于第一视场角及第二视场角,确定二维虚拟对象对应的视场角变换矩阵,视场角变换矩阵用于指示虚拟摄像机的视场角变化的情况;The second matrix determining unit 1061 is configured to, in response to the change of the viewing angle of the virtual camera from the first viewing angle to the second viewing angle, determine the corresponding two-dimensional virtual object based on the first viewing angle and the second viewing angle The field of view angle transformation matrix is used to indicate the change of the field of view angle of the virtual camera;

第二位置获取单元1062,用于基于相对显示位置及视场角变换矩阵,获取二维虚拟物品的第三显示位置。The second position obtaining unit 1062 is 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.

在另一种可能实现方式中,第二位置获取单元1062,用于获取二维虚拟对象的参考点与二维虚拟物品的参考点在第一坐标系下的目标偏移量,第一坐标系为虚拟相机在第一视场角下的坐标系;获取二维虚拟物品在第一坐标系下的第三偏移矩阵,第三偏移矩阵包括二维虚拟物品的多个点与二维虚拟对象的参考点在第一坐标系下的偏移量,多个点构成二维虚拟物品;基于目标偏移量、第三偏移矩阵及视角变换矩阵,确定第三显示位置。In another possible implementation, the second position obtaining unit 1062 is configured to obtain 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, 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 object under the first coordinate system is obtained, and the third offset matrix includes multiple points of the two-dimensional virtual object and two-dimensional virtual objects. The offset of the reference point of the object in the first coordinate system, and multiple points constitute a two-dimensional virtual item; the third display position is determined based on the target offset, the third offset matrix and the viewing angle transformation matrix.

在另一种可能实现方式中,第二位置获取单元1062,用于获取二维虚拟对象的参考点与二维虚拟物品的参考点在第三坐标系下的参考偏移量,第三坐标系为二维虚拟物品的坐标系;对参考偏移量进行坐标系变换,得到目标偏移量。In another possible implementation, the second position obtaining unit 1062 is configured to obtain the 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 It 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.

在另一种可能实现方式中,第二位置获取单元1062,用于获取二维虚拟物品在第三坐标系下的第四偏移矩阵,第三坐标系为二维虚拟物品的坐标系,第四偏移矩阵包括二维虚拟物品的多个点与二维虚拟对象的参考点在第三坐标系下的偏移量;对第四偏移矩阵进行坐标系变换,得到第三偏移矩阵。In another possible implementation manner, the second position acquiring unit 1062 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 coordinate system of the two-dimensional virtual item, and the third coordinate system is the coordinate system of the two-dimensional virtual item. The four-offset matrix includes the offsets between the multiple points of the two-dimensional virtual object and the reference point of the two-dimensional virtual object in the third coordinate system; the coordinate system transformation is performed on the fourth offset matrix to obtain the third offset matrix.

需要说明的是:上述实施例提供的虚拟场景显示装置,仅以上述各功能模块的划分进行举例说明,实际应用中,能够根据需要而将上述功能分配由不同的功能模块完成,即将计算机设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的虚拟场景显示装置与虚拟场景显示方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。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 standard audio layer 3 of the moving picture expert compression), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic Video Expert Compresses Standard Audio Layer 4) Player, Laptop or Desktop. Terminal 1200 may also be called user equipment, portable terminal, laptop terminal, desktop terminal, and the like by other names.

终端1200包括有:处理器1201和存储器1202。The terminal 1200 includes: a processor 1201 and a memory 1202 .

处理器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 processor 1201 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1201 may use at least one hardware form among DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array, programmable logic array) accomplish. The processor 1201 may also include a main processor and a coprocessor. The main processor is a processor used to process data in a wake-up state, also called a CPU (Central Processing Unit, central processing unit); A low-power processor for processing data in a standby state. In some embodiments, the processor 1201 may be integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is used for rendering and drawing the content that needs to be displayed on the display screen. In some embodiments, the processor 1201 may further include an AI (Artificial Intelligence, artificial intelligence) processor, where the AI processor is used to process computing operations related to machine learning.

存储器1202可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器1202还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器1202中的非暂态的计算机可读存储介质用于存储至少一个计算机程序,该至少一个计算机程序用于被处理器1201所执行以实现本申请中方法实施例提供的虚拟场景显示方法。Memory 1202 may include one or more computer-readable storage media, which may be non-transitory. Memory 1202 may also include high-speed random access memory, as well as non-volatile memory, such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1202 is used to store at least one computer program, and the at least one computer program is used to be executed by the processor 1201 to implement the methods provided by the method embodiments in this application. Virtual scene display method.

在一些实施例中,终端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 processor 1201, the memory 1202 and the peripheral device interface 1203 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 1203 through a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1204 , a display screen 1205 , a camera assembly 1206 , an audio circuit 1207 , a positioning assembly 1208 and a power supply 1209 .

外围设备接口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 processor 1201 and the memory 1202 . In some embodiments, processor 1201, memory 1202, and peripherals interface 1203 are integrated on the same chip or circuit board; in some other embodiments, any one of processor 1201, memory 1202, and peripherals interface 1203 or The two can be implemented on a separate chip or circuit board, which is not limited in this embodiment.

射频电路1204用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路1204通过电磁信号与通信网络以及其他通信设备进行通信。射频电路1204将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路1204包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块卡等等。射频电路1204可以通过至少一种无线通信协议来与其它终端进行通信。该无线通信协议包括但不限于:万维网、城域网、内联网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或WiFi(Wireless Fidelity,无线保真)网络。在一些实施例中,射频电路1204还可以包括NFC(Near Field Communication,近距离无线通信)有关的电路,本申请对此不加以限定。The radio frequency circuit 1204 is used for receiving and transmitting RF (Radio Frequency, radio frequency) signals, also called electromagnetic signals. The radio frequency circuit 1204 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 1204 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 1204 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 1204 may communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: World Wide Web, Metropolitan Area Network, Intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), wireless local area network and/or WiFi (Wireless Fidelity, Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1204 may further include a circuit related to NFC (Near Field Communication, short-range wireless communication), which is not limited in this application.

显示屏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 display screen 1205 is used for displaying UI (User Interface, user interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 1205 is a touch display screen, the display screen 1205 also has the ability to acquire touch signals on or above the surface of the display screen 1205 . The touch signal may be input to the processor 1201 as a control signal for processing. At this time, the display screen 1205 may also be used to provide virtual buttons and/or virtual keyboards, also referred to as soft buttons and/or soft keyboards. In some embodiments, there may be one display screen 1205, which is arranged on the front panel of the terminal 1200; in other embodiments, there may be at least two display screens 1205, which are respectively arranged on different surfaces of the terminal 1200 or in a folded design; In other embodiments, the display screen 1205 may be a flexible display screen, which is disposed on a curved surface or a folding surface of the terminal 1200 . Even, the display screen 1205 can also be set as a non-rectangular irregular figure, that is, a special-shaped screen. The display screen 1205 can be made of materials such as LCD (Liquid Crystal Display, liquid crystal display), OLED (Organic Light-Emitting Diode, organic light emitting diode).

摄像头组件1206用于采集图像或视频。可选地,摄像头组件1206包括前置摄像头和后置摄像头。前置摄像头设置在终端的前面板,后置摄像头设置在终端的背面。在一些实施例中,后置摄像头为至少两个,分别为主摄像头、景深摄像头、广角摄像头、长焦摄像头中的任意一种,以实现主摄像头和景深摄像头融合实现背景虚化功能、主摄像头和广角摄像头融合实现全景拍摄以及VR(Virtual Reality,虚拟现实)拍摄功能或者其它融合拍摄功能。在一些实施例中,摄像头组件1206还可以包括闪光灯。闪光灯可以是单色温闪光灯,也可以是双色温闪光灯。双色温闪光灯是指暖光闪光灯和冷光闪光灯的组合,可以用于不同色温下的光线补偿。The camera assembly 1206 is used to capture images or video. Optionally, the camera assembly 1206 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth-of-field camera to realize the background blur function, the main camera It is integrated with the wide-angle camera to achieve panoramic shooting and VR (Virtual Reality, virtual reality) shooting functions or other integrated shooting functions. In some embodiments, the camera assembly 1206 may also include a flash. The flash can be a single color temperature flash or a dual color temperature flash. Dual color temperature flash refers to the combination of warm light flash and cold light flash, which can be used for light compensation under different color temperatures.

音频电路1207可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器1201进行处理,或者输入至射频电路1204以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在终端1200的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器1201或射频电路1204的电信号转换为声波。扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路1207还可以包括耳机插孔。Audio circuitry 1207 may include a microphone and speakers. The microphone is used to collect the sound waves of the user and the environment, convert the sound waves into electrical signals, and input them to the processor 1201 for processing, or to the radio frequency circuit 1204 to realize voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively disposed in different parts of the terminal 1200 . The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signal from the processor 1201 or the radio frequency circuit 1204 into sound waves. The loudspeaker can be a traditional thin-film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for distance measurement and other purposes. In some embodiments, audio circuitry 1207 may also include a headphone jack.

定位组件1208用于定位终端1200的当前地理位置,以实现导航或LBS(LocationBased Service,基于位置的服务)。定位组件1208可以是基于美国的GPS(GlobalPositioning System,全球定位系统)、中国的北斗系统或俄罗斯的伽利略系统的定位组件。The positioning component 1208 is used to locate the current geographic location of the terminal 1200 to implement navigation or LBS (Location Based Service, location-based service). The positioning component 1208 may be a positioning component based on the GPS (Global Positioning System, global positioning system) of the United States, the Beidou system of China or the Galileo system of Russia.

电源1209用于为终端1200中的各个组件进行供电。电源1209可以是交流电、直流电、一次性电池或可充电电池。当电源1209包括可充电电池时,该可充电电池可以是有线充电电池或无线充电电池。有线充电电池是通过有线线路充电的电池,无线充电电池是通过无线线圈充电的电池。该可充电电池还可以用于支持快充技术。The power supply 1209 is used to power various components in the terminal 1200 . The power source 1209 may be alternating current, direct current, primary batteries, or rechargeable batteries. When the power source 1209 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. Wired rechargeable batteries are batteries that are charged through wired lines, and wireless rechargeable batteries are batteries that are charged through wireless coils. The rechargeable battery can also be used to support fast charging technology.

在一些实施例中,终端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 terminal 1200 . For example, the acceleration sensor 1211 can be used to detect the components of the gravitational acceleration on the three coordinate axes. The processor 1201 can control the display screen 1205 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 1211 . The acceleration sensor 1211 can also be used for game or user movement data collection.

陀螺仪传感器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 terminal 1200 . The processor 1201 can implement the following functions according to the data collected by the gyro sensor 1212 : motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

压力传感器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 display screen 1205 . When the pressure sensor 1213 is disposed on the side frame of the terminal 1200, the user's holding signal of the terminal 1200 can be detected, and the processor 1201 can perform left and right hand identification or shortcut operations according to the holding signal collected by the pressure sensor 1213. When the pressure sensor 1213 is disposed on the lower layer of the display screen 1205, the processor 1201 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 1205. The operability controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

指纹传感器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 processor 1201 identifies the user's identity according to the fingerprint collected by the fingerprint sensor 1214, or the fingerprint sensor 1214 identifies the user's identity according to the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 1201 authorizes the user to perform relevant sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 1214 may be disposed on the front, back or side of the terminal 1200 . When the terminal 1200 is provided with physical buttons or a manufacturer's logo, the fingerprint sensor 1214 may be integrated with the physical buttons or the manufacturer's logo.

光学传感器1215用于采集环境光强度。在一个实施例中,处理器1201可以根据光学传感器1215采集的环境光强度,控制显示屏1205的显示亮度。具体地,当环境光强度较高时,调高显示屏1205的显示亮度;当环境光强度较低时,调低显示屏1205的显示亮度。在另一个实施例中,处理器1201还可以根据光学传感器1215采集的环境光强度,动态调整摄像头组件1206的拍摄参数。Optical sensor 1215 is used to collect ambient light intensity. In one embodiment, the processor 1201 can control the display brightness of the display screen 1205 according to the ambient light intensity collected by the optical sensor 1215 . Specifically, when the ambient light intensity is high, the display brightness of the display screen 1205 is increased; when the ambient light intensity is low, the display brightness of the display screen 1205 is decreased. In another embodiment, the processor 1201 may also dynamically adjust the shooting parameters of the camera assembly 1206 according to the ambient light intensity collected by the optical sensor 1215 .

接近传感器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 terminal 1200 . The proximity sensor 1216 is used to collect the distance between the user and the front of the terminal 1200 . In one embodiment, when the proximity sensor 1216 detects that the distance between the user and the front of the terminal 1200 gradually decreases, the processor 1201 controls the display screen 1205 to switch from the bright screen state to the off screen state; when the proximity sensor 1216 detects When the distance between the user and the front of the terminal 1200 gradually increases, the processor 1201 controls the display screen 1205 to switch from the screen-off state to the screen-on state.

本领域技术人员可以理解,图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 server 1300 may vary greatly due to different configurations or performance, and may include one or more processors (Central Processing Units, CPU) 1301 and a Or more than one memory 1302, wherein, at least one computer program is stored in the memory 1302, and the at least one computer program is loaded and executed by the processor 1301 to implement the methods provided by the above method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface for input and output, and the server may also include other components for implementing device functions, which will not be described here.

本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有至少一条计算机程序,该至少一条计算机程序由处理器加载并执行以实现上述实施例的虚拟场景显示方法中所执行的操作。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)

1. A method for displaying a virtual scene, the method comprising:
displaying a first virtual scene image, wherein the first virtual scene image comprises a two-dimensional virtual object in a virtual scene, the first virtual scene image is obtained by shooting the virtual scene by a virtual camera, and the image shot by the virtual camera has the effect of big-end-up and small-end-up;
acquiring a second display position of the two-dimensional virtual object based on a first display position of the two-dimensional virtual object in the first virtual scene image in response to the change of the field angle of the virtual camera;
displaying a second virtual scene image in which the two-dimensional virtual object is displayed at the second display position.
2. The method of claim 1, wherein the obtaining a second display position of the two-dimensional virtual object based on a first display position of the two-dimensional virtual object in the first virtual scene image in response to the change in the angle of view of the virtual camera comprises:
in response to the fact that the field angle of the virtual camera is changed from a first field angle to a second field angle, determining a field angle transformation matrix corresponding to the two-dimensional virtual object based on the first field angle and the second field angle, wherein the field angle transformation matrix is used for indicating the situation that the field angle of the virtual camera is changed;
and acquiring a second display position of the two-dimensional virtual object based on the first display position and the view field angle transformation matrix.
3. The method of claim 2, wherein determining a field angle transformation matrix corresponding to the two-dimensional virtual object based on the first field angle and the second field angle comprises:
and fusing the projection matrix of the first field angle and the projection matrix of the second field angle to obtain the field angle transformation matrix.
4. The method of claim 2, wherein obtaining a second display position of the two-dimensional virtual object based on the first display position and the field of view angular transformation matrix comprises:
determining target coordinates of a reference point of the two-dimensional virtual object under a first coordinate system based on the first field angle, wherein the first coordinate system is a coordinate system of the virtual camera under the first field angle;
acquiring a first offset matrix of the two-dimensional virtual object in the first coordinate system, wherein the first offset matrix comprises offset amounts of a plurality of points of the two-dimensional virtual object and the reference point in the first coordinate system, and the plurality of points form the two-dimensional virtual object;
determining the second display position based on the target coordinate, the first offset matrix, and the perspective transformation matrix.
5. The method of claim 4, wherein obtaining the first offset matrix of the two-dimensional virtual object in the first coordinate system comprises:
acquiring a second offset matrix of the two-dimensional virtual object in a second coordinate system, wherein the second coordinate system is the coordinate system of the two-dimensional virtual object, and the second offset matrix comprises offset amounts of a plurality of points of the two-dimensional virtual object and the reference point in the second coordinate system;
and transforming the coordinate system of the second offset matrix to obtain the first offset matrix.
6. The method of claim 4, wherein determining target coordinates of the reference point of the two-dimensional virtual object in a first coordinate system based on the first field angle comprises:
acquiring a reference coordinate of a reference point of the two-dimensional virtual object in a second coordinate system, wherein the second coordinate system is the coordinate system of the two-dimensional virtual object;
and transforming the reference coordinate to obtain the target coordinate.
7. The method of claim 1, wherein prior to displaying the second virtual scene image, the method further comprises:
determining an amount of change in position between the second display position and the first display position;
adjusting the position of the two-dimensional virtual object in the virtual scene according to the position variation;
and rendering the virtual scene shot by the virtual camera after the angle of the field of view is changed to obtain the second virtual scene image.
8. The method of claim 1, wherein the two-dimensional virtual object is a two-dimensional virtual article held by a hand; the method further comprises the following steps:
acquiring a third display position of the two-dimensional virtual article based on the relative display positions of the two-dimensional virtual article and the two-dimensional virtual object in the first virtual scene image;
and displaying the two-dimensional virtual object at the third display position in the second virtual scene image.
9. The method of claim 8, wherein the obtaining a third display position of the two-dimensional virtual object based on the relative display positions of the two-dimensional virtual object and the two-dimensional virtual object in the first virtual scene image comprises:
in response to the fact that the field angle of the virtual camera is changed from a first field angle to a second field angle, determining a field angle transformation matrix corresponding to the two-dimensional virtual object based on the first field angle and the second field angle, wherein the field angle transformation matrix is used for indicating the situation that the field angle of the virtual camera is changed;
and acquiring the third display position of the two-dimensional virtual article based on the relative display position and the view field angle transformation matrix.
10. The method of claim 9, wherein said obtaining the third display position of the two-dimensional virtual article based on the relative display position and the field-of-view angular transformation matrix comprises:
acquiring a target offset of a reference point of the two-dimensional virtual object and a reference point of the two-dimensional virtual article in a first coordinate system, wherein the first coordinate system is a coordinate system of the virtual camera in the first field angle;
acquiring a third offset matrix of the two-dimensional virtual article in the first coordinate system, wherein the third offset matrix comprises offset amounts of a plurality of points of the two-dimensional virtual article and a reference point of the two-dimensional virtual object in the first coordinate system, and the plurality of points form the two-dimensional virtual article;
determining the third display position based on the target offset, the third offset matrix, and the view transformation matrix.
11. The method of claim 10, wherein obtaining the target offset of the reference point of the two-dimensional virtual object and the reference point of the two-dimensional virtual article in the first coordinate system comprises:
acquiring a reference offset of a reference point of the two-dimensional virtual object and a reference point of the two-dimensional virtual object under a third coordinate system, wherein the third coordinate system is a coordinate system of the two-dimensional virtual object;
and transforming the coordinate system of the reference offset to obtain the target offset.
12. The method of claim 10, wherein said obtaining a third offset matrix of the two-dimensional virtual article in the first coordinate system comprises:
acquiring a fourth offset matrix of the two-dimensional virtual article in a third coordinate system, wherein the third coordinate system is a coordinate system of the two-dimensional virtual article, and the fourth offset matrix comprises offset amounts of a plurality of points of the two-dimensional virtual article and a reference point of the two-dimensional virtual object in the third coordinate system;
and transforming the coordinate system of the fourth offset matrix to obtain the third offset matrix.
13. An apparatus for displaying a virtual scene, the apparatus comprising:
the image display module is used for displaying a first virtual scene image, wherein the first virtual scene image comprises a two-dimensional virtual object in a virtual scene, the first virtual scene image is obtained by shooting the virtual scene by a virtual camera, and the image shot by the virtual camera has the effect of big-end-up and small-end-up;
a first position acquisition module, configured to acquire, in response to a change in a field angle of the virtual camera, a second display position of the two-dimensional virtual object based on a first display position of the two-dimensional virtual object in the first virtual scene image;
the image display module is further configured to display a second virtual scene image, where the two-dimensional virtual object is displayed at the second display position in the second virtual scene image.
14. A computer device, characterized in that the computer device comprises a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the virtual scene display method according to any one of claims 1 to 12.
15. A computer-readable storage medium, having at least one computer program stored therein, the at least one computer program being loaded and executed by a processor to perform the operations performed in the virtual scene display method of any one of claims 1 to 12.
CN202011233140.5A 2020-11-06 2020-11-06 Virtual scene display method, device, computer equipment and storage medium Active CN113384880B (en)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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