Virtual object perspective processing method, device and computer equipment

By automatically correcting the mesh model vertices and camera positions of virtual objects by computer equipment, the unreliability and field angle limitation of manual perspective correction are solved, and efficient and reliable perspective effects are achieved and user experience is improved.

CN114452646BActive Publication Date: 2025-07-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011239948.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-09
Publication Date
2025-07-22
Estimated Expiration
2040-11-09

AI Technical Summary

Technical Problem

In the prior art, the perspective processing of virtual objects relies on manual lattice deformation in three-dimensional modeling tools, resulting in uncontrollable reliability and accuracy, and limit the flexibility of the camera field of view in game scenes, affecting user experience.

Method used

The projection matrix of the target camera field angle and the source camera field angle is automatically obtained through computer equipment, spatial position correction is performed on the vertices of the source mesh model, and offset correction is performed according to the constraints on the field angle change to achieve automatic correction of perspective effects.

Benefits of technology

It improves the efficiency and reliability of perspective processing, removes the limitations on the camera's field of view angle during game operation, ensures the correct perspective effect of virtual objects at different camera field of view angles, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114452646B_ABST
    Figure CN114452646B_ABST
Patent Text Reader

Abstract

The present application provides a virtual object perspective processing method, apparatus, and computer device. During the operation of a game, the computer device obtains in real time the target camera field of view angle of the first virtual application scenario, the source camera field of view angle and the source mesh model of the first virtual object, and then uses the projection matrices corresponding to the target camera field of view angle and the source camera field of view angle respectively to correct the spatial positions of the vertices of the source mesh model, obtaining the target mesh model in the world coordinate system. At the same time, according to the field of view angle change constraint conditions, the source camera spatial position and the source rendering spatial position of the first virtual object under the source camera field of view angle are offset and corrected, obtaining the target camera spatial position and the target rendering spatial position of the first virtual object under the target camera field of view angle, so as to implement the rendering of the target mesh model and obtain the target rendering image that meets the perspective effect requirements of the first virtual object, improving the processing efficiency and reliability, and no longer restricting the camera field of view angle during the game operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing applications, and particularly to a method, device, and computer device for perspective processing of virtual objects. Background Art

[0002] With the development of computer communication technology, electronic games have become an important part of users' life and entertainment. During the development of electronic games, it is usually necessary to render two-dimensional models and three-dimensional models in the games. Taking a horizontal game under a monocular camera as an example, during the model rendering process, for a virtual object with a specific perspective effect, it is usually necessary to first perform perspective correction processing on the source mesh model of the virtual object so that the rendered virtual object exhibits perspective effects under different camera field of view angles.

[0003] Specifically, referring to Figure 1 the currently adopted schematic diagram of the virtual object perspective processing flow shown, currently, first, an art production staff manually performs lattice deformation processing on the source mesh model of the constructed virtual object in a 3D modeling tool, and then imports the deformed target mesh model into the game engine to complete the subsequent model rendering process and achieve the required perspective display effect.

[0004] However, the existing method of manually performing lattice deformation processing on the mesh model is often affected by the subjective vision of the art production staff, and the reliability and accuracy are uncontrollable. Moreover, in order to ensure the display effect of the final virtual object, it is required that the camera field of view angle in any game scene must be consistent with the camera field of view angle set by the art production staff in the 3D modeling tool, which has great limitations and often cannot meet the application requirements, reducing the user experience. Summary of the Invention

[0005] To achieve the above object, the embodiments of the present application provide the following technical solutions:

[0006] On the one hand, the present application proposes a method for perspective processing of virtual objects, and the method includes:

[0007] Obtain the target camera field of view angle of the first virtual application scene, as well as the source camera field of view angle and the source mesh model of the first virtual object in the first virtual application scene;

[0008] Use the projection matrices corresponding to the target camera field of view angle and the source camera field of view angle respectively to correct the spatial positions of the vertices of the source mesh model to obtain a target mesh model in the world coordinate system;

[0009] According to the constraint conditions of the field of view angle change, perform offset correction on the source camera spatial position under the field of view angle of the source camera and the source rendering spatial position of the first virtual object to obtain the target camera spatial position under the field of view angle of the target camera and the target rendering spatial position of the first virtual object;

[0010] Render the target mesh model based on the target camera spatial position and the target rendering spatial position to obtain the target rendering image of the first virtual object.

[0011] Optionally, the obtaining of the field of view angle of the target camera of the first virtual application scenario, as well as the field of view angle of the source camera and the source mesh model of the first virtual object in the first virtual application scenario, includes:

[0012] Obtain the field of view angle of the target camera of the first virtual application scenario, as well as the field of view angles of the source cameras and the source mesh models corresponding to the respective virtual objects in the first virtual application scenario;

[0013] Compare the field of view angles of the source cameras corresponding to the respective virtual objects with the field of view angle of the target camera;

[0014] Based on the comparison result, determine the field of view angle of the source camera and the source mesh model corresponding to the first virtual object, where the first virtual object refers to the virtual object corresponding to the field of view angle of the source camera that is inconsistent with the field of view angle of the target camera.

[0015] Optionally, the method for obtaining the field of view angle of the source camera and the source mesh model of the first virtual object includes:

[0016] Receive a three-dimensional model data import request sent by an electronic device, where the three-dimensional model data import request is generated by the electronic device in response to an operation of importing the three-dimensional model data of the first virtual object;

[0017] Parse the three-dimensional model data import request to obtain the field of view angle of the source camera and the source mesh model of the first virtual object.

[0018] Optionally, the using of the projection matrices corresponding to the field of view angle of the target camera and the field of view angle of the source camera respectively to perform spatial position offset correction on each vertex of the source mesh model to obtain the target mesh model in the world coordinate system includes:

[0019] Obtain the first projection matrix of the field of view angle of the target camera, the second projection matrix of the field of view angle of the source camera, the camera transformation matrix between the camera coordinate system and the world coordinate system, and the source vertex spatial positions corresponding to each vertex in the source mesh model;

[0020] Using the first projection matrix, the second projection matrix, and the camera transformation matrix, perform offset correction on the spatial position of the source vertex to obtain the position offset of the corresponding vertex in the world coordinate system;

[0021] According to the obtained multiple position offsets, perform spatial position offset correction on the corresponding vertices of the source mesh model to obtain the target mesh model of the first virtual object in the world coordinate system.

[0022] Optionally, the field of view change constraint condition includes that the screen space size of the same virtual object is the same under different camera fields of view.

[0023] Optionally, the offset correction of the source camera spatial position and the source rendering spatial position of the first virtual object under the source camera field of view according to the field of view change constraint condition to obtain the target camera spatial position and the target rendering spatial position of the first virtual object under the target camera field of view includes:

[0024] Obtain the source camera state parameters in the world coordinate system under the source camera field of view;

[0025] According to the source camera state parameters, obtain the target camera spatial position under the target camera field of view and the rendering correction parameters of the first virtual object; wherein, the rendering correction parameters include the position correction parameters for the source rendering spatial position in the world coordinate system and / or the model scaling ratio of the first virtual object;

[0026] Use the rendering correction parameters to correct the source rendering spatial position of the first virtual object to obtain the target rendering spatial position.

[0027] Optionally, the source camera state parameters include the source camera spatial position, the source camera pitch angle, and the first included angle of the source camera position vector, where the first included angle is the included angle between the source camera position vector and the first coordinate axis of the world coordinate system, the first coordinate axis can refer to the Y-axis or X-axis of the world coordinate system, the source camera spatial position includes the first coordinate projected by the source camera on the first coordinate axis and the second coordinate projected on the second coordinate axis of the world coordinate system, and the second coordinate axis includes the Z-axis;

[0028] The obtaining of the target camera spatial position under the target camera field of view and the rendering correction parameters of the first virtual object according to the source camera state parameters includes:

[0029] Use the first coordinate and the second coordinate to obtain the camera source distance between the source camera and the origin of the world coordinate system under the source camera field of view;

[0030] Using the field of view angle of the source camera and the field of view angle of the target camera, obtain the model scaling ratio of the first virtual object;

[0031] According to the camera source distance, the model scaling ratio, and the first included angle, obtain the spatial position of the target camera under the field of view angle of the target camera;

[0032] According to the model scaling ratio, the first coordinate, the pitch angle of the camera source, and the first included angle, obtain the rendering correction parameters of the first virtual object.

[0033] Optionally, the obtaining the spatial position of the target camera under the field of view angle of the target camera according to the camera source distance, the model scaling ratio, and the first included angle includes:

[0034] Using the camera source distance and the model scaling ratio, obtain the camera distance offset;

[0035] Using the first coordinate, the pitch angle of the camera source, the first included angle, the camera distance offset, and the camera source distance, obtain the camera position offset under the field of view angle of the target camera, where the camera position offset refers to the position offset of the target camera relative to the projection of the source camera on the Z axis;

[0036] Using the camera position offset, the first included angle, the camera distance offset, and the camera source distance, obtain the third coordinate under the field of view angle of the target camera, where the third coordinate refers to the coordinate of the target camera projected on the Z axis;

[0037] Using the first included angle, the camera distance offset, and the camera source distance, obtain the fourth coordinate under the field of view angle of the target camera, where the fourth coordinate refers to the coordinate of the target camera projected on the first coordinate axis;

[0038] Determine the spatial position of the target camera under the field of view angle of the target camera from the third coordinate and the fourth coordinate;

[0039] The obtaining the rendering correction parameters of the first virtual object according to the model scaling ratio, the first coordinate, the pitch angle of the camera source, and the first included angle includes:

[0040] The camera position offset and the model scaling ratio form the rendering correction parameters of the first virtual object.

[0041] In another aspect, the present application also proposes a virtual object perspective processing device, and the device includes:

[0042] The first data acquisition module is used to acquire the target camera field of view angle of the first virtual application scenario, as well as the source camera field of view angle and the source mesh model of the first virtual object in the first virtual application scenario;

[0043] The first position correction module is used to perform spatial position correction on each vertex of the source mesh model by using the projection matrices corresponding to the target camera field of view angle and the source camera field of view angle respectively, so as to obtain the target mesh model in the world coordinate system;

[0044] The second position correction module is used to perform offset correction on the source camera spatial position under the source camera field of view angle and the source rendering spatial position of the first virtual object according to the field of view angle change constraint condition, so as to obtain the target camera spatial position under the target camera field of view angle and the target rendering spatial position of the first virtual object;

[0045] The rendering module is used to render the target mesh model according to the target camera spatial position and the target rendering spatial position, so as to obtain the target rendering image of the first virtual object.

[0046] In another aspect, the present application also proposes a computer device, which includes:

[0047] A communication module;

[0048] A memory, which is used to store the program of the virtual object perspective processing method as described above;

[0049] A processor, which is used to load and execute the program stored in the memory, and implement the steps of the virtual object perspective processing method as described above.

[0050] In another aspect, the present application also proposes a readable storage medium, which is characterized in that a computer program is stored thereon, and the computer program is loaded and executed by a processor to implement the steps of the virtual object perspective processing method as described above.

[0051] Based on the above technical solution, in the embodiments of the present application, it is not necessary for art production personnel to perform perspective correction on the first virtual object (i.e., the virtual object that requires perspective correction) in a 3D modeling tool. Instead, during the operation of applications such as horizontal games, the computer device (such as a game engine) directly obtains the target camera field of view angle of the first virtual application scene (i.e., the virtual application scene corresponding to any application operation moment), as well as the source camera field of view angle and the source mesh model of the first virtual object in the first virtual application scene. Subsequently, the spatial positions of the vertices of the source mesh model can be corrected using the projection matrices corresponding to the target camera field of view angle and the source camera field of view angle respectively, to obtain the target mesh model in the world coordinate system. At the same time, according to the field of view angle change constraint conditions, the source camera spatial position and the source rendering spatial position of the first virtual object under the source camera field of view angle are offset and corrected to obtain the target camera spatial position and the target rendering spatial position of the first virtual object under the target camera field of view angle, so as to realize the rendering of the target mesh model and obtain the target rendering image of the first virtual object. This automatic processing method for virtual object perspective correction no longer restricts the camera field of view angle during the game operation, ensuring that the target rendering images displayed in the virtual application scenes at each operation moment can achieve the perspective effects meeting the corresponding requirements, and will not affect the original operation state of the application, thus improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on the provided drawings.

[0053] Figure 1 Schematic diagram of the current virtual object perspective processing flow;

[0054] Figure 2 Schematic diagram of the hardware structure of a computer device embodiment applicable to the virtual object perspective processing method and device proposed in the present application;

[0055] Figure 3 Schematic diagram of the hardware structure of an electronic device embodiment applicable to the virtual object perspective processing method and device proposed in the present application;

[0056] Figure 4 Schematic diagram of the flow of an optional example of the virtual object perspective processing method proposed in the present application;

[0057] Figure 5a Schematic diagram of the camera coordinate system;

[0058] Figure 5bSchematic diagram of the world coordinate system;

[0059] Figure 6 Schematic flowchart of another optional example of the perspective processing method for virtual objects proposed in this application;

[0060] Figure 7 Schematic flowchart of another optional example of the perspective processing method for virtual objects proposed in this application;

[0061] Figure 8 Schematic diagram of the perspective projection processing of the first virtual object on the YOZ plane of the world coordinate system in the perspective processing method for virtual objects proposed in this application;

[0062] Figure 9 Schematic flowchart of another optional example of the perspective processing method for virtual objects proposed in this application;

[0063] Figure 10 Schematic structural diagram of an optional example of the perspective processing device for virtual objects proposed in this application;

[0064] Figure 11 Schematic structural diagram of another optional example of the perspective processing device for virtual objects proposed in this application. Detailed implementation manners

[0065] Based on the technical problems described in the background art section, this application hopes to automatically implement perspective correction processing for virtual objects with specific perspective requirements in applications such as horizontal games by a game engine (i.e., a computer device that supports the normal operation of the game), that is, to perform real-time spatial position correction on the vertices of the mesh model of the virtual object and the camera, so that the virtual object exhibits a perspective effect different from the current camera field of view. This perspective correction process is no longer manually completed by art production personnel in a 3D modeling tool (such as modeling software like Maya / Max), thereby solving a series of problems caused by manual lattice deformation processing of the mesh model of the virtual object.

[0066] In the actual application of this application, the construction of the mesh model of the virtual object can be realized based on artificial intelligence (AI) technology. Artificial intelligence uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, and is a theory, method, technology, and application system that can perceive the environment, acquire knowledge, and use knowledge to obtain the best results. Generally, it includes basic technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics, as well as software technologies in several major directions such as computer vision technology (CV), speech processing technology, natural language processing technology (NLP), and machine learning (ML) / deep learning.

[0067] For applications such as the horizontal version of the game with a monocular camera proposed in this application, appropriate artificial intelligence technologies can be selected according to application requirements. For example, image recognition and processing, 3D object reconstruction, 3D technology, etc. in computer vision technology can be used to construct the mesh model (i.e., the mesh body of the virtual object model) of each game object (i.e., the virtual object) in the game scene. The specific construction process is not described in detail in this application. It can be understood that in the model construction process, one or more machine learning algorithms such as artificial neural networks, confidence networks, reinforcement learning, transfer learning, and inductive learning can be combined to implement, but it is not limited to the model construction method described in this embodiment.

[0068] In the model rendering stage after the perspective correction process of the mesh model, this application can be realized by using rendering technology. The specific implementation process is not described in detail, and during the rendering process, it can be combined with the artificial intelligence technology described above according to application requirements to improve the rendering efficiency and reliability.

[0069] In some embodiments, the above model rendering process can be realized by using cloud rendering technology, that is, the 3D program is placed in a remote server for rendering. The user terminal accesses the resource through the Internet by clicking the "cloud rendering" function button in the Web software or directly in the local 3D program, sends the cloud rendering request to the server, and the server executes the corresponding rendering task according to the cloud rendering request, and feeds back the rendered result picture to the user terminal for display to achieve the required animation display effect for the user to watch and operate. Of course, this application can also be completed by an electronic device with certain data processing capabilities locally. This application does not limit the type of computer device for performing model rendering and can be determined according to the situation.

[0070] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts belong to the scope of protection of the present application.

[0071] It should be noted that for the convenience of description, only the parts related to the relevant invention are shown in the accompanying drawings. Without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.

[0072] It should be understood that the "system", "device", "unit" and / or "module" used in the present application are a way to distinguish different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the word can be replaced by other expressions.

[0073] As shown in the present application and the claims, unless the context clearly indicates an exception, words such as "a", "an", "one" and / or "the" are not specifically singular and may also include plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of the clearly identified steps and elements, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements. Elements defined by the statement "comprising one..." do not exclude the existence of other identical elements in the process, method, commodity or device including the element.

[0074] Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B can mean A or B; the "and / or" herein is only a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more than two. The following terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features.

[0075] Refer to Figure 2, which is a schematic diagram of the hardware structure of a computer device applicable to the virtual object perspective processing method and apparatus proposed in this application. Combining the above analysis, the computer device can be a server and / or an electronic device. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server supporting cloud computing services, etc. The server can be directly or indirectly connected to electronic devices such as smart phones, tablet computers, laptop computers, desktop computers, and netbooks through wired or wireless communication methods to meet the data interaction requirements between the electronic device and the server. The specific communication connection method can be determined according to the situation.

[0076] As Figure 2 shown, the computer device proposed in the embodiment of this application may include but is not limited to: a communication module 11, a memory 12, and a processor 13, where:

[0077] The number of each of the communication module 11, the memory 12, and the processor 13 can be at least one, and the communication module 11, the memory 12, and the processor 13 can all be connected to a communication bus to achieve data communication with each other. The specific communication process can be determined according to the situation.

[0078] The communication module 11 may include a GSM module, a GPRS module, a WIFI module, and / or a communication module for implementing other wireless communication networks or wired communication networks, etc. It may also include communication modules such as a USB interface and a serial / parallel port to achieve data transmission between the internal components of the computer device. This application does not limit the type and quantity of the communication modules included in the computer device, which can be determined according to the data communication requirements in the application scenario. This embodiment will not be elaborated one by one here.

[0079] The memory 12 can be used to store the program for implementing the virtual object perspective processing method proposed in this application. The processor 13 can be used to load and execute the program stored in the memory 12 to implement the steps of the virtual object perspective processing method proposed in the embodiment of this application. The specific implementation process can refer to but is not limited to the description of the corresponding part of the method embodiment below and will not be elaborated here.

[0080] In the embodiments of the present application, the memory 12 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device or other volatile solid-state storage devices. The processor 13 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, etc.

[0081] It should be understood that Figure 2 the structure of the computer device shown does not constitute a limitation on the computer device in the embodiments of the present application. In practical applications, the computer device may include more or fewer components than Figure 2 shown, or combine certain components. Exemplarily, if the above computer device is an electronic device as listed above, the electronic device may be configured with an application engine that supports the normal operation of the application, such as a game engine that supports the operation of a horizontal game. In addition, from the perspective of the hardware structure, referring to Figure 3 shown, the electronic device may also include components such as a display, various input devices, various output devices, an antenna, a power module, a sensor module, etc., which are not listed one by one in the present application.

[0082] In practical applications, in combination with the relevant parts described above, in the production and manufacturing stage of game animations, it is usually necessary for art production personnel to use the three-dimensional modeling tools installed in the electronic device to complete the animation production of game objects (denoted as virtual objects) in each game scene. For example, using the obtained object resources to construct three-dimensional models or two-dimensional models of the corresponding virtual objects, etc. The present application does not elaborate on the model construction process, and for the composition structure of the electronic device that realizes the model construction of the virtual object, reference may be made to the corresponding parts described above, and this embodiment will not be elaborated here.

[0083] In the embodiments of the present application, in combination with the description of the technical concept of the present application above, after an art production staff completes the construction of the mesh models (which can also be referred to as model mesh bodies) of each virtual object in a horizontal game or other fixed perspective games on a 3D modeling tool, they can directly import them into the above computer device. In this way, during the game operation, the target camera field of view angle of the game scene can be calculated in real time and sent to the computer device. Then, the game engine in the computer device (that is, some pre-written editable computer game systems, or the core components of some interactive real-time image application programs) executes the virtual object perspective processing method proposed by the present application. According to the target camera field of view angle at the current moment, the perspective correction of the first virtual object (that is, the virtual object with unconventional perspective performance requirements) in the game scene is realized, so that the first virtual object can display the perspective effect of any camera field of view angle, improving the perspective correction and rendering efficiency during the game operation, greatly reducing the workload of the art production staff, and solving the technical problems that the reliability and accuracy are uncontrollable when manually performing lattice deformation processing on the mesh model, and the camera field of view angle during the game process is strictly restricted.

[0084] Next, from the perspective of the computer device, the virtual object perspective processing method proposed by the present application will be described in detail. However, it is not limited to the processing methods described in the following embodiments. For the operations performed by the computer device according to the embodiments of the present application illustrated by the flowcharts in the present application, it can be understood that the previous or subsequent operations do not necessarily need to be executed precisely in sequence. On the contrary, they can be executed in reverse order or simultaneously. At the same time, other operations can also be added to these processes, or one or several steps of operations can be removed from these processes. The following embodiments of the present application do not elaborate on them one by one, but they all belong to the protection scope of the technical solution of the present application.

[0085] Refer to Figure 4 , which is a schematic flowchart of an optional example of the virtual object perspective processing method proposed by the present application. This method is applicable to the computer device described above, as Figure 4 shown. This method may include but is not limited to the following steps:

[0086] Step S11, obtain the target camera field of view angle of the first virtual application scene, as well as the source camera field of view angle and the source mesh model of the first virtual object in the first virtual application scene;

[0087] In the embodiments of the present application, the first virtual application scenario may be any to-be-rendered application scenario to be output during the running of an application, such as any game scenario during the running of a horizontal game under a monocular camera. Correspondingly, the first virtual object may refer to a virtual object with an unconventional perspective display effect in the first virtual application scenario. That is to say, the perspective display effect achieved by rendering the first virtual object according to the conventional model cannot meet the application requirements. It is necessary to first perform perspective correction on the first virtual object and then use the corrected data for model rendering to enable the first virtual object displayed in the first virtual application scenario to achieve the required perspective effect.

[0088] Among them, the above camera may be a scene camera set for the virtual application scenario to implement the model rendering of the virtual object. It usually has a certain spatial position and direction, or has a certain field of view FOV (Field of view), which determines the visual field range of the corresponding virtual application scenario, that is, the display content of the virtual application scenario. Therefore, when the field of view of the scene camera changes, the virtual objects included in the virtual application scenario displayed to the user may also change to meet the user's operation requirements for the application.

[0089] In the process of constructing the mesh models of the virtual objects in the virtual application scenario, the initial field of view corresponding to each virtual object in the virtual application scenario is usually determined, denoted as the source camera field of view, which may not meet the perspective effects desired by different users when the virtual object is output. Exemplarily, if the selected value of the source camera field of view preset for virtual object 1 is small, such as 5° (unit: degree), the virtual object controlled by the game player often shows close to orthographic projection and cannot achieve the visual effect of perspective projection.

[0090] In this regard, taking an application such as a horizontal game under a monocular camera as an example, the present application proposes to correct the information such as the spatial positions of the vertices of the mesh model, the camera spatial position, and the rendering spatial position of the first virtual object whose preset source camera field of view is inconsistent with the target camera field of view obtained in real time during the running of the game, that is, the virtual object that cannot achieve the required perspective display effect by rendering according to the source camera field of view, so that the first virtual object (i.e., the three-dimensional game object in the game scenario) displayed by rendering can achieve the required perspective effect.

[0091] It can be understood that the above-mentioned target camera field of view angle can be calculated in real time during the running of the game and will change dynamically as the user plays the game. This application does not limit the calculation method of the target camera field of view angle. It can calculate the target camera field of view angle at different times in real time based on information such as the scene data of the first virtual application scene currently displayed, the operation data input by the user, and the various state parameters sensed by the electronic device used by the user to play the game. The specific implementation process is not described in detail in this embodiment.

[0092] The source mesh module of the above-mentioned first virtual object can be constructed by an artist in a 3D modeling tool and imported into a computer device. This application does not describe in detail the construction method of the mesh models of different virtual objects.

[0093] Step S12, use the projection matrices corresponding to the target camera field of view angle and the source camera field of view angle respectively to correct the spatial positions of the vertices of the source mesh model to obtain the target mesh model in the world coordinate system;

[0094] Continuing the above description, the source mesh model of the first virtual object is constructed under the source camera field of view angle. However, at this time, the target camera field of view angle that the user needs to display is inconsistent with the source camera field of view angle. If the source mesh model is continued to be rendered, the final rendered image will not be able to achieve the desired perspective projection visual effect. Therefore, this application proposes to correct the source mesh model of the first virtual object according to the currently obtained target camera field of view angle.

[0095] Since the mesh model of a virtual object is usually composed of individual triangular faces (or other shaped planes, this application takes triangular faces as an example for illustration), each triangular face is composed of three vertices. After changing the spatial positions of the vertices, the shape of the corresponding triangular face and the relative position relationship with adjacent triangular faces will be changed, so as to change the display structure of the mesh model and produce the desired perspective animation effect. Therefore, in order to enable the virtual object to display the desired perspective projection visual effect, this application proposes that the spatial positions of the vertices in the source network model of the virtual object can be dynamically adjusted, that is, the spatial positions of the vertices of the source mesh model are offset and corrected, and the specific implementation method is not limited. It can be understood that perspective projection is a single-sided projection drawing obtained by projecting a shape onto a projection plane using the central projection method, which is a more visually effective projection. It has a series of perspective characteristics such as a sense of disappearance, a sense of distance, and regular changes in the shapes of objects of the same size, and can realistically reflect the spatial image of the shape. It is usually used in animations, visual simulations, and many other aspects that require a realistic reflection. In order to meet the perspective projection visual effect of the first virtual object, this application can meet the perspective correction requirements by adjusting the camera focal length or zoom ratio of the camera model (that is, the above-mentioned scene camera), that is, adopting a projection transformation processing method.

[0096] Among them, the projection transformation can be to use a projection matrix to transform the spatial positions of the vertices in the mesh model, so as to project a three-dimensional scene onto the screen to form a two-dimensional image, and enable this two-dimensional image to achieve the visual effect of the above perspective projection. Therefore, in the embodiments of the present application, in order to enable the first virtual object to exhibit the rendering effect under the target camera field of view, the projection matrix of its corresponding source camera field of view can be corrected, and thus the offset of the spatial positions of the vertices in the source mesh model can be calculated by inverse deduction. The specific calculation process can refer to, but is not limited to, the description of the corresponding part of the following embodiments, and the present application does not elaborate on the specific construction method of the projection matrix under different camera fields of view.

[0097] In practical applications, data such as the above target camera field of view, source camera field of view, and source mesh model may be obtained in the camera coordinate system of the camera space. This camera coordinate system refers to the coordinate system with the camera as the origin, as Figure 5a shown. To facilitate perspective correction processing, these data can be converted to the world coordinate system, that is, the three-dimensional space coordinate system of the world space, as Figure 5b shown. Specifically, the camera transformation matrix can be used to implement the conversion processing of the spatial position coordinates from the camera coordinate system to the world coordinate system, and finally obtain the target mesh model in the world coordinate system, that is, the corrected mesh model. The present application does not elaborate on the specific implementation process of the camera transformation processing.

[0098] Step S13: According to the field of view change constraint conditions, perform offset correction on the source camera spatial position and the source rendering spatial position of the first virtual object under the source camera field of view to obtain the target camera spatial position and the target rendering spatial position of the first virtual object under the target camera field of view;

[0099] Among them, the field of view change constraint conditions may include: under different camera fields of view, the screen space size of the same virtual object is the same, ensuring that in the virtual application scene shown in adjacent frames, the screen space size of the same virtual object remains unchanged. Therefore, the present application also needs to correct the spatial position of the camera and the spatial position of the first virtual object (which can be called the rendering spatial position). The specific correction processing process is not elaborated in this embodiment.

[0100] Step S14: Render the target mesh model based on the target camera spatial position and the target rendering spatial position to obtain the target rendering image of the first virtual object.

[0101] Refer to Figure 6Schematic flowchart of the virtual object correction processing method. As analyzed above, after the art production staff completes the construction of the mesh model of the first virtual object, the source mesh model can be imported into the game engine of the computer device, and the vertex spatial position correction, source rendering spatial position correction (i.e., the spatial position correction of the virtual object), and camera spatial position correction of the source mesh model can be respectively implemented in the manner described in the above steps. In this way, in the model rendering stage, the data obtained after correction can be used to implement the model rendering of the first virtual object, and the target rendering image of the first virtual object can be obtained, so that the desired perspective projection visual effect can be achieved when it is displayed.

[0102] Specifically, the above rendering process can be performed by the rendering engine in the game engine to calculate and display the target mesh model, animation, lighting, perspective, special effects, etc. on the screen in real time, and can process signals from the keyboard, mouse, and other peripherals to achieve communication between the game player and the electronic device. The specific implementation process of model rendering in this application will not be elaborated.

[0103] In summary, in the embodiment of this application, the art production staff only needs to complete the construction of the model of the first rendering object in the 3D modeling tool without considering the perspective effect problem, import the constructed source mesh model into the computer device, and during the game operation, the computer device (specifically, the game engine) can directly obtain the target camera field of view angle of the first virtual application scene (i.e., the virtual application scene corresponding to any application operation moment) at the current moment, as well as the source camera field of view angle and the source mesh model of the first virtual object in the first virtual application scene. Then, the projection matrices corresponding to the target camera field of view angle and the source camera field of view angle can be used to perform spatial position correction on each vertex of the source mesh model to obtain the target mesh model in the world coordinate system. At the same time, according to the field of view angle change constraint conditions, the source camera spatial position and the source rendering spatial position of the first virtual object under the source camera field of view angle are offset and corrected to obtain the target camera spatial position and the target rendering spatial position of the first virtual object under the target camera field of view angle, so as to implement the rendering of the target mesh model and obtain the target rendering image of the first virtual object. This automatic virtual object perspective correction processing method greatly improves the perspective processing efficiency and reliability, and no longer limits the camera field of view angles of each game scene during the game operation, ensuring that the target rendering images displayed in the virtual application scenes at each operation moment can achieve the corresponding perspective effects and will not affect the game operation state, thus improving the user experience.

[0104] Refer to Figure 7, which is a schematic flowchart of another optional example of the virtual object perspective processing method proposed in this application. This embodiment can be an optional implementation manner of the virtual object perspective processing method described in the above embodiment, but is not limited to this refined implementation manner described in this embodiment. Combining the above analysis, this application is applicable to horizontal games with a monocular camera, and scenarios where game objects need to exhibit perspective effects of different camera fields of view. Specifically, as Figure 7 shown, this method may include:

[0105] Step S21, obtain the target camera field of view of the first virtual application scene, as well as the source camera field of view and source mesh model corresponding to each virtual object in the first virtual application scene;

[0106] Combined with the description of the above embodiment, in the game animation production stage, the model meshes of each virtual object in the game scene can be constructed, denoted as the source mesh model, and the corresponding source camera field of view can be determined, and these data can be imported into the game engine in the computer device. In this way, during the game playing process, the game engine can obtain the target camera field of view of the currently displayed first virtual application scene, that is, the first game scene. The specific acquisition process will not be elaborated.

[0107] Based on this, in some embodiments, the process of obtaining the source camera field of view and source mesh model of the virtual object may include: receiving a three-dimensional model data import request sent by the electronic device. This three-dimensional model data import request may be generated by the electronic device in response to the three-dimensional model data import operation of the virtual object. For example, after completing the model construction of the virtual object, the "Import" function button can be clicked to generate this three-dimensional model data import request, but it is not limited to this generation method described in this embodiment. Then, the game engine can parse this three-dimensional model data import request to obtain the source camera field of view and source mesh model of each virtual object.

[0108] It can be understood that the source camera field of view and source mesh model of each virtual object in the virtual application scene can be obtained in the above manner. In practical applications, the art production staff can directly import the source mesh model of each virtual object into the game engine after constructing it; or they can import all the source mesh models of each virtual object together after constructing them. This application does not limit this and can be determined according to the situation.

[0109] Moreover, in combination with the relevant descriptions of the computer device type in the corresponding part of the above embodiments, the above game engine can be deployed in the above electronic device. At this time, the above three-dimensional model data import request can be generated by a three-dimensional modeling tool in the electronic device. If the game engine is deployed on a server, the electronic device can establish a communication connection with it and send the generated three-dimensional model data import request to the server, so that the game engine can obtain the source camera field of view angle and source mesh model of each virtual object, etc.

[0110] Step S22: Compare the source camera field of view angles corresponding to each virtual object with the target camera field of view angle respectively.

[0111] Step S23: Determine the source camera field of view angle and source mesh model corresponding to the first virtual object according to the comparison result.

[0112] Continuing the above description, the present application only needs to perform perspective correction processing on virtual objects with unconventional perspective display requirements, that is, virtual objects corresponding to source camera field of view angles inconsistent with the target camera field of view angle, which are denoted as the first virtual objects. For virtual objects corresponding to source camera field of view angles consistent with the target camera field of view angle, they are denoted as the second virtual objects. The user hopes that the displayed perspective effect is the same as the perspective effect obtained by rendering the source mesh model according to the source camera field of view angle it has, so there is no need to perform perspective correction anymore. Therefore, the embodiments of the present application mainly perform perspective correction processing on the first virtual objects.

[0113] Exemplarily, during the operation of a horizontal game, the target camera field of view angle of the game scene at different times may be different, and according to the processing results of the three-dimensional modeling tool, the source camera field of view angles that can represent the rendering effects of each game object in the game scene will also have differences. The specific determination method can refer to the description of the corresponding part of the above embodiments. In this embodiment, taking the target camera field of view angles corresponding to different times shown in Table 1 and the source camera field of view angles of virtual object A and virtual object B in the game scene at that time as an example, the virtual object perspective processing scheme will be described.

[0114] Table 1

[0115]

[0116] As shown in Table 1 above, at the first moment of the horizontal game operation, the target camera field of view angle of the game scene is FOV1. At this time, the source camera field of view angles corresponding to virtual object A and virtual object B respectively, that is, the camera field of view angles of the rendered images obtained by rendering the source mesh model, are both consistent with the target camera field of view angle FOV1 at that time, indicating that the user's rendering effects of virtual object A and virtual object B displayed at this time are conventional perspective effects and do not require correction processing, and the source mesh models can be directly rendered and displayed.

[0117] When the game runs to the second moment, the target field of view angle of the game scene becomes FOV2. At this time, the source camera field of view angle corresponding to the virtual object A is also FOV2, and no perspective correction is required for the virtual object A. However, the source camera field of view angle of the virtual object B at this time is FOV1, which is inconsistent with the target camera field of view angle FOV2 at the second moment. The virtual object B can be used as the first virtual object, and the virtual object B can be perspectively corrected according to the virtual object perspective processing method proposed in this application.

[0118] It can be seen that in this application, by comparing the source camera field of view angle and the target camera field of view angle at the same moment, after determining the first virtual object corresponding to the inconsistency between the two, the source camera field of view angle and the source mesh model corresponding to the first virtual object are directly corrected in the subsequent process. For the second virtual object with the same comparison result, the model can be directly rendered without performing the subsequent correction processing steps. Therefore, the source camera field of view angle and the source mesh model involved in the subsequent correction processing steps refer to the relevant model data of the first virtual object.

[0119] Step S24: Obtain the first projection matrix of the target camera field of view angle, the second projection matrix of the source camera field of view angle of the first virtual object, the camera transformation matrix between the camera coordinate system and the world coordinate system, and the source vertex spatial positions corresponding to each vertex in the source mesh model.

[0120] Continuing with the scene example shown in Table 1 above, perspective correction needs to be performed on the virtual object B (i.e., the first virtual object). For the convenience of describing the subsequent processing process, this application symbolically represents each model parameter of the obtained virtual object B and the relevant parameters under the target camera field of view angle at the current moment.

[0121] Specifically, the source vertex spatial positions corresponding to each vertex in the source mesh model, that is, the vertex original world space coordinate positions, can be denoted as V world , the first projection matrix of the target camera field of view angle is denoted as M projection1 , the second projection matrix of the source camera field of view angle of the first virtual object is denoted as M projection2 , and the above camera transformation matrix is denoted as M view .

[0122] Step S25: Use the first projection matrix, the second projection matrix, and the camera transformation matrix to perform offset correction on the source vertex spatial positions to obtain the position offsets of the corresponding vertices in the world coordinate system.

[0123] Optionally, in order to implement the spatial position correction of each vertex in the source mesh model of the first virtual object, the embodiments of this application can obtain the position offsets of each vertex, that is, the world space coordinate position offsets V of each vertex, according to the following formula wpo, but not limited to the calculation method of this position offset described in this embodiment:

[0124] V WPO = V world × (M view × M projection2 × (M view × M projection1 ) -1 - I);

[0125] In the position offset calculation formula, I can represent the identity matrix, and () -1 can represent the inverse matrix. After obtaining each matrix according to the above method in the embodiments of the present application, the position offset calculation formula can be substituted to obtain the position offset of each vertex spatial coordinate position in the source mesh model of the first virtual object in the world coordinate system. The specific calculation process is not elaborated in the present application.

[0126] Step S26, according to the obtained multiple position offsets, perform spatial position offset correction on the corresponding vertices of the source mesh model to obtain the target mesh model of the first virtual object in the world coordinate system;

[0127] Combined with the above description of the mesh model of the virtual object, in the above manner, after determining the position offset of each vertex, the source spatial position of the corresponding vertex in the source mesh model can be adjusted according to the position offset to obtain the target spatial position of the vertex. At the same time, the change in the vertex spatial position will cause the deformation of each triangular face that makes up the mesh model, thereby causing the overall structure of the source mesh model to deform. The deformed mesh model is denoted as the target mesh model.

[0128] In some embodiments, for the vertex correction process of the source mesh model of the first virtual object, the animation deformator in the game engine can obtain the target mesh model of the first virtual object according to the preset model deformation rules by using the position offsets of each vertex. The specific implementation process is not elaborated in the present application.

[0129] Step S27, obtain the source camera state parameters under the source camera field of view angle in the world coordinate system;

[0130] In the present application, still taking the scenario example shown in Table 1 above, and Figure 8 the camera position correction schematic diagram of the projection on the YOZ plane of the world coordinate system shown as an example for illustration. It can be understood that since in the horizontal game scenario applicable to the present application, the camera has no rotation in the Z - axis direction of the world coordinate system, the present application Figure 8Taking only the case where the plane perpendicular to the screen plane in a landscape game is the YOZ plane as an example, the perspective projection correction process of virtual objects is described, but it is not limited thereto. According to needs, the plane perpendicular to the screen plane in a landscape game can also be configured as the XOZ plane. At this time, the perspective projection of virtual objects on the XOZ plane can be corrected, and the specific implementation process is similar. This application will not elaborate on this case.

[0131] Therefore, based on Figure 8 the schematic diagram of camera position correction shown, the source camera state parameters obtained in this embodiment may include the source camera spatial position (such as the original camera position of virtual object B under FOV1), the source camera pitch angle, and the first included angle pitch' of the source camera position vector. Among them, the first included angle pitch' may refer to the included angle between the source camera position vector and the first coordinate axis of the world coordinate system (specifically, it may be the Y-axis or the X-axis. This application only takes the first coordinate axis as the Y-axis as an example for description, and the projection processing method for the first coordinate axis being the X-axis is similar, and this application will not elaborate), and the source camera spatial position may include the first projection position of the source camera on the first plane (such as Figure 8 the YOZ plane shown) formed by the first coordinate axis and the second coordinate axis (such as the Z-axis) of the source camera in the world coordinate system. The first projection position may include the first coordinate c y of the source camera projection on the Y-axis of this world coordinate system (when obtaining the projection on the XOZ plane, this can be the X-axis here), and the second coordinate c z of the projection on the Z-axis of the world coordinate system. It can be seen that the source camera spatial position in this embodiment can be recorded as camera(c y , c z ).

[0132] It should be noted that the content included in the source camera state parameters under the above source camera field of view is not limited to the content listed above, and this application does not limit the acquisition method of each parameter. For example, after determining the origin O(target) of the world coordinate system, it can be calculated using the relevant data of the source mesh model and the operation data corresponding to the first virtual application scenario, etc., which can be determined according to the content of each parameter, and this application will not elaborate one by one.

[0133] Step S28, obtaining the target camera spatial position under the target camera field of view and the rendering correction parameters of the first virtual object according to the source camera state parameters;

[0134] Referring to Figure 8 shown, according to the principles of mathematical operations such as trigonometric functions, when knowing the source camera spatial position camera(c y , c z ), the first coordinate c y and the second coordinate cz , the camera source distance do between the source camera and the origin of the world coordinate system under the source camera field of view is obtained, that is

[0135] In this embodiment, the above rendering correction parameters may include, under the world coordinate system, the position correction parameters for the source rendering space position, and / or the model scaling ratio of the first virtual object. Among them, the position correction parameters may include the above-mentioned first coordinate c y , parameters such as the camera source pitch angle pitch and the first included angle pitch'; the acquisition method of the model scaling ratio dr may refer to but is not limited to the following implementation methods:

[0136] Using the source camera field of view FOV1 and the target camera field of view FOV2, the model scaling ratio dr of the first virtual object is obtained. Specifically, the calculation formula of the model scaling ratio dr can be constructed using the tangent function tan(), but it is not limited to this calculation formula:

[0137]

[0138] Step S29, using the rendering correction parameters, correct the source rendering space position of the first virtual object to obtain the target rendering space position;

[0139] Step S210, according to the target camera space position and the target rendering space position, render the target mesh model to obtain the target rendering image of the first virtual object.

[0140] In the embodiment of the present application, the above rendering correction parameters can be used to obtain the position offset value of the first virtual object, that is, the offset value of the source rendering space position, and the model scaling ratio of the first virtual object. In the model rendering stage, the target mesh model can be rendered according to the offset value of the source rendering space position and the model scaling ratio, so as to ensure that the screen space size of the target rendering image of the first virtual object obtained by rendering is the same as the screen space size of the source rendering image obtained by rendering the source mesh model.

[0141] It should be noted that, as Figure 6 shown, the above processes of correcting the vertex space position of the mesh model, the rendering space position correction process, and the camera space position correction process can be executed synchronously to improve the perspective correction efficiency; of course, they can also be implemented in other execution orders, and are not limited to the execution order of the above steps in this embodiment.

[0142] In summary, during the operation of applications such as horizontal games, the computer device can obtain the target camera field of view angle of the current first virtual application scene. After determining the first virtual object corresponding to the source camera field of view angle that is inconsistent with the target camera field of view angle in the first virtual application scene, the computer device can use the projection matrices of the target camera field of view angle and the source camera field of view angle, as well as the camera transformation matrix, to correct the spatial positions of the vertices of the source mesh model of the first virtual object, so as to obtain a target mesh model that can achieve the required perspective effect. At the same time, in order to ensure that the screen space size of the first virtual object remains unchanged, the computer device can also use the source camera state parameters to correct the rendering space position and the camera space position of the first virtual object, so that the computer device renders the target mesh model based on the target camera space position and the target rendering space position. After the target rendering image of the first virtual object is displayed, the required perspective projection visual effect can be achieved. It can be seen that the present application can perform perspective correction and model rendering during the operation of horizontal games, greatly improving the processing efficiency, and solving the technical problems that the reliability and accuracy of the method of manually deforming the lattice of the source mesh model by means of three-dimensional modeling tools are uncontrollable, and the target camera field of view angle of the game scene must be kept consistent with the preset source camera field of view angle.

[0143] Moreover, the present application can also be used to meet the unconventional perspective performance requirements in other fixed field of view games, improving the scope of application; when it is necessary to represent situations such as different dimensions in the game, according to the virtual object perspective processing method proposed in the present application, there is no need to switch scenes, and the current game state can be completely retained. It can be seen that, compared with the manual perspective correction processing method described in the background art, the present application improves the scope of application of the solution, greatly reduces the manual workload, and reduces the burden on art production personnel.

[0144] In some embodiments proposed in the present application, as described above Figure 8 shown, the present application can further refine the description of the above-described camera space position correction process and the rendering space position correction process of the first virtual object, but is not limited to the refinement processing method described in this embodiment. Regarding the vertex spatial position correction process of the source mesh model, reference can be made to the corresponding part of the above embodiment, and this embodiment will not be elaborated. As Figure 9 shown, the virtual object perspective processing method proposed in the present application may include:

[0145] Step S31, obtaining the source camera space position, the source camera pitch angle, and the first included angle of the source camera position vector under the source camera field of view angle in the world coordinate system;

[0146] Step S32, using the first coordinate and the second coordinate in the source camera space position to obtain the camera source distance between the source camera and the origin of the world coordinate system under the source camera field of view angle;

[0147] Step S33: Using the source camera field of view angle and the target camera field of view angle, obtain the model scaling ratio of the first virtual object;

[0148] Regarding the implementation processes of Steps S31 to S33, reference may be made to the descriptions of the corresponding parts in the above embodiments, and details are not described in this embodiment.

[0149] Step S34: Using the camera source distance and the model scaling ratio, obtain the camera distance offset;

[0150] Optionally, referring to Figure 8 the perspective projection correction schematic diagram on the YOZ plane shown in the figure, a suitable data operation formula can be used to calculate the camera distance offset dp using the above camera source distance do and model scaling ratio dr, that is, dp = do×(dr - 1), but it is not limited to this.

[0151] Step S35: Using the first coordinate, the camera source pitch angle, the first included angle, the camera distance offset, and the camera source distance, obtain the camera position offset under the target camera field of view angle;

[0152] As Figure 8 shown in the figure, the camera position offset may refer to the position offset offset of the target camera relative to the source camera projected on the Z axis.

[0153] Optionally, after the first coordinate c y , the camera source pitch angle pitch, the first included angle pitch’, the camera distance offset dp, and the camera source distance do in the embodiments of the present application, the following calculation formula can be used to calculate the position offset offset of the target camera space position on the Z axis, but it is not limited to this calculation method:

[0154]

[0155] Step S36: Using the camera position offset, the first included angle, the camera distance offset, and the camera source distance, obtain the third coordinate under the target camera field of view angle;

[0156] As Figure 8 shown in the figure, the above third coordinate refers to the coordinate of the target camera projected on the Z axis, which can be denoted as c z ’. Combining the numerical values of the various parameters obtained above, as Figure 8 shown in the figure, the present application can use the trigonometric function operation formula to calculate the coordinate of the target camera projected on the Z axis, that is, c z ’, such as c′ z = (do + dp)×sin(pitch′) - offset, but it is not limited to this calculation method.

[0157] Step S37: Obtain the fourth coordinate under the target camera field of view by using the first included angle, the camera distance offset, and the camera source distance;

[0158] Step S38: Determine the target camera spatial position under the target camera field of view based on the third coordinate and the fourth coordinate;

[0159] As Figure 8 shown, the fourth coordinate refers to the coordinate where the target camera is projected on the Y axis, which can be denoted as c y ’. Combining the numerical values of each parameter obtained above, as Figure 8 shown, this application can use the trigonometric function operation formula to calculate the fourth coordinate c y ’, that is, c′ y =(do + dp)×cos(pitch′), but it is not limited to this calculation method. At this time, in the world coordinate system, the target camera spatial position camera’(c y ’, c z ) under the target camera field of view in the YOZ plane can be obtained.

[0160] It should be noted that for the landscape game scene applicable to this application, the camera has no rotation in the Z-axis direction of the world coordinate system. The above embodiments only describe the perspective projection correction process of the virtual object in the YOZ plane of the world coordinate system. The process of perspective projection correction of the virtual object in the XOZ plane is similar, and this application will not elaborate.

[0161] Step S39: Obtain the target rendering spatial position of the first virtual object by using the camera position offset and the model scaling ratio.

[0162] Continuing the above description, in order to ensure that the screen space size of the first virtual object is consistent, the position offset value (0, 0, -offset) and the scaling value (dr, dr, dr) of the first virtual object can be determined according to the camera position offset offset and the model scaling ratio dr obtained above. During the rendering process of the target mesh model, the target rendering spatial position of the first virtual object can be determined based on these two parameters, ensuring that the target rendering image obtained by rendering the model can meet the required perspective effect. Figure 8

[0163] Referring to Figure 10 , it is a schematic structural diagram of an optional example of the virtual object perspective processing device proposed by this application. This device can be applicable to the above computer device. As Figure 10 shown, this device may include:

[0164] The first data acquisition module 21 is configured to acquire the target camera field of view angle of the first virtual application scenario, as well as the source camera field of view angle and the source mesh model of the first virtual object in the first virtual application scenario;

[0165] In some embodiments proposed in this application, the first data acquisition module 21 may include:

[0166] The first information acquisition unit is configured to acquire the target camera field of view angle of the first virtual application scenario, as well as the source camera field of view angle and the source mesh model corresponding to each virtual object in the first virtual application scenario;

[0167] Optionally, the first information acquisition unit may include:

[0168] The import request receiving unit is configured to receive a three-dimensional model data import request sent by an electronic device, where the three-dimensional model data import request is generated by the electronic device in response to an operation of importing the three-dimensional model data of the first virtual object;

[0169] The import request parsing unit is configured to parse the three-dimensional model data import request to obtain the source camera field of view angle and the source mesh model of the first virtual object.

[0170] The first comparison unit is configured to compare the source camera field of view angles corresponding to the respective virtual objects with the target camera field of view angle;

[0171] The first determination unit is configured to determine, according to the comparison result, the source camera field of view angle and the source mesh model corresponding to the first virtual object, where the first virtual object refers to the virtual object corresponding to the source camera field of view angle that is inconsistent with the target camera field of view angle.

[0172] The first position correction module 22 is configured to perform spatial position correction on each vertex of the source mesh model by using the projection matrices corresponding to the target camera field of view angle and the source camera field of view angle respectively, so as to obtain a target mesh model in the world coordinate system;

[0173] The second position correction module 23 is configured to perform offset correction on the source camera spatial position under the source camera field of view angle and the source rendering spatial position of the first virtual object according to the field of view angle change constraint condition, so as to obtain the target camera spatial position under the target camera field of view angle and the target rendering spatial position of the first virtual object;

[0174] The rendering module 24 is configured to render the target mesh model according to the target camera spatial position and the target rendering spatial position to obtain a target rendering image of the first virtual object.

[0175] In some embodiments proposed in this application, such as Figure 11As shown, the above-mentioned first position correction module 22 may include:

[0176] A second information acquisition unit 221, configured to acquire a first projection matrix of the target camera field of view angle, a second projection matrix of the source camera field of view angle, a camera transformation matrix between the camera coordinate system and the world coordinate system, and source vertex spatial positions corresponding to each vertex in the source mesh model;

[0177] A first offset correction unit 222, configured to perform offset correction on the source vertex spatial positions by using the first projection matrix, the second projection matrix, and the camera transformation matrix, to obtain position offsets of the corresponding vertices in the world coordinate system;

[0178] A second offset correction unit 223, configured to perform spatial position offset correction on the corresponding vertices of the source mesh model according to the obtained multiple position offsets, to obtain a target mesh model of the first virtual object in the world coordinate system.

[0179] In this embodiment, the above-mentioned field of view angle change constraint condition may include that the screen space size of the same virtual object is the same under different camera field of view angles. To ensure that the perspective-corrected virtual object meets this field of view angle change constraint condition, the above-mentioned second position correction module 23 may specifically include

[0180] A third information acquisition unit 231, configured to acquire source camera state parameters in the world coordinate system under the source camera field of view angle;

[0181] A fourth information acquisition unit 232, configured to obtain a target camera spatial position in the target camera field of view angle and rendering correction parameters of the first virtual object according to the source camera state parameters; wherein, the rendering correction parameters include position correction parameters for the source rendering spatial position in the world coordinate system, and / or a model scaling ratio for the first virtual object;

[0182] A third offset correction unit 234, configured to correct the source rendering spatial position of the first virtual object by using the rendering correction parameters, to obtain a target rendering spatial position.

[0183] In a possible implementation manner, the above-mentioned source camera state parameters may include a source camera spatial position, a source camera pitch angle, and a first included angle of the source camera position vector, where the first included angle is an included angle between the source camera position vector and the first coordinate axis of the world coordinate system, and the first coordinate axis may refer to the Y-axis or the X-axis of the world coordinate system, and the source camera spatial position includes a first coordinate projected by the source camera on the first coordinate axis and a second coordinate projected on the Z-axis of the world coordinate system.

[0184] Based on this, the above-mentioned fourth information acquisition unit 232 may include:

[0185] A camera source distance obtaining unit, configured to obtain the camera source distance between the source camera and the origin of the world coordinate system under the field of view angle of the source camera by using the first coordinate and the second coordinate;

[0186] A model scaling ratio obtaining unit, configured to obtain the model scaling ratio of the first virtual object by using the field of view angle of the source camera and the field of view angle of the target camera;

[0187] A target camera spatial position obtaining unit, configured to obtain the target camera spatial position under the field of view angle of the target camera according to the camera source distance, the model scaling ratio, and the first included angle;

[0188] A rendering correction parameter obtaining unit, configured to obtain the rendering correction parameter of the first virtual object according to the model scaling ratio, the first coordinate, the pitch angle of the camera source, and the first included angle.

[0189] Further, in some embodiments, the above-mentioned target camera spatial position obtaining unit may include:

[0190] A camera distance offset obtaining unit, configured to obtain a camera distance offset by using the camera source distance and the model scaling ratio;

[0191] A camera position offset obtaining unit, configured to obtain the camera position offset under the field of view angle of the target camera by using the first coordinate, the pitch angle of the camera source, the first included angle, the camera distance offset, and the camera source distance;

[0192] Wherein, the camera position offset refers to the position offset of the target camera relative to the projection of the source camera on the Z axis;

[0193] A third coordinate obtaining unit, configured to obtain the third coordinate under the field of view angle of the target camera by using the camera position offset, the first included angle, the camera distance offset, and the camera source distance;

[0194] Wherein, the third coordinate refers to the coordinate of the target camera projected on the Z axis;

[0195] A fourth coordinate obtaining unit, configured to obtain the fourth coordinate under the field of view angle of the target camera by using the first included angle, the camera distance offset, and the camera source distance;

[0196] Wherein, the fourth coordinate refers to the coordinate of the target camera projected on the first coordinate axis;

[0197] A target camera spatial position determination unit, configured to determine the spatial position of the target camera under the target camera field of view according to the third coordinate and the fourth coordinate;

[0198] Correspondingly, the above-mentioned rendering correction parameter obtaining unit may specifically be configured to form the rendering correction parameter of the first virtual object according to the camera position offset and the model scaling ratio.

[0199] It should be noted that, for various modules, units, etc. in the above-mentioned device embodiments, they can all be stored as program modules in the memory, and the processor executes the above-mentioned program modules stored in the memory to implement corresponding functions. For the functions implemented by each program module and its combination, and the achieved technical effects, reference can be made to the description of the corresponding part of the above method embodiments, and details are not described in this embodiment.

[0200] The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program is loaded and executed by a processor to implement the steps of the above-mentioned virtual object perspective processing method. The specific implementation process can refer to the description of the corresponding part of the above embodiment, and details are not described in this embodiment.

[0201] The present application also proposes a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various alternative implementations of the above-mentioned virtual object perspective processing method or the virtual object perspective processing device. The specific implementation process can refer to the description of the corresponding embodiment above, and details are not described.

[0202] Finally, it should be noted that the various embodiments in this specification are described in a progressive or parallel manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the devices and computer devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description of the method part.

[0203] Those skilled in the art may further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design presuppositions of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of this application.

[0204] The above description of the disclosed embodiments enables those skilled in the art to implement or use this application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the core idea or scope of this application. Therefore, this application will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A virtual object perspective processing method, characterized in that, The method includes: Obtaining a target camera field of view angle of a first virtual application scenario, a source camera field of view angle and a source mesh model of a first virtual object in the first virtual application scenario; the first virtual application scenario includes the first virtual object with a source camera field of view angle inconsistent with the target camera field of view angle, and a second virtual object with a source camera field of view angle consistent with the target camera field of view angle; Obtaining a first projection matrix of the target camera field of view angle, a second projection matrix of the source camera field of view angle, a camera transformation matrix between a camera coordinate system and a world coordinate system, and source vertex spatial positions corresponding to each vertex in the source mesh model; Using the first projection matrix, the second projection matrix and the camera transformation matrix to perform offset correction on the source vertex spatial positions to obtain position offsets of the corresponding vertices in the world coordinate system; According to the obtained multiple position offsets, performing spatial position offset correction on the corresponding vertices of the source mesh model to obtain a target mesh model of the first virtual object in the world coordinate system; Performing offset correction on the source camera spatial position under the source camera field of view angle and the source rendering spatial position of the first virtual object according to a field of view angle change constraint condition to obtain a target camera spatial position under the target camera field of view angle and a target rendering spatial position of the first virtual object; the field of view angle change constraint condition includes that the screen space size of the same virtual object is the same under different camera field of view angles; Rendering the target mesh model according to the target camera spatial position and the target rendering spatial position to obtain a target rendering image of the first virtual object.

2. The method according to claim 1, wherein The obtaining of the target camera field of view angle of the first virtual application scenario, the source camera field of view angle and the source mesh model of the first virtual object in the first virtual application scenario includes: Obtaining the target camera field of view angle of the first virtual application scenario, and the source camera field of view angles and source mesh models corresponding to each virtual object in the first virtual application scenario; Comparing the source camera field of view angles corresponding to each virtual object with the target camera field of view angle respectively; Determining the source camera field of view angle and the source mesh model corresponding to the first virtual object according to the comparison result.

3. The method according to claim 1 or 2, characterized in that, The method for obtaining the source camera field of view angle and the source mesh model of the first virtual object includes: Receiving a three-dimensional model data import request sent by an electronic device, where the three-dimensional model data import request is generated by the electronic device in response to an operation of importing three-dimensional model data of the first virtual object; Analyzing the three-dimensional model data import request to obtain the source camera field of view angle and the source mesh model of the first virtual object.

4. The method according to claim 1, characterized in that The performing of offset correction on the source camera spatial position under the source camera field of view angle and the source rendering spatial position of the first virtual object according to the field of view angle change constraint condition to obtain the target camera spatial position under the target camera field of view angle and the target rendering spatial position of the first virtual object includes: Obtaining source camera state parameters in the world coordinate system under the source camera field of view angle; Based on the source camera state parameters, obtain the target camera spatial position under the field of view angle of the target camera and the rendering correction parameters of the first virtual object; wherein, the rendering correction parameters include the position correction parameters of the source rendering spatial position in the world coordinate system and / or the model scaling ratio of the first virtual object. Use the rendering correction parameters to correct the source rendering spatial position of the first virtual object to obtain the target rendering spatial position.

5. The method according to claim 4, wherein The source camera state parameters include the source camera spatial position, the source camera pitch angle, and the first included angle of the source camera position vector, where the first included angle is the included angle between the source camera position vector and the first coordinate axis of the world coordinate system, the first coordinate axis includes the Y-axis or the X-axis, the source camera spatial position includes the first coordinate projected by the source camera on the first coordinate axis and the second coordinate projected on the second coordinate axis of the world coordinate system, and the second coordinate axis includes the Z-axis. The obtaining of the target camera spatial position under the field of view angle of the target camera and the rendering correction parameters of the first virtual object based on the source camera state parameters includes: Use the first coordinate and the second coordinate to obtain the camera source distance between the source camera and the origin of the world coordinate system under the field of view angle of the source camera. Use the field of view angle of the source camera and the field of view angle of the target camera to obtain the model scaling ratio of the first virtual object. Based on the camera source distance, the model scaling ratio, and the first included angle, obtain the target camera spatial position under the field of view angle of the target camera. Based on the model scaling ratio, the first coordinate, the camera source pitch angle, and the first included angle, obtain the rendering correction parameters of the first virtual object.

6. The method according to claim 5, wherein The obtaining of the target camera spatial position under the field of view angle of the target camera based on the camera source distance, the model scaling ratio, and the first included angle includes: Use the camera source distance and the model scaling ratio to obtain the camera distance offset. Use the first coordinate, the camera source pitch angle, the first included angle, the camera distance offset, and the camera source distance to obtain the camera position offset under the field of view angle of the target camera, where the camera position offset is the position offset of the target camera relative to the position projected by the source camera on the Z-axis. Use the camera position offset, the first included angle, the camera distance offset, and the camera source distance to obtain the third coordinate under the field of view angle of the target camera, where the third coordinate is the coordinate projected by the target camera on the Z-axis. Use the first included angle, the camera distance offset, and the camera source distance to obtain the fourth coordinate under the field of view angle of the target camera, where the fourth coordinate is the coordinate projected by the target camera on the first coordinate axis. Determine the target camera spatial position under the field of view angle of the target camera from the third coordinate and the fourth coordinate. Obtaining the rendering correction parameters of the first virtual object according to the model scaling ratio, the first coordinate, the pitch angle of the camera source, and the first included angle includes: The rendering correction parameters of the first virtual object are constituted by the camera position offset and the model scaling ratio.

7. A virtual object perspective processing device, characterized in that The device includes: A first data acquisition module, configured to acquire a target camera field of view angle of a first virtual application scene, and a source camera field of view angle and a source mesh model of a first virtual object in the first virtual application scene; the first virtual application scene includes the first virtual object whose source camera field of view angle is inconsistent with the target camera field of view angle, and a second virtual object whose source camera field of view angle is consistent with the target camera field of view angle; A first position correction module, including: a second information acquisition unit, a first offset correction unit, and a second offset correction unit; The second information acquisition unit is configured to acquire a first projection matrix of the target camera field of view angle, a second projection matrix of the source camera field of view angle, a camera transformation matrix between the camera coordinate system and the world coordinate system, and source vertex spatial positions corresponding to each vertex in the source mesh model; The first offset correction unit is configured to perform offset correction on the source vertex spatial positions by using the first projection matrix, the second projection matrix, and the camera transformation matrix to obtain the position offset of the corresponding vertex in the world coordinate system; The second offset correction unit is configured to perform spatial position offset correction on the corresponding vertices of the source mesh model according to the obtained multiple position offsets to obtain a target mesh model of the first virtual object in the world coordinate system; A second position correction module is configured to perform offset correction on the source camera spatial position under the source camera field of view angle and the source rendering spatial position of the first virtual object according to the field of view angle change constraint condition to obtain the target camera spatial position under the target camera field of view angle and the target rendering spatial position of the first virtual object; the field of view angle change constraint condition includes that the screen space size of the same virtual object is the same under different camera field of view angles; A rendering module is configured to render the target mesh model according to the target camera spatial position and the target rendering spatial position to obtain a target rendering image of the first virtual object.

8. The device according to claim 7, characterized in that, The first data acquisition module includes: A first information acquisition unit, configured to acquire a target camera field of view angle of a first virtual application scene, and a source camera field of view angle and a source mesh model corresponding to each virtual object in the first virtual application scene; A first comparison unit, configured to respectively compare the source camera field of view angles corresponding to the virtual objects with the target camera field of view angle; A first determination unit, configured to determine the source camera field of view angle and the source mesh model corresponding to the first virtual object according to the comparison result.

9. The device according to claim 7 or 8, characterized in that, The first information acquisition unit includes: An import request receiving unit, configured to receive a three-dimensional model data import request sent by an electronic device, where the three-dimensional model data import request is generated by the electronic device in response to an operation of importing three-dimensional model data of a first virtual object; An import request parsing unit for parsing the three-dimensional model data import request to obtain the source camera field of view angle and the source mesh model of the first virtual object.

10. The device according to claim 7, characterized in that, The second position correction module includes: A third information acquisition unit for acquiring source camera state parameters in the world coordinate system under the source camera field of view angle; A fourth information acquisition unit for obtaining the target camera spatial position under the target camera field of view angle and the rendering correction parameters of the first virtual object according to the source camera state parameters; wherein, the rendering correction parameters include position correction parameters for the source rendering spatial position in the world coordinate system and / or the model scaling ratio of the first virtual object; A third offset correction unit for correcting the source rendering spatial position of the first virtual object by using the rendering correction parameters to obtain the target rendering spatial position.

11. The device according to claim 10, characterized in that, The source camera state parameters include the source camera spatial position, the source camera pitch angle, and a first included angle of the source camera position vector, where the first included angle is the included angle between the source camera position vector and the first coordinate axis of the world coordinate system, the first coordinate axis includes the Y-axis or the X-axis, the source camera spatial position includes a first coordinate projected by the source camera on the first coordinate axis and a second coordinate projected on the second coordinate axis of the world coordinate system, and the second coordinate axis includes the Z-axis; The fourth information acquisition unit includes: A camera source distance obtaining unit for obtaining the camera source distance between the source camera and the origin of the world coordinate system under the source camera field of view angle by using the first coordinate and the second coordinate; A model scaling ratio obtaining unit for obtaining the model scaling ratio of the first virtual object by using the source camera field of view angle and the target camera field of view angle; A target camera spatial position obtaining unit for obtaining the target camera spatial position under the target camera field of view angle according to the camera source distance, the model scaling ratio, and the first included angle; A rendering correction parameter obtaining unit for obtaining the rendering correction parameters of the first virtual object according to the model scaling ratio, the first coordinate, the camera source pitch angle, and the first included angle.

12. The device according to claim 11, characterized in that, The target camera spatial position obtaining unit includes: A camera distance offset obtaining unit for obtaining a camera distance offset by using the camera source distance and the model scaling ratio; A camera position offset obtaining unit for obtaining the camera position offset under the target camera field of view angle by using the first coordinate, the camera source pitch angle, the first included angle, the camera distance offset, and the camera source distance, where the camera position offset is the position offset of the target camera relative to the position projected by the source camera on the Z-axis; A third coordinate obtaining unit for obtaining the third coordinate under the target camera field of view angle by using the camera position offset, the first included angle, the camera distance offset, and the camera source distance, where the third coordinate is the coordinate projected by the target camera on the Z-axis; A fourth coordinate obtaining unit, configured to obtain a fourth coordinate under the target camera field of view by using the first included angle, the camera distance offset, and the camera source distance, where the fourth coordinate refers to the coordinate of the target camera projected on the first coordinate axis; A target camera spatial position determining unit, configured to determine the spatial position of the target camera under the target camera field of view according to the third coordinate and the fourth coordinate; The rendering correction parameter obtaining unit is configured to constitute a rendering correction parameter of the first virtual object according to the camera position offset and the model scaling ratio.

13. A computer device, characterized in that, The computer device includes: A communication module; A memory, configured to store a program of the virtual object perspective processing method according to any one of claims 1-6; A processor, configured to load and execute the program stored in the memory, and implement the steps of the virtual object perspective processing method according to any one of claims 1-6.

14. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded and executed by a processor to implement the steps of the virtual object perspective processing method according to any one of claims 1-6.

15. A computer program product, characterized in that, The computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps of the virtual object perspective processing method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Three-dimensional interface display device, method and terminal

    CN102523473A