Image rendering method and device, terminal equipment and computer readable storage medium

By generating 3D texture maps and rendering them in the Unity engine, the problem of virtual objects losing depth and perspective in virtual scenes is solved, achieving high-quality virtual scene rendering effects.

CN115937396BActive Publication Date: 2026-06-30NETEASE (HANGZHOU) NETWORK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2022-12-26
Publication Date
2026-06-30

Smart Images

  • Figure CN115937396B_ABST
    Figure CN115937396B_ABST
Patent Text Reader

Abstract

This invention provides an image rendering method, apparatus, terminal device, and computer-readable storage medium, comprising: acquiring a scene to be rendered; wherein the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured within the scene; generating a three-dimensional texture map based on distance information and color information corresponding to the surface of each virtual object in the scene; and performing rendering processing on the three-dimensional texture map to obtain a scene image; wherein the scene image is used to represent the virtual objects within the scene to be rendered in a three-dimensional effect on the one side. This invention can provide higher quality images of the interior of virtual scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the gaming industry, games often need to render inaccessible virtual scenes to enhance the atmosphere. For example, in a city scene, players cannot enter all rooms. In such cases, it's unnecessary to create separate art assets for each room and render them individually. A related technology proposes using 2D rendering to create 3D (3D) room visuals, ensuring visual quality while saving on performance and manpower costs.

[0003] Currently, the core idea of ​​mainstream 2D ​​rendering technology for 3D room effects is to abstract the room into a mathematical description of a cuboid. By using a point on the plane and the direction of observation of that point, it is possible to calculate which point on which wall of the room the line of sight will hit. Finally, this point is mapped onto a 2D (2-dimensional) texture for sampling. However, this technology can only abstract a basic cuboid room. Virtual objects inside (such as beds, tables, chairs, and people) will lose perspective effects, resulting in poor room image quality. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide an image rendering method, apparatus, terminal device and computer-readable storage medium that can provide higher quality virtual scene interior images.

[0005] In a first aspect, embodiments of the present invention provide an image rendering method, comprising: acquiring a scene to be rendered; wherein the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured within the scene to be rendered; generating a three-dimensional texture map based on distance information and color information corresponding to the object surface of each virtual object in the scene to be rendered; and performing rendering processing based on the three-dimensional texture map to obtain a scene image; wherein the scene image is used to represent the virtual object within the scene to be rendered in a three-dimensional effect on the one side.

[0006] Secondly, embodiments of the present invention also provide an image rendering apparatus, comprising: a scene acquisition module for acquiring a scene to be rendered; wherein the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured within the scene to be rendered; a texture generation module for generating a three-dimensional texture map based on distance information and color information corresponding to the object surface of each virtual object in the scene to be rendered; and a rendering module for performing rendering processing based on the three-dimensional texture map to obtain a scene image; wherein the scene image is used to represent the virtual object within the scene to be rendered in a three-dimensional effect on the one side.

[0007] Thirdly, embodiments of the present invention also provide a terminal device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the image rendering method provided in the first aspect.

[0008] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the image rendering method provided in the first aspect.

[0009] This invention provides an image rendering method, apparatus, terminal device, and computer-readable storage medium. First, a scene to be rendered is acquired. This scene is a three-dimensional scene with one open side. At least one virtual object to be rendered is configured within the scene. Then, a three-dimensional texture map is generated based on the distance and color information corresponding to the surface of each virtual object in the scene. Finally, the scene image is obtained by rendering based on the three-dimensional texture map. The scene image is used to represent the virtual objects within the scene in a three-dimensional effect on the one open side. This method generates a three-dimensional texture map based on the distance and color information corresponding to the surface of each virtual object in the scene, and then renders the scene image based on the three-dimensional texture map. This effectively improves the problem of virtual objects in virtual scenes losing depth and perspective in existing technologies. Although this invention consumes more space and computing power, existing hardware technology is sufficient to run the above image rendering method to present high-quality internal images of virtual scenes with a low polygon count without affecting the normal operation of the game.

[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0013] Figure 1 This is a schematic diagram illustrating the effect of a 3D room rendered in planar rendering, provided as an embodiment of the present invention.

[0014] Figure 2 This is a flowchart illustrating an image rendering method provided in an embodiment of the present invention;

[0015] Figure 3 This is a schematic diagram of a virtual scene to be rendered, provided as an embodiment of the present invention;

[0016] Figure 4 A flowchart for creating a 3D texture map is provided as an embodiment of the present invention;

[0017] Figure 5 A schematic diagram of a hybrid voxel field provided in an embodiment of the present invention;

[0018] Figure 6 An illustration of a virtual scene provided in an embodiment of the present invention;

[0019] Figure 7 A schematic diagram of a point cloud array provided in an embodiment of the present invention;

[0020] Figure 8 A schematic diagram of an outputTexture node provided in an embodiment of the present invention;

[0021] Figure 9 This is a schematic diagram of a texture slice combination provided in an embodiment of the present invention;

[0022] Figure 10 A schematic diagram of a three-dimensional texture map provided in an embodiment of the present invention;

[0023] Figure 11 A schematic diagram of a scene image provided in an embodiment of the present invention;

[0024] Figure 12 This is a schematic diagram of the structure of an image rendering device provided in an embodiment of the present invention;

[0025] Figure 13 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present invention. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] Currently, the mainstream technology for rendering 3D rooms using planar rendering is based on the 2008 paper "Interior Mapping: A new technique for rendering realistic buildings." This technique is simple to implement, has low performance consumption, requires only a single 2D texture from a specific viewpoint, and a few inexpensive calculations to achieve a true perspective room. However, see... Figure 1 The image shown is a schematic diagram illustrating the effect of rendering a 3D room from a flat surface. Figure 1 The illustration shows that this technology can only abstract a basic rectangular room, meaning only the walls, ceiling, and floor have perspective. Virtual objects such as beds, tables, chairs, and figures placed inside the room will lose depth and perspective, appearing as if they are pasted onto the walls and floor. Based on this, the present invention provides an image rendering method, apparatus, terminal device, and computer-readable storage medium that can provide higher quality virtual scene interior images.

[0028] To facilitate understanding of this embodiment, a detailed description of an image rendering method disclosed in this invention will be provided first, see [link to relevant documentation]. Figure 2 The diagram shows a flowchart of an image rendering method, which mainly includes the following steps S202 to S206:

[0029] Step S202: Obtain the scene to be rendered. The scene to be rendered is configured as a three-dimensional scene with one open side (also known as a boxed scene), where the other five sides are closed. This could be a virtual scene such as an inaccessible room in a city scene. The scene to be rendered contains at least one virtual object to be rendered, such as a table, chair, bed, figure, or ornament. In one implementation, an unrendered virtual scene can be prepared in advance, and an upload channel can be provided to the user to upload the virtual scene.

[0030] Step S204: Based on the distance and color information corresponding to the object surface of each virtual object in the scene to be rendered, a 3D texture map is generated. The distance information refers to the distance between points in the scene to be rendered and the object surface of the virtual object. In one implementation, SDF (Signed Distance Field) values ​​can be generated based on the distance information, and color values ​​of points on the object surface of each virtual object can be generated based on the color information in the texture mapping information (UV). This is then output as a texture slice combination, which represents the scene to be rendered as a combination of 256 256x256 pixel slices. Finally, when the texture slice combination is imported into a specified rendering tool (such as the Unity engine), the texture slice combination can be converted into a 3D texture map by specifying the number of slice rows and columns.

[0031] Step S206: Rendering is performed based on the 3D texture map to obtain a scene image. The scene image is used to represent virtual objects within the scene to be rendered in a 3D effect on the single side. In one embodiment, the SDF value in the scene to be rendered can be progressively moved towards the surface of the rendered object until a specified number of iterations is reached or the distance between a pixel and the surface of the virtual object is less than a preset distance threshold. Once this is achieved, the pixel is identified as a target pixel. The color value in the 3D texture map is sampled using the target pixel, and the resulting color value is the color value corresponding to the target pixel. Rendering in this way yields the scene image, which provides a superior perspective effect for the virtual objects within the scene image.

[0032] The image rendering method provided in this invention generates a three-dimensional texture map based on the distance and color information corresponding to the surface of each virtual object in the scene to be rendered, and then renders the scene image based on the three-dimensional texture map. This can effectively improve the problem of virtual objects in virtual scenes losing depth and perspective in the prior art. Although this invention consumes more space and computing power, existing hardware technology is sufficient to run the above image rendering method to present high-quality virtual scene interior images with a low polygon count without affecting the normal operation of the game.

[0033] The present invention aims to solve the problem of expressing good depth and perspective even when there are other objects in a virtual scene (such as a room). The core of the present invention consists of two main parts: the first part is the texture creation part, which mainly involves baking the color and distance of specific object surfaces onto a 3D texture map. This part can be done using Houdini; the second part is the rendering part, which mainly involves using the 3D texture map and the RayMarching algorithm for rendering.

[0034] To facilitate understanding of the above embodiments, this embodiment of the invention provides an implementation method for the aforementioned step S204. When creating 3D texture maps in Houdini, a virtual scene to be rendered can be prepared in advance. For example, such as... Figure 3 The diagram shows a virtual scene to be rendered. Based on this, embodiments of the present invention provide, as follows: Figure 4 The flowchart shown is for creating a 3D texture map. Figure 4 The following steps 1 to 3 are performed on the virtual scene to be rendered:

[0035] Step 1: Based on the distance information between points in the scene to be rendered and the surfaces of virtual objects, determine the directed distance field values ​​corresponding to the points in the scene to be rendered. For specific implementation details, please refer to steps 1.1 to 1.3 below:

[0036] Step 1.1: Convert the scene to be rendered to voxel format. In one implementation, please refer to... Figure 4 The scene to be rendered is designated as InputScene. This scene is then input into the format conversion (cloud2) node, where it is converted to Volume format. Please continue reading... Figure 4 Since the Volume format is relatively dense, while the VDB (voxel data structure) format is relatively sparse, in order to improve the solution efficiency, the scene to be rendered can be converted from the Volume format to the VDB format through another format conversion (ConvertToVolume) node. It should be noted that both the Volume format and the VDB format can be used to describe the volume in the scene to be rendered.

[0037] Step 1.2: Mix the preset first initial voxel field with the voxel format scene to be rendered to obtain a mixed voxel field. The value of the first initial voxel field is a first preset threshold; please refer to [link to relevant documentation]. Figure 4 First, the first initial voxel field (also called the first initial volume field) is generated using the voxel field generation (volume3) node. Then, the first initial voxel field and the VDB format scene to be rendered are input into the blending (volumemix) node. The blending node blends the first initial voxel field with the VDB format scene to be rendered, resulting in a blended voxel field, such as... Figure 5 The diagram shows a hybrid voxel field.

[0038] Step 1.3: The values ​​of the hybrid voxel field are converted into directed distance fields (SDF) through the voxel directed distance field generation (volumeSdf) node to determine the directed distance field values ​​corresponding to points in the scene to be rendered. The determined directed distance field values ​​are the directed distance field values ​​corresponding to points in the scene to be rendered. In this embodiment of the invention, the generated SDF values ​​are scalars.

[0039] Step 2 involves diffusering the color information corresponding to the surface of each virtual object in the scene to be rendered into a preset point cloud array to determine the color value corresponding to the point in the scene. The size of the point cloud array is the same as the size of the scene to be rendered. For specific implementation details, please refer to steps 2.1 to 2.4 below:

[0040] Step 2.1: Configure a specified number of points on the surface of the virtual object to make the point density on the object surface greater than a preset density threshold. Since the initial points on the object surface are very sparse, a large number of points need to be placed on the object surface to reproduce the texture effect as accurately as possible. Please continue to the next step. Figure 4 Specifically, you can place a specified number of points on the surface of a virtual object by using the (ScatterPointOnSurface) node, so that the point density is high enough to accurately represent the effect of the texture after it is transferred to the scene.

[0041] Step 2.2 adds the texture mapping information of the scene to be rendered to points on the surface of each virtual object in the scene. In practical applications, simple points do not have color information; color information is stored in the texture map. Therefore, please refer to [link to relevant documentation]. Figure 4 , Figure 4 This illustrates how the texture mapping information (i.e., UVs) is first copied to the point by using the CopyUVtoPoint node.

[0042] Step 2.3: Determine the color information corresponding to points on the object's surface based on texture mapping information. Please continue reading... Figure 4 In the GetColorFromTexture node, you can use the texture mapping information of a point to search for color information in the texture to obtain the desired result. Figure 6 The effect, among which, Figure 6 This is a rendering of a virtual scene, where the surface of an object is covered with dense dots to reproduce the original texture as closely as possible.

[0043] Step 2.4 involves spreading the color information across a pre-defined point cloud array to determine the color values ​​corresponding to points within the scene to be rendered. These color values ​​can also be referred to as RGB (primary color) values. Please continue reading... Figure 4 , Figure 4It also illustrates how to create a point cloud array of the same size and space using the EmptyPointCloud node, and then use the attribtransfer1 node to diffuse color information into the point cloud array so that the color in the point cloud array is the color of the point closest to the scene surface, as shown in the image. Figure 7 As shown, Figure 7 This is a schematic diagram of a point cloud array. It should be noted that the Volume format and the point cloud format are not the same, but they share the common feature of being able to use space to index the information stored at a certain location.

[0044] Step 3: Store the directed distance field value into the first channel of the preset blank canvas, and store the color value into the second channel of the blank canvas to obtain a 3D texture map. For specific implementation, please refer to steps 3.1 to 3.3 below:

[0045] Step 3.1: Blend the preset second and third initial voxel fields to obtain a blank canvas. The second initial voxel field is a scalar field, and the third initial voxel field is a vector field. In one implementation, the SDF value of the virtual scene to be rendered is a scalar value in Volume format, and the RGB values ​​of the scene image are three-channel values ​​stored in the point cloud array. First, carriers for the SDF and RGB values ​​are created respectively. Assuming the size of the space containing the virtual scene to be rendered is 256*256*256, two empty initial voxel fields (i.e., volumes) with a size of 4096*4096*1 are set. One is a scalar field named Alpha, and the other is a vector field named Cd. Then, the two initial voxel fields are blended through the EmptyVolume node to represent the space as a 16x16, 256*256 slice array, which is equivalent to obtaining a blank canvas.

[0046] Step 3.2: Store the directed distance field value in the first channel of the blank canvas, and store the color value in the second channel of the blank canvas to obtain a texture slice combination; wherein, the texture slice combination is used to represent the scene to be rendered. The first channel is the alpha channel, and the second channel is the chromatic algebra channel. In one implementation, the above-mentioned outputTexture node consists of multiple Houdini type nodes, see [link to implementation details]. Figure 8 The diagram shown is a schematic of an outputTexture node. Figure 8The diagram illustrates that the encapsulation of the `outputTexture` node aims to convert information in 3D space into a 2D image for output. It has three inputs: the first is a Volume acting as a "canvas," the second is an SDF Volume, and the third is a 3D point cloud array of colors. Clearly, in this invention, since the latter two are created using the same process, the Volume size and the point cloud size are identical. Based on this, please continue reading... Figure 4 Within the encapsulated `outputTexture` node, color values ​​from the point cloud array are read and stored in the Cd channel of the "canvas" based on spatial location. Scalar SDF values ​​from the SDF Volume are read and stored in the Alpha channel of the "canvas." Finally, this "canvas" volume, possessing both Cd and Alpha values, is exported as an image using the `ROPFileOutput` node. This image is one slice in the texture slice composition, and all slices together form the texture slice composition, such as... Figure 9 The diagram illustrates a combination of texture slices, where the scene to be rendered is represented as a combination of 256 slices, each 256x256 pixels. Clearly, to ensure sufficient tiling of the slices, the final generated 2D texture size and 3D size maintain a certain power-law relationship. In this embodiment, the volume size and point cloud size are 256*256*256, which will be converted into a 4096*4096 image. Other available sizes also need to satisfy this relationship; for example, a point cloud size of 64*64*64 corresponds to a texture size of 1024*1024.

[0047] Step 3.3: Obtain a 3D texture map based on the texture slice combination. In specific implementations, the texture slice combination can be converted into a 3D texture map based on a pre-defined number of slice rows and columns. In one embodiment, the texture slice combination needs to be imported into a specified rendering tool for rendering. The specified rendering tool can be the Unity engine, thus completing the rendering work through the Unity engine. In specific implementations, the texture slice combination can be imported into the Unity engine using the Unity engine's import tool. During import, it can be specified as a 3D texture, and a specified number of slice rows and columns can be set, thus reconstructing the 2D texture as a 3D texture. The specified number of slice rows and columns can be determined based on the texture slice combination. For example, if the texture slice combination is a 16x16 slice array, then both the specified number of slice rows and columns are 16. Exemplarily, this embodiment of the invention also provides... Figure 10 The diagram shows a 3D texture map. In practical applications, after the texture slice combination is correctly imported into the Unity engine, the scene can be checked in the Unity engine's resource preview window.

[0048] Furthermore, after the texture slice combination is correctly imported into the Unity engine, the scene image can be obtained by rendering based on the 3D texture map in the Unity engine. In one implementation, see steps a to c below:

[0049] Step a: Based on the directed distance field value in the 3D texture map, the pixels in the 3D texture map are progressively approached until a specified number of approaches is reached or the distance between the pixel and the surface of the virtual object is less than a preset distance value, thus obtaining the target pixel. In one implementation, a shader can be written using the RayMarching algorithm. Starting from the surface of the plane, it checks the alpha value in the 3D texture map to determine how far it is from the object surface, and progressively approaches this distance until a specified number of approaches is reached or the distance to the surface becomes negligible, thus obtaining the target position (i.e., the aforementioned target pixel).

[0050] Step b involves sampling the color value of the 3D texture map based on the target pixel to determine the target color value corresponding to the target pixel. In one implementation, this target location can be used to sample the 3D texture map, and the resulting color value is the final result.

[0051] Step c involves rendering the scene image based on the target color value corresponding to each target pixel. For an example, see [link to example]. Figure 11 The image shown is a schematic diagram of a scene. Figure 11 The diagram illustrates the planar effect from different perspectives (including perspective a and perspective b). Since the walls of the virtual scene to be rendered in the above example are not colored, they will appear as pure black in the scene image.

[0052] In summary, the embodiments of this invention aim to give a 2D image the same depth and perspective as a 3D scene, improving rendering quality for inaccessible rooms and distant windows. Although the embodiments of this invention consume more space and computing power compared to Interior Mapping, existing hardware technology allows the embodiments of this invention to present high-quality interior room images with a low polygon count without affecting the normal operation of the game.

[0053] Regarding the image rendering method provided in the foregoing embodiments, this invention provides an image rendering apparatus, see [link to previous embodiment]. Figure 12 The diagram shows the structure of an image rendering device, which mainly includes the following parts:

[0054] The scene acquisition module 1202 is used to acquire the scene to be rendered; wherein, the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured in the scene to be rendered.

[0055] The texture generation module 1204 is used to generate a 3D texture map based on the distance information and color information corresponding to the object surface of each virtual object in the scene to be rendered.

[0056] The rendering module 1206 is used to perform rendering processing based on the three-dimensional texture map to obtain a scene image; wherein, the scene image is used to represent virtual objects in the scene to be rendered in a three-dimensional effect on the one side.

[0057] The image rendering apparatus provided in this invention generates a three-dimensional texture map based on the distance and color information corresponding to the surface of each virtual object in the scene to be rendered, and then renders the scene image based on the three-dimensional texture map. This can effectively improve the problem of virtual objects in virtual scenes losing depth and perspective in the prior art. Although this invention consumes more space and computing power, existing hardware technology is sufficient to run the above image rendering method to present high-quality virtual scene interior images with a low polygon count without affecting the normal operation of the game.

[0058] In one embodiment, the texture generation module 1204 is further configured to: determine the directed distance field value corresponding to the point in the scene to be rendered based on the distance information between the point in the scene to be rendered and the object surface of the virtual object; diffuse the color information corresponding to the object surface of each virtual object in the scene to be rendered into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered; wherein the size of the point cloud array is consistent with the size of the scene to be rendered; store the directed distance field value in a first channel of a preset blank canvas and store the color value in a second channel of the blank canvas to obtain a three-dimensional texture map; wherein the first channel is an Alpha channel and the second channel is a Cd channel.

[0059] In one embodiment, the texture generation module 1204 is further configured to: convert the scene to be rendered into a voxel format; mix a preset first initial voxel field with the voxel format scene to be rendered to obtain a mixed voxel field; wherein the value of the first initial voxel field is a first preset threshold, and if the value of the mixed voxel field is greater than the first preset threshold, it indicates that the points in the scene to be rendered are located inside the virtual object, and vice versa; convert the mixed voxel field into a directed distance field to determine the directed distance field value corresponding to the points in the scene to be rendered.

[0060] In one embodiment, the texture generation module 1204 is further configured to: configure a specified number of points on the surface of the virtual object so that the point density on the surface of the object is greater than a preset density threshold; add the texture mapping information of the scene to be rendered to the points on the surface of each virtual object in the scene to be rendered; determine the color information corresponding to the points on the surface of the object based on the texture mapping information; and diffuse the color information into a preset point cloud array to determine the color value corresponding to the points in the scene to be rendered.

[0061] In one embodiment, the texture generation module 1204 is further configured to: mix a preset second initial voxel field and a third initial voxel field to obtain a blank canvas; wherein the second initial voxel field is a scalar field and the third initial voxel field is a vector field; store the directed distance field value in the first channel of the blank canvas and store the color value in the second channel of the blank canvas to obtain a texture slice combination; wherein the texture slice combination is used to represent the scene to be rendered.

[0062] In one embodiment, the texture generation module 1204 is further configured to: convert the texture slices into a three-dimensional texture map based on a preset number of slice rows and slice columns.

[0063] In one implementation, the rendering module 1206 is further configured to: progressively advance the pixels in the three-dimensional texture map based on the directed distance field value in the three-dimensional texture map until a specified number of advancements is reached or the distance between the pixel and the surface of the virtual object is less than a preset distance value, thereby obtaining a target pixel; sample the color value in the three-dimensional texture map according to the target pixel to determine the target color value corresponding to the target pixel; and perform rendering processing based on the target color value corresponding to each target pixel to obtain a scene image.

[0064] The device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0065] This invention provides a terminal device, specifically, the terminal device includes a processor and a storage device; the storage device stores a computer program, which is executed by the processor when it runs:

[0066] An image rendering method includes: acquiring a scene to be rendered; wherein the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured in the scene to be rendered; generating a three-dimensional texture map based on the distance information and color information corresponding to the object surface of each virtual object in the scene to be rendered; and performing rendering processing on the three-dimensional texture map to obtain a scene image; wherein the scene image is used to represent the virtual object in the scene to be rendered in a three-dimensional effect on the one side.

[0067] In one implementation, a 3D texture map is generated based on the distance and color information corresponding to the object surface of each virtual object in the scene to be rendered. This includes: determining the directed distance field value corresponding to a point in the scene to be rendered based on the distance information between the point in the scene and the object surface of the virtual object; diffusing the color information corresponding to the object surface of each virtual object in the scene to be rendered into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered; wherein the size of the point cloud array is consistent with the size of the scene to be rendered; storing the directed distance field value in a first channel of a preset blank canvas, and storing the color value in a second channel of the blank canvas to obtain the 3D texture map; wherein the first channel is an alpha channel, and the second channel is a cadmium (Cd) channel.

[0068] In one implementation, determining the directed distance field value corresponding to a point in the scene to be rendered based on the distance information between the point in the scene to be rendered and the surface of the virtual object includes: converting the scene to be rendered into a voxel format; mixing a preset first initial voxel field with the voxel format scene to be rendered to obtain a mixed voxel field; wherein the value of the first initial voxel field is a first preset threshold, and if the value of the mixed voxel field is greater than the first preset threshold, it indicates that the point in the scene to be rendered is located inside the virtual object, and vice versa; converting the mixed voxel field into a directed distance field to determine the directed distance field value corresponding to the point in the scene to be rendered.

[0069] In one implementation, the color information corresponding to the surface of each virtual object in the scene to be rendered is diffused into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered. This includes: configuring a specified number of points on the surface of the virtual objects so that the point density on the surface of the objects is greater than a preset density threshold; adding the texture mapping information of the scene to be rendered to the points on the surface of each virtual object in the scene to be rendered; determining the color information corresponding to the points on the surface of the objects based on the texture mapping information; and diffuse the color information into the preset point cloud array to determine the color value corresponding to the point in the scene to be rendered.

[0070] In one implementation, a directional distance field value is stored in a first channel of a preset blank canvas, and a color value is stored in a second channel of the blank canvas to obtain a 3D texture map. This includes: mixing a preset second initial voxel field and a preset third initial voxel field to obtain a blank canvas; wherein the second initial voxel field is a scalar field and the third initial voxel field is a vector field; storing the directional distance field value in the first channel of the blank canvas and the color value in the second channel of the blank canvas to obtain a texture slice combination; wherein the texture slice combination is used to represent the scene to be rendered.

[0071] In one implementation, obtaining a three-dimensional texture map based on a combination of texture slices includes: converting the combination of texture slices into a three-dimensional texture map based on a pre-defined number of slice rows and columns.

[0072] In one implementation, rendering a scene image based on a 3D texture map includes: progressively advancing pixels in the 3D texture map based on directed distance field values ​​in the 3D texture map until a specified number of advancements is reached or the distance between the pixel and the surface of a virtual object is less than a preset distance value, thereby obtaining a target pixel; sampling color values ​​in the 3D texture map based on the target pixel to determine the target color value corresponding to the target pixel; and rendering a scene image based on the target color value corresponding to each target pixel.

[0073] The terminal device provided in this invention generates a three-dimensional texture map based on the distance and color information corresponding to the surface of each virtual object in the scene to be rendered, and then renders the scene image based on the three-dimensional texture map. This can effectively improve the problem of virtual objects in virtual scenes losing depth and perspective in the prior art. Although this invention consumes more space and computing power, the existing hardware technology is sufficient to run the above image rendering method to present high-quality virtual scene interior images with a low polygon count without affecting the normal operation of the game.

[0074] Figure 13 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present invention. The terminal device 100 includes: a processor 10, a memory 11, a bus 12 and a communication interface 13. The processor 10, the communication interface 13 and the memory 11 are connected through the bus 12. The processor 10 is used to execute executable modules, such as computer programs, stored in the memory 11.

[0075] The memory 11 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 13 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.

[0076] Bus 12 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 13 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0077] The memory 11 is used to store programs. After receiving an execution instruction, the processor 10 executes the programs. The method executed by the device for defining the flow process disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 10 or implemented by the processor 10.

[0078] Processor 10 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 10 or by instructions in software form. Processor 10 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 11. The processor 10 reads the information in memory 11 and, in conjunction with its hardware, completes the steps of the above method.

[0079] The computer program product of the readable storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code, wherein the program code includes instructions that can be executed:

[0080] An image rendering method includes: acquiring a scene to be rendered; wherein the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured in the scene to be rendered; generating a three-dimensional texture map based on the distance information and color information corresponding to the object surface of each virtual object in the scene to be rendered; and performing rendering processing on the three-dimensional texture map to obtain a scene image; wherein the scene image is used to represent the virtual object in the scene to be rendered in a three-dimensional effect on the one side.

[0081] In one implementation, a 3D texture map is generated based on the distance and color information corresponding to the object surface of each virtual object in the scene to be rendered. This includes: determining the directed distance field value corresponding to a point in the scene to be rendered based on the distance information between the point in the scene and the object surface of the virtual object; diffusing the color information corresponding to the object surface of each virtual object in the scene to be rendered into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered; wherein the size of the point cloud array is consistent with the size of the scene to be rendered; storing the directed distance field value in a first channel of a preset blank canvas, and storing the color value in a second channel of the blank canvas to obtain the 3D texture map; wherein the first channel is an alpha channel, and the second channel is a cadmium (Cd) channel.

[0082] In one implementation, determining the directed distance field value corresponding to a point in the scene to be rendered based on the distance information between the point in the scene to be rendered and the surface of the virtual object includes: converting the scene to be rendered into a voxel format; mixing a preset first initial voxel field with the voxel format scene to be rendered to obtain a mixed voxel field; wherein the value of the first initial voxel field is a first preset threshold, and if the value of the mixed voxel field is greater than the first preset threshold, it indicates that the point in the scene to be rendered is located inside the virtual object, and vice versa; converting the mixed voxel field into a directed distance field to determine the directed distance field value corresponding to the point in the scene to be rendered.

[0083] In one implementation, the color information corresponding to the surface of each virtual object in the scene to be rendered is diffused into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered. This includes: configuring a specified number of points on the surface of the virtual objects so that the point density on the surface of the objects is greater than a preset density threshold; adding the texture mapping information of the scene to be rendered to the points on the surface of each virtual object in the scene to be rendered; determining the color information corresponding to the points on the surface of the objects based on the texture mapping information; and diffuse the color information into the preset point cloud array to determine the color value corresponding to the point in the scene to be rendered.

[0084] In one implementation, storing directed distance field values ​​in a first channel of a preset blank canvas and storing color values ​​in a second channel of the blank canvas to obtain a 3D texture map includes: mixing preset second initial voxel fields and third initial voxel fields to obtain a blank canvas; wherein the second initial voxel field is a scalar field and the third initial voxel field is a vector field; storing directed distance field values ​​in the first channel of the blank canvas and storing color values ​​in the second channel of the blank canvas to obtain a texture slice combination; wherein the texture slice combination is used to represent the scene to be rendered; and obtaining a 3D texture map based on the texture slice combination.

[0085] In one implementation, obtaining a three-dimensional texture map based on a combination of texture slices includes: converting the combination of texture slices into a three-dimensional texture map based on a pre-defined number of slice rows and columns.

[0086] In one implementation, rendering a scene image based on a 3D texture map includes: progressively advancing pixels in the 3D texture map based on directed distance field values ​​in the 3D texture map until a specified number of advancements is reached or the distance between the pixel and the surface of a virtual object is less than a preset distance value, thereby obtaining a target pixel; sampling color values ​​in the 3D texture map based on the target pixel to determine the target color value corresponding to the target pixel; and rendering a scene image based on the target color value corresponding to each target pixel.

[0087] The readable storage medium provided in this invention generates a three-dimensional texture map based on the distance and color information corresponding to the surface of each virtual object in the scene to be rendered, and then renders the scene image based on the three-dimensional texture map. This can effectively improve the problem of virtual objects in virtual scenes losing depth and perspective in the prior art. Although this invention consumes more space and computing power, existing hardware technology is sufficient to run the above image rendering method to present high-quality virtual scene interior images with a low polygon count without affecting the normal operation of the game.

[0088] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0089] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. An image rendering method, characterized by, include: Obtain the scene to be rendered; wherein the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured in the scene to be rendered; Based on the distance and color information corresponding to the surface of each virtual object in the scene to be rendered, a three-dimensional texture map is generated; The scene image is obtained by rendering the three-dimensional texture map; wherein, the scene image is used to represent the virtual objects in the scene to be rendered in a three-dimensional effect on one side. The step of generating a 3D texture map based on the distance and color information corresponding to the surface of each virtual object in the scene to be rendered includes: Based on the distance information between points in the scene to be rendered and the surface of the virtual object, the directed distance field value corresponding to the points in the scene to be rendered is determined. The color information corresponding to the surface of each virtual object in the scene to be rendered is diffused into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered; wherein the size of the point cloud array is the same as the size of the scene to be rendered. The directional distance field value is stored in the first channel of a preset blank canvas, and the color value is stored in the second channel of the blank canvas to obtain a three-dimensional texture map; wherein, the first channel is an Alpha channel and the second channel is a Cd channel.

2. The method of claim 1, wherein, The step of determining the directed distance field value corresponding to the point in the scene to be rendered based on the distance information between the point in the scene to be rendered and the surface of the virtual object includes: Convert the scene to be rendered into voxel format; The preset first initial voxel field is mixed with the voxel format scene to be rendered to obtain a mixed voxel field; wherein, the value of the first initial voxel field is a first preset threshold, and if the value of the mixed voxel field is greater than the first preset threshold, it indicates that the points in the scene to be rendered are located inside the virtual object, and vice versa, it indicates that the points in the scene to be rendered are located outside the virtual object. The hybrid voxel field is converted into a directed distance field to determine the directed distance field value corresponding to the point in the scene to be rendered.

3. The method of claim 1, wherein, The step of diffusing the color information corresponding to the surface of each virtual object in the scene to be rendered into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered includes: A specified number of points are configured on the surface of the virtual object so that the point density on the surface of the object is greater than a preset density threshold. The texture mapping information of the scene to be rendered is added to a point on the surface of each virtual object in the scene to be rendered. The color information corresponding to the points on the surface of the object is determined based on the texture mapping information; The color information is diffused into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered.

4. The method of claim 1, wherein, The step of storing the directed distance field value into a first channel of a preset blank canvas and storing the color value into a second channel of the blank canvas to obtain a 3D texture map includes: A blank canvas is obtained by mixing the preset second initial voxel field and the third initial voxel field; wherein the second initial voxel field is a scalar field and the third initial voxel field is a vector field. The directional distance field value is stored in the first channel of the blank canvas, and the color value is stored in the second channel of the blank canvas to obtain a texture slice combination; wherein, the texture slice combination is used to represent the scene to be rendered; A three-dimensional texture map is obtained based on the combination of the texture slices.

5. The method of claim 4, wherein, The process of obtaining a 3D texture map based on the combination of texture slices includes: Based on a pre-defined number of slice rows and columns, the texture slices are combined and converted into a 3D texture map.

6. The method of claim 1, wherein, The process of rendering the scene image based on the 3D texture map includes: Based on the directed distance field value in the three-dimensional texture map, the pixels in the three-dimensional texture map are progressively processed until a specified number of progressive steps are reached or the distance between the pixel and the surface of the virtual object is less than a preset distance value, thereby obtaining the target pixel. The color value of the 3D texture map is sampled based on the target pixel to determine the target color value corresponding to the target pixel; The scene image is obtained by rendering based on the target color value corresponding to each target pixel.

7. An image rendering apparatus, characterized by comprising: include: A scene acquisition module is used to acquire a scene to be rendered; wherein, the scene to be rendered is a three-dimensional scene with one side open, and at least one virtual object to be rendered is configured in the scene to be rendered. The texture generation module is used to generate a three-dimensional texture map based on the distance information and color information corresponding to the object surface of each virtual object in the scene to be rendered; The rendering module is used to perform rendering processing based on the three-dimensional texture map to obtain a scene image; wherein, the scene image is used to represent virtual objects in the scene to be rendered in a three-dimensional effect on one side of the scene. The texture generation module is specifically used to determine the directed distance field value corresponding to the point in the scene to be rendered based on the distance information between the point in the scene to be rendered and the surface of the virtual object; diffuse the color information corresponding to the surface of each virtual object in the scene to be rendered into a preset point cloud array to determine the color value corresponding to the point in the scene to be rendered; wherein the size of the point cloud array is consistent with the size of the scene to be rendered; store the directed distance field value in a first channel of a preset blank canvas, and store the color value in a second channel of the blank canvas to obtain a three-dimensional texture map; wherein the first channel is an alpha channel and the second channel is a cadmium channel.

8. A terminal device, comprising: The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the method according to any one of claims 1 to 6.