Image rendering method, device, apparatus and storage medium

CN115761197BActive Publication Date: 2026-09-25BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211469457.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-22
Publication Date
2026-09-25
Estimated Expiration
2042-11-22

AI Technical Summary

Technical Problem

发生形变的虚拟模型会影响图像的显示效果,使得图像不自然

Benefits of technology

[0017]本公开实施例公开了一种图像渲染方法、装置、设备及存储介质,获取3D虚拟模型,并接收用户输入的初始变换信息;其中,3D虚拟模型由多个顶点构成,初始变换信息包括缩放信息、旋转信息及平移信息中的至少一项;根据初始变换信息对3D虚拟模型分别进行第一投影类型和第二投影类型的转换,获得第一投影模型和第二投影模型;根据第一投影模型和第二投影模型控制3D虚拟模型在屏幕坐标系下平移,获得目标图像。本公开实施例提供的图像渲染方法,对3D虚拟模型进行两种投影类型的转换,以基于转换后的第一投影模型和第二投影模型控制3D虚拟模型在屏幕坐标系下平移,可以保证投影到屏幕坐标系下的虚拟模型在移动时只是发生平移,未发生形变,使得投影后的虚拟模型显示更自然,从而提高图像的显示效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115761197B_ABST
    Figure CN115761197B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a kind of image rendering method, device, equipment and storage medium. Including: obtaining 3D virtual model and user input initial transformation information;According to the initial transformation information, the 3D virtual model is respectively converted to the first projection type and the second projection type, obtains first projection model and second projection model;According to the first projection model and the second projection model, the 3D virtual model is translated under screen coordinate system, obtains target image. The image rendering method provided in the embodiments of the present disclosure is converted to two projection types for 3D virtual model, to control 3D virtual model translation under screen coordinate system based on the first projection model and the second projection model after conversion, it can be guaranteed that the virtual model projected into screen coordinate system only occurs translation when moving, does not occur deformation, so that the virtual model after projection is displayed more naturally, to improve the display effect of image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and in particular to an image rendering method, apparatus, device, and storage medium. Background Technology

[0002] When performing perspective projection on a 3D virtual model, perspective creates the effect of objects appearing larger when closer and smaller when farther away. Since the virtual camera's pose remains constant during perspective projection, the projected virtual model will deform if it moves. This deformation affects the image display, making the image appear unnatural. Summary of the Invention

[0003] This disclosure provides an image rendering method, apparatus, device, and storage medium that can prevent the projected virtual model from deforming when it moves, making the projected virtual model display more natural and thus improving the image display effect.

[0004] In a first aspect, embodiments of this disclosure provide an image rendering method, including:

[0005] Acquire a 3D virtual model and receive initial transformation information input by the user; wherein the 3D virtual model is composed of multiple vertices, and the transformation information includes at least one of scaling information, rotation information, and translation information;

[0006] Based on the initial transformation information, the 3D virtual model is converted into a first projection type and a second projection type to obtain a first projection model and a second projection model.

[0007] The 3D virtual model is controlled to translate in the screen coordinate system according to the first projection model and the second projection model to obtain the target image.

[0008] Secondly, embodiments of this disclosure also provide an image rendering apparatus, characterized in that it includes:

[0009] An initial transformation information acquisition module is used to acquire a 3D virtual model and receive initial transformation information input by the user; wherein, the 3D virtual model is composed of multiple vertices, and the transformation information includes at least one of scaling information, rotation information, and translation information;

[0010] The projection conversion module is used to convert the 3D virtual model into a first projection type and a second projection type according to the initial transformation information, so as to obtain a first projection model and a second projection model.

[0011] The target image acquisition module is used to control the 3D virtual model to translate in the screen coordinate system according to the first projection model and the second projection model to obtain the target image.

[0012] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:

[0013] One or more processors;

[0014] Storage device for storing one or more programs.

[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the image rendering method as described in the embodiments of this disclosure.

[0016] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image rendering method as described in embodiments of this disclosure.

[0017] This disclosure provides an image rendering method, apparatus, device, and storage medium. The method acquires a 3D virtual model and receives initial transformation information input by a user. The 3D virtual model consists of multiple vertices, and the initial transformation information includes at least one of scaling, rotation, and translation information. Based on the initial transformation information, the 3D virtual model is converted to a first projection type and a second projection type to obtain a first projection model and a second projection model. The 3D virtual model is then controlled to translate in a screen coordinate system based on the first and second projection models to obtain a target image. The image rendering method provided in this disclosure converts the 3D virtual model to two projection types and controls its translation in a screen coordinate system based on the converted first and second projection models. This ensures that the virtual model projected onto the screen coordinate system only undergoes translation without deformation during movement, resulting in a more natural display and improved image display quality. Attached Figure Description

[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0019] Figure 1 This is a schematic flowchart of an image rendering method provided in an embodiment of this disclosure;

[0020] Figure 2a This is an example image of 3D text rendered using existing technology in an embodiment of this disclosure;

[0021] Figure 2bThis is an example diagram illustrating the rendering of 3D text using the technology of this embodiment.

[0022] Figure 2c This is an example diagram illustrating the rendering of a 3D object using existing technology, as described in this disclosure.

[0023] Figure 2d This is an example diagram illustrating the rendering of a 3D object using the technology of this embodiment.

[0024] Figure 3 This is a schematic diagram of the structure of an image rendering apparatus provided in an embodiment of this disclosure;

[0025] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0026] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0027] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0028] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0029] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0030] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0031] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0032] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0033] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0034] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0035] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0036] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0037] Figure 1 This is a flowchart illustrating an image rendering method provided in an embodiment of the present disclosure. This embodiment is applicable to the situation of rendering a 3D virtual model into a 2D image. The method can be executed by an image rendering device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal, a PC, or a server.

[0038] like Figure 1 As shown, the method includes:

[0039] S110, acquire the initial transformation information of the 3D virtual model and user input.

[0040] The 3D virtual model consists of multiple vertices, and its initial transformation information includes at least one of scaling, rotation, and translation information. The vertices of the 3D virtual model are represented by three-dimensional coordinates in the model's local spatial coordinate system. A 3D virtual model can be understood as a virtual model of a pre-constructed 3D object; the 3D object can be any object such as a physical object, a human body, or text, without limitation here.

[0041] The scaling information can be composed of scaling amounts along the X, Y, and Z axes; the rotation information can be composed of rotation amounts around the X, Y, and Z axes; and the translation information can be composed of translation amounts along the X, Y, and Z axes. In this embodiment, the initial transformation information can be represented by a transformation matrix (Model matrix). Specifically, the process of obtaining the initial transformation information input by the user can be as follows: first, receive any one of the scaling, rotation, and translation information input by the user; then, determine the scaling matrix based on the scaling information; determine the rotation matrix based on the rotation information; determine the translation matrix based on the translation information; and finally, perform dot product of the scaling matrix, rotation matrix, and translation matrix sequentially to obtain the initial transformation matrix, i.e., the initial transformation information.

[0042] S120, Based on the initial transformation information, the 3D virtual model is converted into a first projection type and a second projection type respectively to obtain a first projection model and a second projection model.

[0043] The first projection type can be perspective projection, and the second projection type can be orthographic projection. Perspective projection can be understood as projecting a 3D object onto a projection plane using central projection, thus obtaining a one-sided projection image that closely resembles the visual effect. Orthographic projection can be understood as projection where the projection lines are perpendicular to the projection plane.

[0044] In this embodiment, the process of projecting the 3D virtual model based on the initial transformation information can be as follows: first, obtain the projection information and viewpoint information; then, determine the projection transformation information based on the initial transformation information, projection information, and viewpoint information; and finally, perform projection transformation on the 3D virtual model based on the projection transformation information.

[0045] The perspective projection information represents the perspective transformation from the camera coordinate system to the screen coordinate system, while the viewpoint information represents the transformation from the world coordinate system to the camera coordinate system. The camera coordinate system is the coordinate system where the virtual camera resides, and the world coordinate system is the coordinate system where the 3D virtual model resides. Projection transformation information can be represented by a Model-View-Projection (MVP) matrix. Transformation information is represented by a transformation matrix (Model matrix), viewpoint information by a view matrix (View matrix), and projection information by a projection matrix (Projection matrix). The projection transformation information can be determined by sequentially multiplying the projection matrix, viewpoint matrix, and initial transformation matrix to obtain the MVP matrix. The projection transformation of the 3D virtual model based on the projection transformation information can be performed by multiplying the MVP matrix by the four-dimensional coordinates of each vertex of the 3D virtual model to obtain the projected model. For example, the calculation formula for the projection model can be expressed as: Position1 = P * V * M * Position0, where Position1 represents the coordinates of the vertex in the projection model, P represents the projection matrix, V represents the view matrix, M represents the transformation matrix, and Position0 represents the coordinates of the vertex in the 3D virtual model.

[0046] In this embodiment, the viewpoint matrix can be determined by pre-set virtual camera parameters, which may include the optical center position and the camera viewpoint. Projection information is determined by the near-plane and far-plane parameters of the virtual camera. For perspective projection, the perspective projection matrix can be expressed as: For orthogonal projection, the orthogonal projection matrix can be expressed as: Where n is the z-coordinate of the near plane, f is the z-coordinate of the far plane, t and b are the y-coordinates of the top and bottom sides of the near plane, and l and r are the x-coordinates of the left and right sides of the near plane.

[0047] Optionally, the method for converting the 3D virtual model to a first projection type based on the initial transformation information to obtain the first projection model can be: obtaining perspective projection information and viewpoint information; adjusting the translation information in the initial transformation information to obtain the first transformation information; and performing perspective projection conversion on the 3D virtual model based on the first transformation information, perspective projection information, and viewpoint information to obtain the perspective projection model.

[0048] In this embodiment, the perspective projection information is represented by the perspective projection matrix determined in the above embodiments, and the viewpoint information is determined by the viewpoint matrix determined in the above embodiments. The method for adjusting the translation information in the initial transformation information to obtain the first transformation information can be as follows: determine a first adjustment amount based on the translation information in the initial transformation information and a first set value; adjust the translation information based on the first adjustment amount to obtain the first transformation information.

[0049] The first set value is 0, or a value close to 0. Specifically, adjusting the translation information in the initial transformation information can be understood as adjusting the x and y components of the translation information in the initial transformation information. Determining the first adjustment amount based on the translation information in the initial transformation information and the first set value can be understood as subtracting the translation information from the first set value to obtain the first adjustment amount. Adjusting the translation information based on the first adjustment amount can be understood as accumulating the translation information and the first adjustment amount. In this embodiment, the initial transformation information is represented by a transformation matrix, and the size of the transformation matrix is ​​4*4. The x component of the translation information is located in the 1st row and 4th column, and the y component is located in the 2nd row and 4th column, that is, the values ​​in the 1st row and 4th column and the 2nd row and 4th column of the transformation matrix are adjusted based on the first set value.

[0050] Specifically, the process of performing perspective projection transformation on the 3D virtual model based on the first transformation information, perspective projection information, and viewpoint information is as follows: The perspective projection matrix corresponding to the perspective projection information, the viewpoint matrix corresponding to the viewpoint information, and the transformation matrix corresponding to the first transformation information are sequentially multiplied by a dot to obtain the perspective transformation matrix. Then, the perspective transformation matrix is ​​multiplied by the four-dimensional coordinates of each vertex of the 3D virtual model to obtain the perspective projection model. In this embodiment, each vertex in the perspective projection model is represented by a four-dimensional vector, for example, pos1 = (x1, y1, z1, w1). In this embodiment, when performing perspective projection transformation on the 3D virtual model, the translation information in the transformation matrix is ​​adjusted based on a first set value, so that the translation information has a smaller impact during perspective projection, thereby reducing the deformation of the 3D virtual model during translation.

[0051] Optionally, the 3D virtual model can be converted to a second projection type based on the initial transformation information to obtain the second projection model. This can be achieved by: acquiring orthographic projection information and viewpoint information; adjusting the rotation and scaling amounts in the initial transformation information to obtain the second transformation information; and performing orthographic projection conversion on the 3D virtual model based on the second transformation information, orthographic projection information, and viewpoint information to obtain the orthographic projection model.

[0052] In this system, perspective projection information represents the orthogonal transformation relationship from the camera coordinate system to the screen coordinate system, and viewpoint information represents the transformation relationship from the world coordinate system to the camera coordinate system. The camera coordinate system is the coordinate system where the virtual camera used for rendering resides, and the world coordinate system is the coordinate system where the 3D virtual model resides. Orthogonal projection information is represented by the orthogonal projection matrix determined in the above embodiments, and viewpoint information is represented by the viewpoint matrix determined in the above embodiments. The method for obtaining the second transformation information by adjusting the rotation and scaling information in the initial transformation information can be as follows: determining a second adjustment amount based on the rotation information and a second set value in the initial transformation information; determining a third adjustment amount based on the scaling information and a third set value in the initial transformation information; adjusting the rotation information based on the second adjustment amount; and adjusting the scaling information based on the third adjustment amount to obtain the second transformation information.

[0053] The second setting value is either 0 or close to 0, or 1 or close to 1. Specifically, determining the second adjustment amount based on the rotation information in the initial transformation information and the second setting value can be understood as subtracting the rotation information from the second setting value to obtain the second adjustment amount. Adjusting the rotation information based on the second adjustment amount can be understood as adding the second adjustment amount to the rotation information. In this embodiment, the initial transformation information is represented by a transformation matrix, and the size of the transformation matrix is ​​4*4. The six components of the rotation information are located in the first row and second column, the first row and third column, the second row and first column, the second row and third column, the third row and first row, and the third row and second column. These six components are adjusted based on the second setting value. Optionally, in this embodiment, these six components can be directly adjusted to 0. Determining the third adjustment amount based on the scaling information in the initial transformation information and the third setting value can be understood as subtracting the scaling information from the third setting value to obtain the third adjustment amount. Adjusting the scaling information based on the third adjustment amount can be understood as adding the third adjustment amount to the scaling information.

[0054] The scaling information includes scaling along the x-axis, scaling along the y-axis, and scaling along the z-axis. In this embodiment, the scaling along the x-axis is located in the first row and first column, the scaling along the y-axis is located in the second row and second column, and the scaling along the z-axis is located in the third row and third column. These three values ​​are then adjusted based on a third set value. Optionally, these three values ​​can be directly adjusted to 1.

[0055] Specifically, the process of orthogonally projecting a 3D virtual model based on the second transformation information, orthogonal projection information, to obtain an orthogonal projection model can be as follows: The orthogonal projection matrix corresponding to the orthogonal projection information, the viewpoint matrix corresponding to the viewpoint information, and the transformation matrix corresponding to the second transformation information are sequentially multiplied by a dot to obtain an orthogonal transformation matrix. Then, the orthogonal transformation matrix is ​​multiplied by the four-dimensional coordinates of each vertex of the 3D virtual model to obtain the orthogonal projection model. In this embodiment, each vertex in the orthogonal projection model is represented by a four-dimensional vector, for example, pos2 = (x2, y2, z2, w2). In this embodiment, when performing orthogonal projection on the 3D virtual model, the rotation information in the transformation matrix is ​​adjusted based on a second set value, and the scaling information is adjusted based on a third set value, which can reduce the influence of rotation and scaling information on the orthogonal projection.

[0056] S130, control the 3D virtual model to translate in the screen coordinate system according to the first projection model and the second projection model to obtain the target image.

[0057] Translation can be understood as the 3D virtual model changing only its position in the screen coordinate system, without changing its shape.

[0058] Specifically, the method of controlling the translation of the 3D virtual model in the screen coordinate system according to the first projection model and the second projection model to obtain the target image can be: fusing the first projection model and the second projection model to obtain the target projection model; rendering the target projection model to obtain the target image.

[0059] In this embodiment, fusing the first projection model and the second projection model can be understood as fusing the coordinates of the corresponding vertices of the first projection model and the second projection model to obtain the fused vertex coordinates, and the fused vertices constitute the target projection model.

[0060] Specifically, the method to fuse the first projection model and the second projection model to obtain the target projection model can be as follows: extract the vertex coordinate information from the first projection model; and linearly superimpose the second projection model and the first projection model based on the vertex coordinate information to obtain the target projection model.

[0061] In this model, the vertex coordinates are represented by four-dimensional coordinates, namely the x-component, y-component, z-component, and w-component. The process of linearly superimposing the second and first projection models based on their vertex coordinates can be as follows: multiply the w-component of the vertex coordinates of the first projection model by the vertex coordinates of the second projection model, and then sum the result with the vertex coordinates of the first projection model to obtain the target projection model. For example, assuming the vertex coordinates of the first projection model are represented as pos1 = (x1, y1, z1, w1) and pos2 = (x2, y2, z2, w2), the formula for fusing the first and second projection models can be expressed as: POS = pos1 + pos2 * w1, where POS represents the vertex coordinates of the target projection model, and POS = (x1 + x2 * w1, y1 + y2 * w1, z1 + z2 * w1, w1 + w2 * w1). In this embodiment, the first projection model after perspective projection and the second projection model after orthographic projection are fused to ensure that the fused target projection model only undergoes translation in the screen coordinate system and does not deform during the movement.

[0062] In this embodiment, rendering the target projection model can be understood as rendering the target projection model into a 2D image.

[0063] In this model, the vertices of the target projection model are represented by four-dimensional coordinates, including: a first component, a second component, a third component, and a fourth component. The first component is the x-component, the second component is the y-component, the third component is the z-component, and the fourth component is the w-component. Specifically, the target image can be obtained by rendering the target projection model by performing a homogeneous transformation on the vertex coordinates of the target projection model; and then rendering the homogeneous transformed target projection model to obtain the target image.

[0064] The homogeneous transformation of the vertex coordinates of the target projection model can be understood as dividing the vertex coordinates of the target projection model by the fourth component (i.e., the w component). For example, assuming the vertex coordinates of the target projection model are represented as: POS = (x1 + x2 * w1, y1 + y2 * w1, z1 + z2 * w1, w1 + w2 * w1), then after the homogeneous transformation, they become ((x1 + x2 * w1) / (w1 + w2 * w1), (y1 + y2 * w1) / (w1 + w2 * w1), (z1 + z2 * w1) / (w1 + w2 * w1), 1). In this embodiment, performing a homogeneous transformation on the vertex coordinates of the target projection model can improve the accuracy of subsequent rendering.

[0065] Optionally, the target image can be obtained by rendering the homogeneous transformed target projection model by extracting the two components corresponding to the screen coordinate system in the vertex coordinates of the homogeneous transformed target projection model; and rendering the 3D virtual model onto the screen based on the two components to obtain the target image.

[0066] In this embodiment, the two components corresponding to the screen coordinate system are the x-component and the y-component. Specifically, the x-component and y-component of the vertex coordinates in the homogeneous transformed target projection model are extracted. These x-components and y-components constitute the position information of the vertex of the target projection model in the screen coordinate system. Finally, the pixel values ​​of the vertex of the target projection model are rendered to their corresponding positions in the screen coordinate system, thereby obtaining the target image. In this embodiment, based on the two components corresponding to the screen coordinate system, the 3D virtual model can be accurately rendered onto the screen. For example, Figure 2a The image shown is an example of rendering 3D text using existing technology. The left image is the image of the 3D text before it was moved, and the right image is the image of the 3D text after it was moved. Comparing the two images, it can be seen that the 3D text has undergone obvious deformation, making the display of the 3D text unnatural. Figure 2b The following is an example image of 3D text rendered using the technology of this embodiment. The left image is the image of the 3D text before it is moved, and the right image is the image of the 3D text after it is moved. Comparing the two images, it can be seen that the 3D text is not deformed, making the display of the 3D text more natural and improving the display effect. Figure 2c The image shown is an example of rendering a 3D object using existing technology. The left image is the image of the 3D object before it is moved, and the right image is the image of the 3D object after it is moved. Comparing the two images, it can be seen that the 3D object has undergone obvious deformation, making the display of the 3D object unnatural. Figure 2d The image shown is an example of rendering a 3D object using the technology of this embodiment. The left image is of the 3D object before it is moved, and the right image is of the 3D object after it has been moved. Comparing the two images, it can be seen that the 3D object has not undergone deformation, making the display of the 3D object more natural and improving the display effect. Optionally, the 3D virtual model in this embodiment can also be any object, such as a person, animal, plant, etc., and this embodiment is not limited thereto.

[0067] The technical solution of this disclosure involves acquiring a 3D virtual model and receiving initial transformation information input by the user. The 3D virtual model consists of multiple vertices, and the initial transformation information includes at least one of scaling, rotation, and translation information. Based on the initial transformation information, the 3D virtual model is converted to a first projection type and a second projection type to obtain a first projection model and a second projection model. The 3D virtual model is then controlled to translate in the screen coordinate system based on the first and second projection models to obtain a target image. The image rendering method provided by this disclosure converts the 3D virtual model to two projection types and controls its translation in the screen coordinate system based on the converted first and second projection models. This ensures that the virtual model projected onto the screen coordinate system only undergoes translation without deformation during movement, resulting in a more natural display of the projected virtual model and thus improving the image display effect.

[0068] Figure 3 This is a schematic diagram of the structure of an image rendering apparatus provided in an embodiment of the present disclosure, as shown below. Figure 3 As shown, the device includes:

[0069] The initial transformation information acquisition module 310 is used to acquire a 3D virtual model and receive initial transformation information input by the user; wherein, the 3D virtual model is composed of multiple vertices, and the initial transformation information includes at least one of scaling information, rotation information, and translation information;

[0070] The projection conversion module 320 is used to convert the 3D virtual model into a first projection type and a second projection type according to the initial transformation information to obtain a first projection model and a second projection model.

[0071] The target image acquisition module 330 is used to control the 3D virtual model to translate in the screen coordinate system according to the first projection model and the second projection model to obtain the target image.

[0072] Optionally, the first projection type is perspective projection, and the projection conversion module 320 is also used for:

[0073] Obtain perspective projection information and viewpoint information; whereby, perspective projection information represents the perspective transformation relationship from the camera coordinate system to the screen coordinate system, and viewpoint information represents the transformation relationship from the world coordinate system to the camera coordinate system; the camera coordinate system is the coordinate system in which the virtual camera used for rendering is located, and the world coordinate system is the coordinate system in which the 3D virtual model is located;

[0074] The translation information in the initial transformation information is adjusted to obtain the first transformation information;

[0075] Based on the first transformation information, perspective projection information, and viewpoint information, the 3D virtual model is transformed by perspective projection to obtain a perspective projection model.

[0076] Optionally, the projection conversion module 320 is also used for:

[0077] The first adjustment amount is determined based on the translation information in the initial transformation information and the first set value;

[0078] The translation information is adjusted based on the first adjustment amount to obtain the first transformation information.

[0079] Optionally, the second projection type is orthographic projection, and the projection conversion module 320 is also used for:

[0080] Obtain orthogonal projection information and view information; among which, perspective projection information represents the orthogonal transformation relationship from the camera coordinate system to the screen coordinate system, and view information represents the transformation relationship from the world coordinate system to the camera coordinate system; the camera coordinate system is the coordinate system in which the virtual camera used for rendering is located, and the world coordinate system is the coordinate system in which the 3D virtual model is located;

[0081] The rotation and scaling information in the initial transformation information are adjusted to obtain the second transformation information;

[0082] Based on the second transformation information, orthogonal projection information, and viewpoint information, the 3D virtual model is orthogonally projected to obtain an orthogonal projection model.

[0083] Optionally, the projection conversion module 320 is also used for:

[0084] The second adjustment amount is determined based on the rotation information in the initial transformation information and the second set value;

[0085] The third adjustment amount is determined based on the scaling information in the initial transformation information and the third setting value;

[0086] The rotation information is adjusted based on the second adjustment amount, and the scaling information is adjusted based on the third adjustment amount to obtain the second transformation information.

[0087] Optionally, the target image acquisition module 330 is also used for:

[0088] The first projection model and the second projection model are fused to obtain the target projection model;

[0089] Render the target projection model to obtain the target image.

[0090] Optionally, the target image acquisition module 330 is also used for:

[0091] Extract the vertex coordinates from the first projection model;

[0092] The target projection model is obtained by linearly superimposing the second projection model and the first projection model based on the vertex coordinates.

[0093] Optionally, the vertex coordinates of the target projection model are represented by four-dimensional coordinates, including: a first component, a second component, a third component, and a fourth component; the target image acquisition module 330 is also used for:

[0094] Perform a homogeneous transformation on the vertex coordinates of the target projection model;

[0095] The target projection model after the alignment transformation is rendered to obtain the target image.

[0096] Optionally, rendering module 340 is also used for:

[0097] Extract the two components of the screen coordinate system corresponding to the vertex coordinates in the target projection model after homogeneous transformation;

[0098] The 3D virtual model is rendered to the screen coordinate system based on the two components to obtain the target image.

[0099] The image rendering apparatus provided in this disclosure can execute the image rendering method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.

[0100] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.

[0101] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 4 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 4 The diagram below shows the structure of the terminal device or server 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 4 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0102] like Figure 4As shown, electronic device 500 may include a processing unit (e.g., central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.

[0103] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0104] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0105] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0106] The electronic device provided in this embodiment and the image rendering method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0107] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the image rendering method provided in the above embodiments.

[0108] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0109] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0110] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0111] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to:

[0112] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: acquire a 3D virtual model and initial transformation information input by the user; wherein the 3D virtual model is composed of multiple vertices, and the transformation information includes at least one of scaling information, rotation information, and translation information; convert the 3D virtual model to a first projection type and a second projection type according to the initial transformation information to obtain a first projection model and a second projection model; and control the 3D virtual model to translate in the screen coordinate system according to the first projection model and the second projection model to obtain a target image.

[0113] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0114] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0115] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".

[0116] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0117] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0118] According to one or more embodiments of this disclosure, an image rendering method is provided, comprising:

[0119] Acquire initial transformation information of a 3D virtual model and user input; wherein the 3D virtual model is composed of multiple vertices, and the transformation information includes at least one of scaling information, rotation information, and translation information;

[0120] Based on the initial transformation information, the 3D virtual model is converted into a first projection type and a second projection type to obtain a first projection model and a second projection model.

[0121] The 3D virtual model is controlled to translate in the screen coordinate system according to the first projection model and the second projection model to obtain the target image.

[0122] Further, the first projection type is perspective projection. The 3D virtual model is converted to the first projection type based on the initial transformation information to obtain a first projection model, including:

[0123] Obtain perspective projection information and viewpoint information; wherein, the perspective projection information represents the perspective transformation relationship from the camera coordinate system to the screen coordinate system, and the viewpoint information represents the transformation relationship from the world coordinate system to the camera coordinate system; the camera coordinate system is the coordinate system in which the virtual camera used for rendering is located, and the world coordinate system is the coordinate system in which the 3D virtual model is located;

[0124] The translation information in the initial transformation information is adjusted to obtain the first transformation information;

[0125] Based on the first transformation information, the perspective projection information, and the viewpoint information, the 3D virtual model is transformed by perspective projection to obtain a perspective projection model.

[0126] Further, the translation information in the initial transformation information is adjusted to obtain the first transformation information, including:

[0127] The first adjustment amount is determined based on the translation information in the initial transformation information and the first set value;

[0128] The translation information is adjusted based on the first adjustment amount to obtain the first transformation information.

[0129] Furthermore, the second projection type is orthographic projection. The 3D virtual model is converted to the second projection type based on the initial transformation information to obtain a second projection model, including:

[0130] Obtain orthogonal projection information and viewpoint information; wherein, the perspective projection information represents the orthogonal transformation relationship from the camera coordinate system to the screen coordinate system, and the viewpoint information represents the transformation relationship from the world coordinate system to the camera coordinate system; the camera coordinate system is the coordinate system in which the virtual camera used for rendering is located, and the world coordinate system is the coordinate system in which the 3D virtual model is located;

[0131] The rotation and scaling information in the initial transformation information are adjusted to obtain the second transformation information;

[0132] Based on the second transformation information, the orthogonal projection information, and the viewpoint information, the 3D virtual model is orthogonally projected to obtain an orthogonal projection model.

[0133] Further, the method is characterized in that adjusting the rotation and scaling information in the initial transformation information to obtain the second transformation information includes:

[0134] The second adjustment amount is determined based on the rotation information in the initial transformation information and the second set value;

[0135] The third adjustment amount is determined based on the scaling information in the initial transformation information and the third set value;

[0136] The rotation information is adjusted based on the second adjustment amount, and the scaling information is adjusted based on the third adjustment amount to obtain the second transformation information.

[0137] Further, controlling the 3D virtual model to translate in the screen coordinate system according to the first projection model and the second projection model to obtain the target image includes:

[0138] The first projection model and the second projection model are fused to obtain the target projection model;

[0139] The target projection model is rendered to obtain the target image.

[0140] Further, the first projection model and the second projection model are fused to obtain the target projection model, including:

[0141] Extract the vertex coordinates from the first projection model;

[0142] The second projection model and the first projection model are linearly superimposed based on the vertex coordinates to obtain the target projection model.

[0143] Furthermore, the vertex coordinates of the target projection model are represented by four-dimensional coordinates, including: a first component, a second component, a third component, and a fourth component; rendering the target projection model to obtain a target image includes:

[0144] Perform a homogeneous transformation on the vertex coordinates of the target projection model;

[0145] The target projection model after the alignment transformation is rendered to obtain the target image.

[0146] Furthermore, the target projection model after the alignment transformation is rendered to obtain the target image, including:

[0147] Extract the two components of the screen coordinate system corresponding to the vertex coordinates in the target projection model after homogeneous transformation;

[0148] The 3D virtual model is rendered in screen coordinates based on the two components to obtain the target image.

[0149] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0150] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0151] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. An image rendering method, characterized in that, include: Acquire initial transformation information of a 3D virtual model and user input; wherein the 3D virtual model is composed of multiple vertices, and the initial transformation information includes at least one of scaling information, rotation information, and translation information; Based on the initial transformation information, the 3D virtual model is converted into a first projection type and a second projection type to obtain a first projection model and a second projection model. Based on the first projection model and the second projection model, the 3D virtual model is controlled to translate in the screen coordinate system to obtain the target image; The projection transformation of the 3D virtual model based on the initial transformation information includes: acquiring projection information and viewpoint information, determining projection transformation information based on the initial transformation information, the projection information and the viewpoint information, and performing projection transformation on the 3D virtual model based on the projection transformation information.

2. The method according to claim 1, characterized in that, The first projection type is perspective projection. The 3D virtual model is converted to the first projection type based on the initial transformation information to obtain a first projection model, including: Obtain perspective projection information and viewpoint information; The translation information in the initial transformation information is adjusted to obtain the first transformation information; Based on the first transformation information, the perspective projection information, and the viewpoint information, the 3D virtual model is transformed by perspective projection to obtain a perspective projection model.

3. The method according to claim 2, characterized in that, Adjusting the translation information in the initial transformation information to obtain the first transformation information includes: The first adjustment amount is determined based on the translation information in the initial transformation information and the first set value; The translation information is adjusted based on the first adjustment amount to obtain the first transformation information.

4. The method according to claim 1, characterized in that, The second projection type is orthographic projection. Based on the initial transformation information, the 3D virtual model is converted to the second projection type to obtain a second projection model, including: Obtain orthographic projection information and viewpoint information; The rotation and scaling information in the initial transformation information are adjusted to obtain the second transformation information; Based on the second transformation information, the orthogonal projection information, and the viewpoint information, the 3D virtual model is orthogonally projected to obtain an orthogonal projection model.

5. The method according to claim 4, characterized in that, Adjusting the rotation and scaling information in the initial transformation information to obtain the second transformation information includes: The second adjustment amount is determined based on the rotation information in the initial transformation information and the second set value; The third adjustment amount is determined based on the scaling information in the initial transformation information and the third set value; The rotation information is adjusted based on the second adjustment amount, and the scaling information is adjusted based on the third adjustment amount to obtain the second transformation information.

6. The method according to claim 1, characterized in that, Controlling the 3D virtual model to translate in the screen coordinate system based on the first projection model and the second projection model to obtain the target image includes: The first projection model and the second projection model are fused to obtain the target projection model; The target projection model is rendered to obtain the target image.

7. The method according to claim 6, characterized in that, The first projection model and the second projection model are fused to obtain the target projection model, including: Extract the vertex coordinates from the first projection model; The second projection model and the first projection model are linearly superimposed based on the vertex coordinates to obtain the target projection model.

8. The method according to claim 6, characterized in that, The vertex coordinates of the target projection model are represented by four-dimensional coordinates, including: a first component, a second component, a third component, and a fourth component; rendering the target projection model to obtain a target image includes: Perform a homogeneous transformation on the vertex coordinates of the target projection model; The target projection model after the alignment transformation is rendered to obtain the target image.

9. The method according to claim 8, characterized in that, Render the target projection model after the alignment transformation to obtain the target image, including: Extract the two components of the screen coordinate system corresponding to the vertex coordinates in the target projection model after homogeneous transformation; The 3D virtual model is rendered in screen coordinates based on the two components to obtain the target image.

10. An image rendering apparatus, characterized in that, include: An initial transformation information acquisition module is used to acquire a 3D virtual model and receive initial transformation information input by the user; wherein the 3D virtual model is composed of multiple vertices, and the initial transformation information includes at least one of scaling information, rotation information, and translation information; The projection conversion module is used to convert the 3D virtual model into a first projection type and a second projection type according to the initial transformation information, so as to obtain a first projection model and a second projection model. The target image acquisition module is used to control the 3D virtual model to translate in the screen coordinate system according to the first projection model and the second projection model to obtain the target image; The projection conversion module is further configured to acquire projection information and viewpoint information, determine projection conversion information based on the initial transformation information, the projection information and the viewpoint information, and perform projection conversion on the 3D virtual model based on the projection conversion information.

11. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the image rendering method as described in any one of claims 1-9.

12. A storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image rendering method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Panorama rendering method and device, computer equipment and storage medium

    CN114419226A