Anti-aliasing rendering method and device, electronic equipment, storage medium
By acquiring and processing AO and vertex color information during the target model rendering process, and distinguishing the light intensity in the gap area, the problem of jagged edges in game rendering is solved, achieving a highly efficient anti-aliasing effect that is suitable for various terminal devices and cloud gaming systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-12-06
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, aliasing is difficult to eliminate effectively in game rendering, especially in the case of moving objects and complex environments. Inter-frame anti-aliasing technology is computationally complex and consumes a lot of performance.
By acquiring the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model, the vertex color information of the gap region and other regions is distinguished, the target AO information is obtained, and the target model is rendered based on the target AO information to reduce the indirect light intensity in the gap region.
It effectively eliminates aliasing with simple calculations, reduces performance consumption during the anti-aliasing process, and is suitable for various terminal devices and cloud gaming systems.
Smart Images

Figure CN115738255B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to anti-aliasing rendering methods and apparatus, electronic devices, and storage media. Background Technology
[0002] In game rendering, jagged edges arise because the scene is defined as continuous in three-dimensional space, while the final displayed pixels are a discrete two-dimensional array. Therefore, determining whether a point is covered by a certain pixel is simply a "yes" or "no" question, losing information about continuity and resulting in jagged edges.
[0003] Current anti-aliasing solutions typically optimize the effect through post-processing, softening the jagged edges and increasing the transition to reduce the jaggedness, which consumes a lot of performance.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] In view of the above problems, this application is made to provide an anti-aliasing rendering method, apparatus, electronic device, and storage medium that overcomes or at least partially solves the above problems, including:
[0006] An anti-aliasing rendering method, the method comprising:
[0007] The original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model are obtained. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions.
[0008] The original AO information is processed according to the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information.
[0009] The target model is rendered based on the target AO information of each pixel.
[0010] An anti-aliasing rendering apparatus, the apparatus comprising:
[0011] The information acquisition module is used to acquire the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions.
[0012] The information processing module is used to process the corresponding original AO information according to the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information.
[0013] The model rendering module is used to render the target model based on the target AO information of each pixel.
[0014] An electronic device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the anti-aliasing rendering method as described above.
[0015] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the anti-aliasing rendering method as described above.
[0016] This application has the following advantages:
[0017] In this embodiment, the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model are obtained. The vertex color information of the pixels corresponding to the gap regions of the target model differs from the vertex color information of pixels corresponding to other regions. The original AO information is processed based on the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixels corresponding to the gap regions of the target model is less than the value of the original AO information. The target model is then rendered based on the target AO information of each pixel. In this embodiment, the vertex color information of the pixels corresponding to the gap regions of the target model differs from the vertex color information of pixels corresponding to other regions. Processing the original AO information based on the vertex color information yields the target AO information. The value of the target AO information of the pixels corresponding to the gap regions is less than the value of the corresponding original AO information, which weakens the indirect light intensity of the gaps, achieving an anti-aliasing effect. This embodiment only requires simple calculations to achieve the anti-aliasing effect, thus reducing performance consumption during the anti-aliasing process. Attached Figure Description
[0018] To more clearly illustrate the technical solution of this application, the drawings used in the description of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of a line segment without anti-aliasing.
[0020] Figure 2 This is a schematic diagram of distributed sampling in existing anti-aliasing techniques;
[0021] Figure 3 This is a diagram illustrating the occlusion problem between pixels in adjacent frames.
[0022] Figure 4 This is a schematic diagram of the processing flow of existing anti-aliasing technology;
[0023] Figure 5 This is a flowchart illustrating the steps of an anti-aliasing rendering method according to an embodiment of this application;
[0024] Figure 6 This is a schematic diagram illustrating the anti-aliasing effect achieved by an anti-aliasing rendering method according to an embodiment of this application;
[0025] Figure 7 This is a schematic diagram illustrating the anti-aliasing effect achieved by an anti-aliasing rendering method according to another embodiment of this application;
[0026] Figure 8 This is a structural block diagram of an anti-aliasing rendering device according to an embodiment of this application;
[0027] Figure 9 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0028] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0029] In computer graphics, rendering refers to the process of projecting a 3D scene's object model into a 2D digital image according to predefined environment, materials, lighting, and rendering parameters. In other words, it's the process of converting 3D light energy transfer into a 2D image. Representing scenes and entities in 3D is closer to the real world and facilitates manipulation and transformation.
[0030] The jagged edges refer to the jagged or uneven edges that appear on the edges of images displayed on a monitor, such as... Figure 1 As shown, Figure 1 The lines in the middle are uneven on both sides, with obvious jagged edges.
[0031] Jagged edges can affect the display effect of images. To eliminate the jaggedness, current technologies generally optimize the effect through post-processing, softening the jagged edges and increasing the transition to weaken the jaggedness.
[0032] Specifically, existing technologies generally use TAA (Temporal Anti-Aliasing) to achieve anti-aliasing effects. TAA, also known as inter-frame anti-aliasing, achieves anti-aliasing by weighted mixing of multiple adjacent frames. Theoretically, this means distributing the computational load across multiple frames of supersampling.
[0033] The core idea of inter-frame anti-aliasing technology is to distribute the computational load across multiple frames, such as... Figure 2 As shown, only one pixel is calculated in any given frame. With the accumulation of t frames, there are t sampled pixels. Mixing the results is equivalent to oversampling t sub-pixels. Of course, pixels in each frame need to undergo some dithering; otherwise, pixel values at the same position in different frames would be exactly the same, negating the purpose of spreading the oversampling across multiple frames. By spreading the oversampling across multiple frames, sampling efficiency is improved, thus mitigating aliasing.
[0034] The inventors discovered that although amortized oversampling distributed the computation across different frames, storing multiple frames was impractical. Therefore, they devised a method to mix only two adjacent frames, denoted as the current frame and the historical frame for easy differentiation. If the pixel value of the current frame is s... t (p), the historical frame pixels of the previous t-1 frame are f t-1 (π t-1 (p)) By weighting and mixing them, we can obtain the result of multi-frame oversampling, as shown in equation (1). This method is called exponential smoothing filter, where α is a weighting value called the exponential smoothing coefficient, which can be a fixed value or an adaptive value.
[0035] f t (p)=(α) s t (p)+(1-α) f t-1 (π t-1 (p)) Equation (1)
[0036] In practical applications, the scene is not completely static; the camera and the model are moving. For example, a pixel on the model in the current frame might be located at (100, 520), but its corresponding position in a previous frame might be (99, 530). Therefore, it's necessary to calculate the position of the current frame pixel in the previous frame; this process is called reprojection. If only the camera is moving, the position in the previous frame can be calculated using the camera's transformation matrix. However, if the model itself is also moving, it's necessary to calculate the difference between the positions of the model's vertices in the current and previous frames. This difference is called the motion vector, and the motion vectors of moving models within the scene can be stored in a buffer called the velocity buffer. Reprojection, based on the view projection matrix of the current frame and the velocity buffer, calculates the position p of the current frame pixel on the screen and its corresponding position π in the previous frame. t-1 (p) process.
[0037] At this point, the position of the current frame pixel within the historical frames has been obtained, and the historical frame pixel value f can be sampled from the historical frames. t-1 (π t-1 (p) However, due to pixel jitter, model movement, and changes in the rendering environment (such as lighting conditions) during each frame rendering, the rendering result may change, and the historical frame pixels obtained at this time may not be reliable. For example Figure 3 As shown, the pixel at position p in the current frame has its corresponding pixel in the historical frame occluded, so the historical frame pixel obtained by reprojection cannot correspond to the current frame pixel. Therefore, a stage is needed to verify and correct the historical frame pixel value, and then substitute it into equation (1) to calculate the final result. Conversely, if the historical frame pixel is not corrected, ghosting may occur.
[0038] The process of inter-frame anti-aliasing technology is as follows: Figure 4 As shown. Shake the camera and render the scene to the main buffer; if the model moves, the motion vector of the rendered moving model needs to be stored in the velocity buffer. In the post-processing process of a TAA, the position of the current frame pixel in the historical frame is obtained by reprojection, the historical frame pixels are obtained, the historical frame pixels are verified and corrected, the historical frame pixels and the current frame pixels are weighted and mixed according to equation (1), and the result is output.
[0039] It is evident that the calculation process of inter-frame anti-aliasing technology is relatively complex, and it has flaws in handling moving objects. It requires further calculation of pixel offset vectors and storage in the cache for further correction. The computational load is large, the performance consumption is high, the requirements for the running device are high, the applicable scope is small, and it is even more difficult to run on mobile terminals.
[0040] In view of this, this application provides an anti-aliasing rendering method. The vertex color information of the edge region of the target model is pre-set to 0. During the rendering of the target model, the vertex color information of each pixel of the target model is used to process the corresponding original shielding light occlusion (AO) information to obtain the target AO information of each pixel. Then, the target model is rendered based on the target AO information to reduce the indirect light intensity at the gaps of the target model, thereby achieving an anti-aliasing effect on the rendered target model image. The method is simple to calculate and has low performance consumption.
[0041] Reference Figure 5 This document illustrates a flowchart of an anti-aliasing rendering method according to an embodiment of this application. This anti-aliasing rendering method can run on a local terminal device or a server. The local terminal device may include, but is not limited to, smartphones, desktop computers, tablets, laptops, in-vehicle central control systems, and other electronic devices. The server can be used to provide background services for the local terminal device. The server can be a standalone server, a distributed server, or a server cluster composed of multiple servers. When the information processing method runs on the server, it can be implemented and executed based on a cloud interaction system, which includes a server and client devices.
[0042] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separated. The storage and execution of anti-aliasing rendering are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a first terminal device, television, computer, or PDA; however, the anti-aliasing rendering is performed on the cloud gaming server. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.
[0043] In an optional implementation, taking a game as an example, the local terminal device stores a game program and uses it to display game visuals. The local terminal device is used to interact with the player through a graphical user interface (GUI), that is, to run the game program conventionally via an electronic device. This game program can be a downloadable and installable program, or it can be an instant-play program. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen, or providing it to the player through holographic projection. For example, the local terminal device can include a display screen and a processor. The display screen is used to display the GUI, which includes game visuals, and the processor is used to run the game, generate the GUI, and control the display of the GUI on the display screen.
[0044] In this embodiment of the application, the method may include the following steps:
[0045] Step 501: Obtain the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions.
[0046] Step 502: Process the corresponding original AO information according to the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information.
[0047] Step 503: Render the target model based on the target AO information of each pixel.
[0048] This embodiment of the application obtains the original AO information and vertex color information of each pixel during the rendering process of the target model. The vertex color information of the pixels corresponding to the gap region of the target model differs from the vertex color information of pixels corresponding to other regions. The original AO information is processed based on the vertex color information to obtain the target AO information. The value of the target AO information of the pixels corresponding to the gap region of the target model is less than the value of the corresponding original AO information. The target model is then rendered based on the target AO information. This embodiment of the application distinguishes and sets the vertex colors of the gap region of the target model from those of other regions, and then processes the original AO information based on the vertex color information of each pixel during the rendering process to obtain the target AO information. The target AO information of the pixels corresponding to the gap region is less than the corresponding original AO information, which can weaken the indirect light intensity of the gap, achieving an anti-aliasing effect. This embodiment of the application only requires simple calculations to achieve the anti-aliasing effect, thus reducing the performance consumption during the anti-aliasing process.
[0049] The anti-aliasing rendering method in this exemplary embodiment will be further described below.
[0050] In step 501, the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model are obtained. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions.
[0051] The rendering process of the target model is the process of projecting the 3D target model into a 2D target model image. The pixels in the target model rendering process are the pixels that constitute the target model image. The original AO (Ambient Occlusion) information of each pixel during the target model rendering process can be sampled from the AO map of the target model. The AO map, or Ambient Occlusion Map, is a grayscale image used to record information about the model's occlusion by ambient light. The whiter the AO map, the stronger the ambient light exposure, meaning the weaker the degree of occlusion; the darker the AO map, the weaker the ambient light exposure, meaning the stronger the degree of occlusion. In other words, in this embodiment, the original AO information of each pixel during the target model rendering process is sampled from the AO map of the target model, and this original AO information is the color value of the corresponding pixel in the AO map. The AO map in this embodiment can be obtained by conventional baking of the target model.
[0052] In the process of creating the target model, this embodiment requires distinguishing and setting the vertex colors corresponding to the gap regions of the target model from those corresponding to other regions. In this embodiment, the vertex color information of each pixel during the target model rendering process can be obtained by acquiring the vertex colors of the target model and interpolating them. Based on the vertex color information of each pixel during the target model rendering process, the corresponding original AO information is processed so that the value of the target AO information of the pixel corresponding to the gap region is less than the value of the original AO information, thereby weakening the indirect light in the gap region. For ease of description, the vertex color information of the pixel corresponding to the gap region is denoted as the gap vertex color information, and the vertex color information of the pixel corresponding to other regions is denoted as other vertex color information.
[0053] Optionally, the vertex color of the gap region corresponding to the gap in the target model can be 0, while the vertex colors of other regions are not 0; correspondingly, during the rendering of the target model, the vertex color information of the pixel corresponding to the gap region is 0, while the vertex color information of the pixel corresponding to other regions is not 0.
[0054] Optionally, the color information of the gap vertex is 0, and the color information of other vertices is 1.
[0055] In step 502, the original AO information corresponding to each pixel is processed according to the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information.
[0056] After obtaining the original AO information and vertex color information of each pixel during the target model rendering process, the original AO information is processed according to the vertex color information. Since the vertex color information of the gap is different from that of other vertex color information, by distinguishing the vertex color information of the gap from other vertex color information, the value of the original AO information of the corresponding pixel in the gap area can be reduced by using the vertex color information, thereby reducing the indirect light in the gap area and reducing the jaggedness.
[0057] In some optional embodiments of this application, the slit vertex color information is 0, while the color information of other vertices is not 0. The process of processing the corresponding original AO information based on the vertex color information of each pixel to obtain the target AO information of each pixel may include:
[0058] The vertex color information of each pixel is multiplied by the corresponding original AO information to obtain the target AO information of each pixel.
[0059] In this embodiment, after obtaining the vertex color information and original AO information of each pixel during the rendering process of the target model, the vertex color information of each pixel is multiplied by the corresponding original AO information to obtain the target AO information of each pixel. Since the vertex color information of each pixel corresponding to the gap region is 0, the original AO information multiplied by 0 results in a value of 0. That is, the target AO information of the pixel corresponding to the gap region of the target model is 0, which can minimize the indirect light in the gap region and reduce the jaggedness caused by the specular highlights in the gap region.
[0060] Preferably, in this embodiment, the color information of the gap vertex is 0, and the information of other vertices is 1.
[0061] For pixels corresponding to other regions of the target model, when their original AO information is multiplied by 1, the resulting value of 5 is still the same. That is, the target AO information of pixels corresponding to other regions of the target model retains the original AO information, which not only simplifies the calculation, but also ensures that other regions are not affected.
[0062] In some alternative embodiments of this application, the slit vertex color information is 0, while the color information of other vertices is not 0. The above-described processing of the corresponding original AO information based on the vertex color information of each pixel...
[0063] The process of obtaining the target AO information of each pixel may include: inverting the vertex color information of each pixel;
[0064] Subtract the original AO information of each pixel from the corresponding inverted vertex color information, and normalize the subtraction result to the range [0, 1] to obtain the target AO information of each pixel.
[0065] In this embodiment, the vertex color information is first inverted, that is, 1 is subtracted from the vertex color information. When the vertex color...
[0066] When the information is 0, the inverted vertex color information is 1; when the vertex color information is 1, the inverted vertex color information is 0.
[0067] By inverting the vertex color information, the inverted edge vertex color information is 1, while the inverted color information of other vertices is not 1.
[0068] The original AO information of each pixel during the rendering process of the target model is compared with the corresponding inverted vertex.
[0069] Color information subtraction involves subtracting the inverted vertex color information value from the original AO information value. Since the pixel corresponding to the gap region has a 0, its inverted gap vertex color information is 1. Therefore, the value obtained by subtracting 1 from the original AO information of the pixel corresponding to the gap region in the target model is less than or equal to 0. By further normalizing the subtraction result to the range [0, 1], we can obtain that the value obtained by subtracting 1 from the original AO information of the pixel corresponding to the gap region in the target model is 0, which means that during the rendering of the target model...
[0070] Setting the target AO information of the pixel corresponding to the gap region to 0 can minimize the indirect light in the gap region and reduce the jaggedness caused by the highlights in the gap region.
[0071] Preferably, in this embodiment, if the other vertex information corresponding to other regions is 1, then the inverted other vertex information is 0. For pixels corresponding to other regions of the target model, when their original AO information is subtracted by 0, the resulting value is still the same. That is, the target AO information of pixels corresponding to other regions of the target model retains the original AO information, which not only simplifies the calculation but also ensures that other regions are not affected.
[0072] In some alternative embodiments of this application, the slit vertex color information is 1, while the color information of other vertices is not 1. The process of processing the corresponding original AO information based on the vertex color information of each pixel to obtain the target AO information of each pixel may include:
[0073] Subtract the original AO information of each pixel from the corresponding vertex color information, and normalize the subtraction result to the range [0, 1] to obtain the target AO information of each pixel.
[0074] Since the vertices color information of the pixels corresponding to the slit region is 1, the value obtained by subtracting 1 from the original AO information of the pixels corresponding to the slit region of the target model is less than or equal to 0. By further normalizing the subtraction result to the range [0, 1], we can obtain that the value obtained by subtracting 1 from the original AO information of the pixels corresponding to the slit region of the target model is 0. That is, the target AO information of the pixels corresponding to the slit region of the target model is 0, which can weaken the indirect light in the slit region to the greatest extent and weaken the jaggedness of the highlights in the slit region.
[0075] Preferably, in this embodiment, the vertex information corresponding to other regions is 0. For pixels corresponding to other regions of the target model, when their original AO information is subtracted by 0, the resulting value is still the same. That is, the target AO information of pixels corresponding to other regions of the target model retains the original AO information, which not only simplifies the calculation but also ensures that other regions are not affected.
[0076] In step 503, the target model is rendered based on the target AO information of each pixel.
[0077] Since the target AO information value of the pixel corresponding to the gap region is less than the value of the corresponding original AO information, when rendering the target model based on the target AO information, the indirect light in the gap region of the target model can be weakened, the jaggedness of the rendered target model image can be reduced, and the anti-aliasing effect can be achieved.
[0078] like Figure 6 As shown, Figure 6 The image on the left is the original target model image rendered based on the original AO information, and the image on the right is the target model image rendered based on the target AO information. As can be seen from the comparison, the jagged edges at the gaps in the target model image are significantly reduced.
[0079] This application embodiment obtains the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model. The vertex color information of pixels corresponding to gap regions in the target model differs from the vertex color information of pixels corresponding to other regions. The original AO information is processed based on the vertex color information of each pixel to obtain the target AO information for each pixel. The value of the target AO information for pixels corresponding to gap regions in the target model is less than the value of the original AO information. The target model is rendered based on the target AO information of each pixel. This reduces the indirect light intensity of the gaps, achieving an anti-aliasing effect. This application embodiment only requires simple calculations to achieve the anti-aliasing effect, thus reducing performance consumption during the anti-aliasing process.
[0080] Furthermore, in some optional embodiments of this application, the above method may further include:
[0081] Obtain the world space normals of each pixel during the rendering process of the target model.
[0082] Determine the edge mask corresponding to the target model based on the world space normal;
[0083] Update the roughness of each pixel according to the edge mask;
[0084] The target model is rendered based on the updated roughness.
[0085] Normals are vectors that describe the surface curvature of a 3D model. In real-time rendering, normal vectors are required for lighting and shading calculations on the 3D model. In this embodiment, the world space normals of each pixel during the rendering process of the target model can be obtained by sampling the normal texture of the target model using a fragment shader to obtain normal vectors in tangent space. Then, the normal vectors are transformed to world space using a transformation matrix constructed in the vertex shader, thus obtaining the world space normals of each pixel during the rendering process of the target model.
[0086] By using the world space normals of each pixel, the angular changes between the faces of adjacent pixels can be determined, thus identifying areas in the target model prone to specular jaggedness, i.e., edge regions, resulting in an edge mask. This edge mask is a two-dimensional image, and each pixel in the edge mask corresponds one-to-one with each pixel in the target model rendering process; that is, every pixel in the target model rendering process can find its corresponding pixel value in the edge mask. Each pixel in the target model rendering process has a corresponding roughness, which affects the rendering effect of that pixel. After obtaining the edge mask, the roughness corresponding to each pixel in the target model rendering process is updated based on the edge mask, and then the target model is rendered based on the updated roughness to update the generated target model image.
[0087] It should be noted that in the process of rendering the target model based on the target AO information and generating the target model image, the roughness corresponding to each pixel is also required. The target model rendering based on the updated roughness described in this embodiment refers to further adjusting the roughness corresponding to each pixel of the target model during the rendering process. In other words, this embodiment does not necessarily require rendering the target model twice; it can perform only one rendering, directly rendering and displaying the target model based on the target AO information of each pixel and the updated roughness during the single rendering process.
[0088] This embodiment uses world space normals to obtain edge masks, which are used to distinguish areas in the target model that are prone to specular jaggedness. Then, by adjusting the roughness of the area, the edge highlights are weakened, thereby achieving an anti-aliasing effect.
[0089] In an optional embodiment of this application, determining the edge mask corresponding to the target model based on the world space normal may include:
[0090] Calculate the partial derivative of the world space normal;
[0091] The edge mask corresponding to the target model is determined based on the target partial derivative result that is greater than the preset partial derivative result.
[0092] In this embodiment, by calculating the partial derivative of the world space normal, and based on the relationship between the partial derivative and a preset partial derivative, target partial derivatives larger than the preset partial derivative can be selected. This means pixels whose world space normals change drastically during the rendering of the target model are selected. The pixels corresponding to these target partial derivatives can be considered as edge pixels corresponding to the edge positions of the target model. An edge mask is then determined using the pixels corresponding to the target partial derivatives. This edge mask is used to distinguish areas in the target model that are prone to specular jaggedness.
[0093] For example, the pixel value corresponding to the edge pixel in the edge mask can be recorded as 1, and the pixel value of other pixels can be recorded as 0.
[0094] Accordingly, updating the roughness of each pixel based on the edge mask can be achieved by determining the target pixel corresponding to the pixel with a value of 1 in the edge mask from the pixels corresponding to the target model, increasing the roughness of the target pixel by a preset value, and then normalizing the increased roughness to the range [0, 1]. This preset value can be a fixed value or a dynamic value; for example, the preset value can be 0.5, or it can be equal to the product of the roughness of the target pixel and a preset coefficient.
[0095] In an optional embodiment of this application, determining the edge mask corresponding to the target model based on the world space normal may include:
[0096] Calculate the partial derivative of the world space normal;
[0097] Perform a dot product on the two partial derivative results and normalize the dot product to the range [0, 1].
[0098] The normalized dot product result is determined as the edge mask corresponding to the target model.
[0099] In this embodiment, the partial derivative of the world space normal can be calculated using the HLSL function fwidth. This partial derivative is represented by dN, and the corresponding calculation formula is as follows:
[0100] float3dN=fwidth(WorldNormal);
[0101] Among them, WorldNormal represents the world space normal, and float3 is a three-dimensional data type.
[0102] After obtaining the partial derivative of the world space normal, since the partial derivative is three-dimensional and the information is stored in three channels, it cannot be directly used as a mask. Therefore, in this embodiment, a dot product operation is performed on the partial derivative. Specifically, the partial derivative is multiplied by itself, and then the saturate function is used to normalize the dot product to the range [0, 1], thus obtaining a one-dimensional edge mask. The corresponding calculation formula is as follows:
[0103] float M=saturate(dot(dN,dN));
[0104] Where M represents edge masking, and float is a one-dimensional data type.
[0105] Accordingly, updating the roughness corresponding to each pixel based on the edge mask can include:
[0106] The roughness change value corresponding to each pixel is determined based on the edge mask;
[0107] Add the original roughness corresponding to each pixel to the corresponding roughness change value, and normalize the sum to the range [0, 1].
[0108] The roughness of each pixel is updated based on the standardized summation result.
[0109] In this embodiment, the roughness change value corresponding to each pixel during the target model rendering process is related to the pixel value of the corresponding pixel in the edge mask. In one example, the pixel value of each pixel in the edge mask can be used as the roughness change value of the corresponding pixel during the target model rendering process; to make the selected highlight areas more accurate, in another example, the square of each pixel value in the edge mask can be used as the roughness change value of the corresponding pixel during the target model rendering process. Of course, this embodiment is not limited to the above two examples in determining the roughness change value of each pixel during the target model rendering process based on the edge mask. It can also be that the product of each pixel value in the edge mask and a preset coefficient is used as the roughness change value of the corresponding pixel during the target model rendering process, etc.
[0110] After determining the roughness change value corresponding to each pixel during the target model rendering process, the original roughness of each pixel is added to its corresponding roughness change value. Since the roughness value range is [0, 1], the sum needs to be normalized to [0, 1] as the updated roughness of the corresponding pixel. The corresponding calculation formula is as follows:
[0111] Roughness=saturate(Roughness+M*M);
[0112] Roughness refers to the surface roughness.
[0113] This application embodiment obtains the world space normal of each pixel during the rendering process of the target model, determines the edge mask corresponding to the target model based on the partial derivative of the world space normal, filters the edge areas of the target model that have specular highlights, and then uses the edge mask to modify the roughness of each pixel during the rendering process of the target model, increasing the roughness of the specular areas to reduce drastic specular changes, thereby achieving the effect of anti-spectral aliasing.
[0114] Furthermore, in some optional embodiments of this application, considering that when rendering a vehicle, in order to simulate the realistic lighting effect of the vehicle surface, it is usually necessary to model the paint layer by layer, and simulate the lighting effect of each physical layer such as the primer layer, gloss layer, and clear coat layer by different components and superimpose them, when the target model is a vehicle model, the target model corresponds to a clear coat layer. Therefore, each pixel in the target model rendering process corresponds to a clear coat thickness. In the model rendering process, it is also necessary to render based on the clear coat thickness, that is, the clear coat thickness will also affect the rendering effect of the corresponding pixel. Therefore, the method may further include:
[0115] Update the clear coat thickness corresponding to each pixel based on the edge mask.
[0116] In this embodiment, edge masking can filter out edge regions with highlights in the target model. For the pixels corresponding to these edge regions, in addition to increasing roughness, the varnish thickness of the pixels corresponding to the edge regions can also be reduced to reduce the highlights caused by the varnish layer and reduce the generation of highlight jagged edges.
[0117] In one example, edge pixels in the target model rendering process can be determined based on edge masking, and the varnish thickness corresponding to the edge pixels can be reduced by a preset thickness, and the reduced varnish thickness can be normalized to the range [0, 1]. The preset thickness can be a fixed value or a dynamic value. For example, the preset thickness can be 0.2, or the preset value can be equal to the product of the varnish thickness of the edge pixel and a preset thickness coefficient, etc.
[0118] In another example, the pixel values of each pixel in the edge mask can be inverted to obtain an inverted mask; the original varnish thickness corresponding to each pixel in the target model rendering process is multiplied by the pixel value corresponding to the inverted mask to update the varnish thickness of each pixel in the target model rendering process.
[0119] This process involves inverting the pixel values of each pixel in the edge mask, i.e., subtracting the pixel value of the edge mask from 1. When the pixel value is 0, the inverted pixel value is 1; when the pixel value is 1, the inverted pixel value is 0. The original varnish thickness corresponding to each pixel during the target model rendering process is multiplied by the pixel value corresponding to the inverted mask to obtain the updated varnish thickness for each pixel during the target model rendering process. The corresponding calculation formula is as follows:
[0120] Clearcoat=Clearcoat*(1-M);
[0121] Clearcoat refers to the thickness of the clear coat.
[0122] Generally, in the edge mask, the pixel value of the pixel corresponding to the edge region is 1 or close to 1, and the pixel value of the pixel corresponding to the non-edge region is 0 or close to 0. Correspondingly, in the inverted mask, the pixel value of the pixel corresponding to the edge region is 0 or close to 0, and the pixel value of the pixel corresponding to the non-edge region is 1 or close to 1. For pixels corresponding to the edge region during the target model rendering process, the original varnish thickness multiplied by the pixel value of the corresponding pixel in the inverted mask results in a value of 0 or close to 0, meaning the updated varnish thickness is small. For pixels corresponding to the non-edge region during the target model rendering process, the original varnish thickness multiplied by the pixel value of the corresponding pixel in the inverted mask results in a value that remains the original varnish thickness or is slightly smaller than the original varnish thickness, meaning the updated varnish thickness remains basically unchanged. This reduces the varnish thickness in the edge region and decreases the highlights caused by the smooth varnish.
[0123] In another example, instead of inverting the pixel values of each pixel in the edge mask, the original varnish thickness of each pixel during the target model rendering process is multiplied by the pixel value corresponding to the edge mask to obtain the thickness change value; the original varnish thickness of each pixel during the target model rendering process is then subtracted from the corresponding thickness change value to update the varnish thickness of each pixel during the target model rendering process. The corresponding calculation formula is as follows:
[0124] Clearcoat=Clearcoat-Clearcoat*M.
[0125] Generally, in the edge mask, the pixel value of the pixel corresponding to the edge region is 1 or close to 1, and the pixel value of the pixel corresponding to the non-edge region is 0 or close to 0. During the rendering of the target model, for pixels corresponding to the edge region, multiplying the original varnish thickness by the pixel value of the corresponding pixel in the edge mask yields a thickness change value equal to or close to the original varnish thickness. Subtracting this thickness change value from the original varnish thickness results in a difference of 0 or close to 0, meaning the updated varnish thickness is small. Conversely, for pixels corresponding to the non-edge region during the rendering of the target model, multiplying the original varnish thickness by the pixel value of the corresponding pixel in the edge mask yields a thickness change value of 0 or close to 0. Subtracting this thickness change value from the original varnish thickness results in a difference that remains the same as or slightly less than the original varnish thickness, meaning the updated varnish thickness remains essentially unchanged. This weakens the varnish thickness in the edge region, reducing the highlights caused by the smooth varnish.
[0126] This application embodiment updates the clear coat thickness corresponding to each pixel during the rendering process of the target model by using edge masking, thereby reducing the clear coat thickness in the edge area and reducing the highlights caused by the clear coat in the edge area, thus achieving the effect of anti-speculiar highlights.
[0127] like Figure 7 As shown, Figure 7 The image on the left is the original target model image rendered based on the original AO information, and the image on the right is the updated target model image rendered based on the target AO information, the updated roughness, and the updated varnish thickness. As can be seen from the comparison, the jaggedness at the gaps and edges of the target model image is significantly reduced.
[0128] In some optional embodiments of this application, by adjusting the vertex color of the gap region of the target model to 0 and the vertex color of other regions to 1, and then multiplying the vertex color information of each pixel in the target model rendering process with the corresponding original AO information, the target AO information of each pixel is obtained. This makes the target AO information of the pixel corresponding to the gap region less than the original AO information, and the target AO information of the pixel corresponding to other regions equal to the original AO information. Through simple calculation, the indirect light intensity of the gap can be weakened, achieving an anti-aliasing effect. Furthermore, by combining edge masking, increasing the roughness of the pixels corresponding to the edge region and reducing the varnish thickness of the pixels corresponding to the edge region, the jaggedness caused by the highlights in the edge region is reduced, further improving the anti-aliasing effect.
[0129] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.
[0130] Reference Figure 8 This diagram illustrates a structural block diagram of an embodiment of an anti-aliasing rendering apparatus according to this application. Corresponding to the above-described anti-aliasing rendering method embodiment, in this application embodiment, the apparatus may include the following modules:
[0131] The information acquisition module 801 is used to acquire the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions.
[0132] The information processing module 802 is used to process the corresponding original AO information according to the vertex color information of each pixel to obtain the target AO information of each pixel; the value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information;
[0133] The model rendering module 803 is used to render the target model based on the target AO information of each pixel.
[0134] Optionally, the color information of the gap vertex is 0, and the color information of the other vertices is 1; the information processing module 802 may include:
[0135] The first information processing submodule is used to multiply the vertex color information of each pixel with the corresponding original AO information to obtain the target AO information of each pixel.
[0136] Optionally, the device may further include:
[0137] The normal information acquisition module is used to acquire the world space normals of each pixel during the rendering process of the target model.
[0138] An edge mask determination module is used to determine the edge mask corresponding to the target model based on the world space normal.
[0139] A roughness update module is used to update the roughness of each pixel according to the edge mask.
[0140] Update the rendering module to render the target model based on the updated roughness.
[0141] Optionally, the edge masking determination module may include:
[0142] The partial derivative calculation submodule is used to calculate the partial derivative of the world space normal.
[0143] The partial derivative multiplication submodule is used to perform a dot product of the two partial derivative results and normalize the dot product result to the range [0, 1].
[0144] The mask determination submodule is used to determine the normalized dot product result as the edge mask corresponding to the target model.
[0145] Optionally, the roughness update module may include:
[0146] The roughness change value determination submodule is used to determine the roughness change value corresponding to each pixel based on the edge mask;
[0147] The roughness addition submodule is used to add the original roughness corresponding to each pixel to the corresponding roughness change value, and normalize the addition result to the range [0, 1].
[0148] The roughness update submodule is used to update the roughness of each pixel based on the normalized summation result.
[0149] Optionally, the roughness change value determination submodule can be used to take the square of each pixel value in the edge mask as the roughness change value of the corresponding pixel during the rendering of the target model; or, it can be used to take each pixel value in the edge mask as the roughness change value of the corresponding pixel during the rendering of the target model.
[0150] Optionally, when the target model is a vehicle model, the target model corresponds to a clear coat layer, and each pixel in the target model rendering process corresponds to a clear coat thickness. The device may further include:
[0151] The varnish thickness update module is used to update the varnish thickness corresponding to each pixel based on the edge mask.
[0152] Optionally, the varnish thickness update module may include:
[0153] The inverting submodule is used to invert the pixel values of each pixel of the edge mask to obtain the inverted mask;
[0154] The first update submodule is used to multiply the original varnish thickness corresponding to each pixel by the pixel value corresponding to the inverted mask, so as to update the varnish thickness corresponding to each pixel.
[0155] Optionally, the varnish thickness update module may include:
[0156] The thickness change determination submodule is used to multiply the original varnish thickness corresponding to each pixel by the pixel value corresponding to the edge mask to obtain the thickness change value;
[0157] The second update submodule is used to subtract the corresponding thickness change value from the original varnish thickness corresponding to each pixel in order to update the varnish thickness corresponding to each pixel.
[0158] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0159] Reference Figure 9 This application also discloses an electronic device 90, including a processor 901, a memory 902, and a computer program 903 stored in the memory 902 and capable of running on the processor 901. When the computer program 903 is executed by the processor 901, it implements the steps of the anti-aliasing rendering method described above, for example:
[0160] The original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model are obtained. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions.
[0161] The original AO information is processed according to the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information.
[0162] The target model is rendered based on the target AO information of each pixel.
[0163] Optionally, the slit vertex color information is 0, and the other vertex color information is 1; the step of processing the corresponding original AO information according to the vertex color information of each pixel to obtain the target AO information of each pixel includes:
[0164] The vertex color information of each pixel is multiplied by the corresponding original AO information to obtain the target AO information of each pixel.
[0165] Optionally, the method further includes:
[0166] Obtain the world space normals of each pixel during the rendering process of the target model;
[0167] Determine the edge mask corresponding to the target model based on the world space normal;
[0168] Update the roughness of each pixel according to the edge mask;
[0169] The target model is rendered based on the updated roughness.
[0170] Optionally, determining the edge mask corresponding to the target model based on the world space normal includes:
[0171] Calculate the partial derivative of the world space normal;
[0172] Perform a dot product on the two partial derivative results and normalize the dot product to the range [0, 1].
[0173] The normalized dot product result is determined as the edge mask corresponding to the target model.
[0174] Optionally, updating the roughness corresponding to each pixel based on the edge mask includes:
[0175] The roughness change value corresponding to each pixel is determined based on the edge mask;
[0176] Add the original roughness corresponding to each pixel to the corresponding roughness change value, and normalize the sum to the range [0, 1].
[0177] The roughness of each pixel is updated based on the standardized summation result.
[0178] Optionally, determining the roughness change value corresponding to each pixel based on the edge mask includes:
[0179] The square of each pixel value in the edge mask is used as the roughness change value of the corresponding pixel during the rendering process of the target model;
[0180] or,
[0181] Each pixel value in the edge mask is used as the roughness change value of the corresponding pixel during the rendering process of the target model.
[0182] Optionally, when the target model is a vehicle model, the target model corresponds to a clear coat layer, and each pixel in the target model rendering process corresponds to a clear coat thickness. The method further includes:
[0183] The clear coat thickness corresponding to each pixel is updated based on the edge mask.
[0184] Optionally, updating the clear coat thickness corresponding to each pixel based on the edge mask includes:
[0185] Invert the pixel values of each pixel of the edge mask to obtain an inverted mask; multiply the original varnish thickness corresponding to each pixel with the pixel value corresponding to the inverted mask to update the varnish thickness corresponding to each pixel.
[0186] or,
[0187] Multiply the original varnish thickness corresponding to each pixel by the pixel value corresponding to the edge mask to obtain the thickness change value;
[0188] 0. Subtract the corresponding thickness change value from the original varnish thickness corresponding to each pixel to update the varnish thickness corresponding to each pixel. In the above implementation, by obtaining the original AO information and vertex color information of each pixel during the target model rendering process, wherein the vertex color information of the pixel corresponding to the gap region of the target model is different from the other vertex color information of the pixels corresponding to other regions; according to...
[0189] Vertex color information is processed to obtain the target AO information; the value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the corresponding original AO information.
[0190] The target model is rendered based on the target AO information. This embodiment distinguishes the vertex colors of the gap regions from those of other regions in the target model, and then processes the original AO information based on the vertex color information of each pixel during the rendering process to obtain the target AO information. The target AO information of the pixels corresponding to the gap regions is less than the corresponding original AO information, which weakens the indirect light intensity of the gaps, achieving an anti-aliasing effect. This embodiment requires only simple calculations to achieve the anti-aliasing effect, thus reducing performance consumption during the anti-aliasing process.
[0191] This application also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the anti-aliasing rendering method described above, for example:
[0192] The original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model are obtained. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions.
[0193] The original AO information is processed according to the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information.
[0194] The target model is rendered based on the target AO information of each pixel.
[0195] Optionally, the slit vertex color information is 0, and the other vertex color information is 1; the step of processing the corresponding original AO information according to the vertex color information of each pixel to obtain the target AO information of each pixel includes:
[0196] The vertex color information of each pixel is multiplied by the corresponding original AO information to obtain the target AO information of each pixel.
[0197] Optionally, the method further includes:
[0198] Obtain the world space normals of each pixel during the rendering process of the target model;
[0199] Determine the edge mask corresponding to the target model based on the world space normal;
[0200] Update the roughness of each pixel according to the edge mask;
[0201] The target model is rendered based on the updated roughness.
[0202] Optionally, determining the edge mask corresponding to the target model based on the world space normal includes:
[0203] Calculate the partial derivative of the world space normal;
[0204] Perform a dot product on the two partial derivative results and normalize the dot product to the range [0, 1].
[0205] The normalized dot product result is determined as the edge mask corresponding to the target model.
[0206] Optionally, updating the roughness corresponding to each pixel based on the edge mask includes:
[0207] The roughness change value corresponding to each pixel is determined based on the edge mask;
[0208] Add the original roughness corresponding to each pixel to the corresponding roughness change value, and normalize the sum to the range [0, 1].
[0209] The roughness of each pixel is updated based on the standardized summation result.
[0210] Optionally, determining the roughness change value corresponding to each pixel based on the edge mask includes:
[0211] The square of each pixel value in the edge mask is used as the roughness change value of the corresponding pixel during the rendering process of the target model;
[0212] or,
[0213] Each pixel value in the edge mask is used as the roughness change value of the corresponding pixel during the rendering process of the target model.
[0214] Optionally, when the target model is a vehicle model, the target model corresponds to a clear coat layer, and each pixel in the target model rendering process corresponds to a clear coat thickness. The method further includes:
[0215] The clear coat thickness corresponding to each pixel is updated based on the edge mask.
[0216] Optionally, updating the clear coat thickness corresponding to each pixel based on the edge mask includes:
[0217] Invert the pixel values of each pixel in the edge mask to obtain the inverted mask;
[0218] The original varnish thickness corresponding to each pixel is multiplied by the pixel value corresponding to the inverted mask to update the varnish thickness corresponding to each pixel;
[0219] or,
[0220] Multiply the original varnish thickness corresponding to each pixel by the pixel value corresponding to the edge mask to obtain the thickness change value;
[0221] The original varnish thickness corresponding to each pixel is subtracted from the corresponding thickness change value to update the varnish thickness corresponding to each pixel. In the above implementation, the original AO information and vertex color information of each pixel during the target model rendering process are obtained. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions. The original AO information is processed according to the vertex color information to obtain target AO information. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the corresponding original AO information. The target model is then rendered based on the target AO information. This embodiment distinguishes the vertex color of the gap region of the target model from the vertex colors of other regions, and then processes the original AO information according to the vertex color information of each pixel during the target model rendering process to obtain target AO information. The target AO information of the pixel corresponding to the gap region is less than the corresponding original AO information, which can weaken the indirect light intensity of the gap and achieve an anti-aliasing effect. This embodiment only requires simple calculations to achieve the anti-aliasing effect, thus reducing performance consumption during the anti-aliasing process.
[0222] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0223] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0224] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0225] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0226] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0227] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0228] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0229] The above provides a detailed description of the anti-aliasing rendering method, apparatus, electronic device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An anti-aliasing rendering method, characterized in that, The method includes: The original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model are obtained. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions. The original AO information is processed according to the vertex color information of each pixel to obtain the target AO information of each pixel. The value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information. The target model is rendered based on the target AO information of each pixel; Wherein, the vertices of the gap are 0, and the other vertices are 1; the step of processing the original AO information according to the vertex color information of each pixel to obtain the target AO information of each pixel includes: The vertex color information of each pixel is multiplied by the corresponding original AO information to obtain the target AO information of each pixel.
2. The method of claim 1, wherein, The method further includes: Obtain the world space normals of each pixel during the rendering process of the target model; Determine the edge mask corresponding to the target model based on the world space normal; Update the roughness of each pixel according to the edge mask; The target model is rendered based on the updated roughness.
3. The method of claim 2, wherein, The step of determining the edge mask corresponding to the target model based on the world space normal includes: Calculate the partial derivative of the world space normal; Perform a dot product on the two partial derivative results and normalize the dot product to the range [0, 1]. The normalized dot product result is determined as the edge mask corresponding to the target model.
4. The method of claim 3, wherein, The step of updating the roughness corresponding to each pixel based on the edge mask includes: The roughness change value corresponding to each pixel is determined based on the edge mask; Add the original roughness corresponding to each pixel to the corresponding roughness change value, and normalize the sum to the range [0, 1]. The roughness of each pixel is updated based on the standardized summation result.
5. The method of claim 4, wherein, Determining the roughness change value corresponding to each pixel based on the edge mask includes: The square of each pixel value in the edge mask is used as the roughness change value of the corresponding pixel during the rendering process of the target model; or, Each pixel value in the edge mask is used as the roughness change value of the corresponding pixel during the rendering process of the target model.
6. The method of claim 4, wherein, When the target model is a vehicle model, the target model corresponds to a clear coat layer, and each pixel in the target model rendering process corresponds to a clear coat thickness. The method further includes: The clear coat thickness corresponding to each pixel is updated based on the edge mask.
7. The method of claim 5, wherein, The step of updating the clear coat thickness corresponding to each pixel based on the edge mask includes: Invert the pixel values of each pixel in the edge mask to obtain the inverted mask; The original varnish thickness corresponding to each pixel is multiplied by the pixel value corresponding to the inverted mask to update the varnish thickness corresponding to each pixel; or, Multiply the original varnish thickness corresponding to each pixel by the pixel value corresponding to the edge mask to obtain the thickness change value; The original varnish thickness corresponding to each pixel is subtracted from the corresponding thickness change value to update the varnish thickness corresponding to each pixel.
8. An anti-aliasing rendering apparatus, characterized by, The device includes: The information acquisition module is used to acquire the original ambient occlusion (AO) information and vertex color information of each pixel during the rendering process of the target model. The vertex color information of the pixel corresponding to the gap region of the target model is different from the vertex color information of the pixels corresponding to other regions. The information processing module is used to process the corresponding original AO information according to the vertex color information of each pixel to obtain the target AO information of each pixel; the value of the target AO information of the pixel corresponding to the gap region of the target model is less than the value of the original AO information; The model rendering module is used to render the target model based on the target AO information of each pixel; Wherein, the color information of the gap vertex is 0, and the color information of the other vertices is 1; the information processing module includes: The first information processing submodule is used to multiply the vertex color information of each pixel with the corresponding original AO information to obtain the target AO information of each pixel.
9. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the anti-aliasing rendering method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the anti-aliasing rendering method as described in any one of claims 1-7.