Method, device and equipment for generating virtual object and storage medium
By obtaining the position and posture information of the virtual object frame, determining its size, and selecting matching materials, the problem of excessive gaps after scaling the materials is solved, thus improving the display effect and image quality of the virtual object.
Patent Information
- Application Number
- CN202210072404.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-21
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-02-06
AI Technical Summary
In existing technologies, scaling the material within a virtual object frame results in excessive gaps, affecting the display effect of the virtual object.
Based on the position and orientation information of the virtual object frame in 3D space, its size information is determined, and a matching target material is selected. The material is then rendered into the virtual object frame using the position and orientation information to generate a virtual object.
It improved the size matching between the materials and the virtual object frame, enhanced the display effect of the virtual objects, and improved the display quality of the images.
Smart Images

Figure CN114419298B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of augmented reality, and in particular, to a virtual object generation method and device, equipment and a storage medium. BACKGROUND
[0002] At present, materials are usually distributed into each virtual object frame according to the order of the materials, and then the materials are scaled according to the short side size of the virtual object frame to ensure that the materials are completely located in the virtual object frame. According to this method, if a higher material is placed in a wider virtual object frame, the virtual object frame will have more gaps after the material is scaled, which affects the display effect of the virtual object. SUMMARY
[0003] Embodiments of the present disclosure provide a virtual object generation method, device, equipment and storage medium. The size of the material is selected according to the size of the virtual object frame, which can improve the matching degree of the scaled material and the size of the virtual object frame, thereby improving the display effect of the virtual object.
[0004] In a first aspect, embodiments of the present disclosure provide a virtual object generation method, comprising:
[0005] obtaining position information and attitude information of a virtual object frame in a three-dimensional space;
[0006] determining size information of the virtual object frame in the three-dimensional space according to the attitude information;
[0007] determining a target material according to the size information;
[0008] rendering the target material into the virtual object frame according to the position information and the attitude information to generate a virtual object.
[0009] In a second aspect, embodiments of the present disclosure also provide a virtual object generation device, comprising:
[0010] an information obtaining module configured to obtain position information and attitude information of a virtual object frame in a three-dimensional space;
[0011] a size information determining module configured to determine size information of the virtual object frame in the three-dimensional space according to the attitude information;
[0012] a target material determining module configured to determine a target material according to the size information;
[0013] a virtual object generating module configured to render the target material into the virtual object frame according to the position information and the attitude information to generate a virtual object.
[0014] In a third aspect, the present disclosure also provides an electronic device, which comprises:
[0015] one or more processing devices;
[0016] a storage device configured to store one or more programs;
[0017] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the method for generating a virtual object according to the embodiments of the present disclosure.
[0018] In a fourth aspect, the present disclosure also provides a computer readable medium having a computer program stored thereon, which, when executed by a processing device, implements the method for generating a virtual object according to the embodiments of the present disclosure.
[0019] The embodiments of the present disclosure provide a method and device for generating a virtual object, an electronic device and a storage medium. The position information and the attitude information of a virtual object frame in a three-dimensional space are acquired. The size information of the virtual object frame in the three-dimensional space is determined according to the attitude information. The target material is determined according to the size information. The target material is rendered into the virtual object frame according to the position information and the attitude information, and the virtual object is generated. The method for generating a virtual object provided by the embodiments of the present disclosure can improve the size matching degree of the scaled material and the virtual object frame, thereby improving the display effect of the virtual object and further improving the display quality of the image. BRIEF DESCRIPTION OF DRAWINGS
[0020] Figure 1 is a flowchart of a method for generating a virtual object in the embodiments of the present disclosure;
[0021] Figure 2 is a structural schematic diagram of a device for generating a virtual object in the embodiments of the present disclosure;
[0022] Figure 3 is a structural schematic diagram of an electronic device in the embodiments of the present disclosure. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure will be described in more detail below with reference to the drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein, but rather, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes, and are not intended to limit the scope of protection of the present disclosure.
[0024] It should be understood that each step recited in the method embodiments of the present disclosure can be performed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit performing the steps shown. The scope of the present disclosure is not limited in this respect.
[0025] The term "comprising" and variations thereof as used herein are open-ended, that is, "comprising but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment." The term "another embodiment" means "at least one additional embodiment." The term "some embodiments" means "at least some embodiments." Related terms have corresponding meanings.
[0026] It should be noted that the terms "first", "second", and the like in the present disclosure are merely used to distinguish different devices, modules or units, and do not imply the order or interdependence of the functions performed by these devices, modules or units.
[0027] It should be noted that the terms "one", "multiple" in the present disclosure are illustrative and not restrictive, and those skilled in the art should understand that unless otherwise explicitly stated in the context, it should be understood as "one or more".
[0028] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.
[0029] Figure 1 A flowchart of a virtual object generation method according to an embodiment of the present disclosure is provided. The embodiment can be applied to the generation of a virtual object in a three-dimensional space. The method can be performed by a virtual object generation device, which can be composed of hardware and / or software, and can be integrated in a device having a virtual object generation function, such as a server, a mobile terminal, or a server cluster. As shown in Figure 1 The method specifically includes the following steps:
[0030] S110, obtaining position information and attitude information of a virtual object frame in a three-dimensional space.
[0031] The virtual object frame is hung on an object identified in the three-dimensional space and is used to place a virtual object. The virtual object frame can include multiple virtual object frames. In the embodiment, the virtual object can be a virtual object corresponding to any theme, such as a "Dragon Boat Festival" theme. The virtual object can be a virtual dragon boat, a virtual zongzi, etc., which is not limited here.
[0032] The position information can be coordinate information of a center point of the virtual object frame in a three-dimensional space, and the attitude information can include a yaw angle, a pitch angle and a roll angle of the virtual object frame in the three-dimensional space.
[0033] In this embodiment, the coordinate information of the center point of the virtual object frame in the three-dimensional space can be determined according to SLAM (Simultaneous localization and mapping) information, and the attitude information of the virtual object frame in the three-dimensional space can be determined by a normal estimation algorithm. This embodiment is not limited.
[0034] In this embodiment, the virtual object frame can be determined in the following manner: performing object detection on a current frame; and determining the virtual object frame according to the detected object. Specifically, the size of the virtual object frame can be determined according to the detection frame of the object. For example, the size of the virtual object frame can be smaller than or equal to the detection frame of the object, or the detection frame of the object can be split to obtain multiple virtual object frames.
[0035] In S120, the size information of the virtual object frame in the three-dimensional space is determined according to the attitude information.
[0036] The size information can be an aspect ratio, and therefore, the height and the width of the virtual object frame in the three-dimensional space need to be obtained, and the height and the width are compared to obtain the aspect ratio.
[0037] Optionally, the manner of determining the size information of the virtual object frame in the three-dimensional space according to the attitude information can be: determining a second height of the virtual object frame in the three-dimensional space according to a first height of the virtual object frame in a pixel plane and a pitch angle; determining a second width of the virtual object frame in the three-dimensional space according to a first width information of the virtual object frame in the pixel plane and a yaw angle; and comparing the second height and the second width to obtain an aspect ratio of the virtual object frame in the three-dimensional space.
[0038] Specifically, the first height is multiplied by the cosine of the pitch angle to obtain the second height of the virtual object frame in the three-dimensional space, and the first width is multiplied by the cosine of the yaw angle to obtain the second width of the virtual object frame in the three-dimensional space. The aspect ratio of the virtual object frame in the three-dimensional space is determined based on the attitude information, which can accurately determine the size information of the virtual object frame, facilitating the selection of the target material.
[0039] In S130, the target material is determined according to the size information.
[0040] The target material can be understood as a material placed in the virtual object frame, which can be a material of any theme and designed and stored in a material library by a developer. In this embodiment, the size of the target material matches the size information of the virtual object frame in the three-dimensional space.
[0041] Optionally, the way of determining the target material according to the size information can be: determining a material that does not appear in the historical period as the candidate material; and determining the target material from the candidate material according to the size information.
[0042] The historical period can be understood as the last N seconds, and N can be any positive integer. Specifically, first, the materials in the material library that are rendered to the three-dimensional space in the last N seconds are filtered out, then the remaining materials are determined as candidate materials, and finally the target material is determined from the candidate materials according to the aspect ratio of the virtual object frame in the three-dimensional space. The advantage of this is that it can prevent the same material from appearing repeatedly in a short period of time and improve the diversity of virtual object generation.
[0043] Optionally, the process of determining the target material from the candidate material according to the size information can be: classifying the candidate materials according to the aspect ratio to obtain a plurality of material classes; determining the material class corresponding to the virtual object frame as the target material class according to the size information; and determining the target material from the target material class.
[0044] The aspect ratio categories can include an aspect ratio greater than 1, an aspect ratio equal to 1, and an aspect ratio less than 1. Therefore, the plurality of material classes includes a material class with an aspect ratio greater than 1, a material class with an aspect ratio equal to 1, and a material class with an aspect ratio less than 1. Specifically, if the aspect ratio of the virtual object frame in the three-dimensional space is greater than 1, the material class with an aspect ratio greater than 1 is determined as the target material class; if the aspect ratio of the virtual object frame in the three-dimensional space is equal to 1, the material class with an aspect ratio equal to 1 is determined as the target material class; and if the aspect ratio of the virtual object frame in the three-dimensional space is less than 1, the material class with an aspect ratio less than 1 is determined as the target material class. Finally, a target material is determined from the target material class.
[0045] Optionally, the way of determining the target material from the target material class can be: randomly selecting a material from the target material class to determine as the target material; or determining the material in the target material class with the smallest difference between the aspect ratio and the aspect ratio of the virtual object frame as the target material.
[0046] Specifically, if the target material class is a material class with an aspect ratio greater than 1, a material is randomly selected from the material class with an aspect ratio greater than 1 as the target material. If the target material class is a material class with an aspect ratio equal to 1, a material is randomly selected from the material class with an aspect ratio equal to 1 as the target material. If the target material class is a material class with an aspect ratio less than 1, a material is randomly selected from the material class with an aspect ratio less than 1 as the target material. In this embodiment, the target material is determined based on the classified candidate materials, which can improve the efficiency of determining the target material.
[0047] Specifically, if the target material class is a material class with a length-width ratio greater than 1, the specific length-width ratio of each material in the material class with a length-width ratio greater than 1 is calculated, and the difference between each specific length-width ratio and the length-width ratio of the virtual object frame is calculated. The material with the smallest difference value is taken as the target material. If the target material class is a material class with a length-width ratio less than 1, the specific length-width ratio of each material in the material class with a length-width ratio less than 1 is calculated, and the difference between each specific length-width ratio and the length-width ratio of the virtual object frame is calculated. The material with the smallest difference value is taken as the target material. In this embodiment, the material with the smallest difference value is determined as the target material, which can improve the matching degree of the target material and the virtual object frame.
[0048] In S140, the target material is rendered into the virtual object frame according to the position information and the attitude information, and a virtual object is generated.
[0049] The position information is the coordinate information of the center point of the virtual object frame in the three-dimensional space. Specifically, the center point of the target material is aligned with the center point of the virtual object frame in the three-dimensional space, and the target material is rendered after adjusting the attitude of the target material according to the attitude information, so as to obtain the virtual object.
[0050] Specifically, the target material is rendered into the virtual object frame according to the position information and the attitude information, and a virtual object is generated. The way can be: obtaining the depth information of the virtual object frame in the three-dimensional space; scaling the target material according to the depth information; and rendering the scaled target material into the virtual object frame according to the position information and the attitude information.
[0051] The depth information can be the distance between the center point of the virtual object frame and the optical center of the camera. The scaling of the target material can be a proportional scaling, so that the scaled target material can be completely surrounded by the virtual object frame, preventing the rendered virtual object from overflowing the virtual object frame, thereby avoiding overlapping with other virtual objects. Based on the depth information, the target material is scaled, which can improve the three-dimensional sense of the virtual object.
[0052] Optionally, the way of scaling the target material according to the depth information can be: determining a scaling ratio according to the depth information; and scaling the target material according to the scaling ratio.
[0053] The depth information and the scaling ratio have a certain corresponding relationship, and the depth information and the scaling ratio are inversely proportional. The greater the depth information, the greater the scaling ratio, that is, it conforms to the perspective principle. The farther the object is, the smaller the size of the object in the picture.
[0054] Specifically, after scaling the target material according to the scaling ratio, the center point of the scaled target material is aligned with the center point of the virtual object frame in the three-dimensional space, the pose of the scaled target material is adjusted according to the pose information, and finally rendering is performed to obtain the virtual object. The advantage of this is to ensure that the rendered virtual object fits the virtual object frame and improve the display effect of the virtual object.
[0055] The technical scheme of the embodiment of the present disclosure obtains position information and pose information of a virtual object frame in a three-dimensional space, determines size information of the virtual object frame in the three-dimensional space according to the pose information, determines a target material according to the size information, and renders the target material into the virtual object frame according to the position information and the pose information to generate a virtual object. The method for generating a virtual object provided by the embodiment of the present disclosure can determine a target material according to the size information of a virtual object frame, which can improve the size matching degree of the scaled material and the virtual object frame, thereby improving the display effect of the virtual object and further improving the display quality of the image.
[0056] Figure 2 FIG. 1 is a structural schematic diagram of a virtual object generation device provided by the embodiment of the present disclosure, as shown in the figure, the device comprises: Figure 2
[0057] An information obtaining module 210 is configured to obtain position information and pose information of a virtual object frame in a three-dimensional space.
[0058] A size information determining module 220 is configured to determine size information of the virtual object frame in the three-dimensional space according to the pose information.
[0059] A target material determining module 230 is configured to determine a target material according to the size information.
[0060] A virtual object generation module 240 is configured to render the target material into the virtual object frame according to the position information and the pose information to generate a virtual object.
[0061] Optionally, the pose information comprises a yaw angle, a pitch angle and a roll angle; the size information is an aspect ratio; the size information determining module 220 is further configured to:
[0062] determine a second height of the virtual object frame in the three-dimensional space according to a first height of the virtual object frame in a pixel plane and the pitch angle;
[0063] determine a second width of the virtual object frame in the three-dimensional space according to a first width information of the virtual object frame in the pixel plane and the yaw angle;
[0064] make a ratio of the second height and the second width to obtain an aspect ratio of the virtual object frame in the three-dimensional space.
[0065] Optionally, the target material determining module 230 is further configured to:
[0066] determine the material that does not appear in the historical period as the candidate material;
[0067] determine the target material from the candidate material according to the size information.
[0068] Optionally, the target material determining module 230 is further configured to:
[0069] classify the candidate materials according to the aspect ratio to obtain a plurality of material classes;
[0070] determine the material class corresponding to the virtual object frame as the target material class according to the size information;
[0071] determine the target material from the target material class.
[0072] Optionally, the target material determining module 230 is further configured to:
[0073] randomly select a material from the target material class as the target material; or
[0074] determine the material with the smallest difference between the aspect ratio and the aspect ratio of the virtual object frame in the target material class as the target material.
[0075] Optionally, the virtual object generating module 240 is further configured to:
[0076] obtain depth information of the virtual object frame in the three-dimensional space;
[0077] scale the target material according to the depth information;
[0078] render the scaled target material into the virtual object frame according to the position information and the attitude information.
[0079] Optionally, the virtual object generating module 240 is further configured to:
[0080] determine the scaling ratio according to the depth information;
[0081] scale the target material according to the scaling ratio.
[0082] The apparatus can perform the method provided by all the foregoing embodiments of the present disclosure, and has the corresponding function modules and beneficial effects of performing the foregoing method. Technical details not described in detail in the present embodiment can be referred to the method provided by all the foregoing embodiments of the present disclosure.
[0083] The following refers to Figure 3The diagram illustrates a structural schematic of an electronic device 300 suitable for implementing embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs, desktop computers, or various forms of servers, such as standalone servers or server clusters. Figure 3 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0084] like Figure 3 As shown, the electronic device 300 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a memory device 305 into a random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the electronic device 300. The processing unit 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0085] Typically, the following devices can be connected to I / O interface 305: input devices 306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 309. Communication device 309 allows electronic device 300 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 An electronic device 300 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0086] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing a method of word recommendation. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 309, or installed from a storage device 305, or installed from a ROM 302. When the computer program is executed by a processing device 301, it performs the functions defined above in the methods of embodiments of this disclosure.
[0087] Note that the computer readable medium described above in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination thereof. The computer readable storage medium can be, for example and without limitation, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination thereof. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus or device. In the present disclosure, the computer readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, in which the computer readable program code is contained. Such a propagated data signal can take any of a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. The program code contained on the computer readable medium can be transmitted by any suitable medium, including but not limited to wire, cable, RF, etc., or any suitable combination thereof.
[0088] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.
[0089] The computer readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device, and can be accessed via the electronic device.
[0090] The computer readable medium described above carries one or more programs, which, when executed by the electronic device, cause the electronic device to: acquire position information and attitude information of a virtual object frame in a three-dimensional space; determine size information of the virtual object frame in the three-dimensional space according to the attitude information; determine a target material according to the size information; and render the target material into the virtual object frame according to the position information and the attitude information, to generate a virtual object.
[0091] Computer program code for carrying out operations of the present disclosure can be written in any one or more programming languages, including object oriented programming languages such as Java, Smalltalk, C++ or conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0092] The flow diagrams and the block diagrams in the drawings are illustrations of possible architectures, functions, and operations for systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may
[0093] The units described in the embodiments of the present disclosure can be implemented by software, or by hardware. In some cases, the name of the unit does not constitute a limitation on the unit itself.
[0094] The functionality described herein above can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0095] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0096] According to one or more embodiments of the embodiments of this disclosure, the embodiments of this disclosure disclose a virtual object generation method, comprising:
[0097] Obtaining position information and attitude information of a virtual object frame in a three-dimensional space;
[0098] Determining size information of the virtual object frame in the three-dimensional space according to the attitude information;
[0099] Determining a target material according to the size information;
[0100] Rendering the target material into the virtual object frame according to the position information and the attitude information, to generate a virtual object.
[0101] Further, the attitude information includes a yaw angle, a pitch angle, and a roll angle; the size information is an aspect ratio; determining the size information of the virtual object frame in the three-dimensional space according to the attitude information; comprising:
[0102] Determining a second height of the virtual object frame in the three-dimensional space according to a first height of the virtual object frame in a pixel plane and the pitch angle;
[0103] Determining a second width of the virtual object frame in the three-dimensional space according to a first width information of the virtual object frame in the pixel plane and the yaw angle;
[0104] proportion the second height and the second width to obtain an aspect ratio of the virtual object frame in the three-dimensional space.
[0105] Further, determining the target material according to the size information comprises:
[0106] determining a material that does not appear in the historical period as a candidate material;
[0107] determining the target material from the candidate materials according to the size information.
[0108] Further, determining the target material from the candidate materials according to the size information comprises:
[0109] classifying the candidate materials according to the aspect ratio to obtain a plurality of material classes;
[0110] determining a material class corresponding to the virtual object frame as a target material class according to the size information;
[0111] determining the target material from the target material class.
[0112] Further, determining the target material from the target material class comprises:
[0113] randomly selecting a material from the target material class as the target material; or
[0114] determining a material with the smallest difference in aspect ratio between the target material class and the virtual object frame as the target material.
[0115] Further, rendering the target material into the virtual object frame according to the position information and the attitude information to generate a virtual object comprises:
[0116] obtaining depth information of the virtual object frame in the three-dimensional space;
[0117] scaling the target material according to the depth information;
[0118] rendering the scaled target material into the virtual object frame according to the position information and the attitude information.
[0119] Further, scaling the target material according to the depth information comprises:
[0120] determining a scaling ratio according to the depth information;
[0121] scaling the target material according to the scaling ratio.
[0122] Note that the above merely describes preferred embodiments of the present disclosure and the principles of the technology applied. Those skilled in the art will understand that the present disclosure is not limited to the specific embodiments described herein, and that various obvious changes, modifications and substitutions can be made thereto without departing from the scope of the present disclosure. Therefore, although the present disclosure has been described in detail through the above embodiments, the present disclosure is not limited to the above embodiments only, but can include more other equivalent embodiments without departing from the concept of the present disclosure, and the scope of the present disclosure is determined by the scope of the claims.
Claims
1. A method of generating a virtual object, the method comprising: The method comprises the following steps: acquiring position information and attitude information of a virtual object frame in a three-dimensional space, wherein the virtual object frame is hung on an object identified in the three-dimensional space and is used for placing a virtual object; determining size information of the virtual object frame in the three-dimensional space according to the attitude information; determining a target material according to the size information, wherein the size of the target material matches the size information of the virtual object frame in the three-dimensional space; rendering the target material into the virtual object frame according to the position information and the attitude information to generate a virtual object.
2. The method of claim 1, wherein, The attitude information comprises a yaw angle, a pitch angle and a roll angle; the size information is an aspect ratio; the size information of the virtual object frame in the three-dimensional space is determined according to the attitude information; which comprises the following steps: determining a second height of the virtual object frame in the three-dimensional space according to a first height of the virtual object frame in a pixel plane and the pitch angle; determining a second width of the virtual object frame in the three-dimensional space according to a first width information of the virtual object frame in the pixel plane and the yaw angle; obtaining an aspect ratio of the virtual object frame in the three-dimensional space according to the second height and the second width.
3. The method of claim 2, wherein, The target material is determined according to the size information, which comprises the following steps: determining a material that does not appear in a historical period as a candidate material; determining a target material from the candidate material according to the size information.
4. The method according to claim 3, characterized in that, The target material is determined from the candidate material according to the size information, which comprises the following steps: classifying the candidate material according to an aspect ratio to obtain a plurality of material classes; determining a material class corresponding to the virtual object frame as a target material class according to the size information; determining a target material from the target material class.
5. The method of claim 4, wherein, The target material is determined from the target material class, which comprises the following steps: randomly selecting a material from the target material class as the target material; or determining a material with the smallest difference in aspect ratio between the target material class and the virtual object frame as the target material.
6. The method of claim 1, wherein, The target material is rendered into the virtual object frame according to the position information and the attitude information to generate a virtual object, which comprises the following steps: acquiring depth information of the virtual object frame in the three-dimensional space; scaling the target material according to the depth information; rendering the scaled target material into the virtual object frame according to the position information and the attitude information.
7. The method of claim 6, wherein, The target material is scaled according to the depth information, which comprises the following steps: determining a scaling ratio according to the depth information; scaling the target material according to the scaling ratio.
8. An apparatus for generating a virtual object, the apparatus comprising: The method comprises the following steps: an information acquisition module is configured to acquire position information and attitude information of a virtual object frame in a three-dimensional space, wherein the virtual object frame is hung on an object identified in the three-dimensional space and is used for placing a virtual object; a size information determination module is configured to determine size information of the virtual object frame in the three-dimensional space according to the attitude information; a target material determination module is configured to determine a target material according to the size information, wherein the size of the target material matches the size information of the virtual object frame in the three-dimensional space; A virtual object generation module is configured to render the target material into the virtual object frame according to the position information and the posture information, and generate a virtual object.
9. An electronic device, comprising: The electronic device includes: one or more processing devices; a storage device storing one or more programs; when the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the virtual object generation method as claimed in any one of claims 1-7.
10. A computer readable medium having stored thereon a computer program, characterized in that, The program is executed by the processing device to implement the virtual object generation method as claimed in any one of claims 1-7.
Citation Information
Patent Citations
Image processing method and device, equipment and storage medium
CN110533780A
Display method and device based on augmented reality, storage medium and program product
CN112884908A
Object attitude detection method and device, computer equipment and storage medium
CN113795867A