Method and device for displaying three-dimensional entity on two-dimensional interactive interface
By building a virtual portal on a two-dimensional interactive interface and truncating the three-dimensional entity into foreground and background entities for splicing, the problem that three-dimensional objects cannot break through the virtual portal is solved, and the three-dimensional objects are realized through the display of three-dimensional objects between virtual and real spaces is improved. User experience.
Patent Information
- Application Number
- CN202411291929.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-13
AI Technical Summary
In the prior art, three-dimensional objects cannot break through the two-dimensional space in the virtual portal, and cannot be displayed throughout the virtual portal and real space, affecting the user experience.
Build a virtual portal on a two-dimensional interactive interface, truncate the three-dimensional entity into foreground and background entities through the virtual portal, and splice it to display from the virtual space to the spatial scene, and adjust the display depth and position using the rendered view and attribute components , ensure the reasonable display of three-dimensional entities from different perspectives.
The three-dimensional object image breaks through the virtual portal, and the visual effect of running through the spatial scenes is improved, and the user experience is improved, allowing the display range of three-dimensional entities in some areas in the virtual space and real space exceeds the display range of the virtual portal.
Smart Images

Figure CN119127379A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for displaying a three-dimensional entity on a two-dimensional interactive interface. Background Art
[0002] With the development of computer technology, virtual reality and augmented reality technologies are being used more and more. Augmented reality technology can simultaneously display the real space and the virtual portal superimposed on the real space, and enter a specific application virtual space through the virtual portal.
[0003] A virtual portal is a two-dimensional view on a two-dimensional interactive interface. In different application scenarios, the virtual portal can be used to display two-dimensional object images or three-dimensional object images; however, in the existing methods for displaying images in a virtual portal, the three-dimensional object image can only be displayed in the two-dimensional view of the virtual portal and cannot break through the two-dimensional space of the virtual portal; therefore, there is currently a lack of methods for breaking the three-dimensional object image through the two-dimensional view and achieving the visual effect of displaying part of the three-dimensional object in the virtual portal and part of it in the real space, which affects the user's application experience. Summary of the invention
[0004] In view of this, the embodiments of the present invention provide a method and device for displaying a three-dimensional entity on a two-dimensional interactive interface, which can construct a virtual portal on the two-dimensional interactive interface in a spatial scene, obtain the three-dimensional entity of the object to be displayed; make the front-end perspective of the two-dimensional interactive interface display the three-dimensional entity from the virtual space through the virtual portal to the spatial scene; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity. The embodiments of the present invention overcome the problem that the three-dimensional object cannot break through the virtual portal in the existing method, achieve the visual effect that the three-dimensional object image breaks through the virtual portal and penetrates into the spatial scene, and improve the user experience.
[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a method for displaying a three-dimensional entity on a two-dimensional interactive interface is provided, characterized in that it includes: constructing a virtual portal on the two-dimensional interactive interface in a spatial scene; wherein the virtual portal is the entrance between the spatial scene and the virtual space; obtaining the three-dimensional entity of the object to be displayed; the front-end perspective of the two-dimensional interactive interface displays the three-dimensional entity, and the three-dimensional entity penetrates from the virtual space through the virtual portal to the spatial scene; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity.
[0006] Optionally, after obtaining the three-dimensional entity of the object to be displayed, it further includes: cutting the three-dimensional entity into a foreground three-dimensional entity and a background three-dimensional entity with the virtual portal as a section, so that the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal; splicing the foreground three-dimensional entity and the background three-dimensional entity so that the displayed three-dimensional entity passes through the virtual portal from the virtual space to the spatial scene.
[0007] Optionally, the display of the three-dimensional entity from the virtual space through the virtual portal to the spatial scene further includes: the display range of the area in the virtual space displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal; and / or, the display range of the area in the spatial scene displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal.
[0008] Optionally, after constructing the virtual portal on the two-dimensional interactive interface in the spatial scene, it further includes: constructing a rendering view of the virtual portal, and setting the rendering view on the upper layer of the two-dimensional interactive interface; using the rendering view to load the foreground three-dimensional entity and the background three-dimensional entity, and rendering the background three-dimensional entity and the foreground three-dimensional entity in accordance with the rendering layer order; wherein the foreground three-dimensional entity is set at the topmost layer of the rendering layer.
[0009] Optionally, the method of displaying the foreground three-dimensional entity in the spatial scene outside the virtual portal and the background three-dimensional entity in the virtual space inside the virtual portal includes: obtaining a position offset of the background three-dimensional entity; calculating a distance value between the background three-dimensional entity and a cross-section of the two-dimensional interactive interface based on the position offset, and using the distance value as the display depth; determining a display position based on the display depth, and displaying the background three-dimensional entity and the foreground three-dimensional entity based on the display position, so that the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal.
[0010] Optionally, after taking the distance value as the display depth, it further includes: adjusting the display depth to generate a target display depth according to the display position of the foreground three-dimensional entity; wherein the display position is the position where the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal; and adjusting the original display positions of the background three-dimensional entity and the foreground three-dimensional entity according to the target display depth.
[0011] Optionally, the method for displaying a three-dimensional entity on a two-dimensional interactive interface further includes: configuring corresponding attribute data for multiple components on the server side, wherein the components include a two-dimensional interactive interface, a rendering view, a foreground three-dimensional entity, a background three-dimensional entity, a three-dimensional entity attribute component, and a custom component; when constructing any one of the multiple components, obtaining the attribute data corresponding to the component from the server side.
[0012] Optionally, configuring corresponding attribute data for multiple components on the server side includes: when configuring attribute data for foreground three-dimensional entities and background three-dimensional entities, configuring the reflective attributes in the attribute data of the foreground three-dimensional entities and the background three-dimensional entities to be disabled so that the display tones of the foreground three-dimensional entities and the background three-dimensional entities are consistent.
[0013] To achieve the above object, according to a second aspect of an embodiment of the present invention, a device for displaying a three-dimensional entity on a two-dimensional interactive interface is provided, comprising: a component building module, an entity acquisition module and a display module; wherein:
[0014] The construction component module is used to construct a virtual portal on a two-dimensional interactive interface in the space scene; wherein the virtual portal is the entrance between the space scene and the virtual space;
[0015] The entity acquisition module is used to acquire the three-dimensional entity of the object to be displayed;
[0016] The display module is used for displaying the three-dimensional entity at the front-end perspective of the two-dimensional interactive interface, and the three-dimensional entity penetrates from the virtual space through the virtual portal into the space scene; the three-dimensional entity is not displayed at the back-end perspective of the two-dimensional interactive interface.
[0017] Optionally, the device for displaying a three-dimensional entity on a two-dimensional interactive interface, after obtaining the three-dimensional entity of the object to be displayed, further includes: cutting the three-dimensional entity into a foreground three-dimensional entity and a background three-dimensional entity with a virtual portal as a section, so that the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal; splicing the foreground three-dimensional entity and the background three-dimensional entity so that the displayed three-dimensional entity passes through the virtual portal from the virtual space to the spatial scene.
[0018] Optionally, a device for displaying a three-dimensional entity on a two-dimensional interactive interface, used to show that the three-dimensional entity extends from the virtual space through the virtual portal to the spatial scene, further includes: the display range of the area in the virtual space displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal; and / or, the display range of the area in the spatial scene displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal.
[0019] Optionally, the device for displaying three-dimensional entities on a two-dimensional interactive interface is used to construct a virtual portal on the two-dimensional interactive interface in a spatial scene, and further includes: constructing a rendering view of the virtual portal, and setting the rendering view on the upper layer of the two-dimensional interactive interface; using the rendering view to load the foreground three-dimensional entity and the background three-dimensional entity, and rendering the background three-dimensional entity and the foreground three-dimensional entity in accordance with the rendering layer order; wherein the foreground three-dimensional entity is set at the topmost layer of the rendering layer.
[0020] Optionally, a device for displaying a three-dimensional entity on a two-dimensional interactive interface is used to display the foreground three-dimensional entity in the spatial scene outside the virtual portal and the background three-dimensional entity in the virtual space inside the virtual portal, comprising: obtaining a position offset of the background three-dimensional entity; calculating a distance value between the background three-dimensional entity and a cross-section of the two-dimensional interactive interface based on the position offset, and using the distance value as the display depth; determining a display position based on the display depth, and displaying the background three-dimensional entity and the foreground three-dimensional entity based on the display position, so that the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal and the background three-dimensional entity is displayed in the virtual space inside the virtual portal.
[0021] Optionally, the device for displaying a three-dimensional entity on a two-dimensional interactive interface is used to, after using the distance value as the display depth, further include: adjusting the display depth to generate a target display depth according to the display position of the foreground three-dimensional entity; wherein the display position is the position where the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal; and adjusting the original display positions of the background three-dimensional entity and the foreground three-dimensional entity according to the target display depth.
[0022] Optionally, the device for displaying a three-dimensional entity on a two-dimensional interactive interface is further used to configure corresponding attribute data for multiple components on the server side, wherein the components include a two-dimensional interactive interface, a rendering view, a foreground three-dimensional entity, a background three-dimensional entity, a three-dimensional entity attribute component, and a custom component; when constructing any one of the multiple components, the attribute data corresponding to the component is obtained from the server side.
[0023] Optionally, a device for displaying three-dimensional entities on a two-dimensional interactive interface is used to configure corresponding attribute data for multiple components on the server side, including: when configuring attribute data for foreground three-dimensional entities and background three-dimensional entities, configuring the reflective attributes in the attribute data of the foreground three-dimensional entities and the background three-dimensional entities to be disabled so that the display tones of the foreground three-dimensional entities and the background three-dimensional entities are consistent.
[0024] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided an electronic device for displaying a three-dimensional entity on a two-dimensional interactive interface, characterized in that it comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described above for displaying a three-dimensional entity on a two-dimensional interactive interface.
[0025] To achieve the above-mentioned purpose, according to the fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any method described in the above-mentioned method of displaying a three-dimensional entity on a two-dimensional interactive interface is implemented.
[0026] To achieve the above-mentioned purpose, according to the fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, characterized in that when the computer program is executed by a processor, any of the methods described above for displaying a three-dimensional entity on a two-dimensional interactive interface is implemented.
[0027] An embodiment of the above invention has the following advantages or beneficial effects: it is possible to construct a virtual portal on a two-dimensional interactive interface in a spatial scene to obtain a three-dimensional entity of an object to be displayed; the front-end perspective of the two-dimensional interactive interface displays the three-dimensional entity from the virtual space through the virtual portal to the spatial scene; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity. The embodiment of the present invention overcomes the problem that three-dimensional objects cannot break through the virtual portal in the existing method, achieves the visual effect that the three-dimensional object image breaks through the virtual portal to penetrate into the spatial scene, and improves the user experience.
[0028] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0030] Figure 1 It is a flowchart of a method for displaying a three-dimensional entity on a two-dimensional interactive interface provided by an embodiment of the present invention;
[0031] FIG2A is an example diagram of displaying a three-dimensional entity in a virtual portal from a front-end perspective corresponding to a two-dimensional interactive interface provided by an embodiment of the present invention;
[0032] FIG2B is a schematic diagram of displaying a three-dimensional entity on a two-dimensional interactive interface provided by an embodiment of the present invention;
[0033] Figure 3 is a schematic diagram of the structure of a virtual portal provided by an embodiment of the present invention;
[0034] Figure 4 It is a structural schematic diagram of a device for displaying a three-dimensional entity on a two-dimensional interactive interface provided by an embodiment of the present invention;
[0035] FIG5 is a diagram of an exemplary system architecture in which an embodiment of the present invention may be applied;
[0036] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0037] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0038] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0039] like Figure 1 As shown, an embodiment of the present invention provides a method for displaying a three-dimensional entity on a two-dimensional interactive interface, and the method may include the following steps:
[0040] Step S101: constructing a virtual portal on a two-dimensional interactive interface in a space scene; wherein the virtual portal is an entrance between the space scene and the virtual space.
[0041] Specifically, in the application scenarios of virtual reality and augmented reality, there are usually different spatial scenes, which can be real spatial scenes or virtual spatial scenes; a virtual portal is constructed on a two-dimensional interactive interface in the spatial scene, so that the virtual portal becomes the entrance between the spatial scene and the virtual space. For example: a user can see all objects inside the office (i.e., the real spatial scene) or the scene of a virtual office through an augmented reality device in the office, and at the same time see multiple virtual portals constructed on a two-dimensional interactive interface displayed in the spatial scene, for example, the virtual portal displays an application icon or an introduction to an object to prompt the user to go through the virtual space corresponding to the virtual portal, for example: virtual portal A displays the image of item A, then virtual portal A corresponds to the virtual space with the details of item A; for another example: using virtual portal B to directly display the virtual space of a furniture display venue or a three-dimensional venue.
[0042] Furthermore, the virtual portal is a two-dimensional view. In the existing method, the image displayed in the virtual portal can be a three-dimensional image. However, the three-dimensional image cannot break through the limitation of the two-dimensional view of the virtual portal when displayed. In the embodiment of the present invention, the method of steps S101 to S103 overcomes the problem that the three-dimensional entity cannot break through the limitation of the two-dimensional view of the virtual portal when displayed.
[0043] Below through Figure 2A Schematic diagram of Figure 2A FIG. 1 shows a schematic diagram of a virtual portal and a three-dimensional entity display corresponding to a front-end perspective of a two-dimensional interactive interface according to an embodiment of the present invention; Figure 2A As shown in the figure, the black background area of the "Leisure Living Room" represents a virtual portal built on a two-dimensional interactive interface. The space of the "Leisure Living Room" contains three-dimensional entities such as sofas, tables, chairs, and carpets; among them, part of the three-dimensional entity of the carpet (as well as the round coffee table and chairs) is displayed in the virtual space, and part is displayed in the space scene (such as Figure 2A The real space scene shown includes a rectangular coffee table, green plants, paper, etc.), thereby achieving the visual effect of three-dimensional entities such as carpets (as well as round coffee tables, chairs) penetrating from the virtual space of the virtual portal through the virtual portal into the space scene, thereby achieving a "broken window" effect of three-dimensional entities penetrating from the virtual space of the virtual portal to the space scene (real space scene), greatly improving the visual experience.
[0044] Specifically, the embodiment of the present invention constructs a virtual portal in a two-dimensional interactive interface in a spatial scene, wherein the virtual portal can be a two-dimensional view (2Dview); further, a three-dimensional entity of an object to be displayed in the virtual portal is constructed; wherein the object to be displayed can be one object or a collection of multiple objects, and the object to be displayed is a three-dimensional object. The embodiment of the present invention uses two three-dimensional entities (foreground three-dimensional entity frontentity and background three-dimensional entity rootentity) to merge with the two-dimensional portal view to achieve a "broken window" effect of the three-dimensional entity running through the virtual portal. From the front-end perspective of the two-dimensional interactive interface, part of the three-dimensional entity is in the spatial scene and part is in the virtual space. From the side of the two-dimensional interactive interface, part of the three-dimensional entity is in the spatial scene. From the back-end perspective of the two-dimensional interactive interface, the three-dimensional entity is invisible; that is, the front-end perspective of the two-dimensional interactive interface displays the three-dimensional entity, and the three-dimensional entity runs through the virtual space through the virtual portal to the spatial scene; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity. The embodiment of the present invention achieves breaking through the two-dimensional virtual portal when displaying the three-dimensional entity, and the displayed three-dimensional entity has different forms at different perspectives, which improves the visual effect of displaying the three-dimensional entity on the two-dimensional interactive interface and improves the user experience.
[0045] Step S102: Acquire the three-dimensional entity of the object to be displayed.
[0046] Step S103: The front-end perspective of the two-dimensional interactive interface displays the three-dimensional entity, and the three-dimensional entity penetrates from the virtual space through the virtual portal into the space scene; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity.
[0047] Specifically, step S102 to step S103 describe a method for displaying a three-dimensional entity of an object to be displayed on a two-dimensional interactive interface and showing that the three-dimensional entity penetrates from the virtual space into the space scene through a virtual portal in an embodiment of the present invention.
[0048] Specifically, the method of displaying a three-dimensional entity from a virtual space through a virtual portal into a space scene includes the following two methods:
[0049] The first method: after obtaining the three-dimensional entity of the object to be displayed, it further includes: cutting the three-dimensional entity into a foreground three-dimensional entity and a background three-dimensional entity with a virtual portal as a section, so that the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal; splicing the foreground three-dimensional entity and the background three-dimensional entity so that the displayed three-dimensional entity passes through the virtual portal from the virtual space to the spatial scene.
[0050] Specifically, the following Figure 2B The structural diagram of Figure 2B As shown, it shows a virtual portal 201 (built on a two-dimensional interactive interface, assuming it is a virtual portal of a living room), and the three-dimensional entities of the objects to be displayed (carpet, furniture A, furniture B). Taking the carpet as an example, the three-dimensional entity (carpet) is cut into a foreground three-dimensional entity 203 and a background three-dimensional entity 202 using the virtual portal 201 as a section (represented by a dotted line). Similarly, the three-dimensional entities corresponding to furniture A and furniture B are also cut into a foreground three-dimensional entity and a background three-dimensional entity using the virtual portal as a section (represented by a dotted line). Figure 2B As shown, the foreground three-dimensional entities of the carpet, furniture A, and furniture B are displayed in the spatial scene outside the virtual portal, and the background three-dimensional entities are displayed in the virtual space inside the virtual portal, so that the displayed three-dimensional entities (carpet, furniture A, furniture B) pass through the virtual portal from the virtual space to the spatial scene.
[0051] Thereby, the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal; the foreground three-dimensional entity and the background three-dimensional entity are spliced so that the displayed three-dimensional entity passes through the virtual space from the virtual space to the spatial scene through the virtual portal.
[0052] The second method is: construct two three-dimensional entities for the object to be displayed, namely the foreground three-dimensional entity and the background three-dimensional entity; perform truncation processing on the foreground three-dimensional entity and the background three-dimensional entity respectively with the virtual portal as the section, and fuse the part of the foreground three-dimensional entity and the part of the background three-dimensional entity obtained after the truncation processing to obtain the overall fused three-dimensional result of the object to be displayed. Specifically, since the foreground three-dimensional entity and the background three-dimensional entity have the same model parameters, the foreground three-dimensional entity and the background three-dimensional entity can be truncated and spliced respectively according to the position and display part of the background three-dimensional entity display; specifically, obtain the vertex data of each vertex of the three-dimensional model of the background three-dimensional entity and the position offset of the background three-dimensional entity; synchronize the vertex data of each vertex of the three-dimensional model of the background three-dimensional entity and the position offset of the background three-dimensional entity to the foreground three-dimensional entity; so that the foreground three-dimensional entity and the background three-dimensional entity have the same three-dimensional model attribute data. Furthermore, based on the virtual portal as a section, the foreground three-dimensional entity and the background three-dimensional entity are truncated respectively, the front half of the foreground three-dimensional entity and the back half of the background three-dimensional entity are retained, and then the retained parts are spliced to form a complete visual model; the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal; the foreground three-dimensional entity and the background three-dimensional entity are spliced so that the displayed three-dimensional entity passes through the virtual space from the virtual space to the spatial scene through the virtual portal.
[0053] It is understandable that a 3D entity corresponds to a 3D model, and the 3D model can be a model mesh, which is composed of triangular faces, and each triangular face is composed of 3 vertices. The 3D model at least enables the shape, size, position, etc. of the object to be displayed. That is, the vertex data of each vertex of the 3D model of the background 3D entity and the position offset of the background 3D entity are obtained.
[0054] In an embodiment of the present invention, multiple attribute components are bound to the background 3D entity, such as PortalComponent and worldComponent. PortalComponent is used to set the 3D entity as a component leading to different spaces. WorldComponent is a component that defines space. This component separates the 3D entity and its descendants from the space scene (such as the real space scene or the virtual space scene), so that the 3D entity can only be seen through the virtual portal. Through different attribute components, the attribute data of the background 3D entity can be flexibly configured.
[0055] Furthermore, in an embodiment of the present invention, the background 3D entity is used as the part displayed inside the virtual portal, and the foreground 3D entity is used as the part displayed outside the virtual portal (in real space); therefore, the vertex data of each vertex of the 3D model of the background 3D entity and the position offset of the background 3D entity are synchronized to the foreground 3D entity; so that the foreground 3D entity and the background 3D entity have the same 3D model attribute data. The model attribute data includes size, position offset, vertex data, etc.
[0056] The embodiment of the present invention uses the two-dimensional view of the virtual portal and the fusion of two three-dimensional entities to enable the front-end perspective of the two-dimensional interactive interface to display the three-dimensional entity from the virtual space through the virtual portal to the spatial scene; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity.
[0057] Further, preferably, the display of the three-dimensional entity from the virtual space through the virtual portal to the spatial scene in the embodiment of the present invention further includes: the display range of the area in the virtual space displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal; and / or, the display range of the area in the spatial scene displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal. For example: the three-dimensional entity of the object to be displayed is an irregular three-dimensional entity, the part of the foreground three-dimensional entity is large in volume and the background three-dimensional entity is small, and the display range of the area in the spatial scene displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal, that is, there is a breakthrough in the virtual portal and the spatial scene is displayed within the display range that matches its volume; similarly, for the background three-dimensional entity, the display range of the area in the virtual space displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal. The visual effect of the three-dimensional entity penetrating from the virtual space through the virtual portal to the spatial scene is improved.
[0058] Furthermore, in an embodiment of the present invention, the method for displaying background three-dimensional entities and foreground three-dimensional entities includes: after constructing a virtual portal on a two-dimensional interactive interface in a spatial scene, further including: constructing a rendering view of the virtual portal, and setting the rendering view on the upper layer of the two-dimensional interactive interface; using the rendering view to load the foreground three-dimensional entity and the background three-dimensional entity, and rendering the background three-dimensional entity and the foreground three-dimensional entity in the order of the rendering layers; wherein the foreground three-dimensional entity is set at the top layer of the rendering layer. Figure 3 The description is consistent with that of , and will not be repeated here.
[0059] Further, in an embodiment of the present invention, in order to achieve a visual effect of three-dimensional entity penetration display, when displaying the background three-dimensional entity and the foreground three-dimensional entity, the display position (display position) is first calculated, that is, the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal and the background three-dimensional entity is displayed in the virtual space inside the virtual portal, including: obtaining the position offset of the background three-dimensional entity; calculating the distance value between the background three-dimensional entity and the cross section of the two-dimensional interactive interface according to the position offset, and using the distance value as the display depth; determining the display position according to the display depth, and displaying the background three-dimensional entity and the foreground three-dimensional entity based on the display position, so that the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal. Specifically, since the foreground three-dimensional entity and the background three-dimensional entity have fusion linkage, the display position of the fused three-dimensional entity is determined by calculating the display position of the background three-dimensional entity.
[0060] Furthermore, the display position can be adjusted, that is, after taking the distance value as the display depth, further comprising: adjusting the display depth to generate a target display depth according to the display position of the foreground three-dimensional entity; wherein the display position is the position of the foreground three-dimensional entity displayed in the spatial scene outside the virtual portal; and adjusting the original display positions of the background three-dimensional entity and the foreground three-dimensional entity according to the target display depth. Specifically, after the display depth is calculated for the background three-dimensional entity, the display depth is further adjusted, and the basis for the adjustment is whether the foreground three-dimensional entity can be fully displayed in the spatial scene outside the virtual portal, and the positions of the background three-dimensional entity and the foreground three-dimensional entity are adjusted according to the basis to achieve the optimal display effect; for example, the adjustment method is: obtaining the display depth depth, calculating depth / 2 = depth, and moving the three-dimensional model by a distance of depth to ensure that according to the display position of the foreground three-dimensional entity, the entire entity of the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal.
[0061] In an embodiment of the present invention, steps S101 to S103 can be completed by the interaction between the server and the client, that is, corresponding attribute data is configured for various components on the server, wherein the components include a two-dimensional interactive interface, a rendering view, a foreground three-dimensional entity, a background three-dimensional entity, a three-dimensional entity attribute component, and a custom component; when the client needs to build components such as a two-dimensional interactive interface, a rendering view, a foreground three-dimensional entity, and a background three-dimensional entity, the corresponding attribute data is pulled from the server; and processing, rendering, and display steps are further performed based on the pulled attribute data, that is, when building any one of the various components, the attribute data corresponding to the component is obtained from the server.
[0062] By configuring the attribute data of various components on the server side, the flexibility of configuring the components and the efficiency of displaying the virtual portal and the objects to be displayed on the client side are improved.
[0063] Further, corresponding attribute data is configured for various components on the server side, including: when configuring attribute data for the foreground 3D entity and the background 3D entity, the reflective attribute in the attribute data of the foreground 3D entity and the background 3D entity is configured to be disabled, so that the display tone of the foreground 3D entity and the background 3D entity is consistent. In an embodiment of the present invention, since the display spaces of the foreground 3D entity and the background 3D entity are different, in order to make the display tone of the two consistent, the reflective attribute of the two is configured to be disabled, wherein the reflective attribute is an IBL (Image Base Lighting) attribute, and the reflective attribute of the two (background entity and foreground entity) is configured to be disabled by setting rootentity.iblEnable = false and frontEntity.iblEnable = false. By configuring the reflective attribute, the display effect of merging the background 3D entity and the foreground 3D entity and displaying it on the upper layer of the virtual portal is improved, and the visual effect of displaying the foreground 3D entity of the object to be displayed inside the virtual portal and displaying the foreground 3D entity of the object to be displayed in the real space scene outside the virtual portal is improved.
[0064] In the embodiment of the present invention, the foreground 3D entity and the background 3D entity can also be displayed separately by animation. In order to achieve the synchronous display of the foreground 3D entity and the background 3D entity, a method of recording the animation progress and adjusting the time by using a timer is used.
[0065] Specifically, the global variable CanPlay can be set to control whether the foreground 3D entity and the background 3D entity have been loaded. The animation can be started only after the loading is completed. Furthermore, the custom thread queue DispatchSemaphore is set to coordinate the loading process of the foreground 3D entity and the background 3D entity, and when the model of the 3D entity is initialized, the semaphore attribute semaphore is defined, so that after the loading is completed, semaphore.signal() is called to notify the semaphore, so that the loading is determined to be completed based on the two semaphore notifications to continue playing the animation; further, the semaphore.wait() method is used to wait for the semaphore notification; after the model of each entity (foreground 3D entity and background 3D entity) is loaded, semaphore.signal() will be called to reduce the semaphore count by 1. The above steps and methods are used to achieve the synchronization of the start of the animation of the foreground 3D entity and the background 3D entity.
[0066] Furthermore, multiple functions are set to perform synchronization of each frame of animation, for example: set a timer for synchronizing the screen refresh rate. CADisplayLink; set a property progress to indicate the animation progress; use CADisplayLink to synchronize the update progress; set the function startAnimation to create and start CADisplayLink to record the animation start time and the last update time; set the creation function stopAnimation to stop and destroy CADisplayLink; set the function pauseAnimation to pause CADisplayLink and record the current progress and time; set the function resumeAnimation to resume CADisplayLink and adjust startTime to keep synchronization; set the function updateAnimation to be called once per frame to calculate the animation progress and synchronize the model progress. Detect exceptions and handle them. When there is a serious resource occupation, there will be a freeze, and after the freeze, a specific compensation algorithm needs to be implemented in updateAnimation.
[0067] The updateAnimation method includes: firstly judging whether the animation playback is in a stopped state, if it is in a non-stop state, obtaining the current animation playback time, subtracting the start time from the current playback time to obtain a time difference, and then obtaining the overall duration of the animation, and detecting abnormal time states at the same time, using the current time and the final time as the difference to obtain the current frame rate FPS, if the frame numbers of the two models of the foreground 3D entity and the background 3D entity are different, analyzing that the model with a smaller FPS has animation jamming, and first obtaining the progress of the low frame rate model, and using sin(difference time / total animation time xFPS - FPS / 2)+1) / 2) to make the animation transition smoothly to improve the jamming problem, and then increasing the progress and FPS to the progress of the higher model, wherein the FPS is calculated by the formula "exp(difference time / total animation time-1) / exp(1) - 1” is obtained to achieve the two animations of the foreground 3D entity and the background 3D entity to keep synchronization in each frame; in the field of mathematics, the function exp(x) represents the natural exponential function, that is, the exponential function with the real number e (e≈2.71828) as the base. Its expression is exp(x)=e x , the characteristic of this function is that its derivative is equal to itself. The natural exponential function has a wide range of applications in calculus, probability theory, statistics and other fields. It is used to describe the process of exponential growth or decay, as well as some distributions related to probability density functions.
[0068] By making the playback animations of the foreground 3D entity and the background 3D entity consistent, the user experience is further improved, and the problem of inconsistent playback animations of different entity models (foreground 3D entity and background 3D entity) in different spaces (spatial scenes and virtual spaces) in the prior art is overcome.
[0069] like Figure 3 As shown, an embodiment of the present invention provides a schematic diagram of a structure for displaying a three-dimensional entity on a two-dimensional interactive interface, and the structure may include the following components;
[0070] Virtual portal 301; rendering view 302; foreground 3D entity 303 and background 3D entity 304. That is, after constructing the virtual portal on the two-dimensional interactive interface in the space scene, it further includes: constructing a rendering view of the virtual portal, setting the rendering view on the upper layer of the two-dimensional interactive interface; using the rendering view to load the foreground 3D entity and the background 3D entity, and performing rendering of the background 3D entity and the foreground 3D entity in sequence according to the rendering layer; wherein the foreground 3D entity is set at the uppermost layer of the rendering layer.
[0071] Specifically, an embodiment of the present invention constructs a rendering view on the upper layer of a virtual portal of a two-dimensional interactive interface, uses the rendering view to load foreground three-dimensional entities and background three-dimensional entities, and after processing the foreground three-dimensional entities and the background three-dimensional entities, uses the rendering view to render the background three-dimensional entities and foreground three-dimensional entities in the order of rendering layers; by setting the foreground three-dimensional entity at the top layer of the rendering layer, the visual effect of displaying the foreground three-dimensional entity in the spatial scene outside the virtual portal is achieved.
[0072] like Figure 4 As shown, an embodiment of the present invention provides a device 400 for displaying a three-dimensional entity on a two-dimensional interactive interface, comprising: a component building module 401, an entity acquisition module 402 and a display module 403; wherein,
[0073] The construction component module 401 is used to construct a virtual portal on a two-dimensional interactive interface in a space scene; wherein the virtual portal is an entrance between the space scene and the virtual space;
[0074] The entity acquisition module 402 is used to acquire the three-dimensional entity of the object to be displayed;
[0075] The display module 403 is used for displaying the three-dimensional entity at the front-end perspective of the two-dimensional interactive interface, and the three-dimensional entity penetrates from the virtual space through the virtual portal into the space scene; the three-dimensional entity is not displayed at the back-end perspective of the two-dimensional interactive interface.
[0076] An embodiment of the present invention also provides an electronic device for displaying a three-dimensional entity on a two-dimensional interactive interface, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.
[0077] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method provided in any of the above embodiments is implemented.
[0078] An embodiment of the present invention further provides a computer program product, including a computer program, which implements any of the above methods for displaying a three-dimensional entity on a two-dimensional interactive interface when executed by a processor.
[0079] Figure 5 An exemplary system architecture 500 is shown to which the method for displaying a three-dimensional entity on a two-dimensional interactive interface or the apparatus for displaying a three-dimensional entity on a two-dimensional interactive interface according to the embodiments of the present invention can be applied.
[0080] like Figure 5As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0081] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various client applications can be installed on terminal devices 501, 502, 503, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, and email clients.
[0082] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0083] Server 505 may be a server that provides various services, such as a background management server that provides support for client applications used by users using terminal devices 501, 502, and 503. The background management server may process the received request to pull the attribute data of the component and feed back the corresponding attribute data to the terminal device.
[0084] It should be noted that the method for displaying a three-dimensional entity on a two-dimensional interactive interface provided in an embodiment of the present invention is generally executed by terminal devices 501, 502, and 503. Accordingly, the device for displaying a three-dimensional entity on a two-dimensional interactive interface is generally arranged in terminal devices 501, 502, and 503.
[0085] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0086] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0087] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0088] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0089] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0090] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0091] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. 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 alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession 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 a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0092] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be provided in a processor, for example, they may be described as: a processor including a component building module, an entity acquisition module, and a display module. The names of these modules do not, in some cases, constitute limitations on the modules themselves, for example, the entity acquisition module may also be described as a "module for acquiring a three-dimensional entity of an object to be displayed".
[0093] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: constructing a virtual portal on a two-dimensional interactive interface in a spatial scene; wherein the virtual portal is the entrance between the spatial scene and the virtual space; obtaining a three-dimensional entity of an object to be displayed; the front-end perspective of the two-dimensional interactive interface displays the three-dimensional entity, and the three-dimensional entity passes through the virtual space from the virtual space to the spatial scene through the virtual portal; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity.
[0094] The embodiments of the present invention can construct a virtual portal on a two-dimensional interactive interface in a spatial scene, obtain a three-dimensional entity of an object to be displayed, and enable the front-end perspective of the two-dimensional interactive interface to display the virtual space through the virtual portal to the spatial scene; the back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity. The embodiments of the present invention overcome the problem that three-dimensional objects cannot break through the virtual portal in the existing method, and achieve the visual effect that the three-dimensional object image breaks through the virtual portal to penetrate into the spatial scene, thereby improving the user experience.
[0095] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for displaying a three-dimensional entity on a two-dimensional interactive interface, It is characterized in that include: Constructing a virtual portal on a two-dimensional interactive interface in a spatial scene; wherein the virtual portal is an entrance between the spatial scene and the virtual space; Obtain the three-dimensional entity of the object to be displayed; The front-end perspective of the two-dimensional interactive interface displays the three-dimensional entity, and the three-dimensional entity penetrates from the virtual space through the virtual portal to the space scene; The back-end perspective of the two-dimensional interactive interface does not display the three-dimensional entity.
2. The method according to claim 1, It is characterized in that After obtaining the three-dimensional entity of the object to be displayed, the method further includes: Cutting the three-dimensional entity into a foreground three-dimensional entity and a background three-dimensional entity using the virtual portal as a cutting plane, so that the foreground three-dimensional entity is displayed in the space scene outside the virtual portal, and the background three-dimensional entity is displayed in the virtual space inside the virtual portal; The foreground three-dimensional entity and the background three-dimensional entity are spliced so that the displayed three-dimensional entity passes through the virtual portal from the virtual space to the space scene.
3. The method according to claim 1, It is characterized in that The displaying of the three-dimensional entity from the virtual space through the virtual portal to the space scene further includes: The display range of the area of the virtual space displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal; and / or, the display range of the area of the space scene displaying the three-dimensional entity may exceed the two-dimensional display range of the virtual portal.
4. The method according to claim 2, It is characterized in that After the virtual portal is constructed on the two-dimensional interactive interface in the space scene, the method further includes: Constructing a rendering view of the virtual portal, and setting the rendering view on an upper layer of the two-dimensional interactive interface; The foreground three-dimensional entity and the background three-dimensional entity are loaded by using the rendering view, and the background three-dimensional entity and the foreground three-dimensional entity are rendered in a rendering layer order; wherein the foreground three-dimensional entity is set at the topmost layer of the rendering layer.
5. The method according to claim 2, It is characterized in that The method of making the foreground three-dimensional entity displayed in the space scene outside the virtual portal and the background three-dimensional entity displayed in the virtual space inside the virtual portal includes: Obtaining the position offset of the background three-dimensional entity; Calculating the distance value between the background three-dimensional entity and the cross section of the two-dimensional interactive interface according to the position offset, and using the distance value as the display depth; The display position is determined according to the display depth, and the background three-dimensional entity and the foreground three-dimensional entity are displayed based on the display position, so that the foreground three-dimensional entity is displayed in the spatial scene outside the virtual portal and the background three-dimensional entity is displayed in the virtual space inside the virtual portal.
6. The method according to claim 5, It is characterized in that After using the distance value as the display depth, the method further includes: According to the display position of the foreground three-dimensional entity, adjusting the display depth to generate a target display depth; wherein the display position is the position of the foreground three-dimensional entity displayed in the space scene outside the virtual portal; According to the target display depth, original display positions of the background three-dimensional entity and the foreground three-dimensional entity are adjusted.
7. The method according to any one of claims 1 to 6, It is characterized in that Further including: Configuring corresponding attribute data for various components on the server side, wherein the components include a two-dimensional interactive interface, a rendering view, a foreground three-dimensional entity, a background three-dimensional entity, a three-dimensional entity attribute component, and a custom component; When constructing any one of the multiple components, attribute data corresponding to the component is obtained from the server.
8. The method according to claim 7, It is characterized in that The configuration of corresponding attribute data for various components on the server side includes: When configuring attribute data for a foreground 3D entity and a background 3D entity, the reflective attribute in the attribute data of the foreground 3D entity and the background 3D entity is configured to be disabled so that the display tones of the foreground 3D entity and the background 3D entity are consistent.
9. A device for displaying a three-dimensional entity on a two-dimensional interactive interface, It is characterized in that include: Construct component module, obtain entity module and display module; among them, The construction component module is used to construct a virtual portal on a two-dimensional interactive interface in the space scene; wherein the virtual portal is the entrance between the space scene and the virtual space; The entity acquisition module is used to acquire the three-dimensional entity of the object to be displayed; The display module is used for displaying the three-dimensional entity at the front-end perspective of the two-dimensional interactive interface, and the three-dimensional entity penetrates from the virtual space through the virtual portal into the space scene; the three-dimensional entity is not displayed at the back-end perspective of the two-dimensional interactive interface.
10. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. A computer program product comprising a computer program, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Interface rendering method and device, electronic equipment and storage medium
CN111803945A
Content processing method and device based on augmented reality, terminal equipment and storage medium
CN111862333A
Building model informatization and live-action virtual simulation method
CN112308954A
Window display method and device, electronic equipment and storage medium
CN115546410A
Web-based mr virtual picture display method and device
CN116030228A
Cited By
Three-dimensional model presentation method and device, augmented reality equipment and storage medium
CN119494940A
Three-dimensional model presentation method and apparatus, extended reality device, and storage medium
WO2026056379A1
