Rendering method and device

By using the height map of the target object to clip the depth texture and obtain the height offset texture, it solves the problem of only supporting plane rendering in the existing technology, realizes the rendering of target objects on complex surfaces, and improves the authenticity and accuracy of the rendering effect. User experience.

CN111798504BActive Publication Date: 2024-08-30BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010489956.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-02
Publication Date
2024-08-30
Estimated Expiration
2040-06-02

AI Technical Summary

Technical Problem

In the existing technology, the height offset texture only supports the rendering of target objects on a plane and cannot support the rendering of target objects on complex surfaces, such as the rendering of snow on different terrains.

Method used

By collecting interactive objects within the field of view that interact with the target object, the depth texture of the interactive object is obtained, and the depth texture is clipped using the height map of the target object to obtain a height offset texture relative to the deformable area of ​​the target object, thereby realizing complex surfaces. Target object rendering on.

Benefits of technology

It improves the authenticity of the rendered interaction effect between the target object and the interactive object, supports the rendering of target objects on complex surfaces, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111798504B
    Figure CN111798504B
Patent Text Reader

Abstract

The embodiments of the present application provide a rendering method and device, which relate to the field of computer application technology. Among them, interactive objects that interact with a target object within the field of view are collected; the interactive objects are photographed from the bottom of the target object to obtain the depth texture of the interactive object; the depth texture is cropped using the height map of the target object to obtain a height offset texture relative to the deformable area of ​​the target object; and the height offset texture is used to render and obtain an interactive effect screen between the interactive object and the target object. The technical solution provided by the embodiments of the present application solves the problem that the height offset texture obtained in the prior art only supports the rendering of target objects on a plane, but cannot support the rendering of target objects on complex surfaces.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer application technology, and in particular, to a rendering method and device. Background Art

[0002] With the continuous improvement of image processing technology, many three-dimensional scene images can be rendered and displayed on display devices.

[0003] For rendering of a target object with a soft surface in a three-dimensional scene, a depth texture can be obtained by rendering an interactive object that interacts with the soft surface of the target object, and the depth texture is used as a height offset texture of the target object to offset the height of the target object, and the interactive effect picture between the interactive object and the target object is obtained by rendering. The target object with a soft surface can be, for example, snow, and the interactive object can be, for example, a person in a snow scene, and the interactive effect picture of the snow when the person is in the snow scene is obtained by rendering, such as a depression in the snow.

[0004] In the prior art, when rendering is performed using a height offset texture, the depth texture is directly used as the height offset texture of the target object, that is, the depth texture is only clipped using the camera's near and far clipping planes. The height offset texture obtained at this time only supports rendering of target objects on a plane, but cannot support rendering of target objects on complex surfaces, such as rendering of snow on different terrains. Summary of the invention

[0005] The embodiments of the present application provide a rendering method and device to solve the problem that the highly offset texture obtained in the prior art only supports the rendering of target objects on a plane but cannot support the rendering of target objects on a complex surface.

[0006] A first aspect of the present invention provides a rendering method, the method comprising:

[0007] Collect interactive objects that interact with the target object within the field of view;

[0008] Shooting the interactive object from the bottom of the target object to obtain a depth texture of the interactive object;

[0009] Using the height map of the target object to clip the depth texture, obtaining a height offset texture relative to a deformable region of the target object;

[0010] The height offset texture is used to render and obtain an interaction effect picture between the interactive object and the target object.

[0011] A second aspect of the present invention provides a rendering device, the device comprising:

[0012] A collection module, used to collect interactive objects that interact with the target object within the field of view;

[0013] An acquisition module, used for photographing the interactive object from the bottom of the target object to obtain a depth texture of the interactive object;

[0014] A clipping module, used to clip the depth texture using the height map of the target object to obtain a height offset texture relative to a deformable area of ​​the target object;

[0015] The first rendering module is used to render and obtain an interaction effect picture between the interactive object and the target object by using the height offset texture.

[0016] In the present invention, the depth texture is clipped by the height map of the target object to obtain the height offset texture relative to the deformable area of ​​the target object. When the height offset texture is used for rendering, the rendering of the target object on a complex surface can be realized, for example, the rendering of snow on different terrains. This solves the problem that the prior art only supports the rendering of target objects on a plane surface but not complex surfaces, improves the authenticity of the interactive effect picture of the rendered target object and the interactive object, and improves the user experience.

[0017] These and other aspects of the present invention will become more apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 is a flowchart of an embodiment of a rendering method according to an embodiment of the present invention;

[0020] Figure 2 is a flowchart of another embodiment of a rendering method according to an embodiment of the present invention;

[0021] Figure 2-1 is a schematic diagram of a snow mesh normal error according to an embodiment of the present invention;

[0022] Figure 2-2 is a schematic diagram of a snow mesh normal after recalculation according to an embodiment of the present invention;

[0023] Figure 3 is a flowchart of another embodiment of a rendering method according to an embodiment of the present invention;

[0024] Figure 3-1 is a schematic diagram of an unsmooth snow grid according to an embodiment of the present invention;

[0025] Figure 3-2 is a schematic diagram of a snow mesh after smoothing according to an embodiment of the present invention;

[0026] Figure 4 is a flowchart of another embodiment of a rendering method according to an embodiment of the present invention;

[0027] Figure 5 It is a structural schematic diagram of an embodiment of a rendering device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0029] In some of the processes described in the specification and claims of this application and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.

[0030] The embodiments of the present invention are mainly applicable to the rendering of target objects with soft surfaces in three-dimensional scenes. The depth texture can be obtained by rendering the interactive object that interacts with the soft surface of the target object, and the height offset texture of the target object can be obtained from the depth texture. The height of the target object is offset based on the height offset texture, and the interactive effect picture between the interactive object and the target object can be obtained by rendering.

[0031] In the prior art, the interactive object that interacts with the soft surface of the target object is rendered by the camera to obtain a depth texture, which refers to the height value of the interactive object relative to the camera's near and far clipping plane. The depth texture is directly used as the height offset texture of the target object, and the height of the target object is offset using the height offset texture to obtain the interactive effect picture between the interactive object and the target object. Among them, the target object with a soft surface can be snow, sand, mud, etc.; the interactive object that interacts with the soft surface of the target object can be a dynamic object, such as a person. For example, the target object is snow, and the interactive object is a person in the snow environment. By rendering the person in the snow environment, a depth texture is obtained, that is, the height value of the person relative to the camera's near and far clipping plane, and the depth texture is directly used as the snow height offset texture. The snow height is offset using the snow height offset texture to obtain the effect picture of the snow when the person is in the snow environment, that is, the snow depression.

[0032] However, in the prior art, when rendering with the height offset texture, the depth texture is directly used as the height offset texture of the target object, that is, the depth texture is only clipped using the camera's near and far clipping planes, and the result is on the same plane without any height changes, that is, the height offset texture obtained at this time only supports the rendering of target objects on the plane. In actual scenes, target objects do not only exist on planes, but are often on various complex surfaces. For example, snow is often attached to the upper surfaces of various terrains or static objects, such as the upper surfaces of buildings. Obviously, the prior art does not support the rendering of target objects on complex surfaces.

[0033] Therefore, it is necessary to obtain a height offset texture that supports the rendering of target objects on complex surfaces in order to achieve the rendering of target objects on complex surfaces. The inventors think that on the basis of using the camera's near and far clipping plane to clip the depth texture, an additional height map can be added to clip the depth texture, that is, the height map of the target object. Since the height map of the target object itself contains information that it is on a complex surface, the height offset texture obtained by clipping the depth texture using the height map can also support the rendering of target objects on complex surfaces, thereby achieving the rendering of target objects on complex surfaces. Therefore, the technical solution of the present invention is proposed: collecting interactive objects that interact with the target object within the field of view; photographing the interactive object from the bottom of the target object to obtain a depth texture; using the height map of the target object to clip the depth texture to obtain a height offset texture relative to the deformable area of ​​the target object; using the height offset texture, rendering to obtain the interactive effect screen between the interactive object and the target object. By clipping the depth texture in combination with the height map of the target object, a height offset texture that supports the rendering of target objects on complex surfaces is obtained, and then the height offset texture is used to render the target object, so that the rendering of target objects on complex surfaces can be achieved. The problem that the prior art only supports rendering of target objects on a plane but not complex surfaces is solved, thereby improving the authenticity of the interactive effect picture of the rendered target object and the interactive object.

[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0035] like Figure 1 FIG. 1 is a flowchart of an embodiment of a rendering method provided by an embodiment of the present invention. The method may include the following steps:

[0036] 101: Collect interactive objects that interact with the target object within the field of view.

[0037] The target object may refer to an object in the scene that has a soft surface and the soft surface can be deformed based on the interactive action of the interactive object, such as snow, sand, mud, etc. The interactive object that can interact with the target object may refer to a dynamic object in the scene that can perform an interactive action to deform the soft surface of the target object, such as a person, a wild animal, etc. Among them, the interactive object interacting with the target object may refer to the interactive object performing an interactive action on the target object.

[0038] For example, if the target object is snow and the interactive object is a person in the snow scene, the interactive object interacting with the target object may include the person standing in the snow, or the person walking in the snow, etc. Therefore, in an actual scene, the interactive object interacting with the target object within the collection field of view may be a person standing or walking in the snow scene within the collection camera field of view.

[0039] Optionally, the method for collecting interactive objects that interact with the target object within the field of view may include:

[0040] Use orthographic cameras to collect multiple objects within the camera viewport;

[0041] An interactive object configured with an interactive tag is determined from the plurality of objects.

[0042] The interaction tag can be set by the user in advance to specify the interactive object that needs to interact with the target object. For example, in an actual snow scene, the interaction tag can be a standing person, and the interactive objects that interact with the target object in the field of view can be collected by using an orthogonal camera to collect multiple objects in the camera viewport, and the standing person is selected as the interactive object that interacts with the target object.

[0043] 102: Photograph the interactive object from the bottom of the target object to obtain a depth texture of the interactive object.

[0044] Optionally, an orthogonal camera may be used to shoot the interactive object from the bottom of the target object to obtain a depth texture, and the depth texture may refer to a height value of the interactive object relative to a near and far clipping plane of the camera.

[0045] In actual scenes, taking snow as an example, an orthogonal camera is used to shoot a person in the snow scene from the bottom of the snow, and a depth texture containing the height value of the person relative to the camera's near and far clipping plane can be obtained.

[0046] Wherein, when the target object is located on a horizontal plane, optionally, photographing the interactive object from the bottom of the target object to obtain the depth texture may include:

[0047] The interactive object is rendered from the bottom to the top using an orthographic camera to obtain a depth texture.

[0048] Among them, the viewport of the orthogonal camera should be consistent with the size of the target object mesh, the screen space of the orthogonal camera should be aligned with the texture map coordinate space of the target object mesh, the near clipping plane of the orthogonal camera should be coplanar with the target object mesh, and the interactive object should be rendered from bottom to top according to the normal direction of the plane based on the plane where the target object mesh is located to obtain the depth texture.

[0049] 103: Clipping the depth texture using the height map of the target object to obtain a height offset texture relative to a deformable region of the target object.

[0050] The height map of the target object contains the height values ​​of different vertices in the target object mesh. Taking the target object as snow as an example, there are different ways to obtain the snow height map. As a feasible way, since snow is usually attached to different terrains and the surface of snow fits the ground surface, the terrain height map can be directly selected as the snow height map. Among them, the terrain height map can be generated by the terrain editor.

[0051] As another feasible method, you can select the height map baked offline by the orthographic camera as the snow height map. The height map baked offline by the orthographic camera refers to the height map of the objects in the area obtained by rendering the current snow area in the scene from top to bottom using the orthographic camera.

[0052] The near clipping plane of the orthogonal camera is coplanar with the target object mesh, and the distance between the near and far clipping planes of the orthogonal camera is the deformable area of ​​the target object. Use the orthogonal camera to shoot the interactive object, and obtain a depth texture containing the height value of the interactive object relative to the near and far clipping planes of the orthogonal camera, that is, obtain a depth texture containing the height value of the interactive object relative to the deformable area of ​​the target object. Then use the target object height map to clip the depth texture, and you can get a height offset texture relative to the deformable area of ​​the target object.

[0053] 104: Utilize the height offset texture to render and obtain an interactive effect picture of the interactive object and the target object.

[0054] The interactive effect picture may refer to a picture where an interactive object interacts with a target object to form a certain interactive effect. For example, if the target object is snow and the interactive object is a person, the interaction between the two may be a person standing on the snow, and the interactive effect may be a depression in the snow.

[0055] Based on the obtained height offset texture, when rendering the target object, the height of the target object can be offset by using the height offset texture, and the interactive effect picture between the interactive object and the target object can be obtained by rendering.

[0056] In the embodiment of the present application, the depth texture is clipped by the height map of the target object to obtain the height offset texture relative to the deformable area of ​​the target object. When the height offset texture is used for rendering, the rendering of the target object on a complex surface can be realized, for example, the rendering of snow on different terrains. This solves the problem that the prior art only supports the rendering of target objects on a plane surface but not complex surfaces, improves the authenticity of the interactive effect screen of the rendered target object and the interactive object, and improves the user experience.

[0057] In some embodiments, the method of clipping the depth texture using the height map of the target object to obtain a height offset texture relative to the deformable region of the target object may include:

[0058] The depth texture is clipped using the thickness value of the deformable region of the target object and the minimum height value of the target object configured in the target object height map to obtain a height offset texture relative to the deformable region of the target object.

[0059] Optionally, the height map of the target object may include a minimum height value of the target object. In some embodiments, the method of clipping the depth texture using the thickness value of the deformable region of the target object and the minimum height value of the target object configured in the height map of the target object to obtain a height offset texture relative to the deformable region of the target object may include:

[0060] Determining a maximum height value of the target object;

[0061] Using the difference between the maximum height value and the minimum height value as the thickness value of the deformable area of ​​the target object;

[0062] Based on the depth texture, calculating a difference between the depth texture and the minimum height value;

[0063] The difference between the depth texture and the minimum height value is calculated by quotient from the thickness value of the deformable region of the target object, and the quotient is used as the height offset texture relative to the deformable region of the target object.

[0064] By calculating the difference between the depth texture and the minimum height value, the difference value obtained can represent the height value of the interactive object relative to the deformable area of ​​the target object, which is no longer the height value of the interactive object relative to the camera's near and far clipping plane in the prior art. The height offset texture obtained by the difference can support the rendering of the target object on a complex surface. Then, the relative position of the current depth in the target deformable area can be obtained by calculating the quotient of the difference and the thickness value of the deformable area of ​​the target object, that is, the deformation degree coefficient of the target object. The quotient value is used as the height offset texture relative to the deformable area of ​​the target object, and the depth texture can be clipped using the height map of the target object to obtain the height offset texture relative to the deformable area of ​​the target object.

[0065] In an actual scene, the maximum height value of the target object may be the maximum height value set by the user, and the minimum height value of the target object may be the height value stored in the target object height map, wherein the target object height map may be a terrain height map or a height map baked offline by an orthographic camera.

[0066] Taking the target object as snow as an example, the height offset texture can be calculated by the following formula:

[0067]

[0068] Among them, Displacement represents the snow height offset texture, ZBuffer represents the depth texture, SnowHeightMin represents the minimum snow height, and SnowDisplacementMax represents the thickness value of the snow deformable area. It is used to calculate the relative position of the current depth texture ZBuffer in the deformable area of ​​the snow, that is, the deformation coefficient of the snow. Considering that the value obtained by directly calculating the quotient is not necessarily in the closed interval [0,1], the saturate function is used to clamp the above snow deformation coefficient value to the closed interval [0,1], so as to accurately express the concept of snow deformation. When the snow deformation coefficient is 0, it means that the snow is completely sunken; when the snow deformation coefficient is 1, it means that the snow is not sunken.

[0069] In some embodiments, the method of rendering and obtaining the interactive effect picture of the interactive object and the target object by using the height offset texture may include:

[0070] Performing a height offset on the target object using the height offset texture to obtain a deformed target object mesh;

[0071] Based on the deformed target object mesh, an interaction effect picture between the interactive object and the target object is rendered.

[0072] Based on the obtained height offset texture, the height of the target object is offset using the hardware tessellation model and the height offset texture, and a deformed target object mesh can be obtained. Among them, the method of offsetting the height of the target object using the hardware tessellation model and the height offset texture is a conventional method and will not be described in detail here. The obtained deformed target object mesh is used for rendering to obtain an interactive effect screen between the interactive object and the target object.

[0073] In actual scenarios, there are many ways to render the obtained deformed target object mesh to obtain an interactive effect picture between the interactive object and the target object.

[0074] As an implementable method, in the process of using the hardware tessellation model to perform subdivision to obtain the mesh of the target object, considering that the hardware tessellation model used for subdivision uses a plane mesh, the vertex normals of each vertex in the plane mesh are fixed values, and the plane normals calculated after subdivision are also fixed values. Therefore, the height of the mesh vertices after subdivision is offset based on the height offset texture, and the normals obtained by difference calculation are also fixed values, resulting in errors in the normals in the deformable area of ​​the target object, and further resulting in errors in the lighting results in the deformable area of ​​the target object, affecting the rendering effect.

[0075] like Figure 2-1 As shown, taking the target object as snow as an example, the deformable area of ​​the target object may be a snow concave area. If the normal of the snow concave area is wrong, the lighting result in the concave area will also be wrong, resulting in an unsatisfactory interactive effect of the snow concave area obtained by rendering, affecting the rendering effect. Therefore, as an embodiment, it is necessary to recalculate the normal of the deformed target object mesh, such as Figure 2 FIG. 1 is a flowchart of another embodiment of a rendering method provided by an embodiment of the present invention. The method may include the following steps:

[0076] 201: Collect interactive objects that interact with the target object within the field of view.

[0077] 202: Photograph the interactive object from the bottom of the target object to obtain a depth texture of the interactive object.

[0078] 203: Clipping the depth texture using the height map of the target object to obtain a height offset texture relative to a deformable region of the target object.

[0079] The implementation of steps 201-203 is the same as Figure 1 The implementation methods of steps 101-103 in the illustrated embodiment are consistent, and the above steps can refer to Figure 1 The specific implementation of steps 101-103 in the illustrated embodiment will not be described in detail here.

[0080] 204: Use the height offset texture to perform height offset on the target object to obtain a deformed target object mesh.

[0081] The height of the target object is offset using the hardware tessellation model and the obtained height offset texture to obtain the deformed target object mesh.

[0082] 205: Calculate the tangent space normal of the deformed target object mesh.

[0083] In practical applications, after the target object is height-offset using the height-offset texture relative to the deformable area of ​​the target object, the resulting target object mesh is no longer a mesh on a plane, and the mesh normal is no longer a fixed value. Therefore, after obtaining the deformed target object mesh, the tangent space normal of the deformed target object mesh needs to be recalculated.

[0084] 206: Rendering to obtain an interaction effect picture between the interactive object and the target object using the tangent space normal and the deformed target object mesh.

[0085] By using the calculated correct tangent space normal of the mesh, the correct interaction effect picture between the interactive object and the target object can be rendered.

[0086] In the embodiment of the present invention, considering that the mesh subdivision model is only a plane and the normal is a fixed value, it is necessary to recalculate the normal of the target object mesh after deformation, such as Figure 2-2 As shown, after using the height offset texture relative to the deformable area of ​​the target object for calculation, the correct tangent space normal can be obtained, which solves the problem in the prior art that the normal in the deformable area of ​​the target object is incorrect, resulting in incorrect lighting results and unsatisfactory rendering effects. Based on the correct normal of the deformable area of ​​the target object, the correct lighting result of the deformable area can be obtained, thereby improving the rendering effect and enhancing the authenticity of the interactive effect picture of the interactive object and the target object obtained by rendering.

[0087] As another feasible method, in the process of offsetting the height of the target object by using the hardware tessellation model and the height offset texture to obtain the deformed target object mesh, due to the influence of the interactive object model itself, such as the model containing jagged teeth, when the interactive object model is used to render and generate a depth texture, and the height offset texture is obtained based on the depth texture, the obtained height offset texture data will contain some mutation data, resulting in the deformed target object mesh being not smooth enough and the mesh deformation effect being not ideal after the height of the target object is offset by using the height offset texture, thereby affecting the rendering effect.

[0088] like Figure 3-1 As shown, taking the target object as snow as an example, since the dynamic object model itself has spikes, the height offset texture generated thereby will produce mutation data. After the snow height is offset by the height offset texture, the deformed snow mesh shape will have jagged edges, and the snow mesh deformation effect is not ideal, which will cause the rendered snow interaction effect to be not smooth enough and the interaction effect to be less realistic. Therefore, as an embodiment, in order to improve the authenticity of the interaction effect and improve the problem of the target object mesh deformation effect being not ideal, as shown in FIG. Figure 3FIG. 1 is a flowchart of another embodiment of a rendering method provided by an embodiment of the present invention. The method may include the following steps:

[0089] 301: Collect interactive objects that interact with the target object within the field of view.

[0090] 302: Photograph the interactive object from the bottom of the target object to obtain a depth texture.

[0091] 303: Clipping the depth texture using the height map of the target object to obtain a height offset texture relative to a deformable region of the target object.

[0092] The implementation of steps 301-303 is the same as Figure 1 The implementation methods of steps 101-103 in the illustrated embodiment are consistent, and the above steps can refer to Figure 1 The specific implementation of steps 101-103 in the illustrated embodiment will not be described in detail here.

[0093] 304: Smoothing the height offset texture to obtain a smoothed height offset texture.

[0094] Smoothing may refer to filtering the height offset texture to reduce high-frequency signals in the height offset texture to obtain a smoother height offset texture as a smoothed height offset texture.

[0095] Optionally, the method of smoothing the height offset texture to obtain a smooth height offset texture may include:

[0096] The height offset texture is subjected to Gaussian blur processing with a small radius to obtain a smooth height offset texture.

[0097] By performing Gaussian blur processing with a small radius on the height offset texture, the high-frequency signal in the height offset texture can be reduced, filtering processing can be implemented, and a smooth height offset texture can be obtained.

[0098] Optionally, before performing Gaussian blur processing, the method may further include:

[0099] The simple model of the interactive object is rendered using an orthographic camera to obtain a depth texture of the interactive object.

[0100] By using an orthogonal camera to render a simplified model of an interactive object and obtaining a depth texture of the interactive object, the height value mutation in the depth texture can be reduced, thereby making the mesh of the target object smoother after deformation.

[0101] In practical applications, in order to achieve better rendering and obtain the depth texture of interactive objects, it is necessary to select a suitable resolution of the orthogonal camera frame buffer texture. The resolution can be obtained by calculating the pixel density. The pixel density refers to the number of pixels corresponding to the unit length of the world space. Specifically, it can be obtained by calculating the pixel density and the width and height of the orthogonal camera viewport. The width of the frame buffer texture can be obtained by multiplying the pixel density by the width of the viewport, and the height of the frame buffer texture can be obtained by multiplying the pixel density by the height of the viewport. Therefore, a suitable pixel density can be selected to obtain a suitable resolution of the orthogonal camera frame buffer texture. For example, the pixel density can be 32 pixels / unit length.

[0102] 305: Utilize the smooth height offset texture to render and obtain an interactive effect picture of the interactive object and the target object.

[0103] By smoothing the height offset texture, a smooth height offset texture is obtained, which reduces the mutation data in the height offset texture data. Therefore, when the height of the target object is offset by using the smooth height offset texture, a relatively smooth deformed target object mesh can be obtained, such as Figure 3-2 As shown, the problem of jagged mesh deformation and unsatisfactory mesh deformation effect in the prior art is solved, and the rendering effect of the target object is improved. Taking the target object as snow as an example, a relatively smooth snow mesh after deformation is obtained, making the snow interactive effect picture smoother and improving the authenticity of the snow interactive effect.

[0104] In an actual scene, in order to obtain a more realistic target object interaction effect picture, after obtaining the smooth height offset texture, the method may further include:

[0105] Edge enhancement is performed on the smooth height offset texture.

[0106] By performing edge enhancement on the smooth height offset texture, the edge bulge effect of the target object can be increased, further enhancing the realism of the interaction between the target object and the interactive object, and achieving a more realistic interaction effect. Taking snow as an example, in actual scenes, when real snow is stepped on by people in the snow scene, the edge will produce a pile-up effect. Therefore, by performing edge enhancement on the smooth height offset texture, the edge bulge effect of the snow can be obtained, which enhances the realism of the interaction between the snow and the people.

[0107] like Figure 4 FIG. 1 is a flowchart of another embodiment of a rendering method provided by an embodiment of the present invention. The method may include the following steps:

[0108] 401: Collect interactive objects that interact with the target object within the field of view.

[0109] 402: Photograph the interactive object from the bottom of the target object to obtain a depth texture of the interactive object.

[0110] 403: Clipping the depth texture using the height map of the target object to obtain a height offset texture relative to a deformable region of the target object.

[0111] The implementation of steps 401-403 is the same as Figure 1 The implementation methods of steps 101-103 in the illustrated embodiment are consistent, and the above steps can refer to Figure 1 The specific implementation of steps 101-103 in the illustrated embodiment will not be described in detail here.

[0112] 404: Extract edge texture from the height offset texture.

[0113] The Sobel edge detection algorithm can be used to extract edge textures in highly offset textures.

[0114] 405: Increase the height of the edge texture to obtain an enhanced height offset texture.

[0115] The Sobel edge detection algorithm is used to extract the edges in the height offset texture before Gaussian blur. The extracted edge texture is used as a mask to increase the height of the edge area in the height offset texture. Then a small-radius Gaussian blur process is performed to obtain the enhanced height offset texture.

[0116] 406: Using the enhanced height offset texture, render to obtain an interaction effect picture between the interactive object and the target object.

[0117] By performing edge enhancement on the height offset texture, the edge ridge effect of the target object is increased, the authenticity of the rendered target object interaction effect image is improved, and a more realistic interaction effect is achieved.

[0118] In some embodiments, the method of rendering and obtaining the interactive effect picture of the interactive object and the target object by using the height offset texture may include:

[0119] Merging the height offset texture with the cumulative height texture of the previous frame to obtain the cumulative height texture of the current frame;

[0120] The accumulated height texture of the current frame is used to render and obtain an interaction effect picture between the interactive object and the target object.

[0121] The accumulated height texture of the previous frame and the height offset texture of the current frame may be input into the accumulation renderer, and the two may be fused using the ping-pong algorithm to obtain the accumulated height texture of the current frame.

[0122] Optionally, the method of fusing the height offset texture with the accumulated height texture of the previous frame to obtain the accumulated height texture of the current frame may specifically include:

[0123] The height offset texture is compared with the cumulative height texture of the previous frame, and the smaller value is selected as the cumulative height texture of the current frame.

[0124] In practical applications, two textures for accumulating height offset values ​​can be created first, the indexes of the two textures can be exchanged, and then the two textures can be bound to the accumulation renderer for calculating the accumulated height texture. At this time, the input of the accumulation renderer is the accumulated height texture of the previous frame and the height offset texture of the current frame. The two are compared, and the smaller value of the comparison result is selected for output. In this way, for the same position, if there is no height offset in the previous frame, but there is a height offset in the current frame, the height offset value of the current frame is output and saved; and if there is a height offset in the previous frame, but there is no height offset in the current frame, the height offset value of the previous frame is output and saved.

[0125] For the height offset texture after accumulation of the first frame, it refers to the height offset texture obtained by the first frame. Considering that there is no height offset data in the accumulated height offset texture of the previous frame input by the first frame, the height offset texture of the first frame will be completely output to the accumulated height offset texture after taking the minimum value of the two.

[0126] In actual scenes, when rendering to obtain the interactive effect of the target object and the interactive object, the surface of the target object will be deformed, and it can also be restored under certain circumstances. For example, if the target object is snow and the interactive object is a person in the snow scene, the interaction between the two can be that the person stands in the snow scene, and the snow will show a concave effect. At this time, if the snow scene is snowing, the concave effect of the snow can be restored, which is more in line with the changes in the real scene.

[0127] Therefore, in some embodiments, the above method may further include:

[0128] Merging the accumulated height texture of the current frame with a predetermined height value to obtain a restored height value;

[0129] The restored height value is used to render and obtain a deformation restored image of the target object.

[0130] The deformation recovery effect of the target object can be achieved by using the height offset texture accumulated after the current frame plus a user-controllable height value. Taking the snow as an example, in the actual scene, if the snow scene is in a snowing state, the snow will not always be in a sunken state, and the snow depression will gradually recover. At this time, it can be achieved by adding a user-controllable height value on the basis of obtaining the accumulated height texture. Specifically, according to the height value added by the user, the accumulated height texture of each frame in the accumulation renderer is calculated in combination with the added height value. Among them, the height value added by the user can be a value greater than 0, and the height value is added to the accumulated height texture of each frame, so that the values ​​in the accumulated height offset texture gradually become all 1, that is, the snow gradually changes from a completely sunken state to a non-sunken state, thereby achieving snow recovery.

[0131] By adding a user-controllable height value to the accumulated height texture of the current frame, the snow depression is gradually restored, and a more realistic change in the snow depression effect when it is snowing is obtained, which is more in line with the actual scene changes.

[0132] like Figure 5 FIG. 1 is a schematic diagram of a structure of an embodiment of a rendering device provided by an embodiment of the present invention. The device may include the following modules:

[0133] The collection module 501 is used to collect interactive objects that interact with the target object within the field of view.

[0134] Optionally, the collection module 501 may include:

[0135] A collecting unit, for collecting a plurality of objects within a camera viewport using an orthographic camera;

[0136] The determining unit is used to determine the interactive object configured with the interactive tag from the multiple objects.

[0137] The acquisition module 502 is used to photograph the interactive object from the bottom of the target object to obtain the depth texture of the interactive object.

[0138] Optionally, an orthogonal camera may be used to shoot the interactive object from the bottom of the target object to obtain a depth texture, and the depth texture may refer to a height value of the interactive object relative to a near and far clipping plane of the camera.

[0139] When the target object is located on a horizontal plane, optionally, the acquisition module 502 may include:

[0140] The second acquisition unit is used to render the interactive object from the bottom of the target object to the top by using an orthogonal camera to obtain a depth texture.

[0141] The clipping module 503 is used to clip the depth texture using the height map of the target object to obtain a height offset texture relative to the deformable area of ​​the target object.

[0142] The first rendering module 504 is used to render and obtain an interaction effect picture between the interactive object and the target object by using the height offset texture.

[0143] In the embodiment of the present application, the depth texture is clipped by the height map of the target object to obtain the height offset texture relative to the deformable area of ​​the target object. When the height offset texture is used for rendering, the rendering of the target object on a complex surface can be realized, for example, the rendering of snow on different terrains. This solves the problem that the prior art only supports the rendering of target objects on a plane surface but not complex surfaces, improves the authenticity of the interactive effect screen of the rendered target object and the interactive object, and improves the user experience.

[0144] In some embodiments, the cropping module 503 may include:

[0145] The clipping unit is used to clip the depth texture by using the thickness value of the deformable area of ​​the target object and the minimum height value of the target object configured in the target object height map to obtain a height offset texture relative to the deformable area of ​​the target object.

[0146] Optionally, the height map of the target object may include a minimum height value of the target object. In some embodiments, the clipping unit may include:

[0147] A determination subunit, used to determine a maximum height value of the target object;

[0148] a second calculating subunit, configured to use a difference between the maximum height value and the minimum height value as a thickness value of the deformable region of the target object;

[0149] A third calculation subunit, configured to calculate a difference between the depth texture and the minimum height value based on the depth texture;

[0150] The cropping subunit is used to calculate the quotient of the difference between the depth texture and the minimum height value and the thickness value of the deformable area of ​​the target object, and use the quotient as the height offset texture relative to the deformable area of ​​the target object.

[0151] By calculating the difference between the depth texture and the minimum height value, the difference value obtained can represent the height value of the interactive object relative to the deformable area of ​​the target object, which is no longer the height value of the interactive object relative to the camera's near and far clipping plane in the prior art. The height offset texture obtained by the difference can support the rendering of the target object on a complex surface. Then, the relative position of the current depth in the target deformable area can be obtained by calculating the quotient of the difference and the thickness value of the deformable area of ​​the target object, that is, the deformation degree coefficient of the target object. The quotient value is used as the height offset texture relative to the deformable area of ​​the target object, and the depth texture can be clipped using the height map of the target object to obtain the height offset texture relative to the deformable area of ​​the target object.

[0152] In some embodiments, the first rendering module 504 may include:

[0153] A first acquisition unit, configured to use the height offset texture to perform a height offset on the target object to obtain a deformed target object mesh;

[0154] The first rendering unit is used to render and obtain an interaction effect picture between the interactive object and the target object based on the deformed target object mesh.

[0155] Based on the obtained height offset texture, the height of the target object is offset using the hardware tessellation model and the height offset texture, and a deformed target object mesh can be obtained. Among them, the method of offsetting the height of the target object using the hardware tessellation model and the height offset texture is a conventional method and will not be described in detail here. The obtained deformed target object mesh is used for rendering to obtain an interactive effect screen between the interactive object and the target object.

[0156] In actual scenarios, there are many ways to render the obtained deformed target object mesh to obtain an interactive effect picture between the interactive object and the target object.

[0157] As an implementable method, in the process of using the hardware surface subdivision model to obtain the target object mesh by subdividing, considering that the hardware surface subdivision model used for subdivision uses a plane mesh, the vertex normals of each vertex in the plane mesh are fixed values, and the plane normals calculated after subdivision are also fixed values. Therefore, the height of the mesh vertices after subdivision is offset based on the height offset texture, and the normal obtained by difference calculation is also a fixed value, resulting in errors in the normals in the deformable area of ​​the target object, and further resulting in errors in the lighting results in the deformable area of ​​the target object, affecting the rendering effect. Therefore, it is necessary to recalculate the normals of the deformed target object mesh. In some embodiments, the first rendering unit may include:

[0158] A first calculation subunit, configured to calculate a tangent space normal of the deformed target object mesh;

[0159] The first rendering subunit is used to render and obtain an interaction effect picture between the interactive object and the target object by using the tangent space normal and the deformed target object mesh.

[0160] Considering that the mesh subdivision model is only a plane and the normal is a fixed value, it is necessary to recalculate the normal of the target object mesh after deformation, that is, after calculation using the height offset texture relative to the deformable area of ​​the target object, the correct tangent space normal can be obtained, which solves the problem in the prior art that the normal in the deformable area of ​​the target object is incorrect, resulting in incorrect lighting results and unsatisfactory rendering effects. Based on the correct normal of the deformable area of ​​the target object, the correct lighting result of the deformable area can be obtained, thereby improving the rendering effect and improving the authenticity of the interactive effect picture of the interactive object and the target object obtained by rendering.

[0161] As another achievable method, in the process of offsetting the height of the target object using the hardware tessellation model and the height offset texture to obtain the deformed target object mesh, due to the influence of the interactive object model itself, such as the model containing sawtooth, when the interactive object model is used to render and generate a depth texture, and the height offset texture is obtained based on the depth texture calculation, the obtained height offset texture data will contain some mutation data, resulting in the target object mesh obtained after the height of the target object is offset using the height offset texture not being smooth enough, and the mesh deformation effect is not ideal, thereby affecting the rendering effect. Therefore, in order to improve the authenticity of the interactive effect and improve the problem of the unsatisfactory deformation effect of the target object mesh, in some embodiments, the first rendering module 504 may include:

[0162] A smoothing unit, used for smoothing the height offset texture to obtain a smooth height offset texture;

[0163] The second rendering unit is used to use the smooth height offset texture to render and obtain an interaction effect picture between the interactive object and the target object.

[0164] By smoothing the height offset texture, a smooth height offset texture is obtained, which reduces the mutation data in the height offset texture data. When the height of the target object is offset by using the smooth height offset texture, a relatively smooth deformed target object mesh can be obtained, which solves the problem of jagged mesh deformation and unsatisfactory mesh deformation effect in the prior art, and improves the rendering effect of the target object. Taking the target object as snow as an example, a relatively smooth deformed snow mesh is obtained, which makes the snow interactive effect picture smoother and improves the authenticity of the snow interactive effect.

[0165] Optionally, the smoothing unit may include:

[0166] The processing subunit is used to perform a small-radius Gaussian blur process on the height offset texture to obtain a smooth height offset texture.

[0167] In an actual scenario, in order to obtain a more realistic target object interaction effect picture, in some embodiments, the second rendering unit may include:

[0168] An enhancement subunit, configured to perform edge enhancement on the smooth height offset texture to obtain an enhanced height offset texture;

[0169] The second rendering subunit is used to render and obtain an interaction effect picture between the interactive object and the target object by using the enhanced height offset texture.

[0170] By performing edge enhancement on the smooth height offset texture, the edge bulge effect of the target object can be increased, further enhancing the realism of the interaction between the target object and the interactive object, and achieving a more realistic interaction effect. Taking snow as an example, in actual scenes, when real snow is stepped on by people in the snow scene, the edge will produce a pile-up effect. Therefore, by performing edge enhancement on the smooth height offset texture, the edge bulge effect of the snow can be obtained, which enhances the realism of the interaction between the snow and the people.

[0171] In some embodiments, the first rendering module 504 may include:

[0172] An extraction unit, used for extracting edge texture from the height offset texture;

[0173] An enhancement unit, used for increasing the height of the edge texture to obtain an enhanced height offset texture;

[0174] The third rendering unit is used to render and obtain an interaction effect picture between the interactive object and the target object by using the enhanced height offset texture.

[0175] By performing edge enhancement on the height offset texture, the edge ridge effect of the target object is increased, the authenticity of the rendered target object interaction effect image is improved, and a more realistic interaction effect is achieved.

[0176] In some embodiments, the rendering module may include:

[0177] an accumulation unit, used for fusing the height offset texture with the accumulated height texture of the previous frame to obtain the accumulated height texture of the current frame;

[0178] The first rendering unit is used to render and obtain an interaction effect picture between the interactive object and the target object by using the accumulated height texture of the current frame.

[0179] Optionally, the accumulation unit may include:

[0180] The accumulation subunit is used to compare the height offset texture with the accumulated height texture of the previous frame, and select the smaller value as the accumulated height texture of the current frame.

[0181] In practical applications, two textures for accumulating height offset values ​​can be created first, the indexes of the two textures can be exchanged, and then the two textures can be bound to the accumulation renderer for calculating the accumulated height texture. At this time, the input of the accumulation renderer is the accumulated height texture of the previous frame and the height offset texture of the current frame. The two are compared, and the smaller value of the comparison result is selected for output. In this way, for the same position, if there is no height offset in the previous frame, but there is a height offset in the current frame, the height offset value of the current frame is output and saved; and if there is a height offset in the previous frame, but there is no height offset in the current frame, the height offset value of the previous frame is output and saved.

[0182] For the height offset texture after accumulation of the first frame, it refers to the height offset texture obtained by the first frame. Considering that there is no height offset data in the accumulated height offset texture of the previous frame input by the first frame, the height offset texture of the first frame will be completely output to the accumulated height offset texture after taking the minimum value of the two.

[0183] In actual scenes, when rendering to obtain the interactive effect of the target object and the interactive object, the surface of the target object will be deformed, and it can also be restored under certain circumstances. For example, if the target object is snow and the interactive object is a person in the snow scene, the interaction between the two can be that the person stands in the snow scene, and the snow will appear sunken. At this time, if the snow scene is snowing, the sunken effect of the snow can be restored, which is more in line with the changes in the real scene.

[0184] Therefore, in some embodiments, the apparatus may further include:

[0185] A restoration unit, configured to fuse the accumulated height texture of the current frame with a predetermined height value to obtain a restored height value;

[0186] The fifth rendering unit is used to render and obtain a deformation restoration picture of the target object by using the restoration height value.

[0187] The deformation recovery effect of the target object can be achieved by using the height offset texture accumulated after the current frame plus a user-controllable height value. Taking the snow as an example, in the actual scene, if the snow scene is in a snowing state, the snow will not always be in a sunken state, and the snow depression will gradually recover. At this time, it can be achieved by adding a user-controllable height value on the basis of obtaining the accumulated height texture. Specifically, according to the height value added by the user, the accumulated height texture of each frame in the accumulation renderer is calculated in combination with the added height value. Among them, the height value added by the user can be a value greater than 0, and the height value is added to the accumulated height texture of each frame, so that the values ​​in the accumulated height offset texture gradually become all 1, that is, the snow gradually changes from a completely sunken state to a non-sunken state, thereby achieving snow recovery.

[0188] By adding a user-controllable height value to the accumulated height texture of the current frame, the snow depression is gradually restored, and a more realistic change in the snow depression effect when it is snowing is obtained, which is more in line with the actual scene changes.

[0189] Figure 5 The rendering device can execute Figure 1 The implementation principle and technical effect of the rendering method described in the illustrated embodiment will not be described in detail. The specific manner in which each module and unit performs operations in the rendering device in the above embodiment has been described in detail in the embodiment of the method, and will not be described in detail here.

[0190] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0191] The device embodiments described above are merely illustrative, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. A person skilled in the art may understand and implement the present invention without creative effort.

[0192] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0193] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A rendering method, characterized in that: include: Collect interactive objects that interact with the target object within the field of view; photographing the interactive object from the bottom of the target object to obtain a depth texture of the interactive object; Determine a maximum height value of the target object, and use a difference between the maximum height value and a minimum height value configured in the height map of the target object as a thickness value of the deformable region of the target object; Based on the depth texture, calculating a difference between the depth texture and the minimum height value; Calculate the quotient of the difference between the depth texture and the minimum height value and the thickness value of the deformable area of ​​the target object, and use the quotient as the height offset texture relative to the deformable area of ​​the target object; The height offset texture is used to render and obtain an interaction effect picture between the interactive object and the target object.

2. The method according to claim 1, characterized in that The step of using the height offset texture to render and obtain an interactive effect picture between the interactive object and the target object includes: Performing a height offset on the target object using the height offset texture to obtain a deformed target object mesh; Based on the deformed target object mesh, an interaction effect picture between the interactive object and the target object is rendered.

3. The method according to claim 2, characterized in that The rendering based on the deformed target object mesh to obtain an interaction effect screen between the interactive object and the target object includes: Calculating a tangent space normal of the deformed target object mesh; The tangent space normal and the deformed target object mesh are used to render and obtain an interaction effect picture between the interactive object and the target object.

4. The method according to claim 1, characterized in that The step of using the height offset texture to render and obtain an interactive effect picture between the interactive object and the target object includes: Smoothing the height offset texture to obtain a smooth height offset texture; The smooth height offset texture is used to render an interactive effect picture between the interactive object and the target object.

5. The method according to claim 4, characterized in that The step of smoothing the height offset texture to obtain a smooth height offset texture comprises: The height offset texture is subjected to Gaussian blur processing with a small radius to obtain a smooth height offset texture.

6. The method according to claim 4, characterized in that The step of using the smooth height offset texture to render and obtain an interactive effect picture between the interactive object and the target object includes: Performing edge enhancement on the smooth height offset texture to obtain an enhanced height offset texture; The enhanced height offset texture is used to render and obtain an interaction effect picture between the interactive object and the target object.

7. The method according to claim 1, characterized in that The step of using the height offset texture to render and obtain an interactive effect picture between the interactive object and the target object includes: extracting edge texture from the height offset texture; Increasing the height of the edge texture to obtain an enhanced height offset texture; The enhanced height offset texture is used to render and obtain an interaction effect picture between the interactive object and the target object.

8. The method according to claim 1, characterized in that The step of using the height offset texture to render and obtain an interactive effect picture between the interactive object and the target object includes: Merging the height offset texture with the cumulative height texture of the previous frame to obtain the cumulative height texture of the current frame; The accumulated height texture of the current frame is used to render and obtain an interaction effect picture between the interactive object and the target object.

9. The method according to claim 8, characterized in that The step of fusing the height offset texture with the accumulated height texture of the previous frame to obtain the accumulated height texture of the current frame comprises: The height offset texture is compared with the cumulative height texture of the previous frame, and the smaller value is selected as the cumulative height texture of the current frame.

10. The method according to claim 9, characterized in that The method further comprises: Merging the accumulated height texture of the current frame with a predetermined height value to obtain a restored height value; The restored height value is used to render and obtain a deformation restored image of the target object.

11. The method according to claim 1, characterized in that: The step of photographing the interactive object from the bottom of the target object to obtain the depth texture of the interactive object comprises: The interactive object is rendered from the bottom of the target object to the top using an orthogonal camera to obtain a depth texture of the interactive object.

12. The method according to claim 1, characterized in that The interactive objects that interact with the target object within the collection field of view include: Use orthographic cameras to collect multiple objects within the camera viewport; An interactive object configured with an interactive tag is determined from the plurality of objects.

13. A rendering device, characterized in that: include: A collection module, used to collect interactive objects that interact with the target object within the field of view; An acquisition module, used for photographing the interactive object from the bottom of the target object to obtain a depth texture of the interactive object; A clipping module, used for determining a maximum height value of the target object, and taking a difference between the maximum height value and a minimum height value configured in the height map of the target object as a thickness value of the deformable region of the target object; Based on the depth texture, calculating a difference between the depth texture and the minimum height value; Calculate the quotient of the difference between the depth texture and the minimum height value and the thickness value of the deformable area of ​​the target object, and use the quotient as the height offset texture relative to the deformable area of ​​the target object; The first rendering module is used to render and obtain an interaction effect picture between the interactive object and the target object by using the height offset texture.

Citation Information

Patent Citations

  • Method for rendering contour edges of models

    CN102708585A

  • Image rendering method and device

    CN104268922A