CN117173309A - Image rendering methods, devices, equipment, media and program products - Google Patents

Image rendering methods, devices, equipment, media and program products Download PDF

Info

Publication number
CN117173309A
CN117173309A CN202310956618.4A CN202310956618A CN117173309A CN 117173309 A CN117173309 A CN 117173309A CN 202310956618 A CN202310956618 A CN 202310956618A CN 117173309 A CN117173309 A CN 117173309A
Authority
CN
China
Prior art keywords
image
rendering
application
synthesizer
virtual screen
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.)
Pending
Application number
CN202310956618.4A
Other languages
Chinese (zh)
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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology 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 Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202310956618.4A priority Critical patent/CN117173309A/en
Publication of CN117173309A publication Critical patent/CN117173309A/en
Pending legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

本申请实施例提供一种图像渲染方法、装置、设备、介质和程序产品,根据2D应用的开启指令,在虚拟屏中启动2D应用,2D渲染合成器从虚拟屏中获取2D应用的多个图层,对2D应用的多个图层合成得到2D应用的2D图像,将2D图像发送给传输组件;传输组件将2D图像传输给3D渲染合成器;3D渲染合成器对2D图像以及3D应用的待渲染数据进行渲染合成得到3D应用的3D图像,显示屏幕显示3D图像。2D应用的渲染和3D应用的渲染独立执行,2D应用的渲染由2D渲染合成器实现,3D应用的渲染由3D渲染合成器实现,3D应用的渲染不再依赖安卓系统的surface flinger,使得本实施例的方法不再受限于安卓系统,可以灵活的在各种操作系统中运行。

Embodiments of the present application provide an image rendering method, device, equipment, media and program products. According to the opening instruction of the 2D application, the 2D application is started in the virtual screen. The 2D rendering synthesizer obtains multiple images of the 2D application from the virtual screen. layer, synthesize multiple layers of the 2D application to obtain the 2D image of the 2D application, and send the 2D image to the transmission component; the transmission component transmits the 2D image to the 3D rendering synthesizer; the 3D rendering synthesizer processes the 2D image and the 3D application. The rendering data is rendered and synthesized to obtain a 3D image of the 3D application, and the display screen displays the 3D image. The rendering of 2D applications and the rendering of 3D applications are executed independently. The rendering of 2D applications is implemented by the 2D rendering synthesizer, and the rendering of 3D applications is implemented by the 3D rendering synthesizer. The rendering of 3D applications no longer relies on the surface flinger of the Android system, making this implementation The example method is no longer limited to the Android system and can be flexibly run on various operating systems.

Description

图像渲染方法、装置、设备、介质和程序产品Image rendering methods, devices, equipment, media and program products

技术领域Technical field

本申请实施例涉及虚拟现实技术领域,尤其涉及一种图像渲染方法、装置、设备、介质和程序产品。The embodiments of the present application relate to the field of virtual reality technology, and in particular, to an image rendering method, device, equipment, medium and program product.

背景技术Background technique

扩展现实(Extended Reality,XR),是指通过计算机将真实与虚拟相结合,打造一个可人机交互的虚拟环境,XR也是虚拟现实(Virtual Reality,VR)、增强现实(AugmentedReality,AR)和混合现实(Mixed Reality,MR)等多种技术的统称。通过将三者的视觉交互技术相融合,为体验者带来虚拟世界与现实世界之间无缝转换的“沉浸感”。Extended Reality (XR) refers to the use of computers to combine reality and virtuality to create a virtual environment that allows human-computer interaction. XR is also virtual reality (VR), augmented reality (AR) and hybrid A collective name for various technologies such as Mixed Reality (MR). By integrating the three visual interaction technologies, the user can experience a "sense of immersion" that seamlessly transitions between the virtual world and the real world.

在XR设备中,用户存在使用传统的2D应用(application,app)的需求,现有技术中,主要依赖安卓(Android)系统的系统服务模块(surface flinger)进行渲染,surfaceflinger即能完成2D应用的图像渲染,又能完成3D图像的渲染,从而使得能够在3D应用提供的扩展现实场景中显示2D应用的用户界面(User Interface,UI)。In XR devices, users have the need to use traditional 2D applications (applications, apps). In the existing technology, the system service module (surface flinger) of the Android system is mainly relied on for rendering. Surfaceflinger can complete the rendering of 2D applications. Image rendering can also complete the rendering of 3D images, thereby enabling the user interface (User Interface, UI) of 2D applications to be displayed in the extended reality scene provided by 3D applications.

但是,现有的渲染方式,依赖安卓系统的surface flinger,使用受限。However, the existing rendering method relies on the surface flinger of Android system and has limited use.

发明内容Contents of the invention

本申请实施例提供一种图像渲染方法、装置、设备、介质和程序产品,2D应用的渲染和3D应用的渲染独立执行,2D应用的渲染由2D渲染合成器实现,3D应用的渲染由3D渲染合成器实现,3D应用的渲染不再依赖安卓系统的surface flinger,使得本实施例的方法不再受限于安卓系统,可以灵活的在各种操作系统中运行。Embodiments of the present application provide an image rendering method, device, equipment, media and program products. The rendering of 2D applications and the rendering of 3D applications are executed independently. The rendering of 2D applications is implemented by a 2D rendering synthesizer, and the rendering of 3D applications is implemented by 3D rendering. With the synthesizer implementation, the rendering of 3D applications no longer relies on the surface flinger of the Android system, so that the method in this embodiment is no longer limited to the Android system and can be flexibly run on various operating systems.

第一方面,本申请实施例提供一种图像渲染方法,应用于XR设备,所述XR设备包括2D渲染合成器、3D渲染合成器和显示屏幕,所述方法包括:In a first aspect, embodiments of the present application provide an image rendering method applied to an XR device. The XR device includes a 2D rendering synthesizer, a 3D rendering synthesizer and a display screen. The method includes:

根据2D应用的开启指令,在虚拟屏中启动所述2D应用;According to the opening instruction of the 2D application, launch the 2D application in the virtual screen;

所述2D渲染合成器从所述虚拟屏中获取所述2D应用的多个图层,对所述2D应用的多个图层合成得到所述2D应用的2D图像,将所述2D图像发送给所述虚拟屏的传输组件;The 2D rendering synthesizer obtains multiple layers of the 2D application from the virtual screen, synthesizes the multiple layers of the 2D application to obtain a 2D image of the 2D application, and sends the 2D image to The transmission component of the virtual screen;

所述传输组件将所述2D图像传输给所述3D渲染合成器;The transmission component transmits the 2D image to the 3D rendering synthesizer;

所述3D渲染合成器对所述2D图像以及3D应用的待渲染数据进行渲染合成得到所述3D应用的3D图像,所述3D图像中显示有所述虚拟屏,所述虚拟屏中显示有所述2D图像;The 3D rendering synthesizer renders and synthesizes the 2D image and the data to be rendered of the 3D application to obtain a 3D image of the 3D application. The 3D image displays the virtual screen, and the virtual screen displays the The 2D image;

所述显示屏幕显示所述3D图像。The display screen displays the 3D image.

在一些实施例中,所述传输组件中包括缓冲队列,所述缓冲队列用于存储所述2D图像,所述传输组件采用生产者消费者模型传输所述2D图像。In some embodiments, the transmission component includes a buffer queue, the buffer queue is used to store the 2D image, and the transmission component uses a producer-consumer model to transmit the 2D image.

在一些实施例中,所述显示屏幕显示所述3D图像之前,还包括:In some embodiments, before the display screen displays the 3D image, it further includes:

所述3D渲染合成器对所述3D图像进行反色散处理,将反色散处理后的所述3D图像发送给所述显示屏幕。The 3D rendering synthesizer performs anti-dispersion processing on the 3D image, and sends the anti-dispersion processed 3D image to the display screen.

在一些实施例中,所述XR设备还包括硬件合成器HWC,所述显示屏幕显示所述3D图像之前,还包括:In some embodiments, the XR device further includes a hardware synthesizer HWC, and before the display screen displays the 3D image, it also includes:

所述3D渲染合成器将所述3D图像发送给所述HWC;The 3D rendering compositor sends the 3D image to the HWC;

所述HWC对所述3D图像进行反色散处理,将反色散处理后的所述3D图像发送给所述显示屏幕。The HWC performs anti-dispersion processing on the 3D image, and sends the anti-dispersion processed 3D image to the display screen.

在一些实施例中,所述3D应用中启动了多个2D应用,所述多个2D应用通过多个虚拟屏显示,每个所述虚拟屏只能关联一个2D应用。In some embodiments, multiple 2D applications are launched in the 3D application, and the multiple 2D applications are displayed through multiple virtual screens, and each virtual screen can only be associated with one 2D application.

在一些实施例中,所述2D渲染合成器的渲染频率小于或等于所述3D渲染合成器的渲染频率。In some embodiments, the rendering frequency of the 2D rendering synthesizer is less than or equal to the rendering frequency of the 3D rendering synthesizer.

在一些实施例中,所述3D渲染合成器对所述2D图像以及3D应用的待渲染数据进行渲染合成得到所述3D应用的3D图像,包括:In some embodiments, the 3D rendering synthesizer renders and synthesizes the 2D image and the to-be-rendered data of the 3D application to obtain the 3D image of the 3D application, including:

将所述2D图像划分为左眼2D图像和右眼2D图像;Divide the 2D image into a left eye 2D image and a right eye 2D image;

从所述3D应用的缓冲区中获取所述3D应用的左眼数据和右眼数据;Obtain the left eye data and right eye data of the 3D application from the buffer of the 3D application;

根据所述3D应用的左眼数据、右眼数据、所述左眼2D图像和所述右眼2D图像进行渲染合成得到所述3D应用的左眼图像和右眼图像。The left eye image and the right eye image of the 3D application are rendered and synthesized according to the left eye data, right eye data, the left eye 2D image and the right eye 2D image of the 3D application.

在一些实施例中,当所述XR设备采用安卓系统时,所述2D渲染合成器为系统服务模块surface flinger,所述传输组件包括所述虚拟屏的surface和Surface texture模块,所述Surface texture模块中包括第一缓冲队列,所述第一缓冲队列用于存储所述2D图像。In some embodiments, when the XR device adopts the Android system, the 2D rendering synthesizer is the system service module surface flinger, and the transmission component includes the surface and Surface texture modules of the virtual screen. The Surface texture module includes a first buffer queue, and the first buffer queue is used to store the 2D image.

在一些实施例中,所述传输组件将所述2D图像传输给所述3D渲染合成器,包括:In some embodiments, the transmission component transmits the 2D image to the 3D rendering compositor, including:

所述虚拟屏的surface将所述2D图像存储到所述Surface texture模块的所述第一缓冲队列中;The surface of the virtual screen stores the 2D image into the first buffer queue of the Surface texture module;

所述3D渲染合成器从所述第一缓冲队列中读取所述2D图像。The 3D rendering compositor reads the 2D image from the first buffer queue.

在一些实施例中,所述第一缓冲队列采用多级缓冲区。In some embodiments, the first buffer queue uses a multi-level buffer.

第二方面,本申请实施例提供一种图像渲染装置,包括:In a second aspect, embodiments of the present application provide an image rendering device, including:

启动模块,用于根据2D应用的开启指令,在虚拟屏中启动所述2D应用;A startup module, used to start the 2D application in the virtual screen according to the startup instruction of the 2D application;

2D渲染合成器,用于从所述虚拟屏中获取所述2D应用的多个图层,对所述2D应用的多个图层合成得到所述2D应用的2D图像,将所述2D图像发送给所述虚拟屏的传输组件;A 2D rendering synthesizer, configured to obtain multiple layers of the 2D application from the virtual screen, synthesize the multiple layers of the 2D application to obtain a 2D image of the 2D application, and send the 2D image A transmission component for the virtual screen;

传输组件,用于将所述2D图像传输给所述3D渲染合成器;A transmission component for transmitting the 2D image to the 3D rendering synthesizer;

3D渲染合成器,用于对所述2D图像以及3D应用的待渲染数据进行渲染合成得到所述3D应用的3D图像,所述3D图像中显示有所述虚拟屏,所述虚拟屏中显示有所述2D图像;A 3D rendering synthesizer, configured to render and synthesize the 2D image and the data to be rendered of the 3D application to obtain a 3D image of the 3D application. The virtual screen is displayed in the 3D image, and the virtual screen is displayed in the virtual screen. the 2D image;

显示模块,用于显示所述3D图像。A display module is used to display the 3D image.

第三方面,本申请实施例提供一种XR设备,所述XR包括:处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于调用并运行所述存储器中存储的计算机程序,以执行如上述第一方面任一项所述的方法。In a third aspect, embodiments of the present application provide an XR device. The XR includes: a processor and a memory. The memory is used to store a computer program. The processor is used to call and run the computer program stored in the memory. To perform the method described in any one of the above first aspects.

第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机程序,所述计算机程序使得计算机执行如上述第一方面任一项所述的方法。In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, the computer-readable storage medium being used to store a computer program, the computer program causing the computer to execute the method described in any one of the above-mentioned first aspects.

第五方面,本申请实施例提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述第一方面任一项所述的方法。In a fifth aspect, embodiments of the present application provide a computer program product, including a computer program that implements the method described in any one of the above first aspects when executed by a processor.

本申请实施例提供的图像渲染方法、装置、设备、介质和程序产品,根据2D应用的开启指令,在虚拟屏中启动2D应用,2D渲染合成器从虚拟屏中获取2D应用的多个图层,对2D应用的多个图层合成得到2D应用的2D图像,将2D图像发送给传输组件;传输组件将2D图像传输给3D渲染合成器;3D渲染合成器对2D图像以及3D应用的待渲染数据进行渲染合成得到3D应用的3D图像,显示屏幕显示3D图像。2D应用的渲染和3D应用的渲染独立执行,2D应用的渲染由2D渲染合成器实现,3D应用的渲染由3D渲染合成器实现,3D应用的渲染不再依赖安卓系统的surface flinger,使得本实施例的方法不再受限于安卓系统,可以灵活的在各种操作系统中运行。The image rendering method, device, equipment, media and program products provided by the embodiments of the present application start the 2D application in the virtual screen according to the opening instruction of the 2D application, and the 2D rendering synthesizer obtains multiple layers of the 2D application from the virtual screen , synthesize multiple layers of the 2D application to obtain the 2D image of the 2D application, and send the 2D image to the transmission component; the transmission component transmits the 2D image to the 3D rendering synthesizer; the 3D rendering synthesizer processes the 2D image and the 3D application's to-be-rendered The data is rendered and synthesized to obtain a 3D image of the 3D application, and the 3D image is displayed on the display screen. The rendering of 2D applications and the rendering of 3D applications are executed independently. The rendering of 2D applications is implemented by the 2D rendering synthesizer, and the rendering of 3D applications is implemented by the 3D rendering synthesizer. The rendering of 3D applications no longer relies on the surface flinger of the Android system, making this implementation The example method is no longer limited to the Android system and can be flexibly run on various operating systems.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.

图1是本申请实施例一提供的图像渲染方法的流程示意图;Figure 1 is a schematic flowchart of an image rendering method provided in Embodiment 1 of the present application;

图2为安卓系统下的图像渲染方法的原理示意图;Figure 2 is a schematic diagram of the principle of the image rendering method under the Android system;

图3为本申请实施例二提供的图像渲染方法的流程图;Figure 3 is a flow chart of the image rendering method provided in Embodiment 2 of the present application;

图4为本申请实施例三提供的图像渲染装置的结构示意图;Figure 4 is a schematic structural diagram of an image rendering device provided in Embodiment 3 of the present application;

图5为本申请实施例四提供的XR设备的一种结构示意图。Figure 5 is a schematic structural diagram of the XR equipment provided in Embodiment 4 of the present application.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without any creative work fall within the scope of protection of the present invention.

需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或服务器不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances so that the embodiments of the invention described herein are capable of being practiced in sequences other than those illustrated or described herein. Furthermore, the terms "include" and "having" and any variations thereof are intended to cover non-exclusive inclusions, e.g., a process, method, system, product or server that encompasses a series of steps or units and need not be limited to those explicitly listed. Those steps or elements may instead include other steps or elements not expressly listed or inherent to the process, method, product or apparatus.

为了便于理解本申请实施例,在描述本申请各个实施例之前,首先对本申请所有实施例中所涉及到的一些概念进行适当的解释说明,具体如下:In order to facilitate understanding of the embodiments of the present application, before describing each embodiment of the present application, some concepts involved in all the embodiments of the present application are first properly explained, as follows:

1)虚拟现实(Virtual Reality,简称为VR),创建和体验虚拟世界的技术,确定生成一种虚拟环境,是一种多源信息(本文中提到的虚拟现实至少包括视觉感知,此外还可以包括听觉感知、触觉感知、运动感知,甚至还包括味觉感知、嗅觉感知等),实现虚拟环境的融合的、交互式的三维动态视景和实体行为的仿真,使用户沉浸到模拟的虚拟现实环境中,实现在诸如地图、游戏、视频、教育、医疗、模拟、协同训练、销售、协助制造、维护和修复等多种虚拟环境的应用。1) Virtual Reality (VR for short), a technology for creating and experiencing a virtual world, determines the generation of a virtual environment, and is a type of multi-source information (the virtual reality mentioned in this article at least includes visual perception, in addition to Including auditory perception, tactile perception, motion perception, and even taste perception, olfactory perception, etc.), realizing the integration of virtual environment, interactive three-dimensional dynamic vision and simulation of entity behavior, allowing users to immerse themselves in the simulated virtual reality environment It can be used in various virtual environments such as maps, games, videos, education, medical care, simulation, collaborative training, sales, assisted manufacturing, maintenance and repair, etc.

2)虚拟现实设备(VR设备),实现虚拟现实效果的终端,通常可以提供为眼镜、头盔式显示器(Head Mount Display,简称为HMD)、隐形眼镜的形态,以用于实现视觉感知和其他形式的感知,当然虚拟现实设备实现的形态不限于此,根据实际需要可以进一步小型化或大型化。2) Virtual reality equipment (VR equipment), a terminal that achieves virtual reality effects, can usually be provided in the form of glasses, a Head Mount Display (HMD), or contact lenses to achieve visual perception and other forms. Of course, the form of virtual reality equipment is not limited to this, and can be further miniaturized or enlarged according to actual needs.

可选的,本申请实施例中记载的VR设备可以包括但不限于如下几个类型:Optionally, the VR devices described in the embodiments of this application may include but are not limited to the following types:

2.1)外接式VR设备,VR设备与外接设备通过有线或者无线方式连接,由外接设备进行虚拟现实功能的相关计算,并输出数据至VR设备,该外接设备可以是智能手机、个人电脑(person computer,PC)等电子设备,当外接设备为PC时,外接式VR设备也称为电脑端虚拟现实(PCVR)设备。2.1) External VR equipment. The VR equipment and the external equipment are connected through wired or wireless methods. The external equipment performs calculations related to virtual reality functions and outputs data to the VR equipment. The external equipment can be a smartphone or a personal computer (person computer). , PC) and other electronic devices, when the external device is a PC, the external VR device is also called a computer-side virtual reality (PCVR) device.

2.2)一体机VR设备,具备用于进行虚拟功能的相关计算的处理器,因而具备独立的虚拟现实输入和输出的功能,不需要与PC端或移动终端连接,使用自由度高。2.2) All-in-one VR equipment has a processor for performing related calculations of virtual functions, so it has independent virtual reality input and output functions. It does not need to be connected to a PC or mobile terminal, and has a high degree of freedom of use.

3)混合现实(Mixed Reality,简称为MR):是指结合真实和虚拟世界创造了新的环境和可视化,物理实体和数字对象共存并能实时相互作用,用以模拟真实物体。混合了现实、增强现实、增强虚拟和虚拟现实技术。MR是一种虚拟现实(VR)加增强现实(AR)的合成品混合现实(MR),是虚拟现实(VR)技术的拓展延伸,通过在现实场景中呈现虚拟场景的方式,可以增加用户体验的真实感。MR领域涉及计算机视觉,计算机视觉是一门研究如何使机器“看”的科学,更进一步的,是指摄像机和计算机代替人眼对目标进行识别、跟踪和测量等机器视觉,并进一步做图像处理,用计算机处理成为更适合人眼观察或传送给仪器检测的图像。3) Mixed Reality (MR): refers to the combination of real and virtual worlds to create new environments and visualizations. Physical entities and digital objects coexist and can interact in real time to simulate real objects. Mixed reality, augmented reality, augmented virtual and virtual reality technologies. MR is a composite of virtual reality (VR) and augmented reality (AR). Mixed reality (MR) is an expansion and extension of virtual reality (VR) technology. It can increase user experience by presenting virtual scenes in real scenes. sense of reality. The field of MR involves computer vision. Computer vision is a science that studies how to make machines "see". Furthermore, it refers to the machine vision of cameras and computers replacing human eyes in identifying, tracking and measuring targets, and further image processing. , processed by computers into images more suitable for human eye observation or transmitted to instruments for detection.

也即是说,MR是将计算机创建的感官输入(例如,虚拟对象)与来自物理布景的感官输入或其表示集成的模拟布景,一些MR布景中,计算机创建的感官输入可以适应于来自物理布景的感官输入的变化。另外,用于呈现MR布景的一些电子系统可以监测相对于物理布景的取向和/或位置,以使虚拟对象能够与真实对象(即来自物理布景的物理元素或其表示)交互。例如,系统可监测运动,使得虚拟植物相对于物理建筑物看起来是静止的。That is, MR is a simulated set that integrates computer-created sensory input (e.g., virtual objects) with sensory input from the physical set or its representation. In some MR sets, the computer-created sensory input can be adapted to the input from the physical set. changes in sensory input. Additionally, some electronic systems used to render the MR scenery may monitor orientation and/or position relative to the physical scenery to enable virtual objects to interact with real objects (i.e., physical elements from the physical scenery or representations thereof). For example, the system can monitor motion so that virtual plants appear stationary relative to physical buildings.

图1是本申请实施例一提供的图像渲染方法的流程示意图,该方法由XR设备执行,该XR设备可以为VR设备、AR设备或者MR设备,本实施例以VR设备为例进行说明,VR设备可以是一体式VR设备,也可以是外接式VR设备。该XR设备包括2D渲染合成器、3D渲染合成器和显示屏幕,2D渲染合成器用于对2D应用的图像进行合成,3D渲染合成器用于对3D应用的图像进行合成,还支持在3D应用的虚拟现实空间中显示2D应用的内容。如图1所示,本实施例提供的方法包括以下步骤。Figure 1 is a schematic flowchart of an image rendering method provided in Embodiment 1 of the present application. The method is executed by an XR device. The XR device can be a VR device, an AR device, or an MR device. This embodiment takes a VR device as an example for illustration. VR The device can be an integrated VR device or an external VR device. The XR device includes a 2D rendering synthesizer, a 3D rendering synthesizer and a display screen. The 2D rendering synthesizer is used to synthesize images for 2D applications. The 3D rendering synthesizer is used to synthesize images for 3D applications. It also supports virtualization in 3D applications. Display the content of 2D applications in real space. As shown in Figure 1, the method provided in this embodiment includes the following steps.

S101、根据2D应用的开启指令,在虚拟屏中启动2D应用。S101. Start the 2D application in the virtual screen according to the opening instruction of the 2D application.

2D应用是指传统的运行在手机、电脑、平板电脑等电子设备上的应用,2D应用展示给用户的图像是2D图像。3D应用是指运行在XR设备上的应用,3D应用展示给用户的图像是3D图像。该2D应用包括但不限于:视频播放应用、短视频应用、音乐应用、即时通讯应用和购物软件等。2D applications refer to traditional applications that run on mobile phones, computers, tablets and other electronic devices. The images displayed to users by 2D applications are 2D images. 3D applications refer to applications running on XR devices. The images displayed to users by 3D applications are 3D images. The 2D applications include but are not limited to: video playback applications, short video applications, music applications, instant messaging applications, shopping software, etc.

本申请实施例的使用场景是在3D应用的虚拟现实空间(也称为扩展现实空间或者虚拟场景)中显示2D应用的内容,用户可以在3D应用运行过程中或者3D桌面环境下输入开启指令,XR设备根据该开启指令,在对应的虚拟屏中启动2D应用。The usage scenario of the embodiment of the present application is to display the content of the 2D application in the virtual reality space (also called extended reality space or virtual scene) of the 3D application. The user can input the opening command during the running of the 3D application or in the 3D desktop environment. The XR device starts the 2D application in the corresponding virtual screen according to the opening command.

该虚拟屏可以理解为2D应用的一个承载容器,在有些操作系统中,该虚拟屏也可以为一个容器。The virtual screen can be understood as a hosting container for 2D applications. In some operating systems, the virtual screen can also be a container.

一种实现方式中,每个虚拟屏中只能关联一个2D应用,那么3D应用在接收到开启指令后,可以为该2D应用创建一个虚拟屏以及该虚拟屏对应的传输组件,将该2D应用与对应的虚拟屏关联。虚拟屏具有标识(identity,ID),还具有尺寸、分辨率等参数。在创建虚拟屏之后,该2D应用的内容通过该虚拟屏显示。该虚拟屏对应的传输组件用于将该虚拟屏对应的2D应用的图像传输给3D渲染合成器,该虚拟屏对应的传输组件也可以理解为2D应用对应的传输组件。In one implementation, each virtual screen can only be associated with one 2D application. Then, after receiving the opening instruction, the 3D application can create a virtual screen and the transmission component corresponding to the virtual screen, and transfer the 2D application to the 2D application. Associated with the corresponding virtual screen. The virtual screen has an identity (ID) and also has parameters such as size and resolution. After the virtual screen is created, the content of the 2D application is displayed through the virtual screen. The transmission component corresponding to the virtual screen is used to transmit the image of the 2D application corresponding to the virtual screen to the 3D rendering synthesizer. The transmission component corresponding to the virtual screen can also be understood as the transmission component corresponding to the 2D application.

另一种实现方式中,每个虚拟屏可以关联多个2D应用,用户可以在已创建的虚拟屏中打开一个新的应用,那么此时,不需要在重新创建虚拟屏,但是,一个虚拟屏同一时间只能显示一个2D应用,当打开一个新的2D应用后,该新的2D应用会显示在虚拟屏上,之前显示的2D应用会切换到后台。相应的,XR设备根据2D应用的开启指令,将该虚拟屏中之前显示的2D应用切换到后台,并将该2D应用在虚拟屏中启动。In another implementation, each virtual screen can be associated with multiple 2D applications. The user can open a new application in the created virtual screen. At this time, there is no need to re-create the virtual screen. However, a virtual screen Only one 2D application can be displayed at the same time. When a new 2D application is opened, the new 2D application will be displayed on the virtual screen, and the previously displayed 2D application will be switched to the background. Correspondingly, the XR device switches the 2D application previously displayed in the virtual screen to the background according to the opening instruction of the 2D application, and starts the 2D application in the virtual screen.

S102、2D渲染合成器从虚拟屏中获取2D应用的多个图层,对2D应用的多个图层合成得到2D应用的2D图像,将2D图像发送给虚拟屏的传输组件。S102. The 2D rendering synthesizer obtains multiple layers of the 2D application from the virtual screen, synthesizes the multiple layers of the 2D application to obtain a 2D image of the 2D application, and sends the 2D image to the transmission component of the virtual screen.

本实施例的方法将2D应用的渲染和3D应用的渲染独立开,分别由两个独立的模块实现,2D应用的渲染由2D渲染合成器实现,3D应用的渲染由3D渲染合成器实现,3D渲染合成器也称为XR合成器,3D应用渲染与2D应用的渲染解耦。3D应用的渲染不再依赖安卓系统的surface flinger,即将3D应用渲染与surface flinger解耦,从而更加灵活,可移植性性更高,不再受限于安卓系统,使得本申请实施例的方法可以应用在已有的任意操作系统上。The method of this embodiment separates the rendering of 2D applications and the rendering of 3D applications, which are implemented by two independent modules. The rendering of 2D applications is implemented by a 2D rendering synthesizer, and the rendering of 3D applications is implemented by a 3D rendering synthesizer. 3D The rendering compositor, also known as the XR compositor, decouples the rendering of 3D applications from the rendering of 2D applications. The rendering of 3D applications no longer relies on the surface flinger of the Android system, that is, the 3D application rendering is decoupled from the surface flinger, making it more flexible and more portable. It is no longer limited to the Android system, so that the method of the embodiment of the present application can Applies to any existing operating system.

在对2D应用的每一帧图像进行渲染时,2D渲染合成器从虚拟屏中获取2D应用的当前帧图像的多个图层的内容,将当前帧图像的多个图层合成得到当前帧图像,当前帧图像即2D应用的2D图像。2D图像为当前帧对应的2D图像,2D图像通常由多个图层组成,示例性的,以2D应用为视频应用为例,视频应用的当前帧的2D图像可能包括以下窗口:视频窗口、弹幕窗口、控制菜单窗口、广告窗口,每个窗口可以对应一个图层,或者,多个窗口对应一个图层,例如,弹幕窗口和控制菜单窗口对应一个图层。When rendering each frame image of the 2D application, the 2D rendering synthesizer obtains the contents of multiple layers of the current frame image of the 2D application from the virtual screen, and synthesizes the multiple layers of the current frame image to obtain the current frame image. , the current frame image is the 2D image of the 2D application. The 2D image is the 2D image corresponding to the current frame. The 2D image is usually composed of multiple layers. For example, taking the 2D application as a video application, the 2D image of the current frame of the video application may include the following windows: video window, pop-up window Screen window, control menu window, advertising window, each window can correspond to one layer, or multiple windows correspond to one layer, for example, the barrage window and the control menu window correspond to one layer.

一种实现方式中,2D渲染合成器从虚拟屏中读取到当前帧的各图层,各图层由2D应用生成,另一种实现方式中,2D渲染合成器从虚拟屏中读取到当前帧的各图层的数据,根据各图层的数据生成各图层,其中,各图层的数据是指各窗口中显示的内容,例如,视频窗口的内容即视频数据。In one implementation, the 2D rendering synthesizer reads each layer of the current frame from the virtual screen, and each layer is generated by the 2D application. In another implementation, the 2D rendering synthesizer reads the layers from the virtual screen. Each layer is generated according to the data of each layer of the current frame, where the data of each layer refers to the content displayed in each window. For example, the content of the video window is the video data.

本实施例以每个窗口可以对应一个图层为例,则2D渲染合成器从虚拟屏中读取到视频窗口、弹幕窗口、控制菜单窗口和广告窗口对应的图层,将视频窗口、弹幕窗口、控制菜单窗口和广告窗口对应的图层合成得到视频应用的当前帧图像。In this embodiment, each window can correspond to a layer as an example. The 2D rendering synthesizer reads the layers corresponding to the video window, pop-up window, control menu window and advertising window from the virtual screen, and converts the video window, pop-up window The layers corresponding to the screen window, control menu window and advertising window are synthesized to obtain the current frame image of the video application.

示例性的,2D渲染合成器根据2D应用的多个图层和图像的其他属性进行合成,例如,根据窗口的位置、透明度(例如半透明、全透明)、颜色等属性进行合成,最终得到向用户显示的图像。For example, the 2D rendering compositor performs compositing based on multiple layers of the 2D application and other attributes of the image, for example, compositing based on the position of the window, transparency (such as semi-transparent, fully transparent), color and other attributes, and finally obtains the result. Image displayed by the user.

可以理解,2D渲染合成器在不同的操作系统中可能具有不同的名称,例如,在安卓系统中,2D渲染合成器为系统服务模块surface flinger,surface flinger在XR设备的分层架构中位于系统层,而2D应用和3D应用位于应用程序层。It is understandable that the 2D rendering compositor may have different names in different operating systems. For example, in the Android system, the 2D rendering compositor is the system service module surface flinger. Surface flinger is located at the system layer in the layered architecture of XR devices. , while 2D applications and 3D applications are located at the application layer.

S103、传输组件将2D图像传输给3D渲染合成器。S103. The transmission component transmits the 2D image to the 3D rendering synthesizer.

传输组件可以理解为2D渲染合成器和3D渲染合成器之间的传输通道,可选的,该传输组件中包括缓冲队列(buffer queue),缓冲队列用于存储2D图像,传输组件采用生产者消费者模型传输2D图像。The transmission component can be understood as the transmission channel between the 2D rendering synthesizer and the 3D rendering synthesizer. Optionally, the transmission component includes a buffer queue. The buffer queue is used to store 2D images. The transmission component uses producer consumption. or model to transfer 2D images.

在生产者消费者模型中存在两种角色:生产者和消费者,生产者和消费者通过缓冲队列(内存缓冲区)进行通信,生产者生成消费者需要的数据,生成者生产的数据存到缓冲队列中,消费者从缓冲队列中读取数据进行消费,互不影响,耦合性低。There are two roles in the producer-consumer model: producer and consumer. The producer and the consumer communicate through the buffer queue (memory buffer). The producer generates the data that the consumer needs, and the data produced by the producer is stored in In the buffer queue, consumers read data from the buffer queue for consumption without affecting each other and with low coupling.

如果不采用生产者消费者模型,那么生产者和消费者之间是直接调用关系,生成速度和消费速度可能会互相影响,必须在消费完之后进行下一次生产。If the producer-consumer model is not adopted, there is a direct calling relationship between the producer and the consumer. The generation speed and consumption speed may affect each other, and the next production must be carried out after consumption.

可选的,缓冲队列采用多级缓冲区(buffer),例如,3级缓冲或者4级缓冲,当有多级缓冲区采用交换模式工作,以3级缓冲区为例,比如第一帧图像采用第一个缓冲区进行绘制,第二帧图像采用第二个缓冲区绘制,第三帧图像采用第三个缓冲区绘制,第四帧图像采用第一个缓冲区绘制,以此类推。在同一时间,生产者可能正在向第一个缓冲区中绘制数据,此时,第二个缓冲区用于存储合成完成的数据,那么消费者可以对第二个缓冲区中的数据进行消费,第三个缓冲区可能为一个空闲的缓冲区,也可能为一个已经合成完成的缓冲区,即用于存储合成完成的数据。Optionally, the buffer queue uses a multi-level buffer (buffer), for example, level 3 buffer or level 4 buffer. When the multi-level buffer works in exchange mode, take the level 3 buffer as an example. For example, the first frame image uses The first buffer is used to draw, the second frame image is drawn using the second buffer, the third frame image is drawn using the third buffer, the fourth frame image is drawn using the first buffer, and so on. At the same time, the producer may be drawing data into the first buffer. At this time, the second buffer is used to store the synthesized data, and the consumer can consume the data in the second buffer. The third buffer may be a free buffer or a buffer that has been synthesized, that is, it is used to store the synthesized data.

在本实施例中,2D渲染合成器为生产者,3D渲染合成器为消费者,2D渲染合成器将生产的2D图像存储到传输组件中的缓冲队列中,3D渲染合成器对缓冲队列中的已合成的2D图像进行消费。In this embodiment, the 2D rendering synthesizer is the producer, and the 3D rendering synthesizer is the consumer. The 2D rendering synthesizer stores the produced 2D images into the buffer queue in the transmission component, and the 3D rendering synthesizer stores the generated 2D images in the buffer queue. The synthesized 2D image is consumed.

S104、3D渲染合成器对2D图像以及3D应用的待渲染数据进行渲染合成得到3D应用的3D图像,3D图像中显示有虚拟屏,虚拟屏中显示有2D图像。S104. The 3D rendering synthesizer renders and synthesizes the 2D image and the data to be rendered of the 3D application to obtain a 3D image of the 3D application. The 3D image displays a virtual screen, and the virtual screen displays a 2D image.

示例性的,3D渲染合成器将2D图像划分为左眼2D图像和右眼2D图像,这是因为3D应用的待渲染数据分为左眼数据和右眼数据。然后,从3D应用的缓冲区(buffer)中获取3D应用的左眼数据和右眼数据,根据3D应用的左眼数据、右眼数据、左眼2D图像和右眼2D图像进行渲染合成得到3D应用的左眼图像和右眼图像。For example, the 3D rendering synthesizer divides the 2D image into a left-eye 2D image and a right-eye 2D image, because the data to be rendered in the 3D application is divided into left-eye data and right-eye data. Then, obtain the left eye data and right eye data of the 3D application from the buffer of the 3D application, and perform rendering and synthesis based on the left eye data, right eye data, left eye 2D image and right eye 2D image of the 3D application to obtain 3D The left eye image and the right eye image of the application.

3D应用的左眼数据和右眼数据可以分别存储到不同的buffer,通常会设置两种buffer:左眼buffer和右眼buffer,左眼buffer用于存储左眼数据,右眼buffer用于存储右眼数据。可选的,3D应用的buffer也采用多级buffer,例如,左眼buffer和右眼buffer均采用3级buffer,多级buffer之间通过交换模式工作。The left eye data and right eye data of 3D applications can be stored in different buffers respectively. Usually two buffers are set up: left eye buffer and right eye buffer. The left eye buffer is used to store left eye data, and the right eye buffer is used to store right eye data. eye data. Optionally, the buffers of 3D applications also use multi-level buffers. For example, the left-eye buffer and the right-eye buffer both use 3-level buffers, and multi-level buffers work in exchange mode.

3D渲染合成器在渲染合成时,将3D应用的左眼数据和左眼2D图像进行渲染合成得到3D应用的左眼图像,将3D应用的右眼数据和右眼2D图像进行渲染合成得到3D应用的右眼图像。When rendering and synthesizing, the 3D rendering synthesizer renders and synthesizes the left eye data of the 3D application and the left eye 2D image to obtain the left eye image of the 3D application, and renders and synthesizes the right eye data and the right eye 2D image of the 3D application to obtain the 3D application. image of the right eye.

3D应用的左眼图像和右眼图像中分别通过虚拟屏显示2D图像,从而使得能够在3D应用的扩展现实空间中显示2D应用。The 2D image is displayed through the virtual screen in the left eye image and the right eye image of the 3D application respectively, thereby enabling the 2D application to be displayed in the extended reality space of the 3D application.

由于2D渲染合成器和3D渲染合成器可以独立渲染,因此,2D渲染合成器和3D渲染合成器的渲染频率,渲染频率与帧率(Frame rate)对应,帧率是以帧为单位的图像连续出现在显示器上的频率,可以认为,渲染频率等于帧率。Since the 2D rendering synthesizer and the 3D rendering synthesizer can render independently, the rendering frequency of the 2D rendering synthesizer and the 3D rendering synthesizer corresponds to the frame rate. The frame rate is the continuous image in frames. The frequency that appears on the display can be considered to be the rendering frequency equal to the frame rate.

现有技术中,surface flinger采用相同的渲染频率对2D应用和3D应用进行渲染,而本实施例中,2D渲染合成器的渲染频率不仅可以等于3D渲染合成器的渲染频率,2D渲染合成器的渲染频率还可以小于3D渲染合成器的渲染频率。当2D渲染合成器的渲染频率小于3D渲染合成器的渲染频率时,3D应用提供的扩展现实空间的更新频率大于扩展现实空间中显示的2D图像的更新频率。In the prior art, surface flinger uses the same rendering frequency to render 2D applications and 3D applications. In this embodiment, the rendering frequency of the 2D rendering synthesizer can not only be equal to the rendering frequency of the 3D rendering synthesizer, but also the rendering frequency of the 2D rendering synthesizer. The rendering frequency can also be less than that of the 3D rendering compositor. When the rendering frequency of the 2D rendering synthesizer is less than the rendering frequency of the 3D rendering synthesizer, the update frequency of the extended reality space provided by the 3D application is greater than the update frequency of the 2D image displayed in the extended reality space.

3D应用为了向用户提供逼真的场景,通常采用更高的帧率,而用户对2D应用的显示要求通常低一些,不需要采用与3D应用同样的帧率,现有技术的方法,由于2D应用和3D应用的渲染频率必须一样,增加了渲染成本,而实施例的方法,2D应用的渲染频率可以低于3D应用的渲染频率,降低了渲染成本。In order to provide users with realistic scenes, 3D applications usually use higher frame rates, while users usually have lower display requirements for 2D applications and do not need to use the same frame rate as 3D applications. The methods of the existing technology, because 2D applications The rendering frequency of 2D applications must be the same as that of 3D applications, which increases rendering costs. However, according to the method of the embodiment, the rendering frequency of 2D applications can be lower than that of 3D applications, which reduces rendering costs.

本实施例中,2D渲染合成器和3D渲染合成器为两个独立模块,2D渲染合成器独立完成2D应用的渲染,3D渲染合成器独立完成3D应用的渲染,且3D渲染合成器支持2D应用的2D图像在3D空间中显示。将3D渲染合成器从安卓系统的surface flinger中独立出来,使得本实施例的方法不再受限于安卓系统,可以灵活的在各种操作系统中运行。2D渲染合成器和3D渲染合成器可以独立开发、独立升级、独立维护,低耦合性更便于管理。In this embodiment, the 2D rendering synthesizer and the 3D rendering synthesizer are two independent modules. The 2D rendering synthesizer independently completes the rendering of 2D applications, and the 3D rendering synthesizer independently completes the rendering of 3D applications, and the 3D rendering synthesizer supports 2D applications. The 2D image is displayed in 3D space. The 3D rendering synthesizer is separated from the surface flinger of the Android system, so that the method in this embodiment is no longer limited to the Android system and can be flexibly run in various operating systems. The 2D rendering synthesizer and 3D rendering synthesizer can be developed, upgraded, and maintained independently, and low coupling makes management easier.

S105、显示屏幕显示3D图像。S105. Display the 3D image on the display screen.

3D渲染合成器渲染得到3D图像后,将3D图像提交给显示屏幕进行显示。After the 3D rendering synthesizer renders the 3D image, it submits the 3D image to the display screen for display.

一种实现方式中,3D渲染合成器将3D图像提交给显示屏幕之前,3D渲染合成器对3D图像进行反色散处理,将反色散处理后的3D图像发送给显示屏幕。In one implementation, before the 3D rendering synthesizer submits the 3D image to the display screen, the 3D rendering synthesizer performs anti-dispersion processing on the 3D image, and sends the anti-dispersion processed 3D image to the display screen.

反色散用于对3D图像发生的色散进行反向补偿,补偿3D图像的颜色,抵消由于色散对图像的影响。Inverse dispersion is used to reversely compensate for the dispersion that occurs in 3D images, compensate for the color of the 3D image, and offset the impact of dispersion on the image.

另一种实现方式中,XR设备还包括硬件合成器(Hardware Composer,HWC),3D渲染合成器将3D图像发送给所述HWC,HWC对3D图像进行反色散处理,将反色散处理后的3D图像发送给显示屏幕。In another implementation, the XR device also includes a hardware synthesizer (Hardware Composer, HWC). The 3D rendering synthesizer sends the 3D image to the HWC. The HWC performs anti-dispersion processing on the 3D image, and converts the anti-dispersion processed 3D image into the HWC. The image is sent to the display screen.

本实施例的方法,根据2D应用的开启指令,在虚拟屏中启动2D应用,2D渲染合成器从虚拟屏中获取2D应用的多个图层,对2D应用的多个图层合成得到2D应用的2D图像,将2D图像发送给传输组件;传输组件将2D图像传输给3D渲染合成器;3D渲染合成器对2D图像以及3D应用的待渲染数据进行渲染合成得到3D应用的3D图像,显示屏幕显示3D图像。2D应用的渲染和3D应用的渲染独立开,2D应用的渲染由2D渲染合成器实现,3D应用的渲染由3D渲染合成器实现,3D应用的渲染不再依赖安卓系统的surface flinger,使得本实施例的方法不再受限于安卓系统,可以灵活的在各种操作系统中运行。The method of this embodiment starts the 2D application in the virtual screen according to the opening instruction of the 2D application. The 2D rendering synthesizer obtains multiple layers of the 2D application from the virtual screen, and synthesizes the multiple layers of the 2D application to obtain the 2D application. The 2D image is sent to the transmission component; the transmission component transmits the 2D image to the 3D rendering synthesizer; the 3D rendering synthesizer renders and synthesizes the 2D image and the data to be rendered in the 3D application to obtain the 3D image of the 3D application, and displays the screen Display 3D images. The rendering of 2D applications and the rendering of 3D applications are independent. The rendering of 2D applications is implemented by the 2D rendering synthesizer, and the rendering of 3D applications is implemented by the 3D rendering synthesizer. The rendering of 3D applications no longer relies on the surface flinger of the Android system, making this implementation The example method is no longer limited to the Android system and can be flexibly run on various operating systems.

在实施例一的基础上,本申请实施例二提供一种图像渲染方法,应用在安卓系统中,图2为安卓系统下的图像渲染方法的原理示意图,如图2所示,在安卓系统中2D渲染合成器为surface flinger,传输组件包括虚拟屏的surface和Surface texture模块,Surfacetexture模块中包括第一缓冲队列,第一缓冲队列用于存储2D图像,图中所示的第一缓冲队列采用多级buffer,在安卓系统中,Surface texture模块的buffer也称为绘制缓冲区(即Graphic buffer)。On the basis of the first embodiment, the second embodiment of the present application provides an image rendering method, which is applied in the Android system. Figure 2 is a schematic diagram of the principle of the image rendering method under the Android system. As shown in Figure 2, in the Android system The 2D rendering synthesizer is surface flinger. The transmission component includes the surface and Surface texture modules of the virtual screen. The Surface texture module includes a first buffer queue. The first buffer queue is used to store 2D images. The first buffer queue shown in the figure uses a multi-layer Level buffer, in the Android system, the buffer of the Surface texture module is also called the drawing buffer (ie Graphic buffer).

图3为本申请实施例二提供的图像渲染方法的流程图,结合图2和图3对本实施例的方法进行说明,如图3所示,本实施例提供的方法包括以下步骤。Figure 3 is a flow chart of an image rendering method provided in Embodiment 2 of the present application. The method of this embodiment is described with reference to Figures 2 and 3. As shown in Figure 3, the method provided in this embodiment includes the following steps.

S201、在3D应用的虚拟现实空间中,根据2D应用的开启指令,创建该2D应用的虚拟屏和虚拟屏的surface,在虚拟屏中启动2D应用。S201. In the virtual reality space of the 3D application, according to the opening instruction of the 2D application, create a virtual screen and a surface of the virtual screen of the 2D application, and start the 2D application in the virtual screen.

如图2所示,可以在3D应用中打开多个2D应用:2D app A、2D app B、2D app C,每个2D应用对应一个虚拟屏。As shown in Figure 2, multiple 2D applications can be opened in a 3D application: 2D app A, 2D app B, and 2D app C. Each 2D application corresponds to a virtual screen.

当用户触发任意一个2D应用的开启指令后,XR设备根据该开启指令,为该2D应用创建一个虚拟屏,并创建虚拟屏的surface,2D应用与虚拟屏、虚拟屏的surface绑定。When the user triggers the opening command of any 2D application, the XR device creates a virtual screen for the 2D application according to the opening command, and creates the surface of the virtual screen. The 2D application is bound to the virtual screen and the surface of the virtual screen.

S202、surface flinger从虚拟屏中获取2D应用的多个图层,将2D应用的多个图层合成到虚拟屏的surface上,得到2D应用的2D图像。S202. The surface flinger obtains multiple layers of the 2D application from the virtual screen, synthesizes the multiple layers of the 2D application onto the surface of the virtual screen, and obtains a 2D image of the 2D application.

如图2所示,2D应用可以包括多个2D activity组件,还可以包括2Dwindow组件。As shown in Figure 2, a 2D application can include multiple 2D activity components and can also include a 2Dwindow component.

activity组件在一个安卓应用中通常就是一个单独的屏幕,它上面可以显示一些控件也可以监听并处理用户的事件做出响应,activity组件通常提供一个全屏界面,而window组件提供的是一个非全屏界面,例如,弹窗、对话框等。The activity component is usually a separate screen in an Android application. It can display some controls and listen to and process user events to respond. The activity component usually provides a full-screen interface, while the window component provides a non-full-screen interface. , for example, pop-up windows, dialog boxes, etc.

surface flinger从2D应用的activity组件,或者,2D应用的activity组件和window组件中获取2D应用的图层,通常情况下,一个activity组件对应一个图层,一个window组件对应一个图层,在一些特殊情况下,一个activity组件可能对应多个图层,例如,当在activity组件中显示视频的情况下,视频为一个图层,activity组件本身为一个图层。Surface flinger obtains the layer of the 2D application from the activity component of the 2D application, or the activity component and window component of the 2D application. Normally, one activity component corresponds to one layer, and one window component corresponds to one layer. In some special cases, In some cases, an activity component may correspond to multiple layers. For example, when a video is displayed in the activity component, the video is a layer and the activity component itself is a layer.

虚拟屏的surface可以理解为虚拟屏或者2D应用的一个画布,用于将2D应用的图像渲染到该画布上,从而该2D应用的内容才能在虚拟屏上显示。The surface of the virtual screen can be understood as a virtual screen or a canvas of a 2D application, which is used to render the image of the 2D application onto the canvas so that the content of the 2D application can be displayed on the virtual screen.

S203、虚拟屏的surface将2D图像存储到Surface texture的第一缓冲队列中。S203. The surface of the virtual screen stores the 2D image in the first buffer queue of the Surface texture.

虚拟屏的surface与Surface texture是绑定的,虚拟屏的surface可以理解为surface flinger与Surface texture之间的一个接口,surface flinger合成的2D图像最终存储在Surface texture的第一缓冲队列中。The surface of the virtual screen and the Surface texture are bound. The surface of the virtual screen can be understood as an interface between the surface flinger and the Surface texture. The 2D image synthesized by the surface flinger is finally stored in the first buffer queue of the Surface texture.

本实施例中,利用安卓系统已有的Surface texture实现将2D图像传递给3D渲染合成器,Surface texture的创建以及原理此处不再赘述,Surface texture中的第一缓冲队列可以采用多级buffer,多级buffer之间通过交换模式进行数据传递。In this embodiment, the existing Surface texture in the Android system is used to transfer the 2D image to the 3D rendering synthesizer. The creation and principle of the Surface texture will not be described in detail here. The first buffer queue in the Surface texture can use a multi-level buffer. Data is transferred between multi-level buffers through exchange mode.

S204、3D渲染合成器从Surface texture的第一缓冲队列中读取2D图像。S204. The 3D rendering synthesizer reads the 2D image from the first buffer queue of the Surface texture.

当3D应用中开启了多个2D应用后,3D渲染合成器从每个2D应用对应的Surfacetexture中读取2D图像。When multiple 2D applications are opened in a 3D application, the 3D rendering synthesizer reads the 2D image from the Surface texture corresponding to each 2D application.

S205、3D渲染合成器从3D应用的左眼buffer中读取左眼数据,从3D应用的右眼buffer中读取右眼数据。S205. The 3D rendering synthesizer reads left eye data from the left eye buffer of the 3D application and reads right eye data from the right eye buffer of the 3D application.

S206、3D渲染合成器根据3D应用的左眼数据、右眼数据以及2D图像进行渲染合成得到3D图像,并将3D图像发送给HWC。S206. The 3D rendering synthesizer performs rendering and synthesis based on the left eye data, right eye data and 2D image of the 3D application to obtain a 3D image, and sends the 3D image to the HWC.

当3D应用中开启了多个2D应用后,对于每帧图像,3D渲染合成器在获取到已开启的多个应用的2D图像以及3D应用的待渲染数据后,开始渲染当前帧图像。3D渲染合成器将2D图像划分为左眼2D图像和右眼2D图像,将左眼2D图像和3D应用的左眼图像一起进行渲染,得到左眼的3D图像,将右眼2D图像和3D应用的右眼图像一起进行渲染,得到右眼的3D图像。When multiple 2D applications are opened in a 3D application, for each frame of image, the 3D rendering synthesizer starts rendering the current frame image after acquiring the 2D images of the multiple opened applications and the data to be rendered of the 3D application. The 3D rendering synthesizer divides the 2D image into a left-eye 2D image and a right-eye 2D image, renders the left-eye 2D image and the left-eye image of the 3D application together to obtain a 3D image of the left eye, and combines the right-eye 2D image and the 3D application The right eye image is rendered together to obtain the 3D image of the right eye.

3D渲染合成器渲染合成的3D图像存储在3D渲染合成器的Graphic buffer中,图2中,渲染合成器的Graphic buffer与Surface texture的Graphic buffer存储的数据不同,3D渲染合成器的Graphic buffer中存储的数据为3D图像,Surface texture的Graphicbuffer存储的数据为2D图像。The 3D image rendered and synthesized by the 3D rendering synthesizer is stored in the Graphic buffer of the 3D rendering synthesizer. In Figure 2, the data stored in the Graphic buffer of the rendering synthesizer and the Graphic buffer of the Surface texture are different. The data stored in the Graphic buffer of the 3D rendering synthesizer is different. The data is a 3D image, and the data stored in the Graphicbuffer of the Surface texture is a 2D image.

S207、HWC对3D图像进行反色散处理,将反色散处理后的3D图像发送给显示屏幕。S207. The HWC performs anti-dispersion processing on the 3D image, and sends the anti-dispersion processed 3D image to the display screen.

S208、显示屏幕显示3D图像。S208. Display the 3D image on the display screen.

该3D图像中包括2D应用的内容,2D应用的内容显示在虚拟屏中,图2所示例子中,在3D图像即3D应用提供的虚拟现实空间中显示有3个2D应用的内容。其中,各2D应用的虚拟屏的初始位置可能在固定的位置,用户可以根据自己的需求对虚拟屏的位置、大小、姿态等进行调整,还可以关闭虚拟屏,关闭虚拟屏即关闭虚拟屏中显示的2D应用。The 3D image includes the content of the 2D application, and the content of the 2D application is displayed on the virtual screen. In the example shown in Figure 2, the content of three 2D applications is displayed in the 3D image, that is, the virtual reality space provided by the 3D application. Among them, the initial position of the virtual screen of each 2D application may be at a fixed position. Users can adjust the position, size, posture, etc. of the virtual screen according to their own needs. They can also close the virtual screen. Closing the virtual screen means closing the virtual screen. Display 2D applications.

本实施例中,将3D应用的渲染从安卓系统的surface flinger中分离出来,surface flinger进行2D应用的图像渲染,3D应用的渲染由独立的3D渲染合成器完成,surface flinger对2D应用的图像渲染完成后,将2D图像通过Surface texture传递给3D渲染合成器,3D渲染合成器对3D应用的待渲染数据以及2D图像一起渲染,得到3D图像。3D渲染合成器从surface flinger中分离出来,便于3D渲染合成器的扩展和升级。In this embodiment, the rendering of 3D applications is separated from the surface flinger of the Android system. The surface flinger performs image rendering of 2D applications. The rendering of 3D applications is completed by an independent 3D rendering synthesizer. The surface flinger renders images of 2D applications. After completion, the 2D image is passed to the 3D rendering synthesizer through the Surface texture. The 3D rendering synthesizer renders the 3D application's data to be rendered and the 2D image together to obtain a 3D image. The 3D rendering synthesizer is separated from surface flinger to facilitate the expansion and upgrade of the 3D rendering synthesizer.

为便于更好的实施本申请实施例的图像渲染方法,本申请实施例还提供一种图像渲染装置。图4为本申请实施例三提供的图像渲染装置的结构示意图,如图4所示,该图像渲染装置100可以包括:In order to facilitate better implementation of the image rendering method in the embodiment of the present application, the embodiment of the present application also provides an image rendering device. Figure 4 is a schematic structural diagram of an image rendering device provided in Embodiment 3 of the present application. As shown in Figure 4, the image rendering device 100 may include:

启动模块11,用于根据2D应用的开启指令,在虚拟屏中启动所述2D应用;The startup module 11 is used to start the 2D application in the virtual screen according to the startup instruction of the 2D application;

2D渲染合成器12,用于从所述虚拟屏中获取所述2D应用的多个图层,对所述2D应用的多个图层合成得到所述2D应用的2D图像,将所述2D图像发送给所述虚拟屏的传输组件;The 2D rendering synthesizer 12 is used to obtain multiple layers of the 2D application from the virtual screen, synthesize the multiple layers of the 2D application to obtain a 2D image of the 2D application, and convert the 2D image into Sent to the transmission component of the virtual screen;

传输组件13,用于将所述2D图像传输给所述3D渲染合成器;Transmission component 13, used to transmit the 2D image to the 3D rendering synthesizer;

3D渲染合成器14,用于对所述2D图像以及3D应用的待渲染数据进行渲染合成得到所述3D应用的3D图像,所述3D图像中显示有所述虚拟屏,所述虚拟屏中显示有所述2D图像;The 3D rendering synthesizer 14 is used to render and synthesize the 2D image and the to-be-rendered data of the 3D application to obtain the 3D image of the 3D application. The virtual screen is displayed in the 3D image, and the virtual screen displays There is said 2D image;

显示模块15,用于显示所述3D图像。The display module 15 is used to display the 3D image.

在一些实施例中,所述传输组件中包括缓冲队列,所述缓冲队列用于存储所述2D图像,所述传输组件采用生产者消费者模型传输所述2D图像。In some embodiments, the transmission component includes a buffer queue, the buffer queue is used to store the 2D image, and the transmission component uses a producer-consumer model to transmit the 2D image.

在一些实施例中,所述3D渲染合成器14还用于:对所述3D图像进行反色散处理,将反色散处理后的所述3D图像发送给所述显示模块15。In some embodiments, the 3D rendering synthesizer 14 is also configured to: perform anti-dispersion processing on the 3D image, and send the anti-dispersion processed 3D image to the display module 15 .

在一些实施例中,所述XR设备还包括硬件合成器HWC,所述3D渲染合成器14还用于:将所述3D图像发送给所述HWC;In some embodiments, the XR device further includes a hardware compositor HWC, and the 3D rendering compositor 14 is also used to: send the 3D image to the HWC;

所述HWC,用于对所述3D图像进行反色散处理,将反色散处理后的所述3D图像发送给所述显示模块15。The HWC is used to perform anti-dispersion processing on the 3D image, and send the anti-dispersion processed 3D image to the display module 15 .

在一些实施例中,所述3D应用中启动了多个2D应用,所述多个2D应用通过多个虚拟屏显示,每个所述虚拟屏只能关联一个2D应用。In some embodiments, multiple 2D applications are launched in the 3D application, and the multiple 2D applications are displayed through multiple virtual screens, and each virtual screen can only be associated with one 2D application.

在一些实施例中,所述2D渲染合成器的渲染频率小于或等于所述3D渲染合成器的渲染频率。In some embodiments, the rendering frequency of the 2D rendering synthesizer is less than or equal to the rendering frequency of the 3D rendering synthesizer.

在一些实施例中,所述3D渲染合成器14具体用于:In some embodiments, the 3D rendering synthesizer 14 is specifically used to:

将所述2D图像划分为左眼2D图像和右眼2D图像;Divide the 2D image into a left eye 2D image and a right eye 2D image;

从所述3D应用的缓冲区中获取所述3D应用的左眼数据和右眼数据;Obtain the left eye data and right eye data of the 3D application from the buffer of the 3D application;

根据所述3D应用的左眼数据、右眼数据、所述左眼2D图像和所述右眼2D图像进行渲染合成得到所述3D应用的左眼图像和右眼图像。The left eye image and the right eye image of the 3D application are rendered and synthesized according to the left eye data, right eye data, the left eye 2D image and the right eye 2D image of the 3D application.

在一些实施例中,当所述XR设备采用安卓系统时,所述2D渲染合成器为系统服务模块surface flinger,所述传输组件包括所述虚拟屏的surface和Surface texture模块,所述Surface texture模块中包括第一缓冲队列,所述第一缓冲队列用于存储所述2D图像。In some embodiments, when the XR device adopts the Android system, the 2D rendering synthesizer is the system service module surface flinger, and the transmission component includes the surface and Surface texture modules of the virtual screen. The Surface texture module includes a first buffer queue, and the first buffer queue is used to store the 2D image.

在一些实施例中,所述虚拟屏的surface将所述2D图像存储到所述Surfacetexture模块的所述第一缓冲队列中;In some embodiments, the surface of the virtual screen stores the 2D image into the first buffer queue of the Surfacetexture module;

所述3D渲染合成器从所述第一缓冲队列中读取所述2D图像。The 3D rendering compositor reads the 2D image from the first buffer queue.

在一些实施例中,所述第一缓冲队列采用多级缓冲区。In some embodiments, the first buffer queue uses a multi-level buffer.

应理解的是,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。It should be understood that the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here.

上文中结合附图从功能模块的角度描述了本申请实施例的装置100和200。应理解,该功能模块可以通过硬件形式实现,也可以通过软件形式的指令实现,还可以通过硬件和软件模块组合实现。具体地,本申请实施例中的方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路和/或软件形式的指令完成,结合本申请实施例公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。可选地,软件模块可以位于随机存储器,闪存、只读存储器、可编程只读存储器、电可擦写可编程存储器、寄存器等本领域的成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法实施例中的步骤。The devices 100 and 200 in the embodiments of the present application are described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that this functional module can be implemented in the form of hardware, can also be implemented through instructions in the form of software, or can also be implemented through a combination of hardware and software modules. Specifically, each step of the method embodiments in the embodiments of the present application can be completed by integrated logic circuits of hardware in the processor and/or instructions in the form of software. The steps of the methods disclosed in conjunction with the embodiments of the present application can be directly embodied in hardware. The execution of the decoding processor is completed, or the execution is completed using a combination of hardware and software modules in the decoding processor. Optionally, the software module may be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in combination with its hardware.

本申请实施例还提供一种XR设备。图5为本申请实施例四提供的XR设备的一种结构示意图,如图5所示,该XR设备300可以包括:An embodiment of the present application also provides an XR device. Figure 5 is a schematic structural diagram of an XR device provided in Embodiment 4 of the present application. As shown in Figure 5, the XR device 300 may include:

存储器31和处理器32,该存储器31用于存储计算机程序,并将该程序代码传输给该处理器32。换言之,该处理器32可以从存储器31中调用并运行计算机程序,以实现本申请实施例中的方法。Memory 31 and processor 32. The memory 31 is used to store computer programs and transmit the program codes to the processor 32. In other words, the processor 32 can call and run the computer program from the memory 31 to implement the method in the embodiment of the present application.

例如,该处理器32可用于根据该计算机程序中的指令执行上述方法实施例中XR设备或者服务器执行的方法步骤,相应的,该XR设备300为XR设备或者服务器。For example, the processor 32 may be configured to execute method steps performed by the XR device or server in the above method embodiment according to instructions in the computer program. Correspondingly, the XR device 300 is an XR device or server.

在本申请的一些实施例中,该处理器32可以包括但不限于:In some embodiments of the present application, the processor 32 may include but is not limited to:

通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(FieldProgrammable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等等。General processor, Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or Transistor logic devices, discrete hardware components, and more.

在本申请的一些实施例中,该存储器31包括但不限于:In some embodiments of the present application, the memory 31 includes but is not limited to:

易失性存储器和/或非易失性存储器。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double DataRate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)。Volatile memory and/or non-volatile memory. Among them, the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of illustration, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double DataRate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch link DRAM, SLDRAM) ) and direct memory bus random access memory (Direct Rambus RAM, DR RAM).

在本申请的一些实施例中,该计算机程序可以被分割成一个或多个模块,该一个或者多个模块被存储在该存储器31中,并由该处理器32执行,以完成本申请提供的方法。该一个或多个模块可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述该计算机程序在XR设备中的执行过程。In some embodiments of the present application, the computer program can be divided into one or more modules, and the one or more modules are stored in the memory 31 and executed by the processor 32 to complete the tasks provided by the present application. method. The one or more modules may be a series of computer program instruction segments capable of completing specific functions. The instruction segments are used to describe the execution process of the computer program in the XR device.

如图5所示,该XR设备还可包括:收发器33,该收发器33可连接至该处理器32或存储器31。As shown in FIG. 5 , the XR device may further include a transceiver 33 , and the transceiver 33 may be connected to the processor 32 or the memory 31 .

其中,处理器32可以控制该收发器33与其他设备进行通信,具体地,可以向其他设备发送信息或数据,或接收其他设备发送的信息或数据。收发器33可以包括发射机和接收机。收发器33还可以进一步包括天线,天线的数量可以为一个或多个。The processor 32 can control the transceiver 33 to communicate with other devices. Specifically, it can send information or data to other devices, or receive information or data sent by other devices. Transceiver 33 may include a transmitter and a receiver. The transceiver 33 may further include an antenna, and the number of antennas may be one or more.

可以理解,虽然图5中未示出,该XR设备300还可以包括摄像头模组、无线保真WIFI模块、定位模块、蓝牙模块、显示器、控制器等,在此不再赘述。It can be understood that, although not shown in FIG. 5 , the XR device 300 may also include a camera module, a wireless fidelity WIFI module, a positioning module, a Bluetooth module, a display, a controller, etc., which will not be described again here.

应当理解,该XR设备中的各个组件通过总线系统相连,其中,总线系统除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。It should be understood that various components in the XR device are connected through a bus system, where in addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus.

本申请还提供了一种计算机存储介质,其上存储有计算机程序,该计算机程序被计算机执行时使得该计算机能够执行上述方法实施例中XR设备或者服务器执行的方法,在此不再赘述。This application also provides a computer storage medium on which a computer program is stored. When executed by a computer, the computer program enables the computer to execute the method executed by the XR device or server in the above method embodiments, which will not be described again here.

本申请还提供了一种计算机程序产品,该计算机程序产品包括计算机程序,该计算机程序存储在计算机可读存储介质中。XR设备的处理器从计算机可读存储介质读取该计算机程序,处理器执行该计算机程序,使得XR设备执行上述方法实施例中XR设备或者服务器执行的方法,在此不再赘述。The application also provides a computer program product. The computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. The processor of the XR device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the XR device executes the method executed by the XR device or the server in the above method embodiment, which will not be described again here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,该模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or may be Integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or modules, and may be in electrical, mechanical or other forms.

作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。例如,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。Modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.

以上仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以该权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, and they should be covered by within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (14)

1. An image rendering method, applied to an XR device comprising a 2D rendering compositor, a 3D rendering compositor, and a display screen, the method comprising:
Starting the 2D application in the virtual screen according to an opening instruction of the 2D application;
the 2D rendering synthesizer acquires a plurality of layers of the 2D application from the virtual screen, and the 2D image of the 2D application is obtained by combining the plurality of layers of the 2D application, and the 2D image is sent to a transmission component of the virtual screen;
the transmission component transmits the 2D image to the 3D rendering compositor;
the 3D rendering synthesizer renders and synthesizes the 2D image and the data to be rendered of the 3D application to obtain a 3D image of the 3D application, the 3D image is displayed with the virtual screen, and the virtual screen is displayed with the 2D image;
the display screen displays the 3D image.
2. The method of claim 1, wherein the transmission component comprises a buffer queue therein for storing the 2D image, the transmission component transmitting the 2D image using a producer consumer model.
3. The method of claim 1, wherein prior to the displaying of the 3D image by the display screen, further comprising:
and the 3D rendering synthesizer carries out inverse dispersion processing on the 3D image and sends the 3D image subjected to the inverse dispersion processing to the display screen.
4. The method of claim 1, wherein the XR device further comprises a hardware synthesizer HWC, the display screen further comprising, prior to displaying the 3D image:
the 3D rendering compositor sends the 3D image to the HWC;
and the HWC carries out inverse dispersion processing on the 3D image, and sends the 3D image after the inverse dispersion processing to the display screen.
5. The method of claim 1, wherein a plurality of 2D applications are launched in the 3D application, the plurality of 2D applications being displayed through a plurality of virtual screens, each virtual screen being capable of associating only one 2D application.
6. The method of claim 1, wherein a rendering frequency of the 2D rendering compositor is less than or equal to a rendering frequency of the 3D rendering compositor.
7. The method according to claim 1, wherein the 3D rendering compositor renders and composites the 2D image and data to be rendered of a 3D application to obtain a 3D image of the 3D application, comprising:
dividing the 2D image into a left-eye 2D image and a right-eye 2D image;
acquiring left eye data and right eye data of the 3D application from a buffer zone of the 3D application;
And rendering and synthesizing according to the left-eye data, the right-eye data, the left-eye 2D image and the right-eye 2D image of the 3D application to obtain the left-eye image and the right-eye image of the 3D application.
8. The method of any of claims 1-7, wherein when the XR device employs an android system, the 2D rendering compositor is a system service flinger, the transport component comprises a Surface and a Surface texture module of the virtual screen, and the Surface texture module comprises a first buffer queue, the first buffer queue is configured to store the 2D images.
9. The method of claim 8, wherein the transmitting component transmits the 2D image to the 3D rendering compositor comprises:
the Surface of the virtual screen stores the 2D image into the first buffer queue of the Surface texture module;
the 3D rendering compositor reads the 2D image from the first buffer queue.
10. The method of claim 9, wherein the first buffer queue employs a multi-level buffer.
11. An image rendering apparatus, comprising:
the starting module is used for starting the 2D application in the virtual screen according to the starting instruction of the 2D application;
A 2D rendering synthesizer, configured to obtain multiple layers of the 2D application from the virtual screen, combine the multiple layers of the 2D application to obtain a 2D image of the 2D application, and send the 2D image to a transmission component of the virtual screen;
a transmission component for transmitting the 2D image to the 3D rendering compositor;
a 3D rendering synthesizer, configured to render and synthesize the 2D image and data to be rendered of a 3D application to obtain a 3D image of the 3D application, where the 3D image is displayed with the virtual screen, and the virtual screen is displayed with the 2D image;
and the display module is used for displaying the 3D image.
12. An XR device comprising:
a processor and a memory for storing a computer program, the processor being for invoking and running the computer program stored in the memory to perform the method of any of claims 1 to 10.
13. A computer readable storage medium storing a computer program for causing a computer to perform the method of any one of claims 1 to 10.
14. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 10.
CN202310956618.4A 2023-07-31 2023-07-31 Image rendering methods, devices, equipment, media and program products Pending CN117173309A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310956618.4A CN117173309A (en) 2023-07-31 2023-07-31 Image rendering methods, devices, equipment, media and program products

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310956618.4A CN117173309A (en) 2023-07-31 2023-07-31 Image rendering methods, devices, equipment, media and program products

Publications (1)

Publication Number Publication Date
CN117173309A true CN117173309A (en) 2023-12-05

Family

ID=88938329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310956618.4A Pending CN117173309A (en) 2023-07-31 2023-07-31 Image rendering methods, devices, equipment, media and program products

Country Status (1)

Country Link
CN (1) CN117173309A (en)

Similar Documents

Publication Publication Date Title
EP4044123A1 (en) Display method and device based on augmented reality, and storage medium
US20250225620A1 (en) Special effect image processing method and apparatus, electronic device, and storage medium
WO2018086295A1 (en) Application interface display method and apparatus
EP4050561A1 (en) Augmented reality-based display method, device, and storage medium
US20180018806A1 (en) Method and Apparatus for Displaying 2D Application Interface in Virtual Reality Device
JP2024505995A (en) Special effects exhibition methods, devices, equipment and media
US20200341541A1 (en) Simulated reality cross platform system
JP2019535156A (en) Virtual reality, augmented reality, and mixed reality systems and methods
WO2022252924A1 (en) Image transmission and display method and related device and system
CN109725956B (en) Scene rendering method and related device
CN108668168B (en) Android VR video player based on Unity3D and design method thereof
US20230405475A1 (en) Shooting method, apparatus, device and medium based on virtual reality space
WO2024244666A1 (en) Animation generation method and apparatus for avatar, and electronic device, computer program product and computer-readable storage medium
CN107343206A (en) Support video generation method, device, medium and the electronic equipment of various visual angles viewing
EP4546268A1 (en) Graphical interface processing method and apparatus
WO2024193568A1 (en) Interaction method and apparatus, and device, medium and program
CN117173309A (en) Image rendering methods, devices, equipment, media and program products
CN112017264A (en) Display control method and device for virtual studio, storage medium and electronic equipment
CN107277483A (en) A kind of virtual reality display methods, device and virtual reality glasses
KR20200144702A (en) System and method for adaptive streaming of augmented reality media content
CN114385062A (en) Switching method, device, readable storage medium and electronic device for presentation scheme
CN116828245A (en) Video switching method, device, apparatus, medium, and program
US12190437B2 (en) Display control method and apparatus, terminal, and storage medium
JP2021508133A (en) Mapping pseudo-hologram providing device and method using individual video signal output
RU2802724C1 (en) Image processing method and device, electronic device and machine readable storage carrier

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination