Method, device, computer device and storage medium for generating a rendered image
By offsetting the normal direction position and color rendering of the vertices of the 3D model, a rendering model is generated and superimposed, which solves the problem of complex and inefficient pipeline processing and realizes the efficient dynamic display of the outline of two-dimensional objects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING SWEET SUGARSOFT TECH CO LTD
- Filing Date
- 2022-02-21
- Publication Date
- 2026-06-23
Smart Images

Figure CN114529657B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more specifically, to a method, apparatus, computer device, and storage medium for generating rendered images. Background Technology
[0002] When rendering two-dimensional objects such as cartoon characters, style effects can be added, such as adding outer strokes. In some cases, post-processing methods are used to add outer strokes to the rendered two-dimensional objects, such as using pipeline processing. However, pipeline processing is generally quite complex. If generating continuously changing images using two-dimensional objects, each frame of the image needs to be processed, which is inefficient. Summary of the Invention
[0003] This disclosure provides at least one method, apparatus, computer device, and storage medium for generating rendered images.
[0004] In a first aspect, embodiments of this disclosure provide a method for generating a rendered image, comprising: obtaining a first rendered model generated after rendering a three-dimensional model of a target object using a color map; performing position offset processing on the vertices in the three-dimensional model according to the corresponding vertex normal direction and rendering processing with a preset color to obtain a second rendered model; and performing display overlay processing on the first rendered model and the second rendered model to obtain a target rendered image.
[0005] Thus, the second rendered model, obtained by offsetting the vertices of the target object's 3D model according to their corresponding normal directions and rendering with preset colors, has prominent "edges" compared to the first rendered model generated by directly rendering the 3D model. Therefore, by displaying the first and second rendered models together, the "edges" of the second rendered model's corresponding image, which are not occluded by the first rendered model's image, can be displayed on top of the normal display of the first rendered model's rendered image. These "edges" can then be displayed as the outline of the two-dimensional object in the target rendered image. This model-level processing allows for the rendering and display of corresponding outlines as the state of the two-dimensional object changes, eliminating the need for frame-by-frame post-processing and thus improving efficiency.
[0006] In one optional implementation, the vertex in the 3D model is subjected to position offset processing corresponding to the vertex normal direction and rendering processing with a preset color, including: determining a target vertex from multiple vertices included in the 3D model based on the current display view of the 3D model, and performing position offset processing on the target vertex corresponding to the vertex normal direction to obtain an intermediate 3D model; and using the preset color to render the intermediate 3D model to generate a second rendering model.
[0007] In one optional implementation, the vertex in the three-dimensional model is subjected to position offset processing corresponding to the vertex normal direction and rendering processing with a preset color, including: rendering the three-dimensional model with a preset color to obtain an intermediate rendering model; based on the current display view of the intermediate rendering model, determining a target vertex from the multiple vertices included in the intermediate rendering model, and performing position offset processing on the target vertex corresponding to the vertex normal direction to obtain a second rendering model.
[0008] This provides two ways to determine the second rendering model to generate the target rendered image, offering greater flexibility due to the increased number of options.
[0009] In one optional implementation, the step of performing position offset processing on vertices in the 3D model corresponding to the vertex normal direction includes: obtaining the offset amount of the position offset processing; the offset amount is used to characterize the distance between the target vertex's position after offset and its position before offset; and using the offset amount to perform position offset processing on vertices in the 3D model corresponding to the vertex normal direction.
[0010] In this way, since the offset can be set, the distance between the outer stroke and the outline of the target object in the target rendered image can be determined more flexibly. This allows the target object in the target rendered image to be displayed in a more refined style or a more exaggerated cartoon style by relying on the outer stroke.
[0011] In one optional implementation, rendering a vertex in the 3D model with a preset color includes: obtaining the rendering range when rendering the vertex with the preset color; and rendering the vertex in the 3D model with the preset color based on the rendering range.
[0012] In this way, on the one hand, since the preset colors are selectable, the colors of the outer outlines can be flexibly changed. On the other hand, when rendering vertices, the rendering range can represent the thickness of the outer outlines. Therefore, by adjusting the rendering range, the outer outlines can also be adjusted accordingly, so that the target objects in the resulting rendered image can display different style types.
[0013] In one optional implementation, determining the target vertex from the plurality of vertices included in the 3D model based on the current display view of the 3D model includes: based on the current display view and based on the position information of the plurality of vertices in the 3D model in the corresponding model coordinate system, filtering out vertices that are not visible from the plurality of vertices in the 3D model under the current display view as the target vertex.
[0014] In one optional implementation, the method further includes: determining the shooting pose of a virtual camera that captures the three-dimensional model in the model coordinate system corresponding to the three-dimensional model; and determining the current display viewpoint of the three-dimensional model based on the shooting pose of the virtual camera.
[0015] This method of classifying the 3D model and the virtual camera under the same coordinate system to determine the current display perspective is highly accurate and relatively simple to operate in practical applications, thus effectively improving efficiency.
[0016] In one optional implementation, the step of displaying and overlaying the first rendering model and the second rendering model to obtain a target rendering image includes: rendering the first rendering model based on the current display view of the three-dimensional model to obtain a first rendering layer, and rendering the second rendering model to obtain a second rendering layer; and overlaying the first rendering layer onto the front of the second rendering layer to generate the target rendering image.
[0017] Secondly, embodiments of this disclosure also provide a rendering image generation apparatus, comprising: an acquisition module for acquiring a first rendering model generated after rendering a three-dimensional model of a target object using color mapping; a first processing module for performing position offset processing on vertices in the three-dimensional model according to the corresponding vertex normal direction and rendering processing with preset colors to obtain a second rendering model; and a second processing module for performing display overlay processing on the first rendering model and the second rendering model to obtain a target rendering image.
[0018] In one optional implementation, when the first processing module performs position offset processing on the corresponding vertex normal direction and rendering processing on the vertices in the 3D model, it is configured to: determine a target vertex from the multiple vertices included in the 3D model based on the current display view of the 3D model, and perform position offset processing on the target vertex on the corresponding vertex normal direction to obtain an intermediate 3D model; and use the preset color to render the intermediate 3D model to generate a second rendering model.
[0019] In one optional implementation, when the first processing module performs position offset processing on the corresponding vertex normal direction and rendering processing on the vertices in the three-dimensional model, it is used to: render the three-dimensional model using the preset color to obtain an intermediate rendering model; based on the current display view of the intermediate rendering model, determine a target vertex from the multiple vertices included in the intermediate rendering model, and perform position offset processing on the target vertex on the corresponding vertex normal direction to obtain a second rendering model.
[0020] In one optional implementation, when the first processing module performs position offset processing on vertices in the three-dimensional model according to the corresponding vertex normal direction, it is used to: obtain the offset amount of the position offset processing; the offset amount is used to characterize the distance between the target vertex's position after offset and its position before offset; and use the offset amount to perform position offset processing on vertices in the three-dimensional model according to the corresponding vertex normal direction.
[0021] In one optional implementation, when the first processing module performs preset color rendering on the vertices in the 3D model, it is configured to: obtain the rendering range when rendering the vertices using the preset color; and perform preset color rendering on the vertices in the 3D model based on the rendering range.
[0022] In one optional implementation, when the first processing module determines a target vertex from multiple vertices of the 3D model based on the current display view of the 3D model, it is configured to: based on the current display view and based on the position information of multiple vertices in the 3D model in the corresponding model coordinate system, filter out vertices that are not visible from the multiple vertices of the 3D model under the current display view as the target vertex.
[0023] In one optional implementation, the first processing module is further configured to: determine the shooting pose of the virtual camera that captures the three-dimensional model in the model coordinate system corresponding to the three-dimensional model; and determine the current display viewpoint of the three-dimensional model based on the shooting pose of the virtual camera.
[0024] In one optional implementation, when the second processing module performs display overlay processing on the first rendering model and the second rendering model to obtain a target rendering image, it is configured to: render the first rendering model based on the current display view of the three-dimensional model to obtain a first rendering layer, and render the second rendering model to obtain a second rendering layer; and overlay the first rendering layer onto the front of the second rendering layer to generate the target rendering image.
[0025] Thirdly, an optional implementation of this disclosure also provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.
[0026] Fourthly, an optional implementation of this disclosure also provides a computer-readable storage medium storing a computer program that, when run, performs the steps of the first aspect or any possible implementation of the first aspect.
[0027] For a description of the effects of the above-mentioned rendering image generation apparatus, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned rendering image generation method, which will not be repeated here.
[0028] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0029] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.
[0030] Figure 1 A flowchart illustrating a method for generating a rendered image provided by an embodiment of this disclosure is shown;
[0031] Figure 2 A schematic diagram of a three-dimensional model of a target object provided in an embodiment of this disclosure is shown;
[0032] Figure 3 A schematic diagram of a color map provided in an embodiment of this disclosure is shown;
[0033] Figure 4 This illustration shows a schematic diagram of adding an outer outline to a two-dimensional image according to an embodiment of the present disclosure;
[0034] Figure 5 A schematic diagram of an operating interface provided in an embodiment of this disclosure is shown;
[0035] Figure 6 A schematic diagram of a target rendering image provided by an embodiment of the present disclosure is shown;
[0036] Figure 7 A schematic diagram of an image rendering apparatus provided in an embodiment of the present disclosure is shown;
[0037] Figure 8 A schematic diagram of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0039] Research has found that when adding outlines to 2D objects using pipeline processing, a post-processing approach is typically employed. For example, after obtaining a frame displaying the 2D object, the outline is added to that frame using pipeline processing, with pixels as the processing unit. However, pipeline processing is usually quite complex, and for continuously changing scenes generated for 2D objects, frame-by-frame processing becomes inefficient.
[0040] Based on the above research, this disclosure provides a method for generating rendered images. A second rendered model, obtained by offsetting the vertices of a target object's 3D model according to their corresponding normal directions and rendering with preset colors, has prominent "edges" compared to a first rendered model generated directly from the 3D model. Therefore, by overlaying the first and second rendered models, the "edges" of the second rendered model, which are not obscured by the first rendered model, can be displayed on top of the normal display of the first rendered model's rendered image. These "edges" can then be displayed as the outline of a two-dimensional object in the target rendered image. This model-level processing allows for the rendering and display of corresponding outlines as the state of the two-dimensional object changes, eliminating the need for frame-by-frame post-processing and thus improving efficiency.
[0041] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.
[0042] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0043] To facilitate understanding of this embodiment, a method for generating a rendered image disclosed in this disclosure will first be described in detail. The executing entity of the method for generating a rendered image provided in this disclosure is generally a computer device with certain computing capabilities. This computer device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, the method for generating a rendered image can be implemented by a processor calling computer-readable instructions stored in memory.
[0044] The following describes the method for generating rendered images provided in this disclosure. This disclosure provides a method for generating rendered images that can be used to determine rendered images of two-dimensional objects. The two-dimensional objects described herein can specifically include cartoon characters, game characters, virtual pets, etc. Therefore, the generation method provided in this disclosure can be specifically applied to different application fields such as game screen production or generation, and animation and film production. After obtaining a rendered image using the method provided in this disclosure, the rendered two-dimensional object can have an outer outline effect. This style rendering effect allows the rendered two-dimensional object to have a special style effect, such as highlighting a cartoon style or a minimalist style.
[0045] See Figure 1 The diagram shows a flowchart of a method for generating a rendered image according to an embodiment of this disclosure. The method includes steps S101 to S103, wherein:
[0046] S101: Obtain the first rendered model generated after rendering the 3D model of the target object using color mapping;
[0047] S102: Perform position offset processing on the corresponding vertex normal direction and rendering processing on the vertices in the three-dimensional model to obtain the second rendering model;
[0048] S103: Display and overlay the first rendering model and the second rendering model to obtain the target rendering image.
[0049] In this embodiment, when determining the target rendering image, a first rendering model is generated by rendering the 3D model of the target object using color mapping. A second rendering model is obtained by offsetting the vertices in the 3D model according to their corresponding normal directions and rendering them with preset colors. The target rendering image is then obtained by overlaying the first and second rendering models. This model-level processing allows for the rendering and display of corresponding outlines as the state of the 2D object changes, eliminating the need for frame-by-frame post-processing and thus improving efficiency.
[0050] The above S101 to S103 are explained in detail below.
[0051] Regarding S101 above, the target object may include, for example, the two-dimensional object described above, which will not be elaborated further. Since the target object is a virtual object and does not actually exist, its physical characteristics such as height and weight can be determined by constructing a three-dimensional model corresponding to the target object, and the desired image of the target object in the real world can be simulated using this defined three-dimensional model. For example, see... Figure 2The diagram shown is a schematic representation of a three-dimensional model of a target object provided in an embodiment of this disclosure. The three-dimensional model shown here is an artificially constructed virtual model. Specifically, the three-dimensional model can be further refined to represent specific features such as facial features and clothing characteristics. Figure 2 The image is not shown. Furthermore, different 3D models can be determined for different target objects.
[0052] A 3D model typically consists of multiple vertices located on the surface of the 3D model, and meshes formed by the interconnections between the vertices.
[0053] For color mapping, see Figure 3 The diagram shown is a schematic of a color map provided in an embodiment of this disclosure. In fact, different areas on the color map have different colors. The color map can add color effects to the three-dimensional model corresponding to the target object during rendering, that is, to achieve the coloring process of the three-dimensional model.
[0054] Therefore, after rendering the 3D model of the target object using color mapping, the generated first rendered model can reflect the patterns and corresponding colors of facial features, clothing, etc. In one possible case, if it is not necessary to add outline rendering to the target object, the obtained first rendered model can also be directly used to render an image that can fully display the target object.
[0055] For example, in S102 above, Figure 2 The 3D model shown illustrates some vertices and their corresponding vertex normal directions. Since the 3D model is fixed, multiple vertices can be determined on the outer contour of the 3D model, and the normal direction of each vertex can be determined based on its position on the 3D model. The specific method for determining the normal direction will not be elaborated here.
[0056] By performing position offset processing on the vertices in the 3D model and rendering processing with preset colors, a second rendering model for displaying the outer stroke outline can be obtained. Since the order of position offset processing and preset color rendering processing can be changed, in specific implementations, for example, the following two different methods (a) or (b) can be used:
[0057] (a): First, determine the target vertex to be offset from multiple vertices in the 3D model, and then perform position offset processing and preset color rendering on the determined target vertex.
[0058] In specific implementation, the following method can be adopted: based on the current display view of the three-dimensional model, a target vertex is determined from the multiple vertices included in the three-dimensional model, and the target vertex is offset in the corresponding vertex normal direction to obtain an intermediate three-dimensional model; the intermediate three-dimensional model is rendered using the preset color to generate a second rendering model.
[0059] Specifically, when determining the target vertex from multiple vertices of the 3D model based on the current display view of the 3D model, the following method can be adopted: based on the current display view and the position information of multiple vertices in the 3D model in the corresponding model coordinate system, vertices that are not visible under the current display view are selected from the multiple vertices of the 3D model as the target vertex.
[0060] Specifically, when determining the current display viewpoint, for example, the shooting pose of the virtual camera capturing the 3D model can be determined in the model coordinate system corresponding to the 3D model. Then, based on the shooting pose of the virtual camera, the current display viewpoint of the 3D model can be determined. Here, the virtual camera can be understood as a virtual camera used to capture images of the target object; setting or adjusting the shooting parameters of the virtual camera can correspondingly change the shooting pose.
[0061] Here, since determining the current display viewpoint involves the relative positional relationship between the virtual camera and the target object, a corresponding model coordinate system can be established based on the 3D model to more accurately determine the current display viewpoint. The position information of the virtual camera within this model coordinate system can then be determined. Furthermore, by using the virtual camera's shooting parameters, such as a shooting elevation angle of 45 degrees, the shooting posture of the virtual camera can be determined. Thus, based on the virtual camera's position information and shooting posture, the shooting pose of the virtual camera can be determined.
[0062] Therefore, due to the change in shooting posture, the current display perspective corresponding to the target object changes; for example, it changes from showing the front of the target object to showing its side. The "front" and "side" mentioned here actually refer to showing at least one vertex corresponding to the front and side of the target object. Since the distribution area of currently visible vertices in the model coordinate system can be determined using the current display perspective, and the position information of multiple vertices in the 3D model in the model coordinate system can be determined, the position information corresponding to multiple vertices can be used to filter out vertices that are not visible from the current display perspective from the multiple vertices in the 3D model, and these can be used as target vertices.
[0063] Given a target vertex, the position offset of the target vertex in the corresponding vertex offset direction can be processed first to obtain an intermediate 3D model. Specifically, the position offset processing can be performed as follows: obtain the offset amount; the offset amount represents the distance between the target vertex's position after the offset and its position before the offset; using the offset amount, perform position offset processing on the vertices in the 3D model in the corresponding vertex normal direction.
[0064] Specifically, the offset affects the distance between the outer outline of the second rendering model and the outermost edge (i.e., the outline of the target object) of the rendered target object after it is used to obtain the target rendered image. Generally, when rendering the outer outline of the target object, the outer outline is drawn close to the outline of the target object. A simplified explanation using a two-dimensional image is provided here; see [link to relevant documentation]. Figure 4 The diagram shown is a schematic representation of adding an outer outline to a two-dimensional image according to an embodiment of this disclosure. Figure 4 Image (a) shows a rectangular object, with its outline 41 represented by a dashed line. The outline 41 of the rectangular object can be considered to be composed of multiple vertices, and the vertices can be offset in the two-dimensional plane along their normal directions. After offsetting all vertices by the same distance, the offset outer outline 42 can be obtained from the original outline 41. The outer outline 42 added to the rectangular object is represented, for example, by a solid line. Similarly, in... Figure 4 The same rectangular object is shown in (b), labeled as outline 43 for easy distinction, and the outer stroke 44 added to the rectangular object is also represented by a solid line. Here, the distance between the vertex and the outer stroke in the corresponding normal direction is, for example... Figure 4 The distances d1 shown in (a) and d2 shown in (b) can be determined by transferring the two-dimensional image to the three-dimensional model, which is the offset described above.
[0065] Here, through the analysis of Figure 4 As the explanation shows, the effect of the added outer stroke line varies depending on the offset setting. For example, for... Figure 4 The rectangular object shown in (a) has a smaller offset, so the added outer stroke is closer to the outline of the rectangular object, resulting in a style closer to the refined style obtained when rendering characters with many details. However, for... Figure 4The rectangular object shown in (b) has a large offset, so the added outer stroke is far from the outline of the rectangular object. The style is closer to the exaggerated, comic-style cartoon style obtained when rendering a simple cartoon character.
[0066] Therefore, when obtaining the offset for positional offset processing, the corresponding offset can be determined based on the desired rendering style. The unit of the offset can be, for example, the pixels corresponding to the rendered 2D image; for instance, the offset can be set to 2 pixels or 5 pixels to obtain different style types.
[0067] In addition, offsetting the position of vertices in the 3D model according to their corresponding vertex normal directions is a principle similar to that described above. Figure 4 The principle of offsetting contour lines on a two-dimensional image as described in the previous section is the same, so it will not be repeated here.
[0068] If the intermediate rendering model is obtained by using the position offset processing method described above, the intermediate 3D model can also be rendered using preset colors to obtain the second rendering model.
[0069] In specific implementations, for example, the following method can be used: obtain the rendering range when rendering the vertex using the preset color; and based on the rendering range, perform preset color rendering on the vertex in the 3D model.
[0070] The preset color specifically includes the color of the displayed outer outline, which can be determined in response to a color selection operation. See also Figure 5 The diagram shown is a schematic representation of an operation interface provided in an embodiment of this disclosure. The operation interface includes a color chart and a color picker button at the "Select Color" location. In response to clicking the color picker button, a rendering color can be selected for vertex rendering, and the currently selected rendering color is displayed using the color chart.
[0071] The rendering range can be specifically reflected in the thickness of the outer stroke outline, for example, in... Figure 4 The rendering area corresponding to (a) is smaller, so the outer outline is displayed as thinner; while Figure 4 The rendering range corresponding to (b) is larger, therefore the displayed outer outline is thicker. When determining the rendering range for vertex rendering, in Figure 5The interface shown also includes an adjustment knob at the "Selection Range" location. Controlling this knob determines the size of the selected rendering range, and the result is displayed numerically on the right. Here, the selected rendering range can be represented in pixels, specifically indicating the number of pixels occupied in the direction of the normal to the vertex when rendering the outlining.
[0072] Given a preset color and rendering range, the vertices can be rendered using the preset color according to the rendering range to obtain a second rendered model. Here, the resulting second rendered model has the same shape as the 3D model, but is larger. If the second rendered model is overlaid on the 3D model, the 3D model can be wrapped around it. Furthermore, the vertices of the second rendered model are not visible from the current display viewpoint.
[0073] (b): First, the 3D model is rendered using preset colors. Then, the target vertex to be offset is determined from multiple vertices in the 3D model so as to continue the position offset processing of the corresponding vertex normal direction.
[0074] In specific implementation, for example, the following method can be adopted: use a preset color to render the three-dimensional model to obtain an intermediate rendering model; based on the current display view of the intermediate rendering model, determine the target vertex from the multiple vertices included in the intermediate rendering model, and perform position offset processing on the target vertex in the corresponding vertex normal direction to obtain the second rendering model.
[0075] The method for determining the preset color can be found in the explanation in (a) above, and will not be repeated here. After rendering the 3D model using the preset color, the resulting intermediate rendered model is, for example, a 3D model expressed entirely in the preset color.
[0076] After obtaining the intermediate rendering model, the target vertex can be determined from multiple vertices using the current display viewpoint, and the target vertex can be offset along its corresponding vertex normal direction. The method for determining the current display viewpoint and the method for determining the target vertex using the determined current display viewpoint can be referred to the explanation in (a) above, and will not be repeated here. When offsetting the target vertex with the preset color along its corresponding normal direction, the principle is similar to that used in (a) above to determine the second rendering model, and the resulting second rendering model is the same as the second rendering model determined in (a) above.
[0077] Furthermore, no restrictions are placed on the order in which the steps are executed for S101 and S102.
[0078] Regarding S103 above, if the first rendering model and the second rendering model are determined according to S101 and S102 respectively, the target rendering image can be obtained by displaying and overlaying the first rendering model and the second rendering model.
[0079] In a specific implementation, the target rendering image can be determined in the following manner: based on the current display view of the 3D model, the first rendering model is rendered to obtain a first rendering layer, and the second rendering model is rendered to obtain a second rendering layer; the first rendering layer is superimposed on the front of the second rendering layer to generate the target rendering image.
[0080] Specifically, the second rendering model uses preset colors for vertex rendering and is larger than the first rendering model. Therefore, the second rendering layer obtained after rendering the second rendering model will be slightly larger than the first rendering layer obtained after rendering the first rendering model. If the first rendering layer is superimposed on the second rendering layer, the first rendering layer cannot completely occlude the second rendering layer; instead, it will display the unoccluded edges of the second rendering layer, i.e., the rendered portion with the preset color and rendering range. Furthermore, the vertices of the visible portion of the second rendering model have been removed from the current viewing angle and will not affect the display of the first rendering model. Since the first rendering model, through color mapping, can display the artistic details of the target object, superimposing the first rendering layer on the second rendering layer results in a target rendering image that not only fully displays the target object but also shows the outer outline rendered by the second rendering model, adding more stylistic effects to the target object.
[0081] For example, see Figure 6 The image shown is a schematic diagram of a target rendering image provided in an embodiment of this disclosure. Wherein, Figure 6 The target object shown in (a) is, for example, the rendered image corresponding to the first rendering layer. Figure 6 Image (b) shows the target rendered image obtained after overlaying the second rendering layer. Compared to... Figure 6 The rendered image shown in (a) shows that... Figure 6 The target object in the target rendered image shown in (b) has an outer outline, which can further reflect the comic style effect.
[0082] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0083] Based on the same inventive concept, this disclosure also provides a rendering image generation apparatus corresponding to the rendering image generation method. Since the principle of the apparatus in this disclosure for solving the problem is similar to the rendering image generation method described above in this disclosure, the implementation of the apparatus can refer to the implementation of the method, and repeated details will not be repeated.
[0084] Reference Figure 7 The diagram shown is a schematic representation of an image generation apparatus according to an embodiment of this disclosure. The apparatus includes: an acquisition module 71, a first processing module 72, and a second processing module 73; wherein,
[0085] Module 71 is used to acquire the first rendered model generated after rendering the 3D model of the target object using color mapping; and
[0086] The first processing module 72 is used to perform position offset processing on the vertices in the three-dimensional model according to the corresponding vertex normal direction, and to perform rendering processing with preset colors to obtain the second rendering model.
[0087] The second processing module 73 is used to perform display overlay processing on the first rendering model and the second rendering model to obtain the target rendering image.
[0088] In one optional implementation, when the first processing module 72 performs position offset processing on the corresponding vertex normal direction and rendering processing on the vertices in the three-dimensional model, it is configured to: determine a target vertex from the multiple vertices included in the three-dimensional model based on the current display view of the three-dimensional model, and perform position offset processing on the target vertex on the corresponding vertex normal direction to obtain an intermediate three-dimensional model; and use the preset color to render the intermediate three-dimensional model to generate a second rendering model.
[0089] In one optional implementation, when the first processing module 72 performs position offset processing of the corresponding vertex normal direction and rendering processing of the vertices in the three-dimensional model, it is used to: render the three-dimensional model using the preset color to obtain an intermediate rendering model; based on the current display view of the intermediate rendering model, determine a target vertex from the multiple vertices included in the intermediate rendering model, and perform position offset processing of the corresponding vertex normal direction on the target vertex to obtain the second rendering model.
[0090] In one optional implementation, when the first processing module 72 performs position offset processing on vertices in the three-dimensional model according to the vertex normal direction, it is used to: obtain the offset amount of the position offset processing; the offset amount is used to characterize the distance between the position of the target vertex after the offset and the position before the offset; and use the offset amount to perform position offset processing on vertices in the three-dimensional model according to the vertex normal direction.
[0091] In one optional implementation, when the first processing module 72 performs preset color rendering on the vertices in the three-dimensional model, it is configured to: obtain the rendering range when rendering the vertices using the preset color; and perform preset color rendering on the vertices in the three-dimensional model based on the rendering range.
[0092] In one optional implementation, when the first processing module 72 determines a target vertex from multiple vertices included in the 3D model based on the current display view of the 3D model, it is configured to: based on the current display view and based on the position information of multiple vertices in the 3D model in the corresponding model coordinate system, filter out vertices that are not visible from the multiple vertices of the 3D model under the current display view as the target vertex.
[0093] In an optional implementation, the first processing module 72 is further configured to: determine the shooting pose of the virtual camera that captures the three-dimensional model in the model coordinate system corresponding to the three-dimensional model; and determine the current display view of the three-dimensional model based on the shooting pose of the virtual camera.
[0094] In one optional implementation, when the second processing module 73 performs display overlay processing on the first rendering model and the second rendering model to obtain a target rendering image, it is configured to: render the first rendering model based on the current display view of the three-dimensional model to obtain a first rendering layer, and render the second rendering model to obtain a second rendering layer; and overlay the first rendering layer onto the front end of the second rendering layer to generate the target rendering image.
[0095] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0096] This disclosure also provides a computer device, such as... Figure 8 The diagram shown is a schematic representation of a computer device structure provided in an embodiment of this disclosure, including:
[0097] Processor 10 and memory 20; the memory 20 stores machine-readable instructions executable by processor 10, and processor 10 executes the machine-readable instructions stored in memory 20. When the machine-readable instructions are executed by processor 10, processor 10 performs the following steps:
[0098] A first rendering model is obtained after rendering the 3D model of the target object using color mapping; and a second rendering model is obtained by performing position offset processing on the vertices in the 3D model according to the corresponding vertex normal direction and rendering processing with preset colors; the first rendering model and the second rendering model are displayed and superimposed to obtain the target rendering image.
[0099] The aforementioned memory 20 includes a main memory 210 and an external memory 220; the main memory 210, also known as internal memory, is used to temporarily store the computational data in the processor 10, as well as the data exchanged with external memory 220 such as a hard disk. The processor 10 exchanges data with the external memory 220 through the main memory 210.
[0100] The specific execution process of the above instructions can be referred to the steps of the image generation method described in the embodiments of this disclosure, and will not be repeated here.
[0101] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the image rendering method described in the above-described method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0102] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the image generation method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0103] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0104] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0105] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0106] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0107] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0108] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for generating a rendered image, characterized in that, include: The three-dimensional model of the target object is obtained and pre-rendered with shading to obtain the first rendered model. as well as The vertices in the three-dimensional model are subjected to position offset processing of the corresponding vertex normal direction and rendering processing of preset colors to obtain a second rendering model; The first rendering model and the second rendering model are overlaid to obtain the target rendered image, including: Based on the current display view of the 3D model, the first rendering model is rendered to obtain a first rendering layer, and the second rendering model is rendered to obtain a second rendering layer. The first rendering layer is superimposed on the front of the second rendering layer to generate the target rendering image; The process includes offsetting the vertices in the 3D model according to their corresponding vertex normal directions and rendering them with preset colors, including: Based on the current display view of the 3D model, a target vertex is determined from the multiple vertices included in the 3D model, and the target vertex is offset according to the position of the corresponding vertex normal direction to obtain an intermediate 3D model. The intermediate 3D model is rendered using the preset colors to generate a second rendered model; The step of determining the target vertex from multiple vertices included in the 3D model based on the current display view of the 3D model includes: Based on the current display viewpoint and the position information of multiple vertices in the 3D model in the corresponding model coordinate system, vertices that are not visible from the multiple vertices of the 3D model under the current display viewpoint are selected as the target vertices.
2. The generation method according to claim 1, characterized in that, The process includes offsetting the vertices in the 3D model according to their corresponding vertex normal directions and rendering them with preset colors, including: The three-dimensional model is rendered using preset colors to obtain an intermediate rendering model; Based on the current display view of the intermediate rendering model, a target vertex is determined from the multiple vertices included in the intermediate rendering model, and the target vertex is subjected to position offset processing according to the corresponding vertex normal direction to obtain the second rendering model.
3. The generation method according to any one of claims 1-2, characterized in that, The step of offsetting the position of the vertices in the 3D model according to their corresponding vertex normal directions includes: Obtain the offset amount from the position offset processing; the offset amount is used to characterize the distance between the target vertex's position after the offset and its position before the offset. Using the offset, the vertices in the 3D model are offset in the direction of their corresponding vertex normals.
4. The generation method according to any one of claims 1-3, characterized in that, Rendering the vertices in the 3D model using preset colors includes: Obtain the rendering range when rendering the vertex using the preset color; Based on the rendering range, the vertices in the 3D model are rendered with preset colors.
5. The generation method according to claim 4, characterized in that, The method further includes: Determine the shooting pose of the virtual camera that captures the three-dimensional model in the model coordinate system corresponding to the three-dimensional model; Based on the shooting pose of the virtual camera, the current display viewpoint of the 3D model is determined.
6. An apparatus for generating a rendered image, characterized in that, include: The acquisition module is used to acquire the first rendered model generated after rendering the 3D model of the target object using color mapping; as well as The first processing module is used to perform position offset processing on the vertices in the three-dimensional model according to the corresponding vertex normal direction, and to perform rendering processing with preset colors to obtain the second rendering model. The second processing module is used to overlay the first rendering model and the second rendering model to obtain the target rendering image.
7. A computer device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions stored in the memory, wherein when the machine-readable instructions are executed by the processor, the processor performs the steps of the method for generating a rendered image as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a computer device, performs the steps of the method for generating a rendered image as described in any one of claims 1 to 5.