Virtual model rendering method, apparatus, medium, and device

CN117582661BActive Publication Date: 2026-08-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-07
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0004]本申请实施例提供一种虚拟模型渲染方法、装置、介质及设备,以解决现有技术中在进行大量模型实时渲染时效率低的问题

Benefits of technology

[0017]本申请实施例提供了一种虚拟模型渲染方法、装置、介质及设备,该方法通过获取目标虚拟模型对应的纹理贴图,所述纹理贴图包括所述目标虚拟模型在三维视角下对应不同预设姿态的多张预渲染纹理贴图;从所述纹理贴图中确定待渲染的帧动画对应的目标预渲染纹理贴图;通过光照模型及所述目标预渲染纹理贴图进行光照计算得到目标虚拟模型渲染完成的帧动画;将所述渲染完成的帧动画在虚拟场景中的指定位置进行显示。本申请实施例通过在三维视角下将目标虚拟模型的预设纹理信息烘焙到纹理贴图中,形成多张对应不同预设姿态的预渲染纹理贴图,并将多张预渲染纹理贴图按照顺序进行渲染后以帧动画的形式在虚拟场景中显示,从而实现通过二维图像的形式模拟三维立体的视觉效果,间接提升了模型渲染的效率,尤其适用于在指定的可见范围内同时展示大量模型。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117582661B_ABST
    Figure CN117582661B_ABST
Patent Text Reader

Abstract

This application provides a virtual model rendering method, apparatus, storage medium, and electronic device. The method includes acquiring a texture map corresponding to a target virtual model, the texture map including multiple pre-rendered texture maps; determining the storage location of the target pre-rendered texture map corresponding to the currently rendered frame animation in the texture map; acquiring the target pre-rendered texture map corresponding to the frame animation to be rendered according to the storage location; performing lighting calculations on the target pre-rendered texture map to obtain the rendered frame animation; and displaying the rendered frame animation at a specified location in the virtual scene. This application achieves a simulated three-dimensional visual effect through a two-dimensional image by baking the preset texture information of the target virtual model onto the texture map in a three-dimensional perspective, forming multiple pre-rendered texture maps corresponding to different preset poses, and then rendering the multiple pre-rendered texture maps and displaying them in the form of frame animation in the virtual scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic communication technology, and more particularly to the field of model rendering technology, especially to a virtual model rendering method, apparatus, medium and device. Background Technology

[0002] Real-time rendering is a commonly used technique in game development. The rendering process can be viewed as mapping models in a scene onto the imaging plane of a rendering camera. To accomplish this, modern graphics cards use rasterization to pixelate the models. The higher the polygon count of a model, the more faces need to be rasterized, leading to a rapid decline in rendering performance. In real-time rendering, model animation is typically achieved through skeletal animation. To represent the model's animation, the computer needs to calculate the bone positions and vertex coordinates of the bones in each frame. However, these calculations place high demands on the computer's rendering performance, making it difficult for computers with average performance to render models quickly.

[0003] To improve model rendering efficiency, a common approach is to reduce the number of polygons in real-time rendering. This can be achieved through techniques such as camera culling, occlusion culling, Level of Detail (LOD), and baking low-poly models from high-poly models. However, these techniques improve rendering performance by culling invisible models or replacing low-poly models. When the number of models within the visible area increases significantly, there will still be a substantial loss in rendering performance. Summary of the Invention

[0004] This application provides a virtual model rendering method, apparatus, medium, and device to solve the problem of low efficiency in real-time rendering of a large number of models in the prior art.

[0005] This application provides a virtual model rendering method, including:

[0006] Obtain the texture map corresponding to the target virtual model, wherein the texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view;

[0007] The target pre-rendered texture map corresponding to the frame animation to be rendered is determined from the texture map;

[0008] The frame animation of the target virtual model is obtained by performing lighting calculations using the lighting model and the target pre-rendered texture map;

[0009] The rendered frame animation is displayed at a specified location in the virtual scene.

[0010] Accordingly, another aspect of this application embodiment also provides a virtual model rendering apparatus, the virtual model rendering apparatus comprising:

[0011] The acquisition module is used to acquire the texture map corresponding to the target virtual model. The texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view.

[0012] The determination module is used to determine the target pre-rendered texture map corresponding to the frame animation to be rendered from the texture map;

[0013] The rendering module is used to perform lighting calculations using the lighting model and the target pre-rendered texture map to obtain the frame animation of the rendered target virtual model;

[0014] The display module is used to display the rendered frame animation at a specified position in the virtual scene.

[0015] Accordingly, in another aspect, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute the virtual model rendering method described above.

[0016] Accordingly, another aspect of this application provides an electronic device, including a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the virtual model rendering method described above.

[0017] This application provides a virtual model rendering method, apparatus, medium, and device. The method involves acquiring a texture map corresponding to a target virtual model, where the texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view. The method then determines the target pre-rendered texture map corresponding to a frame animation to be rendered from the texture map. Lighting calculations are performed using a lighting model and the target pre-rendered texture map to obtain the rendered frame animation of the target virtual model. Finally, the rendered frame animation is displayed at a designated location in the virtual scene. This application, by baking the preset texture information of the target virtual model into a texture map in a three-dimensional view to form multiple pre-rendered texture maps corresponding to different preset poses, and rendering these multiple pre-rendered texture maps sequentially, displays them in the virtual scene as frame animations. This achieves the simulation of a three-dimensional visual effect through two-dimensional images, indirectly improving the efficiency of model rendering, and is particularly suitable for simultaneously displaying a large number of models within a specified visible range. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating the virtual model rendering method provided in an embodiment of this application.

[0020] Figure 2 This is a schematic diagram of the baking process for pre-rendered texture maps.

[0021] Figure 3 This is a schematic diagram of a texture map.

[0022] Figure 4 This is a schematic diagram of the structure of the virtual model rendering device provided in the embodiments of this application.

[0023] Figure 5 This is another schematic diagram of the virtual model rendering apparatus provided in the embodiments of this application.

[0024] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the protection scope of this application.

[0026] It's important to note that real-time rendering is a commonly used technique in game development. The rendering process can be viewed as mapping models in a scene onto the rendering camera's image plane. To accomplish this, modern graphics cards use rasterization to pixelate the models. The higher the polygon count of a model, the more faces need to be rasterized, leading to a rapid decrease in rendering performance. In real-time rendering, model animation is typically achieved through skeletal animation. To represent the model's animation, the computer needs to calculate the bone positions and vertex coordinates of the bones in each frame. However, these calculations place high demands on the computer's rendering performance, making it difficult for computers with average performance to render models quickly.

[0027] To improve model rendering efficiency, a common approach is to reduce the number of polygons in real-time rendering. This can be achieved through techniques such as camera culling, occlusion culling, Level of Detail (LOD), and high-poly model baking. Camera culling removes models invisible to the rendering camera; occlusion culling uses pre-detection of depth cache to remove models invisible due to occlusion; LOD improves performance by replacing or simplifying models based on camera distance; and high-poly model baking transfers high-poly details to low-poly models via textures, giving the low-poly model near-high-poly detail, thus improving rendering performance. However, these techniques all improve rendering performance by removing invisible models or replacing low-poly models. When the number of models within the visible area increases significantly, there will still be a substantial performance loss.

[0028] To address the aforementioned technical problems, this application provides a virtual model rendering method. Using this method, preset texture information of the target virtual model is baked onto a texture map from a three-dimensional perspective, forming multiple pre-rendered texture maps corresponding to different preset poses. These pre-rendered texture maps are then rendered sequentially and displayed in a virtual scene as a frame animation. This achieves the simulation of a three-dimensional visual effect through two-dimensional images, indirectly improving the efficiency of model rendering. It is particularly suitable for simultaneously displaying a large number of models within a specified visible range.

[0029] Please see Figures 1-3 , Figure 1 This is a flowchart illustrating the virtual model rendering method provided in an embodiment of this application. Figure 2 This is a schematic diagram of the baking process for pre-rendered texture maps. Figure 3 This is a schematic diagram of texture mapping. The virtual model rendering method, in which the execution entities for each step can be the same or different, can be electronic devices or servers. The electronic devices can be personal computers or similar devices. The method may include the following steps:

[0030] Step 101: Obtain the texture map corresponding to the target virtual model. The texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view.

[0031] It should be noted that the virtual model rendering method provided in this application uses a two-dimensional patch to display information about multiple faces of the target virtual model, thereby simulating a three-dimensional visual effect. However, since the two-dimensional patch itself does not possess the multi-angle display effect of a three-dimensional model, it will fail when viewed from the side. Therefore, this solution is only suitable for displaying the model's effect from a fixed perspective, such as in two-dimensional game scenes where the model's angle does not need to be changed while a three-dimensional perspective effect is desired.

[0032] It should be explained that the target virtual model described in this solution can be a character model in a virtual scene, or other object models that can change their shape, posture, position, and other parameters. The target virtual model can be located in the three-dimensional space of the virtual scene or in other three-dimensional spaces outside the virtual scene. In this embodiment, the target virtual model is established in a three-dimensional space outside the virtual scene. Then, the preset texture information of the target virtual model is collected in the three-dimensional space outside the virtual scene. The collected preset texture information is used to form a pre-rendered texture map, which is then rendered onto the polygon model in the virtual scene. This results in the target virtual model simulating a three-dimensional visual effect in the virtual scene through a two-dimensional image. Compared to existing technologies that improve rendering performance through camera culling, occlusion culling, Level of Detail (LOD), and high-poly model baking of low-poly models, this solution does not require culling invisible models or replacing low-poly models to improve rendering performance. When the number of models within the visible range increases significantly, it avoids excessive loss of rendering performance.

[0033] It should be noted that the texture map includes multiple pre-rendered texture maps generated from the target virtual model in a 3D view. These multiple pre-rendered texture maps can be either one corresponding to a preset pose, or one preset pose corresponding to multiple pre-rendered texture maps. However, to reflect the dynamic display effect of the model, the multiple pre-rendered texture maps must contain at least two preset poses. The preset pose can be a sitting, standing, or other poses, without limitation. In a specific scene, the preset pose can represent a series of repetitive slashing actions performed by one game character against another. Since game scenes often require a large number of virtual models, and to achieve vividness, these models need to have dynamic changes, their primary function in game scenes is to increase the quantity of game scene assets, rather than focusing on their detail or the complexity of their actions. Therefore, this solution can be used to construct a large number of virtual models that can be viewed from a fixed perspective. Based on 2D patch models, 3D visual effects can be simulated in the virtual scene using 2D images.

[0034] Before obtaining the texture map corresponding to the target virtual model, it is necessary to first create and save the texture map of the target virtual model. For example... Figure 2 As shown, specifically, by pointing the pre-rendered camera at a preset angle toward the target virtual model, controlling the target virtual model to switch between different preset poses, taking pictures of the target virtual model through the pre-rendered camera, obtaining pre-rendered texture maps corresponding to different preset poses, and then outputting them to a pre-created texture map corresponding to the target virtual model, thus completing the texture map creation process.

[0035] It's important to explain that during the process of capturing images of the target virtual model, the pre-rendered camera actually maps the preset texture information of the target virtual model onto the imaging plane of the pre-rendered camera. This preset texture information is then baked to form a pre-rendered texture map, which is stored in the pre-rendered camera's rendering cache. The pre-rendered texture map in the rendering cache is then copied to the texture map. Simultaneously, during the camera's capture process, the current animation of the target virtual model must remain unchanged, preventing it from switching to a preset pose.

[0036] Baking is a technique that renders model information into textures, and then applies the baked textures back into the virtual scene. The pre-rendering camera used in the baking process can be either an orthographic camera or a perspective camera, depending on the specific situation; no specific choice is made here. This pre-rendering camera is located in the 3D space where the target virtual model resides; that is, the pre-rendering camera and the target virtual model are in the same space.

[0037] Specifically, based on the model position and the camera position, the relative positional relationship between the pre-rendering camera and the target virtual model in the virtual scene can be determined. Based on this relative positional relationship, information such as the baking angle and baking direction of the target virtual model can be obtained. Furthermore, based on the above information, the baking position of the pre-rendering camera relative to the target virtual model can be determined. Then, the pre-rendering camera can perform baking processing on the target model at this baking position.

[0038] It should be noted that after copying the pre-rendered texture map from the render cache to the texture map, the render cache needs to be cleared at the same time to avoid copying the same pre-rendered texture map to the texture map repeatedly.

[0039] To further explain the process of creating pre-rendered texture maps, two specific implementation methods are provided below. First, the preset texture information refers to one or more of the following: color texture information, normal texture information, ambient occlusion texture information, roughness texture information, and metallicity texture information.

[0040] Color texture information: Records the color of the material surface.

[0041] Normal texture information: Records the normal information of the material surface and transforms the normal information into the unevenness and texture shown under light and shadow.

[0042] Ambient occlusion texture information: records the light occlusion effect on the model surface (this occlusion effect is usually self-occlusion).

[0043] Roughness texture information: Records the roughness information of the material surface. The whiter the texture, the higher the roughness of that area. Conversely, the whiter the texture, the higher the roughness.

[0044] Metallic texture information: Metallicity records the intensity of the metallic texture of a material. The whiter a region is, the stronger its metallic texture.

[0045] One possible implementation involves capturing images of a target virtual model containing either color texture information or normal texture information using a pre-rendered camera. The resulting pre-rendered texture map is then baked from the color texture information or normal texture information of the target virtual model and stored in the rendering cache of the pre-rendered camera. In this example, the pre-rendered texture information can be either color texture information or normal texture information.

[0046] As another possible implementation, a target virtual model containing color and texture information is photographed using a pre-rendered camera. The color and texture information of the target virtual model is baked to obtain a first pre-rendered texture map, which is then stored in the rendering cache of the pre-rendered camera. The target virtual model containing normal texture information is also photographed using the pre-rendered camera. The normal texture information of the target virtual model is baked to obtain a second pre-rendered texture map, which is then stored in the rendering cache of the pre-rendered camera. The first and second pre-rendered texture maps together constitute the pre-rendered texture map. In this example, the preset texture information can be a combination of color and normal texture information. By superimposing two different types of texture information, the detail representation of the model can be improved.

[0047] Specifically, the color map corresponding to the target virtual model containing color texture information can be sampled by the pre-rendered camera. The color texture information of the target virtual model is baked to obtain the first pre-rendered texture map, which is then stored in the rendering cache of the pre-rendered camera. This completes the baking of the color texture information of the target virtual model into the first pre-rendered texture map.

[0048] The process of baking the normal texture information of the target virtual model is similar to the process of baking the color texture information. The normal map corresponding to the target virtual model containing normal texture information can be sampled by the pre-rendering camera to obtain the world space normal in the normal map. After baking the second pre-rendered texture map based on the world space normal, it is stored in the rendering cache of the pre-rendering camera, thus completing the baking of the normal texture information of the target virtual model into the second pre-rendered texture map.

[0049] It should be noted that the baking process described above requires the use of a baking camera, i.e., a pre-rendering camera. This baking camera can be a virtual camera in the virtual scene or another virtual camera. For example, when the target virtual model is located in the virtual scene, the baking camera can be the aforementioned virtual camera in the virtual scene or another camera in the virtual scene.

[0050] It's important to note that in games and movies, many models undergo rotation and scaling, and skinned files may deform according to animation requirements. In these situations, using non-tangent space normal maps, such as world space normal maps, will result in severe visual errors. Therefore, the industry generally uses tangent space coordinates to store the normal maps of 3D models to avoid these problems. However, when using normal information for lighting calculations, it's necessary to convert the normal information from tangent space to world space to facilitate shader calculations. Since this solution converts the 3D model into a 2D frame animation for display, and frame animation cannot perform the conversion of normal information from tangent space to world space, it's crucial to ensure that the normal information obtained when rendering the frame animation is in world space.

[0051] In order to obtain the world space normal, this method first determines the texture type corresponding to the normal map. The texture type includes tangent space normal map and world space normal map. Different operations are performed according to the determination result.

[0052] If the determination result is that the texture type corresponding to the normal map is a tangent space normal map, then the tangent space normal sampled from the normal map is converted into world space normal and then output. It should be noted that the conversion of the tangent space normal sampled from the normal map into world space normal can be achieved by the transformation matrix multiplication algorithm, which is a common technology in the industry and will not be elaborated here.

[0053] If the determination result indicates that the texture type corresponding to the normal map is a world space normal map, then the world space normal passed from the vertex shader will be output.

[0054] Step 102: Determine the target pre-rendered texture map corresponding to the frame animation to be rendered from the texture map.

[0055] It should be explained that the aforementioned texture map can specifically be a large texture map, such as... Figure 3As shown, this texture map is used to store information such as baking direction, color texture information, and normal texture information. Initially, the texture map is blank. When in use, the texture map is typically divided into multiple texture regions, each of which can store baking direction, color texture information, and normal texture information. Furthermore, to easily describe the position of each texture region within the texture map, a texture coordinate system can be established within the texture map, using texture coordinates to represent the specific position of each texture region within the texture map.

[0056] In this embodiment, different texture regions in the texture map can store the baking results of the target virtual model at a specified baking angle, i.e., pre-rendered texture maps. Since each pre-rendered texture map has unique storage location information, the storage location of the target pre-rendered texture map corresponding to the frame animation to be rendered can be determined, and the target pre-rendered texture map corresponding to the frame animation to be rendered can be obtained according to the storage location.

[0057] Step 103: Perform lighting calculations using the lighting model and the target pre-rendered texture map to obtain the frame animation of the rendered target virtual model.

[0058] In this embodiment, the target pre-rendered texture map can be sent to the renderer for frame animation rendering. For example, in real-time rendering of game animation, the renderer plays a crucial role. The renderer can use the lighting model running on the graphics processing unit (GPU) to render the offline-made target pre-rendered texture map onto the screen seen by the player and the audience. The lighting model can be any of the following, depending on the actual situation: Lambert lighting model (used to describe diffuse reflection), Phong lighting model (suitable for smooth object surfaces), Blinn-Phong lighting model (an improved specular lighting model based on the Phong lighting model), ambient light, PBR, etc., without limitation.

[0059] Taking the Phong model as an example, the process of calculating lighting using the Phong lighting model and the target pre-rendered texture map to obtain the frame animation corresponding to the target virtual model can be expressed by the formula:

[0060] I=Ia*Ka+Id*Kd*max(0,dot(N,L))+Is*Ks*pow(max(0,dot(R,V)),shinin ess)

[0061] Where: I: represents the illumination intensity of the target virtual model surface. Ia: represents the intensity of ambient light, usually a constant. Ka: represents the ambient light reflectance coefficient of the target virtual model surface, used to adjust the influence of ambient light on the target virtual model surface. Id: represents the intensity of a directional light source (such as sunlight). Kd: represents the diffuse reflectance coefficient of the target virtual model surface, used to adjust the influence of diffuse light on the target virtual model surface. N: represents the normal vector of the target virtual model surface. L: represents the incident direction vector of the light ray. dot(N, L): represents the dot product of the normal vector N of the target virtual model surface and the incident direction vector L of the light ray.

[0062] In addition to the diffuse lighting component mentioned above, the Phong model also includes a specular lighting component:

[0063] Is: Represents the specular intensity of the light source. Ks: Represents the specular reflection coefficient of the target virtual model surface, used to adjust the effect of specular light on the target virtual model surface. R: Represents the direction vector of the reflected light, calculated from the incident light direction vector L and the normal vector N of the target virtual model surface. V: Represents the observer's direction vector. pow(max(0, dot(R, V)),shininess) represents the shininess power of the dot product of the reflected light direction vector R and the observer's direction vector V. shininess is a parameter that specifies the specular highlight; a larger value results in a smaller and more concentrated highlight area, while a smaller value results in a larger and more diffuse highlight area.

[0064] The Phong model provides a simple and commonly used method for lighting calculations, capable of producing diffuse and specular highlights. By adjusting various parameters, the rendering effects under different lighting conditions can be controlled, allowing for the representation of different materials and surface properties.

[0065] Step 104: Display the rendered frame animation at a specified position in the virtual scene.

[0066] In this embodiment, the above-mentioned patch model can be a two-dimensional quadrilateral patch model. Taking the Quad model as an example, in actual implementation, the Quad model can be set at the model position, that is, the rendering position of the target model in the virtual scene, and then the orientation of the patch model can be adjusted according to the model position and the camera position so that the Quad model is always facing the virtual camera.

[0067] Once the frame animation to be rendered is completed, its corresponding pixel UV coordinates can be mapped onto the Quad model for imaging. For example, in Unity, a Quad model that can rotate with the virtual camera lens can be used for projection display. The rendered frame animation is projected onto a specified position in the virtual scene through a patch model, realizing the simulation of a three-dimensional visual effect through a two-dimensional image, which indirectly improves the efficiency of model rendering. It is especially suitable for displaying a large number of models at the same time within a specified visible range.

[0068] The virtual model rendering method provided in this solution is applicable not only to game scenarios but also to virtual scenarios such as sports events and concerts. However, since this solution is based on a two-dimensional patch model, and two-dimensional patch models themselves do not possess the multi-angle display effect of three-dimensional models, the two-dimensional patch will fail when viewed from the side. Therefore, whether applied to game scenarios or other virtual scenarios, it is necessary to view the display effect of the virtual model from a fixed perspective. This is particularly useful in two-dimensional game scenarios where the angle of the model does not need to be changed but a three-dimensional perspective effect is desired. In one specific embodiment, for a pre-made audience model, images of the audience model from multiple different angles are taken using a virtual camera and baked into a texture map. Then, the patch model is placed in the virtual scene. When the virtual scene is running, the angle and orientation of the patch model are adjusted so that it always faces the virtual camera. Based on the relative position between the virtual camera and the center point of the patch model, a texture map with an appropriate shooting angle is selected from the texture map and rendered onto the patch model. This achieves the simulation of a three-dimensional audience visual effect using two-dimensional patches, and multiple consecutive frame animations can achieve dynamic visual effects. Using this method, the production cost of art resources is moderate, and the three-dimensionality is improved.

[0069] In summary, the virtual model rendering method provided by this solution requires only a single polygon model to render and play model frame animations, and supports dynamic lighting rendering, thus enabling real-time animation of a large number of models in a scene. However, this solution is only suitable for viewing from a fixed perspective, and the rendering quality of the actual model animation depends on the precision of the pre-rendered frame animation map. Theoretically, this solution can be applied to rendering model animations at any distance, but due to the size limitations of frame animation textures in real-time games, it is actually more suitable for model animations at medium to long distances.

[0070] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0071] In practice, this application is not limited by the execution order of the described steps. Without causing conflicts, some steps may be performed in other orders or simultaneously.

[0072] As can be seen from the above, the virtual model rendering method provided in this application obtains the texture map corresponding to the target virtual model. The texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset postures in a three-dimensional view. The method then determines the target pre-rendered texture map corresponding to the frame animation to be rendered from the texture map. Lighting calculations are performed using a lighting model and the target pre-rendered texture map to obtain the rendered frame animation of the target virtual model. The rendered frame animation is then displayed at a designated position in the virtual scene. This application embodiment bakes the preset texture information of the target virtual model into the texture map in a three-dimensional view to form multiple pre-rendered texture maps corresponding to different preset postures. These multiple pre-rendered texture maps are then rendered sequentially and displayed in the virtual scene as frame animations. This achieves the simulation of a three-dimensional visual effect through two-dimensional images, indirectly improving the efficiency of model rendering. It is particularly suitable for simultaneously displaying a large number of models within a specified visible range.

[0073] This application also provides a virtual model rendering device, which can be integrated into an electronic device or a server.

[0074] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of the virtual model rendering apparatus provided in an embodiment of this application. The virtual model rendering apparatus 30 may include:

[0075] The acquisition module 31 is used to acquire the texture map corresponding to the target virtual model. The texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view.

[0076] The determining module 32 is used to determine the target pre-rendered texture map corresponding to the frame animation to be rendered from the texture map;

[0077] Rendering module 33 is used to perform lighting calculations using the lighting model and the target pre-rendered texture map to obtain the frame animation of the target virtual model after rendering;

[0078] Display module 34 is used to display the rendered frame animation at a specified position in the virtual scene.

[0079] In practice, the above modules can be implemented as independent entities or combined in any way to be implemented as the same or several entities.

[0080] As can be seen from the above, the virtual model rendering device 30 provided in this application embodiment uses an acquisition module 31 to acquire the texture map corresponding to the target virtual model, the texture map including multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view; a determination module 32 to determine the target pre-rendered texture map corresponding to the frame animation to be rendered from the texture map; a rendering module 33 to perform lighting calculations using a lighting model and the target pre-rendered texture map to obtain the frame animation rendered by the target virtual model; and a display module 34 to display the rendered frame animation at a specified position in the virtual scene.

[0081] Please see Figure 5 , Figure 5 This is another schematic diagram of the virtual model rendering apparatus provided in this application embodiment. The virtual model rendering apparatus 30 includes a memory 120, one or more processors 180, and one or more application programs, wherein the one or more application programs are stored in the memory 120 and configured to be executed by the processors 180; the processors 180 may include an acquisition module 31, a determination module 32, a rendering module 33, and a display module 34. For example, the structure and connection relationship of the above components can be as follows:

[0082] Memory 120 can be used to store applications and data. The applications stored in memory 120 contain executable code. Applications can be composed of various functional modules. Processor 180 executes various functional applications and data processing by running the applications stored in memory 120. Furthermore, memory 120 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory 120 may also include a memory controller to provide processor 180 with access to memory 120.

[0083] The processor 180 is the control center of the device, connecting various parts of the terminal through various interfaces and lines. It performs various functions and processes data by running or executing applications stored in the memory 120 and calling data stored in the memory 120, thereby providing overall monitoring of the device. Optionally, the processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications.

[0084] Specifically in this embodiment, the processor 180 loads the executable code corresponding to the process of one or more applications into the memory 120 according to the following instructions, and the processor 180 runs the applications stored in the memory 120 to realize various functions.

[0085] This application also provides an electronic device. The electronic device may be an electronic device or a server.

[0086] Please see Figure 6 , Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. This electronic device can be used to implement the virtual model rendering method provided in the above embodiments. Taking the electronic device 1200 as an example, it can be a smartphone or a tablet computer.

[0087] like Figure 6 As shown, the electronic device 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more (only one is shown in the figure) computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a transmission module 170, a processor 180 including one or more (only one is shown in the figure) processing cores, and a power supply 190, etc. Those skilled in the art will understand that... Figure 6 The structure of the electronic device 1200 shown does not constitute a limitation on the electronic device 1200, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0088] RF circuit 110 is used to receive and transmit electromagnetic waves, realizing the mutual conversion between electromagnetic waves and electrical signals, thereby enabling communication with communication networks or other devices. RF circuit 110 may include various existing circuit elements used to perform these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, Subscriber Identity Module (SIM) cards, memory, etc. RF circuit 110 can communicate with various networks such as the Internet, corporate intranets, and wireless networks, or communicate with other devices via wireless networks.

[0089] The memory 120 can be used to store software programs and modules, such as the program instructions / modules corresponding to the virtual model rendering method in the above embodiment. The processor 180 executes various functional applications and data processing by running the software programs and modules stored in the memory 120. It can automatically select a vibration reminder mode for model rendering according to the current scene of the electronic device, ensuring that it is not disturbed in scenarios such as meetings, while also ensuring that users can sense incoming calls, thus improving the intelligence of the electronic device. The memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 120 may further include memory remotely located relative to the processor 180, and these remote memories can be connected to the electronic device 1200 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0090] The input unit 130 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, the input unit 130 may include a touch-sensitive surface 131 and other input devices 132. The touch-sensitive surface 131, also known as a touch display screen or touchpad, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch-sensitive surface 131), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface 131 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 180, and can receive and execute commands from the processor 180. In addition, the touch-sensitive surface 131 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 131, the input unit 130 may also include other input devices 132. Specifically, other input devices 132 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0091] Display unit 140 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of electronic device 1200. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 140 may include display panel 141, optionally configured as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, touch-sensitive surface 131 may cover display panel 141. When touch-sensitive surface 131 detects a touch operation on or near it, it transmits the information to processor 180 to determine the type of touch event. Subsequently, processor 180 provides corresponding visual output on display panel 141 according to the type of touch event. Although in Figure 6 In this embodiment, the touch-sensitive surface 131 and the display panel 141 are implemented as two separate components to realize input and output functions. However, in some embodiments, the touch-sensitive surface 131 and the display panel 141 can be integrated to realize input and output functions.

[0092] The electronic device 1200 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 141 according to the ambient light level, and the proximity sensor can turn off the display panel 141 and / or backlight when the electronic device 1200 is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the electronic device 1200, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0093] Audio circuitry 160, speaker 161, and microphone 162 provide an audio interface between the user and electronic device 1200. Audio circuitry 160 converts received audio data into electrical signals, which are then transmitted to speaker 161, where they are converted into sound signals for output. Conversely, microphone 162 converts collected sound signals into electrical signals, which are received by audio circuitry 160, converted back into audio data, and then processed by processor 180 before being transmitted via RF circuitry 110 to, for example, another terminal, or output to memory 120 for further processing. Audio circuitry 160 may also include an earphone jack to facilitate communication between external headphones and electronic device 1200.

[0094] Electronic device 1200, through transmission module 170 (e.g., Wi-Fi module), enables users to send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 6 The transmission module 170 is shown, but it is understood that it is not an essential component of the electronic device 1200 and can be omitted as needed without changing the nature of the invention.

[0095] The processor 180 is the control center of the electronic device 1200. It connects to various parts of the phone via various interfaces and lines, and performs various functions and processes data of the electronic device 1200 by running or executing software programs and / or modules stored in the memory 120, and by calling data stored in the memory 120, thereby providing overall monitoring of the phone. Optionally, the processor 180 may include one or more processing cores; in some embodiments, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 180.

[0096] The electronic device 1200 also includes a power supply 190 that supplies power to the various components. In some embodiments, the power supply can be logically connected to the processor 180 through a power management system, thereby enabling functions such as discharge management and power consumption management through the power management system. The power supply 190 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0097] Although not shown, the electronic device 1200 may also include a camera (such as a front-facing camera and a rear-facing camera), a Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the display unit 140 of the electronic device 1200 is a touch screen display, and the electronic device 1200 also includes a memory 120 and one or more programs, wherein one or more programs are stored in the memory 120 and configured to be executed by one or more processors 180.

[0098] This application also provides a computer-readable storage medium storing a computer program. When the computer program is run on a computer, the computer executes the virtual model rendering method described in any of the above embodiments.

[0099] Obtain the texture map corresponding to the target virtual model, wherein the texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view;

[0100] The target pre-rendered texture map corresponding to the frame animation to be rendered is determined from the texture map;

[0101] The frame animation of the target virtual model is obtained by performing lighting calculations using the lighting model and the target pre-rendered texture map;

[0102] The rendered frame animation is displayed at a specified location in the virtual scene.

[0103] It should be noted that, for the virtual model rendering method described in this application, those skilled in the art will understand that all or part of the process of the virtual model rendering method described in the embodiments of this application can be implemented by a computer program controlling the relevant hardware. The computer program can be stored in a computer-readable storage medium, such as in the memory of an electronic device, and executed by at least one processor within the electronic device. During execution, it can include the process of the embodiments of the virtual model rendering method described. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), etc.

[0104] For the virtual model rendering apparatus described in this application embodiment, its functional modules can be integrated into a single processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0105] The virtual model rendering method, apparatus, computer-readable storage medium, and electronic device provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and its core ideas; at the same time, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A virtual model rendering method, characterized in that, include: Orient the pre-rendered camera toward the target virtual model at a preset angle; The target virtual model is controlled to switch between different preset poses. The target virtual model is photographed by the pre-rendered camera to bake the preset texture information of the target virtual model into a pre-rendered texture map, which is then stored in the rendering cache of the pre-rendered camera. The pre-rendered texture map includes a first pre-rendered texture map and / or a second pre-rendered texture map. The first pre-rendered texture map is obtained by sampling the color map corresponding to the target virtual model containing color texture information by the pre-rendered camera to bake the color texture information of the target virtual model. The second pre-rendered texture map is obtained by sampling the normal map corresponding to the target virtual model containing normal texture information by the pre-rendered camera to obtain the world space normal in the normal map, and then baking the target virtual model based on the world space normal. Copy the pre-rendered texture map in the rendering cache to the texture map, and clear the rendering cache at the same time to output the pre-rendered texture map corresponding to different preset poses to the texture map. Obtain the texture map corresponding to the target virtual model, the texture map including multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in a three-dimensional view; The target pre-rendered texture map corresponding to the frame animation to be rendered is determined from the texture map; The frame animation of the rendered target virtual model is obtained by performing lighting calculations using the lighting model and the target pre-rendered texture map; The rendered frame animation is displayed at a specified location in the virtual scene.

2. The virtual model rendering method as described in claim 1, characterized in that, The process of obtaining the world space normals in the normal map includes: Determine the texture type corresponding to the normal map, where the texture type includes tangent space normal map and world space normal map; If the texture type corresponding to the normal map is a tangent space normal map, then the tangent space normals sampled from the normal map are converted into world space normals and output. If the texture type corresponding to the normal map is a world space normal map, then the world space normal passed from the vertex shader will be output.

3. The virtual model rendering method as described in claim 1, characterized in that, Determining the target pre-rendered texture map corresponding to the frame animation to be rendered from the texture map includes: Determine the storage location of the target pre-rendered texture map corresponding to the frame animation to be rendered in the texture map, and obtain the target pre-rendered texture map corresponding to the frame animation to be rendered according to the storage location.

4. The virtual model rendering method as described in claim 1, characterized in that, Displaying the rendered frame animation at a specified location in the virtual scene includes: The pixel UV coordinates of the rendered frame animation are mapped onto the patch model, and the rendered frame animation is displayed by projecting the patch model at a specified position in the virtual scene.

5. A virtual model rendering device, characterized in that, The virtual model rendering device includes: The acquisition module is used to orient the pre-rendered camera toward the target virtual model at a preset angle; control the target virtual model to switch between different preset poses; and capture images of the target virtual model through the pre-rendered camera to bake preset texture information of the target virtual model into a pre-rendered texture map, which is then stored in the rendering cache of the pre-rendered camera. The pre-rendered texture map includes a first pre-rendered texture map and / or a second pre-rendered texture map. The first pre-rendered texture map is obtained by sampling the color map corresponding to the target virtual model containing color texture information through the pre-rendered camera, thereby affecting the rendering cache of the target virtual model. The color texture information is baked to obtain the second pre-rendered texture map. The pre-rendered texture map is obtained by sampling the normal map corresponding to the target virtual model containing normal texture information through the pre-rendered camera, obtaining the world space normal in the normal map, and baking according to the world space normal. The pre-rendered texture map in the rendering cache is copied to the texture map, and the rendering cache is cleared at the same time to output the pre-rendered texture map corresponding to different preset poses to the texture map. The texture map corresponding to the target virtual model is obtained, and the texture map includes multiple pre-rendered texture maps of the target virtual model corresponding to different preset poses in the three-dimensional view. The determination module is used to determine the target pre-rendered texture map corresponding to the frame animation to be rendered from the texture map; The rendering module is used to perform lighting calculations using the lighting model and the target pre-rendered texture map to obtain the frame animation of the rendered target virtual model; The display module is used to display the rendered frame animation at a specified position in the virtual scene.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to execute the virtual model rendering method according to any one of claims 1 to 4.

7. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing multiple instructions, and the processor loading the instructions to execute the virtual model rendering method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Interface layer generation method and device, electronic equipment and storage medium

    CN116204256A

  • Game image processing method, apparatus, program, and readable medium

    WO2022111003A1