Method and system for generating augmented reality scene showing real occlusion relationship of objects

By determining the intersection depth value of the virtual object and the real object in AR technology, setting the material attributes to make the obstructed object invisible, the problem of confusing the occlusion relationship between the virtual object and the real object is solved, the rendering of the real occlusion relationship is realized, and the AR scene is improved authenticity and user experience.

CN114863066BActive Publication Date: 2024-11-01KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210429552.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-22
Publication Date
2024-11-01
Estimated Expiration
2042-04-22

AI Technical Summary

Technical Problem

In the existing AR technology, when virtual objects block real objects in real scenes, it is easy to cause confusion in the occlusion relationship between virtual objects and real objects, and it is impossible to accurately present the real scenes expected by users.

Method used

By using multiple rays with observation points as endpoints in AR scenes, the depth value of the intersection between the real object and the virtual object is determined, and the material attribute value of the virtual object is set according to the depth relationship, so that the obstructed object is invisible, thereby realizing the real obstructed relationship rendering.

Benefits of technology

It effectively solves the problem of confusion in the occlusion relationship between virtual objects and real objects, ensures that the generated AR scene is consistent with the real scene expected by users, and improves the authenticity and user experience of AR scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863066B_ABST
    Figure CN114863066B_ABST
Patent Text Reader

Abstract

The present application discloses a method and system for generating an AR scene that presents a real occlusion relationship of an object. In an embodiment of the present application, in a pre-generated AR scene, multiple rays with an observation point as endpoints are used as multiple visual rays. For each visual ray, the intersection with the real object is used as the first pixel of the real object, and the intersection with the virtual object is used as the second pixel of the virtual object; the depth value of the first pixel is obtained and the depth value of the second pixel is obtained; according to the depth value of the first pixel and the depth value of the second pixel, the real occlusion relationship between the first pixel and the second pixel is determined, and the material attribute value of the second pixel is set according to the real occlusion relationship; based on the material attribute value of the second pixel, the virtual object is rendered in the pre-generated AR scene to generate the AR scene. In this way, the occlusion between the real object and the virtual object in the AR scene is realized based on the real occlusion relationship between the real object and the virtual object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to virtual image processing technology, and in particular to a method and system for generating an augmented reality (AR) scene that presents the real occlusion relationship of objects. Background Art

[0002] With the rapid development of computer technology, AR technology has been proposed. AR technology is a technology that organically integrates virtual information with real scenes. It simulates virtual information such as computer-generated text, images, three-dimensional models, music or videos, and applies them to real scenes.

[0003] AR technology is widely used in reality. For example, virtual objects such as wardrobes or TV cabinets can be integrated into real indoor scenes with real objects such as partition walls and chairs to provide users with indoor AR scenes with real objects and virtual objects. Figure 1 As shown, Figure 1 A top view schematic diagram of an indoor AR scene with real objects and virtual objects provided by the prior art. Enter the indoor scene through the entrance door. The indoor scene includes a living room and a bedroom. The living room and the bedroom are separated by a partition wall and accessed through the room door. There is a chair in the bedroom. In order to provide the user with the object arrangement effect in the indoor scene, it is necessary to generate the indoor AR scene based on the indoor scene. Assume that the indoor AR scene is the user in Figure 1 The AR scene obtained by observing the observation points shown is: a virtual TV cabinet is integrated in the living room and a virtual wardrobe is integrated in the bedroom.

[0004] When setting up an AR scene based on a real scene and virtual objects to be fused, it is usually pre-set that the virtual objects occlude the real objects in the real scene, such as Figure 1 The virtual TV cabinet in the real indoor scene blocks the ground. However, no matter what the situation, the obtained AR scene is the virtual object blocking the real object in the real scene, and the occlusion setting is not based on the real occlusion relationship between the virtual object and the real object. Therefore, the resulting AR scene may have a problem of confusion in the occlusion relationship between the virtual object and the real object. For example, in Figure 1 In the obtained AR scene, since the virtual wardrobe blocks the real partition wall by default, the virtual wardrobe will float on the real partition wall, which is inconsistent with the expected AR scene. Summary of the invention

[0005] In view of this, an embodiment of the present application provides a method for generating an AR scene that presents a real occlusion relationship between objects. The method can perform occlusion between real objects and virtual objects based on the real occlusion relationship between real objects and virtual objects in the AR scene.

[0006] An embodiment of the present application also provides a system for generating an AR scene that presents a real occlusion relationship between objects. The system can perform occlusion between real objects and virtual objects based on the real occlusion relationship between real objects and virtual objects in the AR scene.

[0007] The embodiment of the present application is implemented as follows:

[0008] A method for generating an augmented reality scene that presents a real occlusion relationship of an object, the method comprising:

[0009] In a pre-generated augmented reality scene, a plurality of rays with an observation point as endpoints are used as a plurality of visual rays. For each visual ray, in response to an intersection between the visual ray and a real object, the intersection between the visual ray and the real object is used as a first pixel point of the real object; in response to an intersection between the visual ray and the virtual object, the intersection between the visual ray and the virtual object is used as a second pixel point;

[0010] Obtaining a depth value of the first pixel and a depth value of the second pixel located on the same visual ray, wherein the depth value of the first pixel is the distance between the observation point and the first pixel, and the depth value of the second pixel is the distance between the observation point and the second pixel;

[0011] Determining a real occlusion relationship between the first pixel and the second pixel according to the depth value of the first pixel and the depth value of the second pixel, and setting a material attribute value of the second pixel according to the real occlusion relationship;

[0012] Based on the material attribute value of the second pixel point, the virtual object is rendered in a pre-generated augmented reality scene to generate an augmented reality scene.

[0013] Preferably, the intersection point of the visual ray and the real object is an intersection point between the surface of the real object and the visual ray, and is closest to the observation point;

[0014] The intersection point of the visual ray and the virtual object is an intersection point between the surface of the virtual object and the visual ray, and is closest to the observation point.

[0015] Preferably, the determining a real occlusion relationship between the first pixel and the second pixel, and setting a material attribute value of the second pixel according to the real occlusion relationship comprises:

[0016] The depth value of the second pixel is compared with the depth value of the first pixel. If the depth value of the second pixel is greater than the depth value of the first pixel, the material attribute value of the second pixel is set to a transparent attribute value. If the depth value of the second pixel is less than or equal to the depth value of the first pixel, the material attribute value of the second pixel is set to a non-transparent attribute value.

[0017] Preferably, obtaining the depth value of the first pixel includes:

[0018] Setting a virtual model for the real object, and importing the virtual model into a pre-generated augmented reality scene to determine position information of the virtual model in the augmented reality scene;

[0019] Based on the imported position information of the virtual model in the augmented reality scene, a rendering method is adopted, an intersection point of the visual ray and the virtual model is used as a third pixel point of the virtual model, a depth value of the third pixel point is calculated, and the third pixel point of the virtual model is used as a first pixel point corresponding to the real object;

[0020] The calculated depth value of the third pixel is used as the depth value of the first pixel corresponding to the real object, wherein the depth value of the third pixel is the distance between the observation point and the third pixel.

[0021] Preferably, the rendering method is adopted, and the intersection of the visual ray and the virtual model is used as the third pixel point of the virtual model, and the depth value of the third pixel point is calculated, including:

[0022] Not rendering a main rendering pass of the virtual model in the pre-generated augmented reality scene, so that the virtual model is invisible in the generated augmented reality scene;

[0023] In the pre-generated augmented reality scene, the depth rendering channel of the virtual model is not rendered, and a custom depth rendering channel is rendered, and the intersection of the visual ray and the virtual model is used as the third pixel point of the virtual model to calculate the depth value of the third pixel point.

[0024] Preferably, when rendering the virtual object in the pre-generated augmented reality scene, the method further includes:

[0025] Rendering a main rendering pass of the virtual object in a pre-generated augmented reality scene so that the virtual object is displayed in the generated AR scene;

[0026] A depth rendering channel of the virtual object is rendered in the pre-generated augmented reality scene to present the depth of the virtual object in the pre-generated augmented reality scene.

[0027] Preferably, the method further comprises:

[0028] Setting the color attribute value of the second pixel;

[0029] When rendering the virtual object in the pre-generated augmented reality scene, it is also based on the color attribute value of the second pixel point.

[0030] An electronic device, comprising:

[0031] processor;

[0032] A memory stores a program, wherein the program is configured to implement any of the above-mentioned methods for generating an AR scene that presents a real occlusion relationship between objects when executed by the processor.

[0033] A non-transitory computer-readable storage medium storing instructions, characterized in that when the instructions are executed by a processor, the processor executes the steps of any of the above-mentioned methods for generating an augmented reality scene that presents the real occlusion relationship of objects.

[0034] A computer program product includes a computer program or an instruction, wherein when the computer program or the instruction is executed by a processor, the steps of the method for generating an augmented reality scene presenting the real occlusion relationship of objects as described in any one of the above are implemented.

[0035] As can be seen above, in the pre-generated AR scene, the embodiment of the present application uses multiple rays with the observation point as endpoints as multiple visual rays. For each visual ray, in response to the existence of an intersection between the visual ray and the real object, the intersection between the visual ray and the real object is used as the first pixel of the real object; in response to the existence of an intersection between the visual ray and the virtual object, the intersection between the visual ray and the virtual object is used as the second pixel; the depth value of the first pixel located on the same visual ray is obtained and the depth value of the second pixel is obtained, wherein the depth value of the first pixel is the distance between the observation point and the first pixel, and the depth value of the second pixel is the distance between the observation point and the second pixel; according to the depth value of the first pixel and the depth value of the second pixel, the real occlusion relationship between the first pixel and the second pixel is determined, and the material attribute value of the second pixel is set according to the real occlusion relationship; based on the material attribute value of the second pixel, the virtual object is rendered in the pre-generated AR scene to generate an AR scene. In this way, based on the comparison of depth values ​​between real objects and virtual objects in the pre-generated AR scene, it is possible to determine that the virtual object or part of the virtual object is the occluded object, set the material attribute of the occluded object to the transparent attribute value, and render the occluded object in the pre-generated AR scene accordingly, making the occluded object invisible, thereby realizing occlusion between real objects and virtual objects based on the real occlusion relationship between the real objects and virtual objects in the AR scene. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A schematic diagram of an indoor AR scene with real objects and virtual objects provided by the prior art;

[0037] Figure 2 A flow chart of a method for generating an AR scene that presents a real occlusion relationship of objects provided in an embodiment of the present application;

[0038] Figure 3 A schematic diagram of a process of drawing a corresponding virtual model in the AR scene for a real object in the AR scene according to an embodiment of the present application;

[0039] Figure 4 A flow chart of a method for determining an obstructed object and setting a material attribute value of the obstructed object provided in an embodiment of the present application;

[0040] Figure 5 A schematic diagram of a process for rendering a virtual object in an AR scene provided in an embodiment of the present application;

[0041] Figure 6 A schematic diagram of the structure of a system for generating an AR scene that presents a real occlusion relationship between objects provided in an embodiment of the present application;

[0042] Figure 7 A schematic diagram of an electronic device provided for another embodiment of the present application. DETAILED DESCRIPTION

[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0044] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0045] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0046] As can be seen from the background technology, the generated AR scene may have confusion in the occlusion relationship between real objects and virtual objects, such as Figure 1 The virtual cabinet that should be blocked in the scene is presented as floating on the partition wall because the default setting blocks the partition wall as a real object, so that the generated AR scene does not match the real scene expected by the user. In order to overcome the above problem and make the generated AR scene consistent with the real scene expected by the user, it is necessary to confirm the real blocking relationship between the real object and the virtual object in the AR scene to be generated, set the material attribute value of the virtual object or part of the virtual object as the blocked object to the transparent attribute value according to the real blocking relationship, and render the virtual object accordingly, so that the virtual object as the blocked object is invisible in the AR scene.

[0047] Therefore, in the pre-generated AR scene, the embodiment of the present application uses multiple rays with the observation point as endpoints as multiple visual rays. For each visual ray, in response to the existence of an intersection between the visual ray and the real object, the intersection between the visual ray and the real object is used as the first pixel of the real object; in response to the existence of an intersection between the visual ray and the virtual object, the intersection between the visual ray and the virtual object is used as the second pixel; the depth value of the first pixel located on the same visual ray is obtained, and the depth value of the second pixel is obtained, wherein the depth value of the first pixel is the distance between the observation point and the first pixel, and the depth value of the second pixel is the distance between the observation point and the second pixel; according to the depth value of the first pixel and the depth value of the second pixel, the real occlusion relationship between the first pixel and the second pixel is determined, and the material attribute value of the second pixel is set according to the real occlusion relationship; based on the material attribute value of the second pixel, the virtual object is rendered in the pre-generated AR scene to generate an AR scene.

[0048] In this way, based on the comparison of depth values ​​between real objects and virtual objects in the pre-generated AR scene, it is possible to determine that the virtual object or part of the virtual object is an occluded object, set the material attribute value of the occluded object to the transparent attribute value, and render the occluded object in the pre-generated AR scene accordingly, so that the occluded object is invisible in the generated AR scene.

[0049] Figure 2 A flow chart of a method for generating an AR scene that presents a real occlusion relationship of an object provided in an embodiment of the present application, wherein the specific steps include:

[0050] Step 201: In a pre-generated AR scene, a plurality of rays with an observation point as endpoints are used as a plurality of visual rays. For each visual ray, in response to an intersection between the visual ray and a real object, the intersection between the visual ray and the real object is used as a first pixel point of the real object; in response to an intersection between the visual ray and the virtual object, the intersection between the visual ray and the virtual object is used as a second pixel point.

[0051] Step 202: Obtain a depth value of the first pixel and a depth value of the second pixel located on the same visual ray, wherein the depth value of the first pixel is the distance between the observation point and the first pixel, and the depth value of the second pixel is the distance between the observation point and the second pixel;

[0052] Step 203: determining a real occlusion relationship between the first pixel and the second pixel according to the depth value of the first pixel and the depth value of the second pixel, and setting a material attribute value of the second pixel according to the real occlusion relationship;

[0053] Step 204: Render the virtual object in a pre-generated AR scene based on the material attribute value of the second pixel point to generate an AR scene.

[0054] In this method, the pre-generated AR scene includes real objects and virtual objects to be fused, as well as position information of the real objects and position information of the virtual objects to be fused. However, the actual occlusion relationship between the real objects and the virtual objects has not yet been set and rendered in the pre-generated AR scene.

[0055] The AR scene is a fusion of the real scene and the virtual object, which is provided to the user in the form of a three-dimensional image. Therefore, for the same real environment, when the user's observation point is different, the AR scene presented to the user is also different, and the pre-generated AR scene is closely related to the observation point. When the AR scene is provided to the user in the form of a three-dimensional image for a certain observation point, the real objects and virtual objects in the AR scene are composed of and presented by different multiple three-dimensional pixel points.

[0056] The depth value of the pixel points on different objects in the AR scene is related to the observation point of the AR scene, specifically, the distance value between the pixel point and the observation point of the AR scene.

[0057] In an AR scene, in order to determine which object or part of an object is an occluded object, it is necessary to compare the depth values ​​between the occluder and the occluded object, and the object with the larger depth value is determined to be the occluded object. However, in an AR scene, the occlusion relationship between real objects and virtual objects may be confusing because virtual objects occlude real objects by default. Therefore, when comparing, it is sufficient to compare the depth values ​​between real objects and virtual objects in the pre-generated AR scene.

[0058] When comparing the depth values ​​between real objects and virtual objects in the pre-generated AR scene, specifically comparing the depth values ​​between the pixels of the real object and the corresponding pixels on the virtual object, there is an occlusion relationship between the corresponding pixels and the occlusion relationship is related to the observation point of the AR scene. There are many corresponding pixel pairs on the real object and the virtual object. Therefore, the method uses the process of step 201 to determine multiple corresponding pixel pairs on the real object and the virtual object in the AR scene, and then judges the depth values ​​between the determined corresponding pixel pairs one by one.

[0059] In this method, for a certain visual ray, if in response to the existence of an intersection between the visual ray and a real object, the intersection between the visual ray and the real object is used as the first pixel point of the real object. However, in response to the existence of an intersection between the visual ray and the virtual object, that is, in the case where there is no intersection between the visual ray and the virtual object, there will be no problem in setting an occlusion relationship, and the first pixel point can be directly displayed in the AR scene.

[0060] In this method, for a certain visual ray, if in response to the fact that there is no intersection between the visual ray and the real object, that is, there is no intersection between the visual ray and the real object, but in response to the fact that there is an intersection between the visual ray and the virtual object, when the intersection of the visual ray and the virtual object is used as the second pixel point, there will be no problem in setting the occlusion relationship. The second pixel point can be rendered directly in the AR scene according to the non-transparent attribute value set according to the material attribute value of the second pixel point (the second pixel point is directly displayed in the AR scene).

[0061] In this method, for a certain visual ray, the intersection point between the visual ray and the real object is actually the intersection point between the visual ray and the surface of the real object, the number is one, and the distance between the intersection point and the observation point is the shortest. For a certain visual ray, the intersection point between the virtual object is actually the intersection point between the visual ray and the surface of the virtual object, the number is one, and the distance between the intersection point and the observation point is the shortest.

[0062] In this method, a visual ray is a specific ray that takes the observation point as the endpoint and is projected onto the surface of a virtual object or a real object in an AR scene. Usually, there is only one intersection between a visual ray and a virtual object or a real object, and the intersection is closest to the observation point. For the back surface of a virtual object such as a wardrobe, there is no intersection because it cannot be seen. In this case, when rendering a virtual object in an AR scene, the back surface of the virtual object will not be rendered, so the attributes of the pixel points on the back surface of the virtual object do not need to be set.

[0063] The three-dimensional image of the real object in the AR scene is a three-dimensional image layer obtained by photographing the real scene at the observation point. It does not render the real object in the AR scene. Therefore, if the depth value of each first pixel point on the real object in the AR scene is obtained by direct measurement or other methods, the depth value result obtained is inaccurate, and the depth value of the first pixel point on the real object cannot be accurately obtained directly from the AR scene. Therefore, in order to accurately obtain the depth value of the first pixel point on the real object from the AR scene, the embodiment of the present application adopts the following method:

[0064] Setting a virtual model for the real object, and importing the virtual model into a pre-generated AR scene to determine position information of the virtual model in the AR scene;

[0065] Based on the imported position information of the virtual model in the augmented reality scene, a rendering method is adopted, an intersection point of the visual ray and the virtual model is used as a third pixel point of the virtual model, a depth value of the third pixel point is calculated, and the third pixel point of the virtual model is used as a first pixel point corresponding to the real object;

[0066] The calculated depth value of the third pixel is used as the depth value of the first pixel corresponding to the real object, wherein the depth value of the third pixel is the distance between the observation point and the third pixel.

[0067] That is to say, by importing, a virtual model with the same position and structure as the real object is drawn in the pre-generated AR scene, thereby determining the position information of the virtual model in the AR scene. By rendering, based on the position information of the imported virtual model in the augmented reality scene, the intersection of the visual ray and the virtual model is used as the third pixel of the virtual model, and the depth information of the third pixel is calculated. When rendering, when the observation point is different, the visual ray will also be different. The third pixel of the virtual model is determined by the intersection between the determined visual ray and the virtual model. Here, in the AR scene, since the observation point can move and cause the change of the visual ray, the third pixel of the virtual model is determined during rendering, and the depth value of the third pixel is calculated. The position of the imported virtual model in the AR scene will not change with the change of the observation point, so it can be imported once.

[0068] When the virtual model is imported into the AR scene, the AR scene includes the position information of each point on the virtual model. However, whether each point on the virtual model serves as the intersection of the visual ray and the virtual model to determine the third pixel point is determined during the rendering process. The distance between the determined third pixel point and the observation point is subsequently calculated and assigned to the depth value of the third pixel point.

[0069] When rendering, the virtual model is hidden in the AR scene and the position information of each point in the virtual model is retained. The depth value of the third pixel point on the virtual model is directly calculated and then used as the depth value of the first pixel point corresponding to the real object. Here, the position information of the first pixel point of the real object in the AR scene is the same as the position information of the corresponding third pixel point of the virtual model.

[0070] Specifically, the virtual model of the real object is rendered in the pre-generated AR scene using a rendering method using a multi-channel rendering technology. Multi-channel rendering technology uses different rendering channels to render different presentation aspects of a three-dimensional object (such as color and / or depth, etc.). For example, the main rendering channel (Main Pass) is used to cache the RGB values ​​corresponding to the pixels in the three-dimensional object, and the depth rendering channel (Depth Pass) is used to cache the depth values ​​corresponding to the pixels in the three-dimensional object (forming a stereogram), etc. When rendering a three-dimensional object, multiple channels are used for rendering in sequence, and the three-dimensional object can be accurately presented in the AR scene. In this method, in order to obtain an accurate depth value of the first pixel, a virtual model is set for the real object, and after being imported into the pre-generated AR scene, the rendering process used is actually to calculate the depth value of the third pixel, and the calculated depth value of the third pixel is cached in the custom depth rendering channel (CustomDepth Pass) of the virtual model for presentation.

[0071] Specifically, the rendering method is adopted, and the intersection of the visual ray and the virtual model is used as the third pixel point of the virtual model, and the depth value of the third pixel point is calculated, including:

[0072] Not rendering a main rendering pass of the virtual model in the pre-generated AR scene, so that the virtual model is invisible in the generated AR scene;

[0073] In the pre-generated AR scene, the depth rendering channel of the virtual model is not rendered, and the custom depth rendering channel is rendered to calculate the depth value of the third pixel point.

[0074] In the method, when rendering the virtual object in the pre-generated AR scene, it also includes:

[0075] Rendering a primary rendering pass of the virtual object in a pre-generated AR scene so that the virtual object is displayed in the generated AR scene;

[0076] A depth rendering channel of the virtual object is rendered in the pre-generated AR scene to present a depth value of the virtual object in the pre-generated AR scene.

[0077] In this way, the virtual object in the pre-generated AR scene is rendered through different rendering channels, so the depth value of each second pixel point of the virtual object can be determined, and the virtual object can be displayed. Furthermore, the material attribute value of each second pixel point of the virtual object rendered in the pre-generated AR scene is assigned a transparent attribute value or a non-transparent attribute value, so that the material of the virtual object can be presented in the subsequently generated AR scene: the occluded second pixel point presents a transparent material, and the unoccluded second pixel point presents a non-transparent material. In this way, the real occlusion relationship between the real object and the virtual object can be presented in the generated AR scene.

[0078] In step 203 of the method, determining the real occlusion relationship between the first pixel and the second pixel includes:

[0079] The depth value of the second pixel is compared with the depth value of the first pixel. If the depth value of the second pixel is greater than the depth value of the first pixel, the material attribute value of the second pixel is set to a transparent attribute value. If the depth value of the second pixel is less than or equal to the depth value of the first pixel, the material attribute value of the second pixel is set to a non-transparent attribute value.

[0080] The above method is adopted to finally determine whether each second pixel point in the virtual object is occluded or blocked in the AR scene, and set the corresponding material attribute value accordingly. When rendering the virtual object in the pre-generated AR scene, the material attribute value set for each second pixel point is applied, so as to present the real occlusion relationship between the virtual object and the real object in the final generated AR scene. In this way, the AR scene is finally obtained. When the above method is used for comparison, if it is equal, it is considered that the second pixel point blocks the first pixel point. This is because according to the method adopted by the known technology of the applicant, the second pixel point blocks the first pixel point by default. With this setting, the change is small when the second pixel point is subsequently rendered. Of course, if it is equal, it can also be considered that the first pixel point blocks the second pixel point, and then the subsequent rendering process is performed, which is not limited here.

[0081] In an embodiment of the present application, the method further includes:

[0082] Setting the color attribute value of the second pixel;

[0083] When rendering the virtual object in the pre-generated AR scene, it is also based on the color attribute value of the second pixel point.

[0084] In this way, when the AR scene is subsequently generated, when the virtual object is an occluding object, the set color can also be presented.

[0085] The embodiment of the present application is used to implement the occlusion between real objects and virtual objects based on the real occlusion relationship between real objects and virtual objects in the AR scene. However, the embodiment of the present application also needs to meet the following conditions: first, the real objects in the AR scene must be set in advance, and for each real object in the AR scene, a corresponding virtual model invisible in the AR scene needs to be created by rendering. The depth value of each third pixel point on the virtual model can be set when rendering the virtual model; secondly, after the AR scene is generated, that is, after the virtual objects therein are rendered, the real objects and virtual objects therein can no longer change or move. Once the real objects and virtual objects therein move or change, the occlusion relationship between the real objects and the virtual objects will be wrong; finally, after the AR scene is generated, the virtual objects or part of the virtual objects in the AR scene that are occluded have their material attribute values ​​assigned to transparent attribute values. When rendered and presented in the AR scene, the texture of the occluded object, such as metallicity or roughness, cannot be presented.

[0086] The following Figure 1 Taking this as an example, the solution provided in the embodiment of the present application is described in detail.

[0087] The embodiment of the present application is to generate Figure 1 The AR scene shown in FIG. 1 has an observation point of Figure 1 The AR scene includes real objects such as partition walls and chairs, and virtual objects such as wardrobes and TV cabinets.

[0088] The first step is to draw a corresponding virtual model in the AR scene for real objects such as partition walls and chairs in the pre-generated AR scene, so that the drawn virtual model is invisible in the AR scene and a depth value is set for each third pixel point on the virtual model.

[0089] In this step, drawing is achieved using a multi-channel rendering method.

[0090] Figure 3 The present invention is a schematic diagram of a process of drawing a corresponding virtual model in the AR scene for a real object in the AR scene in an embodiment of the present application, wherein the specific process includes: creating a virtual model for the real object; importing the virtual model into the AR scene by rendering; and making the virtual model invisible in the AR scene by rendering.

[0091] When the virtual model is imported into the AR scene by rendering and its invisibility is achieved, specifically including:

[0092] The main rendering channel of the virtual model is not rendered in the AR scene, so that the virtual model is invisible in the AR scene; the depth rendering channel of the virtual model is not rendered in the AR scene, and the custom depth rendering channel is rendered to set the depth value of the third pixel. In other words, by rendering the custom depth rendering channel of the virtual model, the depth value of each third pixel can be set.

[0093] The second step is to determine which object or part of the object is the occluded object by comparing the depth values ​​between the real object and the virtual object in the AR scene, and set the material attribute value of the occluded object as the transparent attribute value.

[0094] like Figure 4 As shown, Figure 4 A flowchart of a method for determining an obstructed object and setting a material attribute value of the obstructed object provided in an embodiment of the present application, wherein the specific steps include:

[0095] Step 401: Determine the position information of a second pixel point of the virtual object;

[0096] In this step, the virtual object is a wardrobe or a TV cabinet, and the position information of the second pixel point of the virtual object is represented by three-dimensional texture (UV) coordinates in the AR scene;

[0097] Step 402: Acquire depth information of a second pixel point based on position information of the second pixel point of the virtual object;

[0098] In this step, the virtual objects are presented in the AR scene by rendering, and the depth values ​​of the second pixels on the virtual objects are cached in the depth buffer of the depth rendering channel (used when rendering the depth rendering channel) corresponding to the position information of the second pixels. The depth information of the second pixels can be extracted by using the UV acquisition command.

[0099] Step 403: Determine the position information of the first pixel point of the real object;

[0100] Step 404: acquiring depth information of the first pixel point based on the position information of the first pixel point of the real object;

[0101] In this step, there is an occlusion relationship between the first pixel and the second pixel in step 401, and the depth information of the first pixel is determined based on the depth information of the corresponding third pixel (with the same position information as the first pixel) on the virtual model;

[0102] In this step, when determining the depth information of the corresponding third pixel on the virtual model, since the virtual model is rendered in the AR scene, the depth values ​​of the third pixels on the virtual object will be cached in the custom depth buffer in the custom depth rendering channel (used when rendering the custom depth rendering channel) corresponding to the position information of the third pixels, so the depth information of the third pixel on the virtual model can be extracted by using the UV acquisition command;

[0103] Step 405: determine whether the depth value of the second pixel is greater than the depth value of the first pixel. If so, execute step 406; if less than or equal to, execute step 407;

[0104] Step 406: Set the transparency value in the material attribute value of the second pixel point to 0;

[0105] In this step, setting the material attribute value of the second pixel point to 0 means: setting the material attribute value of the second pixel point to a transparent attribute;

[0106] Step 407: Set the transparency value in the material attribute value of the second pixel point to 1;

[0107] In this step, setting the material attribute value of the second pixel point to 1 means: setting the material attribute value of the second pixel point to a non-transparent attribute.

[0108] In this method, a color attribute value is also set for the second pixel point, and can be specifically set accordingly based on the color value of the virtual object to be set, and its color value is represented by a red, green, and blue (RGB) value. In this way, in the subsequent step of rendering the second pixel point, the color of the second pixel point can be rendered and presented.

[0109] The third step is to render the virtual object in the pre-generated AR scene based on the material attribute value of the second pixel point.

[0110] In order to present the virtual object in the final generated AR scene, it is necessary to render the second pixel points that constitute the virtual object in the pre-generated AR scene. Figure 5 As shown, Figure 5The schematic diagram of the process of rendering a virtual object in an AR scene provided for an embodiment of the present application specifically includes: rendering the main rendering channel of the virtual object in the pre-generated AR scene so that the virtual object is displayed in the generated AR scene; rendering the depth rendering channel of the virtual object in the pre-generated AR scene to determine the depth value of the virtual object in the generated AR scene; rendering the virtual object in the pre-generated AR scene based on the material attribute values ​​of each second pixel point on the virtual object so that in the generated AR scene, the occluded part of the virtual object has a material with occluding ability and the occluded part has a transparent material. Furthermore, in the pre-generated AR scene, the virtual object is rendered based on the color attribute values ​​of each second pixel point on the virtual object so that in the generated AR scene, the occluded part of the virtual object has a color value.

[0111] In one embodiment of the present application, a system for generating an AR scene that presents the real occlusion relationship of objects is also provided. Figure 6 A schematic diagram of the structure of a system for generating an AR scene presenting a real occlusion relationship of an object provided in an embodiment of the present application includes: a determination unit, a depth value acquisition unit, a determination setting unit and a rendering unit, wherein:

[0112] A determination unit, configured to, in a pre-generated AR scene, use a plurality of rays with an observation point as endpoints as a plurality of visual rays, and for each visual ray, in response to an intersection between the visual ray and a real object, use the intersection between the visual ray and the real object as a first pixel point of the real object; and in response to an intersection between the visual ray and the virtual object, use the intersection between the visual ray and the virtual object as a second pixel point;

[0113] A depth value acquisition unit, configured to acquire a depth value of the first pixel and a depth value of the second pixel located on the same visual ray, wherein the depth value of the first pixel is the distance between the observation point and the first pixel, and the depth value of the second pixel is the distance between the observation point and the second pixel;

[0114] a determination and setting unit, configured to determine a real occlusion relationship between the first pixel and the second pixel according to the depth value of the first pixel and the depth value of the second pixel, and to set a material attribute value of the second pixel according to the real occlusion relationship;

[0115] A rendering unit is used to render the virtual object in a pre-generated AR scene based on the material attribute value of the second pixel point to generate an AR scene.

[0116] In the system, the determination unit is also used to determine that the intersection point of the visual ray with the real object is an intersection point between the surface of the real object and the visual ray, and is closest to the observation point; and the intersection point of the visual ray with the virtual object is an intersection point between the surface of the virtual object and the visual ray, and is closest to the observation point.

[0117] In the system, the determination and setting unit is also used to set a virtual model for the real object, and import the virtual model into a pre-generated AR scene by rendering; based on the imported virtual model, the depth value of the third pixel point is determined, and the third pixel point of the virtual model is the intersection point of each visual ray and the virtual model; the determined depth value of the third pixel point is used as the depth value of the corresponding first pixel point on the real object, wherein the depth value of the third pixel point is the distance between the observation point and the third pixel point.

[0118] In the system, the determination and setting unit is also used for importing the virtual model into the pre-generated AR scene by rendering, including: not rendering the main rendering channel of the virtual model in the pre-generated AR scene to make the virtual model invisible in the generated AR scene; not rendering the depth rendering channel of the virtual model in the pre-generated AR scene, and rendering a custom depth rendering channel to set the depth value of the third pixel.

[0119] In the system, the rendering unit is also used to render the virtual object in a pre-generated AR scene, and also includes: rendering a main rendering channel of the virtual object in the pre-generated AR scene so that the virtual object is displayed in the generated AR scene; rendering a depth rendering channel of the virtual object in the pre-generated AR scene to present the depth value of the virtual object in the pre-generated AR scene.

[0120] In this system, the determination setting unit is also used to compare the depth value of the second pixel point with the depth value of the first pixel point. If the depth value of the second pixel point is greater than the depth value of the first pixel point, the material attribute value of the second pixel point is set to a transparent attribute value; if the depth value of the second pixel point is less than or equal to the depth value of the first pixel point, the material attribute value of the second pixel point is set to a non-transparent attribute value.

[0121] In the system, the determination setting unit is further used to set the color attribute value of the second pixel;

[0122] The rendering unit is further configured to render the virtual object in the pre-generated AR scene based on the color attribute value of the second pixel.

[0123] In another embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory storing a program, wherein the program is configured to implement any of the above-described methods for generating an AR scene that presents a real occlusion relationship between objects when executed by the processor.

[0124] In another embodiment of the present application, a non-transitory computer-readable storage medium is provided, wherein the non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, cause the processor to execute a method for generating an AR scene that presents a real occlusion relationship between objects in the aforementioned embodiment. Figure 7 A schematic diagram of an electronic device provided by another embodiment of the present application. Figure 7 As shown, another embodiment of the present application further provides an electronic device, which may include a processor 701, wherein the processor 701 is used to execute the steps of the above-mentioned method for generating an AR scene that presents a real occlusion relationship between objects. Figure 7 It can also be seen that the electronic device provided in the above embodiment also includes a non-transitory computer-readable storage medium 702, on which a computer program is stored. When the computer program is executed by the processor 701, the steps of the above-mentioned method for generating an AR scene that presents the real occlusion relationship of objects are executed.

[0125] Specifically, the non-transitory computer-readable storage medium 702 can be a general storage medium, such as a mobile disk, a hard disk, FLASH, a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), or a portable compact disk read-only memory (CD-ROM), etc. When the computer program on the non-transitory computer-readable storage medium 702 is executed by the processor 701, it can trigger the processor 701 to execute the above-mentioned steps of a method for generating an AR scene that presents the real occlusion relationship of objects.

[0126] In practical applications, the non-transitory computer-readable storage medium 702 may be included in the device / apparatus / system described in the above embodiment, or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, each step in the above method for generating an AR scene that presents a real occlusion relationship of an object can be executed.

[0127] Yet another embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the various steps in the above-mentioned method for generating an AR scene that presents a real occlusion relationship between objects.

[0128] The flow chart and block diagram in the accompanying drawings of the present application show the possible architecture, function and operation of the system, method and computer program product according to the various embodiments disclosed in the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in the order of the standards in different figures. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0129] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present application. In particular, without departing from the spirit and teachings of the present application, the features described in the various embodiments and / or claims of the present application may be combined and / or combined in a variety of ways, and all of these combinations and / or combinations fall within the scope disclosed in the present application.

[0130] Specific embodiments are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application, and is not used to limit the present application. For those skilled in the art, changes can be made in the specific implementation methods and application scopes according to the ideas, spirits and principles of the present application, and any modifications, equivalent substitutions, improvements, etc. made by them should be included in the scope of protection of the present application.

Claims

1. A method for generating an augmented reality scene that presents the real occlusion relationship of objects, It is characterized in that The method comprises: In a pre-generated augmented reality scene, a plurality of rays with an observation point as endpoints are used as a plurality of visual rays. For each visual ray, in response to an intersection between the visual ray and a real object, the intersection between the visual ray and the real object is used as a first pixel point of the real object; in response to an intersection between the visual ray and a virtual object, the intersection between the visual ray and the virtual object is used as a second pixel point; Obtaining a depth value of the first pixel and a depth value of the second pixel located on the same visual ray, wherein the depth value of the first pixel is the distance between the observation point and the first pixel, and the depth value of the second pixel is the distance between the observation point and the second pixel; Determining a real occlusion relationship between the first pixel and the second pixel according to the depth value of the first pixel and the depth value of the second pixel, and setting a material attribute value of the second pixel according to the real occlusion relationship; Based on the material attribute value of the second pixel point, the virtual object is rendered in a pre-generated augmented reality scene to generate an augmented reality scene.

2. The method according to claim 1, It is characterized in that The intersection point of the visual ray and the real object is an intersection point between the surface of the real object and the visual ray, and is closest to the observation point; The intersection point of the visual ray and the virtual object is an intersection point between the surface of the virtual object and the visual ray, and is closest to the observation point.

3. The method according to claim 1, It is characterized in that The determining a real occlusion relationship between the first pixel and the second pixel, and setting a material attribute value of the second pixel according to the real occlusion relationship comprises: The depth value of the second pixel is compared with the depth value of the first pixel. If the depth value of the second pixel is greater than the depth value of the first pixel, the material attribute value of the second pixel is set to a transparent attribute value. If the depth value of the second pixel is less than or equal to the depth value of the first pixel, the material attribute value of the second pixel is set to a non-transparent attribute value.

4. The method according to claim 1, It is characterized in that The obtaining the depth value of the first pixel includes: Setting a virtual model for the real object, and importing the virtual model into a pre-generated augmented reality scene to determine position information of the virtual model in the augmented reality scene; Based on the imported position information of the virtual model in the augmented reality scene, a rendering method is adopted, an intersection point of the visual ray and the virtual model is used as a third pixel point of the virtual model, a depth value of the third pixel point is calculated, and the third pixel point of the virtual model is used as a first pixel point corresponding to the real object; The calculated depth value of the third pixel is used as the depth value of the first pixel corresponding to the real object, wherein the depth value of the third pixel is the distance between the observation point and the third pixel.

5. The method according to claim 4, It is characterized in that The rendering method is adopted, and the intersection point of the visual ray and the virtual model is used as the third pixel point of the virtual model, and the depth value of the third pixel point is calculated and obtained, including: Not rendering a main rendering pass of the virtual model in the pre-generated augmented reality scene, so that the virtual model is invisible in the generated augmented reality scene; In the pre-generated augmented reality scene, the depth rendering channel of the virtual model is not rendered, and a custom depth rendering channel is rendered, and the intersection of the visual ray and the virtual model is used as the third pixel point of the virtual model to calculate the depth value of the third pixel point.

6. The method according to claim 1, It is characterized in that When rendering the virtual object in the pre-generated augmented reality scene, the method further includes: Rendering a main rendering pass of the virtual object in a pre-generated augmented reality scene so that the virtual object is displayed in the generated AR scene; A depth rendering channel of the virtual object is rendered in the pre-generated augmented reality scene to present the depth of the virtual object in the pre-generated augmented reality scene.

7. The method according to claim 1, It is characterized in that The method further comprises: Setting the color attribute value of the second pixel; When rendering the virtual object in the pre-generated augmented reality scene, it is also based on the color attribute value of the second pixel point.

8. An electronic device, It is characterized in that include: processor; A memory storing a program, wherein the program is configured to implement the method for generating an AR scene presenting a real occlusion relationship of objects as described in any one of claims 1 to 7 when executed by the processor.

9. A non-transitory computer-readable storage medium storing instructions, It is characterized in that When the instructions are executed by a processor, the processor executes the steps of the method for generating an augmented reality scene presenting a real occlusion relationship of objects as described in any one of claims 1 to 7.

10. A computer program product comprising a computer program or instructions, It is characterized in that When the computer program or instruction is executed by a processor, the steps of the method for generating an augmented reality scene presenting the real occlusion relationship of objects as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Virtual-real occlusion real-time processing method based on multi-view image

    CN106803286A

  • AR portrait photographing method and system based on 3D positioning information

    CN113643357A

  • Systems and methods for augmented reality applications

    US20200380790A1

  • Real-time virtual viewpoint in simulated reality environment

    WO2002069272A2