Image rendering method and device based on three-dimensional rendering engine, equipment and medium

By implementing image rendering methods in the 3D rendering engine, including creating three-dimensional scenes, vertex data processing and lighting calculation, the problem of insufficient efficiency and flexibility of the existing 3D rendering engine is solved, and the efficiency improvement of 3D scene rendering and personalized needs are achieved.

CN120070713APending Publication Date: 2025-05-30SHENZHEN YUANJING DIGITAL TECHNOLOGY CO LTD

Patent Information

Application Number
CN202510134113.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-06
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The existing three-dimensional rendering engine has limitations in terms of efficiency and flexibility, which is difficult to meet the personalized needs of users, and the learning cost is high, which limits its wide application.

Method used

The efficiency of 3D scene rendering is improved through image rendering methods based on the 3D rendering engine, including creating three-dimensional scenes, spatial transformation and cropping optimization of vertex data, lighting calculation, texture mapping and rasterization processing.

Benefits of technology

It has achieved the efficiency improvement of three-dimensional scene rendering, which can better meet users' personalized needs, and reduce development costs and complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070713A_ABST
    Figure CN120070713A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and discloses an image rendering method based on a three-dimensional rendering engine, which comprises the following steps of: creating a three-dimensional scene based on collected to-be-modeled scene information, obtaining a modeled scene, selecting various attributes of an influence object, obtaining an initial three-dimensional scene model, obtaining vertex data of the initial three-dimensional model, and obtaining the vertex data of the initial three-dimensional scene model; optimizing the cutting space to obtain vertex data in the cutting space; calculating light to obtain a final illumination value of the vertex; calculating texture coordinates, acquiring colors according to the texture coordinates, obtaining texture colors, filtering the texture colors, and obtaining texture mapping color values; and connecting the vertexes into a triangle, converting the triangle into pixels, and performing color filling during processing to obtain a pixel color value in a screen space and a standard rendering result. The invention further provides an image rendering device and equipment based on the three-dimensional rendering engine and a storage medium. According to the invention, the three-dimensional scene rendering efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly to an image rendering method, apparatus, device and medium based on a three-dimensional rendering engine. Background Art

[0002] With the rapid development of computer hardware and graphics technology, three-dimensional rendering technology has been widely applied in fields such as games, movies, virtual reality, and augmented reality. Among them, the progress of hardware, such as the emergence of GPUs, enables complex graphics computing and rendering tasks to be completed in real time, greatly enhancing the interactivity and experience of games and virtual reality. The innovation of graphics technology, such as real-time ray tracing and global illumination, makes the rendering effect more realistic, enhancing the visual impact of movie special effects and architectural design renderings. In addition, three-dimensional rendering technology is also widely used in fields such as architectural design, product design, interior design, urban planning, e-commerce, and advertising and marketing, helping designers better display their creativity and ideas.

[0003] Existing three-dimensional rendering engines, such as Unity, Unreal Engine, etc., although powerful in function, their complexity and high learning cost pose relatively high requirements for developers, resulting in the difficulty of widespread application of three-dimensional rendering. In addition, existing rendering engines also have certain limitations in terms of scalability and flexibility, and cannot fully meet the personalized needs of users.

[0004] The above defects need to be solved urgently. Summary of the Invention

[0005] The present invention provides an image rendering method, apparatus, device and medium based on a three-dimensional rendering engine, and its main purpose is to improve the efficiency of three-dimensional scene rendering.

[0006] To achieve the above purpose, an image rendering method based on a three-dimensional rendering engine provided by the present invention includes:

[0007] Create a three-dimensional scene based on the collected information of the scene to be modeled, obtain the modeled scene, and select various attributes of the objects affected by the modeled scene in a preset property panel to obtain an initial three-dimensional scene model, where the affected objects include geometric objects, light source objects, and camera objects;

[0008] Obtain the vertex data of the initial three-dimensional scene model, perform spatial transformation and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data;

[0009] Calculate the light influence of the clipped vertex data in the clipping space to obtain the final vertex illumination value;

[0010] Calculate texture coordinates using the vertex positions in the cropped vertex data, collect colors from a preset texture image using the texture coordinates to obtain texture colors, and process the texture colors based on a preset texture filtering algorithm to obtain texture mapped color values;

[0011] Connect the cropped vertex data to obtain triangle primitives, perform rasterization processing on the triangle primitives to obtain coordinate fragment data, and perform shading processing on the coordinate fragment data using the texture mapped color values to obtain pixel color values, and perform anti-aliasing processing on the pixel color values to obtain the standard rendering result of the modeled scene.

[0012] Optionally, the creating a three-dimensional scene based on the collected information of the scene to be modeled to obtain a modeled scene includes:

[0013] Create a three-dimensional model based on a preset three-dimensional modeling software using the information of the scene to be modeled to obtain an initial three-dimensional model;

[0014] Set a scene in the initial three-dimensional model to obtain an initial three-dimensional scene, and simplify the number of polygons in the initial three-dimensional scene to obtain an optimized three-dimensional scene;

[0015] Obtain the user perspective of the optimized three-dimensional scene, and dynamically adjust the level of detail of the optimized three-dimensional scene according to the user perspective to obtain a modeled scene.

[0016] Optionally, the processing the texture colors based on a preset texture filtering algorithm to obtain texture mapped color values includes:

[0017] Obtain the texture image corresponding to the texture colors, and perform interpolation calculation on the texture coordinates of each pixel in the texture image to obtain interpolated texture coordinates;

[0018] Obtain color values from the texture image using the interpolated texture coordinates to obtain texture color values;

[0019] Based on the texture color values, perform interpolation between textures at different mipmap levels using a preset bilinear filtering method and mipmap method to obtain sampled color values, and apply the sampled color values to each pixel of the texture image to obtain texture mapped color values.

[0020] Optionally, the calculating the light influence of the cropped vertex data in the clip space to obtain the final vertex lighting value includes:

[0021] Calculate the influence of ambient light in the clip space on the vertex data in the clip space to obtain the ambient light influence, and calculate the diffuse reflection component of the light source according to the preset light source and material data to obtain the diffuse reflection influence;

[0022] Calculate the specular reflection effect of the light source to obtain the specular reflection effect, and synthesize the ambient light effect, diffuse reflection effect and specular reflection effect to obtain the final vertex lighting value.

[0023] Optionally, calculating the texture coordinates using the vertex positions in the clipped vertex data includes:

[0024] Based on the vertex positions in the clipped vertex data, use a preset 3D modeling software to unfold the model surface of the vertex data into a 2D plane to obtain initial texture coordinates;

[0025] Manually set the texture coordinates of the boundary vertices in the 3D modeling software to obtain boundary texture coordinates, correct the initial texture coordinates, and obtain the texture coordinates according to the boundary texture coordinates and the corrected initial texture coordinates.

[0026] Optionally, collecting the color from a preset texture image using the texture coordinates to obtain the texture color includes:

[0027] Load the texture image into a preset graphics API and bind the graphics API texture object to obtain an adjusted graphics API;

[0028] Obtain a standard graphics API by setting texture parameters in the adjusted graphics API;

[0029] Transfer the vertex texture coordinates to a preset fragment shader, and sample the color from the texture image using the texture coordinates and the standard graphics API in the fragment shader to obtain the texture color.

[0030] Optionally, based on the texture color value, interpolating between textures of different mipmap levels using a preset bilinear filtering method and mipmap method to obtain a sampled color value includes:

[0031] Obtain a sampled pixel and calculate the mipmap level of the sampled pixel in the texture space where the texture color value is located to obtain level D;

[0032] Perform bilinear filtering on the mipmaps of level D and level D+1 respectively to obtain a level D color value and a level D+1 color value, and linearly interpolate between the level D color value and the level D+1 color value to obtain the sampled color value.

[0033] To solve the above problems, the present invention also provides an image rendering device based on a 3D rendering engine, and the device includes:

[0034] A scene construction module, configured to create a three-dimensional scene based on the collected scene information to be modeled, obtain a modeled scene, and select various attributes of the objects affected by the modeled scene in a preset property panel to obtain an initial three-dimensional scene model, where the objects affected include geometric objects, light source objects, and camera objects;

[0035] A data acquisition module, configured to acquire vertex data of the initial three-dimensional scene model, perform spatial transformation and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data;

[0036] A color acquisition module, configured to calculate the light influence of the clipped vertex data in the clipping space to obtain the final vertex illumination value;

[0037] Calculate texture coordinates using the vertex positions in the clipped vertex data, collect colors from a preset texture image using the texture coordinates to obtain texture colors, and process the texture colors based on a preset texture filtering algorithm to obtain texture mapping color values;

[0038] A pixel rendering module, configured to connect the clipped vertex data to obtain triangle primitives, perform rasterization processing on the triangle primitives to obtain coordinate fragment data, and perform coloring processing on the coordinate fragment data using the texture mapping color values to obtain pixel color values, and perform anti-aliasing processing on the pixel color values to obtain the standard rendering result of the modeled scene.

[0039] To solve the above problems, the present invention also provides an electronic device, which includes:

[0040] At least one processor; and,

[0041] A memory communicatively connected to the at least one processor; wherein,

[0042] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the image rendering method based on a three-dimensional rendering engine as described above.

[0043] To solve the above problems, the present invention also provides a computer-readable storage medium, including a storage data area and a storage program area, the storage data area stores created data, and the storage program area stores a computer program; wherein, when the computer program is executed by a processor, it implements the image rendering method based on a three-dimensional rendering engine as described above.

[0044] In an embodiment of the present invention, a three-dimensional scene is created based on the collected information of the scene to be modeled, obtaining a modeled scene, and various attributes of the objects affected by the modeled scene are selected in a preset attribute panel to obtain an initial three-dimensional scene model, where the affected objects include geometric objects, light source objects, and camera objects, to implement the construction of the initial model; the vertex data of the initial three-dimensional scene model is obtained, the vertex data is subjected to spatial transformation and projection transformation to obtain transformed vertex data, and the transformed vertex data is optimized in the clipping space to obtain clipped vertex data; the light influence of the clipped vertex data in the clipping space is calculated to obtain the final vertex illumination value, to implement the processing of the lighting environment; the texture coordinates are calculated using the vertex positions in the clipped vertex data, the color is sampled from a preset texture image using the texture coordinates to obtain the texture color, and the texture color is processed based on a preset texture filtering algorithm to obtain the texture mapping color value; the clipped vertex data is connected to obtain triangle primitives, the triangle primitives are rasterized to obtain coordinate fragment data, and the coordinate fragment data is shaded using the texture mapping color value to obtain the pixel color value, and the pixel color value is anti-aliased to obtain the standard rendering result of the modeled scene. Therefore, the image rendering method, device, electronic device, and computer-readable storage medium based on a three-dimensional rendering engine proposed by the present invention calculate each object in the rendering process and combine them to implement the rendering of the three-dimensional scene, improving the efficiency of three-dimensional scene rendering. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 FIG. is a schematic flowchart of an image rendering method based on a three-dimensional rendering engine provided by an embodiment of the present invention;

[0046] Figure 2 FIG. is a schematic module diagram of an image rendering device based on a three-dimensional rendering engine provided by an embodiment of the present invention;

[0047] Figure 3 FIG. is a schematic internal structure diagram of an electronic device for implementing an image rendering method based on a three-dimensional rendering engine provided by an embodiment of the present invention.

[0048] The implementation, functional features, and advantages of the objectives of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0049] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0050] An embodiment of the present application provides an image rendering method based on a three-dimensional rendering engine. The execution subject of the image rendering method based on the three-dimensional rendering engine includes, but is not limited to, at least one of electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided in the embodiment of the present application. Among them, the server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. In other words, the image rendering method based on the three-dimensional rendering engine can be executed by software or hardware installed on a remote device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to: a single server, a server cluster, a cloud server, or a cloud server cluster, etc.

[0051] Referring to Figure 1 As shown, it is a schematic flowchart of an image rendering method based on a three-dimensional rendering engine provided by an embodiment of the present invention. In this embodiment, the image rendering method based on the three-dimensional rendering engine includes the following steps S1 - S5:

[0052] S1. Create a three-dimensional scene based on the collected information of the scene to be modeled, obtain a modeled scene, and select various attributes of the objects affected by the modeled scene in a preset attribute panel to obtain an initial three-dimensional scene model, where the affected objects include geometric objects, light source objects, and camera objects.

[0053] In an embodiment of the present invention, the information of the scene to be modeled refers to the information for creating a three-dimensional model of a building and its surrounding environment, including elements such as the appearance of the building, internal structure, material texture, and landscape design. These models are not only used to display building design schemes and effects, but also can be used for interior design, environmental landscape planning, and building experiences in virtual reality. Finally, through the three-dimensional rendering engine design tool, high-quality rendering of the building model can be performed, which is more convenient for customers to understand and evaluate the design intent.

[0054] In an embodiment of the present invention, the preset attribute panel refers to the interface part in the user interface module of the three-dimensional rendering engine design tool for displaying and editing various attributes of the selected affected objects (such as geometric objects, light source objects, camera objects, etc.). This panel allows users to intuitively adjust and configure the detailed parameters of the affected objects through a graphical interface, thereby achieving fine control of each affected object in the three-dimensional scene.

[0055] Further, creating a three-dimensional scene based on the collected information of the scene to be modeled and obtaining a modeled scene includes:

[0056] Based on a preset 3D modeling software, create a 3D model using the to-be-modeled scene information to obtain an initial 3D model;

[0057] Set a scene in the initial 3D model to obtain an initial 3D scene, and simplify the number of polygons in the initial 3D scene to obtain an optimized 3D scene;

[0058] Obtain the user perspective of the optimized 3D scene, and dynamically adjust the level of detail of the optimized 3D scene according to the user perspective to obtain a modeled scene.

[0059] In the embodiments of the present invention, the influencing objects refer to various elements that have a direct impact on the final rendering result of a 3D scene in the design of a 3D rendering engine, including geometric objects, light source objects, and camera objects.

[0060] Among them, geometric objects are the basic building blocks in a 3D scene, defining the shape and structure of the scene, including building models, human models, curves and surfaces, volume objects, etc.; light source objects are used to simulate the lighting effects in the scene and have an important impact on the darkness, shadows, and colors of objects, including point lights, directional lights, spotlights, etc.; camera objects define the perspective and view parameters of the observer, determining how the user views the 3D scene, including position, orientation, focal length, field of view, depth of field, etc.

[0061] Furthermore, the dynamic adjustment of the level of detail of the optimized 3D scene according to the user perspective is implemented by the LOD method. The LOD (Level of Detail) method is a method for optimizing 3D rendering performance. By dynamically adjusting the level of detail of the model according to the distance between the object and the user perspective, that is, the camera, the rendering load can be reduced while ensuring the visual effect.

[0062] S2. Obtain the vertex data of the initial 3D scene model, perform spatial transformation and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data.

[0063] It can be understood that by obtaining the vertex data of the 3D model, performing spatial transformation and projection transformation on these vertex data, and performing clipping space optimization, the model can be transformed from the model space to the clipping space. By clipping the vertices outside the viewing frustum, the rendering calculation amount can be reduced, the rendering efficiency can be improved, and at the same time, the perspective effect can be simulated through projection transformation to enhance the realism of the scene.

[0064] In the embodiments of the present invention, the vertex data of the initial three-dimensional model refers to the basic geometric information that constitutes the three-dimensional model. These data define the shape and structure of the model. Each vertex is a point in three-dimensional space and usually includes position, normal, texture coordinates, color, tangent, etc.

[0065] Furthermore, to obtain the vertex data of the initial three-dimensional model, appropriate tools or programming libraries can be selected according to the model file format and development environment, and the initial three-dimensional model file can be loaded using the selected tools or programming libraries. The vertex data, usually including position, normal, texture coordinates, etc., is extracted from the loaded model. Finally, the extracted vertex data is processed as needed to obtain the vertex data of the initial three-dimensional model. Among them, the processing steps include data cleaning, conversion, or application to specific tasks.

[0066] In the embodiments of the present invention, by clarifying the complete process of obtaining the vertex data of the initial three-dimensional model, it is ensured that developers can accurately and efficiently extract and process the geometric information of the model, providing basic data support for subsequent tasks such as three-dimensional rendering, animation production, and physical simulation, so as to achieve high-quality visual effects and interactions in the fields of game development, film and television production, virtual reality, etc.

[0067] In the embodiments of the present invention, performing a spatial transformation and a projection transformation on the vertex data, and performing a clipping space optimization to obtain the vertex data in the clipping space includes:

[0068] Transforming the vertices of the initial three-dimensional scene modeling from the model space to the view frustum space, then to the viewport space, obtaining the clipping space through the projection transformation, and performing corresponding transformations on the normals to ensure the correct handling of the surface normal direction in the lighting calculation, thereby obtaining the vertex data in the clipping space.

[0069] In the embodiments of the present invention, by clarifying the transformation process from the model space to the clipping space, including the transformation of vertices and normals, it is ensured that the model is correctly positioned, has an accurate orientation, and achieves a perspective effect, while optimizing the rendering performance. In addition, the correct transformation of the normals ensures the accuracy of the lighting calculation, making the lighting effect natural and realistic.

[0070] S3. Calculate the light influence on the clipped vertex data in the clipping space to obtain the final vertex lighting value.

[0071] It can be understood that by calculating the influence of light on the clipped vertex data to obtain the final vertex lighting value, the visual realism of the model can be significantly enhanced, enabling the scene to show dynamic changes under different lighting conditions, supporting complex lighting effects such as shadows, reflections, and refractions, while optimizing the rendering performance, improving the details and realism of the model surface, and being widely used in the fields of game development, film and television production, virtual reality, and augmented reality.

[0072] Further, calculating the light influence on the clipped vertex data in the clip space to obtain the final vertex lighting value includes:

[0073] Calculating the influence of the ambient light in the clip space on the vertex data in the clip space to obtain the ambient light influence, and calculating the diffuse reflection component of the light source according to the preset light source and material data to obtain the diffuse reflection influence;

[0074] Calculating the specular reflection influence of the light source to obtain the specular reflection influence, and synthesizing the ambient light influence, the diffuse reflection influence, and the specular reflection influence to obtain the final vertex lighting value.

[0075] Further, the ambient light refers to a uniform background light that simulates the indirect light in all directions in the scene. The diffuse reflection light is the light reflected from the object surface under the light, and these lights are evenly distributed in all directions; the specular reflection light refers to the light reflected from the object surface under the light, and these lights are concentrated in a specific direction to form a highlight area. The final lighting value is the combined effect of the ambient light, the diffuse reflection light, and the specular reflection light, representing the final color and brightness of the vertex under all light sources and lighting conditions.

[0076] In another embodiment of the present invention, for each vertex, the corresponding components (such as RGB components) of the above three lighting influence values are added respectively to obtain the complete lighting value of the vertex. For example, if the ambient light influence value of the vertex is (R1, G1, B1), the diffuse reflection influence value is (R2, G2, B2), and the specular reflection influence value is (R3, G3, B3), then the final vertex lighting value is (R1 + R2 + R3, G1 + G2 + G3, B1 + B2 + B3).

[0077] S4. Calculating the texture coordinates using the vertex positions in the clipped vertex data, collecting the color from the preset texture image using the texture coordinates to obtain the texture color, and processing the texture color based on the preset texture filtering algorithm to obtain the texture mapping color value.

[0078] It can be understood that by calculating the texture coordinates corresponding to the vertex positions, sampling the color from the preset texture image, and applying the texture filtering algorithm to process these colors, a smooth and high-quality texture mapping color value can be obtained, which can enhance the details and realism of the model surface.

[0079] In the embodiments of the present invention, the texture coordinates (Texture Coordinates) are usually represented as (u, v) or (s, t), which are two-dimensional coordinates used to map a texture image onto the surface of a 3D model. These coordinates define the position of each vertex on the model surface in the texture image, enabling the texture image to be correctly fitted onto the model. Among them, the texture mapping color value is the color value after texture mapping.

[0080] Furthermore, the preset texture image refers to a two-dimensional image used to provide details and color information for the surface of a 3D model. The texture image can be any type of image, such as a photo, a hand-drawn picture, a procedurally generated image, etc. The resolution and format of the texture image can be selected according to specific requirements, and common formats include PNG, JPEG, BMP, etc.

[0081] In the embodiments of the present invention, the texture filtering algorithm refers to a series of techniques adopted during the texture mapping process to make the sampling result more reasonable and reduce various artificially generated discontinuity phenomena. It is mainly divided into two types: magnification filtering and minification filtering, and specifically includes the nearest neighbor interpolation method, the bilinear filtering method, the trilinear filtering method, etc.

[0082] Furthermore, calculating the texture coordinates using the vertex positions in the clipped vertex data includes:

[0083] Based on the vertex positions in the clipped vertex data, use a preset 3D modeling software to unfold the model surface of the vertex data into a two-dimensional plane to obtain initial texture coordinates;

[0084] Manually set the texture coordinates of the boundary vertices in the 3D modeling software to obtain boundary texture coordinates, and correct the initial texture coordinates. Obtain the texture coordinates according to the boundary texture coordinates and the corrected initial texture coordinates.

[0085] Among them, for a sphere, a spherical coordinate system is adopted, and for a cube, the texture coordinates are directly generated using the coordinates of the vertices; for a plane, the X and Y coordinates of the vertices can be directly used to generate the texture coordinates.

[0086] In the embodiments of the present invention, the modeling software supports the two-dimensional unfolding function on the surface of the three-dimensional model, and can reasonably convert the three-dimensional curved surface into a two-dimensional plane layout for texture mapping according to the vertex position information, and calculate the initial texture coordinate distribution. It also has an automatic UV unfolding tool or module with a built-in intelligent algorithm that can automatically assign texture coordinates according to the geometric features and topological structure of the model, balance problems such as texture stretching and distortion, and improve the uniformity of texture mapping. Finally, it also provides an interactive interface for manually editing texture coordinates, which is convenient for users to finely adjust the texture coordinates for areas that are not ideal after automatic unfolding, especially key parts such as boundary vertices, so as to accurately control the texture mapping effect.

[0087] In the embodiments of the present invention, collecting colors from a preset texture image using the texture coordinates to obtain texture colors includes:

[0088] Loading the texture image into a preset graphics API and binding the texture object of the graphics API to obtain an adjusted graphics API;

[0089] Obtaining a standard graphics API by setting texture parameters in the adjusted graphics API;

[0090] Transferring the vertex texture coordinates to a preset fragment shader, and sampling colors from the texture image using the texture coordinates and the standard graphics API in the fragment shader to obtain texture colors.

[0091] Among them, the graphics API (Application Programming Interface) plays a key middleware role in efficiently processing texture-related operations: common preset graphics APIs include OpenGL, DirectX, etc. A texture object is a data structure or abstract entity inside the graphics API used to encapsulate and manage texture image data and its related attributes, which enables developers to use texture data in an orderly and efficient manner and cooperate with the graphics API to complete complex texture mapping and rendering tasks.

[0092] Further, processing the texture colors based on a preset texture filtering algorithm to obtain texture mapping color values includes:

[0093] Obtaining the texture image corresponding to the texture colors, and performing interpolation calculation on the texture coordinates of each pixel in the texture image to obtain interpolated texture coordinates;

[0094] Obtaining color values from the texture image using the interpolated texture coordinates to obtain texture color values;

[0095] Based on the texture color value, interpolation is performed between textures of different mipmap levels using a preset bilinear filtering method and mipmap method to obtain a sampled color value, and the sampled color value is applied to each pixel of the texture image to obtain a texture mapped color value.

[0096] Further, the interpolation calculation of the texture coordinates of each pixel in the texture image is implemented by means of the texture coordinates of the vertices.

[0097] In the embodiment of the present invention, the texture mapped color value is the color value sampled from a preset texture image according to the texture coordinates of the vertices during the texture mapping process. These color values are used to enhance the details and realism of the surface of the 3D model, so that the model is used to enhance the details and realism of the surface of the 3D model, making the model look more realistic. Among them, the acquisition and application of the texture mapped color value are the core parts of the texture mapping technology.

[0098] Further, the interpolation between textures of different mipmap levels based on the texture color value using a preset bilinear filtering method and mipmap method to obtain a sampled color value includes:

[0099] Obtain a sampled pixel, and calculate the mipmap level of the sampled pixel in the texture space where the texture color value is located to obtain level D;

[0100] Perform bilinear filtering on the mipmaps of level D and level D + 1 respectively to obtain a level D color value and a level D + 1 color value, and obtain a sampled color value by performing linear interpolation between the level D color value and the level D + 1 color value.

[0101] In the embodiment of the present invention, the mipmap method is a technique for optimizing texture mapping, which is achieved by creating multiple scaled versions of the original texture. The resolution of each scaled version is half of the previous version, forming an image pyramid, which can improve the rendering performance and reduce aliasing artifacts, especially when the object is far from the camera.

[0102] S5. Connect the cropped vertex data to obtain a triangle primitive, rasterize the triangle primitive to obtain coordinate fragment data, and use the texture mapped color value to perform shading processing on the coordinate fragment data to obtain a pixel color value, and perform anti-aliasing processing on the pixel color value to obtain the standard rendering result of the modeling scene.

[0103] It can be understood that by accurately converting vertex data into pixels and performing depth testing, blending, and anti-aliasing processing, the clarity and realism of the image are significantly enhanced, and finally a high-quality, smooth, and detail-rich rendering result is presented.

[0104] In an embodiment of the present invention, rasterization is a process in computer graphics of converting geometric graphics into pixels on a screen. It is an important step in a three-dimensional rendering pipeline, responsible for converting geometric data that has undergone vertex shading, lighting calculation, etc. into a two-dimensional image for display on the screen.

[0105] In another embodiment of the present invention, the anti-aliasing process for the pixel color value to obtain the standard rendering result of the modeling scene includes: sampling and analyzing the coverage masks of adjacent pixels in screen space to obtain the color values of the subsampling points, performing weighted mixing on the color values of the subsampling points according to a preset weight distribution function, outputting the finally anti-aliased pixel color value to the frame buffer, and obtaining the standard rendering result.

[0106] Based on the collected information of the scene to be modeled, an embodiment of the present invention creates a three-dimensional scene to obtain a modeling scene, and selects various attributes of the objects affected by the modeling scene in a preset property panel to obtain an initial three-dimensional scene model, where the affected objects include geometric objects, light source objects, and camera objects, to achieve the construction of the initial model; obtain the vertex data of the initial three-dimensional scene model, perform spatial transformation and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data; calculate the light influence of the clipped vertex data in the clipping space to obtain the final vertex lighting value, to achieve the processing of the lighting environment; calculate the texture coordinates using the vertex positions in the clipped vertex data, collect colors from a preset texture image using the texture coordinates to obtain texture colors, and process the texture colors based on a preset texture filtering algorithm to obtain texture mapping color values; connect the clipped vertex data to obtain triangle primitives, perform rasterization processing on the triangle primitives to obtain coordinate fragment data, and perform shading processing on the coordinate fragment data using the texture mapping color values to obtain pixel color values, and perform anti-aliasing processing on the pixel color values to obtain the standard rendering result of the modeling scene. Therefore, the image rendering method, device, electronic device, and computer-readable storage medium based on a three-dimensional rendering engine proposed by the present invention calculate each object in the rendering process and combine them to achieve the rendering of a three-dimensional scene, improving the efficiency of three-dimensional scene rendering.

[0107] As Figure 2 shown, it is a schematic diagram of the modules of the image rendering device based on a three-dimensional rendering engine of the present invention.

[0108] The image rendering device 100 based on a 3D rendering engine according to the present invention can be installed in an electronic device. According to the functions achieved, the image rendering device based on the 3D rendering engine may include a scene construction module 101, a data acquisition module 102, a color acquisition module 103, and a pixel rendering module 104. The modules in the present invention may also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of an electronic device and can complete fixed functions, and are stored in the memory of the electronic device.

[0109] In this embodiment, the functions of each module / unit are as follows:

[0110] The scene construction module 101 is used to create a 3D scene based on the collected scene information to be modeled, obtain a modeled scene, and select various attributes of the objects affected by the modeled scene in a preset property panel to obtain an initial 3D scene model, where the affected objects include geometric objects, light source objects, and camera objects;

[0111] The data acquisition module 102 is used to acquire the vertex data of the initial 3D scene model, perform spatial transformation and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data;

[0112] The color acquisition module 103 is used to calculate the light influence of the clipped vertex data in the clipping space to obtain the final vertex illumination value;

[0113] Use the vertex positions in the clipped vertex data to calculate texture coordinates, collect colors from a preset texture image using the texture coordinates to obtain texture colors, and process the texture colors based on a preset texture filtering algorithm to obtain texture mapped color values;

[0114] The pixel rendering module 104 is used to connect the clipped vertex data to obtain triangle primitives, perform rasterization processing on the triangle primitives to obtain coordinate fragment data, and perform shading processing on the coordinate fragment data using the texture mapped color values to obtain pixel color values, and perform anti-aliasing processing on the pixel color values to obtain the standard rendering result of the modeled scene.

[0115] Specifically, each module in the image rendering device 100 based on the 3D rendering engine in the embodiment of the present invention uses the same technical means as the above Figure 1 The image rendering method based on the 3D rendering engine and can produce the same technical effects, which will not be elaborated here.

[0116] Such as Figure 3As shown, it is a schematic structural diagram of an electronic device for implementing an image rendering method based on a 3D rendering engine according to the present invention.

[0117] The electronic device may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may further include a computer program stored in the memory 11 and executable on the processor 10, such as an image rendering program based on a 3D rendering engine.

[0118] Among them, the processor 10 may be composed of integrated circuits in some embodiments. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same or different functions packaged, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control core (Control Unit) of the electronic device, connecting various components of the entire electronic device through various interfaces and lines, and by running or executing programs or modules stored in the memory 11 (such as executing an image rendering program based on a 3D rendering engine, etc.), and calling data stored in the memory 11, to perform various functions of the electronic device and process data.

[0119] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disks, multimedia cards, card-type memories (such as SD or DX memories, etc.), magnetic memories, magnetic disks, optical discs, etc. The memory 11 may be an internal storage unit of the electronic device in some embodiments, such as the mobile hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 can not only be used to store application software installed on the electronic device and various types of data, such as the code of an image rendering program based on a 3D rendering engine, etc., but also be used to temporarily store data that has been output or will be output.

[0120] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to implement connection communication between the memory 11 and at least one processor 10, etc.

[0121] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), and is generally used to establish a communication connection between this electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), and optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, and is used to display the information processed in the electronic device and to display a visual user interface.

[0122] Figure 3 Only the electronic device with components is shown. Those skilled in the art can understand that Figure 3 the shown structure does not constitute a limitation on the electronic device, and may include fewer or more components than shown, or combine certain components, or have a different component arrangement.

[0123] For example, although not shown, the electronic device may further include a power source (such as a battery) for powering each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so as to implement functions such as charge management, discharge management, and power consumption management through the power management device. The power source may also include any components such as one or more DC or AC power sources, a recharge device, a power failure detection circuit, a power converter or an inverter, and a power status indicator. The electronic device may also include various sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.

[0124] It should be understood that the above embodiments are only for illustration purposes and are not limited by this structure in the scope of the patent application.

[0125] The image rendering program based on the three-dimensional rendering engine stored in the memory 11 of the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:

[0126] Creating a three-dimensional scene based on the collected scene information to be modeled to obtain a modeling scene, and selecting various properties of objects affected by the modeling scene in a preset property panel to obtain an initial three-dimensional scene model, wherein the affected objects include geometric objects, light source objects, and camera objects;

[0127] Acquire vertex data of the initial three-dimensional scene model, perform spatial conversion and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data;

[0128] Calculate the light effect of the clipped vertex data in the clipping space to obtain the final lighting value of the vertex;

[0129] Calculating texture coordinates using vertex positions in the clipped vertex data, collecting colors from a preset texture image using the texture coordinates to obtain texture colors, and processing the texture colors based on a preset texture filtering algorithm to obtain texture mapping color values;

[0130] The clipped vertex data are connected to obtain triangle primitives, the triangle primitives are rasterized to obtain coordinate fragment data, and the coordinate fragment data are shaded using the texture mapping color values ​​to obtain pixel color values, and the pixel color values ​​are anti-aliased to obtain a standard rendering result of the modeling scene.

[0131] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0132] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0133] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0134] Create a three-dimensional scene based on the collected information of the scene to be modeled, obtain the modeled scene, and select various attributes of the object affected by the modeled scene in a preset property panel to obtain an initial three-dimensional scene model, where the affected objects include geometric objects, light source objects, and camera objects;

[0135] Obtain the vertex data of the initial three-dimensional scene model, perform spatial transformation and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data;

[0136] Calculate the light influence of the clipped vertex data in the clipping space to obtain the final vertex lighting value;

[0137] Calculate texture coordinates using the vertex positions in the clipped vertex data, collect colors from a preset texture image using the texture coordinates to obtain texture colors, and process the texture colors based on a preset texture filtering algorithm to obtain texture mapping color values;

[0138] Connect the clipped vertex data to obtain triangle primitives, perform rasterization processing on the triangle primitives to obtain coordinate fragment data, and perform coloring processing on the coordinate fragment data using the texture mapping color values to obtain pixel color values, and perform anti-aliasing processing on the pixel color values to obtain the standard rendering result of the modeled scene.

[0139] In several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0140] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0141] In addition, each functional module in various embodiments of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware, or in the form of hardware plus software functional modules.

[0142] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and the present invention can be implemented in other specific forms without departing from the spirit or basic characteristics of the present invention.

[0143] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be embraced by the present invention. Any associated drawing marks in the claims should not be regarded as limiting the claims involved.

[0144] The blockchain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a string of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer, etc.

[0145] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results.

[0146] In addition, it is obvious that the word "including" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices stated in the system claims can also be implemented by one unit or device through software or hardware. Words such as "second" are used to denote names and do not denote any specific order.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. An image rendering method based on a three-dimensional rendering engine, characterized in that: The method comprises: Creating a three-dimensional scene based on the collected scene information to be modeled to obtain a modeled scene, and selecting various attributes of objects affected by the modeled scene in a preset attribute panel to obtain an initial three-dimensional scene model, wherein the affected objects include geometric objects, light source objects, and camera objects; Acquire vertex data of the initial three-dimensional scene model, perform spatial conversion and projection transformation on the vertex data to obtain transformed vertex data, and perform clipping space optimization on the transformed vertex data to obtain clipped vertex data; Calculate the light effect of the clipped vertex data in the clipping space to obtain the final lighting value of the vertex; Calculating texture coordinates using vertex positions in the clipped vertex data, collecting colors from a preset texture image using the texture coordinates to obtain texture colors, and processing the texture colors based on a preset texture filtering algorithm to obtain texture mapping color values; The clipped vertex data are connected to obtain triangle primitives, the triangle primitives are rasterized to obtain coordinate fragment data, and the coordinate fragment data are shaded using the texture mapping color values ​​to obtain pixel color values, and the pixel color values ​​are anti-aliased to obtain a standard rendering result of the modeling scene.

2. The image rendering method based on a three-dimensional rendering engine according to claim 1, characterized in that: The step of creating a three-dimensional scene based on the collected scene information to be modeled to obtain a modeled scene includes: Based on the preset three-dimensional modeling software, the three-dimensional model is created using the scene information to be modeled to obtain an initial three-dimensional model; By setting a scene in the initial three-dimensional model, an initial three-dimensional scene is obtained, and the number of polygons in the initial three-dimensional scene is simplified to obtain an optimized three-dimensional scene; A user perspective of the optimized three-dimensional scene is obtained, and the detail level of the optimized three-dimensional scene is dynamically adjusted according to the user perspective to obtain a modeled scene.

3. The image rendering method based on a three-dimensional rendering engine according to claim 1, characterized in that: The processing of the texture color based on a preset texture filtering algorithm to obtain a texture mapping color value includes: Acquire a texture image corresponding to the texture color, and perform interpolation calculation on the texture coordinates of each pixel in the texture image to obtain interpolated texture coordinates; Obtaining a color value from the texture image using the interpolated texture coordinates to obtain a texture color value; Based on the texture color value, interpolation is performed between textures at different mipmap levels using a preset bilinear filtering method and a mipmap method to obtain a sampling color value, and the sampling color value is applied to each pixel of the texture image to obtain a texture mapping color value.

4. The image rendering method based on a three-dimensional rendering engine according to claim 1, characterized in that: The calculating the light influence of the clipped vertex data in the clipping space to obtain the final illumination value of the vertex includes: Calculating the influence of the ambient light in the clipping space on the vertex data in the clipping space to obtain the ambient light influence, and calculating the diffuse reflection component of the light source according to the preset light source and material data to obtain the diffuse reflection influence; The specular reflection influence of the light source is calculated to obtain the specular reflection influence, and the ambient light influence, the diffuse reflection influence and the specular reflection influence are synthesized to obtain the final illumination value of the vertex.

5. The image rendering method based on a three-dimensional rendering engine according to claim 1, characterized in that: The step of calculating the texture coordinates using the vertex positions in the clipped vertex data includes: Based on the vertex positions in the clipped vertex data, the model surface of the vertex data is unfolded into a two-dimensional plane using a preset three-dimensional modeling software to obtain initial texture coordinates; The texture coordinates of the boundary vertices are manually set in the three-dimensional modeling software to obtain the boundary texture coordinates, and the initial texture coordinates are corrected, and the texture coordinates are obtained according to the boundary texture coordinates and the corrected initial texture coordinates.

6. The image rendering method based on a three-dimensional rendering engine according to claim 1, characterized in that: The step of acquiring color from a preset texture image using the texture coordinates to obtain texture color includes: Loading the texture image into a preset graphics API and binding the graphics API texture object to obtain an adjusted graphics API; By setting texture parameters in the adjustment graphics API, a standard graphics API is obtained; The texture coordinates are passed to a preset fragment shader, and in the fragment shader, the color is sampled from the texture image using the texture coordinates and the standard graphics API to obtain the texture color.

7. The image rendering method based on a three-dimensional rendering engine according to any one of claims 1 to 6, characterized in that: Based on the texture color value, interpolating between textures at different mipmap levels using a preset bilinear filtering method and a mipmap method to obtain a sampled color value includes: Obtaining a sampled pixel, and calculating a mipmap level of the sampled pixel in a texture space where the texture color value is located, to obtain a level D; Bilinear filtering is performed on the mipmaps of the level D and level D+1 layers respectively to obtain level D color values ​​and level D+1 color values, and a sampling color value is obtained by performing linear interpolation between the level D color values ​​and the level D+1 color values.

8. An image rendering device based on a three-dimensional rendering engine, characterized in that: The device comprises: A scene construction module is used to create a three-dimensional scene based on the collected scene information to be modeled, obtain a modeled scene, and select various properties of the modeled scene influencing objects in a preset property panel to obtain an initial three-dimensional scene model, wherein the influencing objects include geometric objects, light source objects, and camera objects; A data acquisition module, used for acquiring vertex data of the initial three-dimensional scene model, performing spatial conversion and projection transformation on the vertex data to obtain transformed vertex data, and performing clipping space optimization on the transformed vertex data to obtain clipped vertex data; A color acquisition module, used to calculate the light influence of the clipped vertex data in the clipping space to obtain the final illumination value of the vertex; Calculating texture coordinates using vertex positions in the clipped vertex data, collecting colors from a preset texture image using the texture coordinates to obtain texture colors, and processing the texture colors based on a preset texture filtering algorithm to obtain texture mapping color values; A pixel rendering module is used to connect the clipped vertex data to obtain triangle primitives, rasterize the triangle primitives to obtain coordinate fragment data, and use the texture mapping color values ​​to shade the coordinate fragment data to obtain pixel color values, perform anti-aliasing processing on the pixel color values, and obtain a standard rendering result of the modeling scene.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the image rendering method based on a three-dimensional rendering engine as described in any one of claims 1 to 7.

10. A computer-readable storage medium, comprising a data storage area and a program storage area, wherein the data storage area stores created data and the program storage area stores a computer program; wherein: When the computer program is executed by a processor, the image rendering method based on a three-dimensional rendering engine according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • CPU-based graphic rendering engine and realization method

    CN102722861A

  • Three-dimensional scene rendering method and device, electronic equipment and storage medium

    CN114419234A

  • Three-dimensional visualization multi-scene rendering application integration method

    CN117689791A

  • Three-dimensional model high-precision rendering method

    CN118628623A

Cited By

  • Spatial-temporal data volume rendering method for unreal engine

    CN120782939A

  • Rendering processing method and device, equipment, storage medium and program product

    CN121392104A

  • Game scene processing method and system based on image technology

    CN121861232A

  • Scene rendering method and device, electronic equipment and target vehicle

    CN121962397A

  • Scene rendering method and device, electronic equipment and target vehicle

    CN121962397B