WO2022042436A1 - 图像渲染方法、装置、电子设备及存储介质 - Google Patents

图像渲染方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022042436A1
WO2022042436A1 PCT/CN2021/113716 CN2021113716W WO2022042436A1 WO 2022042436 A1 WO2022042436 A1 WO 2022042436A1 CN 2021113716 W CN2021113716 W CN 2021113716W WO 2022042436 A1 WO2022042436 A1 WO 2022042436A1
Authority
WO
WIPO (PCT)
Prior art keywords
edge
matrix
pixel
target
seam
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2021/113716
Other languages
English (en)
French (fr)
Inventor
曹舜
徐华兵
李元亨
魏楠
崔晓春
李从兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology (Shenzhen) Co Ltd
Original Assignee
Tencent Technology (Shenzhen) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology (Shenzhen) Co Ltd filed Critical Tencent Technology (Shenzhen) Co Ltd
Priority to EP21860273.8A priority Critical patent/EP4120199B1/en
Publication of WO2022042436A1 publication Critical patent/WO2022042436A1/zh
Priority to US17/891,485 priority patent/US12266045B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/00—Three-dimensional [3D] image rendering
    • G06T15/50—Lighting effects
    • G06T15/506—Illumination models
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/00—Three-dimensional [3D] image rendering
    • G06T15/04—Texture mapping
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00—Three-dimensional [3D] modelling for computer graphics
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00—Image analysis
    • G06T7/10—Segmentation; Edge detection
    • G06T7/13—Edge detection
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00—Image analysis
    • G06T7/60—Analysis of geometric attributes
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00—Image analysis
    • G06T7/70—Determining position or orientation of objects or cameras
    • G06T7/73—Determining position or orientation of objects or cameras using feature-based methods
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2215/00—Indexing scheme for image rendering
    • G06T2215/12—Shadow map, environment map

Definitions

  • the present application relates to the technical field of image processing, and in particular, to an image rendering method, apparatus, electronic device and storage medium.
  • the terminal can perform image rendering based on GPU (Graphics Processing Unit, image processor).
  • GPU Graphics Processing Unit, image processor
  • lighting rendering is an important part of image rendering, which is mainly used to render the lighting visual effects presented by objects.
  • the mesh of the 3D model needs to be expanded into a two-dimensional space to obtain a two-dimensional image, because the two-dimensional space is also called UV Space, this unwrapping process is also called UV unwrapping, and the two-dimensional image obtained by UV unwrapping is also called lightmap. Then, based on the rendering engine, each pixel of the lightmap is illuminated to obtain the final illuminated image.
  • Embodiments of the present application provide an image rendering method, apparatus, electronic device, and storage medium.
  • the technical solution is as follows:
  • an image rendering method comprising:
  • the seam edge is an edge that is located on the same surface in the target three-dimensional model and has discontinuous texture in the lightmap
  • the target pixel is updated to obtain a repaired lightmap, and the texture of the seam edge in the repaired lightmap is continuous.
  • an image rendering apparatus comprising:
  • the first obtaining module is used to obtain the light map of the target 3D model according to the lighting rendering instruction
  • a second acquiring module configured to acquire a seam edge of the target three-dimensional model, where the seam edge is an edge that is located on the same surface in the target three-dimensional model and has discontinuous texture in the lightmap;
  • a first determining module configured to determine a target pixel in the lightmap based on the seam edge
  • the updating module is used for updating the target pixel to obtain a repaired lightmap, and the texture of the seam edge in the repaired lightmap is continuous.
  • a set of seam edges includes a directed edge and an opposite edge of the directed edge, and the vertices between the directed edge and the opposite edge are coincident and in opposite directions;
  • the second acquisition module is used for:
  • the directed edge and the reversed edge are determined as a set of seam edges in response to the existence of a reversed edge in a directed edge formed by at least two vertices of the plurality of vertices.
  • the device further includes:
  • a second determining module configured to determine a directed edge for any vertex in the plurality of vertices based on the any vertex and the next vertex;
  • a third determining module configured to determine an auxiliary edge that coincides with the vertices between the directed edges and has an opposite direction
  • the fourth determining module is configured to determine whether the opposite edge exists in the directed edge according to the directed edge and the auxiliary edge.
  • the fourth determining module is used for:
  • the directed edge has a reverse edge
  • the directed edge is added to the set of directed edges.
  • the first determining module includes:
  • a first obtaining unit configured to obtain, for any group of seam edges, the pixel position information of the vertices of the any group of seam edges in the lightmap
  • a first determining unit configured to determine the number of pixel samples of any group of seam edges based on the pixel position information of the vertices
  • the second determining unit is configured to determine, based on the pixel position information and the number of pixel samples, the target pixel points corresponding to the any group of seam edges.
  • the second determining unit is used for:
  • the sampling point determined based on the iterative step size is used as the target pixel point.
  • the first determining unit is used for:
  • a value obtained by multiplying the maximum value of the side length of the directional side and the side length of the reverse side by the sampling quality parameter is determined as the number of pixel samples.
  • the update module includes:
  • the construction unit is configured to construct a first matrix and a second matrix based on the pixel value of the target pixel, and the first matrix is used to represent the directed edge and the inverse of the target pixel in a set of seam edges pixel information on the edge, the second matrix is used to represent the initial pixel value of the target pixel in the lightmap;
  • a second obtaining unit configured to obtain a third matrix based on the first matrix and the second matrix, where the third matrix is used to represent the pixel value to be updated of the target pixel;
  • An update unit configured to update the target pixel point from the initial pixel value to the to-be-updated pixel value based on the third matrix, to obtain the repaired lightmap.
  • the second obtaining unit is used for:
  • the third matrix is obtained by processing the first matrix and the second matrix based on the least squares method; or,
  • the first matrix and the second matrix are processed based on the Cholesky decomposition method to obtain the third matrix.
  • the number of rows of the first matrix is a first target number and the number of columns is a second target number, wherein the first target number is the sampling number of the seam edge and the The value obtained by adding the number of target pixels, the second target number is the number of target pixels; the number of rows of the second matrix is the number of the first target and the number of columns of the second matrix for one.
  • an electronic device includes one or more processors and one or more memories, the one or more memories store at least one piece of program code, the at least one piece of program code is executed by the one or more Multiple processors are loaded and executed to implement the image rendering method as in any of the possible implementations described above.
  • a computer-readable storage medium is provided, and at least one piece of program code is stored in the storage medium, and the at least one piece of program code is loaded and executed by a processor to implement the image rendering method as described above in any possible implementation manner.
  • a computer program product or computer program comprising one or more pieces of program codes stored in a computer-readable storage medium.
  • One or more processors of the electronic device can read the one or more program codes from a computer-readable storage medium, the one or more processors execute the one or more program codes to enable the electronic device to Perform the image rendering method of any of the above possible implementation manners.
  • FIG. 1 is a schematic interface diagram of a seam problem provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an implementation environment of an image rendering method provided by an embodiment of the present application.
  • FIG. 3 is a flowchart of an image rendering method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a principle for obtaining non-zero coefficients provided by an embodiment of the present application.
  • FIG. 5 is a flowchart of an image rendering method provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of an image rendering method provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of an operation interface of a rendering engine provided by an embodiment of the present application.
  • FIG. 8 is a comparison diagram before and after repairing a seam problem of an image rendering method provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of an image rendering apparatus provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the term "at least one” refers to one or more, and the meaning of "plurality” refers to two or more, for example, a plurality of first positions refers to two or more first positions.
  • Lightmap refers to the three-dimensional (3D) model data of static objects, using the global illumination algorithm to pre-generate a picture of lighting information, which is used to represent the lighting visual effect of static objects.
  • UV Unwrapping refers to the process of mapping the mesh of 3D model data to a two-dimensional (2D) image, that is, the lighting rendering process from the target three-dimensional model to the light map.
  • Bilinear Interpolation Also known as bilinear interpolation.
  • bilinear interpolation is an extension of linear interpolation on a two-dimensional rectangular grid, and is used to interpolate bivariate functions. The core idea is to perform linear interpolation in two directions respectively.
  • Rasterization refers to the process of converting vertex data into fragments, which has the function of converting original image data into images composed of rasters. The feature is that each element in the fragment corresponds to the frame buffer. a pixel. In other words, rasterization is the process of turning geometric primitives into two-dimensional images.
  • Path Tracing The rendering method proposed by Kajiya in 1986 is the first unbiased rendering method.
  • the basic idea of the path tracing method is to emit a ray from the viewpoint. When the ray intersects the surface of the object, it continues to sample one direction according to the material properties of the surface, and emits another ray, and so on, until the ray hits the light source (or escapes the scene), Then the Monte Carlo method is used to calculate the contribution of light as the color value of the pixel.
  • the Monte Carlo method is used to solve the integral unbiased, as long as the time is long enough, the final image can converge to a correct result.
  • Sparse Matrix In a matrix, if the number of elements with a value of 0 is far more than the number of non-zero elements, and the distribution of non-zero elements is irregular, the matrix is called a sparse matrix. In other words, if the proportion of non-zero elements in a matrix to all elements is less than a proportion threshold, the matrix is a sparse matrix.
  • Least Squares Method Also known as the least squares method, it is an optimization method that can find the best matching function of the data by minimizing the sum of squares of errors.
  • Cholesky Decomposition also known as the Cholesky decomposition method, it refers to decomposing a positive definite Hermitian matrix into a product of a lower triangular matrix and its conjugate transpose matrix.
  • Directional derivative is a concept in analysis, especially in multivariate calculus.
  • the directional derivative of a scalar field along a vector direction at a point depicts the instantaneous rate of change of the scalar field near the point along the vector direction.
  • Directional derivatives are a generalization of the concept of partial derivatives.
  • Gradient The original meaning of the gradient is a vector (vector), which represents the maximum value of the directional derivative of a function at this point along this direction, that is, the function is at this point along this direction (the direction of the gradient). ) changes the fastest and has the largest rate of change (equal to the magnitude of the gradient).
  • Positive-Define Matrix Given a real symmetric matrix A of size n ⁇ n, if for any non-zero vector X of length n ⁇ n, X T AX > 0 is always established, then matrix A is A positive definite matrix. That is to say, for a vector X, we hope that the angle between the new vector M obtained by X after a change in the matrix A and its own vector is less than 90 degrees.
  • Conjugate Gradient Method A method for solving the numerical solution of a system of linear equations whose coefficient matrix is a symmetric positive definite matrix.
  • the conjugate gradient method is an iterative method that is suitable for systems of linear equations with sparse coefficient matrices, because solving such systems using direct methods like the Cholesky decomposition is too computationally intensive.
  • the mesh of the 3D model needs to be expanded into a two-dimensional space to obtain a two-dimensional image, because this two-dimensional space is also called UV space, so this unwrapping process is also called UV unwrapping, and the two-dimensional image obtained by UV unwrapping is also called lightmap. Image.
  • FIG. 2 is a schematic diagram of an implementation environment of an image rendering method provided by an embodiment of the present application.
  • this embodiment includes: a terminal 201 and a server 202, wherein the terminal 201 is any terminal that can provide an image rendering service, and the server 202 is any server that can provide an image downloading service.
  • the image rendering method provided by the embodiments of the present application is applied to the terminal 201, that is, the terminal 201 performs rendering based on the target three-dimensional model based on the rendering engine, so as to obtain its light map, in the terminal 201
  • the lightmap obtained by lighting rendering is displayed on the .
  • the number of the terminals 201 is one or more, and each terminal 201 performs the rendering operation independently, and the target 3D models rendered on different terminals may be the same or different, which is not specifically limited in this embodiment of the present application .
  • the terminal 201 and the server 202 can be directly or indirectly connected through wired or wireless communication, which is not limited in this application.
  • the terminal 201 uploads the rendered lightmap to the server 202, and the server 202 provides an image download service, so that any terminal can download the lightmap after logging in to the server 202. , to view the lightmap at any time.
  • the server 202 includes at least one of a server, multiple servers, a cloud computing platform or a virtualization center.
  • the server 202 undertakes the main computing work, and the terminal 201 undertakes the secondary computing work; or, the server 202 undertakes the secondary computing work, and the terminal 201 undertakes the main computing work;
  • the computing architecture performs collaborative computing.
  • the terminal 201 generally refers to one of multiple terminals, and the device types of the terminal 201 include but are not limited to: smart phones, tablet computers, notebook computers, desktop computers, smart speakers, smart watches, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Compression Standard Audio Layer 3) player, MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) player, etc., but not limited to this.
  • the terminal includes a desktop computer for illustration.
  • the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud Cloud servers for basic cloud computing services such as communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
  • cloud databases cloud computing
  • cloud functions cloud storage
  • network services cloud Cloud servers for basic cloud computing services such as communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
  • CDN Content Delivery Network
  • FIG. 3 is a flowchart of an image rendering method provided by an embodiment of the present application. Referring to FIG. 3 , this embodiment is executed by an electronic device, and the following is described by taking the electronic device as a terminal as an example, and this embodiment includes:
  • the terminal obtains a light map of the target three-dimensional model according to the lighting rendering instruction.
  • the target 3D model refers to the 3D model to be rendered this time, and the target 3D model corresponds to at least one object.
  • the target 3D model is the 3D model of a single object in the virtual scene, or the target 3D model is multiple objects in the virtual scene. 3D model of an object.
  • the above step 301 that is, a possible implementation manner of the terminal acquiring the lightmap of the target 3D model in response to the light rendering instruction.
  • it when rendering the target 3D model, it involves performing illumination rendering on the target 3D model.
  • the terminal performs illumination rendering on the target 3D model based on a rendering engine.
  • the terminal receives a lighting rendering instruction, and based on the lighting rendering instruction, uses a path tracing algorithm to render each pixel of the lightmap, that is, obtains the lightmap of the target three-dimensional model.
  • the terminal receives the lightmap (lightmap) rendering instruction of the target 3D model of any object, uses the path tracking algorithm to render each pixel of the lightmap, and finally obtains the lightmap of the object, which can achieve an unbiased Lighting rendering effect.
  • a ray can be emitted from the viewpoint.
  • the ray intersects the surface of the object, it continues to sample one direction according to the material properties of the surface, and emit another ray, and so on, until the ray hits the light source (or escape from the scene), and then use the Monte Carlo method to calculate the contribution of light as the color value of the pixel.
  • the path tracing algorithm is based on the ray tracing algorithm (Ray Tracing) combined with the Monte Carlo method to solve the integral. Since the Monte Carlo method is used to solve the integral is unbiased, as long as the time is long enough, the final It can converge to a global light map, so the path tracing algorithm can achieve unbiased lighting rendering effect.
  • the terminal may also perform lighting rendering based on a rasterization method or a ray tracing algorithm, thereby simplifying the calculation amount of the lighting rendering process.
  • the embodiments of the present application do not specifically limit the lighting rendering method.
  • the terminal acquires a seam edge of the target three-dimensional model, where the seam edge is an edge that is located on the same surface in the target three-dimensional model and has discontinuous texture in the lightmap.
  • the pixel point corresponding to the seam edge and its neighbor points should also have continuous textures in the lightmap. However, it is precisely because of the process of UV unwrapping. , it is possible to expand the seam edges to non-adjacent positions of the lightmap respectively. If the texture of the pixels at the non-adjacent positions above is discontinuous, it will lead to seam problems.
  • the left and right lines of the lightmap should actually be the same seam edge in the 3D model of the cylinder, if the textures of the left and right lines of the lightmap are Discontinuity (for example, the pixel value of the pixel has a sudden change), which will cause the rendered cylinder to have an uneven transition on both sides of the seam edge, that is, seam problems, which need to be solved in image rendering. was repaired.
  • the terminal may automatically identify the seam edge of the target 3D model after executing the above step 301, or the terminal may pre-recognize the seam edge of the 3D model before executing the above step 301.
  • This embodiment of the present application is not correct.
  • the sequence of execution of the two steps of identifying seam edges and rendering lightmaps is specifically limited.
  • the above step 302 is also the process of the terminal automatically identifying the seam problem.
  • the seam problem occurs, there is at least one set of seam edges in the three-dimensional model of each object (Object). It can be seen that a set of seam edges is composed of a directed edge and an opposite edge of the directed edge, wherein the vertices between the directed edge and the opposite edge are coincident and in opposite directions. Since the directed edge and the reversed edge are originally co-edge in the target 3D model, it should present a continuous and smooth lighting transition effect. Therefore, the texture is discontinuous and the lighting transition is not smooth in the same surface in the box area as shown in Figure 1.
  • the terminal may identify the seam edge based on the following methods: the terminal acquires a plurality of vertices in at least one face of the target three-dimensional model; There is a reverse edge to the edge, and the directional edge and the reverse edge are determined as a set of seam edges.
  • the automatic identification and judgment of seam edges can be completed by directly using the vertex information that the target 3D model needs to obtain in its own rendering stage, without pulling additional external data, and without investing additional labor costs, which can greatly Improve image rendering efficiency and reduce labor costs for image rendering.
  • the terminal may acquire grid information of the target three-dimensional model based on bake task information of the target three-dimensional model.
  • the baking refers to the process of obtaining a lightmap based on the model data of the target 3D model, so the baking task information is task information created by the terminal based on the lighting rendering instruction.
  • the grid information includes each vertex information, normal information, UV coordinates, triangular surface information, etc. in each surface, and the triangular surface here refers to a model plane uniquely determined by three vertices.
  • the terminal can acquire a plurality of vertices in at least one surface of the target three-dimensional model from the mesh information.
  • the terminal may further perform the following initialization step: create a set (referred to as Seams) for recording two directed edge pairs, and each element in the set is a pair of mutually Reverse directed edge (directed edge VertexEdge and auxiliary edge ReversedEdge), the auxiliary edge here is an edge constructed based on the directed edge, not necessarily a real directed edge in the target 3D model, Seams Initialized to an empty set.
  • create a set of directed edges the set of directed edges is used to record the real existing directed edges in the target 3D model, optionally, the set of directed edges is data such as dictionary, array, list, queue, stack, etc.
  • the directed edge set is a dictionary set, denoted as EdgeMap
  • the dictionary set is a data structure stored in a key-value type
  • the value of Key (key name) is Directed edge
  • the Value (key value) value includes the normal information and UV coordinates of the two vertices of the directed edge.
  • the terminal determines whether any directed edge has its opposite edge based on the following operation: for any vertex among the plurality of vertices, based on the vertex Determine a directed edge with the next vertex; determine the auxiliary edge that coincides with the vertex between the directed edge and has the opposite direction; according to the directed edge and the auxiliary edge, determine whether the directed edge has the opposite edge, which can be Optionally, where the auxiliary edge is another directed edge, the auxiliary edge is determined to be the opposite edge of the directed edge.
  • the terminal may perform the following traversal operation to determine whether the directed edge formed by at least two vertices has its opposite edge: traverse each face of the target three-dimensional model, taking each face as a triangular face as an example , for any triangular face, traverse the three vertices within the triangular face.
  • traverse each face of the target three-dimensional model taking each face as a triangular face as an example , for any triangular face, traverse the three vertices within the triangular face.
  • the directed edge VertexEdge create an auxiliary edge ReversedEdge that coincides with the vertex between the directed edge and has the opposite direction.
  • auxiliary edge ReversedEdge check whether there is data corresponding to the auxiliary edge ReversedEdge.
  • This seam edge is a directed edge and A set of directed edge pairs (VertexEdge and RervsedEdge) formed by reverse edges, insert the directed edge pair (VertexEdge and RervsedEdge) into the directed edge pair set Seams, otherwise, if there is no corresponding data in the dictionary set EdgeMap , indicating that there is no seam problem in this directed edge VertexEdge, insert this directed edge VertexEdge into the dictionary set EdgeMap, continue to traverse the next vertex in the current face, and execute the above process in a loop until the traversal of each face. For each vertex, return the final set of directed edge pairs Seams.
  • the terminal when confirming whether there is data corresponding to the auxiliary edge ReversedEdge of the directed edge in the dictionary set EdgeMap, the terminal follows the following two judgment principles. If there is a target directed edge in the dictionary set EdgeMap, it satisfies: 1 ) The UV coordinates of the directional edge of the target are the same as the UV coordinates of the auxiliary edge ReversedEdge; 2) The angle between the normal of the auxiliary edge ReversedEdge and the two vertices of the directional edge of the target is less than the angle threshold, then it means that the target The directed edge and the auxiliary edge ReversedEdge are co-edge (that is, the two sides coincide), indicating that there is a seam problem. Among them, the angle threshold of seam in the editor can be set to normalcosthreadhold.
  • the auxiliary edge is determined as the relevant edge.
  • Reverse edge of the directed edge if the directed edge set of the target 3D model EdgeMap cannot find the same edge as the auxiliary edge ReversedEdge, add the directed edge VertexEdge to the directed edge set EdgeMap.
  • a set of directed edge pairs with reverse edges can be identified and added to the directed edge pair set Seams during the looping process, and the directed edge pair set Seams can be used as the return value after the final traversal is completed.
  • the terminal determines the target pixel in the lightmap based on the seam edge.
  • the target pixel point refers to the pixel point to be repaired in the process of repairing the seam problem.
  • the above step 303 is also the process of the terminal automatically repairing the seam problem.
  • the terminal determines the target pixel point corresponding to the seam edge in the light map.
  • the terminal may collect the pixel information of the pixel points forming each group of seam edge in the lightmap lightmap, optionally, the pixel information of a pixel point includes the pixel position information of the pixel point (that is, position coordinates) and pixel color information (that is, light color information), and the data set formed by the pixel information of the pixel points forming each group of seam edges is denoted as SeamTexels.
  • the terminal determines the target pixel point by the following methods: obtaining the pixel position information of any group of the seam edge vertices corresponding to the pixels in the lightmap; based on the pixel The position information is used to determine the number of pixel samples corresponding to any group of the seam edges; based on the pixel position information and the number of pixel samples, the target pixel points corresponding to any group of the seam edges are determined.
  • the terminal may perform the following steps: traverse each set of seam edges in each directed edge pair set Seams (a set of seam edges includes a pair of directed edges A and B in opposite directions) ), and then the terminal obtains the pixel position information of the pixels corresponding to the vertices of the directed edges A and B in the lightmap: (StartPosA, EndPosA, StartPosB, EndPosB).
  • StartPosA is the pixel position information of the pixel corresponding to the starting vertex of the directed edge A
  • EndPosA is the pixel position information of the pixel corresponding to the end vertex of the directed edge A
  • StartPosB is the starting vertex of the directed edge B.
  • the pixel position information of the corresponding pixel point, EndPosB is the pixel position information of the pixel point corresponding to the end vertex of the directed edge B.
  • the directed edges A and B share the same edge in the target 3D model (that is, the vertices are coincident), there are different start and end vertices in the lightmap, and it is precisely because the target 3D model has different starting and ending vertices.
  • the overlapping vertices in the model are divided and split in the lightmap, which will cause the so-called "seam problem", resulting in the visual problem of discontinuous lighting transition as shown in the box area in Figure 1. Therefore, for each group The seam edge will obtain the pixel position information of the corresponding pixels of the four vertices.
  • the terminal After acquiring the pixel position information of the pixels corresponding to the four vertices, the terminal can calculate the number of pixel samples corresponding to this group of seam edges based on the pixel position information of the pixels corresponding to the four vertices.
  • the terminal can determine the number of pixel samples based on the following steps: obtain the length of the directional edges in any group of seam edges and the The side length of the reverse side of the directional side; the value obtained by multiplying the maximum value of the side length of the directional side and the side length of the reverse side and the sampling quality parameter is determined as the number of pixel samples.
  • the pixel information of the target pixels forming the seam edge can be collected as much as possible through a small number of pixel samples, with high sampling quality, wherein the pixel information of each target pixel at least includes The pixel position information of the target pixel point and the illumination color information of the target pixel point (for example, the respective pixel values of the three RGB channels).
  • the value obtained by adding the side length of the directional side and the side length of the reverse side can also be multiplied by the sampling quality parameter to obtain the number of pixel samples. Improve the final sample quality.
  • SampleCount Max(SampleCountA,SampleCountB)*SampleQuanlity, where SampleQuanlity is a sampling quality parameter passed in by the baking parameters of the editor.
  • the terminal may determine the target pixel point based on the following method: according to the pixel position information and the pixel sampling number, determine the iterative step size of the sampling process, that is, the iterative step size of pixel sampling ; Take the pixel point corresponding to any vertex as the starting point, and perform pixel sampling based on the iteration step size; take the sampling point determined based on the iteration step size as the target pixel point, that is, the sampling point determined in the pixel sampling Get the target pixel.
  • the terminal can obtain the pixels (to be sampled) spanned by the directed edge A in the lightmap according to the pixel position information StartPosA and EndPosA of the two vertices of the directed edge A.
  • the pixel points are referred to as sampling points for short), and the sampling points are recorded in the pixel list.
  • the principle of search and deduplication may be followed.
  • StepIndex equivalent to the number of samplings
  • the terminal updates the target pixel to obtain a repaired lightmap, and the texture of the seam edge in the repaired lightmap is continuous.
  • the textures of the pixels corresponding to the seam edge and the adjacent points in the repaired lightmap are continuous, in other words, the textures in the repaired lightmap are continuous.
  • step 304 that is, the terminal updates the initial pixel value of the target pixel in the lightmap to obtain a repaired lightmap.
  • the terminal before updating the target pixel, the terminal needs to solve the to-be-updated pixel value of the target pixel.
  • the terminal constructs a first matrix and a second matrix based on the pixel information of the target pixel; and obtains a third matrix based on the first matrix and the second matrix, and the third matrix is used to represent the target pixel.
  • the pixel value to be updated After acquiring the to-be-updated pixel value of the target pixel, the terminal may update the target pixel from the initial pixel value to the to-be-updated pixel value based on the third matrix to obtain a repaired lightmap.
  • the first matrix is used to represent the pixel information of the target pixel on the directional side and the reverse side within a group of seam edges, that is to say, the first matrix is used to represent the target pixel
  • the second matrix is used to represent the initial pixel value of the target pixel in the lightmap.
  • a set of linear equations can be constructed according to the first matrix and the second matrix. This is because when updating the target pixel in the lightmap, it is usually necessary to separately calculate the RGB (red) The pixel values of the three channels of green and blue) are updated, so three linear equations can be constructed for the three channels of RGB, and finally the pixel values to be updated under each channel can be obtained.
  • the terminal processes the first matrix and the second matrix based on a conjugate gradient method to obtain the third matrix.
  • the conjugate gradient method is a data processing method that combines the conjugation and the steepest descent method. After the first matrix and the second matrix are used to construct a linear equation system, after the target pixel is on the three RGB channels On the basis of the initial pixel value, iterate separately, and then output the pixel value to be updated of the target pixel on the three RGB channels.
  • the conjugate gradient method can solve the third matrix faster and has less data storage, so the acquisition rate of the third matrix can be improved.
  • the number of rows of the first matrix A is the first target The number is m and the number of columns is the second target number n, that is, the first matrix A is a matrix with m rows and n columns.
  • the number of samples of a group of seam edges can be represented as SampleCount
  • the number of samples of all seam edges r0 ⁇ SampleCountForEverySeamPair
  • the number of target pixels r1 Count(SeamTexels)
  • r1 is the number of elements in SeamTexels.
  • the first matrix A is a sparse matrix.
  • Each line contains 8 non-zero elements because the bilinear difference method is usually used for lightmaps to determine the pixel information of a sampling point, for example, a position point in the seam edge of the target 3D model, in the lightmap It is expanded into a pair of target pixels, that is, a position point in the seam edge corresponds to a pair of target pixels in the lightmap.
  • the pair of target pixels needs to be Each target pixel is used as a sampling point.
  • each pair of target pixels can be sampled to obtain a set of There are a total of eight neighborhood points, and 8 non-zero coefficients are calculated based on the pixel position information and lighting color information of the eight neighborhood points. For example, four pixels (neighborhood points) around a sampling point need to be interpolated separately. Since the seam edge needs to interpolate the data of the directed edge and the reverse edge distributed on both sides of the seam, so It is necessary to consider the four pixel points around the sampling point on the side corresponding to the seam edge (ie neighborhood points), so each row contains 8 non-zero coefficients.
  • FIG. 4 is a schematic diagram of a principle for acquiring non-zero coefficients provided by an embodiment of the present application, and a manner of acquiring 8 non-zero coefficients in each row in the first matrix A is shown in FIG. 4 .
  • the pixel coordinates of the sampling point are (x, y)
  • the value obtained by rounding down x is recorded as floor(x)
  • the value obtained by rounding up x is recorded as ceil(x).
  • the value obtained by rounding down y is recorded as floor(y)
  • the value obtained by rounding up y is recorded as ceil(y)
  • ceil(y) so that the 4 pixels around the sampling point (x, y) can be determined: ( floor(x), floor(y)), (ceil(x), floor(y)), (floor(x), ceil(y)), (ceil(x), ceil(y)).
  • frac(x) is the difference between x and floor(x)
  • frac(y) is the difference between y and floor(y).
  • the terminal can obtain the other 4 non-zero coefficients on the opposite side of the directional side in a group of seam sides in a similar way, which are denoted as b0, b1, b2, and b3. Then a0 to a3 and b0 to b3 can be used as the 8 non-zero coefficients of the row corresponding to the sampling point in the first matrix A.
  • each non-zero coefficient in the first r0 row of the first matrix A can be constructed based on the bilinear interpolation method, and the remaining coefficients are filled with 0.
  • a matrix with ⁇ as the coefficient can be used for the last r1 row of the first matrix A. In each row, only the column where the sampling point itself is located takes the value ⁇ , and the other items are all 0, where ⁇ is determined by the editor of the rendering engine.
  • a decimal number in the range of [0,1] that is, the baking result coefficient
  • a default value such as 0.5.
  • the matrix coefficients of the first matrix A are determined based on bilinear interpolation, and the first matrix A can be easily and quickly constructed. In some embodiments, bicubic interpolation and other methods can also be used to determine the first matrix. The matrix coefficients of A, which can improve the sampling accuracy.
  • the second matrix b is a column vector with m rows.
  • the value of b in the first row r0 is 0, and the value of b in the row r1 is the illumination
  • the value of the original pixel in the map that is, the initial pixel value of the target pixel
  • a in the loop logic is the first matrix (that is, the coefficient matrix of the linear equation system), b is the second matrix (that is, the observed value of the linear equation system under the observation data), k is the number of iterations, and r is the current
  • the prediction error of the iterative process p is the gradient of the third matrix x of the current iterative process, ⁇ and ⁇ are the iterative steps when solving the linear equation system, x0 is the initial pixel value of the target pixel in the lightmap, and the final output
  • the result x k+1 is the pixel value to be updated of the target pixel in the lightmap.
  • the above loop logic is also the conjugate gradient descent algorithm.
  • the prediction error r 0 , the gradient p 0 and the number of iterations k are initialized, and then based on the above formulas, the iterative steps ⁇ k and ⁇ k of the current iterative process are iteratively calculated, and the gradient is calculated.
  • p k+1 , predicted value x k+1 and prediction error r k+1 until the prediction error r k+1 is small enough (for example, less than the error threshold), then exit the loop and output the predicted value x k+ of the last iteration process 1 , the pixel value to be updated as the target pixel point.
  • the conjugate gradient method is used as an example to illustrate the process of obtaining the third matrix x based on the first matrix A and the second matrix b. It avoids the need for technicians to manually check and repair the seam problem in the lightmap after triggering the lighting rendering command, so that the technician can concentrate on the development and design work, which greatly saves the use of image rendering.
  • the human resources for repairing seam problems have greatly improved the efficiency of image rendering.
  • the terminal may also process the first matrix A and the second matrix b based on the least squares method to obtain the third matrix x, which can reduce the amount of calculation in the process of obtaining the third matrix x and improve the calculation efficiency , or, the terminal processes the first matrix A and the second matrix b based on the Cholesky decomposition method to obtain the third matrix x, which can improve the calculation accuracy of the process of obtaining the third matrix x.
  • the method provided by the embodiment of the present application automatically identifies the seam edge of the target 3D model, and then automatically locates the target pixels to be repaired in the light map of the target 3D model, and these target pixels are also on the seam edge.
  • the pixels corresponding to the edge lines with discontinuous texture appear, so that the pixel value of the target pixel is automatically updated, and the repaired lightmap is finally output, which enables automatic identification and automatic repair of seam problems with one click, which greatly reduces the cost of Human resources used to troubleshoot and repair seam problems during image rendering, thereby reducing image rendering time and improving image rendering efficiency.
  • FIG. 5 is a flowchart of an image rendering method provided by an embodiment of the present application. Please refer to FIG. 5 .
  • the method is applied to a terminal and includes the following steps:
  • the terminal obtains a light map of the target three-dimensional model according to the lighting rendering instruction.
  • the target 3D model refers to the 3D model to be rendered this time, and the target 3D model may correspond to at least one object.
  • the target 3D model is a 3D model of a single object, or the target 3D model is composed of multiple objects.
  • the embodiment of the present application does not specifically limit the content of the target three-dimensional model.
  • the above step 501 that is, the terminal obtains the light map of the target 3D model in response to the lighting rendering instruction, is similar to the above step 301, and will not be repeated here.
  • the terminal acquires multiple vertices in at least one surface of the target three-dimensional model.
  • the terminal acquires grid information of the target three-dimensional model based on bake task information of the target three-dimensional model.
  • the baking refers to the process of obtaining a lightmap based on the model data of the target 3D model, so the baking task information is task information created by the terminal based on the lighting rendering instruction.
  • the mesh information includes vertex information, normal information, UV coordinates, triangular surface information, etc. in each surface, and the triangular surface here refers to a model plane uniquely determined by three vertices. Then, the terminal can acquire a plurality of vertices in at least one surface of the target three-dimensional model from the mesh information.
  • the terminal determines a directed edge for any vertex among the plurality of vertices based on the any vertex and the next vertex.
  • the terminal may further perform the following initialization step: create a set (referred to as Seams) for recording two directed edge pairs, and each element in the set is a pair of mutually Reverse directed edge (directed edge VertexEdge and auxiliary edge ReversedEdge), the auxiliary edge here is an edge constructed based on the directed edge, not necessarily a real directed edge in the target 3D model, Seams Initialized to an empty set.
  • Seams create a set for recording two directed edge pairs, and each element in the set is a pair of mutually Reverse directed edge (directed edge VertexEdge and auxiliary edge ReversedEdge), the auxiliary edge here is an edge constructed based on the directed edge, not necessarily a real directed edge in the target 3D model, Seams Initialized to an empty set.
  • the set of directed edges is used to record the real existing directed edges in the target 3D model
  • the set of directed edges is data such as dictionary, array, list, queue, stack, etc. structure
  • the directed edge set is a dictionary set, denoted as EdgeMap
  • the dictionary set is a key-value type storage data structure
  • the Key (key name) value is a directed edge
  • the Value (key value) ) value includes the normal information and UV coordinates of the two vertices of the directed edge.
  • the terminal traverses each face of the target 3D model, taking each face as a triangular face as an example, for any triangular face, traverses the three vertices in the triangular face , in any traversal process, a directed edge VertexEdge is generated according to the current vertex and the next vertex of the current vertex.
  • the terminal determines an auxiliary edge that is coincident with the vertex between the directed edges and has an opposite direction.
  • auxiliary edge is an edge constructed based on a directed edge, and it is not necessarily a directed edge that actually exists in the target 3D model. It is necessary to judge whether there is a directed edge that shares an edge with the auxiliary edge through the following step 505 , if it exists, it means that the directed edge VertexEdge has a corresponding reverse edge, and a seam problem occurs at this time.
  • the terminal determines, according to the directed edge and the auxiliary edge, whether the directed edge has an opposite edge to the directed edge.
  • the terminal determines the auxiliary edge as the opposite edge of the directed edge.
  • the auxiliary edge that is, there is an edge that shares an edge with the auxiliary edge
  • the directed edge is determined when the same edge as the auxiliary edge is found in the set of directed edges of the target 3D model.
  • the auxiliary edge is determined as the reverse edge of the directed edge.
  • the terminal looks up whether there is data corresponding to the auxiliary edge ReversedEdge in the created dictionary set EdgeMap. If there is corresponding data in the dictionary set EdgeMap, it means that there is a seam problem, and this seam edge has A set of directed edge pairs (VertexEdge and RervsedEdge) formed by a forward edge and a reverse edge, insert the directed edge pair (VertexEdge and RervsedEdge) into the directed edge pair set Seams, otherwise, if the dictionary set EdgeMap does not exist The corresponding data indicates that there is no seam problem in this directed edge VertexEdge, insert this directed edge VertexEdge into the dictionary set EdgeMap, continue to traverse the next vertex in the current face, and loop through the above process until each traversal is completed. For each vertex inside the face, return the final set of directed edge pairs Seams.
  • the terminal when confirming whether there is data corresponding to the auxiliary edge ReversedEdge of the directed edge in the dictionary set EdgeMap, the terminal follows the following two judgment principles. If there is a target directed edge in the dictionary set EdgeMap, it satisfies: 1 ) The UV coordinates of the directional edge of the target are the same as the UV coordinates of the auxiliary edge ReversedEdge; 2) The angle between the normal of the auxiliary edge ReversedEdge and the two vertices of the directional edge of the target is less than the angle threshold, then it means that the target The directed edge and the auxiliary edge ReversedEdge are co-edge (that is, the two sides coincide), indicating that there is a seam problem. Among them, the angle threshold of seam in the editor can be set to normalcosthreadhold.
  • the directed edge VertexEdge is added to the directed edge set EdgeMap. In this way, a set of directed edge pairs with reverse edges can be identified and added to the directed edge pair set Seams during the looping process, and the directed edge pair set Seams can be used as the return value after the final traversal is completed.
  • the terminal determines that the directed edge and the reverse edge are a set of seam edges in response to the presence of an opposite edge in the directed edge formed by at least two vertices in the plurality of vertices.
  • the directional edge and the reverse edge are determined as a group of seam edges, and each directional edge in each surface of the target three-dimensional model is determined.
  • the edge traversal is completed, if there is a seam problem, then at least one set of seam edges can be determined. If there is no seam problem, that is, any directed edges and reverse edges are not detected, then the terminal reports no seam problem. .
  • a group of seam edges includes a directed edge and an opposite edge of the directed edge, and the vertices between the directed edge and the opposite edge are coincident and in opposite directions.
  • the terminal obtains the seam edge of the target 3D model, the seam edge is the edge that is located on the same surface in the target 3D model and has discontinuous texture in the lightmap, optionally, in the embodiment of the present application, the above-mentioned process of obtaining the seam edge is performed after the terminal renders and obtains the lightmap, so that the seam edge of the rendered lightmap can be directly fitted, and a better seam repair effect can be obtained.
  • the seam edge in the target 3D model is automatically identified before the rendering stage, and then in the lighting sampling stage, the pixel difference calculation is performed in the nearby world space, so that the target pixel is in the rendering stage. The pixel value to be updated with a smoother texture transformation is fitted, so that the repaired lightmap can be directly obtained after lighting rendering.
  • the terminal obtains pixel position information of the vertices of the any group of seam edges in the lightmap.
  • step 507 that is, for any group of the seam edges, obtain the pixel position information of the vertices of the seam edges corresponding to the pixels in the lightmap.
  • the terminal may collect the pixel information of the pixels forming each group of seam edges in the lightmap lightmap.
  • the pixel information of one pixel point includes the pixels of the pixel point Position information (that is, position coordinates) and pixel color information (that is, lighting color information), the data set formed by the pixel information of the pixel points composing each group of seam edges is called SeamTexels.
  • the terminal traverses each set of seam edges in each set of directed edge pairs Seams (a set of seam edges includes a pair of directed edges A and B in opposite directions), which can be read from SeamTexels
  • StartPosA is the pixel position information of the pixel corresponding to the starting vertex of the directed edge A
  • EndPosA is the pixel position information of the pixel corresponding to the end vertex of the directed edge A
  • StartPosB is the starting vertex of the directed edge B.
  • the pixel position information of the corresponding pixel point, EndPosB is the pixel position information of the pixel point corresponding to the end vertex of the directed edge B.
  • the directed edges A and B share the same edge in the target 3D model (that is, the vertices are coincident), there are different start and end vertices in the lightmap, and it is precisely because the target 3D model has different starting and ending vertices.
  • the overlapping vertices in the model are divided and split in the lightmap, which will cause the so-called "seam problem", resulting in the visual problem of discontinuous lighting transition as shown in the box area in Figure 1. Therefore, for each group The seam edge will get the pixel position information of the four vertices.
  • the terminal determines, based on the pixel position information of the vertex, the number of pixel samples of any group of seam edges.
  • the terminal determines the number of pixel samples corresponding to the seam edge based on the pixel position information.
  • the terminal obtains the side length of the directional edge in the any group of seam edges and the side length of the opposite side of the directional edge, and obtains the side length of the directional edge and the side length of the opposite side.
  • the value obtained by multiplying the maximum value in the sampling quality parameter by the sampling quality parameter is determined as the sampling quantity of the pixel.
  • the pixel information related to the seam edge can be collected as much as possible through a small number of pixel samples, and the sampling quality is high.
  • the length of the directional edge is related to the The value obtained by adding the side lengths of the opposite sides is multiplied by the sampling quality parameter to obtain the number of pixel samples, which can improve the final sampling quality by increasing the sampling density.
  • SampleCount Max(SampleCountA,SampleCountB)*SampleQuanlity, where SampleQuanlity is a sampling quality parameter passed in by the baking parameters of the editor.
  • the terminal determines, based on the pixel position information and the pixel sampling quantity, a target pixel point corresponding to any group of seam edges.
  • the terminal may determine the iterative step size of the sampling process, that is, the iterative step size of pixel sampling based on the pixel position information and the number of pixel samples; starting from the pixel point corresponding to any vertex, based on the iterative step size Perform pixel sampling; take the sampling point determined based on the iteration step size as the target pixel point, that is, obtain the sampling point determined in the pixel sampling as the target pixel point.
  • the terminal can obtain the pixels spanned by the directed edge A in the light map according to the pixel position information StartPosA and EndPosA of the two vertices of the directed edge A (pixels to be sampled, referred to as sample points), and record the sample points into the pixel list.
  • sample points pixels to be sampled
  • the principle of search and deduplication may be followed.
  • StepIndex equivalent to the number of samplings
  • the terminal determines the target pixels in the lightmap based on the seam, in other words, in the lightmap, determines the target pixels corresponding to the seam, and these target pixels are also That is, the pixel points corresponding to the edge lines with discontinuous texture appearing on the seam edge.
  • the initial pixel values of these target pixel points can be updated, and the repaired light map can be fitted.
  • the terminal constructs a first matrix and a second matrix based on the pixel value of the target pixel, where the first matrix is used to represent the pixels on the directional edge and the reverse edge of the target pixel in a set of seam edges information, the second matrix is used to represent the initial pixel value of the target pixel in the lightmap.
  • the first matrix is used to represent the initial pixel value of the neighbor point of the target pixel point in the lightmap and the baking result coefficient of the target pixel point.
  • the number of rows of the first matrix A is the first target number m and the number of columns is the second target number n, that is, the first matrix A is a matrix with m rows and n columns.
  • the number of rows of the second matrix b is the first target number m
  • the number of columns of the second matrix is one.
  • a set of linear equations can be constructed according to the first matrix and the second matrix. This is because when updating the target pixel in the lightmap, it is usually necessary to perform the RGB (red, green, and blue) respectively. ) to update the pixel values of the three channels, so three linear equation systems can be constructed for the three RGB channels respectively, and finally the pixel values to be updated under each channel can be obtained.
  • the terminal obtains a third matrix based on the first matrix and the second matrix, where the third matrix is used to represent the pixel value to be updated of the target pixel point.
  • the terminal processes the first matrix and the second matrix based on a conjugate gradient method to obtain the third matrix; or, the terminal processes the first matrix and the second matrix based on a least squares method , to obtain the third matrix; or, the terminal processes the first matrix and the second matrix based on the Cholesky decomposition method to obtain the third matrix.
  • the solution of the third matrix x is described by taking the conjugate gradient method as an example.
  • the conjugate gradient method is a data processing method that combines conjugation and the steepest descent method. After the second matrix constructs a system of linear equations, iteratively is performed on the basis of the initial pixel values of the target pixel on the three RGB channels, and the pixel values to be updated on the three RGB channels of the target pixel can be output.
  • the conjugate gradient method can solve the third matrix faster and has less data storage, so the acquisition rate of the third matrix can be improved.
  • the first matrix A is a sparse matrix.
  • Each line contains 8 non-zero elements because the bilinear difference method is usually used for lightmaps to determine the pixel information of a sampling point, for example, a position point in the seam edge of the target 3D model, in the lightmap It is expanded into a pair of target pixels, that is, a position point in the seam edge corresponds to a pair of target pixels in the lightmap.
  • the pair of target pixels needs to be Each target pixel is used as a sampling point.
  • each pair of target pixels can be sampled to obtain a set of There are a total of eight neighborhood points, and 8 non-zero coefficients are calculated based on the pixel position information and lighting color information of the eight neighborhood points. For example, it is necessary to interpolate the four pixel points a0 to a3 around a sampling point (that is, the neighborhood points a0 to a3), because the seam edge needs to be distributed on both sides of the seam.
  • each row contains 8 non-zero coefficients: a0 ⁇ a3 and b0 to b3.
  • the acquisition method of the non-zero coefficients a0-a3 and b0-b3 is similar to the above-mentioned step 304, and will not be repeated here.
  • a matrix with ⁇ as the coefficient can be used for the last r1 row of the first matrix A.
  • ⁇ is determined by the rendering engine.
  • a decimal in the range of [0,1] (that is, the baking result coefficient) passed in by the editor can be customized by the technician, or the default value can be used, for example, the default value is 0.5.
  • the matrix coefficients of the first matrix A are determined based on bilinear interpolation, and the first matrix A can be easily and quickly constructed. In some embodiments, bicubic interpolation and other methods can also be used to determine the first matrix. The matrix coefficients of A, which can improve the sampling accuracy.
  • the second matrix b is a column vector with m rows.
  • the value of b in the first r0 row is 0, and the value of b in the second row r1 is the illumination.
  • the value of the original pixel in the map that is, the initial pixel value of the target pixel
  • the loop logic of the conjugate gradient method is similar to the above step 304, and details are not described here.
  • the conjugate gradient method is used as an example to illustrate the process of obtaining the third matrix x based on the first matrix A and the second matrix b. It avoids the need for technicians to manually check and repair the seam problem in the lightmap after triggering the lighting rendering command, so that the technician can concentrate on the development and design work, which greatly saves the use of image rendering.
  • the human resources for repairing seam problems have greatly improved the efficiency of image rendering.
  • the terminal may also process the first matrix A and the second matrix b based on the least squares method to obtain the third matrix x, which can reduce the amount of calculation in the process of obtaining the third matrix x and improve the calculation efficiency , or, the terminal processes the first matrix A and the second matrix b based on the Cholesky decomposition method to obtain the third matrix x, which can improve the calculation accuracy of the process of obtaining the third matrix x.
  • the terminal updates the target pixel from the initial pixel value to the to-be-updated pixel value to obtain the repaired lightmap.
  • the terminal can read the to-be-updated pixel value of each target pixel from the third matrix, and then in the lightmap, locate the position of each target pixel according to the pixel coordinates of each target pixel, and then At the position where each target pixel is located, the existing initial pixel value is updated to the pixel value to be updated provided by the third matrix, and the repaired lightmap is output after the replacement is completed.
  • the terminal updates the initial pixel value of the target pixel in the lightmap to obtain a repaired lightmap, wherein the pixel corresponding to the seam edge in the repaired lightmap and The textures of the neighborhood points are continuous, in other words, the textures in this repaired lightmap are continuous.
  • the pixel values of the rendered lightmaps are updated, the seam edges with uneven textures are smoothed based on bilinear interpolation, and the pixel values to be updated are calculated by solving the constructed linear equations.
  • the initial pixel value of the target pixel is updated, and the lightmap with the seam problem repaired is finally output, so that the identification and repair of the seam problem can be completed in one click in the lighting rendering stage, without the need for manual inspection by technicians.
  • the method provided by the embodiment of the present application automatically identifies the seam edge of the target 3D model, and then automatically locates the target pixels to be repaired in the light map of the target 3D model, and these target pixels are also on the seam edge.
  • the pixels corresponding to the edge lines with discontinuous texture appear, so that the pixel value of the target pixel is automatically updated, and the repaired lightmap is finally output, which enables automatic identification and automatic repair of seam problems with one click, which greatly reduces the cost of Human resources used to troubleshoot and repair seam problems during image rendering, thereby reducing image rendering time and improving image rendering efficiency.
  • FIG. 6 is a schematic flowchart of an image rendering method provided by an embodiment of the present application. Please refer to FIG. 6 .
  • the method includes:
  • step 601 the terminal receives the lightmap rendering task of the object.
  • step 602 the terminal uses the path tracking algorithm to render each pixel of the lightmap.
  • step 603 the terminal searches for the UV seam edge of the object.
  • step 604 the terminal traverses each face of the object.
  • step 605 the terminal traverses each vertex on the current face.
  • step 606 the terminal searches for the opposite edge of the directed edge formed by the current vertex and the next vertex.
  • step 607 the terminal determines whether a reverse edge is found, and if a reverse edge is found, step 608 is performed; otherwise, if no reverse edge is found, the process returns to step 605.
  • step 608 the terminal determines whether the UV value and normal value of the auxiliary edge and the reverse edge are consistent, if the UV value and the normal value are consistent, execute step 609, otherwise, if the UV value and the normal value are inconsistent, return to step 605 .
  • step 609 the terminal records a set of directed edges that create a seam.
  • step 610 the terminal determines whether the current vertex is the last vertex of the current face, if the current vertex is the last vertex of the current face, executes step 611, otherwise, if the current vertex is not the last vertex of the current face, returns to step 605.
  • step 611 the terminal determines whether the current face is the last face of the object, if the current face is the last face of the object, executes step 612, and if the current face is not the last face of the object, returns to step 604.
  • step 612 the terminal searches out the pixel to be repaired (ie, the target pixel) according to the seam list.
  • step 613 the terminal constructs a system of linear equations according to the pixels at the seam.
  • step 614 the terminal solves the system of linear equations using the conjugate gradient method.
  • step 615 the terminal updates the lightmap lightmap using the solution of the system of equations.
  • step 616 the terminal completes the seam repair, and returns the baking parameters to the front-end editor.
  • the automatic UV seam detection function is implemented in the above steps 603-611, and the seam edge existing in the lightmap can be automatically checked, which greatly avoids the consumption of manual checking.
  • the automatic UV seam repair function is realized, which can automatically repair the identified UV seam edges, and the repair methods are respectively
  • FIG. 7 is a schematic diagram of an operation interface of a rendering engine provided by an embodiment of the present application. Please refer to FIG. 7 , which shows an operation interface 700 of a rendering engine.
  • a baking start button 701 is provided in the operation interface 700.
  • the baking start button is "Dawn". After the user triggers the baking start button 701, the terminal receives the lighting rendering instruction, and performs offline global illumination rendering on the target 3D model imported in the rendering engine.
  • the terminal needs to set the lightmap resolution of each object when rendering the lightmap, and provide the UV information of each vertex of the object in the lightmap, and the normal and tangent information in the world coordinate system.
  • the rendering engine will send the baking task of each object to the baker, and the baking task includes detailed mesh information of the baked object (vertices, normals, triangles, lightmap uv coordinates, etc.) , the baker performs lighting rendering according to the baking task.
  • the current game development is more and more large-scene and big-world development.
  • the number of objects in the virtual scene is tens of thousands, and one object corresponds to on a target 3D model.
  • ue4 Unreal 4
  • a technician needs to manually check the scene data and then re-bake it. Not only does the manual check process take a lot of manpower and material resources, but it also takes a lot of time to re-bake in a large scene. , which brings a lot of labor cost and time cost.
  • the image rendering method based on the embodiment of the present application through automatic UV seam detection, can easily and automatically complete the detection of seam edges, and can also realize automatic UV seam repair, which automatically helps technicians to complete the baking process.
  • the repair work of the seam problem can complete the baking task very efficiently.
  • FIG. 8 is a comparison diagram of an image rendering method before and after repairing a seam problem according to an embodiment of the present application.
  • 801 shows a light map before the seam problem is repaired. It can be seen that in the block There is a seam problem in area 803, there is an anomaly of discontinuity of texture on the smooth surface of the sphere obviously, and 802 shows the lightmap after the seam problem is repaired, it can be seen that the texture is eliminated in the box area 804
  • the discontinuous abnormality makes the light transition on the smooth surface of the sphere smoother, that is to say, the 802 has obviously fixed the seam problem of the original texture discontinuity in the 801, and improved the visual effect of the lightmap.
  • the baking investment can be saved at least 100 hours compared with the traditional manual repair method after each scene change, and with the iteration of development, the saving of The time may be several 100 hours.
  • FIG. 9 is a schematic structural diagram of an image rendering apparatus provided by an embodiment of the present application. Please refer to FIG. 9 .
  • the apparatus includes:
  • the first acquisition module 901 is used to acquire the lightmap of the target 3D model according to the illumination rendering instruction; that is, the first acquisition module 901 is used to acquire the lightmap of the target 3D model in response to the illumination rendering instruction;
  • a second obtaining module 902 configured to obtain a seam edge of the target three-dimensional model, where the seam edge is an edge that is located on the same surface in the target three-dimensional model and has discontinuous texture in the lightmap;
  • the first determination module 903 is used to determine the target pixel point in the lightmap based on the seam edge; that is, the first determination module 903 is used to determine the target corresponding to the seam edge in the lightmap pixel;
  • the update module 904 is used to update the target pixel to obtain a repaired lightmap, and the texture of the seam edge in the repaired lightmap is continuous; that is to say, the update module 904 is used to The initial pixel value of the target pixel in the lightmap is updated to obtain a repaired lightmap, wherein the textures in the repaired lightmap are continuous.
  • the device provided by the embodiment of the present application automatically identifies the seam edge of the target 3D model, and then automatically locates the target pixels to be repaired in the light map of the target 3D model, and these target pixels are also on the seam edge
  • the pixels corresponding to the edge lines with discontinuous texture appear, so that the pixel value of the target pixel is automatically updated, and the repaired lightmap is finally output, which enables automatic identification and automatic repair of seam problems with one click, which greatly reduces the cost of Human resources used to troubleshoot and repair seam problems during image rendering, thereby reducing image rendering time and improving image rendering efficiency.
  • a set of seam edges includes a directed edge and an opposite edge of the directed edge, and the vertices between the directed edge and the opposite edge are coincident and in opposite directions;
  • the second obtaining module 902 is used for:
  • the directed edge and the reverse edge are determined as a set of seam edges.
  • the device further includes:
  • a second determining module configured to determine a directed edge based on the vertex and the next vertex for any vertex in the plurality of vertices
  • the third determining module is used to determine the auxiliary edge that is coincident with the vertex between the directed edges and has an opposite direction;
  • the fourth determination module is used to determine whether the directional edge has the opposite edge according to the directional edge and the auxiliary edge; that is, the fourth determination module is used to determine whether the auxiliary edge is another directional edge.
  • the auxiliary edge is determined as the opposite edge of the directed edge.
  • the fourth determining module is used for:
  • the auxiliary edge is determined as the reverse edge of the directed edge.
  • the device further includes an additional module for:
  • the directed edge is added to the set of directed edges.
  • the first determining module 903 includes:
  • a first acquiring unit configured to acquire, for any group of seam edges, the pixel position information of the corresponding pixels in the lightmap of the vertices of the any group of seam edges;
  • a first determining unit configured to determine the number of pixel samples corresponding to any group of seam edges based on the pixel position information of the vertex
  • the second determining unit is configured to determine the target pixel corresponding to any group of seam edges based on the pixel position information and the pixel sampling quantity.
  • the second determining unit is used for:
  • the iterative step size of the sampling process that is, the iterative step size of pixel sampling
  • the sampling point determined based on the iterative step size is taken as the target pixel point, that is, the sampling point determined in the pixel sampling is obtained as the target pixel point.
  • the first determining unit is used for:
  • the value obtained by multiplying the maximum value of the side length of the directional side and the side length of the reverse side by the sampling quality parameter is determined as the number of pixel samples.
  • the update module 904 includes:
  • a construction unit for constructing a first matrix and a second matrix based on the pixel value of the target pixel, where the first matrix is used to represent the target pixel on the directional edge and the reverse edge within a set of seam edges , that is, the first matrix is used to represent the initial pixel value of the neighborhood point of the target pixel in the lightmap and the baking result coefficient of the target pixel, and the second matrix is used to represent the target pixel The initial pixel value of the point in this lightmap;
  • a second obtaining unit configured to obtain a third matrix based on the first matrix and the second matrix, where the third matrix is used to represent the pixel value to be updated of the target pixel;
  • An update unit configured to update the target pixel point from the initial pixel value to the to-be-updated pixel value based on the third matrix to obtain the repaired light map.
  • the second obtaining unit is used for:
  • the first matrix and the second matrix are processed based on the Cholesky decomposition method to obtain the third matrix.
  • a position point in the seam edge corresponds to a pair of target pixel points in the lightmap, and each pair of target pixel points is sampled to obtain a set of neighborhood points;
  • the row of the first matrix The number is the first target number and the number of columns is the second target number, where the first target number is the value obtained by adding the sampling number of the seam edge and the number of target pixels, that is, the first target The number is the value obtained by adding the number of sampling groups of the neighborhood points and the number of the target pixel points, the second target number is the number of the target pixel points;
  • the number of rows of the second matrix is the first target number and The number of columns of the second matrix is one.
  • the image rendering apparatus provided in the above embodiment renders an image
  • only the division of the above functional modules is used as an example.
  • the internal structure of the electronic device is divided into different functional modules to complete all or part of the functions described above.
  • the image rendering apparatus and the image rendering method embodiments provided by the above embodiments belong to the same concept, and the specific implementation process thereof can be seen in the image rendering method embodiments, which will not be repeated here.
  • FIG. 10 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the device types of the terminal 1000 include: smart phone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III, moving image expert compression standard audio layer 3) , MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) player, laptop or desktop computer.
  • Terminal 1000 may also be called user equipment, portable terminal, laptop terminal, desktop terminal, and the like by other names.
  • the terminal 1000 includes: a processor 1001 and a memory 1002 .
  • the processor 1001 includes one or more processing cores, such as a 4-core processor, an 8-core processor, and the like.
  • the processor 1001 adopts at least one of DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array, programmable logic array) implemented in hardware.
  • the processor 1001 includes a main processor and a co-processor, and the main processor is a processor for processing data in a wake-up state, also referred to as a CPU (Central Processing Unit, central processing unit);
  • a coprocessor is a low-power processor for processing data in a standby state.
  • the processor 1001 is integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is used for rendering and drawing the content that needs to be displayed on the display screen.
  • the processor 1001 further includes an AI (Artificial Intelligence, artificial intelligence) processor, where the AI processor is used to process computing operations related to machine learning.
  • AI Artificial Intelligence, artificial intelligence
  • memory 1002 includes one or more computer-readable storage media, which are optionally non-transitory.
  • memory 1002 also includes high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash storage devices.
  • non-transitory computer-readable storage medium in the memory 1002 is used to store at least one program code, and the at least one program code is used to be executed by the processor 1001 to implement the various embodiments provided in this application. Image rendering method.
  • the terminal 1000 may optionally further include: a display screen 1003 .
  • the display screen 1003 is used for displaying UI (User Interface, user interface).
  • the UI includes graphics, text, icons, video, and any combination thereof.
  • the display screen 1003 also has the ability to collect touch signals on or above the surface of the display screen 1003 .
  • the touch signal can be input to the processor 1001 as a control signal for processing.
  • the display screen 1003 is also used to provide virtual buttons and/or virtual keyboards, also called soft buttons and/or soft keyboards.
  • the display screen 1003 there is one display screen 1003, which is provided on the front panel of the terminal 1000; in other embodiments, there are at least two display screens 1003, which are respectively arranged on different surfaces of the terminal 1000 or in a folded design;
  • the display screen 1003 is a flexible display screen and is disposed on a curved surface or a folding surface of the terminal 1000 . Even, optionally, the display screen 1003 is set as a non-rectangular irregular figure, that is, a special-shaped screen.
  • the display screen 1003 is made of materials such as LCD (Liquid Crystal Display, liquid crystal display), OLED (Organic Light-Emitting Diode, organic light emitting diode).
  • FIG. 10 does not constitute a limitation on the terminal 1000, and can include more or less components than the one shown, or combine some components, or adopt different component arrangements.
  • an electronic device includes one or more processors and one or more memories, wherein the one or more memories store at least one piece of program code, the at least one program The code is loaded by the one or more processors and performs the following operations: in response to the lighting rendering instruction, obtain the light map of the target three-dimensional model; obtain the seam edge of the target three-dimensional model; in the light map, determine and The target pixel corresponding to the seam edge; the initial pixel value of the target pixel is updated in the lightmap to obtain a repaired lightmap, wherein the texture in the repaired lightmap is continuously.
  • a set of seam edges includes a directed edge and an opposite edge of the directed edge, the directional edge and the opposite edge having coincident vertices and opposite directions; the at least one The program code is loaded by the one or more processors and performs the following operations: obtaining a plurality of vertices in at least one face of the target three-dimensional model; The edges have opposite edges, and the directional edges and the opposite edges are determined as a set of seam edges.
  • the at least one piece of program code is loaded by the one or more processors and performs an operation for determining, for any vertex in the plurality of vertices, a directed path based on the vertex and the next vertex edge; determine the auxiliary edge that coincides with the vertices between the directed edges and has an opposite direction; in the case that the auxiliary edge is another directed edge, determine the auxiliary edge to be the opposite of the directed edge side.
  • the at least one piece of program code is loaded by the one or more processors and performs an operation of: querying a directed edge set of the target three-dimensional model to find an edge that is the same as the auxiliary edge In this case, the auxiliary edge is determined to be the opposite edge of the directed edge.
  • the at least one piece of program code is loaded by the one or more processors and performs the following operations: if the set of directed edges cannot be queried for the same edge as the auxiliary edge, Add the directed edge to the set of directed edges.
  • the at least one piece of program code is loaded by the one or more processors and performs the following operations: for any set of the seam edges, obtain a vertex of the seam edge in the lightmap The pixel position information of the corresponding pixel in the pixel position; based on the pixel position information, determine the pixel sampling quantity corresponding to the seam edge; and determine the target pixel point based on the pixel position information and the pixel sampling quantity.
  • the at least one piece of program code is loaded by the one or more processors and performs the following operations: determining an iteration step size of pixel sampling based on the pixel position information and the number of pixel samples; A pixel corresponding to a vertex is a starting point, and pixel sampling is performed based on the iterative step size; the sampling point determined in the pixel sampling is obtained as the target pixel.
  • the at least one piece of program code is loaded by the one or more processors and performs the following operations: obtaining the edge length of the directed edge within the seam edge and the inverse of the directed edge The side length of the side; the value obtained by multiplying the maximum value of the side length of the directional side and the side length of the reverse side by the sampling quality parameter is determined as the number of pixel samples.
  • the at least one piece of program code is loaded by the one or more processors and performs the following operations: based on the target pixel points, constructing a first matrix and a second matrix, the first matrix for Indicates the initial pixel value of the neighborhood point of the target pixel in the lightmap and the baking result coefficient of the target pixel, and the second matrix is used to represent the target pixel in the lightmap
  • the initial pixel value of The target pixel is updated from the initial pixel value to the to-be-updated pixel value to obtain the repaired lightmap.
  • the at least one piece of program code is loaded by the one or more processors and performs the following operations: processing the first matrix and the second matrix based on a conjugate gradient method to obtain the a third matrix; or, processing the first matrix and the second matrix based on the least squares method to obtain the third matrix; or, performing the processing on the first matrix and the second matrix based on the Cholesky decomposition method
  • the second matrix is processed to obtain the third matrix.
  • a position point in the seam edge corresponds to a pair of target pixel points in the lightmap, and each pair of target pixel points is sampled to obtain a set of neighborhood points;
  • the number of rows is the first target number and the number of columns is the second target number, wherein the first target number is the value obtained by adding the number of sampling groups of the neighborhood points and the number of the target pixel points, the
  • the second target number is the number of the target pixels; the row number of the second matrix is the first target number and the column number of the second matrix is one.
  • a computer-readable storage medium such as a memory including at least one piece of program code
  • the at least one piece of program code can be executed by a processor in the terminal to complete the image rendering method in the above-mentioned embodiment.
  • the computer-readable storage medium includes ROM (Read-Only Memory, read-only memory), RAM (Random-Access Memory, random access memory), CD-ROM (Compact Disc Read-Only Memory, read-only optical disk), Tape, floppy disk, and optical data storage devices, etc.
  • a computer-readable storage medium stores at least one piece of program code, the at least one piece of program code is loaded by a processor and performs the following operations: in response to a lighting rendering instruction, obtain a target The light map of the three-dimensional model; obtain the seam edge of the target three-dimensional model; in the light map, determine the target pixel point corresponding to the seam edge; The initial pixel value is updated to obtain a repaired lightmap, wherein the textures in the repaired lightmap are continuous.
  • a set of seam edges includes a directed edge and an opposite edge of the directed edge, the directional edge and the opposite edge having coincident vertices and opposite directions; the at least one The program code is loaded by the processor and performs the following operations: acquiring a plurality of vertices in at least one face of the target three-dimensional model; in response to the existence of a reverse edge in a directed edge formed by at least two vertices in the plurality of vertices, The directional edge and the reversed edge are determined as a set of seam edges.
  • the at least one piece of program code is loaded by the processor and performs the following operations: for any vertex in the plurality of vertices, determine a directed edge based on the vertex and the next vertex; Auxiliary edges whose vertices are coincident and opposite directions between directed edges; in the case that the auxiliary edge is another directed edge, the auxiliary edge is determined as the opposite edge of the directed edge.
  • the at least one piece of program code is loaded by the processor and performs the following operations: in the case where the same edge as the auxiliary edge is found in the set of directed edges of the target three-dimensional model, load the Auxiliary edges are determined to be opposite edges of the directed edges.
  • the at least one piece of program code is loaded by a processor and performs an operation of: in the case where the set of directed edges cannot be queried for the same edge as the auxiliary edge, put the directed edge added to the set of directed edges.
  • the at least one piece of program code is loaded by the processor and performs the following operations: for any set of the seam edges, obtain the pixels of the vertices of the seam edges corresponding to the pixels in the lightmap position information; determine the pixel sampling quantity corresponding to the seam edge based on the pixel position information; determine the target pixel point based on the pixel position information and the pixel sampling quantity.
  • the at least one piece of program code is loaded by the processor and performs the following operations: determining the iteration step size of pixel sampling based on the pixel position information and the number of pixel samples; using the pixel point corresponding to any vertex As a starting point, pixel sampling is performed based on the iterative step size; the sampling point determined in the pixel sampling is obtained as the target pixel point.
  • the at least one piece of program code is loaded by the processor and performs the following operations: obtaining the side length of the directional edge within the seam edge and the side length of the opposite side of the directional edge; A value obtained by multiplying the maximum value of the side length of the directional side and the side length of the reverse side by the sampling quality parameter is determined as the number of pixel samples.
  • the at least one piece of program code is loaded by the processor and performs the following operations: constructing a first matrix and a second matrix based on the target pixel point, the first matrix being used to represent the target pixel point The initial pixel value of the neighborhood point in the lightmap and the baking result coefficient of the target pixel, the second matrix is used to represent the initial pixel value of the target pixel in the lightmap; based on For the first matrix and the second matrix, a third matrix is obtained, and the third matrix is used to represent the pixel value to be updated of the target pixel point; based on the third matrix, the target pixel point is converted from The initial pixel value is updated to the to-be-updated pixel value to obtain the repaired lightmap.
  • the at least one piece of program code is loaded by a processor and performs the following operations: processing the first matrix and the second matrix based on a conjugate gradient method to obtain the third matrix; or, The first matrix and the second matrix are processed based on the least squares method to obtain the third matrix; or, the first matrix and the second matrix are processed based on the Cholesky decomposition method, The third matrix is obtained.
  • a position point in the seam edge corresponds to a pair of target pixel points in the lightmap, and each pair of target pixel points is sampled to obtain a set of neighborhood points;
  • the number of rows is the first target number and the number of columns is the second target number, wherein the first target number is the value obtained by adding the number of sampling groups of the neighborhood points and the number of the target pixel points, the
  • the second target number is the number of the target pixels; the row number of the second matrix is the first target number and the column number of the second matrix is one.
  • a computer program product or computer program comprising one or more pieces of program code stored in a computer-readable storage medium.
  • the one or more processors of the electronic device can read the one or more program codes from the computer-readable storage medium, the one or more processors execute the one or more program codes to enable the electronic device to execute to complete The image rendering method in the above embodiment.
  • the program is stored in a computer-readable storage medium,
  • the above-mentioned storage medium is a read-only memory, a magnetic disk, an optical disk, or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Image Generation (AREA)

Abstract

本申请公开了一种图像渲染方法、装置、电子设备及存储介质,属于图像处理技术领域。该方法包括:响应于光照渲染指令,获取目标三维模型的光照贴图;获取该目标三维模型的接缝边;在该光照贴图中,确定与该接缝边对应的目标像素点;在所述光照贴图中对所述目标像素点的初始像素值进行更新,得到修复后的光照贴图。本申请通过自动识别出目标三维模型的接缝边,并自动对目标像素点的像素值进行更新,能够一键完成接缝问题的自动识别和自动修复,避免了浪费人力资源排查及修复接缝问题,降低了图像渲染耗时、提升了图像渲染效率。

Description

图像渲染方法、装置、电子设备及存储介质
本申请要求于2020年08月27日提交的申请号为202010878803.2、发明名称为“图像渲染方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,特别涉及一种图像渲染方法、装置、电子设备及存储介质。
背景技术
随着图像处理技术的发展,终端能够基于GPU(Graphics Processing Unit,图像处理器)以进行图像渲染。其中,光照渲染是图像渲染中的重要一环,主要用于渲染出对象呈现的光照视觉效果。
在光照渲染过程中,在创建好待渲染对象的三维(3D)模型之后,需要将3D模型的网格(mesh)展开至二维空间,得到一张二维图像,由于该二维空间也称为UV空间,这一展开过程也称为UV展开,UV展开所得的二维图像也称为光照贴图,接着,基于渲染引擎对光照贴图的每个像素点进行光照渲染,得到最终光照渲染后的图像。
发明内容
本申请实施例提供了一种图像渲染方法、装置、电子设备及存储介质。该技术方案如下:
一方面,提供了一种图像渲染方法,该方法包括:
根据光照渲染指令,获取目标三维模型的光照贴图;
获取所述目标三维模型的接缝边,所述接缝边为在所述目标三维模型中位于同一表面且在所述光照贴图中纹理不连续的边线;
基于所述接缝边,确定所述光照贴图中的目标像素点;
对所述目标像素点进行更新,得到修复后的光照贴图,所述修复后的光照贴图中所述接缝边的纹理连续。
一方面,提供了一种图像渲染装置,该装置包括:
第一获取模块,用于根据光照渲染指令,获取目标三维模型的光照贴图;
第二获取模块,用于获取所述目标三维模型的接缝边,所述接缝边为在所述目标三维模型中位于同一表面且在所述光照贴图中纹理不连续的边线;
第一确定模块,用于基于所述接缝边,确定所述光照贴图中的目标像素点;
更新模块,用于对所述目标像素点进行更新,得到修复后的光照贴图,所述修复后的光照贴图中所述接缝边的纹理连续。
在一种可能实施方式中,一组接缝边包括一条有向边和所述有向边的反向边,所述有向边与所述反向边之间顶点重合且方向相反;
所述第二获取模块用于:
获取所述目标三维模型中至少一个面内的多个顶点;
响应于所述多个顶点中至少两个顶点所形成的有向边存在反向边,将所述有向边和所述反向边确定为一组接缝边。
在一种可能实施方式中,所述装置还包括:
第二确定模块,用于对所述多个顶点中任一顶点,基于所述任一顶点与下一顶点确定一条有向边;
第三确定模块,用于确定与所述有向边之间顶点重合且方向相反的辅助边;
第四确定模块,用于根据所述有向边和所述辅助边,确定所述有向边是否存在所述反向边。
在一种可能实施方式中,所述第四确定模块用于:
若在所述目标三维模型的有向边集合中查询到与所述辅助边相同的边,确定所述有向边存在反向边;
若在所述目标三维模型的有向边集合中查询不到与所述辅助边相同的边,将所述有向边添加至所述有向边集合。
在一种可能实施方式中,所述第一确定模块包括:
第一获取单元,用于对任一组接缝边,获取所述任一组接缝边的顶点在所述光照贴图中的像素位置信息;
第一确定单元,用于基于所述顶点的像素位置信息,确定所述任一组接缝边的像素采样数量;
第二确定单元,用于基于所述像素位置信息和所述像素采样数量,确定所述任一组接缝边所对应的目标像素点。
在一种可能实施方式中,所述第二确定单元用于:
根据所述像素位置信息和所述像素采样数量,确定采样过程的迭代步长;
以任一顶点为起点,将基于所述迭代步长所确定的采样点作为所述目标像素点。
在一种可能实施方式中,所述第一确定单元用于:
获取所述任一组接缝边内的有向边的边长与所述有向边的反向边的边长;
将所述有向边的边长与所述反向边的边长中的最大值与采样质量参数相乘所得的数值,确定为所述像素采样数量。
在一种可能实施方式中,所述更新模块包括:
构建单元,用于基于所述目标像素点的像素值,构建第一矩阵和第二矩阵,所述第一矩阵用于表示所述目标像素点在一组接缝边内的有向边和反向边上的像素信息,所述第二矩阵用于表示所述目标像素点在所述光照贴图中的初始像素值;
第二获取单元,用于基于所述第一矩阵和所述第二矩阵,获取第三矩阵,所述第三矩阵用于表示所述目标像素点的待更新像素值;
更新单元,用于基于所述第三矩阵,将所述目标像素点从所述初始像素值更新为所述待更新像素值,得到所述修复后的光照贴图。
在一种可能实施方式中,所述第二获取单元用于:
基于共轭梯度法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,
基于最小二乘法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,
基于乔列斯基分解法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵。
在一种可能实施方式中,所述第一矩阵的行数为第一目标数量且列数为第二目标数量, 其中,所述第一目标数量为所述接缝边的采样数量与所述目标像素点的数量相加所得的数值,所述第二目标数量为所述目标像素点的数量;所述第二矩阵的行数为所述第一目标数量且所述第二矩阵的列数为一。
一方面,提供了一种电子设备,该电子设备包括一个或多个处理器和一个或多个存储器,该一个或多个存储器中存储有至少一条程序代码,该至少一条程序代码由该一个或多个处理器加载并执行以实现如上述任一种可能实现方式的图像渲染方法。
一方面,提供了一种计算机可读存储介质,该存储介质中存储有至少一条程序代码,该至少一条程序代码由处理器加载并执行以实现如上述任一种可能实现方式的图像渲染方法。
一方面,提供一种计算机程序产品或计算机程序,所述计算机程序产品或所述计算机程序包括一条或多条程序代码,所述一条或多条程序代码存储在计算机可读存储介质中。电子设备的一个或多个处理器能够从计算机可读存储介质中读取所述一条或多条程序代码,所述一个或多个处理器执行所述一条或多条程序代码,使得电子设备能够执行上述任一种可能实施方式的图像渲染方法。
附图说明
图1是本申请实施例提供的一种接缝问题的界面示意图;
图2是本申请实施例提供的一种图像渲染方法的实施环境示意图;
图3是本申请实施例提供的一种图像渲染方法的流程图;
图4是本申请实施例提供的一种获取非零系数的原理性示意图;
图5是本申请实施例提供的一种图像渲染方法的流程图;
图6是本申请实施例提供的一种图像渲染方法的原理性流程图;
图7是本申请实施例提供的一种渲染引擎的操作界面示意图;
图8是本申请实施例提供的一种图像渲染方法的接缝问题修复前后的对比图;
图9是本申请实施例提供的一种图像渲染装置的结构示意图;
图10是本申请实施例提供的一种电子设备的结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
本申请中术语“第一”“第二”等字样用于对作用和功能基本相同的相同项或相似项进行区分,应理解,“第一”、“第二”、“第n”之间不具有逻辑或时序上的依赖关系,也不对数量和执行顺序进行限定。
本申请中术语“至少一个”是指一个或多个,“多个”的含义是指两个或两个以上,例如,多个第一位置是指两个或两个以上的第一位置。
在介绍本申请实施例之前,首先对本申请所涉及的部分术语进行解释:
光照贴图(Lightmap):指对静态物体的三维(3D)模型数据,使用全局光照算法预先生成光照信息的图片,用于表示静态物体的光照视觉效果。
UV展开(UV Unwrapping):指将3D模型数据的网格(mesh)映射到二维(2D)图像上的过程,也即由目标三维模型到光照贴图的光照渲染过程。
双线性插值(Bilinear Interpolation):又称为双线性内插。在理论上,双线性插值是对线性插值在二维直角网格上的扩展,用于对双变量函数进行插值处理,核心思想是在两个方向上分别进行一次线性插值。
光栅化(Rasterization):指把顶点数据转换为片元的过程,具有将原始图像数据转化为一个个栅格组成的图像的作用,特点是片元中的每个元素对应于帧缓冲区中的一个像素点。换言之,光栅化是一种将几何图元变为二维图像的过程。
路径跟踪(Path Tracing):由Kajiya在1986年提出的渲染方法,是第一个无偏(Unbiased)的渲染方法。路径追踪方法的基本思想是从视点发出一条光线,光线与物体表面相交时根据表面的材质属性继续采样一个方向,发出另一条光线,如此迭代,直到光线打到光源上(或逃逸出场景),然后采用蒙特卡洛方法,计算光线的贡献,作为像素点的颜色值。而使用蒙特卡洛方法对积分的求解是无偏的,只要时间足够长,最终图像能收敛到一个正确的结果。
稀疏矩阵(Sparse Matrix):在矩阵中,如果数值为0的元素数目远远多于非0元素的数目,并且非0元素分布无规律时,则称该矩阵为稀疏矩阵。换言之,如果一个矩阵的非0元素占全部元素的数值比例小于一个比例阈值,则该矩阵属于稀疏矩阵。
最小二乘法(Least Squares Method):又称最小平方法,是一种优化方法,能够通过最小化误差的平方和,以寻找数据的最佳匹配函数。
Cholesky分解(Cholesky Decomposition):又称乔列斯基分解方法,是指将一个正定的埃尔米特矩阵分解成一个下三角矩阵与其共轭转置矩阵之乘积。Cholesky分解方法主要被用于线性方程组Ax=b的求解。
方向导数(Directional Derivative):方向导数是分析学特别是多元微积分中的概念。一个标量场在某点沿着某个向量方向上的方向导数,描绘了该点附近标量场沿着该向量方向变动时的瞬时变化率。方向导数是偏导数的概念的推广。
梯度(Gradient):梯度的本意是一个向量(矢量),表示某一函数在该点处的方向导数沿着该方向取的最大值,即函数在该点处沿着该方向(此梯度的方向)变化最快,变化率最大(等于该梯度的模)。
正定矩阵(Positive-Define Matrix):给定一个大小为n×n的实对称矩阵A,若对于任意长度为n×n的非零向量X,有X TAX>0恒成立,则矩阵A是一个正定矩阵。也即是说,对于一个向量X,我们希望X在经过有一个矩阵A的变化后得到的新的向量M和它自身的向量之间的夹角小于90度。
共轭梯度法(Conjugate Gradient Method):一种求解系数矩阵为对称正定矩阵的线性方程组的数值解的方法。共轭梯度法属于一种迭代方法,它适用于系数矩阵为稀疏矩阵的线性方程组,因为使用像Cholesky分解这样的直接方法求解这类系统所需的计算量太大了。
在光照渲染过程中,在创建好待渲染对象的三维(3D)模型之后,需要将3D模型的网格(mesh)展开至二维空间,得到一张二维图像,由于这一二维空间也称为UV空间,因此这一展开过程也称为UV展开,而UV展开所得的二维图像也称为光照贴图,接着,基于渲染引擎对光照贴图的每个像素点进行光照渲染,得到最终光照渲染后的图像。
由于3D模型的网格中相邻面的UV坐标有可能在展开过程中被分割开,而被分割的相邻面在光照贴图中的光照信息存在较大差异,导致最终光照渲染后的图像相邻面呈现出来光照较为割裂的视觉效果,如图1的100所示,这一问题称为“接缝问题”,目前需要技术人员 对接缝问题进行人工排查并手动修复,重新进行UV展开及光照渲染,导致图像渲染的耗时长、效率低。有鉴于此,本申请实施例提供一种图像渲染方法,下面进行详述。
图2是本申请实施例提供的一种图像渲染方法的实施环境示意图。参见图2,该实施例包括:终端201和服务器202,其中,该终端201是任一能够提供图像渲染服务的终端,该服务器202是任一能够提供图像下载服务的服务器。
在一些实施例中,本申请实施例提供的图像渲染方法应用于该终端201,也即是,该终端201基于渲染引擎,自行基于目标三维模型进行渲染,以得到其光照贴图,在该终端201上显示经过光照渲染得到的该光照贴图。
在上述情况下,该终端201的数量为一个或多个,每个终端201独立执行渲染操作,在不同终端上渲染的目标三维模型可以相同,也可以不同,本申请实施例不对此进行具体限定。
终端201以及服务器202能够通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。
可选地,终端201在渲染得到光照贴图后,将渲染好的光照贴图上传至服务器202,由该服务器202提供图像下载服务,使得任一终端能够在登录服务器202后,对该光照贴图进行下载,以随时查看该光照贴图。
服务器202包括一台服务器、多台服务器、云计算平台或者虚拟化中心中的至少一种。可选地,服务器202承担主要计算工作,终端201承担次要计算工作;或者,服务器202承担次要计算工作,终端201承担主要计算工作;或者,终端201和服务器202两者之间采用分布式计算架构进行协同计算。
在一些实施例中,终端201泛指多个终端中的一个,终端201的设备类型包括但不限于:智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表、电子书阅读器、MP3(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)播放器、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器等,但并不局限于此。以下实施例,以终端包括台式计算机来进行举例说明。
在一些实施例中,服务器是独立的物理服务器,或者是多个物理服务器构成的服务器集群或者分布式系统,或者是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)以及大数据和人工智能平台等基础云计算服务的云服务器。
图3是本申请实施例提供的一种图像渲染方法的流程图。参见图3,该实施例由电子设备执行,以下以电子设备为终端为例进行说明,该实施例包括:
301、终端根据光照渲染指令,获取目标三维模型的光照贴图。
其中,该目标三维模型是指本次待渲染的三维模型,目标三维模型对应于至少一个物体,比如,目标三维模型为虚拟场景中单个物体的三维模型,或者,目标三维模型为虚拟场景中多个物体的三维模型。
上述步骤301,也即终端响应于光照渲染指令,获取目标三维模型的光照贴图的一种可能实施方式。在一些实施例中,在对目标三维模型进行渲染时,涉及到对目标三维模型进行光照渲染,可选地,终端基于渲染引擎进行目标三维模型的光照渲染。
可选地,终端在获取目标三维模型之后,接收光照渲染指令,基于该光照渲染指令,采 用路径跟踪算法渲染出光照贴图的每个像素点,也即得到目标三维模型的光照贴图。
在一个示例中,终端接收任一物体的目标三维模型的lightmap(光照贴图)渲染指令,使用路径跟踪算法渲染出lightmap的每个像素点,最终得到物体的lightmap,这样能够达到一种无偏差的光照渲染效果。
在基于路径跟踪算法进行渲染的过程中,可以从视点发出一条光线,光线与物体表面相交时根据表面的材质属性继续采样一个方向,发出另一条光线,如此迭代,直到光线打到光源上(或逃逸出场景),然后采用蒙特卡洛方法,计算光线的贡献,作为像素点的颜色值。简言之,路径追踪算法是在光线追踪算法(Ray Tracing)的基础上结合了蒙特卡洛方法进行积分求解,由于使用蒙特卡洛方法对积分的求解是无偏的,只要时间足够长,最终能够收敛到一张全局的光照贴图,因此基于路径追踪算法能够达到无偏差的光照渲染效果。
在一些实施例中,终端还可以基于光栅化方法或者光线追踪算法来进行光照渲染,从而简化光照渲染过程的计算量,本申请实施例不对光照渲染方式进行具体限定。
302、终端获取该目标三维模型的接缝边,该接缝边为在该目标三维模型中位于同一表面且在该光照贴图中纹理不连续的边线。
由于接缝边在该目标三维模型中是位于同一表面的,因此接缝边所对应的像素点与其邻域点理应在光照贴图中也具有连续的纹理,然而,正是由于在UV展开的过程中,有可能会将接缝边分别展开到光照贴图的不相邻位置,如果上述不相邻位置上的像素点的纹理不连续,就会导致接缝问题的产生。例如,圆柱体的侧面展开为矩形的光照贴图时,光照贴图的左边线和右边线实际上在圆柱体的3D模型中应该是同一条接缝边,如果光照贴图的左边线和右边线的纹理不连续(例如,像素点的像素值产生了突变),就会导致渲染出的圆柱体,在接缝边的两侧过渡不平滑,即产生了接缝问题,这类问题需要在图像渲染中被修复。
在上述过程中,终端可以在执行上述步骤301之后,自动识别该目标三维模型的接缝边,或者,终端在执行上述步骤301之前,预先识别该三维模型的接缝边,本申请实施例不对识别接缝边与渲染光照贴图这两个步骤的先后执行顺序进行具体限定。
上述步骤302也即是终端自动识别接缝问题的过程,当出现接缝问题时,每个物体(Object)的三维模型中至少存在一组接缝边,如图1中的方框区域,可以看出,一组接缝边是由一条有向边和该有向边的反向边所组成的,其中,该有向边与该反向边之间顶点重合且方向相反。由于有向边和反向边本来在目标三维模型中是共边的,因此本该呈现出连续平滑的光照过渡效果,在发生接缝问题的情况下,有向边与反向边在光照贴图中被割裂开了,因此会呈现出如图1的方框区域内同一个表面中纹理不连续、光照过渡不平滑的异常表现。
在一些实施例中,终端可以基于下述方式来识别出接缝边:终端获取该目标三维模型中至少一个面内的多个顶点;响应于该多个顶点中至少两个顶点所形成的有向边存在反向边,将该有向边和该反向边确定为一组接缝边。
在上述过程中,直接利用目标三维模型在自身渲染阶段需要获取的顶点信息,即可完成接缝边的自动识别及判断,无需拉取额外的外部数据,更无需投入额外的人力成本,能够大大提升图像渲染效率,降低图像渲染的人力成本。
可选地,终端在获取顶点的过程中,可以基于目标三维模型的烘焙(bake)任务信息来获取目标三维模型的网格信息。其中,烘焙是指基于目标三维模型的模型数据获取光照贴图的过程,因此该烘焙任务信息是终端基于光照渲染指令所创建的任务信息。其中,该网格信息包括各个面中的各个顶点信息、法线信息、UV坐标、三角面信息等,这里的三角面是指 三个顶点所唯一确定的一个模型平面。接着,终端从该网格信息中,即可获取该目标三维模型中至少一个面内的多个顶点。
在一些实施例中,终端在获取接缝边之前,还可以进行如下初始化步骤:创建一个用于记载两个有向边对的集合(记作Seams),集合中的每个元素是一对互相反向的有向边(有向边VertexEdge及辅助边ReversedEdge),这里的辅助边是基于有向边而构造出来的一条边,并不一定是目标三维模型中真实存在的有向边,将Seams初始化为空集。再者,创建一个有向边集合,该有向边集合用于记载目标三维模型中真实存在的有向边,可选地,该有向边集合为字典、数组、列表、队列、堆栈等数据结构,本申请实施例对此不作限定,在一个示例性中,该有向边集合为字典集合,记作EdgeMap,字典集合是一种键值型存储的数据结构,Key(键名)值为有向边,而Value(键值)值包括该有向边的两个顶点的法线信息及UV坐标。
在上述过程中,通过对有向边对集合Seams和字典集合EdgeMap进行初始化,便于在自动识别接缝边的过程中快速进行遍历识别,可以加快识别接缝边的速度,提升识别接缝边的效率。
在创建了有向边对集合Seams和字典集合EdgeMap之后,可选地,终端基于下述操作确定任一有向边是否存在其反向边:对该多个顶点中任一顶点,基于该顶点与下一顶点确定一条有向边;确定与该有向边之间顶点重合且方向相反的辅助边;根据该有向边和该辅助边,确定该有向边是否存在该反向边,可选地,在该辅助边为另一有向边的情况下,将该辅助边确定为该有向边的反向边。
在一个示例中,终端可以执行如下遍历操作,以确定至少两个顶点所形成的有向边是否存在其反向边:遍历目标三维模型的每个面,以每个面均为三角面为例,对于任一个三角面,遍历三角面内的三个顶点。接着,1)根据当前顶点和该当前顶点的下一顶点,生成一条有向边VertexEdge。2)根据有向边VertexEdge,创建一个与该有向边之间顶点重合且方向相反的辅助边ReversedEdge。3)接着,在创建的字典集合EdgeMap中,查找是否存在与辅助边ReversedEdge对应的数据,如果字典集合EdgeMap中存在对应的数据,说明出现了接缝问题,这一接缝边为有向边与反向边所构成的一组有向边对(VertexEdge和RervsedEdge),将有向边对(VertexEdge和RervsedEdge)插入到有向边对集合Seams中,否则,如果字典集合EdgeMap中不存在对应的数据,说明这一有向边VertexEdge不存在接缝问题,将这一有向边VertexEdge插入到字典集合EdgeMap中,继续遍历当前面中的下一顶点,循环执行上述过程直到遍历了每个面内的每个顶点,返回最终的有向边对集合Seams。
在一些实施例中,在确认字典集合EdgeMap中是否存在与该有向边的辅助边ReversedEdge对应的数据时,终端遵循如下两点判定原则,如果字典集合EdgeMap中存在一条目标有向边满足:1)该目标有向边的UV坐标与辅助边ReversedEdge的UV坐标相同;2)该辅助边ReversedEdge的法线与该目标有向边的两个顶点之间的夹角小于角度阈值,那么说明该目标有向边与辅助边ReversedEdge共边(也即两边重合),说明出现了接缝问题。其中,在编辑器中seam的角度阈值可以设置为normalcosthreadhold。
在上述过程中,在该目标三维模型的有向边集合EdgeMap中查询到与该辅助边ReversedEdge相同的边的情况下,确定该有向边VertexEdge存在反向边,将该辅助边确定为该有向边的反向边;在该目标三维模型EdgeMap的有向边集合中查询不到与该辅助边ReversedEdge相同的边的情况下,将该有向边VertexEdge添加至该有向边集合EdgeMap。这 样,能够在循环过程中,将存在反向边的一组有向边对识别出来并添加到有向边对集合Seams中,并在最终遍历完毕后将有向边对集合Seams作为返回值,此外,还能够将不存在反向边的有向边插入到有向边集合EdgeMap中,扩充下一次循环过程中需要识别的有向边集合EdgeMap内的元素数量,能够提升识别接缝边的准确性。
303、终端基于该接缝边,确定该光照贴图中的目标像素点。
其中,该目标像素点是指本次接缝问题修复过程中的待修复像素点。
上述步骤303也即是终端自动修复接缝问题的过程,换言之,终端在该光照贴图中,确定与该接缝边对应的目标像素点。在从上述步骤302中确定出接缝边之后,终端可以收集光照贴图lightmap中组成各组接缝边的像素点的像素信息,可选地,一个像素点的像素信息包括像素点的像素位置信息(也即位置坐标)和像素颜色信息(也即光照颜色信息),将组成各组接缝边的像素点的像素信息所构成的数据集合记为SeamTexels。
在一些实施例中,对任一组接缝边,终端通过下述方式确定目标像素点:获取任一组该接缝边的顶点在该光照贴图中对应像素点的像素位置信息;基于该像素位置信息,确定任一组该接缝边对应的像素采样数量;基于该像素位置信息和该像素采样数量,确定任一组该接缝边所对应的目标像素点。
在获取顶点的像素位置信息时,终端可以执行下述步骤:遍历每个有向边对集合Seams中的每组接缝边(一组接缝边包括一对方向相反的有向边A和B),接下来终端分别获取有向边A和B在光照贴图中其顶点所对应像素点的像素位置信息:(StartPosA,EndPosA,StartPosB,EndPosB)。其中,StartPosA为有向边A的起始顶点所对应像素点的像素位置信息,EndPosA为有向边A的结束顶点所对应像素点的像素位置信息,StartPosB为有向边B的起始顶点所对应像素点的像素位置信息,EndPosB为有向边B的结束顶点所对应像素点的像素位置信息。
需要说明的是,有向边A和B虽然在目标三维模型中共边(也即顶点重合),但是在光照贴图中却存在各不相同的起始顶点和结束顶点,而正是由于在目标三维模型中本该重合的顶点在光照贴图中被分割割裂开了,才会引发俗称的“接缝问题”,产生如图1中方框区域所示的光照过渡不连续的视觉问题,因此针对每组接缝边会获取到四个顶点各自所对应像素点的像素位置信息。
在获取到四个顶点各自所对应像素点的像素位置信息之后,终端可以基于这四个顶点各自所对应像素点的像素位置信息,计算出这一组接缝边对应的像素采样数量,由于在采样时需要分别对一组接缝边内的两个有向边进行采样,因此终端能够基于下述步骤确定像素采样数量:获取任一组该接缝边内的有向边的边长与该有向边的反向边的边长;将该有向边的边长与该反向边的边长中的最大值与采样质量参数相乘所得的数值,确定为该像素采样数量。
在上述过程中,能够通过较少的像素采样数量采集到尽可能多的组成接缝边的目标像素点的像素信息,具有较高的采样质量,其中,每个目标像素点的像素信息至少包括目标像素点的像素位置信息和目标像素点的光照颜色信息(例如,RGB三个通道各自的像素值)。在一些实施例中,还可以将该有向边的边长与该反向边的边长相加所得的数值再与采样质量参数相乘,得到该像素采样数量,这样能够通过提升采样密度从而提高最终的采样质量。
在一些实施例中,终端可以分别获取两条有向边的像素采样数量(记作SampleCount),有向边A的像素采样数量等于有向边A的边长,记作SampleCountA=Length(EndPosA–StartPosA),有向边B的像素采样数量等于有向边B(也即有向边A的反向边)的边长,记 作SampleCountB=Length(EndPosB–StartPosB),两条有向边所构成的一组接缝边总共的像素采样数量SampleCount=Max(SampleCountA,SampleCountB)*SampleQuanlity,其中,SampleQuanlity是一个由编辑器的烘焙参数传入的采样质量参数。
在确定一组接缝边的像素采样数量之后,终端可以基于下述方式来确定目标像素点:根据该像素位置信息和该像素采样数量,确定采样过程的迭代步长即像素采样的迭代步长;以任一顶点对应的像素点为起点,基于该迭代步长进行像素采样;将基于该迭代步长所确定的采样点作为该目标像素点,也即,将该像素采样中确定的采样点获取为该目标像素点。
在一些实施例中,以有向边A为例,终端根据有向边A的两个顶点的像素位置信息StartPosA和EndPosA,能够获取到有向边A在光照贴图中所跨越的像素(待采样的像素点,简称为采样点),并将采样点记录到像素列表中。可选地,为了避免冗余的计算量,在像素列表中记录采样点时,可以遵循查找去重原则。
在一些实施例中,获取采样点的方式如下:终端获取即将在Samplecount上进行迭代的步长(Step),Step=(EndPosA-StartPosA)/SampleCount,接着从从0到SampleCount进行循环迭代,迭代索引记作StepIndex(相当于采样次数),对任一次迭代过程,当前迭代过程的采样点的像素坐标CoveragePixel=StartPosA+Step*StepIndex,接下来可以在像素信息的数据集合SeamTexels中查询是否已经记载了对应位置的像素信息,如果没有记载,那么将当前采样点的像素位置坐标和光照颜色信息添加到SeamTexels中,如果已经记载了,那么进行下一次采样。在本申请实施例中,仅以有向边A的迭代采样过程为例进行说明,对于其对应的有向边B可以进行类似操作,这里不做赘述。
304、终端对该目标像素点进行更新,得到修复后的光照贴图,该修复后的光照贴图中该接缝边的纹理连续。
其中,该修复后的光照贴图中与该接缝边对应的像素点以及邻域点的纹理连续,换言之,该修复后的光照贴图中的纹理是连续的。
上述步骤304,也即终端在该光照贴图中对该目标像素点的初始像素值进行更新,得到修复后的光照贴图。
在一些实施例中,终端在对目标像素点进行更新之前,需要解出目标像素点的待更新像素值。可选地,终端基于该目标像素点的像素信息,构建第一矩阵和第二矩阵;基于该第一矩阵和该第二矩阵,获取第三矩阵,该第三矩阵用于表示该目标像素点的待更新像素值。在获取到目标像素点的待更新像素值之后,终端可以基于该第三矩阵,将该目标像素点从初始像素值更新为该待更新像素值,得到修复后的光照贴图。
其中,该第一矩阵用于表示该目标像素点在一组接缝边内的有向边和反向边上的像素信息,也即是说,该第一矩阵用于表示该目标像素点的邻域点在该光照贴图中的初始像素值以及该目标像素点的烘焙结果系数,该第二矩阵用于表示该目标像素点在该光照贴图中的初始像素值。
在一些实施例中,终端在求解第三矩阵时,可以根据第一矩阵和第二矩阵构建一组线性方程组,这是由于在光照贴图中更新目标像素点时,通常需要分别对RGB(红绿蓝)三个通道的像素值进行更新,因此可以针对RGB三个通道分别构建出三个线性方程组,最终可以获取到每个通道下的待更新像素值。以任一色彩通道为例,在构建线性方程组时,将第三矩阵作为未知数,即可构建Ax=b的线性方程组,其中,A表示第一矩阵,b表示第二矩阵(由于列数为1,因此相当于一个列向量),x表示第三矩阵(同时也是待求解的未知数),接下来利 用一些方程组求解手段,即可处理得到第三矩阵。
可选地,终端基于共轭梯度法对该第一矩阵和该第二矩阵进行处理,得到该第三矩阵。其中,该共轭梯度法是一种将共轭性与最速下降方法相结合的数据处理方式,利用第一矩阵和第二矩阵构建线性方程组之后,在目标像素点在RGB三个通道上的初始像素值的基础上分别进行迭代,即可输出目标像素点在RGB三个通道上的待更新像素值。共轭梯度法对第三矩阵的求解速度较快、数据存储量小,因此能够提升第三矩阵的获取速率。
由于共轭梯度法求解Ax=b方程组时,需要保证第一矩阵A是一个正定矩阵,在此示出证明第一矩阵A为正定矩阵的过程:将Ax=b等价变换为A TAx=A Tb,其中A T表示第一矩阵A的转置矩阵。由于(BA) T=A TB T,这里令B=A T代入上式,得到(A TA) T=A TA,符合矩阵对称的定义,因此A TA为对称矩阵,而由于第一矩阵A中的系数都是正小数,因此第一矩阵A是正定矩阵,第一矩阵A的转置矩阵A T也是正定矩阵,且二者相乘所得的矩阵A TA也是正定矩阵,也即A TA为对称正定矩阵。
在保证第一矩阵A为正定矩阵的基础上,即可采用共轭梯度法求解任一通道的线性方程组Ax=b,在一些实施例中,该第一矩阵A的行数为第一目标数量m且列数为第二目标数量n,也即第一矩阵A是一个m行n列的矩阵。其中,该第一目标数量m为该接缝边的采样数量r0与该目标像素点的数量r1相加所得的数值(m=r0+r1),其中,该接缝边的采样数量r0是指对目标像素点的邻域点的采样组数,关于邻域点的采样过程将在下文进行描述,这里不做赘述。该第二目标数量n为该目标像素点的数量r1(n=r1),该第二矩阵b的行数为该第一目标数量m且该第二矩阵的列数为一。
在一些实施例中,由于一组接缝边的采样数量可以表示为SampleCount,那么所有接缝边的采样数量r0=ΣSampleCountForEverySeamPair,由于在上述步骤202中目标像素点的像素信息都被记录在SeamTexels中,那么目标像素点的数量r1=Count(SeamTexels),换言之,r1为SeamTexels内的元素数量。
可选地,第一矩阵A的前r0行中每行只有8个元素是非零小数,其他元素均为0,并且由于第一矩阵A的列数n一般都较大,可见第一矩阵A中零元素的数量远大于非零元素的数量,也即第一矩阵A中非零元素占全部元素的数值比例小于比例阈值,第一矩阵A属于稀疏矩阵。而每行包含8个非零元素是由于对光照贴图通常采用双线性差值法来确定一个采样点的像素信息,例如,目标三维模型的接缝边中的一个位置点,在光照贴图中被展开成了一对目标像素点,即该接缝边中的一个位置点对应于该光照贴图中的一对目标像素点,在像素值修复过程中,需要将这一对目标像素点中的每个目标像素点都作为采样点,假设对每个采样点都采样四个邻域点(邻域点是指该采样点周围的像素点),那么对每对目标像素点能够采样得到一组共八个邻域点,并基于这八个邻域点的像素位置信息和光照颜色信息,计算出8个非零系数。例如,需要对一个采样点周围的四个像素点(即邻域点)分别进行插值,由于接缝边需要对分布于接缝两侧的有向边和反向边的数据分别进行插值,因此需要考虑到接缝边对应一侧的采样点周围的四个像素点(即邻域点),因此每一行内包含8个非零系数。
在一个示例中,图4是本申请实施例提供的一种获取非零系数的原理性示意图,第一矩阵A中每一行的8个非零系数的获取方式如图4所示。请参考400,假设采样点的像素坐标为(x,y),对x向下取整所得的数值记作floor(x),对x向上取整所得的数值记作ceil(x),同理,对y向下取整所得的数值记作floor(y),对y向上取整所得的数值记作ceil(y),这样可以确定采样点(x,y)周围的4个像素点:(floor(x),floor(y))、(ceil(x),floor(y))、(floor(x), ceil(y))、(ceil(x),ceil(y))。
在上述4个像素点的基础上,基于双线性插值能够确定采样点(x,y)在单条有向边上所对应的4个非零系数分别为:
a0=(1–frac(x))*(1–frac(y));
a1=frac(x)*(1-frac(y));
a2=(1-frac(x))*frac(y);
a3=frac(x)*frac(y)。
其中,frac(x)为x与floor(x)之间的差值,frac(y)为y与floor(y)之间的差值。
终端可以按照类似的方式,获取到一组接缝边内该一条有向边的反向边上的另外4个非零系数,记作b0、b1、b2、b3,需要注意符号取反,接下来a0~a3和b0~b3即可作为第一矩阵A内与该采样点对应行的8个非零系数。
重复执行上述过程,能够基于双线性插值法构造出第一矩阵A的前r0行内的各个非零系数,并将其余的系数均采用0进行填充。而对于第一矩阵A的后r1行,可以采用一个λ为系数的矩阵,每一行中只有采样点自身所在列取值为λ,其余项皆为0,其中λ是由渲染引擎的编辑器所传入的一个位于[0,1]区间的小数(即烘焙结果系数),可由技术人员进行自定义设置,也可以采用默认值,例如默认值为0.5。
在上述过程中,基于双线性插值确定了第一矩阵A的矩阵系数,能够方便快捷地构造出第一矩阵A,在一些实施例中,还可以采用双三次插值等方式来确定第一矩阵A的矩阵系数,这样能够提升采样精度。
在一些实施例中,第二矩阵b是一个行数为m的列向量,可选地,在第二矩阵b中前r0行中的b值均取0,后r1行中b的值为光照贴图中原有像素的数值(也即目标像素点的初始像素值),由于在光照贴图中通常会按照RGB三个通道,分别记录下来每个目标像素点的在三个通道各自的初始像素值,因此可以构建出三个通道各自的三个第二矩阵b,从而可以构建出三组Ax=b形式的线性方程组。
以任一通道的线性方程组Ax=b为例,在基于第一矩阵A和第二矩阵b获取第三矩阵x的过程中,终端先将Ax=b转换成A TAx=A Tb形式,再基于共轭梯度法确定第三矩阵x,也即对目标像素点在该通道上的初始像素值进行迭代求解,最终输出目标像素点在该通道上的待更新像素值,对其他通道也可执行类似操作,最终能够得到目标像素点分别在RGB三个通道上的待更新像素值,这里不做赘述。
其中,上述共轭梯度法的循环逻辑如下:
r 0:=b-Ax 0
p 0:=r 0
k:=0
repeat
Figure PCTCN2021113716-appb-000001
x k+1:=x k+α kp k
r k+1:=r k-α kAp k
if r k+1 is sufficiently small,then exit loop
Figure PCTCN2021113716-appb-000002
p k+1:=r k+1+β kp k
k:=k+1
end repeat
结果为x k+1
其中,循环逻辑中的A为第一矩阵(也即线性方程组的系数矩阵),b为第二矩阵(也即线性方程组在观测数据下的观测值),k为迭代次数,r为当前迭代过程的预测误差,p为当前迭代过程的第三矩阵x的梯度,α和β均为求解线性方程组时的迭代步进,x0为目标像素点在光照贴图中的初始像素值,最终输出的结果x k+1为目标像素点在光照贴图中的待更新像素值。
上述循环逻辑也即是共轭梯度下降算法,首先初始化预测误差r 0、梯度p 0以及迭代次数k,接下来基于上述各个公式,迭代计算当前迭代过程的迭代步进α k和β k、梯度p k+1、预测值x k+1以及预测误差r k+1,直到预测误差r k+1足够小(比如小于误差阈值),那么退出循环,输出最后一次迭代过程的预测值x k+1,作为目标像素点的待更新像素值。
在上述过程中,以共轭梯度法为例示出了基于第一矩阵A和第二矩阵b来获取第三矩阵x的过程,能够在自动识别出接缝边之后,自动修复接缝边上存在的接缝问题,避免了技术人员在触发光照渲染指令之后,还需要人工反复排查修复lightmap中的接缝问题,使得技术人员能够专心将精力投入到开发设计工作中,大大节约了图像渲染中用于修复接缝问题的人力资源,大大提升了图像渲染效率。
在一些实施例中,终端也可以基于最小二乘法对该第一矩阵A和该第二矩阵b进行处理,得到该第三矩阵x,能够降低获取第三矩阵x过程的计算量、提升计算效率,或者,终端基于乔列斯基(Cholesky)分解法对该第一矩阵A和该第二矩阵b进行处理,得到该第三矩阵x,能够提升获取第三矩阵x过程的计算精度。
上述所有可选技术方案,能够采用任意结合形成本公开的可选实施例,在此不再一一赘述。
本申请实施例提供的方法,通过自动识别出目标三维模型的接缝边,接着自动在目标三维模型的光照贴图中定位到待修复的目标像素点,这些目标像素点也即是接缝边上出现纹理不连续的边线所对应的像素点,从而自动对目标像素点的像素值进行更新,最终输出修复后的光照贴图,使得能够一键完成接缝问题的自动识别和自动修复,大大降低了图像渲染过程 中用于排查并修复接缝问题的人力资源,从而降低了图像渲染耗时、提升了图像渲染效率。
图5是本申请实施例提供的一种图像渲染方法的流程图,请参考图5,该方法应用于终端,包括下述步骤:
501、终端根据光照渲染指令,获取目标三维模型的光照贴图。
其中,该目标三维模型是指本次待渲染的三维模型,目标三维模型可以对应于至少一个物体,例如,目标三维模型为单个物体的三维模型,或者,目标三维模型为多个物体所构成的虚拟场景的三维模型,本申请实施例不对目标三维模型的内容进行具体限定。
上述步骤501也即终端响应于光照渲染指令,获取目标三维模型的光照贴图,与上述步骤301类似,这里不做赘述。
502、终端获取该目标三维模型中至少一个面内的多个顶点。
可选地,终端基于目标三维模型的烘焙(bake)任务信息来获取目标三维模型的网格信息。其中,烘焙是指基于目标三维模型的模型数据获取光照贴图的过程,因此该烘焙任务信息是终端基于光照渲染指令所创建的任务信息。其中,该网格信息包括各个面中的各个顶点信息、法线信息、UV坐标、三角面信息等,这里的三角面是指三个顶点所唯一确定的一个模型平面。接着,终端从该网格信息中,即可获取该目标三维模型中至少一个面内的多个顶点。
503、终端对该多个顶点中任一顶点,基于该任一顶点与下一顶点确定一条有向边。
在一些实施例中,终端在确定有向边之前,还可以进行如下初始化步骤:创建一个用于记载两个有向边对的集合(记作Seams),集合中的每个元素是一对互相反向的有向边(有向边VertexEdge及辅助边ReversedEdge),这里的辅助边是基于有向边而构造出来的一条边,并不一定是目标三维模型中真实存在的有向边,将Seams初始化为空集。
再者,创建一个有向边集合,该有向边集合用于记载目标三维模型中真实存在的有向边,可选地,该有向边集合为字典、数组、列表、队列、堆栈等数据结构,在一个示例性中,该有向边集合为字典集合,记作EdgeMap,字典集合是一种键值型存储的数据结构,Key(键名)值为有向边,而Value(键值)值包括该有向边的两个顶点的法线信息及UV坐标。
在上述过程中,通过对有向边对集合Seams和字典集合EdgeMap进行初始化,便于在自动识别接缝边的过程中快速进行遍历识别,可以加快识别接缝边的速度,提升识别接缝边的效率。
在创建了有向边对集合Seams和字典集合EdgeMap之后,终端遍历目标三维模型的每个面,以每个面均为三角面为例,对于任一个三角面,遍历三角面内的三个顶点,在任一次遍历过程中,根据当前顶点和该当前顶点的下一顶点,生成一条有向边VertexEdge。
504、终端确定与该有向边之间顶点重合且方向相反的辅助边。
在上述过程中,终端在基于当前顶点和下一顶点生成一条有向边VertexEdge之后,以该有向边VertexEdge的两个顶点不变,创建一条与有向边VertexEdge方向相反的辅助边ReversedEdge,也即是说,得到一个与该有向边VertexEdge之间顶点重合且方向相反的辅助边ReversedEdge。这里的辅助边是基于有向边而构造出来的一条边,并不一定是目标三维模型中真实存在的有向边,需要通过下述步骤505来判断是否存在与辅助边共边的有向边,如果存在,说明有向边VertexEdge存在对应的反向边,此时发生了接缝问题。
505、终端根据该有向边和该辅助边,确定该有向边是否存在该有向边的反向边。
可选地,终端在该辅助边为另一有向边的情况下,将该辅助边确定为该有向边的反向边,例如,终端在该目标三维模型的有向边集合中查询是否存在与该辅助边相同的边(也即存在与辅助边共边的边),在该目标三维模型的有向边集合中查询到与该辅助边相同的边的情况下,确定该有向边存在反向边,将该辅助边确定为该有向边的反向边,否则,在该目标三维模型的有向边集合中查询不到与该辅助边相同的边的情况下,将该有向边添加至该有向边集合,执行遍历当前面的下一顶点的循环过程,如果当前顶点是当前面的最后一个顶点,那么继续遍历下一个面的第一个顶点。
在一些实施例中,终端在创建的字典集合EdgeMap中,查找是否存在与辅助边ReversedEdge对应的数据,如果字典集合EdgeMap中存在对应的数据,说明出现了接缝问题,这一接缝边为有向边与反向边所构成的一组有向边对(VertexEdge和RervsedEdge),将有向边对(VertexEdge和RervsedEdge)插入到有向边对集合Seams中,否则,如果字典集合EdgeMap中不存在对应的数据,说明这一有向边VertexEdge不存在接缝问题,将这一有向边VertexEdge插入到字典集合EdgeMap中,继续遍历当前面中的下一顶点,循环执行上述过程直到遍历了每个面内的每个顶点,返回最终的有向边对集合Seams。
在一些实施例中,在确认字典集合EdgeMap中是否存在与该有向边的辅助边ReversedEdge对应的数据时,终端遵循如下两点判定原则,如果字典集合EdgeMap中存在一条目标有向边满足:1)该目标有向边的UV坐标与辅助边ReversedEdge的UV坐标相同;2)该辅助边ReversedEdge的法线与该目标有向边的两个顶点之间的夹角小于角度阈值,那么说明该目标有向边与辅助边ReversedEdge共边(也即两边重合),说明出现了接缝问题。其中,在编辑器中seam的角度阈值可以设置为normalcosthreadhold。
在上述过程中,若在该目标三维模型的有向边集合EdgeMap中查询到与该辅助边ReversedEdge相同的边,确定该有向边VertexEdge存在反向边;若在该目标三维模型EdgeMap的有向边集合中查询不到与该辅助边ReversedEdge相同的边,将该有向边VertexEdge添加至该有向边集合EdgeMap。这样,能够在循环过程中,将存在反向边的一组有向边对识别出来并添加到有向边对集合Seams中,并在最终遍历完毕后将有向边对集合Seams作为返回值,此外,还能够将不存在反向边的有向边插入到有向边集合EdgeMap中,扩充下一次循环过程中需要识别的有向边集合EdgeMap内的元素数量,能够提升识别接缝边的准确性。
506、终端响应于该多个顶点中至少两个顶点所形成的有向边存在反向边,将该有向边和该反向边确定为一组接缝边。
在上述过程中,每当检测出任一条有向边存在反向边之后,将该有向边和该反向边确定为一组接缝边,在对目标三维模型的各个面内的各个有向边遍历完毕后,如果存在接缝问题,那么能够确定出至少一组接缝边,如果不存在接缝问题,也即未检测到任何有向边存在反向边,那么终端报告无接缝问题。
在一些实施例中,在上述步骤505的遍历过程中,一旦检测出一组接缝边,那么就将检测出的一组接缝边插入到有向边对集合Seams中,在遍历完毕后直接调用循环逻辑所返回的有向边对集合Seams,即可读取到目标三维模型的各组接缝边。其中,一组接缝边包括一条有向边和该有向边的反向边,该有向边与该反向边之间顶点重合且方向相反。
在上述步骤502-506中,终端获取该目标三维模型的接缝边,该接缝边为在该目标三维模型中位于同一表面且在该光照贴图中纹理不连续的边线,可选地,在本申请实施例中,上述获取接缝边的过程在终端渲染得到光照贴图之后执行,这样能够直接对渲染后的光照贴图 的接缝边进行拟合,能够得到更好地接缝修复效果,在一些实施例中,在渲染阶段之前就自动识别出目标三维模型中的接缝边,然后在光照采样阶段,在附近的世界空间中进行像素的差值计算,使得对目标像素点在渲染阶段中就拟合出纹理变换更加平滑的待更新像素值,这样使得光照渲染之后直接得到已经经过修复的光照贴图。
507、对任一组接缝边,终端获取该任一组接缝边的顶点在该光照贴图中的像素位置信息。
上述步骤507,也即对任一组该接缝边,获取该接缝边的顶点在该光照贴图中对应像素点的像素位置信息。
在上述过程中,终端在确定出各组接缝边之后,可以收集光照贴图lightmap中组成各组接缝边的像素点的像素信息,可选地,一个像素点的像素信息包括像素点的像素位置信息(也即位置坐标)和像素颜色信息(也即光照颜色信息),将组成各组接缝边的像素点的像素信息所构成的数据集合称为SeamTexels。
在一些实施例中,终端遍历每个有向边对集合Seams中的每组接缝边(一组接缝边包括一对方向相反的有向边A和B),从SeamTexels中可以读取到有向边A和B在光照贴图中其顶点所对应像素点的像素位置信息:(StartPosA,EndPosA,StartPosB,EndPosB)。
其中,StartPosA为有向边A的起始顶点所对应像素点的像素位置信息,EndPosA为有向边A的结束顶点所对应像素点的像素位置信息,StartPosB为有向边B的起始顶点所对应像素点的像素位置信息,EndPosB为有向边B的结束顶点所对应像素点的像素位置信息。
需要说明的是,有向边A和B虽然在目标三维模型中共边(也即顶点重合),但是在光照贴图中却存在各不相同的起始顶点和结束顶点,而正是由于在目标三维模型中本该重合的顶点在光照贴图中被分割割裂开了,才会引发俗称的“接缝问题”,产生如图1中方框区域所示的光照过渡不连续的视觉问题,因此针对每组接缝边会获取到四个顶点的像素位置信息。
508、终端基于该顶点的像素位置信息,确定该任一组接缝边的像素采样数量。
上述步骤508,也即终端基于该像素位置信息,确定该接缝边对应的像素采样数量。
可选地,终端获取该任一组接缝边内的有向边的边长与该有向边的反向边的边长,将该有向边的边长与该反向边的边长中的最大值与采样质量参数相乘所得的数值,确定为该像素采样数量。
在上述过程中,能够通过较少的像素采样数量采集到尽可能多的接缝边相关的像素信息,具有较高的采样质量,在一些实施例中,将该有向边的边长与该反向边的边长相加所得的数值再与采样质量参数相乘,得到该像素采样数量,这样能够通过提升采样密度从而提高最终的采样质量。
在一些实施例中,终端可以分别获取两条有向边的像素采样数量(记作SampleCount),有向边A的像素采样数量等于有向边A的边长,记作SampleCountA=Length(EndPosA–StartPosA),有向边B的像素采样数量等于有向边B(也即有向边A的反向边)的边长,记作SampleCountB=Length(EndPosB–StartPosB),两条有向边所构成的一组接缝边总共的像素采样数量SampleCount=Max(SampleCountA,SampleCountB)*SampleQuanlity,其中,SampleQuanlity是一个由编辑器的烘焙参数传入的采样质量参数。
509、终端基于该像素位置信息和该像素采样数量,确定该任一组接缝边所对应的目标像素点。
在一些实施例中,终端可以基于该像素位置信息和该像素采样数量,确定采样过程的迭代步长即像素采样的迭代步长;以任一顶点对应的像素点为起点,基于该迭代步长进行像素 采样;将基于该迭代步长所确定的采样点作为该目标像素点,也即,将该像素采样中确定的采样点获取为该目标像素点。
以有向边A为例,终端根据有向边A的两个顶点的像素位置信息StartPosA和EndPosA,能够获取到有向边A在光照贴图中所跨越的像素(待采样的像素点,简称为采样点),并将采样点记录到像素列表中。可选地,为了避免冗余的计算量,在像素列表中记录采样点时,可以遵循查找去重原则。
在一些实施例中,获取采样点的方式如下:终端获取即将在Samplecount上进行迭代的步长(Step),Step=(EndPosA-StartPosA)/SampleCount,接着从从0到SampleCount进行循环迭代,迭代索引记作StepIndex(相当于采样次数),对任一次迭代过程,当前迭代过程的采样点的像素坐标CoveragePixel=StartPosA+Step*StepIndex,接下来可以在像素信息的数据集合SeamTexels中查询是否已经记载了对应位置的像素信息,如果没有记载,那么将当前采样点的像素位置坐标和光照颜色信息添加到SeamTexels中,如果已经记载了,那么进行下一次采样。在本申请实施例中,仅以有向边A的迭代采样过程为例进行说明,对于其对应的有向边B可以进行类似操作,这里不做赘述。
在上述步骤507-509中,终端基于该接缝边,确定该光照贴图中的目标像素点,换言之,在该光照贴图中,确定与该接缝边对应的目标像素点,这些目标像素点也即是接缝边上出现纹理不连续的边线所对应的像素点,通过下述步骤510-512,可以对这些目标像素点的初始像素值进行更新,拟合出修复后的光照贴图。
510、终端基于该目标像素点的像素值,构建第一矩阵和第二矩阵,该第一矩阵用于表示该目标像素点在一组接缝边内的有向边和反向边上的像素信息,该第二矩阵用于表示该目标像素点在该光照贴图中的初始像素值。
也即是说,该第一矩阵用于表示该目标像素点的邻域点在该光照贴图中的初始像素值以及该目标像素点的烘焙结果系数。
在一些实施例中,该第一矩阵A的行数为第一目标数量m且列数为第二目标数量n,也即第一矩阵A是一个m行n列的矩阵。其中,该第一目标数量m为该接缝边的采样数量r0与该目标像素点的数量r1相加所得的数值(m=r0+r1),其中,该接缝边的采样数量r0是指对目标像素点的邻域点的采样组数,关于邻域点的采样过程将在下文进行描述,这里不做赘述。该第二目标数量n为该目标像素点的数量r1(n=r1),该第二矩阵b的行数为该第一目标数量m且该第二矩阵的列数为一。
可选地,终端在求解第三矩阵时,可以根据第一矩阵和第二矩阵构建一组线性方程组,这是由于在光照贴图中更新目标像素点时,通常需要分别对RGB(红绿蓝)三个通道的像素值进行更新,因此可以针对RGB三个通道分别构建出三个线性方程组,最终可以获取到每个通道下的待更新像素值。以任一通道为例,在构建线性方程组时,将第三矩阵作为未知数,即可构建Ax=b的线性方程组,其中,A表示第一矩阵,b表示第二矩阵(由于列数为1,因此相当于一个列向量),x表示第三矩阵(同时也是待求解的未知数),接下来在下述步骤511中利用一些方程组求解手段,即可处理得到第三矩阵。
511、终端基于该第一矩阵和该第二矩阵,获取第三矩阵,该第三矩阵用于表示该目标像素点的待更新像素值。
在一些实施例中,终端基于共轭梯度法对该第一矩阵和该第二矩阵进行处理,得到该第三矩阵;或,终端基于最小二乘法对该第一矩阵和该第二矩阵进行处理,得到该第三矩阵; 或,终端基于乔列斯基分解法对该第一矩阵和该第二矩阵进行处理,得到该第三矩阵。
在本申请实施例中,以共轭梯度法求解第三矩阵x为例进行说明,该共轭梯度法是一种将共轭性与最速下降方法相结合的数据处理方式,利用第一矩阵和第二矩阵构建线性方程组之后,在目标像素点在RGB三个通道上的初始像素值的基础上分别进行迭代,即可输出目标像素点在RGB三个通道上的待更新像素值。共轭梯度法对第三矩阵的求解速度较快、数据存储量小,因此能够提升第三矩阵的获取速率。
由于共轭梯度法求解Ax=b方程组时,需要保证第一矩阵A是一个正定矩阵,在此示出证明第一矩阵A为正定矩阵的过程:将Ax=b等价变换为A TAx=A Tb,其中A T表示第一矩阵A的转置矩阵。由于(BA) T=A TB T,这里令B=A T代入上式,得到(A TA) T=A TA,符合矩阵对称的定义,因此A TA为对称矩阵,而由于第一矩阵A中的系数都是正小数,因此第一矩阵A是正定矩阵,第一矩阵A的转置矩阵A T也是正定矩阵,且二者相乘所得的矩阵A TA也是正定矩阵,也即A TA为对称正定矩阵。
在保证第一矩阵A为正定矩阵的基础上,即可采用共轭梯度法求解任一通道的线性方程组Ax=b,由于一组接缝边的采样数量可以表示为SampleCount,那么所有接缝边的采样数量r0=ΣSampleCountForEverySeamPair,由于在上述步骤202中目标像素点的像素信息都被记录在SeamTexels中,那么目标像素点的数量r1=Count(SeamTexels),换言之,r1为SeamTexels内的元素数量。
可选地,第一矩阵A的前r0行中每行只有8个元素是非零小数,其他元素均为0,并且由于第一矩阵A的列数n一般都较大,可见第一矩阵A中零元素的数量远大于非零元素的数量,也即第一矩阵A中非零元素占全部元素的数值比例小于比例阈值,第一矩阵A属于稀疏矩阵。而每行包含8个非零元素是由于对光照贴图通常采用双线性差值法来确定一个采样点的像素信息,例如,目标三维模型的接缝边中的一个位置点,在光照贴图中被展开成了一对目标像素点,即该接缝边中的一个位置点对应于该光照贴图中的一对目标像素点,在像素值修复过程中,需要将这一对目标像素点中的每个目标像素点都作为采样点,假设对每个采样点都采样四个邻域点(邻域点是指该采样点周围的像素点),那么对每对目标像素点能够采样得到一组共八个邻域点,并基于这八个邻域点的像素位置信息和光照颜色信息,计算出8个非零系数。例如,需要对一个采样点周围的四个像素点a0~a3(即邻域点a0~a3)分别进行插值,由于接缝边需要对分布于接缝两侧的有向边和反向边的数据分别进行插值,因此需要考虑到接缝边对应一侧的采样点周围的四个像素点b0~b3(即邻域点b0~b3),因此每一行内包含8个非零系数:a0~a3及b0~b3。非零系数a0~a3及b0~b3的获取方式与上述步骤304类似,这里不做赘述。重复执行上述过程,可以基于双线性插值法构造出第一矩阵A的前r0行内的各个非零系数,并将其余的系数均采用0进行填充。
可选地,对于第一矩阵A的后r1行,可以采用一个λ为系数的矩阵,每一行中只有采样点自身所在列取值为λ,其余项皆为0,其中λ是由渲染引擎的编辑器所传入的一个位于[0,1]区间的小数(即烘焙结果系数),可由技术人员进行自定义设置,也可以采用默认值,例如默认值为0.5。
在上述过程中,基于双线性插值确定了第一矩阵A的矩阵系数,能够方便快捷地构造出第一矩阵A,在一些实施例中,还可以采用双三次插值等方式来确定第一矩阵A的矩阵系数,这样能够提升采样精度。
在一些实施例中,第二矩阵b是一个行数为m的列向量,可选地,在第二矩阵b中前r0 行中的b值均取0,后r1行中b的值为光照贴图中原有像素的数值(也即目标像素点的初始像素值),由于在光照贴图中通常会按照RGB三个通道,分别记录下来每个目标像素点的在三个通道各自的初始像素值,因此可以构建出三个通道各自的三个第二矩阵b,从而可以构建出三组Ax=b形式的线性方程组。
以任一通道的线性方程组Ax=b为例,在基于第一矩阵A和第二矩阵b获取第三矩阵x的过程中,终端先将Ax=b转换成A TAx=A Tb形式,再基于共轭梯度法确定第三矩阵x,也即对目标像素点在该通道上的初始像素值进行迭代求解,最终输出目标像素点在该通道上的待更新像素值,对其他通道也可执行类似操作,最终能够得到目标像素点分别在RGB三个通道上的待更新像素值,这里不做赘述。
共轭梯度法的循环逻辑与上述步骤304类似,这里不做赘述。
在上述过程中,以共轭梯度法为例示出了基于第一矩阵A和第二矩阵b来获取第三矩阵x的过程,能够在自动识别出接缝边之后,自动修复接缝边上存在的接缝问题,避免了技术人员在触发光照渲染指令之后,还需要人工反复排查修复lightmap中的接缝问题,使得技术人员能够专心将精力投入到开发设计工作中,大大节约了图像渲染中用于修复接缝问题的人力资源,大大提升了图像渲染效率。
在一些实施例中,终端也可以基于最小二乘法对该第一矩阵A和该第二矩阵b进行处理,得到该第三矩阵x,能够降低获取第三矩阵x过程的计算量、提升计算效率,或者,终端基于乔列斯基(Cholesky)分解法对该第一矩阵A和该第二矩阵b进行处理,得到该第三矩阵x,能够提升获取第三矩阵x过程的计算精度。
512、终端基于该第三矩阵,将该目标像素点从该初始像素值更新为该待更新像素值,得到该修复后的光照贴图。
在上述过程中,终端从第三矩阵中能够读取到各个目标像素点的待更新像素值,接着在光照贴图中,根据各个目标像素点的像素坐标定位到各个目标像素点所在的位置,接着在定位到各个目标像素点所在的位置上,将已有的初始像素值更新为第三矩阵所提供的待更新像素值,在替换完毕后输出修复后的光照贴图。
在上述步骤510-512中,终端在该光照贴图中对该目标像素点的初始像素值进行更新,得到修复后的光照贴图,其中该修复后的光照贴图中该接缝边对应的像素点以及邻域点的纹理连续,换言之,该修复后的光照贴图中的纹理是连续的。上述步骤中,是对已经渲染后的光照贴图进行像素值更新,基于双线性插值对原本纹理不平滑的接缝边进行平滑处理,通过求解构造的线性方程组计算出待更新像素值,对目标像素点的初始像素值进行更新,最终输出修复了接缝问题的光照贴图,这样能够使得接缝问题的识别和修复在光照渲染阶段一键完成,无需技术人员进行人工排查。
上述所有可选技术方案,能够采用任意结合形成本公开的可选实施例,在此不再一一赘述。
本申请实施例提供的方法,通过自动识别出目标三维模型的接缝边,接着自动在目标三维模型的光照贴图中定位到待修复的目标像素点,这些目标像素点也即是接缝边上出现纹理不连续的边线所对应的像素点,从而自动对目标像素点的像素值进行更新,最终输出修复后的光照贴图,使得能够一键完成接缝问题的自动识别和自动修复,大大降低了图像渲染过程中用于排查并修复接缝问题的人力资源,从而降低了图像渲染耗时、提升了图像渲染效率。
图6是本申请实施例提供的一种图像渲染方法的原理性流程图,请参考图6,该方法包括:
在步骤601中,终端接收物体的lightmap渲染任务。
在步骤602中,终端使用路径跟踪算法渲染出lightmap的每个像素点。
在步骤603中,终端查找该物体的UV接缝边。
在步骤604中,终端遍历物体的每个面。
在步骤605中,终端遍历当前面上的每个顶点。
在步骤606中,终端查找当前顶点与下一顶点所构成的有向边的反向边。
在步骤607中,终端判断是否查找到反向边,如果查找到反向边,执行步骤608,否则,如果查找不到反向边,返回步骤605。
在步骤608中,终端判断辅助边与反向边的UV值和法线值是否一致,如果UV值和法线值一致,执行步骤609,否则,如果UV值和法线值不一致,返回步骤605。
在步骤609中,终端记录产生接缝的一组有向边。
在步骤610中,终端判断当前顶点是否为当前面的最后一个顶点,如果当前顶点是当前面的最后一个顶点,执行步骤611,否则,如果当前顶点不是当前面的最后一个顶点,返回步骤605。
在步骤611中,终端判断当前面是否为物体的最后一个面,如果当前面是物体的最后一个面,执行步骤612,如果当前面不是物体的最后一个面,返回步骤604。
在步骤612中,终端根据接缝列表查找出要修复的像素点(也即目标像素点)。
在步骤613中,终端根据接缝处像素构建线性方程组。
在步骤614中,终端使用共轭梯度法解线性方程组。
在步骤615中,终端使用方程组的解更新lightmap光照贴图。
在步骤616中,终端完成接缝修复,向前端的编辑器回传烘焙参数。
在本申请实施例中,在渲染lightmap光照贴图之后,在上述步骤603-611中实现了自动UV接缝检测功能,能够自动排查到光照贴图中存在的接缝边,大大避免了人工排查的耗时,提升了识别接缝边的效率,且节约了人力资源,在上述步骤612-616中实现了自动UV接缝修复功能,能够对识别出的UV接缝边进行自动修复,修复方式是分别求解RGB三个通道下的三组线性方程组,可以利用共轭梯度法、最小二乘法、Cholesky分解法等方式获取待更新像素值,并对光照贴图中已有像素值进行替换,即可实现一键自动化的接缝问题识别与修复。
图7是本申请实施例提供的一种渲染引擎的操作界面示意图,请参考图7,示出了一种渲染引擎的操作界面700,在操作界面700中提供了烘焙启动按钮701,例如,该烘焙启动按钮为“Dawn”,用户在触发烘焙启动按钮701之后,终端接收光照渲染指令,对渲染引擎内导入的目标三维模型进行离线全局光照渲染,在操作界面700中,还提供接缝修复开关702和烘焙参数设置区域703,用户可以通过接缝修复开关702来控制是否需要启用UV接缝自动修复功能,如果开启了UV接缝自动修复功能,还可以在烘焙参数设置区域703中设置一系列修复需要用到的参数,比如样本数量(Num Samples)、λ(Lambda,第一矩阵A的后r1行的烘焙结果系数)、角度阈值(Cos Normal Threshold,用于判断辅助边与反向边是否共边),在一个示例中,Num Samples=1,λ=0.1,Cos Normal Threshold=0.5。需要说明的是,终端在渲染lightmap时需要设置每个物体的光照贴图分辨率,提供物体的每个顶点在光照贴图中的UV信息,在世界坐标系中的法线和切线信息等。用户在触发烘焙启动按钮701后, 渲染引擎会将每个物体的烘焙任务发送给烘焙器,烘焙任务中包括烘焙物体的详细网格信息(顶点、法线,三角面,光照贴图uv坐标等),烘焙器根据烘焙任务进行光照渲染。
在一个示例性场景中,以游戏场景数据的离线渲染为例,目前游戏开发中越来越多是大场景大世界开发,基本上虚拟场景中物体的数量都是上万个,其中,一个物体对应于一个目标三维模型。如果使用ue4(虚幻4)这种专业渲染引擎去执行光照贴图的渲染任务,至少也需要若干个小时以上。而如果渲染出来的lightmap存在接缝问题,需要由技术人员人工排查后进行场景数据的调整,然后重新进行烘焙,不仅人工排查过程需要花费很多人力物力,且大场景下重新烘焙也需要花费大量时间,从而带来了大量的人力成本和时间成本。而基于本申请实施例的图像渲染方法,通过自动UV接缝检测,能够非常方便的自动完成接缝边的检测,并且还能实现自动UV接缝修复,在烘焙过程中就自动帮助技术人员完成接缝问题的修复工作,可以非常高效的完成烘焙任务。
图8是本申请实施例提供的一种图像渲染方法的接缝问题修复前后的对比图,如图8所示,801示出了接缝问题修复前的光照贴图,可以看出,在方框区域803中存在接缝问题,在球体的光滑表面上明显存在纹理不连续的异常情况,而802示出了接缝问题修复后的光照贴图,可以看出,在方框区域804中消除了纹理不连续的异常情况,使得球体的光滑表面上光照过渡也更加平滑,也即是说,802中明显修复了801中原本纹理不连续的接缝问题,改善了光照贴图的视觉效果。在使用了光照贴图的自动接缝识别和接缝修复算法后,用户在进行离线全局渲染时,可以不用手动去修复lightmap中的接缝问题,大大节约了时间成本和人力成本。使得用户可以专心的将精力投入到场景的美术设计上面,有利于高效的完成游戏开发工作。
在一个示例性中,假设一个大世界场景,基本上都会有上万个物体,即使有1%的物体存在接缝问题,那也会产生上百个待人工修复的问题,假设用户1小时能够修复一个问题,那么修复完一个场景总人力的投入也需要100小时,甚至如果场景有了变化需要重新渲染,还得重新花费这100小时的人力投入。而通过本申请实施例的自动UV接缝识别和智能修复方案,每次场景变化后,烘焙的投入相较于传统人工修复方式,至少能够节约100个小时,且随着开发的迭代,节省的时间可能是若干个100小时。
图9是本申请实施例提供的一种图像渲染装置的结构示意图,请参考图9,该装置包括:
第一获取模块901,用于根据光照渲染指令,获取目标三维模型的光照贴图;也即该第一获取模块901,用于响应于光照渲染指令,获取目标三维模型的光照贴图;
第二获取模块902,用于获取该目标三维模型的接缝边,该接缝边为在该目标三维模型中位于同一表面且在该光照贴图中纹理不连续的边线;
第一确定模块903,用于基于该接缝边,确定该光照贴图中的目标像素点;也即该第一确定模块903,用于在该光照贴图中,确定与该接缝边对应的目标像素点;
更新模块904,用于对该目标像素点进行更新,得到修复后的光照贴图,该修复后的光照贴图中该接缝边的纹理连续;也即是说,该更新模块904,用于在该光照贴图中对该目标像素点的初始像素值进行更新,得到修复后的光照贴图,其中,该修复后的光照贴图中的纹理是连续的。
本申请实施例提供的装置,通过自动识别出目标三维模型的接缝边,接着自动在目标三维模型的光照贴图中定位到待修复的目标像素点,这些目标像素点也即是接缝边上出现纹理 不连续的边线所对应的像素点,从而自动对目标像素点的像素值进行更新,最终输出修复后的光照贴图,使得能够一键完成接缝问题的自动识别和自动修复,大大降低了图像渲染过程中用于排查并修复接缝问题的人力资源,从而降低了图像渲染耗时、提升了图像渲染效率。
在一种可能实施方式中,一组接缝边包括一条有向边和该有向边的反向边,该有向边与该反向边之间顶点重合且方向相反;
该第二获取模块902用于:
获取该目标三维模型中至少一个面内的多个顶点;
响应于该多个顶点中至少两个顶点所形成的有向边存在反向边,将该有向边和该反向边确定为一组接缝边。
在一种可能实施方式中,基于图9的装置组成,该装置还包括:
第二确定模块,用于对该多个顶点中任一顶点,基于该顶点与下一顶点确定一条有向边;
第三确定模块,用于确定与该有向边之间顶点重合且方向相反的辅助边;
第四确定模块,用于根据该有向边和该辅助边,确定该有向边是否存在该反向边;也即该第四确定模块,用于在该辅助边为另一有向边的情况下,将该辅助边确定为该有向边的反向边。
在一种可能实施方式中,该第四确定模块用于:
在该目标三维模型的有向边集合中查询到与该辅助边相同的边的情况下,确定该有向边存在反向边,即将该辅助边确定为该有向边的反向边。
在一些可能实施方式中,基于图9的装置组成,该装置还包括添加模块,用于:
在该目标三维模型的有向边集合中查询不到与该辅助边相同的边的情况下,将该有向边添加至该有向边集合。
在一种可能实施方式中,基于图9的装置组成,该第一确定模块903包括:
第一获取单元,用于对任一组接缝边,获取该任一组接缝边的顶点在该光照贴图中对应像素点的像素位置信息;
第一确定单元,用于基于该顶点的像素位置信息,确定该任一组接缝边对应的像素采样数量;
第二确定单元,用于基于该像素位置信息和该像素采样数量,确定该任一组接缝边所对应的目标像素点。
在一种可能实施方式中,该第二确定单元用于:
基于该像素位置信息和该像素采样数量,确定采样过程的迭代步长即像素采样的迭代步长;
以任一顶点对应的像素点为起点,基于该迭代步长进行像素采样;
将基于该迭代步长所确定的采样点作为该目标像素点,也即,将该像素采样中确定的采样点获取为该目标像素点。
在一种可能实施方式中,该第一确定单元用于:
获取该任一组接缝边内的有向边的边长与该有向边的反向边的边长;
将该有向边的边长与该反向边的边长中的最大值与采样质量参数相乘所得的数值,确定为该像素采样数量。
在一种可能实施方式中,基于图9的装置组成,该更新模块904包括:
构建单元,用于基于该目标像素点的像素值,构建第一矩阵和第二矩阵,该第一矩阵用 于表示该目标像素点在一组接缝边内的有向边和反向边上的像素信息,也即该第一矩阵用于表示该目标像素点的邻域点在该光照贴图中的初始像素值以及该目标像素点的烘焙结果系数,该第二矩阵用于表示该目标像素点在该光照贴图中的初始像素值;
第二获取单元,用于基于该第一矩阵和该第二矩阵,获取第三矩阵,该第三矩阵用于表示该目标像素点的待更新像素值;
更新单元,用于基于该第三矩阵,将该目标像素点从该初始像素值更新为该待更新像素值,得到该修复后的光照贴图。
在一种可能实施方式中,该第二获取单元用于:
基于共轭梯度法对该第一矩阵和该第二矩阵进行处理,得到该第三矩阵;或,
基于最小二乘法对该第一矩阵和该第二矩阵进行处理,得到该第三矩阵;或,
基于乔列斯基分解法对该第一矩阵和该第二矩阵进行处理,得到该第三矩阵。
在一种可能实施方式中,该接缝边中的一个位置点对应于该光照贴图中的一对目标像素点,对每对目标像素点采样得到一组邻域点;该第一矩阵的行数为第一目标数量且列数为第二目标数量,其中,该第一目标数量为该接缝边的采样数量与该目标像素点的数量相加所得的数值,也即,该第一目标数量为该邻域点的采样组数与该目标像素点的数量相加所得的数值,该第二目标数量为该目标像素点的数量;该第二矩阵的行数为该第一目标数量且该第二矩阵的列数为一。
上述所有可选技术方案,能够采用任意结合形成本公开的可选实施例,在此不再一一赘述。
需要说明的是:上述实施例提供的图像渲染装置在渲染图像时,仅以上述各功能模块的划分进行举例说明,实际应用中,能够根据需要而将上述功能分配由不同的功能模块完成,即将电子设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的图像渲染装置与图像渲染方法实施例属于同一构思,其具体实现过程详见图像渲染方法实施例,这里不再赘述。
图10是本申请实施例提供的一种电子设备的结构示意图。可选地,以该电子设备为终端为例进行说明,该终端1000的设备类型包括:智能手机、平板电脑、MP3播放器(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、笔记本电脑或台式电脑。终端1000还可能被称为用户设备、便携式终端、膝上型终端、台式终端等其他名称。
通常,终端1000包括有:处理器1001和存储器1002。
可选地,处理器1001包括一个或多个处理核心,比如4核心处理器、8核心处理器等。可选地,处理器1001采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。在一些实施例中,处理器1001包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器1001集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器1001还包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。
在一些实施例中,存储器1002包括一个或多个计算机可读存储介质,可选地,该计算机可读存储介质是非暂态的。可选地,存储器1002还包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器1002中的非暂态的计算机可读存储介质用于存储至少一个程序代码,该至少一个程序代码用于被处理器1001所执行以实现本申请中各个实施例提供的图像渲染方法。
在一些实施例中,终端1000还可选包括有:显示屏1003。
显示屏1003用于显示UI(User Interface,用户界面)。可选地,该UI包括图形、文本、图标、视频及其它们的任意组合。当显示屏1003是触摸显示屏时,显示屏1003还具有采集在显示屏1003的表面或表面上方的触摸信号的能力。该触摸信号能够作为控制信号输入至处理器1001进行处理。可选地,显示屏1003还用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏1003为一个,设置终端1000的前面板;在另一些实施例中,显示屏1003为至少两个,分别设置在终端1000的不同表面或呈折叠设计;在再一些实施例中,显示屏1003是柔性显示屏,设置在终端1000的弯曲表面上或折叠面上。甚至,可选地,显示屏1003设置成非矩形的不规则图形,也即异形屏。可选地,显示屏1003采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-Emitting Diode,有机发光二极管)等材质制备。
本领域技术人员能够理解,图10中示出的结构并不构成对终端1000的限定,能够包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。
在一些实施例中,提供一种电子设备,所述电子设备包括一个或多个处理器和一个或多个存储器,所述一个或多个存储器中存储有至少一条程序代码,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:响应于光照渲染指令,获取目标三维模型的光照贴图;获取所述目标三维模型的接缝边;在所述光照贴图中,确定与所述接缝边对应的目标像素点;在所述光照贴图中对所述目标像素点的初始像素值进行更新,得到修复后的光照贴图,其中,所述修复后的光照贴图中的纹理是连续的。
在一些实施例中,一组接缝边包括一条有向边和所述有向边的反向边,所述有向边与所述反向边之间顶点重合且方向相反;所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:获取所述目标三维模型中至少一个面内的多个顶点;响应于所述多个顶点中至少两个顶点所形成的有向边存在反向边,将所述有向边和所述反向边确定为一组接缝边。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:对所述多个顶点中任一顶点,基于所述顶点与下一顶点确定一条有向边;确定与所述有向边之间顶点重合且方向相反的辅助边;在所述辅助边为另一有向边的情况下,将所述辅助边确定为所述有向边的反向边。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:在所述目标三维模型的有向边集合中查询到与所述辅助边相同的边的情况下,将所述辅助边确定为所述有向边的反向边。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:在所述有向边集合中查询不到与所述辅助边相同的边的情况下,将所述有向边添加至所述有向边集合。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:对任一组所述接缝边,获取所述接缝边的顶点在所述光照贴图中对应像素点的像素位置信息; 基于所述像素位置信息,确定所述接缝边对应的像素采样数量;基于所述像素位置信息和所述像素采样数量,确定所述目标像素点。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:基于所述像素位置信息和所述像素采样数量,确定像素采样的迭代步长;以任一顶点对应的像素点为起点,基于所述迭代步长进行像素采样;将所述像素采样中确定的采样点获取为所述目标像素点。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:获取所述接缝边内的有向边的边长与所述有向边的反向边的边长;将所述有向边的边长与所述反向边的边长中的最大值与采样质量参数相乘所得的数值,确定为所述像素采样数量。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:基于所述目标像素点,构建第一矩阵和第二矩阵,所述第一矩阵用于表示所述目标像素点的邻域点在所述光照贴图中的初始像素值以及所述目标像素点的烘焙结果系数,所述第二矩阵用于表示所述目标像素点在所述光照贴图中的初始像素值;基于所述第一矩阵和所述第二矩阵,获取第三矩阵,所述第三矩阵用于表示所述目标像素点的待更新像素值;基于所述第三矩阵,将所述目标像素点从所述初始像素值更新为所述待更新像素值,得到所述修复后的光照贴图。
在一些实施例中,所述至少一条程序代码由所述一个或多个处理器加载并执行如下操作:基于共轭梯度法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,基于最小二乘法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,基于乔列斯基分解法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵。
在一些实施例中,所述接缝边中的一个位置点对应于所述光照贴图中的一对目标像素点,对每对目标像素点采样得到一组邻域点;所述第一矩阵的行数为第一目标数量且列数为第二目标数量,其中,所述第一目标数量为所述邻域点的采样组数与所述目标像素点的数量相加所得的数值,所述第二目标数量为所述目标像素点的数量;所述第二矩阵的行数为所述第一目标数量且所述第二矩阵的列数为一。
在示例性实施例中,还提供了一种计算机可读存储介质,例如包括至少一条程序代码的存储器,上述至少一条程序代码可由终端中的处理器执行以完成上述实施例中图像渲染方法。例如,该计算机可读存储介质包括ROM(Read-Only Memory,只读存储器)、RAM(Random-Access Memory,随机存取存储器)、CD-ROM(Compact Disc Read-Only Memory,只读光盘)、磁带、软盘和光数据存储设备等。
在一些实施例中,提供一种计算机可读存储介质,所述存储介质中存储有至少一条程序代码,所述至少一条程序代码由处理器加载并执行如下操作:响应于光照渲染指令,获取目标三维模型的光照贴图;获取所述目标三维模型的接缝边;在所述光照贴图中,确定与所述接缝边对应的目标像素点;在所述光照贴图中对所述目标像素点的初始像素值进行更新,得到修复后的光照贴图,其中,所述修复后的光照贴图中的纹理是连续的。
在一些实施例中,一组接缝边包括一条有向边和所述有向边的反向边,所述有向边与所述反向边之间顶点重合且方向相反;所述至少一条程序代码由处理器加载并执行如下操作:获取所述目标三维模型中至少一个面内的多个顶点;响应于所述多个顶点中至少两个顶点所形成的有向边存在反向边,将所述有向边和所述反向边确定为一组接缝边。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:对所述多个顶点中任一顶点,基于所述顶点与下一顶点确定一条有向边;确定与所述有向边之间顶点重合且方向相反的辅助边;在所述辅助边为另一有向边的情况下,将所述辅助边确定为所述有向边的反向边。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:在所述目标三维模型的有向边集合中查询到与所述辅助边相同的边的情况下,将所述辅助边确定为所述有向边的反向边。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:在所述有向边集合中查询不到与所述辅助边相同的边的情况下,将所述有向边添加至所述有向边集合。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:对任一组所述接缝边,获取所述接缝边的顶点在所述光照贴图中对应像素点的像素位置信息;基于所述像素位置信息,确定所述接缝边对应的像素采样数量;基于所述像素位置信息和所述像素采样数量,确定所述目标像素点。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:基于所述像素位置信息和所述像素采样数量,确定像素采样的迭代步长;以任一顶点对应的像素点为起点,基于所述迭代步长进行像素采样;将所述像素采样中确定的采样点获取为所述目标像素点。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:获取所述接缝边内的有向边的边长与所述有向边的反向边的边长;将所述有向边的边长与所述反向边的边长中的最大值与采样质量参数相乘所得的数值,确定为所述像素采样数量。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:基于所述目标像素点,构建第一矩阵和第二矩阵,所述第一矩阵用于表示所述目标像素点的邻域点在所述光照贴图中的初始像素值以及所述目标像素点的烘焙结果系数,所述第二矩阵用于表示所述目标像素点在所述光照贴图中的初始像素值;基于所述第一矩阵和所述第二矩阵,获取第三矩阵,所述第三矩阵用于表示所述目标像素点的待更新像素值;基于所述第三矩阵,将所述目标像素点从所述初始像素值更新为所述待更新像素值,得到所述修复后的光照贴图。
在一些实施例中,所述至少一条程序代码由处理器加载并执行如下操作:基于共轭梯度法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,基于最小二乘法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,基于乔列斯基分解法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵。
在一些实施例中,所述接缝边中的一个位置点对应于所述光照贴图中的一对目标像素点,对每对目标像素点采样得到一组邻域点;所述第一矩阵的行数为第一目标数量且列数为第二目标数量,其中,所述第一目标数量为所述邻域点的采样组数与所述目标像素点的数量相加所得的数值,所述第二目标数量为所述目标像素点的数量;所述第二矩阵的行数为所述第一目标数量且所述第二矩阵的列数为一。
在示例性实施例中,还提供了一种计算机程序产品或计算机程序,包括一条或多条程序代码,该一条或多条程序代码存储在计算机可读存储介质中。电子设备的一个或多个处理器能够从计算机可读存储介质中读取该一条或多条程序代码,该一个或多个处理器执行该一条或多条程序代码,使得电子设备能够执行以完成上述实施例中图像渲染方法。
本领域普通技术人员能够理解实现上述实施例的全部或部分步骤能够通过硬件来完成,也能够通过程序来指令相关的硬件完成,可选地,该程序存储于一种计算机可读存储介质中,可选地,上述提到的存储介质是只读存储器、磁盘或光盘等。
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (14)

  1. 一种图像渲染方法,由电子设备执行,所述方法包括:
    响应于光照渲染指令,获取目标三维模型的光照贴图;
    获取所述目标三维模型的接缝边;
    在所述光照贴图中,确定与所述接缝边对应的目标像素点;
    在所述光照贴图中对所述目标像素点的初始像素值进行更新,得到修复后的光照贴图,其中,所述修复后的光照贴图中的纹理是连续的。
  2. 根据权利要求1所述的方法,其中,一组接缝边包括一条有向边和所述有向边的反向边,所述有向边与所述反向边之间顶点重合且方向相反;
    所述获取所述目标三维模型的接缝边包括:
    获取所述目标三维模型中至少一个面内的多个顶点;
    响应于所述多个顶点中至少两个顶点所形成的有向边存在反向边,将所述有向边和所述反向边确定为一组接缝边。
  3. 根据权利要求2所述的方法,其中,所述响应于所述多个顶点中至少两个顶点所形成的有向边存在反向边,将所述有向边和所述反向边确定为一组接缝边之前,所述方法还包括:
    对所述多个顶点中任一顶点,基于所述顶点与下一顶点确定一条有向边;
    确定与所述有向边之间顶点重合且方向相反的辅助边;
    在所述辅助边为另一有向边的情况下,将所述辅助边确定为所述有向边的反向边。
  4. 根据权利要求3所述的方法,其中,所述在所述辅助边为另一有向边的情况下,确定所述辅助边为所述有向边的反向边包括:
    在所述目标三维模型的有向边集合中查询到与所述辅助边相同的边的情况下,将所述辅助边确定为所述有向边的反向边。
  5. 根据权利要求4所述的方法,其中,所述方法还包括:
    在所述有向边集合中查询不到与所述辅助边相同的边的情况下,将所述有向边添加至所述有向边集合。
  6. 根据权利要求1所述的方法,其中,所述在所述光照贴图中,确定与所述接缝边对应的目标像素点包括:
    对任一组所述接缝边,获取所述接缝边的顶点在所述光照贴图中对应像素点的像素位置信息;
    基于所述像素位置信息,确定所述接缝边对应的像素采样数量;
    基于所述像素位置信息和所述像素采样数量,确定所述目标像素点。
  7. 根据权利要求6所述的方法,其中,所述基于所述像素位置信息和所述像素采样数量,确定所述目标像素点包括:
    基于所述像素位置信息和所述像素采样数量,确定像素采样的迭代步长;
    以任一顶点对应的像素点为起点,基于所述迭代步长进行像素采样;
    将所述像素采样中确定的采样点获取为所述目标像素点。
  8. 根据权利要求6所述的方法,其中,所述基于所述像素位置信息,确定所述接缝边对应的像素采样数量包括:
    获取所述接缝边内的有向边的边长与所述有向边的反向边的边长;
    将所述有向边的边长与所述反向边的边长中的最大值与采样质量参数相乘所得的数值,确定为所述像素采样数量。
  9. 根据权利要求1所述的方法,其中,所述在所述光照贴图中对所述目标像素点的初始像素值进行更新,得到修复后的光照贴图包括:
    基于所述目标像素点,构建第一矩阵和第二矩阵,所述第一矩阵用于表示所述目标像素点的邻域点在所述光照贴图中的初始像素值以及所述目标像素点的烘焙结果系数,所述第二矩阵用于表示所述目标像素点在所述光照贴图中的初始像素值;
    基于所述第一矩阵和所述第二矩阵,获取第三矩阵,所述第三矩阵用于表示所述目标像素点的待更新像素值;
    基于所述第三矩阵,将所述目标像素点从所述初始像素值更新为所述待更新像素值,得到所述修复后的光照贴图。
  10. 根据权利要求9所述的方法,其中,所述基于所述第一矩阵和所述第二矩阵,获取第三矩阵包括:
    基于共轭梯度法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,
    基于最小二乘法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵;或,
    基于乔列斯基分解法对所述第一矩阵和所述第二矩阵进行处理,得到所述第三矩阵。
  11. 根据权利要求9所述的方法,其中,所述接缝边中的一个位置点对应于所述光照贴图中的一对目标像素点,对每对目标像素点采样得到一组邻域点;
    所述第一矩阵的行数为第一目标数量且列数为第二目标数量,其中,所述第一目标数量为所述邻域点的采样组数与所述目标像素点的数量相加所得的数值,所述第二目标数量为所述目标像素点的数量;
    所述第二矩阵的行数为所述第一目标数量且所述第二矩阵的列数为一。
  12. 一种图像渲染装置,所述装置包括:
    第一获取模块,用于响应于光照渲染指令,获取目标三维模型的光照贴图;
    第二获取模块,用于获取所述目标三维模型的接缝边;
    第一确定模块,用于在所述光照贴图中,确定与所述接缝边对应的目标像素点;
    更新模块,用于在所述光照贴图中对所述目标像素点的初始像素值进行更新,得到修复后的光照贴图,其中,所述修复后的光照贴图中的纹理是连续的。
  13. 一种电子设备,所述电子设备包括一个或多个处理器和一个或多个存储器,所述一个或多个存储器中存储有至少一条程序代码,所述至少一条程序代码由所述一个或多个处理器加载并执行以实现如权利要求1至权利要求11任一项所述的图像渲染方法。
  14. 一种计算机可读存储介质,所述存储介质中存储有至少一条程序代码,所述至少一条程序代码由处理器加载并执行以实现如权利要求1至权利要求11任一项所述的图像渲染方法。
PCT/CN2021/113716 2020-08-27 2021-08-20 图像渲染方法、装置、电子设备及存储介质 Ceased WO2022042436A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21860273.8A EP4120199B1 (en) 2020-08-27 2021-08-20 Image rendering method and apparatus, and electronic device and storage medium
US17/891,485 US12266045B2 (en) 2020-08-27 2022-08-19 Lightmap updating method and apparatus, electronic device, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010878803.2A CN111932664B (zh) 2020-08-27 2020-08-27 图像渲染方法、装置、电子设备及存储介质
CN202010878803.2 2020-08-27

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/891,485 Continuation US12266045B2 (en) 2020-08-27 2022-08-19 Lightmap updating method and apparatus, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
WO2022042436A1 true WO2022042436A1 (zh) 2022-03-03

Family

ID=73308375

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/113716 Ceased WO2022042436A1 (zh) 2020-08-27 2021-08-20 图像渲染方法、装置、电子设备及存储介质

Country Status (4)

Country Link
US (1) US12266045B2 (zh)
EP (1) EP4120199B1 (zh)
CN (1) CN111932664B (zh)
WO (1) WO2022042436A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116051681A (zh) * 2023-03-02 2023-05-02 深圳市光速时代科技有限公司 一种基于智能手表生成图像数据的处理方法及系统

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111932664B (zh) 2020-08-27 2023-06-23 腾讯科技(深圳)有限公司 图像渲染方法、装置、电子设备及存储介质
CN112669428B (zh) * 2021-01-06 2024-06-25 南京亚派软件技术有限公司 一种基于服务器和客户端协作的bim模型渲染方法
CN113298925B (zh) * 2021-04-14 2023-07-11 江苏理工学院 一种基于光线路径复用的动态场景渲染加速方法
CN113262480B (zh) * 2021-05-13 2024-06-21 网易(杭州)网络有限公司 三维场景的烘焙方法和装置
CN113628328B (zh) * 2021-08-12 2024-05-10 深圳须弥云图空间科技有限公司 一种针对拼缝构件的模型渲染方法及装置
CN113744379B (zh) * 2021-08-25 2024-08-13 北京字节跳动网络技术有限公司 图像生成方法、装置和电子设备
CN113706583B (zh) 2021-09-01 2024-03-22 上海联影医疗科技股份有限公司 图像处理方法、装置、计算机设备和存储介质
US12254556B2 (en) * 2021-09-02 2025-03-18 Nvidia Corporation Techniques for rendering signed distance functions
CN114066721B (zh) * 2021-11-03 2024-02-02 抖音视界有限公司 显示方法、装置和电子设备
CN116843811A (zh) * 2022-03-23 2023-10-03 腾讯科技(成都)有限公司 三维模型渲染方法、装置、设备及存储介质
CN117689583A (zh) * 2022-08-31 2024-03-12 完美世界(重庆)互动科技有限公司 三维模型修复方法及设备
CN115330640B (zh) * 2022-10-11 2023-01-10 腾讯科技(深圳)有限公司 光照贴图降噪方法、装置、设备和介质
CN116228935A (zh) * 2023-02-15 2023-06-06 深圳证券时报社有限公司 全局光渲染的方法、装置、设备及存储介质
CN116091365B (zh) * 2023-04-07 2023-06-20 深圳开鸿数字产业发展有限公司 基于三角面的三维模型缺口修复方法、装置、设备及介质
CN119091077A (zh) * 2023-05-30 2024-12-06 腾讯科技(深圳)有限公司 模型接缝修复方法、装置、设备和介质
CN118333869B (zh) * 2024-06-13 2024-09-06 瑞旦微电子技术(上海)有限公司 一种基于矩形块的数据处理方法及显示装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103345771A (zh) * 2013-06-28 2013-10-09 中国科学技术大学 一种基于建模的图像高效渲染方法
CN109427083A (zh) * 2017-08-17 2019-03-05 腾讯科技(深圳)有限公司 三维虚拟形象的显示方法、装置、终端及存储介质
CN111311723A (zh) * 2020-01-22 2020-06-19 腾讯科技(深圳)有限公司 像素点识别及光照渲染方法、装置、电子设备和存储介质
CN111932664A (zh) * 2020-08-27 2020-11-13 腾讯科技(深圳)有限公司 图像渲染方法、装置、电子设备及存储介质

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6753875B2 (en) * 2001-08-03 2004-06-22 Hewlett-Packard Development Company, L.P. System and method for rendering a texture map utilizing an illumination modulation value
CN1267860C (zh) * 2003-01-23 2006-08-02 财团法人工业技术研究院 三维影像接合处的色彩处理方法
US7006090B2 (en) * 2003-02-07 2006-02-28 Crytek Gmbh Method and computer program product for lighting a computer graphics image and a computer
JP4282587B2 (ja) * 2004-11-16 2009-06-24 株式会社東芝 テクスチャ・マッピング装置
JP5711289B2 (ja) * 2013-03-29 2015-04-30 株式会社スクウェア・エニックス 予測方法、生成方法、及び記録媒体
US9396585B2 (en) * 2013-12-31 2016-07-19 Nvidia Corporation Generating indirection maps for texture space effects
US20150187126A1 (en) * 2013-12-31 2015-07-02 Nvidia Corporation Using indirection maps for rendering texture space effects
JP2015228186A (ja) * 2014-06-02 2015-12-17 株式会社ソニー・コンピュータエンタテインメント 画像処理装置および画像処理方法
US10467820B2 (en) * 2018-01-24 2019-11-05 Google Llc Image style transfer for three-dimensional models
US11694392B2 (en) * 2018-05-22 2023-07-04 Apple Inc. Environment synthesis for lighting an object
CN109767484B (zh) * 2018-12-06 2022-09-23 武汉天际航信息科技股份有限公司 一种三维贴图中具有色彩一致性的匀光匀色方法及系统
CN109993823B (zh) * 2019-04-11 2022-11-25 腾讯科技(深圳)有限公司 阴影渲染方法、装置、终端及存储介质
CN109903385A (zh) * 2019-04-29 2019-06-18 网易(杭州)网络有限公司 三维模型的渲染方法、装置、处理器及终端
CN111068310B (zh) * 2019-11-21 2021-05-11 珠海剑心互动娱乐有限公司 一种实现游戏地图无缝加载的方法及系统
CN111243071A (zh) * 2020-01-08 2020-06-05 叠境数字科技(上海)有限公司 实时三维人体重建的纹理渲染方法、系统、芯片、设备和介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103345771A (zh) * 2013-06-28 2013-10-09 中国科学技术大学 一种基于建模的图像高效渲染方法
CN109427083A (zh) * 2017-08-17 2019-03-05 腾讯科技(深圳)有限公司 三维虚拟形象的显示方法、装置、终端及存储介质
CN111311723A (zh) * 2020-01-22 2020-06-19 腾讯科技(深圳)有限公司 像素点识别及光照渲染方法、装置、电子设备和存储介质
CN111932664A (zh) * 2020-08-27 2020-11-13 腾讯科技(深圳)有限公司 图像渲染方法、装置、电子设备及存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4120199A4

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116051681A (zh) * 2023-03-02 2023-05-02 深圳市光速时代科技有限公司 一种基于智能手表生成图像数据的处理方法及系统

Also Published As

Publication number Publication date
EP4120199B1 (en) 2026-01-28
US20220392144A1 (en) 2022-12-08
EP4120199C0 (en) 2026-01-28
CN111932664A (zh) 2020-11-13
EP4120199A1 (en) 2023-01-18
EP4120199A4 (en) 2023-06-14
US12266045B2 (en) 2025-04-01
CN111932664B (zh) 2023-06-23

Similar Documents

Publication Publication Date Title
EP4120199B1 (en) Image rendering method and apparatus, and electronic device and storage medium
US12272002B2 (en) Method and apparatus for generating virtual character, electronic device and readable storage medium
US12347016B2 (en) Image rendering method and apparatus, device, medium, and computer program product
CN110084874B (zh) 对于三维模型的图像风格迁移
US8665267B2 (en) System and method for generating 3D surface patches from unconstrained 3D curves
JP2020531980A (ja) 照明をシミュレートするレンダリング方法及び端末
US20170358132A1 (en) System And Method For Tessellation In An Improved Graphics Pipeline
CN114119853B (zh) 图像渲染方法、装置、设备和介质
CN113781653B (zh) 对象模型生成方法、装置、电子设备及存储介质
CN112734900B (zh) 阴影贴图的烘焙方法、装置、设备及计算机可读存储介质
CN107464286B (zh) 三维城市模型中的孔洞修复方法及装置、设备及可读介质
CN109448123B (zh) 模型的控制方法及装置、存储介质、电子设备
CN114998504A (zh) 二维图像光照渲染方法、装置、系统和电子装置
WO2025050831A1 (zh) 建筑群渲染方法、装置、计算机设备和存储介质
WO2024183288A1 (zh) 阴影渲染方法、装置、计算机设备和存储介质
CN115908687A (zh) 渲染网络的训练、渲染方法、装置及电子设备
US9582247B1 (en) Preserving data correlation in asynchronous collaborative authoring systems
CN120345001A (zh) 包围体层次结构叶节点压缩
CN112396680A (zh) 毛发流向图的制作方法及装置、存储介质、计算机设备
CN114241378A (zh) 生成转场视频的方法、装置、电子设备、存储介质
CN114820968B (zh) 三维可视化方法和装置、机器人、电子设备和存储介质
WO2023184139A1 (en) Methods and systems for rendering three-dimensional scenes
CN117635803A (zh) 着色模型的参数配置方法、装置、计算机设备及存储介质
CN116934950A (zh) 皮肤渲染方法及装置、计算机存储介质、电子设备
CN115761087A (zh) 模型渲染方法、装置和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21860273

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021860273

Country of ref document: EP

Effective date: 20221014

NENP Non-entry into the national phase

Ref country code: DE

WWG Wipo information: grant in national office

Ref document number: 2021860273

Country of ref document: EP