Virtual model rendering method and device, electronic equipment and program product

By adjusting the vertex position offset and visual display parameters of the virtual model, contour outline data is generated, which solves the problems of penetration and layer confusion in semi-transparent material areas during virtual model rendering, achieving high-precision outline effect and improving rendering efficiency.

CN121837568APending Publication Date: 2026-04-10GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-05
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing virtual model rendering technology cannot accurately render semi-transparent material areas, resulting in mutual penetration between areas and chaotic display layers. Furthermore, the outlines are uneven and unstable, and modifying the engine source code is costly.

Method used

By offsetting the vertices of the virtual model along the normal direction, contour outline data is generated. Visual display parameters are determined based on the reference depth and pixel depth of the semi-transparent material area. Rendering is then performed in conjunction with the contour outline data, avoiding the need to modify the rendering engine.

Benefits of technology

It achieves high-precision outline tracing effects, enhances the realism and layering of semi-transparent material areas, solves the problem of uneven tracing and poor stability, and avoids the development complexity and low compatibility issues caused by engine modifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121837568A_ABST
    Figure CN121837568A_ABST
Patent Text Reader

Abstract

The invention provides a rendering method of a virtual model, a rendering device of the virtual model, electronic equipment and a computer program product, and belongs to the technical field of model processing. The method comprises the steps of obtaining a to-be-processed model; performing vertex position offset on the first vertex of the to-be-processed model along the normal direction, determining a second vertex after the vertex position offset, and generating contour stroke data of the to-be-processed model according to the second vertex; determining a reference depth and a pixel depth of a semitransparent material area in the to-be-processed model, and determining visual display parameters of the semitransparent material area according to the reference depth and the pixel depth; and rendering the to-be-processed model according to the contour stroke data and the visual display parameters of the semitransparent material area to obtain a target rendering model. According to the method and the device, the semitransparent material area and the stroked edge of the model can be conveniently and accurately rendered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of model processing technology, and in particular to a rendering method for virtual models, a rendering device for virtual models, electronic devices, and computer program products. Background Technology

[0002] In games, animations, and virtual simulations, rendering virtual models is often required. However, existing model rendering methods have several drawbacks. First, they cannot accurately render semi-transparent material areas within virtual models, leading to issues such as semi-transparent material areas penetrating each other, display layer confusion, and a loss of realism. Second, current technologies typically use edge pixel identification and coloring for outlining, resulting in uneven outlining and poor stability. Third, existing rendering methods require modifications to the engine's source code, leading to high development and manpower costs and impacting work efficiency.

[0003] 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

[0004] This disclosure provides a rendering method, rendering device, electronic device, and computer program product for virtual models, thereby overcoming, to at least a certain extent, the problems of poor rendering accuracy and low rendering efficiency for semi-transparent material areas and outlines of models in the prior art.

[0005] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0006] According to one aspect of this disclosure, a method for rendering a virtual model is provided, comprising: acquiring a model to be processed; offsetting the position of a first vertex of the model to be processed along the normal direction to determine a second vertex after the vertex position offset, and generating contour outline data of the model to be processed based on the second vertex; determining a reference depth and pixel depth of a semi-transparent material region in the model to be processed, and determining visual display parameters of the semi-transparent material region based on the reference depth and the pixel depth; and rendering the model to be processed based on the contour outline data and the visual display parameters of the semi-transparent material region to obtain a target rendering model.

[0007] In one exemplary embodiment of this disclosure, the step of offsetting the first vertex of the model to be processed along the normal direction to determine the second vertex after the vertex position offset, and generating the contour outline data of the model to be processed based on the second vertex, includes: offsetting the first vertex of the model to be processed along the normal direction to obtain the second vertex after the vertex position offset; selecting a third vertex from the second vertex; wherein the third vertex is an invisible vertex relative to the virtual camera; and generating the contour outline data of the model to be processed based on the third vertex.

[0008] In one exemplary embodiment of this disclosure, the step of filtering out the third vertex from the second vertex includes: filtering out the third vertex from the second vertex according to a preset model mask.

[0009] In one exemplary embodiment of this disclosure, generating the outline stroke data of the model to be processed based on the third vertex includes: obtaining a preset stroke color; determining the stroke area of ​​the model to be processed based on the third vertex; and rendering the stroke area based on the preset stroke color to generate the outline stroke data of the model to be processed.

[0010] In one exemplary embodiment of this disclosure, the step of offsetting the vertex position of the first vertex of the model to be processed along the normal direction includes: obtaining a noise map of the model to be processed, determining an offset parameter based on the noise map, and offsetting the vertex position of the first vertex of the model to be processed along the normal direction according to the offset parameter.

[0011] In one exemplary embodiment of this disclosure, determining the visual display parameters of the semi-transparent material region based on the reference depth and the pixel depth includes: determining the visual display parameters of the semi-transparent material region based on a comparison result of the difference between the reference depth and the pixel depth of the semi-transparent material region.

[0012] In one exemplary embodiment of this disclosure, determining the visual display parameters of the semi-transparent material region based on the difference between the reference depth and the pixel depth of the semi-transparent material region includes: determining the visual display parameters of the semi-transparent material region based on the difference between the sum of the reference depth and the preset offset depth of the semi-transparent material region and the pixel depth.

[0013] In one exemplary embodiment of this disclosure, determining the visual display parameters of the semi-transparent material region based on the difference between the sum of the reference depth and the preset offset depth of the semi-transparent material region and the pixel depth includes: if the difference between the sum of the reference depth and the preset offset depth of the pixel in the semi-transparent material region and the pixel depth is less than 0, then adjusting the transparency display parameters of the pixel to invisible; if the difference between the sum of the reference depth and the preset offset depth of the pixel in the semi-transparent material region and the pixel depth is greater than 1, then adjusting the transparency display parameters of the pixel to visible.

[0014] According to one aspect of this disclosure, a rendering apparatus for a virtual model is provided, comprising: a model acquisition module for acquiring a model to be processed; a stroke data generation module for offsetting the position of a first vertex of the model to be processed along the normal direction, determining a second vertex after the vertex position offset, and generating contour stroke data of the model to be processed based on the second vertex; a display parameter determination module for determining a reference depth and pixel depth of a semi-transparent material region in the model to be processed, and determining visual display parameters of the semi-transparent material region based on the reference depth and pixel depth; and a model rendering module for rendering the model to be processed based on the contour stroke data and the visual display parameters of the semi-transparent material region to obtain a target rendering model.

[0015] According to one aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute a rendering method of a virtual model as described in any of the preceding claims by executing the executable instructions.

[0016] According to one aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the rendering method of the virtual model described in any of the preceding claims.

[0017] The exemplary embodiments disclosed herein have the following beneficial effects: Obtain the model to be processed; offset the first vertex of the model to be processed along the normal direction to determine the second vertex after the vertex position is offset, and generate the outline stroke data of the model to be processed based on the second vertex; determine the pixel depth and reference depth of the semi-transparent material area in the model to be processed, and determine the visual display parameters of the semi-transparent material area based on the pixel depth and reference depth; render the model to be processed based on the outline stroke data and the visual display parameters of the semi-transparent material area to obtain the target rendering model. On the one hand, this exemplary embodiment determines the pixel depth and reference depth of the semi-transparent material area and adjusts the visual display parameters based on the comparison results of the two. This can accurately determine the occlusion relationship of the semi-transparent area, effectively avoid the problem of mutual penetration between semi-transparent areas and chaotic display layers, and significantly improve the realism and sense of layering of the semi-transparent effect of the virtual model. On the other hand, this exemplary embodiment generates contour outline data by offsetting the first vertex of the model along the normal direction, and then completes the rendering by combining it with the semi-transparent visual display parameters. It can achieve a high-precision contour outline effect without modifying the rendering engine. This solves the problems of uneven outline and poor stability in the prior art, and avoids the defects of complex development and low compatibility caused by modifying the engine, thus improving the ease of use and adaptability of the rendering solution.

[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0020] Figure 1 A flowchart illustrating a rendering method for a virtual model in this exemplary embodiment is shown schematically. Figure 2 This schematic diagram illustrates a model that has not been rendered according to this exemplary embodiment. Figure 3 This schematic diagram illustrates a model rendered according to this exemplary embodiment. Figure 4 This schematic diagram illustrates a stroke outline data corresponding to the stroke displayed in this exemplary embodiment. Figure 5 This schematically illustrates a hair texture area in this exemplary embodiment that is not rendered using visual display parameters; Figure 6 This schematic diagram illustrates a hair texture area rendered using visual display parameters in this exemplary embodiment. Figure 7 This schematic diagram illustrates the structural block diagram of a rendering apparatus for a virtual model in this exemplary embodiment; Figure 8 An electronic device for implementing the above method is illustrated in this exemplary embodiment. Detailed Implementation

[0021] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0022] The exemplary embodiments disclosed herein first provide a method for rendering a virtual model.

[0023] The following is in conjunction with the appendix Figure 1 The exemplary embodiments will be further described as follows: Figure 1 As shown, the rendering method for a virtual model may include the following steps S110~S140: Step S110: Obtain the model to be processed.

[0024] The "model to be processed" refers to a virtual 3D model that needs to be rendered. It can be any model from a game, animation, or virtual simulation scene, such as a human body model, animal model, or object model. The model to be processed may include semi-transparent material areas, which are material models with a transparent texture display effect or layered display requirements, such as hair, gauze clothing, or plastic equipment. In this exemplary embodiment, the model to be processed can be a model that has already undergone initial rendering, such as a human body model in a game that has been initially rendered. It possesses the basic effects of a model but does not yet have outlining effects or the adjustment and optimization effects of semi-transparent materials.

[0025] This exemplary embodiment can use specific functional software to process the model to be processed. For example, the model to be processed or the file data of the model to be processed can be imported into a rendering engine (such as the UE5 engine), and the Overlay Material function can be used to perform the subsequent model rendering process.

[0026] Step S120: Offset the position of the first vertex of the model to be processed along the normal direction, determine the second vertex after the vertex position offset, and generate the outline data of the model to be processed based on the second vertex.

[0027] In this model, the first vertex can be the original vertex of the model to be processed. The normal direction refers to the inherent direction vector perpendicular to the surface of each vertex in the model to be processed. Vertex position offset refers to changing the spatial position of the first vertex according to a preset rule, causing the vertex to move outward or inward along the normal direction. The second vertex refers to the new vertex determined after offsetting the original vertex of the model to be processed. In this exemplary embodiment, the vertex normal data (VertexNormalWs) can be read through the WorldPositionOffset node in the rendering engine, the offset distance parameter can be set, the normal vector can be multiplied by the offset distance parameter, and then superimposed on the original vertex (i.e., the first vertex) position to obtain the offset vertex (i.e., the second vertex) position. For example, for each original first vertex corresponding to the hair area of ​​the human model, its normal vector can be read, the offset distance can be set, and the position coordinates of the offset second vertex can be calculated based on the normal vector and the offset distance.

[0028] Contour stroke data refers to data describing the contour lines of a model. This data may include the vertices constituting the contour stroke, vertex positions, stroke color, stroke thickness or variations in thickness, and stroke transparency. Applying contour stroke data to the model to be processed can make the model's edges appear outlined and prominent. This exemplary embodiment can generate contour stroke data for the model to be processed through vertex shader operations of the overlay material function. Specifically, the contour stroke data can be generated based on a second vertex after a vertex position offset. This contour stroke data can be viewed as generating an "shell" that can encompass the model to be processed, thereby enclosing the model.

[0029] Step S130: Determine the reference depth and pixel depth of the semi-transparent material area in the model to be processed, and determine the visual display parameters of the semi-transparent material area based on the reference depth and pixel depth.

[0030] Semi-transparent material areas refer to material models in the model that have a semi-transparent display effect, such as hair materials, sheer clothing materials, and plastic prop materials. After the model to be processed is imported into the rendering engine, the system can identify semi-transparent material areas and set different visual display parameters for different semi-transparent material areas. It can also default to semi-transparent material areas; for example, the hair of a human model can be set as a semi-transparent material area by default.

[0031] Pixel depth refers to the depth value of each pixel in the semi-transparent material area in screen space (which can be understood as the distance of a pixel from the virtual camera). Reference depth refers to a preset depth benchmark used for comparison, which can be regarded as a custom depth. In this exemplary embodiment, the rendering engine can calculate PixelDepth and CustomDepth separately. The sampling result can be a value between 0 and 1, with a larger value indicating a greater distance from the camera. Then, based on the difference between the reference depth and the pixel depth, the visual display parameters of the semi-transparent material area are determined. For example, in the semi-transparent area of ​​the hair model, the difference between the pixel depth corresponding to each pixel in the area and the reference depth is calculated, and based on the difference, it is determined whether the pixel is occluded. In this exemplary embodiment, the depth can be written through the Opacitymask node. The pixel depth and reference depth can be calculated by the engine or determined by other methods, such as pre-configuring a custom depth as the reference depth.

[0032] Visual display parameters refer to parameters that control the rendering effect of semi-transparent material areas. These can be pixel opacity / transparency, or the display hierarchy / order of different pixel areas, etc., which directly affect the visibility of the semi-transparent material area. This exemplary embodiment can use the depth comparison operation of the overlay material function to compare the pixel depth with the reference depth, or calculate the difference between the reference depth and the pixel depth, and output the visual display parameters for rendering. For example, when the pixel depth is less than the reference depth, it can be set to fully visible; when the pixel depth is greater than the reference depth, it can be set to completely invisible, achieving an "occlusion culling" effect. Alternatively, when the difference between the reference depth and the pixel depth is less than a first threshold (e.g., 0), it can be set to invisible; when the difference between the reference depth and the pixel depth is greater than a second threshold (e.g., 1), it can be set to visible, etc. It should be noted that this "occlusion culling" effect does not delete the semi-transparent material areas. Instead, it adjusts the transparency of the semi-transparent material areas without deleting the model, making them appear transparent (invisible) or opaque (visible). This ensures the correct display hierarchy of the semi-transparent material areas. For example, in the hair area, the bottom layer of hair is invisible, while the top layer of hair is visible, avoiding material layering or misalignment that could affect the display effect.

[0033] Step S140: Render the model to be processed based on the outline data and the visual display parameters of the semi-transparent material area to obtain the target rendering model.

[0034] In this exemplary embodiment, rendering can be a secondary rendering process that applies outline data and visual display parameters of the semi-transparent material area to the initially rendered model to be processed. The target rendering model is the final model that includes the correct semi-transparency effect and outline. This exemplary embodiment can determine the visual display parameters and outline data of the semi-transparent material area through the rendering engine's overlay material function, generate overlay material data based on these two data, and then apply the overlay material data to the model to be processed to output the target rendering model. For example, in the Overlay Material (named M_Outline), the normal data of the first vertex of the character model can be read through the World PositionOffset node, the offset distance can be set, and the vertex position can be offset to obtain the second vertex. Combined with the set outline color EmissiveColor or other outline data, outline outline data can be generated; a calculation node can be added to the hair material to calculate the visual display parameter Opacity through a formula; further, the engine first renders the semi-transparent material area of ​​the hair model (applying the calculated transparency parameter), and then renders the outline outline data through the Overlay Material channel. The two rendering results are superimposed to obtain a character model including the hair material with the correct semi-transparency effect and clear outline. Figure 2 The diagram shows a model that has not been rendered using this exemplary embodiment. It can be seen that it does not have an outline effect, and the hair layers are displayed in a disordered manner, with the bottom black hair pieces covering the top gray hair pieces on the outside. Figure 3 A schematic diagram of a model rendered according to this exemplary embodiment is shown. It can be seen that not only is the human body model outlined, but the layer display order of the hair area is also correctly displayed, avoiding the problem of material models going through layers.

[0035] Based on the above description, in this exemplary embodiment, a model to be processed is obtained; the first vertex of the model to be processed is offset along the normal direction to determine the second vertex after the vertex position offset, and the outline stroke data of the model to be processed is generated based on the second vertex; the pixel depth and reference depth of the semi-transparent material region in the model to be processed are determined, and the visual display parameters of the semi-transparent material region are determined based on the pixel depth and reference depth; the model to be processed is rendered based on the outline stroke data and the visual display parameters of the semi-transparent material region to obtain the target rendering model. On the one hand, this exemplary embodiment determines the pixel depth and reference depth of the semi-transparent material area and adjusts the visual display parameters based on the comparison results of the two. This can accurately determine the occlusion relationship of the semi-transparent area, effectively avoid the problem of mutual penetration between semi-transparent areas and chaotic display layers, and significantly improve the realism and sense of layering of the semi-transparent effect of the virtual model. On the other hand, this exemplary embodiment generates contour outline data by offsetting the first vertex of the model along the normal direction, and then completes the rendering by combining it with the semi-transparent visual display parameters. It can achieve a high-precision contour outline effect without modifying the rendering engine. This solves the problems of uneven outline and poor stability in the prior art, and avoids the defects of complex development and low compatibility caused by modifying the engine, thus improving the ease of use and adaptability of the rendering solution.

[0036] In an exemplary embodiment, the process of offsetting the first vertex of the model to be processed along the normal direction to determine the second vertex after the offset, and generating the contour outline data of the model to be processed based on the second vertex, may include: For the first vertex of the model to be processed, offset the vertex position along the normal direction to obtain the second vertex after the vertex position is offset. The third vertex is selected from the second vertex; the third vertex is an invisible vertex relative to the virtual camera. The contour outline data of the model to be processed is generated based on the third vertex.

[0037] Among them, the virtual camera can be a logical module in the virtual scene used to realize the shooting function. It may not have a physical object. Through the virtual camera, the display status of the model in the virtual scene can be "observed". It can be understood that the virtual scene can capture two-dimensional or three-dimensional images of the virtual model through the virtual camera.

[0038] Normally, when a model is rendered with only one side enabled (such as front-facing rendering), the model includes visible vertices (such as front-facing vertices) and invisible vertices (such as back-facing vertices). However, invisible vertices are not seen by the camera and do not participate in the vertex processing process. When multi-sided rendering is enabled (such as two-sided rendering), both visible and invisible vertices of the model can be rendered, and the invisible vertices of the model are made eligible to be processed. For example, back-facing vertices of the model can participate in the subsequent vertex processing process.

[0039] In this exemplary embodiment, multi-sided rendering can be enabled when generating contour outline data. For example, by enabling the Two Sided option for the material in the rendering engine, the back face vertices can be rendered. With multi-sided rendering enabled, the first vertex can be offset outward along the normal direction to obtain the second vertex. At this time, the second vertex can be obtained by offsetting all the original vertices of the model to be processed. Then, the third vertex can be selected from the second vertex, for example, by preset rules, manual selection, or masking logic. The third vertex can be a vertex that cannot be captured by the virtual camera, such as a vertex located on the back or rear side of the model, a vertex occluded by other parts of the model itself, or a vertex outside the view frustum of the virtual camera. The third vertex determines the specific position and shape of the outline of the model to be processed.

[0040] Finally, the outline stroke data of the model to be processed can be generated based on the third vertex to ensure that the stroke only appears on the edge of the model outline, avoiding the situation where the front vertex is stroked and causes occlusion of the front of the model, thus improving the accuracy of the stroke. The generation of the outline stroke data can combine the coordinate data of the third vertex and the stroke attributes. For example, the coordinate data of the third vertex can be bound with preset stroke color, thickness, transparency and other attributes. In the rendering engine, the stroke color is set through the EmissiveColor node, and the stroke thickness is controlled by the offset distance of World Position Offset. After integration, the outline stroke data is formed.

[0041] In addition, in this exemplary embodiment, to avoid the influence of lighting on the model, the material can be set to use a no-lighting mode during rendering.

[0042] In one exemplary embodiment, the above-described selection of a third vertex from the second vertex may include: Based on the preset model mask, the third vertex is selected from the second vertex.

[0043] A preset model mask can refer to a pre-created texture image (such as a mask map) or dataset used to filter model vertices or pixels. It can mark different regions of the model using color values ​​such as black, white, and gray, or Boolean values, with white areas indicating retention and black areas indicating removal. It can be drawn by artists using computer software tools or automatically generated by an engine. In this exemplary embodiment, the preset model mask can be a texture map used to filter back vertices (i.e., the third vertex) of the model.

[0044] By using the pre-defined model mask marking rules, the third vertex used for outlining can be accurately separated, avoiding excessive complexity in the filtering logic. In the material editor of the rendering engine, the pre-defined model mask can be connected to the Sampler 2D node to sample the mask color value corresponding to each second vertex. A threshold is set, and when the mask color value is greater than the threshold, the second vertex is retained as the third vertex; when the color value is less than or equal to the threshold, the vertex is discarded.

[0045] In an exemplary embodiment, the above-mentioned generation of contour outline data of the model to be processed based on the third vertex may include: Get the preset stroke color; The outline area of ​​the model to be processed is determined based on the third vertex; Based on the preset outline color, the outline area is rendered to generate the outline data of the model to be processed.

[0046] A preset stroke color refers to a pre-set color parameter used to render the outline stroke. It can be represented using color spaces such as RGB or HSV, and can be a single color, multiple colors, or a gradient, used to match the overall visual style of the model. Preset stroke colors can be obtained by directly inputting color values ​​in the engine's material editor, or by importing color maps, gradient maps, etc. In this exemplary embodiment, the preset stroke color can be a fixed color or dynamically controlled through parameterization; for example, the user can adjust the stroke color in real time according to the display effect. In this exemplary embodiment, the preset stroke color is controlled through the EmissiveColor node.

[0047] The stroke region refers to the pixel area that needs to be stroked, determined by the third vertex. For example, multiple triangular facets formed based on the third vertex, after rasterization by the graphics pipeline, correspond to a two-dimensional pixel area in screen space. The stroke region can represent the spatial position of the outline of the model to be processed after it has been extended outwards.

[0048] Finally, by binding the preset stroke color to the stroke area, the stroke area can be visually presented with the preset color, ultimately forming complete stroke outline data that includes geometric position (stroke area) and visual attributes (preset color).

[0049] In this exemplary embodiment, the outline stroke data may include various information, such as the area range of the stroke, the vertices constituting the stroke, the color of the stroke, the thickness of the stroke, or the thickness variation of the stroke, etc. The basic thickness of the stroke can be adjusted according to the vertex color data of the third vertex. The color of the edge line can be determined based on a preset color map and the ambient light intensity. For example, in the material editor, the color of a specific color map can be collected using the Color node, and combined with the ambient light intensity data collected by the EyeAdaptationInverse node, the color of the edge line can be determined.

[0050] In an exemplary embodiment, the above-mentioned vertex position offsetting of the first vertex of the model to be processed along the normal direction may include: Obtain the noise map of the model to be processed, and determine the offset parameters based on the noise map; According to the offset parameters, the first vertex of the model to be processed is offset along the normal direction.

[0051] The noise map can be an image containing a texture pattern, where the grayscale values ​​of the texture are irregularly distributed. This provides randomization parameters for vertex offsets, allowing for natural variations in stroke thickness and preventing overly regular strokes. In this exemplary embodiment, different regions of the model to be processed can have different noise maps; for example, the noise map for the hair model can be different from the noise map for the arm.

[0052] Offset parameters refer to the numerical values ​​that control the offset distance of a vertex along the normal direction. They can be determined based on a noise map, for example, by sampling the noise map and determining the offset distance based on the sampling results. Specifically, this exemplary embodiment can determine the offset parameter based on the grayscale values ​​of the noise map. For example, the grayscale values ​​of the noise map can be sampled, and the sampling results can be used as the final offset parameter. Alternatively, the sampling results can be multiplied by the base offset distance to obtain the final offset parameter. Different offset parameters for different vertices can create differentiated stroke thicknesses; for example, higher grayscale values ​​result in larger offset parameters and thicker strokes, while lower grayscale values ​​result in smaller offset parameters and thinner strokes. Alternatively, the grayscale values ​​in the noise map can be sampled first, and then the sampled grayscale values ​​can be mapped to a target offset range to calculate the offset parameter based on the target offset range.

[0053] In this exemplary embodiment, noise maps can be imported and grayscale values ​​sampled in the engine's material editor via the Sampler 2D node; the grayscale values ​​are multiplied by the base offset distance via the Multiply node to obtain the offset parameters of each first vertex; the offset parameters are multiplied by the vertex normal vector and superimposed onto the original vertex coordinates to complete the vertex position offset.

[0054] It should be noted that in this exemplary embodiment, the basic thickness of the stroke can be adjusted first based on the vertex color data of the model. For example, the basic offset parameters can be determined based on the vertex color data collected by the VertexColor node. Then, the basic offset parameters can be adjusted in combination with the noise map of the model so that the stroke can present different thickness variations according to the changes in the noise texture. Figure 4 This illustration shows a schematic diagram of the outline data corresponding to the outline displayed in this exemplary embodiment. It can be seen that the thickness of the outline can be different at different outline positions of the model.

[0055] In an exemplary embodiment, determining the visual display parameters of the semi-transparent material region based on the reference depth and pixel depth may include: The visual display parameters of the semi-transparent material area are determined based on the comparison between the reference depth and the pixel depth. The comparison result refers to the difference between the pixel depth and the reference depth of the semi-transparent material area, such as the depth difference or depth relationship. This comparison result can be used to determine the occlusion state between different pixels, thereby determining the visual display parameters. In the material editor, the difference between the pixel depth and the reference depth can be calculated through specific nodes. Options include calculating the difference (reference depth - pixel depth), the ratio (pixel depth / reference depth), or determining the size relationship (pixel depth > reference depth). For example, if a pixel in the hair area has a pixel depth of 0.6 and a reference depth of 0.5, the comparison result is determined to be a difference of 0.1, or pixel depth > reference depth.

[0056] Then, the difference can be used to determine whether a pixel is occluded, and the visual effect can be adjusted (such as transparency or displaying the occlusion hierarchy) to ensure the correctness of the semi-transparent effect. In this exemplary embodiment, in the material editor, the reference depth (CustomDepth) and pixel depth (PixelDepth) can be sampled first through the SceneTexture node. Then, the difference comparison result between the two (such as the difference value) can be calculated through the mathematical node. The difference comparison result is input into the transparency adjustment node, and the corresponding visual display parameters (such as transparency, opacity, or visibility) are output according to the result.

[0057] In an exemplary embodiment, determining the visual display parameters of the semi-transparent material region based on the comparison result of the difference between the reference depth and the pixel depth of the semi-transparent material region may include: The visual display parameters of the semi-transparent material area are determined by the difference between the sum of the reference depth and the preset offset depth of the semi-transparent material area and the pixel depth.

[0058] The preset offset depth can be a pre-set depth compensation value, a fixed constant, or it can be flexibly adjusted according to the model type and scene requirements to optimize the occlusion judgment accuracy of semi-transparent areas.

[0059] In this exemplary embodiment, a specific value for the preset offset depth can be set in the material editor. Generally, the more complex the model details, the larger the preset offset depth should be to avoid false occlusion detection; the simpler the model details, the smaller the value should be to ensure accurate detection. This exemplary embodiment can determine visual display parameters by calculating "reference depth + preset offset depth - pixel depth". For example, the formula for calculating the visual display parameter Opacity can be: Opacity = saturate(CustomDepth.r+ DepthBias - PixelDepth), where saturate represents a function node that can restrict the input value to the range [0,1]. If for any input value x, x < 0, then output 0, indicating that the reference depth + preset offset depth - pixel depth < 0, meaning that the pixel is occluded and needs to be made invisible; if 0 ≤ x ≤ 1, then output x; if x > 1, then output 1, indicating that the reference depth + preset offset depth - pixel depth > 1, meaning that the pixel is not occluded and needs to be made visible.

[0060] In one exemplary embodiment, the aforementioned visual display parameters are transparent display parameters; The visual display parameters of the semi-transparent material area, determined by the difference between the sum of the reference depth and the preset offset depth of the semi-transparent material area and the pixel depth, may include: If the difference between the sum of the reference depth and the preset offset depth of a pixel in the semi-transparent material area and the pixel depth is less than 0, then the pixel's transparency display parameter is adjusted to invisible. If the difference between the sum of the reference depth and the preset offset depth of a pixel in a semi-transparent material area and the pixel depth is greater than 1, then the pixel's transparency display parameter is adjusted to be visible.

[0061] The transparency parameter controls whether a semi-transparent material area is visible or occluded. It can be opacity (e.g., Opacity), with a value range of 0-1, where 0 represents completely invisible and 1 represents fully visible. This is used to achieve culling and transparency effects in semi-transparent areas. In the material editor, the transparency parameter value can be output via formulas or logical judgments. The calculation result is directly output to the material's Opacity node, controlling the pixel's transparency. For example, a transparency parameter of 1.0 for a semi-transparent hair pixel means the hair strand is completely transparent and visible; 0 means it's completely invisible; 0.5 means it's semi-transparent, allowing a glimpse of objects behind it; or a transparency parameter of 1.0 indicates the hair strand is on the top layer; 0 indicates it's on the bottom layer; and 0.5 indicates it's in the middle layer, etc.

[0062] In this exemplary embodiment, the transparency display parameters of the pixels can be adjusted according to the difference between the reference depth and the pixel depth. If the difference between the sum of the reference depth and the preset offset depth of the pixels in the semi-transparent material area and the pixel depth is greater than 1, it means that the pixel is not occluded and is set to visible. If the difference between the sum of the reference depth and the preset offset depth of the pixels in the semi-transparent material area and the pixel depth is less than 0, it means that the pixel is occluded and is set to invisible. This ensures the correctness of the semi-transparent sorting.

[0063] Figure 5 The diagram shows a hair texture area that has not been rendered using visual display parameters, revealing disordered color levels and poor display quality. Figure 6 The diagram shows a rendering of a hair texture area after applying visual display parameters. It can be seen that the hierarchical order of the hair area is logically reasonable, and the hair display effect is more natural.

[0064] Exemplary embodiments of this disclosure also provide a rendering apparatus for a virtual model. (Refer to...) Figure 7 The rendering device 700 for the virtual model may include: a model acquisition module 710 for acquiring the model to be processed; a stroke data generation module 720 for offsetting the first vertex of the model to be processed along the normal direction, determining the second vertex after the vertex position offset, and generating the outline stroke data of the model to be processed based on the second vertex; a display parameter determination module 730 for determining the reference depth and pixel depth of the semi-transparent material area in the model to be processed, and determining the visual display parameters of the semi-transparent material area based on the reference depth and pixel depth; and a model rendering module 740 for rendering the model to be processed based on the outline stroke data and the visual display parameters of the semi-transparent material area to obtain the target rendering model.

[0065] In an exemplary embodiment, the outline data generation module includes: a second vertex obtaining unit, used to offset the position of a first vertex of the model to be processed along the normal direction to obtain a second vertex after the vertex position offset; a third vertex filtering unit, used to filter out a third vertex from the second vertex; wherein the third vertex is an invisible vertex relative to the virtual camera; and an outline data generation unit, used to generate outline data of the model to be processed based on the third vertex.

[0066] In one exemplary embodiment, the third vertex filtering unit includes a mask filtering subunit, used to filter out the third vertex from the second vertices according to a preset model mask.

[0067] In an exemplary embodiment, the outline data generation unit includes: an outline color acquisition subunit for acquiring a preset outline color; an outline region determination subunit for determining the outline region of the model to be processed based on a third vertex; and an outline rendering subunit for rendering the outline region based on the preset outline color to generate outline data of the model to be processed.

[0068] In an exemplary embodiment, the outline data generation module includes: an offset parameter determination unit, configured to acquire a noise map of the model to be processed and determine an offset parameter based on the noise map; and a vertex offset unit, configured to offset the vertex position of the first vertex of the model to be processed along the normal direction according to the offset parameter.

[0069] In one exemplary embodiment, the display parameter determination module includes: a display parameter determination unit, configured to determine the visual display parameters of the semi-transparent material region based on a comparison result of the difference between the reference depth and the pixel depth of the semi-transparent material region.

[0070] In an exemplary embodiment, the display parameter determination unit includes a display parameter determination subunit, configured to determine the visual display parameters of the semi-transparent material region based on the difference between the sum of the reference depth and the preset offset depth of the semi-transparent material region and the pixel depth.

[0071] In an exemplary embodiment, the visual display parameter is a transparent display parameter; the display parameter determining subunit includes: a first adjustment subunit, configured to adjust the transparent display parameter of the pixel to be invisible if the difference between the sum of the reference depth and the preset offset depth of the pixel in the semi-transparent material region and the pixel depth is less than 0; and a second adjustment subunit, configured to adjust the transparent display parameter of the pixel to be visible if the difference between the sum of the reference depth and the preset offset depth of the pixel in the semi-transparent material region and the pixel depth is greater than 1.

[0072] The specific details of each part of the above-mentioned device have been described in detail in the method section of the implementation plan. For any undisclosed details, please refer to the implementation plan of the method section, and therefore will not be repeated here.

[0073] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to exemplary embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0074] Exemplary embodiments of this disclosure also provide a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the rendering method for the virtual model described above.

[0075] In one implementation, the computer program product can be a tangible product containing a computer program, such as a computer-readable storage medium storing the computer program. The readable storage medium can be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory, hard disk drive (HDD), solid-state drive (SSD), etc. For example, the computer program product can be implemented as a non-volatile storage medium storing a computer program, such as read-only memory, NAND flash memory, etc.

[0076] In one implementation, the computer program product can be an intangible product containing a computer program. For example, the computer program product can be implemented as a virtual digital product, such as an executable file, installation package, or other digital file storing the computer program.

[0077] Computer program code can be written in one or more programming languages. Examples of programming languages ​​include C, Java, and C++. Program code can execute entirely on the user's computing device, partially on the user's computing device, or as a standalone software package. It can also execute partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, such as a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via an internet connection provided by a mobile network operator).

[0078] Computer programs can be carried or transmitted via signals such as electricity, magnetism, light, electromagnetic fields, and infrared radiation. Electronic devices can convert the signals carrying computer programs into digital signals, thereby running the computer programs. When a computer program runs on an electronic device, its code is used to cause the electronic device to execute (more specifically, to execute) the method steps of various exemplary embodiments of this disclosure, such as the rendering method of the virtual model described above.

[0079] Exemplary embodiments of this disclosure also provide an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as program code. The processor executes the executable instructions to perform the methods of this exemplary embodiment. Furthermore, the electronic device may also include a display for displaying a graphical user interface.

[0080] The following is for reference. Figure 8 The electronic device is illustrated by way of a general-purpose computing device. It should be understood that... Figure 8 The electronic device 800 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0081] like Figure 8 As shown, the electronic device 800 may include: a processor 810, a memory 820, a bus 830, an I / O (input / output) interface 840, a network adapter 850, and a display 860.

[0082] The memory 820 may include volatile memory, such as RAM 821 and cache unit 822, and may also include non-volatile memory, such as ROM 823. The memory 820 may also include one or more program modules 824, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. For example, program module 824 may include the modules described above.

[0083] The processor 810 may include one or more processing units, such as an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor, and / or an NPU (Neural-Network Processing Unit).

[0084] The processor 810 can be used to execute executable instructions stored in the memory 820, such as the rendering method of the virtual model described above.

[0085] Bus 830 is used to connect different components of electronic device 800 and may include data bus, address bus and control bus.

[0086] Electronic device 800 can communicate with one or more external devices 900 (such as keyboard, mouse, external controller, etc.) through I / O interface 840.

[0087] Electronic device 800 can communicate with one or more networks via network adapter 850. For example, network adapter 850 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, and near-field communication. Network adapter 850 can communicate with other modules of electronic device 800 via bus 830.

[0088] Electronic device 800 can display a graphical user interface, etc., through display 860.

[0089] although Figure 8 As not shown in the diagram, other hardware and / or software modules may also be configured in the electronic device 800, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0090] As can be seen from the above, the technical solutions disclosed herein can be implemented as methods, apparatus, systems, computer program products, storage media, electronic devices, etc. Those skilled in the art will understand that various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be referred to as "circuit," "module," or "system," respectively.

[0091] It should be understood that this disclosure is not limited to the specific methods, steps, or structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. Those skilled in the art will readily conceive of other embodiments based on the specific implementations provided in this disclosure. Therefore, the specific implementations provided in this disclosure are merely exemplary, and the scope and spirit of this disclosure are indicated by the claims, and should cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary technical means in the art not disclosed in this disclosure.

[0092] Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be embodied in entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as “circuit,” “module,” or “system.” Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0093] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is defined only by the appended claims.

Claims

1. A method for rendering a virtual model, characterized in that, include: Obtain the model to be processed; The first vertex of the model to be processed is offset along the normal direction to determine the second vertex after the vertex position is offset, and the outline tracing data of the model to be processed is generated based on the second vertex. Determine the reference depth and pixel depth of the semi-transparent material region in the model to be processed, and determine the visual display parameters of the semi-transparent material region based on the reference depth and the pixel depth; Based on the outline data and the visual display parameters of the semi-transparent material area, the model to be processed is rendered to obtain the target rendering model.

2. The method according to claim 1, characterized in that, The step of offsetting the first vertex of the model to be processed along the normal direction to determine the second vertex after the vertex position offset, and generating the contour outline data of the model to be processed based on the second vertex, includes: For the first vertex of the model to be processed, offset the vertex position along the normal direction to obtain the second vertex after the vertex position is offset; A third vertex is selected from the second vertex; wherein the third vertex is an invisible vertex relative to the virtual camera; The contour outline data of the model to be processed is generated based on the third vertex.

3. The method according to claim 2, characterized in that, The step of selecting the third vertex from the second vertex includes: The third vertex is selected from the second vertex based on the preset model mask.

4. The method according to claim 2, characterized in that, The process of generating contour outline data for the model to be processed based on the third vertex includes: Get the preset stroke color; The outline region of the model to be processed is determined based on the third vertex; Based on the preset outline color, the outline area is rendered to generate the outline data of the model to be processed.

5. The method according to claim 1, characterized in that, The step of offsetting the first vertex of the model to be processed along the normal direction includes: Obtain the noise map of the model to be processed, and determine the offset parameters based on the noise map; According to the offset parameters, the first vertex of the model to be processed is offset along the normal direction.

6. The method according to claim 1, characterized in that, Determining the visual display parameters of the semi-transparent material area based on the reference depth and the pixel depth includes: Based on the comparison results of the difference between the reference depth and the pixel depth of the semi-transparent material area, the visual display parameters of the semi-transparent material area are determined.

7. The method according to claim 6, characterized in that, The step of determining the visual display parameters of the semi-transparent material region based on the comparison result of the difference between the reference depth and the pixel depth of the semi-transparent material region includes: The visual display parameters of the semi-transparent material area are determined based on the difference between the sum of the reference depth and the preset offset depth of the semi-transparent material area and the pixel depth.

8. The method according to claim 7, characterized in that, The visual display parameters are transparent display parameters; The step of determining the visual display parameters of the semi-transparent material region based on the difference between the sum of the reference depth and the preset offset depth of the semi-transparent material region and the pixel depth includes: If the difference between the sum of the reference depth and the preset offset depth of the pixel in the semi-transparent material area and the pixel depth is less than 0, then the transparency display parameter of the pixel is adjusted to invisible. If the difference between the sum of the reference depth and the preset offset depth of the pixel in the semi-transparent material region and the pixel depth is greater than 1, then the transparency display parameter of the pixel is adjusted to be visible.

9. A rendering apparatus for a virtual model, characterized in that, include: The module for acquiring models to be processed is used to acquire models to be processed. The outline data generation module is used to offset the first vertex of the model to be processed along the normal direction, determine the second vertex after the vertex position offset, and generate the outline data of the model to be processed based on the second vertex. The display parameter determination module is used to determine the reference depth and pixel depth of the semi-transparent material area in the model to be processed, and to determine the visual display parameters of the semi-transparent material area based on the reference depth and the pixel depth. The model rendering module is used to render the model to be processed based on the outline data and the visual display parameters of the semi-transparent material area to obtain the target rendering model.

10. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the rendering method of the virtual model according to any one of claims 1-8 by executing the executable instructions.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the rendering method of the virtual model according to any one of claims 1-8.